mftsccs-browser 2.1.96-beta → 2.1.97-beta
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/main.bundle.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var e={1735:(e,t,n)=>{n.d(t,{J:()=>a});var o,i=n(2370),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static incrementConcept(e){try{e&&(this.conceptsData[e]=(this.conceptsData[e]||0)+1)}catch(e){console.error("Failed on increment concept")}}static incrementConnection(e){try{e&&(this.connectionsData[e]=(this.connectionsData[e]||0)+1)}catch(e){console.error("Failed on increment connection")}}static getTopConcepts(e){return Object.entries(this.conceptsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static getTopConnections(e){return Object.entries(this.connectionsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static saveDataToLocalStorage(){const e={concepts:this.conceptsData,connections:this.connectionsData};null===localStorage||void 0===localStorage||localStorage.setItem(this.accessData,JSON.stringify(e))}static loadDataFromLocalStorage(){const e=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(this.accessData);if(e){const t=JSON.parse(e);this.conceptsData=t.concepts||{},this.connectionsData=t.connections||{}}}static sendToServer(){return c(this,void 0,void 0,(function*(){try{yield this.syncToServer()}catch(e){console.error("Failed to process Access Tracker Sync with Server")}}))}static syncToServer(){return c(this,void 0,void 0,(function*(){try{if(!Object.keys(this.conceptsData).length&&!Object.keys(this.connectionsData).length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.conceptsData&&Object.keys(this.conceptsData).length>0?this.conceptsData:{},n=this.connectionsData&&Object.keys(this.connectionsData).length>0?this.connectionsData:{},o=yield fetch(i.BaseUrl.PostPrefetchConceptConnections(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({concepts:t,connections:n})});if(!o.ok)throw new Error("Failed to sync data to the server.");yield o.json(),this.conceptsData={},this.connectionsData={},this.setNextSyncTime()}catch(e){console.error("Sync error:",e)}}))}static setNextSyncTime(){this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS}static startAutoSync(){setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&this.syncNow().catch(console.error)}),6e4)}static syncNow(){return c(this,void 0,void 0,(function*(){try{this.activateStatus?yield this.syncToServer():console.warn("Access Tracker inactive.")}catch(e){console.error("Error on sync access tracker")}}))}static GetSuggestedConcepts(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,n=new URL(i.BaseUrl.GetSuggestedConcepts());void 0!==e&&n.searchParams.append("top",e.toString());const o=yield fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const e=yield o.text();throw new Error(`Failed to load concepts: ${o.status} ${o.statusText}. Details: ${e}`)}const c=(yield o.json())||[];return yield this.addConceptToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested concepts:",e.message),new Error("Unable to fetch suggested concepts. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested concepts."))}}))}static GetSuggestedConnections(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,n=new URL(i.BaseUrl.GetSuggestedConnections());void 0!==e&&n.searchParams.append("top",e.toString());const o=yield fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const e=yield o.text();throw new Error(`Failed to load connections: ${o.status} ${o.statusText}. Details: ${e}`)}const c=(yield o.json())||[];return yield this.addConnectionToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested Connections:",e.message),new Error("Unable to fetch suggested connections. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested Connections."))}}))}static addConceptToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConceptsData.AddConcept(e)}))}catch(e){console.error("Error on adding Concepts Data into tree")}}))}static addConnectionToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConnectionData.AddConnection(e)}))}catch(e){console.error("Error on adding Connections Data into tree")}}))}}o=a,a.conceptsData={},a.connectionsData={},a.SYNC_INTERVAL_MS=12e4,a.nextSyncTime=Date.now(),a.activateStatus=!1,a.accessData="Access Data",o.startAutoSync()},1167:(e,t,n)=>{n.d(t,{Y:()=>s});var o=n(9581),i=n(3518),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,void 0,void 0,(function*(){const t=r.Logger.logfunction("CreateTheConceptApi",e);let n=(0,r.CreateDefaultConcept)();try{var a=(0,i.Xr)();const s=yield fetch(o.B.CreateTheConceptUrl(),{method:"POST",headers:a,body:JSON.stringify(e)});if(!s.ok)throw(0,c.ry)(s),new Error(`Error! status: ${s.status}`);return n=yield s.json(),r.Logger.logUpdate(t),n}catch(e){e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),(0,c.Mb)(e,o.B.CreateTheConceptUrl()),(0,c.ey)(t,"CreateTheConceptApi",e)}}))}},2:(e,t,n)=>{n.d(t,{s:()=>d});var o=n(8286),i=n(9581),r=n(1412),c=n(3518),a=n(1863),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=s.Logger.logfunction("GetAllConnectionsOfComposition",t);var i=[];if(0==(i=yield o.d.GetConnectionsOfConcept(e)).length)i=yield h(e);else{var c=yield h(e);(0,r.e)(c,i),i=c}return s.Logger.logUpdate(n),i}))}function h(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=s.Logger.logfunction("GetAllConnectionsOfCompositionOnline",t);var r=[];try{(0,c.Xr)("application/json");const t=new Headers,d=new FormData;d.append("composition_id",e.toString());const h=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:t,body:d});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!h.ok)throw(0,a.ry)(h),new Error(`Error! status: ${h.status}`);const u=yield h.json();for(var l=0;l<u.length;l++)o.d.AddConnection(u[l]),r.push(u[l]);return s.Logger.logUpdate(n),r}catch(e){e instanceof Error?console.log("Get all connection of composition error : ",e.message):console.log("Get all connection of composition error : ",e),(0,a.Mb)(e,i.B.GetAllConnectionsOfCompositionUrl()),(0,a.ey)(n,"GetAllConnectionsOfCompositionOnline",e)}}))}},8642:(e,t,n)=>{n.d(t,{Y:()=>u});var o=n(8286),i=n(9581),r=n(4364),c=n(5284),a=n(1412),s=n(3518),l=n(1863),d=n(2370),h=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function u(){var e=arguments;return h(this,arguments,void 0,(function*(t=[]){const n=d.Logger.logfunction("GetAllConnectionsOfCompositionBulk",e)||{};if(d.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:t});return d.Logger.logUpdate(n),e.data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,l.ey)(n,"GetAllConnectionsOfCompositionBulk",e),(0,d.handleServiceWorkerException)(e)}}var u=[];if(t.length<=0)return u;var p=yield(0,c.B)(t),f=yield function(){var e=arguments;return h(this,arguments,void 0,(function*(t=[]){const n=d.Logger.logfunction("GetAllConnectionsOfCompositionOnline",e);var r=[];try{var c=(0,s.Xr)();const e=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:c,body:JSON.stringify(t)});if(e.ok){const t=yield e.json();for(var a=0;a<t.length;a++)o.d.AddConnection(t[a]),r.push(t[a])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.ry)(e);return d.Logger.logUpdate(n),r}catch(e){e instanceof Error?console.log("Get all connections of composition bulk error message: ",e.message):console.log("Get all connections of composition bulk unexpected error: ",e),(0,l.Mb)(e,i.B.GetAllConnectionsOfCompositionBulkUrl()),(0,l.ey)(n,"GetAllConnectionsOfCompositionOnline",e)}}))}(t);return u=f,(0,a.e)(u,p),yield(0,r.s)(u),d.Logger.logUpdate(n),u}))}},2803:(e,t,n)=>{n.d(t,{x:()=>s});var o=n(8286),i=n(9581),r=n(1863),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e,t,n){var s=arguments;return a(this,void 0,void 0,(function*(){const a=c.Logger.logfunction("GetCompositionConnectionsBetweenTwoConcepts",s)||{};var l=[];try{if(c.serviceWorker){a.serviceWorker=!0;try{const o=yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:n});return c.Logger.logUpdate(a),o.data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,r.ey)(a,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,c.handleServiceWorkerException)(e)}}var d=new FormData;d.append("ofConceptId",e.toString()),d.append("mainKey",n.toString()),d.append("toConceptId",t.toString());const s=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:d,redirect:"follow"});if(s.ok){const e=yield s.json();for(var h=0;h<e.length;h++)o.d.AddConnection(e[h]),l.push(e[h]);c.Logger.logUpdate(a)}else console.log("Get composition connection between two concepts",s.status),(0,r.ry)(s)}catch(e){e instanceof Error?console.log("Get composition connection between two concepts error message: ",e.message):console.log("Get composition connection between two concepts unexpected error: ",e),(0,r.Mb)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl()),(0,r.ey)(a,"GetCompositionConnectionsBetweenTwoConcepts",e)}return l}))}},7139:(e,t,n)=>{n.d(t,{r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(2370),a=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){var t=arguments;return s(this,void 0,void 0,(function*(){const n=c.Logger.logfunction("GetConcept",t)||{};try{if(c.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,c.sendMessage)("GetConcept",{id:e});return c.Logger.logUpdate(n),t.data}catch(e){console.error("GetConcept sw error: ",e),(0,a.ey)(n,"GetConcept",e),(0,c.handleServiceWorkerException)(e)}}let t=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return t;var s=yield o.I.GetConcept(e);let l=o.I.GetNpc(e);if(0!=s.id||l)return c.Logger.logUpdate(n),s;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const s=new FormData;s.append("id",e.toString());const l=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:s});return l.ok?(t=yield l.json(),t.id>0?o.I.AddConcept(t):o.I.AddNpc(e)):(console.log("Get the concept error",l.status),(0,a.ry)(l)),c.Logger.logUpdate(n),t}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,a.Mb)(e,i.B.GetConceptUrl()),(0,a.ey)(n,"GetConcept",e)}}))}},1239:(e,t,n)=>{n.d(t,{I:()=>d,r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){return s(this,void 0,void 0,(function*(){const t=a.Logger.logfunction("GetConceptBulk",[e.length])||{};let n=[],s=((new Date).getTime(),performance.now()),l=Array.from(new Set(e));try{if(a.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,a.sendMessage)("GetConceptBulk",{passedConcepts:e});return a.Logger.logUpdate(t),n.data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,c.ey)(t,"GetConceptBulk",e),(0,a.handleServiceWorkerException)(e)}}if(l.length>0){let d=[];for(let e=0;e<l.length;e++)0==(yield o.I.GetConcept(l[e])).id&&d.push(l[e]);if(0==d.length)return a.Logger.logfunction(t),n;{let l=(0,r.Xr)();const h=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:l,body:JSON.stringify(d)});if(h.ok){if(n=yield h.json(),n.length>0)for(let e=0;e<n.length;e++){let t=n[e];o.I.AddConcept(t)}console.log("added the concepts"),a.Logger.logUpdate(t)}else console.log("Get Concept Bulk error",h.status),a.Logger.logError(s,"unknown","read","unknown",void 0,h.status,h,"GetConceptBulk",[e],"unknown",void 0),(0,c.ry)(h)}}}catch(n){n instanceof Error?console.log("Get Concept Bulk error message: ",n.message):console.log("Get Concept Bulk unexpected error: ",n),a.Logger.logError(s,"unknown","read","unknown",void 0,500,n,"GetConceptBulk",[e],"unknown",void 0),(0,c.Mb)(n,i.B.GetConceptBulkUrl()),(0,c.ey)(t,"GetConceptBulk",n)}return n}))}function d(e){return s(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const n={"Content-Type":"application/json"};try{const r=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok){const e=yield r.json();if(e.length>0)for(let n=0;n<e.length;n++){const i=e[n];t.push(i),o.I.AddConcept(i)}}else console.log("bulk concept getter api error: ",r.status),(0,c.ry)(r)}catch(e){e instanceof Error?console.log("bulk concept getter api error: ",e.message):console.log("bulk concept getter api error: ",e),(0,c.Mb)(e,i.B.GetConceptBulkUrl())}}return t}))}},4402:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t){var n=arguments;return s(this,void 0,void 0,(function*(){const s=a.Logger.logfunction("GetConceptByCharacterAndType",n);try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,a.handleServiceWorkerException)(e)}let n=yield o.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==n||0==n.id){var l={character_value:`${e}`,type_id:t},d=JSON.stringify(l),h=(0,r.Xr)();const a=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:h,body:d});a.ok?(n=yield a.json(),o.I.AddConcept(n)):((0,c.ry)(a),console.log("This is the concept by type and character error",a.status))}return a.Logger.logUpdate(s),n}catch(e){e instanceof Error?console.log(" This is the concept by type and character error message: ",e.message):console.log(" This is the concept by type and character unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterAndTypeUrl()),(0,c.ey)(s,"GetConceptByCharacterAndType",e)}}))}},8146:(e,t,n)=>{n.d(t,{Y:()=>s});var o=n(9639),i=n(9581),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("GetConceptByCharacterValue",t);let a=(0,r.CreateDefaultConcept)();try{const t=new FormData;t.append("character_value",e);const s=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:t});s.ok?(a=yield s.json(),a.id>0&&o.I.AddConcept(a),r.Logger.logUpdate(n)):((0,c.ry)(s),console.log("Error in Getting concept by character value Error",s.status))}catch(e){e instanceof Error?console.log("Error in Getting concept by character value error message: ",e):console.log("Error in Getting concept by character value unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterValueUrl()),(0,c.ey)(n,"GetConceptByCharacterValue",e)}return a}))}},7467:(e,t,n)=>{n.d(t,{j:()=>d});var o=n(8286),i=n(9581),r=n(4364),c=n(3518),a=n(1863),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){const t=s.Logger.logfunction("GetConnectionBulk",e.length)||{};let n=[];try{if(s.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("GetConnectionBulk",{connectionIds:e});return s.Logger.logUpdate(t),n.data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,a.ey)(t,"GetConnectionBulk",e),(0,s.handleServiceWorkerException)(e)}}if(e.length>0){let r=[];for(let t=0;t<e.length;t++){let i=yield o.d.GetConnection(e[t]);0==i.id?r.push(e[t]):n.push(i)}if(0==r.length)return s.Logger.logUpdate(t),n;{let e=(0,c.Xr)();const l=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(r)});if(l.ok){const e=yield l.json();if(e.length>0)for(let t=0;t<e.length;t++){let i=e[t];n.push(i),o.d.AddConnection(i)}}else(0,a.ey)(t,"GetConnectionBulk",l.status),(0,a.ry)(l),console.log("Get Connection Bulk error",l.status);s.Logger.logUpdate(t)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,a.ey)(t,"GetConnectionBulk",e),(0,a.Mb)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(n),n}))}},2832:(e,t,n)=>{n.d(t,{j:()=>s});var o=n(2370),i=n(9581),r=n(1863),c=n(3518),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,arguments,void 0,(function*(e,n=""){const a=o.Logger.logfunction("SearchLinkMultipleApi",t);let s=performance.now();var l=(0,c.ab)("application/json",n);const d=i.B.SearchLinkMultipleAllApiUrl(),h=JSON.stringify(e);try{const t=yield fetch(d,{method:"POST",headers:l,body:h});if(t.ok){let e=yield t.json();return o.Logger.logUpdate(a),e}return(0,r.ry)(t),console.log("This is the searching multiple error",t.status),o.Logger.logError(s,"unknown","search","unknown",void 0,t.status,t,"SearchLinkMultipleApi",[e,n],"unknown",void 0),[]}catch(t){console.log("This is the searching multiple error",t),o.Logger.logError(s,"unknown","search","unknown",void 0,500,t,"SearchLinkMultipleApi",[e,n],"unknown",void 0),(0,r.Mb)(t,d),(0,r.ey)(a,"SearchLinkMultipleApi",t)}}))}},3130:(e,t,n)=>{n.d(t,{BG:()=>s,SL:()=>l,XZ:()=>a,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>o});const o=1,i=2,r=3,c=4,a=5,s=6,l=7},9635:(e,t,n)=>{n.d(t,{x:()=>o});const o=new BroadcastChannel("Freeschema_mftsccs_browser_channel")},9581:(e,t,n)=>{n.d(t,{B:()=>o});class o{static setRandomizer(e){console.log("set randomizer",e),this.BASE_RANDOMIZER=e}static getRandomizer(){return this.BASE_RANDOMIZER}static GetConceptUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/getConcept":this.NODE_CACHE_URL+"/api/getConcept"}static GetConnectionUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get-connection-by-id":this.NODE_CACHE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get_concept_bulk":this.NODE_CACHE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get_connection_bulk":this.NODE_CACHE_URL+"/api/get_connection_bulk"}static GetAllConceptsOfUserUrl(){return this.BASE_URL+"/api/get_all_concepts_of_user"}static GetAllConnectionsOfUserUrl(){return this.BASE_URL+"/api/get_all_connections_of_user"}static GetAllConnectionsOfCompositionUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition"}static GetAllConnectionsOfCompositionBulkUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition_bulk"}static GetConceptByCharacterValueUrl(){return this.BASE_URL+"/api/get_concept_by_character_value"}static GetConceptByCharacterAndTypeUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_type"}static GetConceptByCharacterAndCategoryUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category"}static GetConceptByCharacterAndCategoryDirectUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category_direct"}static GetCharacterByCharacterUrl(){return this.BASE_URL+"/api/get_character_by_character"}static GetAllConceptsByTypeUrl(){return this.BASE_URL+"/api/get_all_concepts_by_type"}static GetAllConnectionsOfConceptUrl(){return this.BASE_URL+"/api/get-link-connections"}static GetAllAiData(){return this.BASE_URL+"/api/get-preloaded-concepts"}static getMyCacheServer(){return this.NODE_URL+"/api/v1/cache-server"}static PostPrefetchConceptConnections(){return this.NODE_URL+"/api/v1/access-tracker/sync-access-tracker"}static GetSuggestedConcepts(){return this.NODE_URL+"/api/v1/access-tracker/list-concepts-file"}static GetSuggestedConnections(){return this.NODE_URL+"/api/v1/access-tracker/list-connections-file"}static PostLogger(){return this.LOG_SERVER+"/api/logger"}static GetAllPrefetchConnectionsUrl(){return this.BASE_URL+"/api/get_all_connections_of_user?inpage=500"}static GetAllLinkerConnectionOfConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-from-concept"}static GetAllLinkerConnectionToConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-to-concept"}static DeleteConceptUrl(){return this.BASE_URL+"/api/delete_concept"}static DeleteUserUrl(){return this.BASE_URL+"/api/deleteuser"}static RecursiveSearchUrl(){return this.BASE_URL+"/api/recursivesearch-concept-connection"}static SearchLinkMultipleAllApiUrl(){return this.BASE_URL+"/api/Connection/search-link-multiple-all-ccs"}static MakeTheNameInBackendUrl(){return this.BASE_URL+"/api/make-name-from-frontend"}static SearchAllTypeWithLinker(e=!0){return e?this.BASE_URL+"/api/search-all-with-linker-ccs":this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static LoginUrl(){return this.BASE_URL+"/api/auth/login"}static SignupUrl(){return this.BASE_URL+"/api/auth/signup"}static GetCompositionConnectionBetweenTwoConceptsUrl(){return this.BASE_URL+"/api/get-composition-connection-between-two-concepts"}static SearchCompositionsUrl(){return this.BASE_URL+"/api/search-compositions"}static SearchLinkMultipleAll(){return this.BASE_URL+"/api/Connection/search-link-multiple-all"}static CreateSessionId(){return this.BASE_URL+"/api/create-session-id-remote"}static CreateSessionVisitUrl(){return this.BASE_URL+"/api/create-remote-session-visit"}static ViewInternalDataUrl(){return this.BASE_URL+"/api/view-api-internal-data-ccs-id-bulk"}static SearchInternalWithAuthenticatedCcsUrl(){return this.BASE_URL+"/api/search-composition-internal-authenticated-ccs"}static SearchInternalWithCcsUrl(){return this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static CreateGhostConceptApiUrl(){return o.NODE_URL+"/api/v1/local-concepts"}static CreateGhostConnectionApiUrl(){return o.NODE_URL+"/api/v1/local-connections"}static GetRealConceptById(){return o.NODE_URL+"/api/v1/local-concepts-translate"}static GetReservedIdUrl(){return this.BASE_URL+"/api/get_reserved_ids"}static GetReservedConnectionIdUrl(){return this.BASE_URL+"/api/get_reserved_connection_ids"}static CreateTheTextDataUrl(){return this.BASE_URL+"/api/create_text_data"}static CreateTheCharacterDataUrl(){return this.BASE_URL+"/api/create_character_data"}static CreateTheConceptUrl(){return this.BASE_URL+"/api/create_the_concept"}static CreateTheConnectionUrl(){return this.BASE_URL+"/api/create_the_connection"}static CreateTheConnectionNewUrl(){return this.BASE_URL+"/api/create_the_connection_new"}static MakeTheTypeConceptUrl(){return this.BASE_URL+"/api/make_the_type_concept"}static DeleteTheConnectionUrl(){return this.BASE_URL+"/api/delete_connection"}static FreeschemaQueryUrl(){return this.BASE_URL+"/api/freeschema-query"}static uploadImageUrl(){return this.BASE_URL+"/api/Image/UploadImage"}static uploadFileUrl(){return this.BASE_URL+"/api/Image/UploadFile"}static sendMail(){return this.BASE_URL+"/api/sendmail"}static sendBulkMail(){return this.BASE_URL+"/api/sendmail/bulk"}static getWidgetData(){return this.BASE_URL+"/api/get-widget"}static getLatestWidgetData(){return this.BASE_URL+"/api/get-latest-widget"}static getConnectionsByTypes(){return this.BASE_URL+"/api/get-connection-by-types"}static CreatePrototypeUrl(){return this.BASE_URL+"/api/create-prototype"}}o.BASE_URL="https://localhost:7053/",o.NODE_CACHE_URL="",o.AI_URL="https://ai.freeschema.com",o.MQTT_URL="192.168.1.249",o.NODE_URL="http://localhost:5001",o.LOG_SERVER="https://logdev.freeschema.com",o.BASE_APPLICATION="",o.FLAGS={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1},o.BASE_RANDOMIZER=999},6963:(e,t,n)=>{n.d(t,{f:()=>c});var o=n(205),i=n(6731),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isCharacterLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static addNodeToTree(e){return r(this,void 0,void 0,(function*(){return null==this.characterRoot?(this.characterRoot=e,this.characterRoot):(this.characterRoot=this.characterRoot.addCharacterNode(e,this.characterRoot,this.characterRoot.height),this.characterRoot)}))}static removeNodeByCharacter(e,t){return r(this,void 0,void 0,(function*(){this.characterRoot&&this.characterRoot.removeNodeWithVariants(this.characterRoot,e,t)}))}static countNumberOfNodes(){return this.characterRoot?this.characterRoot.countNodeBelow(this.characterRoot):0}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.b(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getNodeFromTreeUpdated(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getCharacterAndTypeFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndCategory(e,t,this.characterRoot):this.characterRoot}))}static removeConceptCharacter(e){this.characterRoot&&(this.characterRoot=this.characterRoot.removeNode(this.characterRoot,e))}}c.characterRoot=null},2202:(e,t,n)=>{n.d(t,{W:()=>s});var o=n(6963),i=n(6731),r=n(205),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static addConceptToTree(e){let t=new i.b(e.id,e,null,null),n=new i.b(e.characterValue,e,null,null);o.f.addNodeToTree(n),this.addNodeToTree(t)}static getNodeFromTree(e){return a(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return a(this,void 0,void 0,(function*(){if(this.root){let t=new Event(`${e}`);console.log("this is the fired event after delete",t),(0,c.dispatchIdEvent)(e),this.root=this.root.removeNode(this.root,e)}}))}static getConceptListFromIds(e,t,n){return a(this,void 0,void 0,(function*(){this.root&&this.root.checkIfIdsInNode(this.root,e,t,n)}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}s.root=null},5457:(e,t,n)=>{n.d(t,{c:()=>s});var o=n(2370),i=n(7282),r=n(205);class c{constructor(e,t){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=null,this.rightNode=null,this.currentNode=null}addType(e,t,n){var o,i,r,a;if(null==e)return new c(t,n);if(t<e.key)e.leftNode=this.addType(e.leftNode,t,n);else{if(!(t>e.key))return e.value.push(n),e;e.rightNode=this.addType(e.rightNode,t,n)}e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1;const s=this.getBalanceFactor(e);return s>1&&t<(null===(o=e.leftNode)||void 0===o?void 0:o.key)?this.rightRotate(e):s<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):s>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):s<-1&&t<(null===(a=e.rightNode)||void 0===a?void 0:a.key)?(e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)):e}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.value.length>0)for(let t=0;t<e.value.length;t++)if(n==e.value[t])return e.value.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static addType(e){return a(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,o.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root):(new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,o.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root=this.root.addType(this.root,e.key,e.value[0]),this.root)}))}static addConceptToTree(e){if(0!=e.typeId){let t=new c(e.typeId,e.id);this.addType(t)}}static removeTypeConcept(e,t){this.root&&(this.root=this.root.removeNodeWithVariants(this.root,e,t))}static getNodeFromTreeNew(e){return this.root?this.root.getFromNode(e,this.root):this.root}static getTypeVariantsFromTreeNew(e){return a(this,void 0,void 0,(function*(){let t=this.getNodeFromTreeNew(e),n=[],i=[];if(t){n=t.value;for(let e=0;e<n.length;e++){let t=!1;for(let o=0;o<i.length;o++)i[o].id==n[e]&&(t=!0);t||i.push(yield(0,o.GetTheConcept)(n[e]))}}return i}))}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isTypeLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return a(this,void 0,void 0,(function*(){let n=[],o=yield this.getTypeVariantsFromTreeNew(e);console.log("these are all the concepts",o);for(let e=0;e<o.length;e++)o[e].userId==t&&n.push(o[e]);return n}))}static getTypeVariantsWithCharacterValueNew(e,t){return a(this,void 0,void 0,(function*(){let n=yield this.getTypeVariantsFromTreeNew(t);console.log("this is all the concepts for character",n);let o=(0,i.o)();for(let t=0;t<n.length;t++)n[t].characterValue==e&&(o=n[t]);return o}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}s.typeRoot=null,s.root=null},2615:(e,t,n)=>{n.d(t,{j:()=>i});var o=n(2370);class i{constructor(e,t,n,i,r,c,a,s=!1,l,d,h){this.count=0,this.typeCharacter="",this.referent=null,this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=o.BaseUrl.getRandomizer(),this.x=0,this.y=0,this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=i,this.referentId=r,this.characterValue=`${c}`,this.accessId=a,this.typeCharacter=h,this.type=null,this.isNew=s,this.entryTimeStamp=l,this.updatedTimeStamp=d}getType(){console.log(this.typeId)}}},9639:(e,t,n)=>{n.d(t,{I:()=>d});var o=n(3655),i=n(2202),r=n(6963),c=n(5457),a=n(7282),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{constructor(){this.name="conceptsArray"}static CheckContains(e){for(var t=!1,n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].id==e.id&&(t=!0);return t}static AddNpc(e){this.NPC.includes(e)||(this.NPC.length>10&&(this.NPC=[]),this.NPC.push(e))}static GetNpc(e){return!!this.NPC.includes(e)}static AddConceptToStorage(e){e.id>0&&(0,o.kH)("concept",e)}static GetConceptBulkData(e,t,n){return l(this,void 0,void 0,(function*(){yield i.W.getConceptListFromIds(e,t,n)}))}static AddConcept(e){if(s.serviceWorker)try{(0,s.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,s.handleServiceWorkerException)(e)}e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptTemporary(e){var t=this.CheckContains(e);this.conceptDictionary[e.id]=e,t&&this.RemoveConcept(e),this.conceptsArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsArray.length;t++)this.conceptsArray[t].id==e.id&&this.conceptsArray.splice(t,1);(0,o.wh)("concept",e.id)}static GetConcept(e){return l(this,void 0,void 0,(function*(){if(s.serviceWorker)try{return(yield(0,s.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,s.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,a.o)();var t=(0,a.o)(),n=yield i.W.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return l(this,void 0,void 0,(function*(){var t=(0,a.o)(),n=r.f.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterUpdated(e){return l(this,void 0,void 0,(function*(){var t=(0,a.o)(),n=r.f.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return l(this,void 0,void 0,(function*(){return(0,a.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var n=(0,a.o)(),o=yield r.f.getCharacterAndCategoryFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptsByTypeId(e){let t=[];for(var n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].typeId==e&&t.push(this.conceptsArray[n]);return t}static GetConceptsByTypeIdAndUser(e,t){var n=arguments;return l(this,void 0,void 0,(function*(){if(s.Logger.logfunction("ConceptsData.GetConceptsByTypeIdAndUser",n),s.serviceWorker)try{return(yield(0,s.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,s.handleServiceWorkerException)(e)}let o=[];return o=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),o}))}static GetBinaryCharacterTree(){return r.f.characterRoot}getName(){return this.name}}d.conceptsArray=[],d.NPC=[],d.conceptDictionary=[]},2155:(e,t,n)=>{n.d(t,{N:()=>r});var o=n(7282),i=n(9581);class r{constructor(e=0,t,n,r,c,a,s){this.count=0,this.isTemp=!1,this.toUpdate=!1,this.applicationId=i.B.getRandomizer(),this.type=(0,o.o)(),this.ofConcept=(0,o.o)(),this.toConcept=(0,o.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.userId=r,this.typeId=c,this.ghostId=e,this.orderId=a,this.accessId=s,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,n)=>{n.d(t,{O:()=>a});var o=n(205),i=n(2370);class r{constructor(e,t,n,o){this.leftNode=null,this.rightNode=null,this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let n=!1;e.value.id==t.value.id&&(n=!0);for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}getMax(e,t){return e>t?e:t}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(e.key<t.key)t.leftNode=this.addNode(e,o,n);else{if(!(e.key>t.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}throw console.log("this is the error in right rotation",e,t),new Error("Cannot perform right rotation: left node is null.")}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}throw console.log("this is the error in left rotation",e,t),new Error("Cannot perform left rotation: right node is null.")}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){try{if(t)return e==t.key?(t.value.count?t.value.count++:t.value.count=1,t):e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t}catch(n){console.log("this is the exception",e,t,null==t?void 0:t.leftNode,null==t?void 0:t.rightNode)}return t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}checkIfIdsInNode(e,t,n,o){if(e){if(t.includes(e.key)){n.push(e.value);let o=t.indexOf(e.key);t.splice(o,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,n,o),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,n,o)}}traverse(e){let t=0;return e&&(t+=1,(null==e?void 0:e.leftNode)&&(t+=this.traverse(e.leftNode)),e.rightNode&&(t+=this.traverse(e.rightNode))),t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(new Event(`${e.value.ofTheConceptId}`),(0,i.dispatchIdEvent)(e.value.ofTheConceptId),null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static addNodeToTree(e){try{if(null==this.connectionroot)return this.connectionroot=e,this.connectionroot;this.connectionroot=this.connectionroot.addNode(e,this.connectionroot,this.connectionroot.height)}catch(e){throw console.log("This is the error in making the tree",e),e}}static addConnectionToTree(e){let t=new r(e.id,e,null,null);this.addNodeToTree(t)}static traverse(){var e;return null===(e=this.connectionroot)||void 0===e?void 0:e.traverse(this.connectionroot)}static waitForDataToLoad(){return c(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isConnectionLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return c(this,void 0,void 0,(function*(){try{return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}catch(t){console.log("this is the getNodeFromTree",e,this.connectionroot)}}))}static getConnectionListFromIds(e,t,n){return c(this,void 0,void 0,(function*(){this.connectionroot&&this.connectionroot.checkIfIdsInNode(this.connectionroot,e,t,n)}))}}a.connectionroot=null},991:(e,t,n)=>{n.d(t,{H:()=>a});var o=n(2370),i=n(3996);class r extends i.i{constructor(e,t,n,o){super(e,t,n,o),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static CreateCompositionKey(e,t){return e}static GetConnectionByOfTheConceptAndTypeId(e,t){let n=this.CreateCompositionKey(e,t);if(this.node){let e=this.node.getFromNode(n,this.node);if(e)return e.value}return null}static addConnection(e){if(e.id>0){let t=this.CreateCompositionKey(e.ofTheConceptId,e.typeId);if(this.node){let n=this.node.getFromNode(t,this.node);if(n){let t=null==n?void 0:n.value;0==t.length&&(n.value=[]),t.includes(e.id)||t.push(e.id)}else{let n=[];n.push(e.id);let o=new r(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new r(t,n,null,null);this.addNodeToTree(o)}new Event(`${t}`)}else console.log("cannot insert key id with n 0 to the connection tree",e)}static addNodeToTree(e){return c(this,void 0,void 0,(function*(){return null==this.node?(this.node=e,(0,o.dispatchIdEvent)(e.key),this.node):(this.node=this.node.addNode(e,this.node,this.node.height),this.node)}))}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.node&&(this.node=this.node.removeNode(this.node,e))}))}}a.node=null},3996:(e,t,n)=>{n.d(t,{i:()=>o});class o{constructor(e,t,n,o){this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},8286:(e,t,n)=>{n.d(t,{d:()=>f});var o=n(1735),i=n(2370),r=n(3655),c=n(1863),a=n(2155),s=n(5239),l=n(991),d=n(3996);class h extends d.i{constructor(e,t,n,o){super(e,t,n,o),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}class u{static CreateCompositionKey(e){return e}static addNodeToTree(e){return t=this,n=void 0,i=function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=e,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addNode(e,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{s(i.next(e))}catch(e){r(e)}}function a(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}s((i=i.apply(t,n||[])).next())}));var t,n,o,i}static addConnectionToTree(e){if(e.id>0){let t=this.CreateCompositionKey(e.typeId);if(this.connectionTypeRoot){let n=this.connectionTypeRoot.getFromNode(t,this.connectionTypeRoot);if(n){let t=null==n?void 0:n.value;0==t.length&&(n.value=[]),t.includes(e.id)||t.push(e.id)}else{let n=[];n.push(e.id);let o=new h(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new h(t,n,null,null);this.addNodeToTree(o)}}else console.log("cannot insert key id with n 0 to the connection tree",e)}static GetConnectionByOfTheConceptAndTypeId(e,t){let n=this.CreateCompositionKey(t);if(this.connectionTypeRoot){let e=this.connectionTypeRoot.getFromNode(n,this.connectionTypeRoot);if(e)return e.value}return null}}u.connectionTypeRoot=null;var p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class f{constructor(){this.name="Connection Array"}static CheckContains(e){let t=!1;for(let n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e.id&&(t=!0);return t}static AddConnectionToStorage(e){(0,r.kH)("connection",e)}static AddConnection(e){try{s.O.addConnectionToTree(e),u.addConnectionToTree(e),l.H.addConnection(e)}catch(e){throw console.log("this is the error in making the connection"),e}}static AddConnectionToMemory(e){e.isTemp||(s.O.addConnectionToTree(e),u.addConnectionToTree(e),l.H.addConnection(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&((0,r.wh)("connection",e.id),s.O.removeNodeFromTree(e.id),l.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){l.H.node}static GetConnectionByOfTheConceptAndType(e,t){return p(this,void 0,void 0,(function*(){try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionByOfTheConceptAndType",{ofTheConceptId:e,typeId:t})).data}catch(e){console.error("GetConnectionByOfTheConceptAndType sw error: ",e),(0,i.handleServiceWorkerException)(e)}return l.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){const n=i.Logger.logfunction("ConnectionData.GetConnectionByOfType",arguments);let o=u.GetConnectionByOfTheConceptAndTypeId(e,t);return o?(i.Logger.logUpdate(n),o):(i.Logger.logUpdate(n),[])}static GetConnectionTree(){return s.O.connectionroot}static GetConnectionTypeTree(){return u.connectionTypeRoot}static GetConnectionBulkData(e,t,n){return p(this,void 0,void 0,(function*(){yield s.O.getConnectionListFromIds(e,t,n)}))}static GetConnection(e){return p(this,void 0,void 0,(function*(){o.J.incrementConnection(e);let t=new a.N(0,0,0,0,0,0,0);try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnection",{id:e})).data}catch(e){console.error("GetConnection sw error: ",e),(0,i.handleServiceWorkerException)(e)}let n=yield s.O.getNodeFromTree(e);if(null==n?void 0:n.value){let e=n.value;e&&(t=e)}return t}catch(e){return console.log("this is the error in GetConnection",e),t}}))}static GetConnectionsOfCompositionLocal(e){var t=arguments;return p(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("ConnectionData.GetConnectionsOfCompositionLocal",t)||{};let o=[];try{if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,c.ey)(n,"GetConnectionsOfCompositionLocal",e),(0,i.handleServiceWorkerException)(e)}}let t=[];t=f.GetConnectionByOfType(e,e);for(let e=0;e<t.length;e++){let r=yield s.O.getNodeFromTree(t[e]);r&&o.push(r.value),i.Logger.logUpdate(n)}}catch(t){console.log("this is the error GetConnectionsOfCompositionLocal",e,o),(0,c.ey)(n,"ConnectionData.GetConnectionsOfCompositionLocal",t)}return o}))}static GetConnectionsOfConcept(e){return p(this,void 0,void 0,(function*(){let t=[],n=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfConcept",{id:e})).data}catch(e){console.error("GetConnectionsOfConcept sw error: ",e),(0,i.handleServiceWorkerException)(e)}t=yield f.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<t.length;e++){let o=yield s.O.getNodeFromTree(t[e]);o&&n.push(o.value)}return n}catch(e){return console.log("this is the error in GetConnectionsOfConcept",e),n}}))}getName(){return this.name}}f.connectionArray=[],f.connectionDictionary=[]},205:(e,t,n)=>{n.d(t,{B:()=>o});class o{}o.isTypeLoaded=!1,o.isCharacterLoaded=!1,o.isDataLoaded=!1,o.isLocalDataLoaded=!1,o.isLocalCharacterLoaded=!1,o.isLocalTypeLoaded=!1,o.isConnectionLoaded=!1,o.isConnectionTypeLoaded=!1,o.isLocalConnectionLoaded=!1},2515:(e,t,n)=>{n.d(t,{x:()=>o});class o{constructor(e,t,n,o){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;var n=!1;for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addCharacterNode(e,t,n){if(""!=e.value.characterValue){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}updateNodeSyncStatus(e,t,n){if(n){if(e==n.key){let e=n.value;return e.isSynced=t,n.value=e,n}return e<n.key?this.updateNodeSyncStatus(e,t,n.leftNode):e>n.key?this.updateNodeSyncStatus(e,t,n.rightNode):n}return n}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.typeId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.typeId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndType(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndType(e,t,n.rightNode)}return null}return n}getFromNodeWithCharacterAndCategory(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.categoryId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.categoryId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.rightNode)}return null}return n}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var n=this.inOrderSuccessor(e.rightNode);return e.value=n.value,e.key=n.key,e.variants=n.variants,e.currentNode=n.currentNode,e.rightNode=this.removeNode(e.rightNode,n.key),e}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){var o=e.variants[0];if(o)return e.value=o.value,e.key=o.key,e.currentNode=o.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var i=this.inOrderSuccessor(e.rightNode);return e.value=i.value,e.key=i.key,e.variants=i.variants,e.currentNode=i.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,i.key,n),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},9736:(e,t,n)=>{n.d(t,{v:()=>C});var o=n(205),i=n(2515),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.id,e,null,null);new i.x(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static getCharacterAndTypeFromTree(e,t){return this.root?this.root.getFromNodeWithCharacterAndType(e,t,this.root):this.root}static updateSyncStatus(e){return this.root?this.root.updateNodeSyncStatus(e,!0,this.root):this.root}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null;var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalCharacterLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static addNodeToTree(e){return a(this,void 0,void 0,(function*(){return null==this.LocalCharacterRoot?(this.LocalCharacterRoot=e,this.LocalCharacterRoot):(this.LocalCharacterRoot=this.LocalCharacterRoot.addCharacterNode(e,this.LocalCharacterRoot,this.LocalCharacterRoot.height),this.LocalCharacterRoot)}))}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.x(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.LocalCharacterRoot?this.LocalCharacterRoot.getCharacterFromNode(e,this.LocalCharacterRoot):this.LocalCharacterRoot}static getCharacterAndTypeFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static getCharacterAndCategoryFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndCategory(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(e,t){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,e,t))}}s.LocalCharacterRoot=null;var l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{static addNodeToTree(e){return l(this,void 0,void 0,(function*(){return null==this.LocalTypeRoot?(this.LocalTypeRoot=e,this.LocalTypeRoot):(this.LocalTypeRoot=this.LocalTypeRoot.addTypeNode(e,this.LocalTypeRoot,this.LocalTypeRoot.height),this.LocalTypeRoot)}))}static addConceptToTree(e){if(0!=e.typeId){var t=new i.x(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeConceptType(e,t){this.LocalTypeRoot&&(this.LocalTypeRoot=this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,e,t))}static getNodeFromTree(e){return this.LocalTypeRoot?this.LocalTypeRoot.getFromNode(e,this.LocalTypeRoot):this.LocalTypeRoot}static getTypeVariantsFromTree(e){var t=this.getNodeFromTree(e),n=[];if(t){n.push(null==t?void 0:t.value);for(let e=0;e<t.variants.length;e++)n.push(t.variants[e].value);return n}}static waitForDataToLoad(){return l(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalTypeLoaded)return e("done");setTimeout(d.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return l(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(e);if(o){console.log("this is the node to type",o),o.value.userId!=t&&999!=o.value.userId||n.push(null==o?void 0:o.value);for(let e=0;e<o.variants.length;e++)o.variants[e].value.userId!=t&&999!=o.value.userId||n.push(o.variants[e].value)}return n}))}}d.LocalTypeRoot=null;var h=n(6416),u=n(9639),p=n(7820),f=n(4864),y=n(628),v=n(2370),g=n(3278),m=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class C{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&(c.addConceptToTree(e),s.addConceptToTree(e),d.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(c.removeNodeFromTree(e.ghostId),s.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId),p.G.addConceptToTree(e),u.I.AddConcept(e),(0,v.AddGhostConcept)(e,e.userId,g.b.sessionId))}static RemoveConcept(e){return m(this,void 0,void 0,(function*(){try{0!=e.id&&(c.removeNodeFromTree(e.ghostId),s.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return m(this,void 0,void 0,(function*(){try{let t=yield C.GetConcept(e);0!=t.id&&(c.removeNodeFromTree(e),s.removeConceptType(t.characterValue,t.ghostId),d.removeConceptType(t.typeId,t.ghostId),y.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(c.addConceptToTree(e),s.addConceptToTree(e),d.addConceptToTree(e))}static GetConcept(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=yield c.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static UpdateConceptSyncStatus(e){return m(this,void 0,void 0,(function*(){c.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=yield p.G.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=s.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return m(this,void 0,void 0,(function*(){var n=(0,h.u)(),o=yield s.getCharacterAndTypeFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptByCharacterAndCategoryLocal(e,t){return m(this,void 0,void 0,(function*(){var n=(0,h.u)(),o=yield s.getCharacterAndCategoryFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptsByTypeId(e){let t=[];for(var n=0;n<this.localconceptsArray.length;n++)this.localconceptsArray[n].typeId==e&&t.push(this.localconceptsArray[n]);return t}static GetConceptsByTypeIdAndUser(e,t){return m(this,void 0,void 0,(function*(){let n=[];return n=yield d.getTypeVariantsFromTreeWithUserId(e,t),n}))}static ClearData(){return m(this,void 0,void 0,(function*(){this.localconceptsArray=[],f.G.connectionArray=[]}))}getName(){return this.name}}C.localconceptsArray=[]},4864:(e,t,n)=>{n.d(t,{G:()=>s});var o=n(2155),i=n(8286),r=n(205),c=n(628),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{constructor(){this.name="Connection Array"}static CheckContains(e){for(var t=!1,n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e.id&&(t=!0);return t}static AddConnection(e){this.CheckContains(e)&&this.RemoveConnection(e),e.id,this.connectionArray.push(e)}static AddConnectionToMemory(e){this.CheckContains(e)&&this.RemoveConnection(e),this.connectionArray.push(e)}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e.id&&this.connectionArray.splice(t,1);e.id}static RemoveConnectionById(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e&&this.connectionArray.splice(t,1);c.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&i.d.AddConnection(function(e){let t=new o.N(0,0,0,0,0,0,0);return t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.typeId=e.typeId,t.orderId=e.orderId,t.id=e.id,t}(e))}static GetConnection(e){var t;t=null;for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e&&(t=this.connectionArray[n]);return t}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isLocalConnectionLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return a(this,void 0,void 0,(function*(){var t=[];try{for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].typeId==e&&t.push(this.connectionArray[n]);return t}catch(e){return t}}))}static GetConnectionOfCompositionAndTypeLocal(e,t){return a(this,void 0,void 0,(function*(){var n=[];try{for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].typeId==e&&this.connectionArray[o].ofTheConceptId==t&&n.push(this.connectionArray[o]);return n}catch(e){return n}}))}getName(){return this.name}}s.connectionArray=[],s.connectionDictionary=[]},7820:(e,t,n)=>{n.d(t,{G:()=>c});var o=n(205),i=n(2515),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.ghostId,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null},5257:(e,t,n)=>{n.d(t,{R:()=>c});var o=n(9003),i=n(3075),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static AddConceptId(e){this.localId=e.value,(0,o.kH)("localid",e)}static getConceptId(){return r(this,void 0,void 0,(function*(){try{if(this.localId){if(this.ReservedLocalId.length<5){yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let n=this.localId-t;this.ReservedLocalId.push(n),e=n}this.AddConceptId({id:0,value:e})})).catch((e=>(console.log(" getid: cannot get the id from indexdb"),-Math.floor(1e8*Math.random()))));let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}{let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}}return yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let n=this.localId-t;this.ReservedLocalId.push(n),e=n}this.AddConceptId({id:0,value:e})})),this.getConceptId()}catch(e){return console.log(" getid: this is the eror in concept",e),-Math.floor(1e8*Math.random())}}))}static AddConnectionId(e){this.localConnectionId=e.value}static getConnectionId(){return r(this,void 0,void 0,(function*(){try{if(this.localConnectionId){if(this.ReservedConnectionId.length<5){yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let n=this.localConnectionId-t;this.ReservedConnectionId.push(n),e=n}})).catch((e=>(console.log("this is the new event",e),-Math.floor(1e8*Math.random()))));let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}{let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}}return yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let n=this.localConnectionId-t;this.ReservedConnectionId.push(n),e=n}this.AddConnectionId({id:1,value:e})})),this.getConnectionId()}catch(e){return-Math.floor(1e8*Math.random())}}))}}c.ReservedLocalId=[],c.ReservedConnectionId=[]},628:(e,t,n)=>{n.d(t,{H:()=>y});var o=n(9581),i=n(3278),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const s=(e,t)=>a(void 0,void 0,void 0,(function*(){let n={concepts:[],connections:[]};try{const r=new Headers;let a={concepts:e,connections:t};r.set("Content-Type","application/json"),r.set("Authorization","Bearer "+i.b.BearerAccessToken),r.set("Accept","application/json"),r.set("Randomizer",o.B.getRandomizer().toString());const s=yield fetch(o.B.CreateGhostConceptApiUrl(),{method:"POST",headers:r,body:JSON.stringify(a)});if(!s.ok)throw(0,c.ry)(s),new Error(`Error! status: ${s.status}`);const l=yield s.json();return n.concepts=l.concepts,n.connections=l.connections,n}catch(e){throw e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),e}}));function l(e,t){const n=[];for(let o=0;o<e.length;o+=t){const i=e.slice(o,o+t);n.push(i)}return n}const d=(...e)=>a(void 0,[...e],void 0,(function*(e=[]){return yield Promise.all(e.map((e=>{let t=JSON.parse(JSON.stringify(e));return delete t.type,delete t.ofConcept,delete t.toConcept,t})))}));var h=n(9003),u=n(9736),p=n(4864),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class y{static CheckContains(e){for(var t=!1,n=0;n<this.conceptsSyncArray.length;n++)this.conceptsSyncArray[n].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,n=0;n<this.connectionSyncArray.length;n++)this.connectionSyncArray[n].id==e.id&&(t=!0);return t}static AddConcept(e){try{let t=!1;0!=y.CheckIfTheConceptIdExists(e.id,this.conceptsSyncArray).id&&(t=!0),t||this.conceptsSyncArray.push(e)}catch(e){throw e}}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static SyncDataOnline(e,t){return f(this,void 0,void 0,(function*(){let n=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,r.handleServiceWorkerException)(e)}let n=[],o=[];if(e&&this.transactionCollections.some((t=>t.id==e))){const t=this.transactionCollections.find((t=>t.id==e));if(this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e)),this.transactionCollections=this.transactionCollections.filter((e=>new Date(e.createdDate).getTime()>(new Date).getTime()-6048e5)),!t)return;n=t.data.concepts.slice(),o=t.data.connections.slice()}else Array.isArray(null==t?void 0:t.concepts)&&Array.isArray(null==t?void 0:t.connections)?(console.log("this is the concepts and connections array",null==t?void 0:t.concepts,null==t?void 0:t.connections),n=t.concepts.filter((e=>this.conceptsSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),o=t.connections.filter((e=>this.connectionSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),console.log("this is the concepts and connections array",n,o),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>e.id==t.id||e.ghostId==t.ghostId)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>e.id==t.id||e.ghostId==t.ghostId))))):(console.warn("Syncing this way has been Depreceted in service worker."),console.info("Only if serive worker is not running"),n=this.conceptsSyncArray.slice()||[],o=this.connectionSyncArray.slice()||[]);this.connectionSyncArray=[],this.conceptsSyncArray=[];let i=[];for(let e=0;e<n.length;e++)i.push(n[e]),yield u.v.UpdateConceptSyncStatus(n[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(o,i);let h=yield function(e,t){return a(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("CreateTheGhostConceptApi",[e.length,t.length]);try{const o=1e3;let i={concepts:[],connections:[]};const c=yield d(e),a=yield d(t);if(e.length+t.length<=2*o){const e=yield s(c,a);return Array.isArray(null==e?void 0:e.concepts)&&(i.concepts=[...i.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(i.connections=[...i.connections,...e.connections]),r.Logger.logUpdate(n),i}const h=l(c,o),u=l(a,o),p=[],f=[];for(let e=0;e<h.length;e++){const t=h[e];p.push(s(t,[]))}const y=yield Promise.all(p);for(let e=0;e<y.length;e++){const t=y[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}for(let e=0;e<u.length;e++){const t=u[e];f.push(s([],t))}const v=yield Promise.all(f);for(let e=0;e<v.length;e++){const t=v[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}return r.Logger.logUpdate(n),i}catch(e){throw console.log(e),(0,c.ey)(n,"CreateTheGhostConceptApi",e),e}}))}(i,o),f=h.concepts,y=h.connections;for(let e=0;e<f.length;e++)u.v.AddPermanentConcept(f[e]);for(let e=0;e<y.length;e++)p.G.AddPermanentConnection(y[e]);return n}catch(e){throw r.Logger.logError(n,"unknown",void 0,"unknown",void 0,500,e,"SyncDataOnline",[],"unknown",void 0),e}}))}static ConvertGhostIdsInConnections(e){var t,n,o;for(let i=0;i<e.length;i++){let r=e[i].ofTheConceptId,c=e[i].toTheConceptId,a=e[i].typeId,s=null!==(t=y.ghostIdMap.get(r))&&void 0!==t?t:r,l=null!==(n=y.ghostIdMap.get(c))&&void 0!==n?n:c,d=null!==(o=y.ghostIdMap.get(a))&&void 0!==o?o:a;e[i].ofTheConceptId=s,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return f(this,void 0,void 0,(function*(){for(let n=0;n<e.length;n++){let o=e[n].ofTheConceptId,i=e[n].toTheConceptId,r=e[n].typeId;if(o<0){let i=this.CheckIfTheConceptIdExists(o,t);0==i.id&&(i=yield u.v.GetConceptByGhostId(o),0!=i.id?i.id!=i.ghostId&&(e[n].ofTheConceptId=i.id):(i=yield u.v.GetConcept(o),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let o=this.CheckIfTheConceptIdExists(i,t);0==o.id&&(o=yield u.v.GetConceptByGhostId(i),0!=o.id?o.id!=o.ghostId&&(e[n].toTheConceptId=o.id):(o=yield u.v.GetConcept(i),this.AddConceptIfDoesNotExist(o,t)))}if(r<0){let o=this.CheckIfTheConceptIdExists(r,t);0==o.id&&(o=yield u.v.GetConceptByGhostId(r),0!=o.id?o.id!=o.ghostId&&(e[n].typeId=o.id):(o=yield u.v.GetConcept(r),this.AddConceptIfDoesNotExist(o,t)))}}}))}static AddConceptIfDoesNotExist(e,t=[]){let n=!1;for(let o=0;o<t.length;o++)e.ghostId==t[o].ghostId&&(n=!0);n||t.push(e)}static CheckIfTheConceptIdExists(e,t=[]){let n=(0,r.CreateDefaultLConcept)();for(let o=0;o<t.length;o++)e!=t[o].ghostId&&e!=t[o].id||(n=t[o]);return n}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static RemoveConnectionById(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e&&this.connectionSyncArray.splice(t,1)}static syncDataLocalDb(){return f(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,h.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,h.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections.push({id:e,data:{concepts:[],connections:[]},createdDate:(new Date).toISOString()})}catch(e){console.log("error in initializeTransaction",e)}}))}static markTransactionActions(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,r.handleServiceWorkerException)(e)}this.transactionCollections=this.transactionCollections.map((n=>n.id==e?Object.assign(Object.assign({},n),{data:JSON.parse(JSON.stringify(t))}):n)),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>t.id==e.id||t.ghostId==e.id)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>t.id==e.id||t.ghostId==e.id))))}catch(e){console.log("error in markTransactionActions",e)}}))}static rollbackTransaction(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e))}catch(e){console.log("LocalSyncData, roll",e)}}))}}y.conceptsSyncArray=[],y.connectionSyncArray=[],y.ghostIdMap=new Map,y.transactionCollections=[]},6731:(e,t,n)=>{n.d(t,{b:()=>o});class o{constructor(e,t,n,o){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let n=!1;for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}checkIfIdsInNode(e,t,n,o){if(e){if(t.includes(e.key)){n.push(e.value);let o=t.indexOf(e.key);t.splice(o,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,n,o),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,n,o)}}addCharacterNode(e,t,n){if(""!=e.value.characterValue){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return console.log("adding the type node to the tree",e),e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return console.log("adding the type node to the tree down",e),t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),console.log("adding the type node to the tree last",t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getCharacterFromNodeUpdated(e,t){var n;return t?e==t.key||51==(null===(n=t.value)||void 0===n?void 0:n.typeId)?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.typeId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.typeId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndType(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndType(e,t,n.rightNode)}return null}return n}getFromNodeWithCharacterAndCategory(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.categoryId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.categoryId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.rightNode)}return null}return n}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},5976:(e,t,n)=>{n.d(t,{p:()=>l,B:()=>s});var o=n(9581),i=n(3518),r=n(1863),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static getId(){return a(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){var e,t,n,a,l=arguments;return e=this,t=void 0,a=function*(){const e=c.Logger.logfunction("GetReservedIds",l);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const n=yield fetch(o.B.GetReservedIdUrl(),{method:"GET",headers:t});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);const a=yield n.json();for(let e=0;e<a.length;e++)s.AddId(a[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved ids error message: ",t.message):console.log("get reserved ids unexpected error: ",t),(0,r.Mb)(t,o.B.GetReservedIdUrl()),(0,r.ey)(e,"GetReservedIds",t)}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}s.ids=[];class l{static getId(){return a(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){var e,t,n,a,s=arguments;return e=this,t=void 0,a=function*(){const e=c.Logger.logfunction("GetReservedConnectionIds",s);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const n=yield fetch(o.B.GetReservedConnectionIdUrl(),{method:"GET",headers:t});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);const a=yield n.json();for(let e=0;e<a.length;e++)l.AddId(a[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),(0,r.Mb)(t,o.B.GetReservedConnectionIdUrl()),(0,r.ey)(e,"GetReservedConnectionIds",t)}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}l.connectionIds=[]},7273:(e,t,n)=>{n.d(t,{z:()=>i});var o=n(9581);class i{constructor(e,t,n,i){this.url=o.B.BASE_URL,this.message=e,this.ok=t,this.status=n,this.data=i}getMessage(){return this.message}setMessage(e){return this.message=e,this}getStatus(){return this.status}setStatus(e){return this.status=e,this}getData(){return this.data}setData(e){return this.data=e,this}getOk(){return this.ok}setOk(e){return this.ok=e,this}getUrl(){return this.url}setUrl(e){return this.url=e,this}}},3278:(e,t,n)=>{n.d(t,{b:()=>o});class o{}o.BearerAccessToken="",o.sessionId=998},2299:(e,t,n)=>{n.d(t,{B:()=>o});class o{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}},442:(e,t,n)=>{n.d(t,{Y:()=>h});var o=n(1167),i=n(2155),r=n(9581),c=n(3518),a=n(1863),s=n(9639),l=n(8286),d=n(2370);class h{static CheckContains(e){for(var t=!1,n=0;n<this.conceptsSyncArray.length;n++)this.conceptsSyncArray[n].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,n=0;n<this.connectionSyncArray.length;n++)this.connectionSyncArray[n].id==e.id&&(t=!0);return t}static AddConcept(e){this.conceptsSyncArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static SyncDataOnline(){return e=this,t=void 0,h=function*(){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,d.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)s.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)l.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,o.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,n=void 0,s=function*(){let t=new i.N(0,0,0,0,0,0,0);try{var n=(0,c.Xr)(),o=JSON.stringify(e);const i=yield fetch(r.B.CreateTheConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?yield i.json():(console.log("Create the connection error message: ",i.status),(0,a.ry)(i)),t}catch(e){throw e instanceof Error?console.log("Create the connection error message: ",e.message):console.log(" Create the connection unexpected error: ",e),e}},new((o=void 0)||(o=Promise))((function(e,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,c)}a((s=s.apply(t,n||[])).next())}));var t,n,o,s}(e)}return"done"},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(h.next(e))}catch(e){i(e)}}function c(e){try{a(h.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}a((h=h.apply(e,t||[])).next())}));var e,t,n,h}}h.conceptsSyncArray=[],h.connectionSyncArray=[]},9003:(e,t,n)=>{n.d(t,{S5:()=>l,kH:()=>h,qI:()=>s});var o=n(1863),i=n(2370),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};let c=10;class a{}function s(e){const t=i.Logger.logfunction("openDatabase",arguments);return new Promise((function(n,r){a.db&&(i.Logger.logUpdate(t),n(a.db));let l=i.BaseUrl.BASE_URL+"_FreeSchemaLocal"+i.BaseUrl.BASE_APPLICATION;const h=indexedDB.open(l,c);h.onupgradeneeded=e=>{var t=e.target.result,o="localconcept",r="localconnection",a="localid";console.log("this is the version upgrade",c),t.objectStoreNames.contains(o)&&t.deleteObjectStore(o),t.objectStoreNames.contains(r)&&t.deleteObjectStore(r),t.objectStoreNames.contains(a)&&t.deleteObjectStore(a),t.objectStoreNames.contains(o)||(t.createObjectStore(o,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(r)||(t.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(a)||(t.createObjectStore(a,{keyPath:"id"}).transaction.oncomplete=e=>{d(a,{id:0,value:-100}),d(a,{id:1,value:-200}),d(a,{id:3,value:i.BaseUrl.getRandomizer()})}),n(t)},h.onerror=n=>{console.error("Why didn't you allow my web app to use IndexedDB?!",n),indexedDB.deleteDatabase(l),s(e),(0,o.ey)(t,"openDatabase",n),r(n)},h.onsuccess=function(e){var o=e.target;a.db=o.result,i.Logger.logUpdate(t),n(a.db)}}))}function l(e){var t=arguments;return r(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("getObjectsFromLocalIndexDb",t);return new Promise((function(t,r){s(e).then((o=>{var r=[],c=o.transaction(e,"readwrite").objectStore(e).getAll();c.onsuccess=()=>{const e=c.result;for(var o=0;o<e.length;o++)r.push(e[o]);i.Logger.logUpdate(n),t(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e};(0,o.ey)(n,"getObjectsFromLocalIndexDb",t),r(t)}))}))}))}function d(e,t){const n=i.Logger.logfunction("storeToDatabase",[e,"localindexdb"]);return new Promise((function(r,c){s(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).add(t);s.onsuccess=e=>{i.Logger.logUpdate(n),r(t)},s.onerror=i=>{let r={status:400,ok:!1,message:"Cannot store to the Local database "+e,data:i,body:t};(0,o.ey)(n,"storeToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e};(0,o.ey)(n,"storeToDatabase",t),c(t)}))}))}function h(e,t){const n=i.Logger.logfunction("UpdateToDatabase",arguments);return new Promise((function(r,c){s(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).put(t);s.onsuccess=e=>{i.Logger.logUpdate(n),r(t)},s.onerror=i=>{let r={status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:i,body:t};(0,o.ey)(n,"UpdateToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e};(0,o.ey)(n,"UpdateToDatabase",t),c(t)}))}))}},3655:(e,t,n)=>{n.d(t,{El:()=>u,b8:()=>h,kH:()=>d,qI:()=>l,wh:()=>p});var o=n(2299),i=n(9581),r=n(2370),c=n(1863);let a=10;class s{}function l(e){const t=r.Logger.logfunction("openDatabase",[e,"indexdb"]);return new Promise((function(n,o){s.db&&(r.Logger.logUpdate(t),n(s.db));let d=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const h=indexedDB.open(d,a);console.log("this is the update version",a,h),h.onupgradeneeded=e=>{let o=e.target.result,i="concept",c="connection",s="settings";console.log("this is the version update for index",a),o.objectStoreNames.contains(i)&&o.deleteObjectStore(i),o.objectStoreNames.contains(c)&&o.deleteObjectStore(c),o.objectStoreNames.contains(s)&&o.deleteObjectStore(s),o.objectStoreNames.contains(i)||(o.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),o.objectStoreNames.contains(c)||(o.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),o.objectStoreNames.contains(s)||(o.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{}),r.Logger.logUpdate(t),n(o)},h.onerror=n=>{console.error("Why didn't you allow my web app to use IndexedDB?!",n),indexedDB.deleteDatabase(d),l(e),(0,c.ey)(t,"openDatabase",n),o(n)},h.onsuccess=function(e){let o=e.target;s.db=o.result,r.Logger.logUpdate(t),n(s.db)}}))}function d(e,t){const n=r.Logger.logfunction("UpdateToDatabase",[e,"indexdb"]);return new Promise((function(o,i){l(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).put(t);s.onsuccess=e=>{r.Logger.logUpdate(n),o(t)},s.onerror=o=>{let r={status:400,ok:!1,message:"Cannot Update to the database"+e,data:o,body:t};(0,c.ey)(n,"UpdateToDatabase",r),i(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e};(0,c.ey)(n,"UpdateToDatabase",t),i(t)}))}))}function h(){const e=r.Logger.logfunction("GetLastSettingsFromDatabase",["indexdb"]);return new Promise((function(t,n){let i="settings";l(i).then((a=>{let s=a.transaction(i,"readwrite").objectStore(i).getAll();s.onsuccess=()=>{let n=new o.B(!1),i=s.result;for(let e=0;e<i.length;e++)n=i[e];r.Logger.logUpdate(e),t(n)},s.onerror=t=>{(0,c.ey)(e,"GetLastSettingsFromDatabase",t),n(t)}})).catch((t=>{let o={status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:t};(0,c.ey)(e,"GetLastSettingsFromDatabase",o),n(o)}))}))}function u(e){const t=r.Logger.logfunction("AiUpdateFlag",["indexdb"]);return new Promise((function(n,o){let i="settings";l(i).then((a=>{const s=a.transaction(i,"readwrite").objectStore(i).put(e);s.onsuccess=o=>{r.Logger.logUpdate(t),n(e)},s.onerror=n=>{let i={status:400,ok:!1,message:"Cannot update AI flag",data:n,body:e};(0,c.ey)(t,"AiUpdateFlag",i),o(i)}})).catch((e=>{let n={status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e};(0,c.ey)(t,"AiUpdateFlag",n),o(n)}))}))}function p(e,t){const n=r.Logger.logfunction("removeFromDatabase",[e,"indexdb"]);return new Promise((function(o,i){l(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).delete(Number(t));s.onsuccess=function(e){r.Logger.logUpdate(n),o(t)},s.onerror=t=>{let o={status:400,ok:!1,message:"Cannot remove from the database"+e,data:t};(0,c.ey)(n,"removeFromDatabase",o),i(o)}})).catch((e=>{let o={status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t};(0,c.ey)(n,"removeFromDatabase",o),i(o)}))}))}},4485:(e,t,n)=>{function o(e=[],t){var n,o;let i=[],r=null===(n=t.type)||void 0===n?void 0:n.characterValue;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(e))for(let n=0;n<e.length;n++){let c=null===(o=e[n].type)||void 0===o?void 0:o.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),t.typeId!=e[n].typeId&&r!=c||i.push(e[n])}return i}function i(e=[],t){let n=[],o=t.typeCharacter;if((null==o?void 0:o.startsWith("the_"))||(o="the_"+o),Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i].typeCharacter;(null==r?void 0:r.startsWith("the_"))||(r="the_"+r),t.typeId!=e[i].typeId&&o!=r||n.push(e[i])}return n}function r(e=[],t){let n=[];if(Array.isArray(e)){const o=e.find((e=>e.toTheConceptId==t));o&&n.push(o);const i=e.find((e=>e.ofTheConceptId==t));i&&n.push(i)}return n}function c(e=[],t){let n=[];if(Array.isArray(e)){const o=e.find((e=>e.toTheConceptId==t));o&&n.push(o);const i=e.find((e=>e.ofTheConceptId==t));i&&n.push(i)}return n}n.d(t,{gt:()=>c,nm:()=>i,vo:()=>o,wS:()=>r}),n(2155),n(7282)},9934:(e,t,n)=>{function o(e,t){return-1===e.indexOf(t)&&e.push(t),e}n.d(t,{A:()=>o})},9700:(e,t,n)=>{n.d(t,{R:()=>d,V:()=>l});var o,i=n(2370),r=n(3278),c=n(1863),a=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class l{static startAutoSync(){this.autoSyncInterval?console.warn("Auto-sync is already running."):(this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS,setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&(this.nextSyncTime=e+this.SYNC_INTERVAL_MS,this.sendPackageLogsToServer(),this.sendApplicationLogsToServer())}),3e4))}static stopAutoSync(){null!==this.autoSyncInterval&&(clearInterval(this.autoSyncInterval),this.autoSyncInterval=null,this.nextSyncTime=null)}static setLogLevel(e){this.logLevel=e}static shouldLog(e){return this.LOG_LEVELS.indexOf(e)>=this.LOG_LEVELS.indexOf(this.logLevel)}static formatLogData(e,t,n){const o=Object.assign({timestamp:(new Date).toISOString(),level:e,message:t},n);return this.packageLogsData.push(o),"ERROR"==e&&(this.sendPackageLogsToServer(),this.sendApplicationLogsToServer()),o}static log(e,t,n){if(this.logPackageActivationStatus)try{this.formatLogData(e,t,n||null)}catch(e){console.error("Error on Logger Log : ",e)}}static logUpdate(e){var t;try{if(!this.logPackageActivationStatus)return{};if(!e)return{};const n=Date.now();e.startTime=null!==(t=e.startTime)&&void 0!==t?t:n;const o=n-e.startTime;e.responseTime=`${o} ms`,1==!e.serviceWorker&&(e.serviceWorker=!1)}catch(t){(0,c.ey)(e,"Logger.logUpdate",t)}}static logfunction(e,...t){if(!this.logPackageActivationStatus)return{};const n=Date.now();let o=t;const c=i.BaseUrl.getRandomizer(),a=r.b.sessionId;let s={startTime:n,functionName:e,functionParameters:o,requestFrom:i.BaseUrl.BASE_APPLICATION,sessionId:a,applicationId:c};return this.formatLogData("INFO","function called",s)}static logError(e,t,n,o,i,r,c,a,s,l,h){try{const u=d("SessionId"),p={startTime:e,userId:t,operationType:n,requestFrom:o,requestIP:i,responseStatus:r,responseTime:`${(performance.now()-e).toFixed(3)}ms`,responseSize:c?`${JSON.stringify(c).length}`:"0",sessionId:null==u?void 0:u.toString(),functionName:a,functionParameters:s,userAgent:l,conceptsUsed:h};this.formatLogData("ERROR",`Information logged for ${a}`,p)}catch(e){console.error("Error on logError")}}static logApplication(e,t,n){if(this.logApplicationActivationStatus)try{const o={timestamp:(new Date).toISOString(),level:e,message:t,data:n||null};this.applicationLogsData.push(o)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return s(this,void 0,void 0,(function*(){const e=this.applicationLogsData;try{if(0===e.length)return;this.applicationLogsData=[],r.b.BearerAccessToken;const t=50;let n=(0,a.Xr)(),o=0;for(;0!=e.length;){const r=e.slice(0,t),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:n,body:JSON.stringify({logType:this.appLogs,logData:r})});c.ok||(yield c.text()),e.splice(0,t),o+=t,o++}}catch(e){}}))}static sendPackageLogsToServer(){return s(this,void 0,void 0,(function*(){const e=this.packageLogsData;try{if(0===e.length)return;this.packageLogsData=[];const t=300;let n=0;for(;0!=e.length;){const o=e.slice(0,t);let r=(0,a.Xr)();const c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:r,body:JSON.stringify({logType:this.mftsccsBrowser,logData:o})});if(!c.ok)return void(yield c.text());e.splice(0,t),n++}}catch(e){}}))}static saveLogToLocalStorage(e,t){try{if(void 0===typeof localStorage)return void console.warn("Local Storage type undefined");{const n=JSON.parse((null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))||"[]");n.push(t),null===localStorage||void 0===localStorage||localStorage.setItem(e,JSON.stringify(n))}}catch(e){console.error("Error on saving log in localstorage"),this.log("ERROR","Error while saving log in local storage")}}static clearLogsFromLocalStorage(e){void 0!==typeof localStorage?null===localStorage||void 0===localStorage||localStorage.removeItem(e):console.warn("localStorage is not available")}}function d(e){try{let t=e+"=",n=decodeURIComponent(document.cookie).split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}catch(e){return console.error("Error on getcookie"),""}}o=l,l.logLevel="INFO",l.packageLogsData=[],l.applicationLogsData=[],l.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],l.SYNC_INTERVAL_MS=6e4,l.nextSyncTime=null,l.appLogs="app",l.mftsccsBrowser="mftsccs",l.logApplicationActivationStatus=!1,l.logPackageActivationStatus=!1,l.autoSyncInterval=null,o.startAutoSync()},1412:(e,t,n)=>{function o(e=[],t=[]){}n.d(t,{e:()=>o})},5898:(e,t,n)=>{n.d(t,{w:()=>a,V:()=>s});var o=n(7139),i=n(2370);class r{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e=[]){let t=[];if(e.length>0)for(let n=0;n<e.length;n++){let o=l(e[n]);t.push(o)}return t}function s(e){var t=arguments;return c(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConnectionTypeForCount",t);let r={};for(let t=0;t<e.length;t++){let n=yield(0,o.r)(e[t].connectionTypeId);e[t].connectionType=n.characterValue,r[e[t].conceptId]=e[t]}return i.Logger.logUpdate(n),r}))}function l(e){const t=e.split("_");if(3===t.length){let e=new r;return e.conceptId=Number(t[0]),e.connectionTypeId=Number(t[1]),e.count=Number(t[2]),e}throw new Error("Input string must contain exactly three parts separated by underscores.")}},1863:(e,t,n)=>{n.d(t,{ER:()=>c,Mb:()=>a,ey:()=>s,ry:()=>r});var o=n(2370),i=n(7273);function r(e){if(o.Logger.log("ERROR",e.statusText,{code:e.status,data:e.statusText}),401==e.status||406==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function c(e,t={}){if(o.Logger.log("ERROR",t.statusText,{code:e.status,data:e.status}),401==e.status||406==e.status){let n=new i.z(t.statusText,!1,e.status,"");throw n.setUrl(e.url),n}if(500==e.status){let n=new i.z(t.statusText,!1,e.status,"");throw n.setUrl(e.url),n}}function a(e,t=""){if(o.Logger.log("ERROR",e.message,{code:e.status,data:e.stack}),e.status){let n=new i.z(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new i.z(e.message,!1,500,e.stack);throw n.setUrl(t),n}}function s(e,t,n){var o;try{if(!e)return void console.error(`Error in ${t}: logData is undefined`);const i=Date.now();e.startTime=null!==(o=e.startTime)&&void 0!==o?o:i,e.responseTime=i-e.startTime+" ms",e.level="ERROR",e.errorMessage=(null==n?void 0:n.message)||"Unknown error occurred",console.error(`Error in function ${t}:`,n)}catch(e){console.error("Failed to handle package function error:",e)}}},176:(e,t,n)=>{n.d(t,{F4:()=>c,P6:()=>s,dp:()=>a});var o=n(2155),i=n(7282),r=n(6416);function c(e){var t,n;const o=(0,r.u)();return o.id=e.id,o.ghostId=e.ghostId,o.userId=e.userId,o.accessId=e.accessId,o.categoryId=e.categoryId,o.characterValue=e.characterValue,o.entryTimeStamp=e.entryTimeStamp,o.typeId=e.typeId,o.type=e.type,o.isTemp=!1,o.typeCharacter=null!==(n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"",o}function a(e){const t=(0,i.o)();return t.id=e.id,t.ghostId=e.ghostId,t.userId=e.userId,t.accessId=e.accessId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.categoryId=e.categoryId,t}function s(e){const t=new o.N(0,0,0,0,0,0,0);return t.id=e.id,t.ghostId=e.ghostId,t.accessId=e.accessId,t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.isTemp=!1,t}},5020:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(2370),i=n(9639),r=n(205),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(){return c(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];i.I.AddConceptToMemory(n)}r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0}catch(e){throw yield(0,o.DelayFunctionExecution)(2e3,a()),{message:"Cannot create Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7282:(e,t,n)=>{n.d(t,{o:()=>i});var o=n(2615);function i(){let e=new Date,t=new Date;return new o.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},1218:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(2370),i=n(7282),r=n(1666),c=n(8407),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,arguments,void 0,(function*(e,t=null,n=null,a=null,l=null,d=null,h=null){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:a,userId:l,accessId:d,sessionInformationId:h})).data}catch(e){console.error("CreateTheComposition sw error: ",e),(0,o.handleServiceWorkerException)(e)}let u=null!=l?l:999,p=null!=d?d:4,f=null!=h?h:999,y=null!=a?a:0,v=(0,i.o)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=y,n=yield(0,c.A)(o,"",!0,u,p,f);v=n,t=n.id,y=n.id,yield s(e[o],n.id,n.userId,t,l,d,h)}else{let i=null!=t?t:999,a=null!=n?n:999,g=y,m=yield(0,c.A)(o,"",!0,u,p,f);v=m,yield(0,r.q)(i,a,m.id,g),yield s(e[o],m.id,m.userId,g,l,d,h)}else{let i=null!=t?t:999,a=null!=n?n:10267,s=y,l=yield(0,c.A)(o,e[o].toString(),!1,u,p,f);yield(0,r.q)(i,a,l.id,s)}return v}))}},2212:(e,t,n)=>{n.d(t,{Ay:()=>l,N:()=>d});var o=n(1167),i=n(2615),r=n(5976),c=n(442),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n,o,a,l,d){return s(this,void 0,void 0,(function*(){let s=yield r.B.getId(),h=new Date,u=new Date,p=new i.j(s,t,o,n,a,e,l,!0,h,u,d);return p.isTemp=!1,c.Y.AddConcept(p),p}))}function d(e,t,n,c,l,d,h){return s(this,void 0,void 0,(function*(){let s=yield r.B.getId(),u=new Date,p=new Date,f=new i.j(s,t,c,n,l,e,d,!1,u,p,h);return a.ConceptsData.AddConcept(f),(0,o.Y)([f]),f}))}},1666:(e,t,n)=>{n.d(t,{q:()=>c});var o=n(2155),i=n(442),r=n(1863);function c(e,t,n,c){var a=t,s=new o.N(0,e,n,a,c,1,4);if(e==n)return s.ofTheConceptId=0,s.toTheConceptId=1,s;try{s.isTemp=!0,s.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(s)}catch(e){(0,r.Mb)(e)}return s}},1838:(e,t,n)=>{n.d(t,{m:()=>h});var o=n(2370),i=n(9581),r=n(1863),c=n(3518),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},s=n(5239),l=n(4864),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function h(e){var t=arguments;return d(this,void 0,void 0,(function*(){const n=o.Logger.logfunction("DeleteConnectionById",t);if(o.serviceWorker)try{return(yield(0,o.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,o.handleServiceWorkerException)(e)}e>0?(yield function(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=o.Logger.logfunction("DeleteTheConnection",t);try{const t=new FormData;t.append("id",e.toString());let a=(0,c.BZ)();const s=yield fetch(i.B.DeleteTheConnectionUrl(),{method:"POST",headers:a,body:t,redirect:"follow"});o.Logger.logUpdate(n),s.ok||(console.log("Delete connection error status: ",s.status),(0,r.ry)(s))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,r.Mb)(e,i.B.DeleteTheConnectionUrl()),(0,r.ey)(n,"DeleteTheConnection",e)}}))}(e),s.O.removeNodeFromTree(e)):l.G.RemoveConnectionById(e),o.Logger.logUpdate(n)}))}},4364:(e,t,n)=>{n.d(t,{s:()=>c});var o=n(1239),i=n(2370),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){const t=i.Logger.logfunction("FindConceptsFromConnections",[e.length]);let n=[];if(e.length>0){for(let t=0;t<e.length;t++)n.includes(e[t].ofTheConceptId)||n.push(e[t].ofTheConceptId),n.includes(e[t].toTheConceptId)||n.push(e[t].toTheConceptId),n.includes(e[t].typeId)||n.push(e[t].typeId);yield(0,o.r)(n)}i.Logger.logUpdate(t)}))}},5284:(e,t,n)=>{n.d(t,{B:()=>a});var o=n(2370),i=n(8286),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(){return c(this,arguments,void 0,(function*(e=[]){const t=o.Logger.logfunction("FindConnectionsOfCompositionsBulkInMemory",[e.length])||{};let n=[];try{if(o.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,o.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e});return o.Logger.logUpdate(t),n.data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),(0,o.handleServiceWorkerException)(e)}}for(let t=0;t<e.length;t++){let o=yield i.d.GetConnectionsOfConcept(e[t]);n.push(...o)}return o.Logger.logUpdate(t),n}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),n}}))}},8939:(e,t,n)=>{n.d(t,{$N:()=>I,$V:()=>u,Ez:()=>w,JA:()=>C,Mb:()=>y,Nj:()=>f,PT:()=>T,RW:()=>m,XI:()=>g,ay:()=>h,hL:()=>d,kx:()=>v,re:()=>p,yz:()=>k,zN:()=>L});var o=n(7139),i=n(2),r=n(9639),c=n(8286),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){return l(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,a.handleServiceWorkerException)(e)}let n=yield(0,i.s)(e);t.connectionList=n;for(let e=0;e<t.connectionList.length;e++)t.compositionList.includes(t.connectionList[e].ofTheConceptId)||t.compositionList.push(t.connectionList[e].ofTheConceptId);return t}catch(e){return console.error("GetCompositionById error: ",e),t}}))}function h(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield L(e,t,n);return a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,a}))}function u(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield L(e,t,n);a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=s.entryTimeStamp,d.data=a,d.id=e,d}))}function p(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield A(s,t,n);return a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,a}))}function f(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,a.handleServiceWorkerException)(e)}let c=[],s={};c=yield(0,i.s)(e);let l=[];for(let e=0;e<c.length;e++)l.includes(c[e].ofTheConceptId)||l.push(c[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield L(e,c,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function y(e){return l(this,void 0,void 0,(function*(){var t,n;let c=[],a={};c=yield(0,i.s)(e);let s=[];for(let e=0;e<c.length;e++)s.includes(c[e].ofTheConceptId)||s.push(c[e].ofTheConceptId);let l=yield r.I.GetConcept(e);0==l.id&&null!=e&&null!=e&&(l=yield(0,o.r)(e));let d=yield S(e,c,s);return a[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=d,a}))}function v(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield N(d,i,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function g(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield A(d,i,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function m(e){var t=arguments;return l(this,void 0,void 0,(function*(){var n,i;const l=a.Logger.logfunction("GetCompositionWithIdFromMemory",t)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return a.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.ey)(l,"GetCompositionWithIdFromMemory",e),(0,a.handleServiceWorkerException)(e)}}let d={},h=[],u={};try{h=yield c.d.GetConnectionsOfCompositionLocal(e);let t=[];for(let e=0;e<h.length;e++)t.includes(h[e].ofTheConceptId)||t.push(h[e].ofTheConceptId);let a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let s=yield N(a,h,t);u[null!==(i=null===(n=null==a?void 0:a.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=s,d.created_at=a.entryTimeStamp,d.data=u,d.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e),(0,s.ey)(l,"GetCompositionWithIdFromMemory",t)}return a.Logger.logUpdate(l),d}))}function C(e,t){var n=arguments;return l(this,void 0,void 0,(function*(){var i,c;const l=a.Logger.logfunction("GetCompositionFromMemoryWithConnections",n)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const n=yield(0,a.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t});return a.Logger.logUpdate(l),n.data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,s.ey)(l,"GetCompositionFromMemoryWithConnections",e),(0,a.handleServiceWorkerException)(e)}}let d={},h=[];for(let e=0;e<t.length;e++)h.includes(t[e].ofTheConceptId)||h.push(t[e].ofTheConceptId);let u=yield r.I.GetConcept(e);0==u.id&&null!=e&&null!=e&&(u=yield(0,o.r)(e));let p=yield N(u,t,h);d[null!==(c=null===(i=null==u?void 0:u.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=p;let f={};return f.created_at=u.entryTimeStamp,f.data=d,f.id=e,a.Logger.logUpdate(l),f}))}function T(e,t){return l(this,void 0,void 0,(function*(){var n,i;const c=a.Logger.logfunction("GetCompositionWithIdFromMemoryFromConnection",[e])||{};if(a.serviceWorker){c.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return a.Logger.logUpdate(c),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.ey)(c,"GetCompositionWithIdFromMemoryFromConnection",e),(0,a.handleServiceWorkerException)(e)}}let l={},d=[];for(let e=0;e<t.length;e++)d.includes(t[e].ofTheConceptId)||d.push(t[e].ofTheConceptId);let h=yield r.I.GetConcept(e);0==h.id&&null!=e&&null!=e&&(h=yield(0,o.r)(e));let u=yield N(h,t,d);l[null!==(i=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=u;let p={};return p.created_at=h.entryTimeStamp,p.data=l,p.id=e,a.Logger.logUpdate(c),p}))}function I(e){return l(this,void 0,void 0,(function*(){var t;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,a.handleServiceWorkerException)(e)}let n=[],i={};n=yield c.d.GetConnectionsOfCompositionLocal(e);let s=[];for(let e=0;e<n.length;e++)s.includes(n[e].ofTheConceptId)||s.push(n[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(console.log("this concept you cannot find ",e),d=yield(0,o.r)(e)),(new Date).getTime();let h=yield function(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,s,l,d,h,u;let p={},f=e.id,y=((new Date).getTime(),null!==(r=null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"");if(!n.includes(f)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(o.includes(f))return"";o.push(f);for(let e=0;e<t.length;e++){let n=yield(0,a.GetTheConcept)(t[e].ofTheConceptId),o=yield(0,a.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=n,t[e].toConcept=o;let i=n.id,r="the_",l=(null!==(s=null===(c=null==o?void 0:o.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"").replace(r,"");null!=p[i]&&null!=p[i]||(p[i]={}),p[i][l]=o.characterValue}let v={};for(let e=0;e<t.length;e++){let n=t[e].ofConcept,o=t[e].toConcept,i=null!==(d=null===(l=null==n?void 0:n.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"",r="the_",c=(null!==(u=null===(h=null==o?void 0:o.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"").replace(r,"");null!=v[n.id]&&null!=v[n.id]||(v[n.id]={});let a=v[n.id];null!=a[i]&&null!=a[i]||(a[i]={}),null!=p[t[e].ofTheConceptId]&&null!=p[t[e].toTheConceptId]?a[i][c]=p[o.id]:a[i][c]=o.characterValue}return v[e.id]}))}(d,n,s);null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=h;let u={};return u.created_at=d.entryTimeStamp,u.data=i,u.id=e,u}))}function w(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield L(e,i,l);s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h;let u={};return u.data=s,u.id=e,u.created_at=d.entryTimeStamp,u}))}function k(e){var t=arguments;return l(this,void 0,void 0,(function*(){var n,c;const l=a.Logger.logfunction("GetCompositionWithId",t)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithId",{id:e});return a.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,s.ey)(l,"GetCompositionWithId",e),(0,a.handleServiceWorkerException)(e)}}let d=[],h={};d=yield(0,i.s)(e);let u=[];for(let e=0;e<d.length;e++)u.includes(d[e].ofTheConceptId)||u.push(d[e].ofTheConceptId);let p=yield r.I.GetConcept(e);0==p.id&&null!=e&&null!=e&&(p=yield(0,o.r)(e));let f=yield L(e,d,u);h[null!==(c=null===(n=null==p?void 0:p.type)||void 0===n?void 0:n.characterValue)&&void 0!==c?c:""]=f;let y={};return y.data=h,y.id=e,a.Logger.logUpdate(l),y}))}function N(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[],h=e.id;if(null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!n.includes(h))return null==e?void 0:e.characterValue;if(i.includes(h))return"";i.push(h);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==h)if(h!=t[e].toTheConceptId){let c=t[e].toTheConceptId,h=yield r.I.GetConcept(c);if(null!=h&&0!=h.id||null==c||null==c||(h=yield(0,o.r)(c)),0!=h.id&&null==(null==h?void 0:h.type)){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}let u="the_",p=(null!==(s=null===(a=null==h?void 0:h.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(u,"");if(isNaN(Number(p))){if(p){const e=yield N(h,t,n,i);l[p]=e}}else{const e=yield N(h,t,n,i);d[p]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,l;const d=a.Logger.logfunction("recursiveFetchConceptNormal",[e]);(new Date).getTime();let h={},u=[],p=e.id;if(h.id=p,null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!n.includes(p))return null==e?void 0:e.characterValue;if(i.includes(p))return"";i.push(p);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==p)if(p!=t[e].toTheConceptId){let c=t[e].toTheConceptId,a=yield r.I.GetConcept(c);if(null!=a&&0!=a.id||null==c||null==c||(a=yield(0,o.r)(c)),0!=a.id&&null==(null==a?void 0:a.type)){let e=a.typeId,t=yield r.I.GetConcept(e);a.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),a.type=t)}let d="the_",p=(null!==(l=null===(s=null==a?void 0:a.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"").replace(d,"");if(isNaN(Number(p))){if(p){const e=yield N(a,t,n,i);h[p]=e}}else{const e=yield N(a,t,n,i);u[p]=e,h=u}}else console.log("this is the faulty connection ",t[e]);return a.Logger.logUpdate(d),h}))}function L(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[];if(0==e)return null;let h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==h.type){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}if(null===(c=null==h?void 0:h.type)||void 0===c?void 0:c.characterValue,!n.includes(e))return null==h?void 0:h.characterValue;if(i.includes(e))return"";i.push(e);for(let c=0;c<t.length;c++)if((new Date).getTime(),t[c].ofTheConceptId==e)if(e!=t[c].toTheConceptId){let e=t[c].toTheConceptId,h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==(null==h?void 0:h.type)){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}let u="the_",p=(null!==(s=null===(a=null==h?void 0:h.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(u,"");if(isNaN(Number(p))){if(p){const o=yield L(e,t,n,i);l[p]=o}}else{const o=yield L(e,t,n,i);d[p]=o,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[];if(0==e)return null;let h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==h.type){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}if(null===(c=null==h?void 0:h.type)||void 0===c?void 0:c.characterValue,!n.includes(e))return null==h?void 0:h.characterValue;if(i.includes(e))return"";i.push(e),l.id=e;for(let i=0;i<t.length;i++)if(t[i].ofTheConceptId==e){let e=t[i].toTheConceptId,c=yield r.I.GetConcept(e);if(null!=c&&0!=c.id||null==e||null==e||(c=yield(0,o.r)(e)),c&&null==(null==c?void 0:c.type)){let e=c.typeId,t=yield r.I.GetConcept(e);c.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),c.type=t)}let h="the_",u=(null!==(s=null===(a=null==c?void 0:c.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(h,"");if(isNaN(Number(u))){if(u){const o=yield S(e,t,n);l[u]=o}}else{const o=yield S(e,t,n);d[u]=o,l=d}}return l}))}},6687:(e,t,n)=>{n.d(t,{D:()=>I,MT:()=>T,Nt:()=>f,QL:()=>g,as:()=>y,cw:()=>h,dF:()=>d,hG:()=>v,km:()=>p,nr:()=>C,p8:()=>u,rv:()=>m});var o=n(8642),i=n(7467),r=n(2370),c=n(1863),a=n(5284),s=n(8939),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){yield(0,o.Y)(e);let t=[];for(let n=0;n<e.length;n++){let o=yield(0,s.kx)(e[n]);t.push(o)}return t}))}function h(){return l(this,arguments,void 0,(function*(e=[]){yield(0,o.Y)(e);let t=[];for(let n=0;n<e.length;n++){let o=yield(0,s.RW)(e[n]);t.push(o)}return t}))}function u(){return l(this,arguments,void 0,(function*(e=[],t=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataId",[e])||{};if(r.serviceWorker){n.serviceWorker=!0;try{const o=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t});return r.Logger.logUpdate(n),o.data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataId",e),(0,r.handleServiceWorkerException)(e)}}let o=[];for(let t=0;t<e.length;t++){let n=yield(0,s.RW)(e[t]);o.push(n)}return r.Logger.logUpdate(n),o}))}function p(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdFromConnections",e)||{};if(r.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:t,connectionIds:n});return r.Logger.logUpdate(o),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataIdFromConnections",e),(0,r.handleServiceWorkerException)(e)}}let a=yield(0,i.j)(n),l=[];for(let e=0;e<t.length;e++){let n=yield(0,s.PT)(t[e],a);l.push(n)}return r.Logger.logUpdate(o),l}))}function f(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdIndex",e)||{};if(r.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:t,connectionIds:n});return r.Logger.logUpdate(o),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataIdIndex",e),(0,r.handleServiceWorkerException)(e)}}yield(0,i.j)(n),yield(0,a.B)(t);let l={};for(let e=0;e<t.length;e++){let n=yield(0,s.RW)(t[e]);l[t[e]]=n}return r.Logger.logUpdate(o),l}))}function y(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,a.B)(e);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.kx)(e[t]);n[e[t]]=o}return n}))}function v(){return l(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithIndexFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithIndexFromConnections error sw: ",e),(0,r.handleServiceWorkerException)(e)}let n=yield(0,i.j)(t),o=[];for(let t=0;t<e.length;t++){let i=yield(0,s.JA)(e[t],n);o[e[t]]=i}return o}))}function g(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("GetConnectionDataPrefetch",t)||{};if(r.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e});return r.Logger.logUpdate(n),t.data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,c.ey)(n,"GetConnectionDataPrefetch",e),(0,r.handleServiceWorkerException)(e)}}let o=[],a=[],s={};for(let t=0;t<e.length;t++){let n=yield r.ConnectionData.GetConnection(e[t]);0==n.id?o.push(e[t]):a.push(n)}for(let t=0;t<o.length;t++)s[e[t]]=!1;let l=[],d=yield(0,i.j)(o);a=[...a,...d];for(let e=0;e<a.length;e++)l.push(a[e].ofTheConceptId),l.push(a[e].toTheConceptId),l.push(a[e].typeId);return yield(0,r.GetConceptBulk)(l),r.Logger.logUpdate(n),a}))}function m(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdInObject",e);yield(0,i.j)(n);let c={};for(let e=0;e<t.length;e++){let n=yield(0,s.RW)(t[e]);c[t[e]]=n}return r.Logger.logUpdate(o),c}))}function C(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.$N)(e[t]);n[e[t]]=o}return n}))}function T(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.kx)(e[t]);n[e[t]]=o}return n}))}function I(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.XI)(e[t]);n[e[t]]=o,console.log("this is the normal data",e[t],o)}return n}))}},2013:(e,t,n)=>{n.d(t,{A:()=>s,w:()=>l});var o=n(8146),i=n(2370),r=n(9639),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConceptByCharacter",t)||{};if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,c.ey)(n,"GetConceptByCharacter",e),(0,i.handleServiceWorkerException)(e)}}let a=yield r.I.GetConceptByCharacter(e),s=`${e}`;return null!=a&&0!=(null==a?void 0:a.id)||!s||(yield(0,o.Y)(e),a=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==a.id&&(a=yield r.I.GetConceptByCharacter(e))),i.Logger.logUpdate(n),a}))}function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConceptByCharacterUpdated",t)||{};if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,c.ey)(n,"GetConceptByCharacterUpdated",e),(0,i.handleServiceWorkerException)(e)}}let a=yield r.I.GetConceptByCharacter(e),s=`${e}`;return null!=a&&0!=(null==a?void 0:a.id)||!s||(yield(0,o.Y)(e),a=yield r.I.GetConceptByCharacter(e)),i.Logger.logUpdate(n),a}))}},7887:(e,t,n)=>{n.d(t,{a:()=>c,p:()=>a});var o=n(8286),i=n(4864),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.d.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}function a(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)i.G.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Local Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7876:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(1735),i=n(7139),r=n(2370),c=n(9639),a=n(7282),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const l=new Map;function d(e){return s(this,arguments,void 0,(function*(e,t=999){let n=performance.now();if(o.J.activateStatus)try{o.J.incrementConcept(e)}catch(e){console.error("Error adding connection in access tracker"),r.Logger.log("ERROR","Error Adding Connection")}if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConcept",{id:e,userId:t})).data}catch(e){console.error("GetTheConcept sw error: ",e),(0,r.handleServiceWorkerException)(e)}let d=(0,a.o)();if(l.has(e))return l.get(e)||d;const h=(()=>s(this,void 0,void 0,(function*(){try{if(e<0)return yield r.LocalConceptsData.GetConceptByGhostId(e);if(d=yield c.I.GetConcept(e),(null==d||0==d.id)&&null!=e&&null!=e){let t=yield(0,i.r)(e);d=t}if(0!=d.id&&null==d.type&&null==(yield c.I.GetConcept(d.typeId))&&null!=d.typeId&&null!=d.typeId){let e=yield(0,i.r)(d.typeId);d.type=e}return d}catch(o){throw console.error("this is the error in the getting concept",o),r.Logger.logError(n,t,"read","unknown",void 0,500,o,"GetTheConcept",[e,t],"unknown",void 0),o}finally{l.delete(e)}})))();return l.set(e,h),h}))}},7869:(e,t,n)=>{n.d(t,{_:()=>y,A:()=>f});var o=n(9581),i=n(9639),r=n(1863),c=n(3518),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},l=n(2299);class d{}d.isUpdated=!1,d.isOnlineSync=!1;var h=n(3655),u=n(9003),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function f(){return p(this,arguments,void 0,(function*(e=!0){try{if(yield(0,h.qI)("concepts"),yield(0,u.qI)("concepts"),e){if((yield(0,h.b8)()).isOnlineSync)return!0;yield function(){return s(this,void 0,void 0,(function*(){const e=a.Logger.logfunction("GetAiData");try{const s=(new Date).getTime();var t=(0,c.ab)("application/x-www-form-urlencoded");const l=yield fetch(o.B.GetAllAiData(),{method:"GET",headers:t});l.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.ry)(l));const d=yield l.json();for(var n=0;n<d.length;n++)i.I.AddConcept(d[n]);y();let h=(new Date).getTime()-s;console.log("The time taken is ",h),a.Logger.logUpdate(e)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.Mb)(e,o.B.GetAllAiData())}}))}()}return!0}catch(e){let t={message:"cannot initlize the AI system",ok:!1,status:400,data:e};return console.log(t),!0}}))}function y(){return p(this,void 0,void 0,(function*(){d.isOnlineSync=!0;var e=new l.B(d.isOnlineSync);(0,h.El)(e)}))}},8095:(e,t,n)=>{n.d(t,{h:()=>a});var o=n(2370),i=n(9700),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n){var a=arguments;return c(this,arguments,void 0,(function*(e,t,n,c=!1,s={concepts:[],connections:[]}){var l,d,h,u,p,f;const y=i.V.logfunction("CreateConnectionBetweenTwoConceptsLocal",a)||{};let v=performance.now();try{if(o.serviceWorker){y.serviceWorker=!0;try{const r=yield(0,o.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:n,both:c,actions:s});return(null===(d=null===(l=null==r?void 0:r.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(s.concepts=JSON.parse(JSON.stringify(r.actions.concepts))),(null===(u=null===(h=null==r?void 0:r.actions)||void 0===h?void 0:h.connections)||void 0===u?void 0:u.length)&&(s.connections=JSON.parse(JSON.stringify(r.actions.connections))),i.V.logUpdate(y),r.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",e),(0,o.handleServiceWorkerException)(e)}}if(e.userId,c){let i=(null===(p=t.type)||void 0===p?void 0:p.characterValue)+"_s_"+n+"_by";var g=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,s);yield(0,o.CreateTheConnectionLocal)(t.id,e.id,g.id,1e3,void 0,void 0,s)}let a=(null===(f=e.type)||void 0===f?void 0:f.characterValue)+"_s_"+n+"_s";var m=yield(0,o.MakeTheInstanceConceptLocal)("connection",a,!1,999,999,999,void 0,s);let v=yield(0,o.CreateTheConnectionLocal)(e.id,t.id,m.id,1e3,void 0,void 0,s);return i.V.logUpdate(y),v}catch(o){throw i.V.logError(v,e.userId,"create",void 0,void 0,500,o,"CreateConnectionBetweenTwoConceptsLocal",[e,t,n,c],void 0,void 0),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",o),o}}))}},6416:(e,t,n)=>{n.d(t,{u:()=>i});var o=n(2615);function i(){let e=new Date,t=new Date;return new o.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},3075:(e,t,n)=>{n.d(t,{Ay:()=>d,EO:()=>h,xd:()=>u});var o=n(205),i=n(9736),r=n(5257),c=n(9003),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,void 0,void 0,(function*(){const e=a.Logger.logfunction("CreateLocalBinaryTreeFromIndexDb");try{let t=[];if(Array.isArray(t))for(let e=0;e<t.length;e++){let n=t[e];i.v.AddConceptToMemory(n)}o.B.isLocalDataLoaded=!0,o.B.isLocalTypeLoaded=!0,o.B.isLocalCharacterLoaded=!0,a.Logger.logUpdate(e)}catch(t){yield(0,a.DelayFunctionExecution)(2e3,d());let n={message:"Cannot create local binary tree from index db",data:t,ok:!1,status:400};throw(0,s.ey)(e,"CreateLocalBinaryTreeFromIndexDb",t),n}}))}function h(){return l(this,void 0,void 0,(function*(){var e;const t=a.Logger.logfunction("PopulateTheLocalConceptsToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[0]){let t=e[0].value;if(t)r.R.AddConceptId(e[0]),yield(0,c.kH)("localid",{id:0,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},n={id:0,value:t-10};r.R.AddConceptId(e),yield(0,c.kH)("localid",n)}}e[2]}})))),a.Logger.logUpdate(t)}catch(e){let n={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,s.ey)(t,"PopulateTheLocalConceptsToMemory",e),n}}))}function u(){return l(this,void 0,void 0,(function*(){var e;const t=a.Logger.logfunction("PopulateTheLocalConnectionToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[1]){let t=e[1].value;if(t)r.R.AddConnectionId(e[1]),yield(0,c.kH)("localid",{id:1,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},n={id:0,value:t-10};r.R.AddConnectionId(e),yield(0,c.kH)("localid",n)}}e[2]}})))),a.Logger.logUpdate(t)}catch(e){let n={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,s.ey)(t,"PopulateTheLocalConnectionToMemory",e),n}}))}},999:(e,t,n)=>{n.d(t,{R:()=>l});var o=n(2370),i=n(1863),r=n(6416),c=n(4711),a=n(5868),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,d=null,h=null,u=null,p=!1,f={concepts:[],connections:[]}){var y,v,g,m;const C=o.Logger.logfunction("CreateTheCompositionLocal")||{};if(o.serviceWorker){C.serviceWorker=!0;try{const i=yield(0,o.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,userId:d,accessId:h,sessionInformationId:u,actions:f});return(null===(v=null===(y=null==i?void 0:i.actions)||void 0===y?void 0:y.concepts)||void 0===v?void 0:v.length)&&(f.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(m=null===(g=null==i?void 0:i.actions)||void 0===g?void 0:g.connections)||void 0===m?void 0:m.length)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),o.Logger.logUpdate(C),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,i.ey)(C,"CreateTheCompositionLocal",e),(0,o.handleServiceWorkerException)(e)}}let T=null!=d?d:999,I=null!=h?h:999,w=null!=u?u:999,k=null!=s?s:0,N=(0,r.u)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=k,n=yield(0,a.k)(o,"",!0,T,I,w,void 0,f);N=n,t=n.id,k=n.id,yield l(e[o],n.id,n.userId,t,d,h,u,void 0,f)}else{let n=null!=t?t:999,i=k,r=yield(0,a.k)(o,"",!0,T,I,w,void 0,f);yield(0,c.F)(n,r.id,i,void 0,void 0,void 0,f),yield l(e[o],r.id,r.userId,i,d,h,u,void 0,f)}else{let n=null!=t?t:999,i=k,r=yield(0,a.k)(o,e[o].toString(),!1,T,I,w,void 0,f);yield(0,c.F)(n,r.id,i,void 0,void 0,void 0,f)}return o.Logger.logUpdate(C),N}))}},3077:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(2370),i=n(2615),r=n(9736),c=n(5257),a=n(9700),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n,l,d,h){return s(this,arguments,void 0,(function*(e,t,n,s,l,d,h=!1,u=0,p={concepts:[],connections:[]}){var f,y,v,g;let m=performance.now();try{if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateTheConceptLocal",{referent:e,typecharacter:t,userId:n,categoryId:s,typeId:l,accessId:d,isComposition:h,referentId:u});return(null===(y=null===(f=null==i?void 0:i.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(g=null===(v=null==i?void 0:i.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let a=yield c.R.getConceptId(),m=!0,C=new Date,T=new Date;if("the"==e)return new i.j(1,999,5,5,u,e,d,m,C,T,t);let I=new i.j(a,n,l,s,u,e,d,m,C,T,t);return I.isTemp=!0,I.isComposition=h,r.v.AddConcept(I),p.concepts.push(I),I}catch(o){throw a.V.logError(m,n,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,n,s,l,d,h],void 0),o}}))}},4711:(e,t,n)=>{n.d(t,{F:()=>l});var o=n(2155),i=n(4864),r=n(5257),c=n(9700),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n){return s(this,arguments,void 0,(function*(e,t,n,s=1,l="",d=999,h={concepts:[],connections:[]}){var u,p,f,y;let v=performance.now();if(a.serviceWorker)try{const o=yield(0,a.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:n,orderId:s,typeString:l,userId:d,actions:h});return(null===(p=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===p?void 0:p.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===y?void 0:y.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.log("CreateTheConnectionLocal error sw: ",e),(0,a.handleServiceWorkerException)(e)}try{let c=4,u=yield r.R.getConnectionId(),p=0,f=0,y=0;p=e,f=t,y=n;let v=new o.N(0,0,0,0,0,0,0);return e!=t&&(v=new o.N(u,p,f,d,n,s,c),v.isTemp=!0,v.typeCharacter=l,a.LocalSyncData.AddConnection(v),i.G.AddConnection(v),h.connections.push(v)),v}catch(o){throw c.V.logError(v,d,"create","Unknown","Unknown",500,void 0,"CreateTheConnectionLocal",[e,t,n,s,l,d],"UnknownUserAgent",[]),o}}))}},8064:(e,t,n)=>{n.d(t,{$I:()=>a,Ay:()=>c});var o=n(9736),i=(n(9581),n(3518),n(2370));n(1863);var r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(e){return r(this,void 0,void 0,(function*(){return yield o.v.GetConceptByCharacterAndTypeLocal(e,51)}))}function a(e){return r(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterAndCategoryLocal",{character:e})).data}catch(e){console.error("GetConceptByCharacterAndCategoryLocal error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=(0,i.CreateDefaultLConcept)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=(0,i.SplitStrings)(e);if(n.length>1){let i=1,c=yield a(n[0]);0!=c.id&&(i=c.id),t=yield function(e,t){return r(this,void 0,void 0,(function*(){return o.v.GetConceptByCharacterAndCategoryLocal(e,t)}))}(e,i)}else n[0]==e&&(t=yield c(e));return t}))}},1213:(e,t,n)=>{n.d(t,{f:()=>s});var o=n(9736),i=n(7820),r=n(2370),c=n(176),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,void 0,void 0,(function*(){let t=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConceptLocal",{id:e})).data}catch(e){console.error("GetTheConceptLocal error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=(0,r.CreateDefaultLConcept)();if(e<0){if(t=yield o.v.GetConcept(e),0==t.id){let n=yield i.G.getNodeFromTree(e);if(null==n?void 0:n.value){let e=n.value;e&&(t=e)}}}else{let n=yield(0,r.GetTheConcept)(e);t=(0,c.F4)(n)}return t}catch(n){throw r.Logger.logError(t,"unknown","read","unknown",void 0,200,void 0,"GetTheConceptLocal",[e],"unknown",void 0),n}}))}},9975:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(2370),i=n(9736),r=n(3077),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n,a,s){return c(this,arguments,void 0,(function*(e,t,n,c,a,s={concepts:[],connections:[]}){var l,d,h,u;if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("MakeTheConceptLocal",{referent:e,typeCharacter:t,userId:n,categoryId:c,typeId:a,actions:s});return(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(s.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(u=null===(h=null==i?void 0:i.actions)||void 0===h?void 0:h.connections)||void 0===u?void 0:u.length)&&(s.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let p=yield i.v.GetConceptByCharacterAndTypeLocal(e,a),f=p;return"the"==t&&(c=1),0==f.id&&(p=yield(0,r.A)(e,t,n,c,a,4,void 0,void 0,s),f=p),f}))}},5868:(e,t,n)=>{n.d(t,{k:()=>l});var o=n(3077),i=n(8357),r=n(9736),c=n(2370),a=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t){var n=arguments;return s(this,arguments,void 0,(function*(e,t,s=!1,l,d,h=999,u=0,p={concepts:[],connections:[]}){var f,y,v,g;const m=c.Logger.logfunction("MakeTheInstanceConceptLocal",n)||{};if(c.serviceWorker){m.serviceWorker=!0;try{const n=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:s,userId:l,accessId:d,sessionInformationId:h,referentId:u,actions:p});return(null===(y=null===(f=null==n?void 0:n.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(g=null===(v=null==n?void 0:n.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(n.actions.connections))),c.Logger.logUpdate(m),n.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,a.ey)(m,"MakeTheInstanceConceptLocal",e),(0,c.handleServiceWorkerException)(e)}}try{let n,a,d=999,h=4,f=l,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,s)n=yield(0,i.$)(e,d,l,l,p),a=yield(0,o.A)(t,e,l,h,n.id,y,!0,u,p);else if(g>255)n=yield(0,i.$)(v,d,f,l,p),a=yield(0,o.A)(t,v,l,h,n.id,y,void 0,void 0,p);else{n=yield(0,i.$)(v,d,f,l,p);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,n.id);a=e,0==e.id&&0==e.userId&&(a=yield(0,o.A)(t,v,l,h,n.id,y,void 0,void 0,p))}return a.type=n,c.LocalSyncData.AddConcept(a),p.concepts.push(a),c.Logger.logUpdate(m),a}catch(e){throw(0,a.ey)(m,"MakeTheInstanceConceptLocal",e),e}}))}},8357:(e,t,n)=>{n.d(t,{$:()=>d});var o=n(3077),i=n(8064),r=n(6467),c=n(9975),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e,t,n,h){var u=arguments;return l(this,arguments,void 0,(function*(e,t,n,l,h={concepts:[],connections:[]}){var p,f,y,v;const g=a.Logger.logfunction("MakeTheTypeConceptLocal",u)||{};if(a.serviceWorker){g.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:n,userId:l,actions:h});return(null===(f=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(v=null===(y=null==o?void 0:o.actions)||void 0===y?void 0:y.connections)||void 0===v?void 0:v.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),a.Logger.logUpdate(g),o.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,s.ey)(g,"MakeTheTypeConceptLocal",e),(0,a.handleServiceWorkerException)(e)}}let m=yield(0,i.$I)(e);if(m&&(0==m.id||0==m.userId)){let i=(0,r.f)(e);if(i[0]==e)m=yield(0,c.A)(e,"the",l,1,51,h);else{let r=yield d(i[0],t,n,l,h),c=yield d(i[1],t,n,l,h);m=yield(0,o.A)(e,i[1],l,r.id,c.id,4,void 0,void 0,h)}}return a.Logger.logUpdate(g),m}))}},3729:(e,t,n)=>{n.d(t,{D:()=>p});var o=n(9934),i=n(4485),r=n(2),c=n(7876),a=n(1838),s=n(999),l=n(5868),d=n(2370),h=n(176),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function p(e){return u(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var n,u,p,f;if(performance.now(),d.serviceWorker)try{const o=yield(0,d.sendMessage)("UpdateCompositionLocal",{patcherStructure:e,actions:t});return(null===(u=null===(n=null==o?void 0:o.actions)||void 0===n?void 0:n.concepts)||void 0===u?void 0:u.length)&&(t.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(f=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.connections)||void 0===f?void 0:f.length)&&(t.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("UpdateCompositionLocal error sw: ",e),(0,d.handleServiceWorkerException)(e)}const y=e.userId,v=e.sessionId,g=e.accessId;let m=[];const C=[];let T=(0,d.CreateDefaultLConcept)(),I=(0,d.CreateDefaultLConcept)();const w=[],k=e.compositionId,N=e.ofTheCompositionId;let A=[],L=yield(0,r.s)(k);for(let e=0;e<L.length;e++)m.push((0,h.P6)(L[e]));const S=[],G=[];let _=[];for(let e=0;e<m.length;e++)(0,o.A)(G,m[e].ofTheConceptId),(0,o.A)(S,m[e].ofTheConceptId),(0,o.A)(S,m[e].toTheConceptId),_.push(m[e].ofTheConceptId);for(let e=0;e<S.length;e++){const t=yield(0,c.A)(S[e]);k==S[e]&&(T=(0,h.F4)(t)),N==S[e]&&(I=(0,h.F4)(t)),C.push((0,h.F4)(t))}const b=e.patchObject;for(const e in b){let n=(0,d.CreateDefaultLConcept)();const o=b[e];let r=T;I.id>0&&(r=I),Array.isArray(o)||"object"==typeof o?(n=yield(0,l.k)(e,"",!0,T.userId,4,999,void 0,t),yield(0,s.R)(b[e],n.id,n.userId,T.id,T.userId,4,999,void 0,t)):n=yield(0,l.k)(e,o,!1,y,g,v,void 0,t);const c=(0,i.nm)(C,n);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,i.gt)(m,c[e].id);A=A.concat(t),w.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,n.id,T.id,2,void 0,void 0,t),C.push(n)}for(let e=0;e<A.length;e++)yield(0,a.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,n)=>{n.d(t,{A:()=>f});var o=n(9581),i=n(3518),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},a=n(4402),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.userId=e,this.data=t,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.entryTimestamp=s,this.isNew=l}}var h=n(7282),u=n(2212),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function f(e,t){var n=arguments;return p(this,arguments,void 0,(function*(e,t,p=!1,f,y=4,v=999,g=0){const m=s.Logger.logfunction("MakeTheInstanceConcept",n)||{};if(s.serviceWorker){m.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:p,userId:f,passedAccessId:y,passedSessionId:v,referentId:g});return s.Logger.logUpdate(m),n.data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,r.ey)(m,"MakeTheInstanceConcept",e),(0,s.handleServiceWorkerException)(e)}}let C,T=v,I=f,w=f,k=y,N=f,A="",L=t.length,S=(0,h.o)();if(A=e.startsWith("the_")?e:"the_"+e,p)S=yield(0,s.MakeTheTypeConceptApi)(e,f),C=yield(0,u.Ay)(t,f,4,S.id,g,k,e);else if(L>255)S=yield(0,s.MakeTheTypeConceptApi)(A,f),C=yield(0,u.Ay)(t,f,4,S.id,g,k,A),function(e){c(this,void 0,void 0,(function*(){try{var t=(0,i.Xr)();const n=yield fetch(o.B.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);return yield n.json()}catch(e){throw e instanceof Error?console.log("Create the text error message: ",e.message):console.log("Create the text unexpected error: ",e),e}}))}(new d(f,t,999,I,k,N,T,w,Date.now().toString(),!0));else{S=yield(0,s.MakeTheTypeConceptApi)(A,f);let e=yield(0,a.A)(t,S.id);C=e,0==e.id&&0==e.userId&&(C=yield(0,u.N)(t,f,4,S.id,12,k,A),function(e,t,n,c){var a=arguments;l(this,void 0,void 0,(function*(){const l=s.Logger.logfunction("MakeTheNameInBackend",a);try{let a={newConceptId:e,referent:t,typeId:n,typeUserId:c},d=(0,i.Xr)(),h=JSON.stringify(a);const u=yield fetch(o.B.MakeTheNameInBackendUrl(),{method:"POST",headers:d,body:h});s.Logger.logUpdate(l),u.ok||(0,r.ry)(u)}catch(e){e instanceof Error?console.log("make the name in backend error message: ",e.message):console.log("make the name in backend unexpected error: ",e),(0,r.Mb)(e,o.B.MakeTheNameInBackendUrl()),(0,r.ey)(l,"MakeTheNameInBackend",e)}}))}(C.id,`${t}`,S.id,f))}return C.type=S,s.Logger.logUpdate(m),C}))}},5312:(e,t,n)=>{n.d(t,{NK:()=>u,Ve:()=>p,cf:()=>d,vw:()=>f,y8:()=>h});var o=n(2832),i=n(3130),r=n(2370),c=n(1863),a=n(6687),s=n(7106),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,arguments,void 0,(function*(e,n="",d=null,u=i.y0){var p,y,v,g,m,C,T,I;const w=r.Logger.logfunction("SearchLinkMultipleAll",t)||{};try{try{if(r.serviceWorker){w.serviceWorker=!0;const t=yield(0,r.sendMessage)("SearchLinkMultipleAll",{searchQuery:e,token:n,caller:d,format:u});return r.Logger.logUpdate(w),t.data}}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),(0,c.ey)(w,"SearchLinkMultipleAll",e),(0,r.handleServiceWorkerException)(e)}let t=[],k=[],N=[],A=[],L=e[0].composition,S={},G={};(null==d?void 0:d.isDataLoaded)?(S.compositionIds=null===(p=d.conceptIds)||void 0===p?void 0:p.slice(),S.internalConnections=null===(y=d.internalConnections)||void 0===y?void 0:y.slice(),S.linkers=null===(v=d.linkers)||void 0===v?void 0:v.slice(),S.reverse=null===(g=d.reverse)||void 0===g?void 0:g.slice(),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse):(S=yield(0,o.j)(e,n),d&&(d.conceptIds=null===(m=S.compositionIds)||void 0===m?void 0:m.slice(),d.internalConnections=null===(C=S.internalConnections)||void 0===C?void 0:C.slice(),d.linkers=null===(T=S.linkers)||void 0===T?void 0:T.slice(),d.reverse=null===(I=S.reverse)||void 0===I?void 0:I.slice(),d.isDataLoaded=!0),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse);let _=yield function(e,t,n,o,r,c){return l(this,arguments,void 0,(function*(e,t,n,o,r,c,l=i.y0){try{let d,u,p=yield(0,a.QL)(e);return l==i.ZJ?(d=yield(0,a.MT)(t,n),u=yield f(e,d,r,o)):l==i.yv?(d=yield(0,a.D)(t,n),u=yield f(e,d,r,o)):100==l?(d=yield(0,a.nr)(t,n),u=yield h(p,d,r,o)):l==i.SL?u=yield(0,s._W)(e,t,n,c.ofCompositions,o):(d=yield(0,a.rv)(t,n),u=yield h(p,d,r,o)),u}catch(e){return void console.log("Error Occured in build layer",e)}}))}(k,t,N,A,L,e[0],u);return r.Logger.logUpdate(w),_}catch(e){throw console.log("this is the error in the search link multiple",e),(0,c.ey)(w,"SearchLinkMultipleAll",e),e}}))}function h(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){(new Date).getTime();let i={},c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;if(o.includes(e[n].id)&&(i=!0),1==i){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{let o=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[a][o])||("string"==typeof c[a]&&(c[a]={}),c[a][o]=[]),c[a][o].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[a][i.characterValue])||("string"==typeof c[a]&&(c[a]={}),c[a][i.characterValue]=[]),c[a][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}function u(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){let i=[],c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;if(o.includes(e[n].id)&&(i=!0),1==i){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=Object.keys(o)[0];try{let r=i.characterValue+"_reverse";"string"==typeof o&&(o={}),Array.isArray(o[c][r])||("string"==typeof o[c]&&(o[c]={}),o[c][r]=[]),o[c][r].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=Object.keys(o)[0];try{"string"==typeof o&&(o={}),Array.isArray(o[c][i.characterValue])||("string"==typeof o[c]&&(o[c]={}),o[c][i.characterValue]=[]),o[c][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o&&i.push(o)}return i}))}function p(e,t,n,o){return l(this,arguments,void 0,(function*(e,t,n,o,i=[]){(new Date).getTime();let c=[],a=[];for(let t=0;t<e.length;t++)a.push(e[t].toTheConceptId),a.push(e[t].ofTheConceptId),a.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let o=!1;if(i.includes(e[n].id)&&(o=!0),1==o){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{let o=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[a][o])||("string"==typeof c[a]&&(c[a]={}),c[a][o]=[]),c[a][o].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[a][i.characterValue])||("string"==typeof c[a]&&(c[a]={}),c[a][i.characterValue]=[]),c[a][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&c.push(n)}return c}))}function f(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){let i={},c=yield(0,r.GetConnectionBulk)(e),a=[];for(let e=0;e<c.length;e++)a.push(c[e].toTheConceptId),a.push(c[e].ofTheConceptId),a.push(c[e].typeId);yield(0,r.GetConceptBulk)(a),c.sort((function(e,t){return t.id-e.id}));for(let e=0;e<c.length;e++){let n=!1;if(o.includes(c[e].id)&&(n=!0),1==n){if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let n=t[c[e].toTheConceptId],o=yield(0,r.GetTheConcept)(c[e].typeId),i=n,a=Object.keys(i)[0];try{let n=o.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[a][n])||("string"==typeof i[a]&&(i[a]={}),i[a][n]=[]),i[a][n].push(t[c[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let n=t[c[e].ofTheConceptId],o=yield(0,r.GetTheConcept)(c[e].typeId),i=n,a=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[a][o.characterValue])||("string"==typeof i[a]&&(i[a]={}),i[a][o.characterValue]=[]),i[a][o.characterValue].push(t[c[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}},7106:(e,t,n)=>{n.d(t,{zl:()=>v,b6:()=>C,e$:()=>I,y6:()=>T,yV:()=>g,_W:()=>m});var o=n(2370),i=n(6687);function r(e){return e.startsWith("the_")?e.slice(4):e}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n){return c(this,void 0,void 0,(function*(){var i,r,c,a,s,l,d,h;let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let p=!1;n.includes(e[u].id)&&(p=!0);let f=yield(0,o.GetTheConcept)(e[u].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[u].toTheConceptId);if(1==p&&0!=f.id&&0!=y.id){let n,s=null!==(r=null===(i=y.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self";e[u].toTheConceptId in t?n=t[e[u].toTheConceptId]:(n={},n[s]={},t[e[u].toTheConceptId]=n);let l=yield(0,o.GetTheConcept)(e[u].typeId);try{let e=null!==(a=null===(c=null==f?void 0:f.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"none",n=f.characterValue;l.characterValue,l.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}if(0!=f.id&&0!=y.id){let n,i=null!==(l=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self";e[u].ofTheConceptId in t?n=t[e[u].ofTheConceptId]:(n={},n[i]={},t[e[u].ofTheConceptId]=n);let r=yield(0,o.GetTheConcept)(e[u].typeId);try{let e=null!==(h=null===(d=null==y?void 0:y.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"none",n=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var s=n(5312),l=n(7876),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function h(e,t,n){if(e in t){let o=t[e];o&&(n[o.connectionType+"_count"]=o.count)}}var u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},p=n(5898);function f(e,t="DESC"){return"ASC"==t?e.sort((function(e,t){return e.id-t.id})):e.sort((function(e,t){return t.id-e.id})),e}var y=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function v(e,t){return y(this,arguments,void 0,(function*(e,t,n=""){let r=yield(0,o.SearchWithTypeAndLinkerApi)(e,t,n),c=r.compositionIds,a=r.internalConnections,l=r.linkers,d=r.reverse,h=r.mainCompositionIds,u=yield(0,i.QL)(l),p=yield(0,i.MT)(c,a);return yield(0,s.NK)(u,p,h,d)}))}function g(e,t,n,o,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),a=yield(0,i.rv)(t,n);return yield(0,s.Ve)(c,a,t,o,r)}))}function m(e,t,n,o,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),a=yield(0,i.D)(t,n);return yield(0,s.NK)(c,a,o,r)}))}function C(e,t,n,s,l){return y(this,void 0,void 0,(function*(){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnections",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:s,countInfos:l})).data}catch(e){console.error("formatConnections error sw: ",e),(0,o.handleServiceWorkerException)(e)}let d=yield(0,i.QL)(e);d=f(d);let h=[];h=yield a(d,h,s),h=yield function(e,t,n){return c(this,void 0,void 0,(function*(){var i,c,a,s,l,d,h,u;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let p=0;p<e.length;p++){let f=!1;n.includes(e[p].id)&&(f=!0);let y=yield(0,o.GetTheConcept)(e[p].ofTheConceptId),v=yield(0,o.GetTheConcept)(e[p].toTheConceptId);if(1==f&&0!=y.id&&0!=v.id){let n,l=null!==(c=null===(i=v.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self";e[p].toTheConceptId in t?(n=t[e[p].toTheConceptId],l in n||(n[l]={})):(n={},n[l]={},t[e[p].toTheConceptId]=n);let d=yield(0,o.GetTheConcept)(e[p].typeId);try{let e=null!==(s=null===(a=null==y?void 0:y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"none",t=y.characterValue,o=d.characterValue;""==o&&(o=e,o=r(o));let i={[e]:t},c=o+"_reverse";d.characterValue.includes("_s_")||("string"==typeof n[l]&&(n[l]={}),n[l][c]=i)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let n,i=null!==(d=null===(l=y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(n=t[e[p].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[p].ofTheConceptId]=n);let c=yield(0,o.GetTheConcept)(e[p].typeId);try{let e=null!==(u=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",t=v.characterValue,o=c.characterValue,a=(c.characterValue,!1);""==o&&(o=e,o=r(o),a=!0);let s={[e]:t};isNaN(Number(o))?c.characterValue.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][o]=a?t:s):(Array.isArray(n[i])||(n[i]=[]),n[i].push(t))}catch(e){console.log("this is error",e)}}}return t}))}(d,h,s);let u=yield function(e,t,n,i){return c(this,arguments,void 0,(function*(e,t,n,i,r=[]){var c,a,s,l,d,h;let u=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;r.includes(e[n].id)&&(i=!0);let u=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),p=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(1==i&&0!=u.id&&0!=p.id&&p.id in t){let i,r=null!==(a=null===(c=p.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self";e[n].toTheConceptId in t?i=t[e[n].toTheConceptId]:(i={},i[r]={},t[e[n].toTheConceptId]=i);let s=yield(0,o.GetTheConcept)(e[n].typeId);try{let o=s.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(i[r][o])?i[r][o].push(c):s.characterValue.includes("_s_")?(i[r][o]=[],i[r][o].push(c)):i[r][o]=c)}catch(e){console.log("this is error",e)}}if(0!=u.id&&0!=p.id&&u.id in t){let i,r=null!==(l=null===(s=u.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self";e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],"string"==typeof i[r]&&(i[r]={})):(i={},i[r]={},t[e[n].ofTheConceptId]=i);let c=!1,a=(yield(0,o.GetTheConcept)(e[n].typeId)).characterValue;""==a&&(a=p.characterValue,c=!0),""==a&&(a=null!==(h=null===(d=null==p?void 0:p.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"");try{let o=t[e[n].toTheConceptId];o&&(Array.isArray(i[r])?c?i[r].push(o[a]):i[r].push(o):Array.isArray(i[r][a])?i[r][a].push(o):a.includes("_s_")?(i[r][a]=[],c?i[r][a].push(o[a]):i[r][a].push(o)):i[r][a]=c?o[a]:o)}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o?(o.id=n[e],u.push(o)):(o={},o.id=n[e],u.push(o))}return u}))}(d,h,n,[],s);return u}))}function T(e,t,n,c,s){return y(this,arguments,void 0,(function*(e,t,n,c,s,u="DESC"){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnectionsJustId",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:c,countInfos:s,order:u})).data}catch(e){console.error("formatConnectionsJustId error sw: ",e),(0,o.handleServiceWorkerException)(e)}let y=yield(0,i.QL)(e),v=yield(0,p.V)(s);y=f(y,u);let g=[];g=yield a(y,g,c),g=yield function(e,t){return d(this,arguments,void 0,(function*(e,t,n=[]){var o,i,c,a,s,d,h,u;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let p=0;p<e.length;p++){let f=!1,y=yield(0,l.A)(e[p].ofTheConceptId),v=yield(0,l.A)(e[p].toTheConceptId);if(n.includes(e[p].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id){let n,s=yield(0,l.A)(e[p].typeId),d=null!==(i=null===(o=v.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[p].toTheConceptId in t?(n=t[e[p].toTheConceptId],d in n||(n[d]={})):(n={},n[d]={},t[e[p].toTheConceptId]=n);try{let t=null!==(a=null===(c=null==y?void 0:y.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"none",o=y.characterValue,i=s.characterValue;""==i&&(i=t,i=r(i));let l={id:y.id,[t]:o,created_on:e[p].entryTimeStamp},h=i+"_reverse";h.includes("_s_")||("string"==typeof n[d]&&(n[d]={}),n[d][h]=l)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let n,o=yield(0,l.A)(e[p].typeId),i=null!==(d=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(n=t[e[p].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[p].ofTheConceptId]=n);try{let t=null!==(u=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",c=v.characterValue,a=o.characterValue,s=!1;""==a&&(a=t,a=r(a),s=!0);let l={};l[t]={id:v.id,data:c,created_on:e[p].entryTimeStamp},isNaN(Number(a))?a.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][a]=s?l[t]:l):(Array.isArray(n[i])||(n[i]=[]),n[i].push(l[t]))}catch(e){console.log("this is error",e)}}}return t}))}(y,g,c);let m=yield function(e,t,n){return d(this,arguments,void 0,(function*(e,t,n,o=[],i){var r,c,a,s,d,u,p;(new Date).getTime();let f=[],y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,y=yield(0,l.A)(e[n].ofTheConceptId),v=yield(0,l.A)(e[n].toTheConceptId);if(o.includes(e[n].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id&&v.id in t){let o,i=yield(0,l.A)(e[n].typeId),a=null!==(c=null===(r=v.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",s=!1;e[n].toTheConceptId in t&&(s=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[a]&&(o[a]={})):(o={},o[a]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let r=t[e[n].ofTheConceptId];r&&(r.id=y.id,r.created_on=y.entryTimeStamp);let c=i.characterValue+"_reverse";Array.isArray(o[a][c])?o[a][c].push(r):c.includes("_s_")?(o[a][c]=[],o[a][c].push(r)):o[a][c]=r}}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id&&y.id in t){let o,r=yield(0,l.A)(e[n].typeId),c=null!==(s=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self",f=!1;e[n].toTheConceptId in t&&(f=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},t[e[n].ofTheConceptId]=o),h(y.id,i,o);let g=!1,m=r.characterValue;""==m&&(m=v.characterValue,g=!0),""==m&&(m=(null===(d=null==v?void 0:v.type)||void 0===d?void 0:d.characterValue)||"");try{let r=null!==(p=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==p?p:"none",a=t[e[n].toTheConceptId];if(a){let t={};t[r]={data:a[r],id:v.id,created_on:e[n].entryTimeStamp},Array.isArray(o[c])?g?o[c].push(a[m]):o[c].push(a):Array.isArray(o[c][m])?o[c][m].push(t):m.includes("_s_")?(o[c][m]=[],g?o[c][m].push(t[r]):o[c][m].push(t)):o[c][m]=g?t[r]:t,h(v.id,i,t)}}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o={};o=t[n[e]],o||(o={}),o.id=n[e],f.push(o)}return f}))}(y,g,n,c,v);return m}))}function I(e,t,n,c,a){return y(this,arguments,void 0,(function*(e,t,n,c,a,s="DESC"){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnectionsDataId",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:c,countInfos:a,order:s})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,o.handleServiceWorkerException)(e)}let l=yield(0,i.QL)(e),d=yield(0,p.V)(a);l=f(l,s);let y=[];y=yield function(e,t){var n=arguments;return u(this,arguments,void 0,(function*(e,t,i=[]){var r,c,a,s,l,d,h,u;const p=o.Logger.logfunction("FormatFunctionData",n);let f=[];for(let t=0;t<e.length;t++)f.push(e[t].toTheConceptId),f.push(e[t].ofTheConceptId),f.push(e[t].typeId);for(let n=0;n<e.length;n++){let p=!1,f=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(p=!0),1==p&&0!=f.id&&0!=y.id){let i,l=yield(0,o.GetTheConcept)(e[n].typeId),d=null!==(c=null===(r=y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[n].toTheConceptId in t?i=t[e[n].toTheConceptId]:(i={},i[d]={},t[e[n].toTheConceptId]=i);try{let e=null!==(s=null===(a=null==f?void 0:f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"none",n=f.characterValue;(l.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}if(0!=f.id&&0!=y.id){let i,r=yield(0,o.GetTheConcept)(e[n].typeId),c=null!==(d=null===(l=f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[n].ofTheConceptId in t?i=t[e[n].ofTheConceptId]:(i={},i[c]={},t[e[n].ofTheConceptId]=i);try{let e=null!==(u=null===(h=null==y?void 0:y.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",n=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return o.Logger.logUpdate(p),t}))}(l,y,c),y=yield function(e,t){var n=arguments;return u(this,arguments,void 0,(function*(e,t,i=[]){var c,a,s,l,d,h,u,p;const f=o.Logger.logfunction("FormatFunctionDataForData",n);let y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,y=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),v=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id){let i,d=yield(0,o.GetTheConcept)(e[n].typeId),h=null!==(a=null===(c=v.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self";e[n].toTheConceptId in t?(i=t[e[n].toTheConceptId],h in i||(i[h]={})):(i={},i[h]={},t[e[n].toTheConceptId]=i);try{let e=null!==(l=null===(s=null==y?void 0:y.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"none",t=y.characterValue,n=d.characterValue;""==n&&(n=e,n=r(n));let o={id:y.id,data:{[e]:t}},c=n+"_reverse";c.includes("_s_")||("string"==typeof i[h]&&(i[h]={}),i[h][c]=o)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),a=null!==(h=null===(d=y.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"self";e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],a in i||(i[a]={})):(i={},i[a]={},t[e[n].ofTheConceptId]=i);try{let e=null!==(p=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==p?p:"none",t=v.characterValue,n=c.characterValue,o=!1;""==n&&(n=e,n=r(n),o=!0);let s={id:v.id,data:{[e]:t}};isNaN(Number(n))?n.includes("_s_")||("string"==typeof i[a]&&(i[a]={}),i[a][n]=s):(Array.isArray(i[a])||(i[a]=[]),i[a].push(s))}catch(e){console.log("this is error",e)}}}return o.Logger.logUpdate(f),t}))}(l,y,c);let v=yield function(e,t,n,i){var r=arguments;return u(this,arguments,void 0,(function*(e,t,n,i,c=[],a){var s,l,d,u,p,f;const y=o.Logger.logfunction("FormatFromConnectionsAlteredArrayExternal",r);let v=[],g=[];for(let t=0;t<e.length;t++)g.push(e[t].toTheConceptId),g.push(e[t].ofTheConceptId),g.push(e[t].typeId);for(let n=0;n<e.length;n++){let i=!1,r=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(c.includes(e[n].id)&&(i=!0),1==i&&0!=r.id&&0!=y.id&&y.id in t){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),a=null!==(l=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self",d=!1;e[n].toTheConceptId in t&&(d=!0),e[n].toTheConceptId in t?(i=t[e[n].toTheConceptId],"string"==typeof i[a]&&(i[a]={})):(i={},i[a]={},t[e[n].toTheConceptId]=i);try{if(t[e[n].ofTheConceptId]){let o={id:r.id,data:t[e[n].ofTheConceptId],created_on:e[n].entryTimeStamp},s=c.characterValue+"_reverse";Array.isArray(i[a][s])?i[a][s].push(o):s.includes("_s_")?(i[a][s]=[],i[a][s].push(o)):i[a][s]=o}}catch(e){console.log("this is error",e)}}if(0!=r.id&&0!=y.id&&r.id in t){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),s=null!==(u=null===(d=r.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self",l=!1;e[n].toTheConceptId in t&&(l=!0),e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],"string"==typeof i[s]&&(i[s]={})):(i={},i[s]={},t[e[n].ofTheConceptId]=i),h(r.id,a,i);let v=!0,g=c.characterValue;""==g&&(g=y.characterValue,v=!0),""==g&&(g=(null===(p=null==y?void 0:y.type)||void 0===p?void 0:p.characterValue)||"");try{null===(f=null==y?void 0:y.type)||void 0===f||f.characterValue;let o=t[e[n].toTheConceptId];if(o){let r={id:y.id,data:t[e[n].toTheConceptId],created_on:e[n].entryTimeStamp};Array.isArray(i[s])?i[s].push(o):Array.isArray(i[s][g])?i[s][c.characterValue].push(r):g.includes("_s_")?(i[s][g]=[],i[s][g].push(r)):i[s][g]=r,h(y.id,a,r)}}catch(e){console.log("this is error",e)}}}for(let e=0;e<i.length;e++){let n={};n.id=i[e];let r=yield(0,o.GetTheConcept)(n.id);n.data=t[i[e]],n.created_on=r.entryTimeStamp,v.push(n)}return o.Logger.logUpdate(y),v}))}(l,y,[],n,c,d);return v}))}},3518:(e,t,n)=>{n.d(t,{BZ:()=>c,Xr:()=>i,ab:()=>r});var o=n(3278);function i(e="application/json",t="application/json"){let n={};return n=""!=o.b.BearerAccessToken?{"Content-Type":e,Authorization:"Bearer "+o.b.BearerAccessToken,Accept:t}:{"Content-Type":e,Accept:t},n}function r(e="application/json",t="",n="application/json"){""==t&&(t=o.b.BearerAccessToken);let i={};return i=""!=t?{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}:{"Content-Type":e,Accept:n},i}function c(){let e=o.b.BearerAccessToken;const t=new Headers;return t.append("Authorization","Bearer "+e),t}},6467:(e,t,n)=>{function o(e){const t=e.lastIndexOf("_");let n=[];return n=t>0?[e.substring(0,t),e.substring(t+1,e.length)]:[e],n}n.d(t,{f:()=>o})},4310:(e,t,n)=>{n.d(t,{Cp:()=>h,ix:()=>p,qj:()=>u});var o=n(2370),i=n(5898),r=n(1863),c=n(7106),a=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const l=new Map,d=new Map;function h(e){var t=arguments;return s(this,void 0,void 0,(function*(){o.Logger.logfunction("BuildWidgetFromId",t);try{if(o.serviceWorker)return(yield(0,o.sendMessage)("BuildWidgetFromId",{id:e})).data}catch(e){console.error("BuildWidgetFromId error sw: ",e),(0,o.handleServiceWorkerException)(e)}let n={};if(l.has(e))return l.get(e)||n;const d=(()=>s(this,void 0,void 0,(function*(){try{let t=[],s=[],l=[],d=[],h="DESC",u=[],p={},f=(0,a.Xr)("application/json"),y=o.BaseUrl.getWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];p=yield v.json(),t=p.conceptIds,s=p.linkers,l=p.reverse,d=p.mainCompositionIds,u=p.countinfo;let g=(0,i.w)(u);return n=yield(0,c.e$)(s,t,d,l,g,h),n}catch(e){throw console.log("this is the error in the build widget",e),e}finally{l.delete(e)}})))();return l.set(e,d),d}))}function u(e){var t=arguments;return s(this,void 0,void 0,(function*(){o.Logger.logfunction("BuildWidgetFromIdForLatest",t);try{if(o.serviceWorker)return(yield(0,o.sendMessage)("BuildWidgetFromIdForLatest",{id:e})).data}catch(e){console.error("BuildWidgetFromIdForLatest error sw: ",e),(0,o.handleServiceWorkerException)(e)}let n={};if(d.has(e))return d.get(e)||n;const l=(()=>s(this,void 0,void 0,(function*(){try{let t=[],s=[],l=[],d=[],h="DESC",u=[],p={},f=(0,a.Xr)("application/json"),y=o.BaseUrl.getLatestWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];p=yield v.json(),t=p.conceptIds,s=p.linkers,l=p.reverse,d=p.mainCompositionIds,u=p.countinfo;let g=(0,i.w)(u);return n=yield(0,c.e$)(s,t,d,l,g,h),{data:n,mainId:p.mainId}}catch(e){throw console.log("this is the error in the build widget",e),e}finally{d.delete(e)}})))();return d.set(e,l),l}))}function p(e,t){for(let n=0;n<e.length;n++)if(e[n].id==t)return e[n]}},4287:(e,t,n)=>{n.d(t,{w:()=>c});var o=n(2370),i=n(3130),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{constructor(){this.subscribers=[],this.mainConcept=0,this.compositionIds=[],this.conceptIds=[],this.internalConnections=[],this.reverse=[],this.linkers=[],this.dependency=[],this.isDataLoaded=!1,this.isUpdating=!1,this.fetched=!1,this.format=i.yv}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let n=e;if(!t.compositionIds.includes(null==n?void 0:n.detail)){t.compositionIds.unshift(null==n?void 0:n.detail),t.listenToEvent(null==n?void 0:n.detail);let e=null==n?void 0:n.detail,i=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)yield o.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}))}t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let n=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield o.ConnectionData.GetConnection(n[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEventConnectionType(e,t){window.addEventListener(`${e}`,(n=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let n=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let i=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)i.typeId==t&&(yield o.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==n.mainConcept?n.internalConnections.includes(e.id)||n.internalConnections.push(e.id):n.linkers.includes(e.id)||n.linkers.push(e.id),n.conceptIds.includes(e.toTheConceptId)||n.conceptIds.push(e.toTheConceptId),n.compositionIds.includes(e.ofTheConceptId)||n.compositionIds.push(e.ofTheConceptId)})));n.isUpdating=!1,yield n.bind(),n.notify()}))}),200)}}))}bind(){return r(this,void 0,void 0,(function*(){console.log("this is the old execute data")}))}update(){return r(this,void 0,void 0,(function*(){this.isDataLoaded=!1,yield this.bind(),this.notify()}))}subscribe(e){return r(this,void 0,void 0,(function*(){return this.subscribers.push(e),console.log("again executing data"),yield this.bind(),e(this.data,this)}))}unsubscribe(e){return this.subscribers.filter((t=>t!=e)),this.subscribers.length}notify(){console.log("notifiers",this.subscribers),this.subscribers.map((e=>{console.log("notify"),e(this.data,this)}))}}},5328:(e,t,n)=>{n.d(t,{d:()=>l});var o=n(2370),i=n(3130),r=n(8939),c=n(4287),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s extends c.w{constructor(e,t,n,o,i){super(),this.connections=[],this.data=[],this.mainConcept=e,this.linker=t,this.inpage=n,this.page=o,this.format=i}bind(){return a(this,void 0,void 0,(function*(){var e;if(!this.isDataLoaded){let i=yield(0,o.GetTheConcept)(this.mainConcept),r=(null===(e=i.type)||void 0===e?void 0:e.characterValue)+"_s_"+this.linker,c=yield(0,o.GetConceptByCharacterAndType)(r,16);if(c.id>0){let e=yield(0,o.GetConnectionOfTheConcept)(c.id,i.id,i.userId,this.inpage,this.page);this.connections=e;for(var t=[],n=0;n<this.connections.length;n++)t.push(this.connections[n].toTheConceptId),this.linkers.push(this.connections[n].id),this.listenToEvent(this.connections[n].toTheConceptId);yield(0,o.GetAllConnectionsOfCompositionBulk)(t)}this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return a(this,void 0,void 0,(function*(){this.data=[],this.connections=yield(0,o.GetConnectionBulk)(this.linkers);for(var e=0;e<this.connections.length;e++){let t=this.connections[e].toTheConceptId,n=yield(0,o.GetTheConcept)(t);if(console.log("this is the format",this.format),this.format==i.yv){let e=yield(0,r.RW)(n.id);this.data.push(e)}else if(this.format==i.ZJ){let e=yield(0,r.kx)(n.id);this.data.push(e)}else if(this.format==i.iw){let e=yield(0,o.GetCompositionWithIdAndDateFromMemory)(n.id);this.data.push(e)}else{let e=yield(0,o.GetCompositionWithIdAndDateFromMemory)(n.id);this.data.push(e)}}return this.data}))}}function l(e,t,n,o,r=i.yv){return new s(e,t,n,o,r)}},2370:(e,t,n)=>{n.r(t),n.d(t,{ADMIN:()=>Dn,ALLID:()=>En.BG,AccessTracker:()=>qe.J,AddGhostConcept:()=>hn,Anomaly:()=>_o,BaseUrl:()=>l.B,BinaryTree:()=>Oe.W,BuildWidgetFromId:()=>Jo.Cp,BuilderStatefulWidget:()=>No,Composition:()=>Et,CompositionBinaryTree:()=>bt,CompositionNode:()=>Gt,Concept:()=>oo.j,ConceptsData:()=>s.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>D.A,CreateConnectionBetweenEntityLocal:()=>Ho,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Sn.h,CreateData:()=>ai,CreateDefaultConcept:()=>P.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>H,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>En.y0,DATAIDDATE:()=>En.iw,DelayFunctionExecution:()=>Rn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>_n,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Eo,DeleteUser:()=>$e,DependencyObserver:()=>Mn.w,FilterSearch:()=>lo,FormatFromConnections:()=>un.vw,FormatFromConnectionsAltered:()=>un.y8,FreeschemaQuery:()=>Fo,FreeschemaQueryApi:()=>Uo,GetAllConnectionsOfComposition:()=>E.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Do,GetComposition:()=>v.Nj,GetCompositionBulk:()=>tt.dF,GetCompositionBulkWithDataId:()=>tt.cw,GetCompositionFromConnectionsWithDataId:()=>tt.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>tt.km,GetCompositionFromConnectionsWithDataIdInObject:()=>tt.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>tt.Nt,GetCompositionFromConnectionsWithIndex:()=>tt.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>tt.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>w,GetCompositionListListener:()=>zn,GetCompositionListLocal:()=>x,GetCompositionListLocalWithId:()=>R,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Hn,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>_,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>qt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>ft.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>xn,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>no,GetLinkListener:()=>Xn.d,GetLinkRaw:()=>se,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>pn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>En.ZJ,LConcept:()=>io,LConnection:()=>ro,LISTNORMAL:()=>En.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>so.H,LocalTransaction:()=>Lo,Logger:()=>vo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>z.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>Ge,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>En.yv,PRIVATE:()=>Fn,PUBLIC:()=>Wn,PatcherStructure:()=>co,Prototype:()=>pi,RAW:()=>En.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>at,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>Kn,SchemaQueryListener:()=>Vo,SearchAllConcepts:()=>Mt,SearchLinkInternal:()=>An,SearchLinkInternalAll:()=>Ln,SearchLinkMultipleAll:()=>un.cf,SearchLinkMultipleAllObservable:()=>Pn,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>et,SearchStructure:()=>ho,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Qn.zl,SearchWithTypeAndLinkerApi:()=>On,SessionData:()=>ao,Signin:()=>kt,Signup:()=>Tt,SignupEntity:()=>It,SplitStrings:()=>a.f,StatefulWidget:()=>wo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Ut,UpdateCompositionLocal:()=>fn.D,UserBinaryTree:()=>sn,Validator:()=>Bo,ViewInternalData:()=>In,ViewInternalDataApi:()=>Cn,WidgetTree:()=>jo,convertFromConceptToLConcept:()=>wn.F4,convertFromLConceptToConcept:()=>wn.dp,convertWidgetTreeToWidget:()=>ti,convertWidgetTreeToWidgetWithWrapper:()=>ni,createFormFieldData:()=>xo,createPrototypeLocal:()=>vi,dispatchIdEvent:()=>bi,getFromDatabaseWithType:()=>ne,getObjectsFromIndexDb:()=>oe,getWidgetBulkFromId:()=>ei,getWidgetFromId:()=>Ko,handleServiceWorkerException:()=>xi,hasActivatedSW:()=>ki,init:()=>Li,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>xt,renderLatestWidget:()=>Xo,renderPage:()=>Qo,renderWidget:()=>Yo,searchLinkMultipleListener:()=>Vn,sendEmail:()=>Co,sendMessage:()=>Si,serviceWorker:()=>mi,setHasActivatedSW:()=>Ni,storeToDatabase:()=>te,subscribedListeners:()=>Ii,unwrapContainers:()=>ri,updateAccessToken:()=>Ai,uploadAttachment:()=>ht,uploadFile:()=>pt,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var o={};n.r(o),n.d(o,{ADMIN:()=>Dn,ALLID:()=>En.BG,AccessTracker:()=>qe.J,AddGhostConcept:()=>hn,Anomaly:()=>_o,BaseUrl:()=>l.B,BinaryTree:()=>Oe.W,BuildWidgetFromId:()=>Jo.Cp,BuilderStatefulWidget:()=>No,Composition:()=>Et,CompositionBinaryTree:()=>bt,CompositionNode:()=>Gt,Concept:()=>oo.j,ConceptsData:()=>s.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>D.A,CreateConnectionBetweenEntityLocal:()=>Ho,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Sn.h,CreateData:()=>ai,CreateDefaultConcept:()=>P.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>H,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>En.y0,DATAIDDATE:()=>En.iw,DelayFunctionExecution:()=>Rn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>_n,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Eo,DeleteUser:()=>$e,DependencyObserver:()=>Mn.w,FilterSearch:()=>lo,FormatFromConnections:()=>un.vw,FormatFromConnectionsAltered:()=>un.y8,FreeschemaQuery:()=>Fo,FreeschemaQueryApi:()=>Uo,GetAllConnectionsOfComposition:()=>E.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Do,GetComposition:()=>v.Nj,GetCompositionBulk:()=>tt.dF,GetCompositionBulkWithDataId:()=>tt.cw,GetCompositionFromConnectionsWithDataId:()=>tt.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>tt.km,GetCompositionFromConnectionsWithDataIdInObject:()=>tt.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>tt.Nt,GetCompositionFromConnectionsWithIndex:()=>tt.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>tt.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>w,GetCompositionListListener:()=>zn,GetCompositionListLocal:()=>x,GetCompositionListLocalWithId:()=>R,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Hn,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>_,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>qt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>ft.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>xn,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>no,GetLinkListener:()=>Xn.d,GetLinkRaw:()=>se,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>pn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>En.ZJ,LConcept:()=>io,LConnection:()=>ro,LISTNORMAL:()=>En.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>so.H,LocalTransaction:()=>Lo,Logger:()=>vo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>z.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>Ge,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>En.yv,PRIVATE:()=>Fn,PUBLIC:()=>Wn,PatcherStructure:()=>co,Prototype:()=>pi,RAW:()=>En.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>at,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>Kn,SchemaQueryListener:()=>Vo,SearchAllConcepts:()=>Mt,SearchLinkInternal:()=>An,SearchLinkInternalAll:()=>Ln,SearchLinkMultipleAll:()=>un.cf,SearchLinkMultipleAllObservable:()=>Pn,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>et,SearchStructure:()=>ho,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Qn.zl,SearchWithTypeAndLinkerApi:()=>On,SessionData:()=>ao,Signin:()=>kt,Signup:()=>Tt,SignupEntity:()=>It,SplitStrings:()=>a.f,StatefulWidget:()=>wo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Ut,UpdateCompositionLocal:()=>fn.D,UserBinaryTree:()=>sn,Validator:()=>Bo,ViewInternalData:()=>In,ViewInternalDataApi:()=>Cn,WidgetTree:()=>jo,convertFromConceptToLConcept:()=>wn.F4,convertFromLConceptToConcept:()=>wn.dp,convertWidgetTreeToWidget:()=>ti,convertWidgetTreeToWidgetWithWrapper:()=>ni,createFormFieldData:()=>xo,createPrototypeLocal:()=>vi,dispatchIdEvent:()=>bi,getFromDatabaseWithType:()=>ne,getObjectsFromIndexDb:()=>oe,getWidgetBulkFromId:()=>ei,getWidgetFromId:()=>Ko,handleServiceWorkerException:()=>xi,hasActivatedSW:()=>ki,init:()=>Li,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>xt,renderLatestWidget:()=>Xo,renderPage:()=>Qo,renderWidget:()=>Yo,searchLinkMultipleListener:()=>Vn,sendEmail:()=>Co,sendMessage:()=>Si,serviceWorker:()=>mi,setHasActivatedSW:()=>Ni,storeToDatabase:()=>te,subscribedListeners:()=>Ii,unwrapContainers:()=>ri,updateAccessToken:()=>Ai,uploadAttachment:()=>ht,uploadFile:()=>pt,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var i=n(5020),r=n(205),c=n(2832),a=n(6467),s=n(9639),l=n(9581),d=n(3518),h=n(1863),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function p(e,t){var n=arguments;return u(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetAllConceptsByType",n);try{var i=new URLSearchParams;i.append("type",e),i.append("user_id",t.toString());var r=(0,d.Xr)("application/x-www-form-urlencoded");const n=yield fetch(l.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:r,body:i});if(n.ok){const e=yield n.json();for(var c=0;c<e.length;c++)s.I.AddConcept(e[c])}else console.log("GetAllConceptsByType error",n.status),(0,h.ry)(n)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,h.Mb)(e,l.B.GetAllConceptsByTypeUrl()),(0,h.ey)(o,"GetAllConceptsByType",e)}}))}var f=n(8642),y=n(9736),v=n(8939),g=n(2013),m=n(8064),C=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function T(e,t){var n=arguments;return C(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetCompositionList",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetCompositionList",{compositionName:e,userId:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetCompositionList sw error: ",e),(0,h.ey)(r,"GetCompositionList",e),xi(e)}}let c=yield(0,g.A)(e),a=[];if(c){yield p(e,t);let n=yield s.I.GetConceptsByTypeIdAndUser(c.id,t),r=o*(i-1),l=[];for(let e=r;e<r+o;e++)n[e]&&l.push(n[e].id);yield(0,f.Y)(l);for(let e=r;e<r+o;e++)if(n[e]){let t=yield(0,v.kx)(n[e].id);a.push(t)}}return vo.V.logUpdate(r),a}))}function I(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=x(e,t),r=T(e,t),c=[];return Promise.race([i,r]).then((e=>{console.log("Promise result",e),c.push(...e)})).catch((e=>{console.log("error in handling",e)})),r.then((e=>{console.log("This is the second promise result",e),c.push(...e)})),c}))}function w(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){if(mi)try{return(yield Si("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),xi(e)}let i=yield(0,m.Ay)(e),r=yield(0,g.A)(e),c=[],a=[],l=[],d=[];0!=i.id&&(a=yield y.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),d=yield s.I.GetConceptsByTypeIdAndUser(r.id,t),c=d);for(let e=0;e<a.length;e++){let t=!1;for(let n=0;n<d.length;n++)a[e].ghostId==d[n].ghostId&&(t=!0);t||l.push(a[e])}console.log("This is the all list",l);let h=[];return h=yield function(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=[],r=n*(o-1),c=[],a=t.length;for(let t=r;t<r+n-a;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let n=yield _(t[e].id);i.push(n)}yield(0,f.Y)(c);for(let t=r;t<r+n-a;t++)if(e[t]){let n=yield(0,v.RW)(e[t].id);i.push(n)}return i}))}(c,l,n,o),h}))}function k(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){if(mi)try{return(yield Si("GetCompositionListWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),xi(e)}let i=yield(0,g.A)(e),r=[];if(i){yield p(e,t);let c=yield s.I.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),l=[];for(let e=a;e<a+n;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=a;e<a+n;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}function N(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=yield(0,g.w)(e),r=[];if(i){yield p(e,t);let c=yield s.I.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),l=[];for(let e=a;e<a+n;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=a;e<a+n;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}var A=n(4864),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},S=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function G(e){return S(this,void 0,void 0,(function*(){var t,n;try{if(mi)try{return(yield Si("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),xi(e)}let o=[],i={};o=yield A.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<o.length;e++)r.includes(o[e].ofTheConceptId)||r.push(o[e].ofTheConceptId);let c=yield y.v.GetConcept(e);if(0==c.id){let t=yield function(e){var t=arguments;return L(this,void 0,void 0,(function*(){const n=vo.V.logfunction("TranslateLocalToReal",t);let o=(0,P.o)();try{var i=(0,d.ab)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetRealConceptById(),{method:"POST",headers:i,body:`id=${e}`});if(t.ok)return o=yield t.json(),o.id>0&&s.I.AddConcept(o),o;console.log("Error in Getting Translating concept Error",t.status),(0,h.ry)(t),vo.V.logUpdate(n)}catch(e){e instanceof Error?console.log("Error in Getting Translating concept error message: ",e):console.log("Error in Getting Translating concept unexpected error: ",e),(0,h.Mb)(e,l.B.GetRealConceptById()),(0,h.ey)(n,"TranslateLocalToReal",e)}return o}))}(e);if(t.id>0)return yield(0,v.Nj)(t.id)}let a=yield b(e,o,r);return i[null!==(n=null===(t=null==c?void 0:c.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=a,i}catch(e){throw e}}))}function _(e){return S(this,void 0,void 0,(function*(){var t,n;try{if(mi)try{return(yield Si("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),xi(e)}let o=[],i={},r={};o=yield A.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<o.length;e++)c.includes(o[e].ofTheConceptId)||c.push(o[e].ofTheConceptId);let a=yield y.v.GetConcept(e);if(0!=a.id){let r=yield b(e,o,c);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=r}return r.data=i,r.id=e,r}catch(e){throw e}}))}function b(e,t,n){return S(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c;let a={},s=[],l=yield y.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield y.v.GetConcept(e);l.type=t}if(null===(i=null==l?void 0:l.type)||void 0===i?void 0:i.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e);for(let o=0;o<t.length;o++)if(t[o].ofTheConceptId==e){let e=t[o].toTheConceptId,i=yield y.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield y.v.GetConcept(e);i.type=t}let l="the_",d=(null!==(c=null===(r=null==i?void 0:i.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace(l,"");if(isNaN(Number(d))){if(d){const o=yield b(e,t,n);a[d]=o}}else{const o=yield b(e,t,n);s[d]=o,a=s}}return a}))}var B=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function x(e,t){return B(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),xi(e)}try{let n=yield(0,m.Ay)(e),o=[];if(0!=n.id){let e=yield y.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield G(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}function R(e,t){return B(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),xi(e)}try{let n=yield(0,m.Ay)(e),o=[];if(0!=n.id){let e=yield y.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield _(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}var E=n(2),D=n(1218),F=n(999),W=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function U(e,t,n){var o=arguments;return W(this,arguments,void 0,(function*(e,t,n,i=10,r=1){const c=vo.V.logfunction("GetConnectionOfTheConcept",o)||{};let a=[];try{if(mi){c.serviceWorker=!0;try{const o=yield Si("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:n,inpage:i,page:r});return vo.V.logUpdate(c),o.data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),(0,h.ey)(c,"GetConnectionOfTheConcept",e),xi(e)}}let o=new URLSearchParams;o.append("typeId",`${e}`),o.append("ofTheConceptId",`${t}`),o.append("userId",`${n}`),o.append("inpage",`${i}`),o.append("page",`${r}`);let s=(0,d.Xr)("application/x-www-form-urlencoded");const u=yield fetch(l.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:s,body:o});return u.ok?a=yield u.json():((0,h.ey)(c,"GetConnectionOfTheConcept",u.status),(0,h.ry)(u),console.log("Get connection of concept error",u.status)),vo.V.logUpdate(c),a}catch(e){e instanceof Error?console.log("Get connection of concept error message: ",e.message):console.log("Get connection of concept unexpected error: ",e),(0,h.Mb)(e,l.B.GetAllConnectionsOfConceptUrl()),(0,h.ey)(c,"GetConnectionOfTheConcept",e)}}))}var O=n(2155),M=n(442),P=n(7282),V=n(5976),j=n(7273),$=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function H(e,t,n,o){return $(this,arguments,void 0,(function*(e,t,n,o,i=1,r=4){if(e>0&&n>0){var c=t,a=yield V.p.getId(),s=new O.N(a,e,n,c,o,i,r);return e==n?(s.ofTheConceptId=0,s.toTheConceptId=1,s):(s.toUpdate=!0,s.isTemp=!1,M.Y.AddConnection(s),s)}throw new j.z("cannot create connection because id are negative ",!1,400,"")}))}var J=n(1838),q=n(7876),z=n(8407),Q=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function X(e,t,n){return Q(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;if(mi)try{return(yield Si("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:n,both:o,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),xi(e)}let a=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Y(o,t,a));let s=yield(0,z.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,a,s.id,1e3,4);M.Y.AddConnection(l)}let s=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+s;i&&(yield Y(s,e,a));let d=yield(0,z.A)("connection",l,!1,999,999,999),h=new O.N(0,e.id,t.id,a,d.id,1e3,4);return M.Y.AddConnection(h),h}))}function Y(e,t){return Q(this,arguments,void 0,(function*(e,t,n=null){var o;let i=t,r=null!=n?n:t.userId,c=e+"_count",a=(null===(o=t.type)||void 0===o?void 0:o.characterValue)+"_s_"+c,s=yield(0,z.A)("connection",a,!1,r,4,999),l=yield U(s.id,t.id,r,10,1),d=[],h=(0,P.o)();for(let e=0;e<l.length;e++){let t=yield(0,q.A)(l[e].toTheConceptId);d.push(t)}if(d.length<1)h=yield(0,z.A)("count","1",!1,r,4,999);else{let e=d[0],t=0;try{t=Number(e.characterValue)}catch(e){t=0}t+=1,h=yield(0,z.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,J.m)(l[e].id)}let u=new O.N(0,i.id,h.id,i.userId,s.id,1e3,4);yield M.Y.AddConnection(u)}))}function Z(e,t,n){return Q(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;let a=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Y(o,t,a));let s=yield(0,z.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,a,s.id,1e3,4);M.Y.AddConnection(l)}let s=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+s;i&&(yield Y(s,e,a));let d=yield(0,z.A)("connection",l,!1,999,999,999);return yield H(e.id,e.userId,t.id,d.id,1e3,4)}))}var K=n(5868),ee=(n(3655),function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))});function te(e,t){const n=vo.V.logfunction("storeToDatabase",[e,"noindexdb"]);vo.V.logUpdate(n)}function ne(e,t,n){return ee(this,void 0,void 0,(function*(){const t=vo.V.logfunction("getFromDatabaseWithType",[e,"noindexdb"]);vo.V.logUpdate(t)}))}function oe(e){return ee(this,void 0,void 0,(function*(){const t=vo.V.logfunction("getObjectsFromIndexDb",[e,"noindexdb"]);vo.V.logUpdate(t)}))}var ie=n(1666),re=n(4402),ce=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ae(e,t){var n=arguments;return ce(this,arguments,void 0,(function*(e,t,o=10,i=1){var r;const c=vo.V.logfunction("GetLink",n)||{};if(mi){c.serviceWorker=!0;try{const n=yield Si("GetLink",{id:e,linker:t,inpage:o,page:i});return vo.V.logUpdate(c),n.data}catch(e){console.error("GetLink sw error: ",e),(0,h.ey)(c,"GetLink",e),xi(e)}}let a=[],s=yield(0,q.A)(e),l=(null===(r=s.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield U(d.id,s.id,s.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,v.Ez)(o.id);a.push(i)}}return vo.V.logUpdate(c),a}))}function se(e,t){var n=arguments;return ce(this,arguments,void 0,(function*(e,t,o=10,i=1){var r;const c=vo.V.logfunction("GetLinkRaw",n);let a=[],s=yield(0,q.A)(e),l=(null===(r=s.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield U(d.id,s.id,s.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n);a.push(o)}}return vo.V.logUpdate(c),a}))}var le=n(8357),de=n(2212);class he{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.isNew=l}}class ue{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new he(0,"0",0,0,0,0,0,0,"0",!1),n=0;n<this.characterData.length;n++)this.characterData[n].data==e&&(t=this.characterData[n]);return t}}ue.characterData=[];class pe{constructor(e,t,n,o){this.id=e,this.userId=t,this.referentId=n,this.isNew=o}}var fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},ye=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ve(e,t,n,o,i){return ye(this,void 0,void 0,(function*(){return new he(t,e,n,t,o,t,i,t,"",!1),yield function(){return fe(this,void 0,void 0,(function*(){var e;const t=vo.V.logfunction("CreateTheCharacter",e);try{if(0==(e=ue.GetCharacter(e.data)).id){var n=(0,d.Xr)();const i=yield fetch(l.B.CreateTheCharacterDataUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!i.ok)throw(0,h.ry)(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();var o=new he(r.userId,e.data,0,0,4,4,999,999,"",!1);return o.id=r.id,ue.AddCharacter(o),vo.V.logUpdate(t),r}return new pe(e.id,e.userId,0,!1)}catch(e){throw e instanceof Error?console.log("create the character error message: ",e.message):console.log("create the character unexpected error: ",e),(0,h.ey)(t,"CreateTheCharacter",e),e}}))}()}))}var ge=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function me(e,t,n,o,i,r,c){return ge(this,void 0,void 0,(function*(){let a=yield(0,re.A)(e,o),s=a;return 0==s.id&&(a=yield(0,de.Ay)(e,t,n,o,i,r,c),s=a),s}))}var Ce=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Te=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ie(e,t,n,o){var i=arguments;return Te(this,void 0,void 0,(function*(){const r=vo.V.logfunction("MakeTheTypeConcept",i)||{};if(mi){r.serviceWorker=!0;try{const i=yield Si("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:n,userId:o});return vo.V.logUpdate(r),i.data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),(0,h.ey)(r,"MakeTheTypeConcept",e),xi(e)}}let c=yield(0,g.A)(e);if(c&&(0==c.id||0==c.userId)){let i=(0,a.f)(e);if(i.length>0)if(i[0]==e){let n=yield function(e,t,n,o,i,r){return Ce(this,void 0,void 0,(function*(){let n;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ve(e,t,999,o,r),n=me(e,t,4,c,i,o,"the_character")}else{let i=yield ve(e,t,999,o,r);i.isNew,n=yield me(e,t,4,51,i.id,o,"the_characters")}return n}))}(e,o,0,999,0,t);c=n}else{let r=yield Ie(i[0],t,n,o),a=yield Ie(i[1],t,n,o);a&&(c=yield(0,de.N)(e,o,r.id,a.id,999,999,i[1]))}}return vo.V.logUpdate(r),c}))}var we=n(8146),ke=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ne=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ae(e){return Ne(this,void 0,void 0,(function*(){const t=vo.V.logfunction("GetConceptByCharacterAndCategory",e);let n=(0,P.o)();if("the"==e)return n.id=1,n.typeId=5,n.characterValue="the",n;let o=(0,a.f)(e);if(o.length>1){let t=1,i=yield Ae(o[0]);0!=i.id&&(t=i.id),n=yield function(e,t){var n=arguments;return Ne(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetConceptByCharacterAndCategoryFromMemory",n);let i=yield s.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==i.id&&(i=yield function(e,t){var n=arguments;return ke(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetConceptByCharacterAndCategoryDirectApi",n);let i=(0,P.o)();try{var r=(0,d.Xr)("application/x-www-form-urlencoded");const n=yield fetch(l.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:r,body:`character_value=${e}&category_id=${t}`});n.ok?(i=yield n.json(),s.I.AddConcept(i)):(console.log("This is the concept by category and character error",n.status),(0,h.ry)(n)),vo.V.logUpdate(o)}catch(e){e instanceof Error?console.log(" This is the concept by category and character error message: ",e.message):console.log(" This is the concept by category and character unexpected error: ",e),(0,h.Mb)(e,l.B.GetConceptByCharacterAndCategoryDirectUrl()),(0,h.ey)(o,"GetConceptByCharacterAndCategoryDirectApi",e)}return i}))}(e,t)),vo.V.logUpdate(o),i}))}(e,t)}else o[0]==e&&(n=yield function(e){var t=arguments;return Ne(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConceptByCharacter",t);let o=yield s.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==o.id&&(o=yield(0,we.Y)(e)),vo.V.logUpdate(n),o}))}(e));return vo.V.logUpdate(t),n}))}var Le=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const Se=new Map;function Ge(e,t){var n=arguments;return Le(this,void 0,void 0,(function*(){const t=vo.V.logfunction("MakeTheTypeConceptApi",n);let o=(0,P.o)();if(Se.has(e))return Se.get(e)||o;const i=(()=>Le(this,void 0,void 0,(function*(){try{if(o=yield Ae(e),0==o.id||4==o.typeId){let n=(0,d.Xr)("application/x-www-form-urlencoded");const i=yield fetch(l.B.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${e}`});if(!i.ok)throw(0,h.ry)(i),new Error(`Error! status: ${i.status}`);let r=yield i.json();o=r,vo.V.logUpdate(t)}}catch(e){e instanceof Error?console.log("Make The Type Concept Api error : ",e.message):console.log("Make The Type Concept Api error : ",e),(0,h.Mb)(e,l.B.MakeTheTypeConceptUrl()),(0,h.ey)(t,"MakeTheTypeConceptApi",e)}finally{Se.delete(e)}return o})))();return Se.set(e,i),i}))}var _e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function be(e){var t=arguments;return _e(this,void 0,void 0,(function*(){vo.V.logfunction("GetAllLinkerConnectionsFromTheConcept",t);var n=[];try{(new Date).getTime();var o=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:o});if(t.ok){const e=yield t.json();for(var i=0;i<e.length;i++){var r=e[i];n.push(r)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,h.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection from the concepts error: ",e.message):console.log("Get all linker connection from the concepts error(Unexpected): ",e),(0,h.Mb)(e,l.B.GetAllLinkerConnectionOfConceptUrl())}return n}))}var Be=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xe(e){var t=arguments;return Be(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetAllLinkerConnectionsToTheConcept",t);var o=[];try{(new Date).getTime();var i=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:i});if(t.ok){const e=yield t.json();for(var r=0;r<e.length;r++){var c=e[r];o.push(c)}vo.V.logUpdate(n)}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,h.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection To the concepts error: ",e.message):console.log("Get all linker connection To the concepts error(Unexpected): ",e),(0,h.Mb)(e,l.B.GetAllLinkerConnectionToConceptUrl()),(0,h.ey)(n,"GetAllLinkerConnectionsToTheConcept",e)}return o}))}var Re=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ee(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetLinkerConnectionFromConcepts",t);let o=yield be(e);for(let e=0;e<o.length;e++){let t=o[e],n=t.typeId,i=yield(0,q.A)(n);t.type=i}return vo.V.logUpdate(n),o}))}function De(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetLinkerConnectionToConcepts",t);let o=yield xe(e);for(let e=0;e<o.length;e++){let t=o[e],n=t.typeId,i=yield(0,q.A)(n);t.type=i}return vo.V.logUpdate(n),o}))}var Fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},We=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ue=n(6963),Oe=n(2202),Me=n(5457),Pe=n(991),Ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function je(e){var t=arguments;return Ve(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteConceptById",t);if(mi)try{return(yield Si("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),xi(e)}if(e>0){var o=yield s.I.GetConcept(e);if(o.id>0){var i=o.typeId,r=o.characterValue;yield Me.c.removeTypeConcept(i,e),yield Ue.f.removeNodeByCharacter(r,e),yield function(e){var t=arguments;return We(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteTheConcept",t);try{const t=new FormData;t.append("id",e.toString());let o=(0,d.BZ)();const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",headers:o,body:t});i.ok||(console.log("Delete concept error",i.status),(0,h.ry)(i)),vo.V.logUpdate(n)}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl()),(0,h.ey)(n,"DeleteTheConcept",e)}}))}(e),yield Oe.W.removeNodeFromTree(e),yield Pe.H.removeNodeFromTree(e)}}else y.v.RemoveConceptById(e);vo.V.logUpdate(n)}))}function $e(e){return Ve(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),xi(e)}e>0?function(e){var t=arguments;Fe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteUserInBackend",t);try{var o=(0,d.ab)("application/json","");let t=l.B.DeleteUserUrl();t=t+"?conceptId="+e+"&apiKey=freeschema";const i=yield fetch(t,{method:"POST",headers:o});if(i.ok){let e=yield i.json(),t=Number(e.data);return console.log("this is the delete email concept",t),je(t),vo.V.logUpdate(n),t}throw(0,h.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl()),(0,h.ey)(n,"DeleteUserInBackend",e)}}))}(e):y.v.RemoveConceptById(e)}))}var He=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Je(e,t){return He(this,void 0,void 0,(function*(){try{const n=new Headers;n.append("Authorization","Bearer "+t);const o=new FormData;o.append("id",e.toString());const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw(0,h.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl())}}))}var qe=n(1735),ze=n(8286),Qe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Xe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ye(e){var t=arguments;return Xe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConnectionById",t);if(console.log("AccessTracker activation status from GetConnectionById"),!0===qe.J.activateStatus)try{qe.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),vo.V.log("ERROR","Error Adding Connection")}if(mi)try{return(yield Si("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),xi(e)}let o=yield ze.d.GetConnection(e);if((null==o||0==o.id)&&null!=e&&null!=e){let t=yield function(e){var t=arguments;return Qe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConnection",t);let o=yield ze.d.GetConnection(e);try{if(0!=o.id)return o;{let t=(0,d.Xr)("application/x-www-form-urlencoded");const i=new FormData;i.append("id",e.toString());const r=yield fetch(l.B.GetConnectionUrl(),{method:"POST",headers:t,body:i});return r.ok?(o=yield r.json(),ze.d.AddConnection(o)):((0,h.ry)(r),console.log("Get Connection Error",r.status)),vo.V.logUpdate(n),o}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,h.Mb)(e,l.B.GetConnectionUrl()),(0,h.ey)(n,"GetConnection",e)}}))}(e);o=t}return vo.V.logUpdate(n),o}))}var Ze=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ke(e,t,n){return Ze(this,arguments,void 0,(function*(e,t,n,o=4,i=999){const r=vo.V.logfunction("MakeTheTimestamp")||{};if(mi){r.serviceWorker=!0;try{const c=yield Si("MakeTheTimestamp",{type:e,referent:t,userId:n,accessId:o,sessionInformationId:i});return vo.V.logUpdate(r),c.data}catch(e){console.error("MakeTheTimestamp sw error: ",e),(0,h.ey)(r,"MakeTheTimestamp",e),xi(e)}}let c,a="",s=e.startsWith("the_"),l=(0,P.o)();return a=s?e:"the_"+e,l=yield Ge(a,n),c=yield me(t,n,4,l.id,0,o,a),vo.V.logUpdate(r),c}))}class et{constructor(){this.composition=0,this.type="",this.linker="",this.inpage=10,this.page=1,this.listLinkers=[],this.fullLinkers=[],this.textSearch="",this.logic="or",this.reverse=!1,this.doFilter=!1,this.filterSearches=[],this.selectors=[],this.ofCompositions=[]}}var tt=n(6687),nt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ot(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApi",e)||{};let r=[];try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApi",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApi sw error: ",e),(0,h.ey)(i,"RecursiveSearchApi",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let c=JSON.stringify(e),a=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:a,body:c});if(s.ok){const e=yield s.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,r=yield(0,tt.p8)(t,n)}else console.log("recursive search error ",s.status),(0,h.ey)(i,"RecursiveSearchApi",s.status),(0,h.ry)(s);vo.V.logUpdate(i)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"RecursiveSearchApi",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function it(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiWithInternalConnections",e)||{};let r=[];try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiWithInternalConnections",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiWithInternalConnections",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let c=JSON.stringify(e),a=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:a,body:c});if(s.ok){const e=yield s.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,r=yield(0,tt.km)(t,n),vo.V.logUpdate(i)}else console.log("recursive search error ",s.status),(0,h.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",s.status),(0,h.ry)(s)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function rt(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRaw",e)||{};try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiRaw",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiRaw",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiRaw",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"RecursiveSearchApiRaw",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}}))}function ct(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRawFullLinker",e)||{};try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiRawFullLinker",{composition:t,fullLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",e),xi(e)}}let e=new et;e.composition=t,e.fullLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl()),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",e)}}))}function at(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRawFullLinker",e)||{};try{if(mi)try{i.serviceWorker=!0;const e=yield Si("RecursiveSearchApiNewRawFullLinker",{composition:t,fullLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",e),xi(e)}let e=new et;e.composition=t,e.fullLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl()),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",e)}}))}var st=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const lt=["image/jpeg","image/jpg","image/png","image/webp"],dt=["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","text/plain","application/pdf"];function ht(e,t){return st(this,void 0,void 0,(function*(){const n=vo.V.logfunction("uploadAttachment");try{console.log("File Type",e.type);const o=new FormData;let i;if(dt.includes(e.type))o.append("file",e,e.name),i=yield pt(o,t);else{if(!lt.includes(e.type))return{message:"Invalid File Format",success:!1};o.append("image",e,e.name),i=yield ut(o,t)}return(null==i?void 0:i.data)?(vo.V.logUpdate(n),{message:"Upload Success",success:!0,url:i.data}):{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),(0,h.ey)(n,"uploadAttachment",e),e}}))}function ut(e){return st(this,arguments,void 0,(function*(e,t=""){const n=vo.V.logfunction("uploadImage");try{const o=yield fetch(l.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!o.ok){const e=o.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==o?void 0:o.text());const t=yield null==o?void 0:o.text();return console.error(`${o.status} ${t}`),vo.V.logUpdate(n),null}return yield o.json()}catch(e){return console.error(e),(0,h.ey)(n,"uploadImage",e),null}}))}function pt(e){return st(this,arguments,void 0,(function*(e,t=""){const n=vo.V.logfunction("uploadFile");try{const o=yield fetch(l.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!o.ok){const e=o.headers.get("content-type");e&&e.includes("text/plain")&&console.info(o.text());const t=yield o.text();return console.error(`${o.status} ${t}`),null}return vo.V.logUpdate(n),yield o.json()}catch(e){return console.error(e),(0,h.ey)(n,"uploadFile",e),null}}))}var ft=n(1239),yt=n(7467),vt=n(3278),gt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function mt(e,t){var n=arguments;return gt(this,void 0,void 0,(function*(){const o=vo.V.logfunction("LoginToBackend",n);try{let n={email:e,password:t},i=new Headers;i.append("Content-Type","application/json");let r=JSON.stringify(n);const c=yield fetch(l.B.LoginUrl(),{method:"POST",headers:i,body:r}),a=yield c.json();if(c.ok)return vt.b.BearerAccessToken=a.data.token,vo.V.logUpdate(o),a;console.log("Login tsccs error message: ",c.status),(0,h.ER)(c,a)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,h.Mb)(e,l.B.LoginUrl()),(0,h.ey)(o,"LoginToBackend",e)}}))}var Ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Tt(e){return Ct(this,void 0,void 0,(function*(){const t=yield function(){return Ct(this,arguments,void 0,(function*(e="",t={}){let n={message:"success",status:!1,statusCode:200,data:"cannot signup"};try{const o=yield fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(t)}),i=yield o.json();return o.ok?n={message:"success",status:!0,statusCode:200,data:i}:(0,h.ER)(o,i),n}catch(t){console.log("Signup Error: ",t),(0,h.Mb)(t,e)}}))}(l.B.SignupUrl(),e);return t}))}function It(e){return Ct(this,void 0,void 0,(function*(){const t=l.B.NODE_URL,n=yield fetch(`${t}/api/v1/entity/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok)return n.json();if(404===n.status)throw new Error("404, Not found");if(500===n.status)throw new Error("500, internal server error");throw new Error(n.status)}))}var wt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function kt(e){return wt(this,void 0,void 0,(function*(){const t=JSON.stringify({email:e.email,password:e.password});let n={message:"success",status:!1,statusCode:200,data:""};const o=new Headers;o.append("Content-Type","application/json");const i=l.B.LoginUrl();try{const e=yield fetch(i,{method:"POST",headers:o,body:t,redirect:"follow"}),r=yield e.json();return e.ok?n={message:"success",status:!0,statusCode:200,data:null==r?void 0:r.data}:(0,h.ER)(e,r),n}catch(e){console.log("Sign in api error",e),(0,h.Mb)(e,i)}}))}var Nt=n(9934),At=n(4485);function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function St(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class Gt{constructor(e,t,n,o){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}isValid(){const e=new Date(Date.now());return!(this.expiryTime<e&&(bt.removeNodeFromTree(this.key),1))}saveToCache(e){this.value.cached=e}addNode(e,t,n){if(null==t)return e;const o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return this.isValid(),e;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));const r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return this.isValid(),t}rightRotate(e){if(e){const t=e.leftNode;if(t){const n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){const t=e.rightNode;if(t){const n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key&&t.isValid()?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){const t=e.rightNode;return e=null,t}if(null==e.rightNode){const t=e.leftNode;return e=null,t}{const t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.rightNode=this.removeNode(e.rightNode,t.key),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var _t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class bt{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addCompositionToTree(e){const t=new Gt(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return _t(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return _t(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}bt.root=null;var Bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xt(e,t,n,o){return Bt(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c;let a={};const l=[];if(0==e)return"";let d=Rt(n,e);if(null!=d&&0!=d.id||null==e||null==e||(d=yield(0,q.A)(e)),0!=d.id&&null==d.type){const e=d.typeId;let t=Rt(n,e);d.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,q.A)(e),d.type=t)}if(!o.includes(e))return null==d?void 0:d.characterValue;if(i.includes(e))return"";i.push(e);for(let d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){const h=t[d].toTheConceptId;if(o.includes(e)){let e=Rt(n,h);if(null!=e&&0!=e.id||null==h||null==h||(e=yield(0,q.A)(h)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield s.I.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield(0,q.A)(t),e.type=n)}const d="the_",u=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(d,"");if(isNaN(Number(u))){if(u){const e=yield xt(h,t,n,o,i);a[u]=e}}else{const e=yield xt(h,t,n,o,i);l[u]=e,a=l}}}return a}))}function Rt(e,t){let n=(0,P.o)();for(let o=0;o<e.length;o++)if(t==e[o].id)return n=e[o],n;return n}class Et{constructor(){this.id=0,this.mainConcept=(0,P.o)(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return e=this,t=void 0,o=function*(){if(0==this.mainConcept.id)for(let e=0;e<this.concepts.length;e++)this.concepts[e].id==this.id&&(this.mainConcept=this.concepts[e]);this.cached=yield xt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&(t=null===(e=this.id)||void 0===e?void 0:e.toString(),l.B.MQTT_CONNECTION&&l.B.MQTT_CONNECTION.publish("compositionUpdate",t))}catch(e){console.log("Error while publishing message",e)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var e,t,n;const o={};o[null!==(n=null===(t=null===(e=this.mainConcept)||void 0===e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=this.cached;const i={};return i.data=o,i.id=this.id,i}}var Dt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ft(e){return Dt(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,a=null){const s=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let h=null!=o?o:0,u=(0,P.o)();null==a&&(a=new Et);for(const o in e)if("object"==typeof e[o]||Array.isArray(e[o])){const p=yield(0,z.A)(o,"",!0,s,l,d);if(null==t&&null==n){let t=h;u=p,t=p.id,h=p.id,a.concepts.push(p),a.id=p.id,yield Ft(e[o],p.id,p.userId,t,i,r,c,a)}else{const s=null!=t?t:999,l=null!=n?n:999,d=h;u=p,a.concepts.push(p);const f=yield(0,ie.q)(s,l,p.id,d);a.connections.push(f),yield Ft(e[o],p.id,p.userId,d,i,r,c,a)}null!=e[o]&&null!=e[o]&&a.subcompositions.push(p.id)}else{const i=null!=t?t:999,r=null!=n?n:999,c=h,u=yield(0,z.A)(o,e[o],!1,s,l,d);a.concepts.push(u);const p=yield(0,ie.q)(i,r,u.id,c);a.connections.push(p)}return u}))}var Wt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ut(e){return Wt(this,void 0,void 0,(function*(){const t=vo.V.logfunction("UpdateComposition")||{};if(mi){t.serviceWorker=!0;try{const n=yield Si("UpdateComposition",{patcherStructure:e});return vo.V.logUpdate(t),n.data}catch(e){console.error("UpdateComposition sw error: ",e),(0,h.ey)(t,"UpdateComposition",e),xi(e)}}const n=e.userId,o=e.sessionId,i=e.accessId;let r=[];const c=[];let a=(0,P.o)(),s=(0,P.o)();const l=[];let d=e.compositionId;const u=e.ofTheCompositionId;let p=[];if(d<0){let e=yield(0,q.A)(d,n);if(!(e.id>0))return null;d=e.id}r=yield(0,E.s)(d);const f=[],y=new Et,v=[];y.id=d,y.isUpdating();let g=[];for(let e=0;e<r.length;e++)(0,Nt.A)(v,r[e].ofTheConceptId),(0,Nt.A)(f,r[e].ofTheConceptId),(0,Nt.A)(f,r[e].toTheConceptId),g.push(r[e].ofTheConceptId);y.subcompositions=v,y.connections=r;for(let e=0;e<f.length;e++){const t=yield(0,q.A)(f[e]);d==f[e]&&(a=t),u==f[e]&&(s=t),c.push(t)}const m=e.patchObject;for(const e in m){let t=(0,P.o)();const r=m[e];let d=a;if(s.id>0&&(d=s),Array.isArray(r)||"object"==typeof r){t=yield(0,z.A)(e,"",!0,a.userId,4,999),y.subcompositions.push(t.id);const n=(0,At.vo)(c,t);for(let e=0;e<n.length;e++)if(n[e].id>0){const t=(0,At.wS)(y.connections,n[e].id);p=p.concat(t),l.push(n[e])}yield Ft(m[e],t.id,t.userId,a.id,a.userId,4,999,y)}else{t=yield(0,z.A)(e,r,!1,n,i,o);const a=(0,At.vo)(c,t);for(let e=0;e<a.length;e++)if(a[e].id>0){const t=(0,At.wS)(y.connections,a[e].id);p=p.concat(t),l.push(a[e])}}const h=(0,ie.q)(d.id,d.userId,t.id,a.id);c.push(t),y.connections.push(h)}for(let e=0;e<p.length;e++)St(y.connections,p[e]),(0,J.m)(p[e].id);for(let e=0;e<l.length;e++)Lt(c,l[e]);y.concepts=y.concepts.concat(c),y.mainConcept=a,y.id=a.id,yield y.updateCache(),bt.addCompositionToTree(y),M.Y.SyncDataOnline();let C=y.GetDataCache();return vo.V.logUpdate(t),C}))}var Ot=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Mt(e,t,n,o){return Ot(this,arguments,void 0,(function*(e,t,n,o,i=10,r=1){var c=(0,d.ab)("application/x-www-form-urlencoded",o),a=new URLSearchParams;a.append("type",e),a.append("search",t),a.append("composition",n),a.append("inpage",i.toString()),a.append("page",r.toString());const s=l.B.SearchCompositionsUrl()+"?"+a.toString();try{const e=yield fetch(s,{method:"GET",headers:c});return e.ok?yield e.json():((0,h.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,h.Mb)(e,s)}}))}var Pt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Vt(e){return Pt(this,arguments,void 0,(function*(e,t=""){var n=(0,d.ab)("application/json",t);const o=l.B.SearchLinkMultipleAll(),i=JSON.stringify(e);try{const e=yield fetch(o,{method:"POST",headers:n,body:i});return e.ok?yield e.json():(console.log("This is the searching error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,h.Mb)(e,o)}}))}var jt=n(7139),$t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ht(e){return $t(this,arguments,void 0,(function*(e,t=[]){var n,o;let i=[];const r=[];let c={},a={};const l=yield bt.getNodeFromTree(e),d=[];let h=yield s.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,jt.r)(e)),null==l){let s=[];s=t.length>0?Jt(e,t):yield(0,E.s)(e),i=s;for(let e=0;e<i.length;e++)d.includes(i[e].ofTheConceptId)||(d.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);Qt(h,i,r,d);let l=[];a=yield(0,v.zN)(e,i,d,l),c[null!==(o=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a}else a=l.value.GetDataCache(),c=a;return 0==h.id?"":c}))}function Jt(e,t){const n=[];for(let o=0;o<t.length;o++)t[o].typeId==e&&n.push(t[o]);return n}function qt(e){return $t(this,arguments,void 0,(function*(e,t=[]){var n,o;let i={},r=[];const c=[];let a;const l={},d=yield bt.getNodeFromTree(e),h=[];let u=yield s.I.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield(0,jt.r)(e)),null==d){let s=[];s=t.length>0?Jt(e,t):yield(0,E.s)(e),r=s;for(let e=0;e<r.length;e++)h.includes(r[e].ofTheConceptId)||(h.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);Qt(u,r,c,h),a=yield(0,v.zN)(e,r,h),l[null!==(o=null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a,i.created_at=u.entryTimeStamp,i.data=l,i.id=e}else a=d.value.GetDataCache(),i=a;return 0==u.id?"":i}))}function zt(e,t){return $t(this,void 0,void 0,(function*(){let n=[];const o=[];n=yield(0,yt.j)(t);for(let t=0;t<e.length;t++){const i=yield qt(e[t],n);i&&o.push(i)}return o}))}function Qt(e,t,n,o){return $t(this,void 0,void 0,(function*(){const i=new Et,r=yield function(e){return $t(this,void 0,void 0,(function*(){let t=[];const n=[];for(let o=0;o<(null==e?void 0:e.length);o++){const i=yield s.I.GetConcept(e[o]);0==i.id?n.push(e[o]):t.push(i)}return 0==(null==n?void 0:n.length)||(t=yield(0,ft.I)(n)),t}))}(n);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=o,i.mainConcept=e;const c=yield xt(e.id,t,r,o,[]);i.cached=c,bt.addCompositionToTree(i)}))}var Xt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Yt(e){return Xt(this,void 0,void 0,(function*(){try{var t=(0,d.Xr)();const n=JSON.stringify(e),o=yield fetch(l.B.CreateSessionId(),{method:"POST",headers:t,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),(0,h.ry)(o),null)}catch(e){console.log("Creating session failed",e),(0,h.Mb)(e,l.B.CreateSessionId())}}))}var Zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Kt(e,t){return Zt(this,void 0,void 0,(function*(){try{var n=(0,d.Xr)("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",e.toString()),o.append("url",t);const i=yield fetch(l.B.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,h.ry)(i),null)}catch(e){console.log("Creating session url failed",e),(0,h.Mb)(e,l.B.CreateSessionVisitUrl())}}))}var en=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function tn(e,t){var n=arguments;return en(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetRelation",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetRelation",{id:e,relation:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetRelation error sw: ",e),(0,h.ey)(r,"GetRelation",e),xi(e)}}let c=[],a=yield(0,q.A)(e),s=yield Ae(t);if(s.id>0){let e=yield U(s.id,a.id,a.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,v.Ez)(o.id);c.push(i)}}return vo.V.logUpdate(r),c}))}function nn(e,t){var n=arguments;return en(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetRelationRaw",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetRelationRaw",{id:e,relation:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetRelationRaw error sw: ",e),(0,h.ey)(r,"GetRelationRaw",e),xi(e)}}let c=[],a=yield(0,q.A)(e),s=yield Ae(t);if(s.id>0){let e=yield U(s.id,a.id,a.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n);c.push(o)}}return vo.V.logUpdate(r),c}))}var on=n(6416),rn=n(4711);class cn{constructor(e,t,n,o){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t.value.push(...e.value),t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var n=this.inOrderSuccessor(e.rightNode);return e.value=n.value,e.key=n.key,e.rightNode=this.removeNode(e.rightNode,n.key),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var an=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class sn{static compositeKey(e,t){return("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+t.toString(16).toUpperCase()).slice(-4)}static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return an(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(sn.checkFlag,1e3,e)}static addConceptToTree(e,t,n=999){let o=this.compositeKey(t,n);var i=new cn(o,e,null,null);this.addNodeToTree(i)}static getNodeFromTree(e,t){return an(this,void 0,void 0,(function*(){let n=this.compositeKey(e,t);return this.root?this.root.getFromNode(n,this.root):null}))}static removeNodeFromTree(e){return an(this,arguments,void 0,(function*(e,t=999){if(this.root){let n=this.compositeKey(e,t);this.root=this.root.removeNode(this.root,n)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}sn.root=null;var ln=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function dn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){let o=yield sn.getNodeFromTree(e,n),i=(0,on.u)();if(o)for(let e=0;e<o.value.length;e++){let n=o.value[e];n.ghostId==t&&(i=n)}return i}))}function hn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){sn.addConceptToTree(e,t,n)}))}var un=n(5312),pn=n(1213),fn=n(3729),yn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function gn(e,t,n){return vn(this,void 0,void 0,(function*(){try{if(mi)try{return(yield Si("GetRelationLocal",{id:e,relation:t,userId:n})).data}catch(e){console.error("GetRelationLocal error sw: ",e),xi(e)}let o=yield(0,m.$I)(t),i=[];0!=o.id&&(i=yield function(e,t){return yn(this,void 0,void 0,(function*(){try{return yield A.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,o.id));let r=[];for(let e=0;e<i.length;e++){let t=yield G(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Cn(e){return mn(this,void 0,void 0,(function*(){let t=[];try{var n=(0,d.Xr)();const o=yield fetch(l.B.ViewInternalDataUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(o.ok){let e=yield o.json(),n={};for(let o=0;o<e.length;o++){let i=e[o].concepts;t=e[o].connections;let r=e[o].id;(0,ft.r)(i),n[r]=t}return n}return console.log("View Internal Data error",o.status),(0,h.ry)(o),t}catch(e){throw e instanceof Error?console.log(" This is the view internal data error message: ",e.message):console.log(" This is the view internal data unexpected error: ",e),e}}))}var Tn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function In(e){return Tn(this,void 0,void 0,(function*(){var t;try{let n=yield Cn(e),o=[];for(let i=0;i<e.length;i++){let r=e[i],c=n[r];if(r&&c){let e=[],t={};for(let t=0;t<c.length;t++)e.includes(c[t].ofTheConceptId)||e.push(c[t].ofTheConceptId);let n=yield(0,v.zN)(r,c,e);t.data=n,t.id=r,o.push(t)}else{let e={};e.id=r;let n=yield(0,q.A)(r),i={};n.type&&(i[null===(t=null==n?void 0:n.type)||void 0===t?void 0:t.characterValue]=n.characterValue,e.data=i,o.push(e))}}return o}catch(e){throw e}}))}var wn=n(176),kn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Nn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function An(e){return Nn(this,arguments,void 0,(function*(e,t=""){try{let n=yield function(e){return kn(this,arguments,void 0,(function*(e,t=""){var n=(0,d.ab)("application/json",t);let o=l.B.SearchInternalWithAuthenticatedCcsUrl();o=o+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(o,{method:"GET",headers:n});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,h.Mb)(e,o)}}))}(e,t);return yield In(n)}catch(e){throw e}}))}function Ln(e){return Nn(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return kn(this,void 0,void 0,(function*(){var t=(0,d.ab)("application/json","");let n=l.B.SearchInternalWithCcsUrl();n=n+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(n,{method:"GET",headers:t});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,h.Mb)(e,n)}}))}(e)}catch(e){throw e}}))}var Sn=n(8095),Gn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function _n(e){return Gn(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),xi(e)}let t=yield(0,pn.f)(e);y.v.RemoveConcept(t)}))}var bn=n(2803),Bn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xn(e,t,n,o){return Bn(this,arguments,void 0,(function*(e,t,n,o,i=!0){var r,c;const a=vo.V.logfunction("GetConnectionBetweenTwoConceptsLinker")||{};if(mi){a.serviceWorker=!0;try{const r=yield Si("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:n,fullLinker:o,forward:i});return vo.V.logUpdate(a),r.data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),(0,h.ey)(a,"GetConnectionBetweenTwoConceptsLinker",e),xi(e)}}let s=(0,P.o)();if(""!=n){let o="";o=i?(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s_"+n+"_s":(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s_"+n+"_by",s=yield(0,z.A)("connection",o,!1,999)}""!=o&&(s=yield Ge(o,999));let l=[];return l=i?yield(0,bn.x)(e.id,t.id,s.id):yield(0,bn.x)(t.id,e.id,s.id),vo.V.logUpdate(a),l}))}function Rn(e,t){return new Promise(((n,o)=>{setTimeout((()=>{n(t)}),e)}))}var En=n(3130);const Dn=3,Fn=4,Wn=5;var Un=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function On(e,t){return Un(this,arguments,void 0,(function*(e,t,n=""){let o=l.B.SearchAllTypeWithLinker(e.auth);var i=(0,d.ab)("application/json",n);o=o+"?search="+e.search+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;const r=JSON.stringify(t);try{const e=yield fetch(o,{method:"POST",headers:i,body:r});return e.ok?yield e.json():((0,h.ry)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,h.Mb)(e,o)}}))}var Mn=n(4287);class Pn extends Mn.w{constructor(e,t,n=En.y0){super(),this.searchQuery=[],this.format=En.y0,this.searchQuery=e,this.format=n}bind(){return e=this,t=void 0,o=function*(){return this.data=yield(0,un.cf)(this.searchQuery,"",this,this.format),this.mainConcept=this.searchQuery[0].composition,this.listenToEvent(this.mainConcept),console.log("this is the data",this.data),this.data},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}}function Vn(e,t,n=En.y0){return new Pn(e,null!=t?t:"",n)}var jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class $n extends Mn.w{constructor(e,t=En.ZJ){super(),this.id=e,this.format=t}bind(){return jn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,v.hL)(this.id);this.mainConcept=this.id,this.compositionIds=e.compositionList;let t=e.connectionList;for(let e=0;e<t.length;e++)this.internalConnections.push(t[e].id);this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return jn(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let n=0;n<t.length;n++)e.push(yield ze.d.GetConnection(t[n]));return this.format==En.ZJ?this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds):this.format==En.y0?this.data=yield(0,v.$V)(this.mainConcept,e,this.compositionIds):this.format==En.yv?this.data=yield(0,v.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function Hn(e,t=En.ZJ){return new $n(e,t)}var Jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class qn extends Mn.w{constructor(e,t,n,o,i){super(),this.data=[],this.startPage=0,this.compositionName=e,this.userId=t,this.inpage=n,this.page=o,this.format=i}bind(){return Jn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){var e=yield(0,g.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId);let o=yield s.I.GetConceptsByTypeIdAndUser(e.id,this.userId);for(var t=this.inpage*(this.page-1),n=t;n<t+this.inpage;n++)o[n]&&this.compositionIds.push(o[n].id)}yield(0,f.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return Jn(this,void 0,void 0,(function*(){if(this.data=[],this.format==En.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==En.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==En.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.XI)(this.compositionIds[e]);this.data.push(t)}}else for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function zn(e,t,n,o,i=En.ZJ){return new qn(e,t,n,o,i)}var Qn=n(7106),Xn=n(5328),Yn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Zn extends Mn.w{constructor(e,t,n="",o){super(),this.searchText="",this.connections=[],this.externalConnectionIds=[],this.data=[],this.mainConcept=e,this.searchLinkers=t,this.textSearch=n,o&&(this.format=o)}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Yn(this,void 0,void 0,(function*(){let n=yield ze.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield ze.d.GetConnection(n[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId),t.compositionIds.includes(e.toTheConceptId)||t.compositionIds.push(e.toTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Yn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;const e=yield rt(this.mainConcept,this.searchLinkers,this.textSearch);this.compositionIds=e.compositionIds||[],this.internalConnections=e.internalConnections||[],this.externalConnectionIds=e.externalConnections||[],this.linkers=this.externalConnectionIds,this.connections=yield(0,yt.j)(this.externalConnectionIds);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Yn(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==En.XZ?this.data={compositionIds:this.compositionIds,internalConnections:this.internalConnections,externalConnections:this.externalConnectionIds}:this.data=yield(0,tt.p8)(this.compositionIds,this.internalConnections),this.data}))}}function Kn(e,t,n="",o){return new Zn(e,t,n,o)}var eo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class to extends Mn.w{constructor(e,t,n,o=En.y0){super(),this.searchQuery=[],this.format=En.y0,this.mainCompositionIds=[],this.searchCharacter="",this.token="",this.searchStructure=e,this.searchQuery=t,this.searchQuery[0].type=e.composition,this.searchCharacter=e.composition,this.format=o,this.token=vt.b.BearerAccessToken}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return eo(this,void 0,void 0,(function*(){let n=e;t.mainCompositionIds.includes(null==n?void 0:n.detail)||(t.mainCompositionIds.unshift(null==n?void 0:n.detail),t.conceptIds.push(null==n?void 0:n.detail),t.listenToEvent(null==n?void 0:n.detail),ze.d.GetConnectionsOfConcept(null==n?void 0:n.detail).then((e=>{for(let n=0;n<e.length;n++)t.linkers.push(e[n].id)}))),t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return eo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,g.A)(this.searchCharacter);let t=yield On(this.searchStructure,this.searchQuery,this.token);this.conceptIds=t.compositionIds,this.internalConnections=t.internalConnections,this.linkers=t.linkers,this.reverse=t.reverse,this.mainCompositionIds=t.mainCompositionIds,this.listenToEventType(e.id);for(let e=0;e<this.mainCompositionIds.length;e++)this.listenToEvent(this.mainCompositionIds[e])}return yield this.build()}))}build(){return eo(this,void 0,void 0,(function*(){return yield(0,ft.r)(this.conceptIds),this.format==En.y0?this.data=yield(0,Qn.yV)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield(0,Qn._W)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function no(e,t,n,o=En.y0){return new to(e,t,n,o)}var oo=n(2615);class io{constructor(e,t,n,o,i,r,c,a=!1,s,d,h){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=l.B.getRandomizer(),this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=o,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=a,this.typeCharacter=c,this.entryTimeStamp=s,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=h}getType(){console.log(this.typeId)}}class ro{constructor(e,t,n,o,i,r){this.isTemp=!1,this.applicationId=l.B.getRandomizer(),this.type=(0,P.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.typeId=o,this.ghostId=e,this.orderId=i,this.typeCharacter="",this.accessId=r,this.typeCharacter="",this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class co{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class ao{constructor(){this.id="0",this.remote_address="",this.server_port="",this.server_address="",this.server_name="",this.server_software="",this.http_user_agent="",this.self="",this.port="",this.userId="",this.email=""}}var so=n(628);class lo{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class ho{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var uo=n(7887),po=n(3075),fo=n(7869),yo=n(9635),vo=n(9700);class go{static initialize(){try{console.warn("Initialized Application Monitoring for tracking errors..."),this.initGlobalErrorHandlers(),this.logCatchError(),this.logErrorEvent(),this.logUnhandledError(),this.logUserInteractions(),this.logNetworkRequests(),this.logRouteChanges(),this.logPerformanceMetrics(),this.logWebSocketEvents()}catch(e){console.error("Error during Application Monitoring initialization:",e)}}static initGlobalErrorHandlers(){try{if(console.log("this is the window",window),void 0===typeof window)return;const e=vt.b.sessionId||"unknown";window.onerror=(t,n,o,i,r)=>{const c={message:t,source:n,lineno:o,colno:i,stack:(null==r?void 0:r.stack)||"undefined",requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("ERROR","Runtime Error",c),vo.V.log("ERROR","Runtime Error",c)},window.onunhandledrejection=t=>{vo.V.logApplication("ERROR","Unhandled Promise Rejection",{message:t.reason?t.reason.message:t.reason,stack:t.reason?t.reason.stack:null,requestFrom:l.B.BASE_APPLICATION,sessionId:e}),vo.V.log("ERROR","Unhandled Promise Rejection",{message:t.reason?t.reason.message:t.reason,stack:t.reason?t.reason.stack:null,requestFrom:l.B.BASE_APPLICATION,sessionId:e})}}catch(e){console.warn("Failed to initialize global error handlers:",e)}}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError...");const t=vt.b.sessionId||"unknown";console.error=function(...n){const o="Console Error",i={arguments:n.map((e=>mo(e))),requestFrom:l.B.BASE_APPLICATION,sessionId:t};vo.V.logApplication("ERROR",o,i),vo.V.log("ERROR",o,i),e.apply(console,n)}}catch(e){console.warn("Failed to override console.error:",e)}}static logErrorEvent(){try{window.addEventListener("error",(e=>{var t;console.log("Inside error event...");const n=vt.b.sessionId||"unknown",o={error:(null===(t=e.error)||void 0===t?void 0:t.message)||e.message,source:e.filename,line:e.lineno,column:e.colno,stack:e.error?mo(e.error.stack):void 0,requestFrom:l.B.BASE_APPLICATION,sessionId:n},i="Unhandled Error";vo.V.logApplication("ERROR",i,o),vo.V.log("ERROR",i,o)}))}catch(e){console.warn("Failed to add error event listener:",e)}}static logUnhandledError(){try{window.addEventListener("unhandledrejection",(e=>{var t,n;console.log("Inside unhandledrejection...");const o=vt.b.sessionId||"unknown",i={reason:(null===(t=e.reason)||void 0===t?void 0:t.message)||String(e.reason),stack:(null===(n=e.reason)||void 0===n?void 0:n.stack)||"No stack trace available",requestFrom:l.B.BASE_APPLICATION,sessionId:o};vo.V.logApplication("ERROR","Unhandled Promise Rejection",i),vo.V.log("ERROR","Unhandled Promise Rejection",i)}))}catch(e){console.warn("Failed to add unhandled rejection event listener:",e)}}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const n=vt.b.sessionId||"unknown",o=e.target,i={element:o.tagName,id:o.id,classes:o.className,text:null===(t=o.innerText)||void 0===t?void 0:t.slice(0,50),requestFrom:l.B.BASE_APPLICATION,sessionId:n};vo.V.logApplication("INFO","User Click",i)})),document.addEventListener("input",(e=>{const t=e.target;vt.b.sessionId,t.tagName,t.id,t.value,l.B.BASE_APPLICATION})),document.addEventListener("scroll",(()=>{vt.b.sessionId,window.scrollY,l.B.BASE_APPLICATION}))}static logNetworkRequests(){try{if(void 0===typeof window)return;const e=vt.b.sessionId||"unknown",t=null===window||void 0===window?void 0:window.fetch;if(!t)throw new Error("Original fetch is not available.");const n=[l.B.PostLogger(),l.B.PostPrefetchConceptConnections()];window.fetch=(...o)=>{return i=this,r=void 0,a=function*(){const[i,r]=o,c=i instanceof Request?i.url:i instanceof URL?i.toString():i;if(n.includes(c))return console.log("Ignored URLs detected : ",c),t(...o);let a={request:{type:"REQUEST",message:"Network Request",method:(null==r?void 0:r.method)||"GET",url:c,body:null==r?void 0:r.body,requestFrom:l.B.BASE_APPLICATION,sessionId:e}};try{const n=yield t(...o);return a.response={type:"RESPONSE",message:"Network Response",url:c,status:n.status,requestFrom:l.B.BASE_APPLICATION,sessionId:e},n}catch(t){throw a.response={type:"ERROR",message:"Network Request Failed",url:c,error:t instanceof Error?t.message:String(t),requestFrom:l.B.BASE_APPLICATION,sessionId:e},vo.V.logApplication("ERROR","Failed Network Request",a),new Error(`Network request failed for ${c}: ${t.message}`)}},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function o(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof c?i:new c((function(e){e(i)}))).then(n,o)}s((a=a.apply(i,r||[])).next())}));var i,r,c,a}}catch(e){console.warn("Failed to override network requests:",e)}}static logPerformanceMetrics(){void 0!==typeof window&&(null===window||void 0===window||window.addEventListener("load",(()=>{const e=performance.timing;vt.b.sessionId,e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart,l.B.BASE_APPLICATION})))}static logRouteChanges(){const e=history.pushState,t=vt.b.sessionId||"unknown";history.pushState=function(...n){var o;const i={url:null===(o=n[2])||void 0===o?void 0:o.toString(),requestFrom:l.B.BASE_APPLICATION,sessionId:t};return vo.V.logApplication("INFO","Route Change",i),e.apply(this,n)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href,requestFrom:l.B.BASE_APPLICATION,sessionId:t};vo.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=vt.b.sessionId||"unknown",t=WebSocket;window.WebSocket=class extends t{constructor(t,n){super(t,n);const o={url:t.toString(),requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Open",o),this.addEventListener("message",(n=>{const o={url:t,data:n.data,requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Message",o)})),this.addEventListener("error",(n=>{const o={url:t,error:n instanceof Error?n.message:String(n),requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("ERROR","WebSocket Error",o)})),this.addEventListener("close",(()=>{const n={url:t,requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Closed",n)}))}}}}function mo(e){try{return JSON.stringify(e,((e,t)=>t&&"object"==typeof t&&t instanceof Error?{message:t.message,stack:t.stack}:t))}catch(e){return"Error while serializing value"}}const Co=(e,t,...n)=>{return o=void 0,i=[e,t,...n],c=function*(e,t,n=!1){try{let o=l.B.sendMail();n&&(o=l.B.sendBulkMail());const i=yield fetch(o,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}),r=i.headers.get("content-type");if(!i.ok){const e=yield i.json();return console.info(`${i.status} ${e}`),null}const c=yield i.json();return r&&r.includes("text/plain")?yield i.text():c}catch(e){return console.error(e),null}},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function a(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r((function(e){e(o)}))).then(n,a)}s((c=c.apply(o,i||[])).next())}));var o,i,r,c};class To{constructor(){this.inDevelopment=!1,this.subscribers=[]}notify(e=null){this.subscribers.map((t=>{t(e||this.data)}))}dataChange(e){this.subscribers.push(e)}}class Io extends To{constructor(){super(...arguments),this.element=null,this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return this.element}getElementById(e){let t=this.getComponent(),n=document.body;if(t){let o=t.querySelector("#"+e);if(o)return n=o,n}return null}createWidgetWrapperIdentifier(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier.toString()}}class wo extends Io{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.state={},this.previousState={},this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement=""}querySelector(e){return this.element?this.element.querySelector(e):null}querySelectorAll(e){return this.element?this.element.querySelectorAll(e):null}getElement(){return this.element}setTitle(e){document.title=e}getHtml(){return this.html}UpdateChildData(e,t){let n=t;n.data=e,n.render(),n.update()}update(){}setState(e){this.previousState=Object.assign({},this),this.data=e,this.state=Object.assign({},this),this.hasStateChanged()&&(this.notify(),this.render())}setProperty(e){this.previousState=Object.assign({},this),Object.assign(this,e),this.state=Object.assign({},this),this.hasStateChanged()&&(this.notify(),this.render())}hasStateChanged(){return!this.isPropertyEqual(this.state,this.previousState)}isPropertyEqual(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let i of n){if(!o.includes(i))return!1;for(let n of o)if(i==n&&"state"!=i&&"previousState"!=i&&e[i]!=t[i])return!1}return!0}loadChildWidgets(){this.childWidgets.map((e=>{let t=this.getElementById(e.parentElement);t&&(t.innerHTML=""),e.mount(t)}))}render(){this.element&&(this.element.innerHTML=this.getHtml()),this.loadChildWidgets(),this.after_render()}getElementByClassName(e){let t=this.getComponent();return t?null==t?void 0:t.querySelectorAll("."+e):[]}mount_child(){}mount(e){return t=this,n=void 0,i=function*(){e&&(this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier(),this.element.innerHTML=this.getHtml(),e.appendChild(this.element),this.parentElement=e.id,this.before_render(),this.mount_child(),this.widgetMounted=!0)},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{s(i.next(e))}catch(e){r(e)}}function a(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}s((i=i.apply(t,n||[])).next())}));var t,n,o,i}before_render(){this.render()}after_render(){console.log("this is calling the after render",this)}renderChildWidgets(){function e(t){var n;t&&(null===(n=t.childWidgets)||void 0===n||n.forEach((t=>{e(t)})),t.render())}console.log("this is the render child widget",this),this.childWidgets.forEach((t=>{e(t)}))}setWidgetState(e,t){this.widgetState[e]=t,function e(t){t&&Array.isArray(t.childWidgets)&&t.childWidgets.forEach((n=>{n.widgetState=Object.assign(Object.assign({},n.widgetState),t.widgetState),e(n)}))}(this),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var ko=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class No extends wo{constructor(){super(...arguments),this.childComponents=[],this.componentMounted=!1,this.oldHtml=null,this.phonebooks=[],this.childrenData={},this.childWidgets=[],this.typeValueList=[],this.widgetType="the_element_name",this.parentConceptList=[]}getUserId(){return ko(this,void 0,void 0,(function*(){const e=yield new Promise((e=>{let t=(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("profile"))||"";t?e(JSON.parse(t)):e()}));return null==e?void 0:e.userId}))}getTypeValueList(){return ko(this,arguments,void 0,(function*(e=""){return new Promise((t=>ko(this,void 0,void 0,(function*(){const n=null==(e=this.widgetType)?void 0:e.match(/^[a-z0-9]+_[a-z0-9]+/i),o=n?n[0]:"",i=null==e?void 0:e.match(/^([a-z0-9]+).*_([a-z0-9]+)$/i),r=i?`${i[1]}_${i[2]}`:"";let c=[],a=new lo;a.type=r,a.search="1",a.logicoperator=">",a.name="emailfilter",a.operateon="entityEmail",a.composition=!1,c.push(a);let s=new Fo;s.typeConnection=e,s.name="entityEmail";let l=new Fo;l.type=o,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[s],l.outputFormat=En.y0,Vo(l,"").subscribe((n=>{if(null==n?void 0:n.length){const i=null==n?void 0:n.map((t=>{var n,i,c,a,s,l,d;const h=null===(a=null===(c=null===(i=null===(n=t.data)||void 0===n?void 0:n[o])||void 0===i?void 0:i[e])||void 0===c?void 0:c.data)||void 0===a?void 0:a[r];return{id:null===(d=null===(l=null===(s=t.data)||void 0===s?void 0:s[o])||void 0===l?void 0:l[e])||void 0===d?void 0:d.id,name:h,text:h}}));return this.typeValueList=i,t(i),i}}))}))))}))}setTitle(e){document.title=e}getHtml(){return this.html}createRandomNumber(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier}mount_child(){return ko(this,void 0,void 0,(function*(){try{new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the mount child",e),e}}))}setProperty(e){return ko(this,void 0,void 0,(function*(){return this.widgetType=e,this.getTypeValueList(this.widgetType).then((()=>{var e,t,n;null===(e=this.element)||void 0===e||e.setAttribute("data-type-value",this.widgetType),null===(n=null===(t=this.element)||void 0===t?void 0:t.parentElement)||void 0===n||n.setAttribute("data-type-value",this.widgetType),this.render()})),this}))}createTypeEditor(e){!function(e,t){if(e){const n=document.querySelector("#widget-properties #widget-type"),o=null==n?void 0:n.querySelectorAll("input");null==o||o.forEach((e=>{null==e||e.remove()}));const i=e.target.closest(".added-widget-container"),r=e.target.closest("div");let c="";i?c=null==i?void 0:i.getAttribute("data-type-value"):r&&(c=null==r?void 0:r.getAttribute("data-type-value"));const a=document.createElement("input");a.setAttribute("type","text"),a.setAttribute("name","input-widgetTypeValue"),a.setAttribute("of",t.elementIdentifier.toString()),a.setAttribute("class","form-control"),a.setAttribute("id","widgetType"),a.setAttribute("onchange","updateWidgetTypeValue(event)"),t.widgetType?a.value=t.widgetType:a.setAttribute("placeholder","e.g. the_entity");let s=t;a.addEventListener("change",(function(e){var t,n,o;const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;s.widgetType=i,s.before_render(),s.loadChildWidgets(),null===(o=null===(n=s.element)||void 0===n?void 0:n.parentElement)||void 0===o||o.setAttribute("data-type-value",s.widgetType)})),null==n||n.appendChild(a)}}(e,this)}mount(e){return ko(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier();let t=this;this.inDevelopment&&(this.element.onclick=function(e){e.preventDefault(),t.createTypeEditor(e)},this.element.className="mftsccs-marking-element"),this.element.innerHTML=this.getHtml(),null==e||e.setAttribute("data-type-value",t.widgetType),e.appendChild(this.element),this.parentElement=e.id,0==this.componentMounted||0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0,this.componentMounted=!0):this.render(),this.childWidgetElement=this.getElementByClassName("added-widget-container")}}))}before_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the before render",e),e}}after_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the after render",e),e}}CreateConnectionBetweenEntityLocal(e,t,n){return ko(this,void 0,void 0,(function*(){var o;const i=e.userId,r=(null===(o=e.type)||void 0===o?void 0:o.characterValue)+"_"+n,c=yield(0,le.$)(r,999,999,i);return yield(0,rn.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Ao=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Lo{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Ao(this,void 0,void 0,(function*(){yield so.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Ao(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield so.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Ao(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield so.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Ao(this,void 0,void 0,(function*(){yield so.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Ao(this,arguments,void 0,(function*(e,t,n=!1,o,i,r=999,c=0){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,K.k)(e,t,n,o,i,r,c,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,n,o){return Ao(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,le.$)(e,t,n,o,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateConnectionBetweenTwoConceptsLocal(e,t,n){return Ao(this,arguments,void 0,(function*(e,t,n,o=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Sn.h)(e,t,n,o,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheConnectionLocal(e,t,n){return Ao(this,arguments,void 0,(function*(e,t,n,o=1,i="",r=999){try{if(!this.success)throw Error("Query Transaction Expired");const c=yield(0,rn.F)(e,t,n,o,i,r,this.actions);return yield this.markAction(),c}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheCompositionLocal(e){return Ao(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,a=!1){try{if(!this.success)throw Error("Query Transaction Expired");const s=yield(0,F.R)(e,t,n,o,i,r,c,a,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}}const So={number:/^\d+(\.\d+)?$/,text:/^[\s\S]*$/,textOnly:/^[A-Za-z\s]+$/,email:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,document:/\.(pdf|docx?|pptx?|xlsx?)$/i,sound:/\.(mp3|wav|ogg|flac)$/i,image:/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i,video:/\.(mp4|avi|mov|mkv|flv|webm)$/i,url:/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,date:/^\d{4}-\d{2}-\d{2}$/,time:/^(?:[01]\d|2[0-3]):[0-5]\d$/,password:/^.{6,}$/,ipaddress:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/,uuid:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/};var Go=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class _o{constructor(){_o.cacheInitialized||_o.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Go(this,void 0,void 0,(function*(){try{yield _o.getAnomalyParameters(),_o.refreshCache(),_o.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Go(this,void 0,void 0,(function*(){const e=Date.now();if(_o.anomalyParamsCache&&e-_o.lastFetchedTime<_o.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),_o.anomalyParamsCache;try{return yield _o.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Go(this,void 0,void 0,(function*(){try{const e=yield fetch("https://devai.freeschema.com/v1/get-frontend-anomaly-parameters",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error("Failed to fetch anomaly parameters");const t=yield e.json();return _o.anomalyParamsCache=t.data,_o.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Go(this,void 0,void 0,(function*(){try{Date.now()-_o.lastFetchedTime>_o.cacheExpiryThreshold&&(yield _o.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,n]of Object.entries(So))if(n.test(e))return t;return null}checkConceptAnomaly(e,t){return Go(this,void 0,void 0,(function*(){const n=[];try{if(!t)return n.push("Null value"),{valid:!1,warnings:n};const o=_o.anomalyParamsCache;e.startsWith("the_")||(e=`the_${e}`);const i=o[e];if(console.log("Concept Details : ",i),!i)return console.warn(`No concept details found for type: ${e}`),n.push(`No concept details found for type: ${e}`),{valid:!1,warnings:n};const r=t.length,{min_length:c,max_length:a,data_types:s}=i,l=r>=c&&r<=a,d=this.detectDataType(t),h=s.includes(d);return l||n.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${a}). Current length: ${r}.`),h||n.push(`Type mismatch for '${t}'. Expected types: ${s.join(", ")}, detected type: ${d}.`),l&&h&&n.push(`Concept ${e} is valid. Length: ${r}, Type: ${d}`),{valid:l&&h,warnings:n}}catch(o){return console.error(`Error checking anomaly for ${e} with value ${t}:`,o),{valid:!1,warnings:n}}}))}static checkAnomalyInBulk(e){return Go(this,void 0,void 0,(function*(){_o.cacheInitialized||(yield _o.initializeAnomalyParameters());try{const t={};for(const[n,o]of Object.entries(e)){const e=o.value,{valid:i,warnings:r}=yield(new _o).checkConceptAnomaly(n,e);t[n]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){console.log("Main : ",o);const e=Object.keys(o);return console.log("The exported List : ",e),e}static getFunctionaAnomalyParameters(){}}_o.anomalyParamsCache=null,_o.cacheInitialized=!1,_o.lastFetchedTime=0,_o.cacheExpiryThreshold=6e5;var bo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Bo{checkUniqueness(e,t){return bo(this,void 0,void 0,(function*(){const n=vo.V.logfunction("checkUniqueness");e.startsWith("the_")||(e="the_"+e);let o=(yield Ge(e,999)).id,i=yield(0,re.A)(t,o);return console.log("This is the concept for validator",i),!(i.id>0||(vo.V.logUpdate(n),0))}))}validateField(e){return bo(this,void 0,void 0,(function*(){var t;const n=vo.V.logfunction("validateField");try{performance.now();const o={},{name:i,value:r,type:c,dataType:a,pattern:s,conceptType:l,maxLength:d,minLength:h,minValue:u,maxValue:p,accept:f,file:y,required:v,isUnique:g}=e;if(console.log("Validation is happening on : \n",e),!v||null!==r&&""!==r||(o.required=`The field ${i} is required.`),a&&r){let e=So[a];e&&""!==r&&!e.test(r)&&(o.dataType=`Invalid value for ${a}`)}if(s&&r){const e="string"==typeof s?new RegExp(s):s;""===r||e.test(r)||(o.pattern="Pattern doesn't match with value")}if(r&&null!=d&&r.length>d&&(o.maxLength=`Length exceeds the maximum length of ${d}`),r&&null!=h&&r.length<h&&(o.minLength=`Length must be at least ${h} characters long`),null!=u&&r&&!isNaN(Number(r))&&Number(r)<u&&(o.minValue=`Value must be greater than or equal to ${u}`),null!=p&&r&&!isNaN(Number(r))&&Number(r)>p&&(o.maxValue=`Value must be less than or equal to ${p}`),y&&c&&f){const e=f.split(",").map((e=>e.trim().toLowerCase())),n=null===(t=y.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();n&&!e.includes(n)&&(o.accept=`File must be a valid file type: ${e.join(", ")}`)}return l&&g&&r&&((yield this.checkUniqueness(l,r))||(o.unique="Value is not unique")),vo.V.logUpdate(n),console.log("Before Validation Result : ",o),o}catch(e){throw(0,h.ey)(n,"Validator.validateField",e),e}}))}validateForm(e){return bo(this,void 0,void 0,(function*(){const t=vo.V.logfunction("validateForm");try{performance.now();const n={};for(const t in e){const o=yield this.validateField(e[t]);Object.keys(o).length>0&&(n[t]=o)}return vo.V.logUpdate(t),n}catch(e){throw(0,h.ey)(t,"Validator.validateForm",e),e}}))}validate(e){const t=vo.V.logfunction("validate");try{let n={};return this.validateField(e).then((e=>{Object.keys(e).length>0?(n.status=!1,n.details=e):n.status=!0})),console.error("Error on validate object"),vo.V.logUpdate(t),n}catch(e){(0,h.ey)(t,"Validator.validate",e)}}}const xo=e=>{var t;const n=document.getElementsByName(e)[0];if(!n)return console.warn(`Element with NAME "${e}" not found.`),{name:null,value:null,type:null,dataType:null,pattern:null,conceptType:null,maxLength:null,minLength:null,minValue:null,maxValue:null,accept:null,file:null,required:!1,isUnique:!0};const o=n.hasAttribute("required")||"true"===n.getAttribute("data-required"),i=n.hasAttribute("isUnique")&&"true"===n.getAttribute("isUnique");return{name:n.name,value:n.value,type:n.type,dataType:n.getAttribute("data-type"),pattern:n.getAttribute("data-pattern"),conceptType:n.getAttribute("concept-type"),maxLength:n.getAttribute("maxlength")?parseInt(n.getAttribute("maxlength")):null,minLength:n.getAttribute("minlength")?parseInt(n.getAttribute("minlength")):null,minValue:n.getAttribute("min")?parseInt(n.getAttribute("min")):null,maxValue:n.getAttribute("max")?parseInt(n.getAttribute("max")):null,accept:n.getAttribute("accept")||null,file:"file"===n.type&&(null===(t=n.files)||void 0===t?void 0:t[0])||null,required:o,isUnique:i}};var Ro=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Eo(e,t){var n=arguments;return Ro(this,void 0,void 0,(function*(){const o=vo.V.logfunction("DeleteConnectionByType",n)||{};if(mi){o.serviceWorker=!0;try{const n=yield Si("DeleteConnectionByType",{id:e,linker:t});return vo.V.logUpdate(o),n.data}catch(e){console.error("DeleteConnectionByType sw error: ",e),(0,h.ey)(o,"DeleteConnectionByType",e),xi(e)}}let i=yield be(e);for(let e=0;e<i.length;e++)ze.d.AddConnection(i[e]);let r=yield ze.d.GetConnectionsOfConcept(e),c=yield(0,g.A)(t),a=[];for(let e=0;e<r.length;e++)r[e].typeId==c.id&&a.push(r[e]);for(let e=0;e<a.length;e++)(0,J.m)(a[e].id);vo.V.logUpdate(o)}))}function Do(e,t){return Ro(this,arguments,void 0,(function*(e,t,n=!1){if(mi)try{return(yield Si("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:n})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),xi(e)}let o=[];if(n){let n=yield xe(e),i=yield Ge(t,999);for(let e=0;e<n.length;e++)n[e].typeId==i.id&&o.push(n[e])}else{let n=yield be(e);for(let e=0;e<n.length;e++)ze.d.AddConnection(n[e]);let i=yield ze.d.GetConnectionsOfConcept(e),r=yield(0,g.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&o.push(i[e])}return o}))}class Fo{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=En.yv,this.name="",this.reverse=!1,this.limit=!1,this.isSecure=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var Wo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Uo(e){var t=arguments;return Wo(this,arguments,void 0,(function*(e,n=""){const o=vo.V.logfunction("FreeschemaQueryApi",t);var i=(0,d.ab)("application/json",n);const r=l.B.FreeschemaQueryUrl(),c=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:i,body:c});return e.ok?yield e.json():((0,h.ry)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,h.Mb)(e,r),(0,h.ey)(o,"FreeschemaQueryApi",e)}}))}var Oo=n(5898),Mo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Po extends Mn.w{constructor(e,t){super(),this.query=new Fo,this.countInfoStrings=[],this.order="DESC",this.totalCount=0,this.query=e,this.format=e.outputFormat,this.order=e.order}bind(){return Mo(this,void 0,void 0,(function*(){var e,t;if(this.isDataLoaded)for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);else{if(this.isDataLoaded=!0,this.query.outputFormat=En.BG,""!=this.query.type){let e=yield Ge(this.query.type,999);this.listenToEventType(e.id)}let n=yield Uo(this.query,"");this.conceptIds=n.conceptIds,this.internalConnections=null!==(e=n.internalConnections)&&void 0!==e?e:[],this.linkers=null!==(t=n.linkers)&&void 0!==t?t:[],this.reverse=n.reverse,this.compositionIds=n.mainCompositionIds,this.totalCount=n.mainCount,this.countInfoStrings=n.countinfo}let n=yield this.build();for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);if(""!=this.query.type){let e=yield Ge(this.query.type,999);console.log("this is the listening to the type",e),this.listenToEventType(e.id)}return n}))}build(){return Mo(this,void 0,void 0,(function*(){vo.V.logfunction("build",["schemaquery",this.compositionIds]);let e=(0,Oo.w)(this.countInfoStrings);return this.format==En.y0?this.data=yield(0,Qn.e$)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e,this.order):this.format==En.ZJ?this.data=yield(0,Qn.y6)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e,this.order):this.data=yield(0,Qn.b6)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e),this.data}))}}function Vo(e,t){return new Po(e,t)}class jo{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",this.library={css:[],js:[]},this.assistant={id:"",input:"",type:""},this.timestamp="",this.widgetId=0,this.type="",this.clean="",this.after_render="",this.before_render="",this.update="",this.origin=0,this.version=0,this.mount_child="",this.children=[],this.wrapper="0",this.widget=new No}}var $o=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ho(e,t,n){return $o(this,void 0,void 0,(function*(){var o;const i=vo.V.logfunction("CreateConnectionBetweenEntityLocal",[e.id,t.id,n]),r=e.userId,c=(null===(o=e.type)||void 0===o?void 0:o.characterValue)+"_"+n,a=yield(0,le.$)(c,999,999,r);console.log(yield(0,rn.F)(e.id,t.id,a.id,1e3)),vo.V.logUpdate(i)}))}var Jo=n(4310);const qo='\n/* CKEditor content styles */\n.ck-content {\n /* Container styles */\n max-width: 100%;\n margin: 0 auto;\n font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;\n line-height: 1.5;\n padding: 0.75rem;\n background: #fff;\n color: #333;\n border: 1px solid #ccced1;\n}\n\n/* Headings */\n.ck-content h1, .ck-content h2, .ck-content h3, \n.ck-content h4, .ck-content h5, .ck-content h6 {\n font-weight: 700;\n line-height: 1.2;\n margin: 1em 0 0.5em;\n}\n\n.ck-content h1 { font-size: 2.5em; }\n.ck-content h2 { font-size: 2em; }\n.ck-content h3 { font-size: 1.75em; }\n.ck-content h4 { font-size: 1.5em; }\n.ck-content h5 { font-size: 1.25em; }\n.ck-content h6 { font-size: 1em; }\n\n/* Paragraphs and spacing */\n.ck-content p {\n margin: 1em 0;\n line-height: 1.6;\n}\n\n/* Links */\n.ck-content a {\n color: #1a73e8;\n text-decoration: none;\n}\n\n.ck-content a:hover {\n text-decoration: underline;\n}\n\n/* Lists */\n.ck-content ul,\n.ck-content ol {\n padding-left: 2em;\n margin: 1em 0;\n}\n\n.ck-content ul {\n list-style: disc;\n}\n\n.ck-content ol {\n list-style: decimal;\n}\n\n.ck-content li {\n margin: 0.5em 0;\n}\n\n/* Blockquotes */\n.ck-content blockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 5px solid #ccc;\n font-style: italic;\n color: #666;\n}\n\n/* Code blocks */\n.ck-content pre {\n background: #f5f5f5;\n border: 1px solid #ddd;\n border-radius: 4px;\n padding: 1em;\n margin: 1em 0;\n overflow-x: auto;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;\n}\n\n.ck-content code {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n border-radius: 3px;\n font-size: 0.9em;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;\n}\n\n/* Tables */\n.ck-content table {\n border-collapse: collapse;\n width: 100%;\n margin: 1em 0;\n}\n\n.ck-content table th,\n.ck-content table td {\n border: 1px solid #ddd;\n padding: 0.75em;\n text-align: left;\n}\n\n.ck-content table th {\n background: #f5f5f5;\n font-weight: bold;\n}\n\n/* Images */\n.ck-content img {\n max-width: 100%;\n height: auto;\n margin: 1em 0;\n}\n\n.ck-content figure {\n margin: 1em 0;\n text-align: center;\n}\n\n.ck-content figure img {\n margin: 0;\n}\n\n.ck-content figcaption {\n color: #666;\n font-size: 0.9em;\n margin-top: 0.5em;\n}\n\n/* Dark mode */\n/*\n@media (prefers-color-scheme: dark) {\n .ck-content {\n background: #1a1a1a;\n color: #e0e0e0;\n }\n\n .ck-content a {\n color: #64b5f6;\n }\n\n .ck-content blockquote {\n border-left-color: #404040;\n color: #b0b0b0;\n }\n\n .ck-content pre,\n .ck-content code {\n background: #2d2d2d;\n border-color: #404040;\n }\n\n .ck-content table th,\n .ck-content table td {\n border-color: #404040;\n }\n\n .ck-content table th {\n background: #2d2d2d;\n }\n\n .ck-content figcaption {\n color: #b0b0b0;\n }\n}\n*/\n\n/* CUSTOM DOCUMENTATION CSS */\n\n#documentation-preview {\n border: 1px solid #ccc;\n padding: 1rem;\n}\n\n#documentation-preview h3 {\n font-size: 1.5rem;\n margin-bottom: 1rem;\n}\n\n.pre-wrapper {\n background: #f2f5f9;\n border: 1px solid #cecece;\n display: block;\n padding: 1rem;\n border-radius: 0.25rem;\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n\n.pre-wrapper pre {\n margin: 0;\n color: #e87aa2;\n}\n\n.widget-doc-section pre {\n background-color: transparent;\n}\n\n.widget-doc-section p {\n margin: 0;\n}\n\n.widget-doc-section code {\n color: #e87aa2;\n font-size: 0.875rem;\n}\n\n.mv-3 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n\n.pv-3 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n\n.documentation-creator {\n text-align: right;\n color: #666;\n margin-top: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.documentation-creator span {\n font-style: italic;\n}\n\n.documentation-attachments {\n display: flex;\n flex-wrap: wrap;\n}\n\n.documentation-attachments img {\n width: 25%;\n height: auto;\n border: 1px solid #ccc;\n padding: 0.25rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n\n';var zo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Qo(e,t,n){return zo(this,void 0,void 0,(function*(){var o;const i=yield tn(e,"the_page_body");(null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.id)?yield Yo(i[0].id,t,n):t.innerHTML="<h4>Invalid or Page doesn't exist</h4>"}))}function Xo(e,t,n){return zo(this,void 0,void 0,(function*(){try{t.innerHTML='\n <div style="display: flex; align-items: center; gap: 10px; width: 100%">\n <div style="\n width: 20px;\n height: 20px;\n border: 3px solid #f3f3f3;\n border-top: 3px solid #3498db;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n "></div>\n <span>Please Wait...</span>\n </div>\n \n <style>\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n </style>\n';const o=yield(0,Jo.qj)(e);let i=o.mainId,r=o.data;return yield Zo(i,r,t,n)}catch(e){console.error(`Error Caught Rendering Widget: ${e}`),t.textContent=`Error: ${e.message}`}}))}function Yo(e,t,n){return zo(this,void 0,void 0,(function*(){try{const o=yield(0,Jo.Cp)(e);return yield Zo(e,o,t,n)}catch(e){console.error(`Error Caught Rendering Widget: ${e}`)}}))}function Zo(e,t,n,o){return zo(this,void 0,void 0,(function*(){const i=yield ei(e,[],t);if(!i.name)return void(n.innerHTML="<h4>Invalid or Widget doesn't exist</h4>");const r=n,c=yield ti(i,r,void 0,o),a=Array.from({length:32},(()=>"abcdef"[Math.floor(6*Math.random())])).join("");n.classList.add(`${a}`),n.style.position="relative";const s=document.createElement("style");s.id="mystyleid",s.innerHTML=`\n .${a} {\n ${i.css+c.css+qo} \n /* DOCUMENTATION */\n }\n\n #widget-details {\n position: absolute;\n right: 0px;\n top: 0px;\n }\n\n #widget-details button {\n background: #fff;\n border: 1px solid #ccc;\n border-radius: 0 0 0 0.25rem;\n height: auto;\n width: auto;\n }\n\n #widget-details button:hover, \n #widget-details button:focus {\n opacity: 0.75;\n }\n\n #widget-details button span {\n pointer-events: none;\n font-size: 1rem;\n }\n`,document.head.appendChild(s);const l=document.createElement("script");l.innerHTML=i.js,r.appendChild(l);const d=document.createElement("div");d.id="widget-details",d.innerHTML="",d.innerHTML='\n <button id="widget-documentation-btn" class="d-flex align-items-center gap-1" title="Documentation">\n <span class="material-symbols-outlined"> visibility </span>\n </button>\n ',r.appendChild(d);const h=document.createElement("dialog");h.id="widget-documentation-preview-modal",h.className="col-md-8",h.innerHTML="",h.innerHTML='\n <div class="py-2 px-3 bg-secondary text-light fs-4 d-flex justify-content-between align-items-center">\n <span>Documentation</span>\n <span class="material-symbols-outlined document-preview-close-button" style="cursor: pointer;">close</span>\n </div>\n\n <div id="documentation-preview" class="ck-content"></div>\n\n <div class="text-end mt-3">\n <button class="btn btn-secondary document-preview-close-button">Close</button>\n </div>\n ',r.appendChild(h),document.getElementById("widget-documentation-btn").addEventListener("click",(()=>{!function(e){zo(this,void 0,void 0,(function*(){const t=new Fo;t.typeConnection="the_widget_documentation",t.name="documentationText",t.selectors=["the_documentation_text"];const n=new Fo;n.typeConnection="the_widget_s_documentation",n.name="documentationBlank",n.selectors=["the_documentation_text","the_documentation_content","the_documentation_language","the_documentation_doc_title","the_documentation_folder","the_documentation_creator_email","the_documentation_created_by","the_documentation_content","the_documentation_type","the_documentation_s_doc_url","the_documentation_s_image_url","the_documentation_auth_type","the_documentation_bearer_token","the_documentation_method","the_documentation_method_url","the_documentation_username","the_documentation_password","the_documentation_s_json_list","the_documentation_code_editor","the_documentation_return"];const o=new Fo;o.typeConnection="the_documentation_s_json_list",o.name="documentationJSON",o.selectors=["the_json_list_key","the_json_list_value"],n.freeschemaQueries=[o];const i=new Fo;i.conceptIds=[e],i.freeschemaQueries=[t,n],i.inpage=100,i.outputFormat=En.y0,yield Vo(i,"").subscribe((e=>zo(this,void 0,void 0,(function*(){var t,n,o,i,r,c,a,s,l,d,h;let u;console.log("widget documentation preview data ->",e);const p=(null===(s=null===(a=null===(c=null===(r=null===(i=null===(o=null===(n=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.data)||void 0===n?void 0:n.the_widget)||void 0===o?void 0:o.the_widget_documentation)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_documentation)||void 0===c?void 0:c.the_documentation_text)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_text)||"";p&&(u=p);const f=null===(h=null===(d=null===(l=null==e?void 0:e[0])||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_widget)||void 0===h?void 0:h.the_widget_s_documentation;if(null==f?void 0:f.length){const e=null==f?void 0:f.map((e=>{var t,n,o,i,r,c,a,s,l,d,h,u,p,f,y,v,g,m,C,T,I,w,k,N,A,L,S;const G=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_documentation,_=null===(o=null===(n=null==G?void 0:G.the_documentation_type)||void 0===n?void 0:n.data)||void 0===o?void 0:o.the_type,b=null===(r=null===(i=null==G?void 0:G.the_documentation_content)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_content,B=null===(a=null===(c=null==G?void 0:G.the_documentation_creator_email)||void 0===c?void 0:c.data)||void 0===a?void 0:a.the_creator_email,x=null===(l=null===(s=null==G?void 0:G.the_documentation_doc_title)||void 0===s?void 0:s.data)||void 0===l?void 0:l.the_doc_title,R=null===(h=null===(d=null==G?void 0:G.the_documentation_method)||void 0===d?void 0:d.data)||void 0===h?void 0:h.the_method,E=null===(p=null===(u=null==G?void 0:G.the_documentation_method_url)||void 0===u?void 0:u.data)||void 0===p?void 0:p.the_method_url,D=null===(y=null===(f=null==G?void 0:G.the_documentation_bearer_token)||void 0===f?void 0:f.data)||void 0===y?void 0:y.the_bearer_token,F=null===(g=null===(v=null==G?void 0:G.the_documentation_username)||void 0===v?void 0:v.data)||void 0===g?void 0:g.the_username,W=null===(C=null===(m=null==G?void 0:G.the_documentation_password)||void 0===m?void 0:m.data)||void 0===C?void 0:C.the_password,U=null===(I=null===(T=null==G?void 0:G.the_documentation_auth_type)||void 0===T?void 0:T.data)||void 0===I?void 0:I.the_auth_type,O=null==G?void 0:G.the_documentation_s_json_list,M=null===(k=null===(w=null==G?void 0:G.the_documentation_language)||void 0===w?void 0:w.data)||void 0===k?void 0:k.the_language,P=null===(A=null===(N=null==G?void 0:G.the_documentation_return)||void 0===N?void 0:N.data)||void 0===A?void 0:A.the_return,V=null===(S=null===(L=null==G?void 0:G.the_documentation_code_editor)||void 0===L?void 0:L.data)||void 0===S?void 0:S.the_code_editor,j=null==G?void 0:G.the_documentation_s_doc_url,$=null==G?void 0:G.the_documentation_s_image_url;let H={type:_,content:b,creatorEmail:B,title:x};if("blank"===_)H=Object.assign({},H);else if("api"===_){const e=[];(null==O?void 0:O.length)&&(null==O||O.forEach((t=>{var n,o,i,r,c,a,s,l;e.push({key:null===(r=null===(i=null===(o=null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.the_json_list)||void 0===o?void 0:o.the_json_list_key)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_key,value:null===(l=null===(s=null===(a=null===(c=null==t?void 0:t.data)||void 0===c?void 0:c.the_json_list)||void 0===a?void 0:a.the_json_list_value)||void 0===s?void 0:s.data)||void 0===l?void 0:l.the_value})}))),H=Object.assign(Object.assign({},H),{method:R,methodURL:E,authType:U,username:F,password:W,bearerToken:D,json:e})}else if("function"===_)H=Object.assign(Object.assign({},H),{language:M,return:P,codeEditor:V});else if("imgAndLink"===_){const e=[],t=[];(null==$?void 0:$.length)&&(null==$||$.forEach((t=>{var n;e.push(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.the_image_url)}))),(null==j?void 0:j.length)&&(null==j||j.forEach((e=>{var n;t.push(null===(n=e.data)||void 0===n?void 0:n.the_doc_url)}))),H=Object.assign(Object.assign({},H),{imageList:e,linkList:t})}return H}));u=e}yield function(){return zo(this,void 0,void 0,(function*(){document.getElementById("widget-documentation-preview-modal").showModal()}))}(),function(e){const t=document.getElementById("documentation-preview");t.innerHTML="",e.length&&"string"!=typeof e?null==e||e.forEach((e=>{var n,o;const i=document.createElement("h3");let r="";switch(null==e?void 0:e.type){case"api":r="API";break;case"function":r="Functions and Classes";break;case"imgAndLink":r="Images and Links";break;default:r=""}i.innerHTML=`\n ${null==e?void 0:e.title} ${r?"("+r+")":""}\n `,null==t||t.appendChild(i);const c=document.createElement("div");c.classList.add("widget-doc-content"),(null==e?void 0:e.content)&&(c.innerHTML=e.content,null==t||t.appendChild(c));const a=document.createElement("div");if(a.classList.add("widget-doc-section"),"blank"===e.type)a.innerHTML=`\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `;else if("api"===e.type){let t="";"basicAuth"===e.authType?t=`\n <p>username: <code>${null==e?void 0:e.username}</code></p>\n <p>password: <code>${null==e?void 0:e.password}</code></p>\n `:"bearerToken"===e.authType&&(t=`\n <h6>Token: <code>${null==e?void 0:e.bearerToken}</code></h6>\n `);const n=e.json.map((e=>`${null==e?void 0:e.key}: ${null==e?void 0:e.value}`)).join(", ");a.innerHTML=`\n <div class="pv-3">\n <h6>Method Type: <code>${null==e?void 0:e.method.toUpperCase()}</code></h6>\n <h6>Endpoint: <code>${null==e?void 0:e.methodURL}</code></h6>\n </div>\n <div class="pv-3">\n <h6>Auth Type: <code>${null==e?void 0:e.authType.toUpperCase()}</code></h6>\n ${t}\n </div>\n <div class="pv-3">\n <h6>JSON</h6>\n <code class="pre-wrapper">\n<pre>{\n ${n}\n}\n</pre>\n </code>\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `}else if("function"===e.type)a.innerHTML=`\n <div class="mv-3">\n <h6>Parameter</h6>\n <p>Language: ${null==e?void 0:e.language}</p>\n <code class="pre-wrapper"><pre>${null==e?void 0:e.codeEditor}</pre></code>\n <h6>Returns</h6>\n <code class="pre-wrapper"><pre>${null==e?void 0:e.return}</pre></code>\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `;else if("imgAndLink"===e.type){const t=null===(n=null==e?void 0:e.linkList)||void 0===n?void 0:n.map((e=>`\n <p>${e}</p>\n `)).join(""),i=null===(o=null==e?void 0:e.imageList)||void 0===o?void 0:o.map((e=>`\n <img src="${e}">\n `)).join(""),r=(null==t?void 0:t.length)?`\n <div class="mv-3">\n <h6>Web links</h6>\n ${t}\n </div>\n `:"",c=(null==i?void 0:i.length)?`\n <h6>Attachments</h6>\n <div class="documentation-attachments">\n ${i}\n </div>\n `:"";a.innerHTML=`\n <div class="mv-3">\n ${r}\n ${c}\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `}null==t||t.appendChild(a)})):t.innerHTML=e}(u)}))))}))}((null==i?void 0:i.origin)||(null==i?void 0:i.widgetId))}));const u=r.querySelectorAll(".document-preview-close-button");return null==u||u.forEach((e=>{e.addEventListener("click",(()=>{!function(){zo(this,void 0,void 0,(function*(){const e=document.getElementById("widget-documentation-preview-modal"),t=null==e?void 0:e.querySelector("form");null==t||t.reset(),null==e||e.close()}))}()}))})),r.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")})),c}))}function Ko(e){return zo(this,arguments,void 0,(function*(e,t=[],n=""){const o=yield(0,Jo.Cp)(e);return yield ei(e,[],o)}))}function ei(e){return zo(this,arguments,void 0,(function*(e,t=[],n,o=""){var i,r,c,a,s,l,d,h,u,p,f,y,v,g,m,C,T,I,w,k,N,A,L,S,G,_,b,B,x,R,E,D,F,W,U,O,M,P,V,j,$,H,J,q,z,Q,X,Y,Z,K,ee,te,ne,oe;try{const ie=new jo,re=(0,Jo.ix)(n,e);t.push(e);const ce=null===(i=null==re?void 0:re.data)||void 0===i?void 0:i.the_widget;ie.name=null===(c=null===(r=null==ce?void 0:ce.the_widget_name)||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,ie.html=null===(s=null===(a=null==ce?void 0:ce.the_widget_html)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_html,ie.css=null===(d=null===(l=null==ce?void 0:ce.the_widget_css)||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_css,ie.js=null===(u=null===(h=null==ce?void 0:ce.the_widget_js)||void 0===h?void 0:h.data)||void 0===u?void 0:u.the_js,ie.origin=Number(null===(f=null===(p=null==ce?void 0:ce.the_widget_origin)||void 0===p?void 0:p.data)||void 0===f?void 0:f.the_origin),ie.version=null===(v=null===(y=null==ce?void 0:ce.the_widget_version)||void 0===y?void 0:y.data)||void 0===v?void 0:v.the_version,ie.clean=null===(m=null===(g=null==ce?void 0:ce.the_widget_clean)||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_clean,ie.timestamp=null===(T=null===(C=null==ce?void 0:ce.the_widget_timestamp)||void 0===C?void 0:C.data)||void 0===T?void 0:T.the_timestamp,ie.id=re.id;const ae=null===(w=null===(I=null==ce?void 0:ce.the_widget_type)||void 0===I?void 0:I.data)||void 0===w?void 0:w.the_type;ie.type="null"==ae||null==ae?"the_element_name":ae,ie.after_render=null===(N=null===(k=null==ce?void 0:ce.the_widget_after_render)||void 0===k?void 0:k.data)||void 0===N?void 0:N.the_after_render,ie.before_render=null===(L=null===(A=null==ce?void 0:ce.the_widget_before_render)||void 0===A?void 0:A.data)||void 0===L?void 0:L.the_before_render,ie.update=null===(G=null===(S=null==ce?void 0:ce.the_widget_update)||void 0===S?void 0:S.data)||void 0===G?void 0:G.the_update,ie.widgetId=e,ie.mount_child=null===(b=null===(_=null==ce?void 0:ce.the_widget_mount_child)||void 0===_?void 0:_.data)||void 0===b?void 0:b.the_mount_child;const se=null==ce?void 0:ce.the_widget_s_child,le=null===(B=null==ce?void 0:ce.the_widget_s_css_library)||void 0===B?void 0:B.map((e=>{var t,n,o,i,r,c,a,s;return{order:null===(i=null===(o=null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_css_library)||void 0===n?void 0:n.the_css_library_order)||void 0===o?void 0:o.data)||void 0===i?void 0:i.the_order,url:null===(s=null===(a=null===(c=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.the_css_library)||void 0===c?void 0:c.the_css_library_url)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_url}})),de=null===(x=null==ce?void 0:ce.the_widget_s_js_library)||void 0===x?void 0:x.map((e=>{var t,n,o,i,r,c,a,s;return{order:null===(i=null===(o=null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_js_library)||void 0===n?void 0:n.the_js_library_order)||void 0===o?void 0:o.data)||void 0===i?void 0:i.the_order,url:null===(s=null===(a=null===(c=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.the_js_library)||void 0===c?void 0:c.the_js_library_url)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_url}}));ie.library={css:le||[],js:de||[]};const he=null===(E=null===(R=null==ce?void 0:ce.the_widget_assistant)||void 0===R?void 0:R.data)||void 0===E?void 0:E.the_assistant;if(ie.assistant={id:null===(F=null===(D=null==he?void 0:he.the_assistant_id)||void 0===D?void 0:D.data)||void 0===F?void 0:F.the_id,input:null===(U=null===(W=null==he?void 0:he.the_assistant_input)||void 0===W?void 0:W.data)||void 0===U?void 0:U.the_input,type:null===(M=null===(O=null==he?void 0:he.the_assistant_type)||void 0===O?void 0:O.data)||void 0===M?void 0:M.the_type},null==se?void 0:se.length)for(let e=0;e<se.length;e++){const i=(null===(j=null===(V=null===(P=se[e])||void 0===P?void 0:P.data.the_child_widget)||void 0===V?void 0:V.the_child_widget_info)||void 0===j?void 0:j.id)||(null===(q=null===(J=null===(H=null===($=se[e])||void 0===$?void 0:$.data.the_child_widget)||void 0===H?void 0:H.the_child_widget_parent)||void 0===J?void 0:J.data)||void 0===q?void 0:q.the_parent),r=yield ei(i,t,n,o),c=null===(Z=null===(Y=null===(X=null===(Q=null===(z=se[e])||void 0===z?void 0:z.data)||void 0===Q?void 0:Q.the_child_widget)||void 0===X?void 0:X.the_child_widget_type)||void 0===Y?void 0:Y.data)||void 0===Z?void 0:Z.the_type,a=null===(oe=null===(ne=null===(te=null===(ee=null===(K=se[e])||void 0===K?void 0:K.data)||void 0===ee?void 0:ee.the_child_widget)||void 0===te?void 0:te.the_child_widget_wrapper)||void 0===ne?void 0:ne.data)||void 0===oe?void 0:oe.the_wrapper;r.type="null"==c||null==c?"the_element_name":c,r.wrapper=a,ie.children.push(r)}return ie}catch(e){throw console.error("error",e),e}}))}function ti(e,t){return zo(this,arguments,void 0,(function*(e,t,n=!0,o,i){var r,c;const a=new No;a.html=e.html,a.widgetType=e.type,a.componentDidMountFunction=e.before_render,a.addEventFunction=e.after_render,a.mountChildWidgetsFunction=e.mount_child,a.widgetState=Object.assign({},i),o&&(a.data=o),t.innerHTML="";const s=t;if(s&&(yield a.mount(s),e.widget=a,e.children.length>0&&(null===(r=a.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){const n=e.children[t];for(let e=0;e<a.childWidgetElement.length;e++){const t=a.childWidgetElement[e];if(n.wrapper===t.id){const e=oi(n);n.html=`<div id="${n.wrapper}">${n.html}</div>`;const o=yield ti(e,t,!1,a.data,a.widgetState);a.childWidgets.push(o),a.css=a.css+o.css+`#${t.id} { ${n.css} }`,o.dataChange((e=>{var t;const n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(a.childrenData[n]=e)}))}}}return console.log("newWidget ->",a,e),yield ri(t,".widget_container"),a}))}function ni(e,t){return zo(this,arguments,void 0,(function*(e,t,n=!0,o,i){var r,c;let a=new No;a.html=e.html,a.widgetState=Object.assign({},o),a.widgetType=e.type,a.componentDidMountFunction=e.before_render,a.addEventFunction=e.after_render,a.mountChildWidgetsFunction=e.mount_child,a.inDevelopment=!1!==i,t.innerHTML="";let s=t;if(s&&(yield a.mount(s),e.widget=a,e.children.length>0&&(null===(r=a.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){let n=e.children[t];for(let e=0;e<a.childWidgetElement.length;e++){let t=a.childWidgetElement[e];if(n.wrapper===t.id){const e=oi(n),o=yield ni(e,t,!1,a.widgetState,i);a.childWidgets.push(o),a.css=a.css+o.css+`#${t.id} { ${n.css} }`,o.dataChange((e=>{var t;console.log("This is the data change in child",e);let n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(a.childrenData[n]=e),console.log("new child data",a.childrenData)}))}}}return console.log("newWidget ->",a,e),a}))}function oi(e){return e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),e.html=e.html.replace(/<[^>]*onclick="widgetSelected\(event\)"\s*,?\s*ondragover="_dragService\.dragOverWidgetElement\(event\)"\s*,?\s*ondrop="_dragService\.dropWidgetElement\(event\)"\s*,?\s*ondragstart="_dragService\.dragStartWidgetElement\(event\)"\s*,?\s*ondragend="_dragService\.dragEndWidgetElement\(event\)"[^>]*>/g,(e=>e.replace(/onclick="widgetSelected\(event\)"/g,'onclick=""').replace(/ondragover="_dragService\.dragOverWidgetElement\(event\)"/g,'ondragover=""').replace(/ondrop="_dragService\.dropWidgetElement\(event\)"/g,'ondrop=""').replace(/ondragstart="_dragService\.dragStartWidgetElement\(event\)"/g,'ondragstart=""').replace(/ondragend="_dragService\.dragEndWidgetElement\(event\)"/g,'ondragend=""').trim())),e.html=e.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),e}function ii(e,t){return zo(this,void 0,void 0,(function*(){return e&&1===e.nodeType&&e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function ri(e,t){return zo(this,void 0,void 0,(function*(){const n=e.querySelectorAll(t);for(const e of n){const n=e.parentElement;if(n){for(;e.firstChild;){const o=yield ii(e.firstChild,t);n.insertBefore(o,e)}n.removeChild(e)}}}))}var ci=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ai(e){return ci(this,arguments,void 0,(function*(e,t=null,n="",o={concepts:[],connections:[]}){var i,r,c,a;if(mi)try{const s=yield Si("CreateData",{json:e,ofConcept:t,typeConcept:n,actions:o});return(null===(r=null===(i=null==s?void 0:s.actions)||void 0===i?void 0:i.concepts)||void 0===r?void 0:r.length)&&(o.concepts=JSON.parse(JSON.stringify(s.actions.concepts))),(null===(a=null===(c=null==s?void 0:s.actions)||void 0===c?void 0:c.connections)||void 0===a?void 0:a.length)&&(o.connections=JSON.parse(JSON.stringify(s.actions.connections))),s.data}catch(e){console.error("CreateTheComposition sw error: ",e),xi(e)}let s=999,l=999,d=(0,P.o)();for(const i in e){let r=si(i);if("string"!=typeof e[i]&&"number"!=typeof e[i])if(null==t||0==t.id)d=yield(0,K.k)(r,"",!0,s,4,l,void 0,o),Array.isArray(e[i])&&(r=li(r)),yield ai(e[i],d,r,o);else{Array.isArray(e[i])&&(r=di(r));let c=di(i),a=yield(0,K.k)(r,"",!0,s,4,l,void 0,o);d=a;let h=ui(n,c),u=yield(0,le.$)(h,l,s,s,o);yield(0,rn.F)(t.id,a.id,u.id,1e3,u.characterValue,s,o),Array.isArray(e[i])&&(r=li(r)),yield ai(e[i],a,r,o)}else{let r=ui(n,i),c=yield(0,le.$)(r,l,s,s,o),a=yield(0,K.k)(i,e[i].toString(),!1,s,4,l,void 0,o);console.log("this is the type concept in down",c,a),null!=t&&(yield(0,rn.F)(t.id,a.id,c.id,1e3,r,s,o))}}return d}))}function si(e){return e.startsWith("the_")?e:"the_"+e}function li(e){return e.endsWith("_s")?e:e+"_s"}function di(e){return e.replace(/_s$/,"")}const hi=e=>/^[+-]?\d+(\.\d+)?$/.test(e);function ui(e,t){return hi(t)?e+"_":e+"_"+function(e){return e.startsWith("the_")?e.slice(4):e}(t)}class pi{constructor(){this.prototype="",this.required=[],this.optional=[],this.concepts=[],this.connections=[],this.addedConcepts=[],this.addedConnections=[],this.childPrototypes=[]}}var fi=n(3077),yi=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function vi(e){return yi(this,void 0,void 0,(function*(){let t=[],n=yield function(e){return yi(this,void 0,void 0,(function*(){let t=yield(0,le.$)("the_prototype_of",999,999,999),n=yield(0,le.$)(e,999,999,999);return yield function(e,t){return yi(this,void 0,void 0,(function*(){let n=yield(0,fi.A)("","",999,e.id,t.id,4,!1);return n.characterValue=t.characterValue,n.typeCharacter=t.characterValue,n.isComposition=!0,n.type=t,n}))}(t,n)}))}(e.prototype),o=yield gi(e.required,n,t,!0),i=yield gi(e.optional,n,t);if(t.push(n),e.childPrototypes.length>0)for(let t=0;t<e.childPrototypes.length;t++)yield vi(e.childPrototypes[t]);return o=[...o,...i],e.concepts=[...t,...e.addedConcepts],e.connections=[...o,...e.addedConnections],{concepts:t,connections:o}}))}function gi(e,t,n){return yi(this,arguments,void 0,(function*(e,t,n,o=!1){var i;let r=[],c=[],a=(null===(i=t.type)||void 0===i?void 0:i.characterValue)+"_prototype";a+=o?"_requires":"_optional";let s=yield(0,le.$)(a,999,999,999);n.push(s);for(let t=0;t<e.length;t++){let n=yield(0,le.$)(e[t],999,999,999);r.push(n)}for(let e=0;e<r.length;e++){let n=yield(0,rn.F)(t.id,r[e].id,s.id,1e3,a,999);c.push(n)}for(let e=0;e<r.length;e++)n.push(r[e]);return c}))}var mi,Ci=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const Ti=Date.now().toString(36)+Math.random().toString(36).substring(2);let Ii=[],wi=[],ki=!1;function Ni(e){ki=e}function Ai(e="",t){vt.b.BearerAccessToken=e,null==typeof document?vt.b.sessionId=t:vt.b.sessionId=parseInt((0,vo.R)("SessionId")),mi&&Si("updateAccessToken",{accessToken:e,session:parseInt((0,vo.R)("SessionId"))})}function Li(){return Ci(this,arguments,void 0,(function*(e="",t="",n="",o="",i=!0,c="",a=void 0,s={},d={}){var u;try{l.B.BASE_URL=e,l.B.AI_URL=t,l.B.NODE_URL=o,l.B.BASE_APPLICATION=c,l.B.LOG_SERVER=null!==(u=d.logserver)&&void 0!==u?u:"https://logdev.freeschema.com",console.log("setting the logserver",l.B.LOG_SERVER,d.logserver),Ai(n);let i=Math.floor(1e8*Math.random());l.B.setRandomizer(i);const p={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(l.B.FLAGS=p,l.B.FLAGS=Object.assign(Object.assign({},p),s),function(e){const t=vo.V.logfunction("initializeFlags",arguments);try{return e.logApplication&&(go.initialize(),vo.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(vo.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(qe.J.activateStatus=!0,console.warn("Access Tracker Activated.")),e.isTest&&(r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0),vo.V.logUpdate(t),e}catch(e){throw(0,h.ey)(t,"initializeFlags",e),e}}(l.B.FLAGS),!("serviceWorker"in navigator))return yield _i(),void console.warn("Service Worker not supported in this browser.");if(yield function(){return Ci(this,void 0,void 0,(function*(){const e=sessionStorage.getItem("myCacheServer");function t(e){return Ci(this,void 0,void 0,(function*(){try{const t=yield fetch(l.B.getMyCacheServer(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({"my-coords":e?e.coords:"location denied"})});if(!t.ok)throw new Error("Failed to sync data to the server.");const n=yield t.json();n.success&&(sessionStorage.setItem("myCacheServer",n.nearestServer),l.B.NODE_CACHE_URL=n.nearestServer)}catch(e){console.error("error getting cache server",e.message)}}))}e?l.B.NODE_CACHE_URL=e:navigator.geolocation.getCurrentPosition((e=>Ci(this,void 0,void 0,(function*(){yield t(e)}))),(e=>Ci(this,void 0,void 0,(function*(){e.code===e.PERMISSION_DENIED&&(yield t())}))))}))}(),function(){navigator.serviceWorker.addEventListener("message",(e=>Ci(this,void 0,void 0,(function*(){var t,n,o,i;try{if(e.data&&"API_401"===e.data.type){const{requestDetails:o}=e.data,i={method:o.method,headers:new Headers(o.headers),body:o.body},r=yield fetch(o.url,i),c=yield null==r?void 0:r.json();null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||void 0===n||n.postMessage({type:"API_RESPONSE",messageId:e.data.messageId,response:new Response(c,{status:r.status,statusText:r.statusText,headers:r.headers})})}}catch(t){console.error("Error during listenPostMessage",t),null===(i=null===(o=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===o?void 0:o.controller)||void 0===i||i.postMessage({type:"API_RESPONSE",messageId:e.data.messageId})}}))))}(),function(){yo.x.addEventListener("message",(e=>Ci(this,void 0,void 0,(function*(){const{type:t,payload:n}=e.data;if(!t)return;let o={success:!1,data:void 0};Gi[t]?yield Gi[t](n):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),a&&a.activate&&a.manual)yield new Promise(((e,t)=>{navigator.serviceWorker.ready.then((t=>Ci(this,void 0,void 0,(function*(){console.log("registraions ready",t),mi=t.active,yield Ri(),e("done")})))).catch((e=>{console.error("Error: Ready service worker",e),t(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>t("Timeout ready")),3e4)}));else if(a&&(null==a?void 0:a.activate))try{console.log("service worker initialiing"),yield function(e){var t=arguments;return Ci(this,void 0,void 0,(function*(){const n=vo.V.logfunction("handleRegisterServiceWorker",t);yield new Promise(((t,o)=>{var i,r;let c=!1;navigator.serviceWorker.register(null!==(i=e.pathToSW)&&void 0!==i?i:"./serviceWorker.bundle.js",{scope:null!==(r=e.scope)&&void 0!==r?r:"/"}).then((e=>Ci(this,void 0,void 0,(function*(){console.log("Service Worker registered:",e),setInterval((()=>{wi.length&&Bi()}),2e3),console.log("update listen start"),e.onupdatefound=()=>{const n=e.installing;console.log("new worker",n),n&&(n.onstatechange=()=>Ci(this,void 0,void 0,(function*(){console.warn("on state change triggered",n.state,navigator.serviceWorker.controller),"installing"===n.state&&(console.log("Service Worker installing"),mi=void 0),"activated"!==n.state&&"redundant"!==n.state||!navigator.serviceWorker.controller||(mi=n,console.log("New Service Worker is active",e),setTimeout((()=>{console.log("Message Processed after some time"),Bi()}),5e3),yield Ri(),c=!0,Bi(),t())})))},e.addEventListener("controllerchange",(()=>Ci(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(mi=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield Ri())})))),(e.installing||e.waiting||e.active)&&e.addEventListener("statechange",(e=>Ci(this,void 0,void 0,(function*(){var t;"activating"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.state)&&(mi=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield Ri())})))),e.active?(console.log("active sw"),mi=e.active,yield Ri(),Bi(),t()):setTimeout((()=>{c||o("Not Completed Initialization")}),1e4)})))).catch((e=>Ci(this,void 0,void 0,(function*(){yield _i(),o(e),console.error("Service Worker registration failed:",e),(0,h.ey)(n,"handleRegisterServiceWorker",e)}))))}))}))}(a)}catch(e){yield _i(),console.error("Unable to start service worker",e)}else yield _i(),console.warn("Service Worker not activated");return!0}catch(e){yield _i(),console.warn("Cannot initialize the system",e)}}))}function Si(e,t){return Ci(this,arguments,void 0,(function*(e,t,n=0){let o=!1;const i=Math.random().toString(36).substring(2);t.messageId=i,t.TABID=Ti;const r=JSON.parse(JSON.stringify(t));let c;return"checkProcess"!=e&&0==n&&(c=setInterval((()=>Ci(this,void 0,void 0,(function*(){if(console.log("process took more than one second",i,e,o),!o&&!(yield function(e,t){return Ci(this,void 0,void 0,(function*(){var n;try{const o=yield Si("checkProcess",{checkMessageId:e});if(console.log("check interval data res for type ",t,e,o.data),null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.processing)return!0}catch(n){return console.error("error on checing executing process",t,e,n),!1}}))}(i,e))&&(clearInterval(c),!o)){if(console.log("Failed to handle type "+e+" message not found "+i,"retrying: ",0==n,e),0==n&&"checkProcess"!=e)return console.log("retrying ",e,i),yield Si(e,t,n+1);console.log("Failed to handle type "+e+" "+i)}}))),2e3)),new Promise(((n,a)=>{if(navigator.serviceWorker.controller||mi||console.log("will go to queue",navigator.serviceWorker.controller,mi,e),navigator.serviceWorker.controller||mi){const s=r=>{var l,d,u,p,f,y;(null===(l=null==r?void 0:r.data)||void 0===l?void 0:l.messageId)==i&&(o=!0,clearInterval(c),r.data.success||(401==(null===(d=null==r?void 0:r.data)||void 0===d?void 0:d.status)?a((0,h.ry)(new Response("Unauthorized",{status:401,statusText:null===(u=null==r?void 0:r.data)||void 0===u?void 0:u.statusText}))):500==(null===(p=null==r?void 0:r.data)||void 0===p?void 0:p.status)?a((0,h.Mb)(new Response("Internal Server Error",{status:500,statusText:null===(f=null==r?void 0:r.data)||void 0===f?void 0:f.statusText}))):(console.error("Error in the response from worker:",r),a(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(r.data)}`))),(null===(y=r.data)||void 0===y?void 0:y.actions)&&(t.actions=JSON.parse(JSON.stringify(r.data.actions))),n(r.data),navigator.serviceWorker.removeEventListener("message",s))};if(navigator.serviceWorker.addEventListener("message",s),navigator.serviceWorker.controller)"checkProcess"!=e&&console.log("sent to sw",e,i),navigator.serviceWorker.controller.postMessage({type:e,payload:r});else if(mi){console.warn(`controller not found but serviceWorker is available. messageId: ${i}, type: ${e}`);try{mi.postMessage({type:e,payload:r})}catch(t){console.log("Retrying again on catch service worker",t),mi.postMessage({type:e,payload:r})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${i}, type: ${e}`),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${i}, type: ${e}`),mi?(console.info("This is triggered "),null==mi||mi.postMessage({type:e,payload:t})):(console.log("not ready",e),clearInterval(c),a("Service worker not ready"))}),3e4);setTimeout((()=>{clearInterval(c),a(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",s)}),21e4)}else wi.push({message:{type:e,payload:r}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller,mi,e),"init"==e&&(clearInterval(c),n(null))}))}))}const Gi={GetLinkListener:e=>Ci(void 0,void 0,void 0,(function*(){const t=Ii.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>Ci(void 0,void 0,void 0,(function*(){if(mi){let t=new CustomEvent(e.id||"",e.data);dispatchEvent(t)}return{success:!0}})),checkInit:e=>Ci(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),mi=navigator.serviceWorker.controller),yield Ri(),{success:!0}}))};function _i(){return Ci(this,void 0,void 0,(function*(){yield(0,fo.A)();const e=(new Date).getTime();yield(0,i.A)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})).catch((e=>{throw e})),yield(0,po.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,uo.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,po.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,uo.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)})).catch((e=>{throw e}))}))}function bi(e,t={}){if(mi||"undefined"!=typeof window){let n=new CustomEvent(`${e}`,t);dispatchEvent(n)}else yo.x.postMessage({type:"dispatchEvent",payload:{id:e,data:t}})}function Bi(){return Ci(this,void 0,void 0,(function*(){console.log("message queue",wi);const e=wi.find((e=>{var t;return"init"==(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.type)}));if(e){console.log("Processing Init Queue poped",null==e?void 0:e.type,e);const t=wi.indexOf(e);t>-1&&wi.splice(t,1),yield Si(null==e?void 0:e.type,null==e?void 0:e.payload)}for(console.log("message queue while",wi);wi.length>0;){const{message:e,resolve:t,reject:n}=wi.shift();console.log("Queue poped",e.type,e),yield Si(e.type,e.payload)}}))}const xi=e=>{if(e instanceof j.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)};function Ri(){return Ci(this,void 0,void 0,(function*(){yield Si("init",{url:l.B.BASE_URL,aiurl:l.B.AI_URL,accessToken:vt.b.BearerAccessToken,nodeUrl:l.B.NODE_URL,enableAi:!1,applicationName:l.B.BASE_APPLICATION,flags:l.B.FLAGS})}))}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=n(2370),i=o.ADMIN,r=o.ALLID,c=o.AccessTracker,a=o.AddGhostConcept,s=o.Anomaly,l=o.BaseUrl,d=o.BinaryTree,h=o.BuildWidgetFromId,u=o.BuilderStatefulWidget,p=o.Composition,f=o.CompositionBinaryTree,y=o.CompositionNode,v=o.Concept,g=o.ConceptsData,m=o.Connection,C=o.ConnectionData,T=o.CreateComposition,I=o.CreateConnectionBetweenEntityLocal,w=o.CreateConnectionBetweenTwoConcepts,k=o.CreateConnectionBetweenTwoConceptsGeneral,N=o.CreateConnectionBetweenTwoConceptsLocal,A=o.CreateData,L=o.CreateDefaultConcept,S=o.CreateDefaultLConcept,G=o.CreateSession,_=o.CreateSessionVisit,b=o.CreateTheCompositionLocal,B=o.CreateTheCompositionWithCache,x=o.CreateTheConnection,R=o.CreateTheConnectionGeneral,E=o.CreateTheConnectionLocal,D=o.DATAID,F=o.DATAIDDATE,W=o.DelayFunctionExecution,U=o.DeleteConceptById,O=o.DeleteConceptLocal,M=o.DeleteConnectionById,P=o.DeleteConnectionByType,V=o.DeleteUser,j=o.DependencyObserver,$=o.FilterSearch,H=o.FormatFromConnections,J=o.FormatFromConnectionsAltered,q=o.FreeschemaQuery,z=o.FreeschemaQueryApi,Q=o.GetAllConnectionsOfComposition,X=o.GetAllConnectionsOfCompositionBulk,Y=o.GetAllTheConnectionsByTypeAndOfTheConcept,Z=o.GetComposition,K=o.GetCompositionBulk,ee=o.GetCompositionBulkWithDataId,te=o.GetCompositionFromConnectionsWithDataId,ne=o.GetCompositionFromConnectionsWithDataIdFromConnections,oe=o.GetCompositionFromConnectionsWithDataIdInObject,ie=o.GetCompositionFromConnectionsWithDataIdIndex,re=o.GetCompositionFromConnectionsWithIndex,ce=o.GetCompositionFromConnectionsWithIndexFromConnections,ae=o.GetCompositionFromMemoryWithConnections,se=o.GetCompositionList,le=o.GetCompositionListAll,de=o.GetCompositionListAllWithId,he=o.GetCompositionListListener,ue=o.GetCompositionListLocal,pe=o.GetCompositionListLocalWithId,fe=o.GetCompositionListWithId,ye=o.GetCompositionListWithIdUpdated,ve=o.GetCompositionListener,ge=o.GetCompositionLocal,me=o.GetCompositionLocalWithId,Ce=o.GetCompositionWithAllIds,Te=o.GetCompositionWithCache,Ie=o.GetCompositionWithDataIdBulk,we=o.GetCompositionWithDataIdWithCache,ke=o.GetCompositionWithId,Ne=o.GetCompositionWithIdAndDateFromMemory,Ae=o.GetConceptBulk,Le=o.GetConceptByCharacter,Se=o.GetConceptByCharacterAndCategoryLocal,Ge=o.GetConceptByCharacterAndType,_e=o.GetConnectionBetweenTwoConceptsLinker,be=o.GetConnectionBulk,Be=o.GetConnectionById,xe=o.GetConnectionDataPrefetch,Re=o.GetConnectionOfTheConcept,Ee=o.GetLink,De=o.GetLinkListListener,Fe=o.GetLinkListener,We=o.GetLinkRaw,Ue=o.GetLinkerConnectionFromConcepts,Oe=o.GetLinkerConnectionToConcepts,Me=o.GetRelation,Pe=o.GetRelationLocal,Ve=o.GetRelationRaw,je=o.GetTheConcept,$e=o.GetTheConceptLocal,He=o.GetUserGhostId,Je=o.JUSTDATA,qe=o.LConcept,ze=o.LConnection,Qe=o.LISTNORMAL,Xe=o.LocalConceptsData,Ye=o.LocalSyncData,Ze=o.LocalTransaction,Ke=o.Logger,et=o.LoginToBackend,tt=o.MakeTheInstanceConcept,nt=o.MakeTheInstanceConceptLocal,ot=o.MakeTheTimestamp,it=o.MakeTheTypeConcept,rt=o.MakeTheTypeConceptApi,ct=o.MakeTheTypeConceptLocal,at=o.NORMAL,st=o.PRIVATE,lt=o.PUBLIC,dt=o.PatcherStructure,ht=o.Prototype,ut=o.RAW,pt=o.RecursiveSearchApi,ft=o.RecursiveSearchApiNewRawFullLinker,yt=o.RecursiveSearchApiRaw,vt=o.RecursiveSearchApiRawFullLinker,gt=o.RecursiveSearchApiWithInternalConnections,mt=o.RecursiveSearchListener,Ct=o.SchemaQueryListener,Tt=o.SearchAllConcepts,It=o.SearchLinkInternal,wt=o.SearchLinkInternalAll,kt=o.SearchLinkMultipleAll,Nt=o.SearchLinkMultipleAllObservable,At=o.SearchLinkMultipleApi,Lt=o.SearchQuery,St=o.SearchStructure,Gt=o.SearchWithLinker,_t=o.SearchWithTypeAndLinker,bt=o.SearchWithTypeAndLinkerApi,Bt=o.SessionData,xt=o.Signin,Rt=o.Signup,Et=o.SignupEntity,Dt=o.SplitStrings,Ft=o.StatefulWidget,Wt=o.SyncData,Ut=o.TrashTheConcept,Ot=o.UpdateComposition,Mt=o.UpdateCompositionLocal,Pt=o.UserBinaryTree,Vt=o.Validator,jt=o.ViewInternalData,$t=o.ViewInternalDataApi,Ht=o.WidgetTree,Jt=o.convertFromConceptToLConcept,qt=o.convertFromLConceptToConcept,zt=o.convertWidgetTreeToWidget,Qt=o.convertWidgetTreeToWidgetWithWrapper,Xt=o.createFormFieldData,Yt=o.createPrototypeLocal,Zt=o.dispatchIdEvent,Kt=o.getFromDatabaseWithType,en=o.getObjectsFromIndexDb,tn=o.getWidgetBulkFromId,nn=o.getWidgetFromId,on=o.handleServiceWorkerException,rn=o.hasActivatedSW,cn=o.init,an=o.recursiveFetch,sn=o.recursiveFetchNew,ln=o.renderLatestWidget,dn=o.renderPage,hn=o.renderWidget,un=o.searchLinkMultipleListener,pn=o.sendEmail,fn=o.sendMessage,yn=o.serviceWorker,vn=o.setHasActivatedSW,gn=o.storeToDatabase,mn=o.subscribedListeners,Cn=o.unwrapContainers,Tn=o.updateAccessToken,In=o.uploadAttachment,wn=o.uploadFile,kn=o.uploadImage,Nn=o.validDocumentFormats,An=o.validImageFormats;export{i as ADMIN,r as ALLID,c as AccessTracker,a as AddGhostConcept,s as Anomaly,l as BaseUrl,d as BinaryTree,h as BuildWidgetFromId,u as BuilderStatefulWidget,p as Composition,f as CompositionBinaryTree,y as CompositionNode,v as Concept,g as ConceptsData,m as Connection,C as ConnectionData,T as CreateComposition,I as CreateConnectionBetweenEntityLocal,w as CreateConnectionBetweenTwoConcepts,k as CreateConnectionBetweenTwoConceptsGeneral,N as CreateConnectionBetweenTwoConceptsLocal,A as CreateData,L as CreateDefaultConcept,S as CreateDefaultLConcept,G as CreateSession,_ as CreateSessionVisit,b as CreateTheCompositionLocal,B as CreateTheCompositionWithCache,x as CreateTheConnection,R as CreateTheConnectionGeneral,E as CreateTheConnectionLocal,D as DATAID,F as DATAIDDATE,W as DelayFunctionExecution,U as DeleteConceptById,O as DeleteConceptLocal,M as DeleteConnectionById,P as DeleteConnectionByType,V as DeleteUser,j as DependencyObserver,$ as FilterSearch,H as FormatFromConnections,J as FormatFromConnectionsAltered,q as FreeschemaQuery,z as FreeschemaQueryApi,Q as GetAllConnectionsOfComposition,X as GetAllConnectionsOfCompositionBulk,Y as GetAllTheConnectionsByTypeAndOfTheConcept,Z as GetComposition,K as GetCompositionBulk,ee as GetCompositionBulkWithDataId,te as GetCompositionFromConnectionsWithDataId,ne as GetCompositionFromConnectionsWithDataIdFromConnections,oe as GetCompositionFromConnectionsWithDataIdInObject,ie as GetCompositionFromConnectionsWithDataIdIndex,re as GetCompositionFromConnectionsWithIndex,ce as GetCompositionFromConnectionsWithIndexFromConnections,ae as GetCompositionFromMemoryWithConnections,se as GetCompositionList,le as GetCompositionListAll,de as GetCompositionListAllWithId,he as GetCompositionListListener,ue as GetCompositionListLocal,pe as GetCompositionListLocalWithId,fe as GetCompositionListWithId,ye as GetCompositionListWithIdUpdated,ve as GetCompositionListener,ge as GetCompositionLocal,me as GetCompositionLocalWithId,Ce as GetCompositionWithAllIds,Te as GetCompositionWithCache,Ie as GetCompositionWithDataIdBulk,we as GetCompositionWithDataIdWithCache,ke as GetCompositionWithId,Ne as GetCompositionWithIdAndDateFromMemory,Ae as GetConceptBulk,Le as GetConceptByCharacter,Se as GetConceptByCharacterAndCategoryLocal,Ge as GetConceptByCharacterAndType,_e as GetConnectionBetweenTwoConceptsLinker,be as GetConnectionBulk,Be as GetConnectionById,xe as GetConnectionDataPrefetch,Re as GetConnectionOfTheConcept,Ee as GetLink,De as GetLinkListListener,Fe as GetLinkListener,We as GetLinkRaw,Ue as GetLinkerConnectionFromConcepts,Oe as GetLinkerConnectionToConcepts,Me as GetRelation,Pe as GetRelationLocal,Ve as GetRelationRaw,je as GetTheConcept,$e as GetTheConceptLocal,He as GetUserGhostId,Je as JUSTDATA,qe as LConcept,ze as LConnection,Qe as LISTNORMAL,Xe as LocalConceptsData,Ye as LocalSyncData,Ze as LocalTransaction,Ke as Logger,et as LoginToBackend,tt as MakeTheInstanceConcept,nt as MakeTheInstanceConceptLocal,ot as MakeTheTimestamp,it as MakeTheTypeConcept,rt as MakeTheTypeConceptApi,ct as MakeTheTypeConceptLocal,at as NORMAL,st as PRIVATE,lt as PUBLIC,dt as PatcherStructure,ht as Prototype,ut as RAW,pt as RecursiveSearchApi,ft as RecursiveSearchApiNewRawFullLinker,yt as RecursiveSearchApiRaw,vt as RecursiveSearchApiRawFullLinker,gt as RecursiveSearchApiWithInternalConnections,mt as RecursiveSearchListener,Ct as SchemaQueryListener,Tt as SearchAllConcepts,It as SearchLinkInternal,wt as SearchLinkInternalAll,kt as SearchLinkMultipleAll,Nt as SearchLinkMultipleAllObservable,At as SearchLinkMultipleApi,Lt as SearchQuery,St as SearchStructure,Gt as SearchWithLinker,_t as SearchWithTypeAndLinker,bt as SearchWithTypeAndLinkerApi,Bt as SessionData,xt as Signin,Rt as Signup,Et as SignupEntity,Dt as SplitStrings,Ft as StatefulWidget,Wt as SyncData,Ut as TrashTheConcept,Ot as UpdateComposition,Mt as UpdateCompositionLocal,Pt as UserBinaryTree,Vt as Validator,jt as ViewInternalData,$t as ViewInternalDataApi,Ht as WidgetTree,Jt as convertFromConceptToLConcept,qt as convertFromLConceptToConcept,zt as convertWidgetTreeToWidget,Qt as convertWidgetTreeToWidgetWithWrapper,Xt as createFormFieldData,Yt as createPrototypeLocal,Zt as dispatchIdEvent,Kt as getFromDatabaseWithType,en as getObjectsFromIndexDb,tn as getWidgetBulkFromId,nn as getWidgetFromId,on as handleServiceWorkerException,rn as hasActivatedSW,cn as init,an as recursiveFetch,sn as recursiveFetchNew,ln as renderLatestWidget,dn as renderPage,hn as renderWidget,un as searchLinkMultipleListener,pn as sendEmail,fn as sendMessage,yn as serviceWorker,vn as setHasActivatedSW,gn as storeToDatabase,mn as subscribedListeners,Cn as unwrapContainers,Tn as updateAccessToken,In as uploadAttachment,wn as uploadFile,kn as uploadImage,Nn as validDocumentFormats,An as validImageFormats};
|
|
1
|
+
var e={1735:(e,t,n)=>{n.d(t,{J:()=>a});var o,i=n(2370),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static incrementConcept(e){try{e&&(this.conceptsData[e]=(this.conceptsData[e]||0)+1)}catch(e){console.error("Failed on increment concept")}}static incrementConnection(e){try{e&&(this.connectionsData[e]=(this.connectionsData[e]||0)+1)}catch(e){console.error("Failed on increment connection")}}static getTopConcepts(e){return Object.entries(this.conceptsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static getTopConnections(e){return Object.entries(this.connectionsData).map((([e,t])=>[parseInt(e),t])).sort(((e,t)=>t[1]-e[1])).slice(0,e)}static saveDataToLocalStorage(){const e={concepts:this.conceptsData,connections:this.connectionsData};null===localStorage||void 0===localStorage||localStorage.setItem(this.accessData,JSON.stringify(e))}static loadDataFromLocalStorage(){const e=null===localStorage||void 0===localStorage?void 0:localStorage.getItem(this.accessData);if(e){const t=JSON.parse(e);this.conceptsData=t.concepts||{},this.connectionsData=t.connections||{}}}static sendToServer(){return c(this,void 0,void 0,(function*(){try{yield this.syncToServer()}catch(e){console.error("Failed to process Access Tracker Sync with Server")}}))}static syncToServer(){return c(this,void 0,void 0,(function*(){try{if(!Object.keys(this.conceptsData).length&&!Object.keys(this.connectionsData).length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.conceptsData&&Object.keys(this.conceptsData).length>0?this.conceptsData:{},n=this.connectionsData&&Object.keys(this.connectionsData).length>0?this.connectionsData:{},o=yield fetch(i.BaseUrl.PostPrefetchConceptConnections(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({concepts:t,connections:n})});if(!o.ok)throw new Error("Failed to sync data to the server.");yield o.json(),this.conceptsData={},this.connectionsData={},this.setNextSyncTime()}catch(e){console.error("Sync error:",e)}}))}static setNextSyncTime(){this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS}static startAutoSync(){setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&this.syncNow().catch(console.error)}),6e4)}static syncNow(){return c(this,void 0,void 0,(function*(){try{this.activateStatus?yield this.syncToServer():console.warn("Access Tracker inactive.")}catch(e){console.error("Error on sync access tracker")}}))}static GetSuggestedConcepts(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,n=new URL(i.BaseUrl.GetSuggestedConcepts());void 0!==e&&n.searchParams.append("top",e.toString());const o=yield fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const e=yield o.text();throw new Error(`Failed to load concepts: ${o.status} ${o.statusText}. Details: ${e}`)}const c=(yield o.json())||[];return yield this.addConceptToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested concepts:",e.message),new Error("Unable to fetch suggested concepts. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested concepts."))}}))}static GetSuggestedConnections(e){return c(this,void 0,void 0,(function*(){try{const t=r.b.BearerAccessToken,n=new URL(i.BaseUrl.GetSuggestedConnections());void 0!==e&&n.searchParams.append("top",e.toString());const o=yield fetch(n.toString(),{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}});if(!o.ok){const e=yield o.text();throw new Error(`Failed to load connections: ${o.status} ${o.statusText}. Details: ${e}`)}const c=(yield o.json())||[];return yield this.addConnectionToBinaryTree(c.data),c}catch(e){throw e instanceof Error?(console.error("Error fetching suggested Connections:",e.message),new Error("Unable to fetch suggested connections. Please try again later.")):(console.error("An unexpected error occurred:",e),new Error("An unexpected error occurred while fetching suggested Connections."))}}))}static addConceptToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConceptsData.AddConcept(e)}))}catch(e){console.error("Error on adding Concepts Data into tree")}}))}static addConnectionToBinaryTree(e){return c(this,void 0,void 0,(function*(){try{e.forEach((e=>{i.ConnectionData.AddConnection(e)}))}catch(e){console.error("Error on adding Connections Data into tree")}}))}}o=a,a.conceptsData={},a.connectionsData={},a.SYNC_INTERVAL_MS=12e4,a.nextSyncTime=Date.now(),a.activateStatus=!1,a.accessData="Access Data",o.startAutoSync()},1167:(e,t,n)=>{n.d(t,{Y:()=>s});var o=n(9581),i=n(3518),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,void 0,void 0,(function*(){const t=r.Logger.logfunction("CreateTheConceptApi",e);let n=(0,r.CreateDefaultConcept)();try{var a=(0,i.Xr)();const s=yield fetch(o.B.CreateTheConceptUrl(),{method:"POST",headers:a,body:JSON.stringify(e)});if(!s.ok)throw(0,c.ry)(s),new Error(`Error! status: ${s.status}`);return n=yield s.json(),r.Logger.logUpdate(t),n}catch(e){e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),(0,c.Mb)(e,o.B.CreateTheConceptUrl()),(0,c.ey)(t,"CreateTheConceptApi",e)}}))}},2:(e,t,n)=>{n.d(t,{s:()=>d});var o=n(8286),i=n(9581),r=n(1412),c=n(3518),a=n(1863),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=s.Logger.logfunction("GetAllConnectionsOfComposition",t);var i=[];if(0==(i=yield o.d.GetConnectionsOfConcept(e)).length)i=yield h(e);else{var c=yield h(e);(0,r.e)(c,i),i=c}return s.Logger.logUpdate(n),i}))}function h(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=s.Logger.logfunction("GetAllConnectionsOfCompositionOnline",t);var r=[];try{(0,c.Xr)("application/json");const t=new Headers,d=new FormData;d.append("composition_id",e.toString());const h=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:t,body:d});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!h.ok)throw(0,a.ry)(h),new Error(`Error! status: ${h.status}`);const u=yield h.json();for(var l=0;l<u.length;l++)o.d.AddConnection(u[l]),r.push(u[l]);return s.Logger.logUpdate(n),r}catch(e){e instanceof Error?console.log("Get all connection of composition error : ",e.message):console.log("Get all connection of composition error : ",e),(0,a.Mb)(e,i.B.GetAllConnectionsOfCompositionUrl()),(0,a.ey)(n,"GetAllConnectionsOfCompositionOnline",e)}}))}},8642:(e,t,n)=>{n.d(t,{Y:()=>u});var o=n(8286),i=n(9581),r=n(4364),c=n(5284),a=n(1412),s=n(3518),l=n(1863),d=n(2370),h=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function u(){var e=arguments;return h(this,arguments,void 0,(function*(t=[]){const n=d.Logger.logfunction("GetAllConnectionsOfCompositionBulk",e)||{};if(d.serviceWorker){n.serviceWorker=!0;try{const e=yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:t});return d.Logger.logUpdate(n),e.data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,l.ey)(n,"GetAllConnectionsOfCompositionBulk",e),(0,d.handleServiceWorkerException)(e)}}var u=[];if(t.length<=0)return u;var p=yield(0,c.B)(t),f=yield function(){var e=arguments;return h(this,arguments,void 0,(function*(t=[]){const n=d.Logger.logfunction("GetAllConnectionsOfCompositionOnline",e);var r=[];try{var c=(0,s.Xr)();const e=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:c,body:JSON.stringify(t)});if(e.ok){const t=yield e.json();for(var a=0;a<t.length;a++)o.d.AddConnection(t[a]),r.push(t[a])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.ry)(e);return d.Logger.logUpdate(n),r}catch(e){e instanceof Error?console.log("Get all connections of composition bulk error message: ",e.message):console.log("Get all connections of composition bulk unexpected error: ",e),(0,l.Mb)(e,i.B.GetAllConnectionsOfCompositionBulkUrl()),(0,l.ey)(n,"GetAllConnectionsOfCompositionOnline",e)}}))}(t);return u=f,(0,a.e)(u,p),yield(0,r.s)(u),d.Logger.logUpdate(n),u}))}},2803:(e,t,n)=>{n.d(t,{x:()=>s});var o=n(8286),i=n(9581),r=n(1863),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e,t,n){var s=arguments;return a(this,void 0,void 0,(function*(){const a=c.Logger.logfunction("GetCompositionConnectionsBetweenTwoConcepts",s)||{};var l=[];try{if(c.serviceWorker){a.serviceWorker=!0;try{const o=yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:n});return c.Logger.logUpdate(a),o.data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,r.ey)(a,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,c.handleServiceWorkerException)(e)}}var d=new FormData;d.append("ofConceptId",e.toString()),d.append("mainKey",n.toString()),d.append("toConceptId",t.toString());const s=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:d,redirect:"follow"});if(s.ok){const e=yield s.json();for(var h=0;h<e.length;h++)o.d.AddConnection(e[h]),l.push(e[h]);c.Logger.logUpdate(a)}else console.log("Get composition connection between two concepts",s.status),(0,r.ry)(s)}catch(e){e instanceof Error?console.log("Get composition connection between two concepts error message: ",e.message):console.log("Get composition connection between two concepts unexpected error: ",e),(0,r.Mb)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl()),(0,r.ey)(a,"GetCompositionConnectionsBetweenTwoConcepts",e)}return l}))}},7139:(e,t,n)=>{n.d(t,{r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(2370),a=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){var t=arguments;return s(this,void 0,void 0,(function*(){const n=c.Logger.logfunction("GetConcept",t)||{};try{if(c.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,c.sendMessage)("GetConcept",{id:e});return c.Logger.logUpdate(n),t.data}catch(e){console.error("GetConcept sw error: ",e),(0,a.ey)(n,"GetConcept",e),(0,c.handleServiceWorkerException)(e)}}let t=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return t;var s=yield o.I.GetConcept(e);let l=o.I.GetNpc(e);if(0!=s.id||l)return c.Logger.logUpdate(n),s;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const s=new FormData;s.append("id",e.toString());const l=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:s});return l.ok?(t=yield l.json(),t.id>0?o.I.AddConcept(t):o.I.AddNpc(e)):(console.log("Get the concept error",l.status),(0,a.ry)(l)),c.Logger.logUpdate(n),t}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,a.Mb)(e,i.B.GetConceptUrl()),(0,a.ey)(n,"GetConcept",e)}}))}},1239:(e,t,n)=>{n.d(t,{I:()=>d,r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){return s(this,void 0,void 0,(function*(){const t=a.Logger.logfunction("GetConceptBulk",[e.length])||{};let n=[],s=((new Date).getTime(),performance.now()),l=Array.from(new Set(e));try{if(a.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,a.sendMessage)("GetConceptBulk",{passedConcepts:e});return a.Logger.logUpdate(t),n.data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,c.ey)(t,"GetConceptBulk",e),(0,a.handleServiceWorkerException)(e)}}if(l.length>0){let d=[];for(let e=0;e<l.length;e++)0==(yield o.I.GetConcept(l[e])).id&&d.push(l[e]);if(0==d.length)return a.Logger.logfunction(t),n;{let l=(0,r.Xr)();const h=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:l,body:JSON.stringify(d)});if(h.ok){if(n=yield h.json(),n.length>0)for(let e=0;e<n.length;e++){let t=n[e];o.I.AddConcept(t)}console.log("added the concepts"),a.Logger.logUpdate(t)}else console.log("Get Concept Bulk error",h.status),a.Logger.logError(s,"unknown","read","unknown",void 0,h.status,h,"GetConceptBulk",[e],"unknown",void 0),(0,c.ry)(h)}}}catch(n){n instanceof Error?console.log("Get Concept Bulk error message: ",n.message):console.log("Get Concept Bulk unexpected error: ",n),a.Logger.logError(s,"unknown","read","unknown",void 0,500,n,"GetConceptBulk",[e],"unknown",void 0),(0,c.Mb)(n,i.B.GetConceptBulkUrl()),(0,c.ey)(t,"GetConceptBulk",n)}return n}))}function d(e){return s(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const n={"Content-Type":"application/json"};try{const r=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok){const e=yield r.json();if(e.length>0)for(let n=0;n<e.length;n++){const i=e[n];t.push(i),o.I.AddConcept(i)}}else console.log("bulk concept getter api error: ",r.status),(0,c.ry)(r)}catch(e){e instanceof Error?console.log("bulk concept getter api error: ",e.message):console.log("bulk concept getter api error: ",e),(0,c.Mb)(e,i.B.GetConceptBulkUrl())}}return t}))}},4402:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t){var n=arguments;return s(this,void 0,void 0,(function*(){const s=a.Logger.logfunction("GetConceptByCharacterAndType",n);try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,a.handleServiceWorkerException)(e)}let n=yield o.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==n||0==n.id){var l={character_value:`${e}`,type_id:t},d=JSON.stringify(l),h=(0,r.Xr)();const a=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:h,body:d});a.ok?(n=yield a.json(),o.I.AddConcept(n)):((0,c.ry)(a),console.log("This is the concept by type and character error",a.status))}return a.Logger.logUpdate(s),n}catch(e){e instanceof Error?console.log(" This is the concept by type and character error message: ",e.message):console.log(" This is the concept by type and character unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterAndTypeUrl()),(0,c.ey)(s,"GetConceptByCharacterAndType",e)}}))}},8146:(e,t,n)=>{n.d(t,{Y:()=>s});var o=n(9639),i=n(9581),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("GetConceptByCharacterValue",t);let a=(0,r.CreateDefaultConcept)();try{const t=new FormData;t.append("character_value",e);const s=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:t});s.ok?(a=yield s.json(),a.id>0&&o.I.AddConcept(a),r.Logger.logUpdate(n)):((0,c.ry)(s),console.log("Error in Getting concept by character value Error",s.status))}catch(e){e instanceof Error?console.log("Error in Getting concept by character value error message: ",e):console.log("Error in Getting concept by character value unexpected error: ",e),(0,c.Mb)(e,i.B.GetConceptByCharacterValueUrl()),(0,c.ey)(n,"GetConceptByCharacterValue",e)}return a}))}},7467:(e,t,n)=>{n.d(t,{j:()=>d});var o=n(8286),i=n(9581),r=n(4364),c=n(3518),a=n(1863),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){const t=s.Logger.logfunction("GetConnectionBulk",e.length)||{};let n=[];try{if(s.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("GetConnectionBulk",{connectionIds:e});return s.Logger.logUpdate(t),n.data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,a.ey)(t,"GetConnectionBulk",e),(0,s.handleServiceWorkerException)(e)}}if(e.length>0){let r=[];for(let t=0;t<e.length;t++){let i=yield o.d.GetConnection(e[t]);0==i.id?r.push(e[t]):n.push(i)}if(0==r.length)return s.Logger.logUpdate(t),n;{let e=(0,c.Xr)();const l=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(r)});if(l.ok){const e=yield l.json();if(e.length>0)for(let t=0;t<e.length;t++){let i=e[t];n.push(i),o.d.AddConnection(i)}}else(0,a.ey)(t,"GetConnectionBulk",l.status),(0,a.ry)(l),console.log("Get Connection Bulk error",l.status);s.Logger.logUpdate(t)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,a.ey)(t,"GetConnectionBulk",e),(0,a.Mb)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(n),n}))}},2832:(e,t,n)=>{n.d(t,{j:()=>s});var o=n(2370),i=n(9581),r=n(1863),c=n(3518),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,arguments,void 0,(function*(e,n=""){const a=o.Logger.logfunction("SearchLinkMultipleApi",t);let s=performance.now();var l=(0,c.ab)("application/json",n);const d=i.B.SearchLinkMultipleAllApiUrl(),h=JSON.stringify(e);try{const t=yield fetch(d,{method:"POST",headers:l,body:h});if(t.ok){let e=yield t.json();return o.Logger.logUpdate(a),e}return(0,r.ry)(t),console.log("This is the searching multiple error",t.status),o.Logger.logError(s,"unknown","search","unknown",void 0,t.status,t,"SearchLinkMultipleApi",[e,n],"unknown",void 0),[]}catch(t){console.log("This is the searching multiple error",t),o.Logger.logError(s,"unknown","search","unknown",void 0,500,t,"SearchLinkMultipleApi",[e,n],"unknown",void 0),(0,r.Mb)(t,d),(0,r.ey)(a,"SearchLinkMultipleApi",t)}}))}},3130:(e,t,n)=>{n.d(t,{BG:()=>s,SL:()=>l,XZ:()=>a,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>o});const o=1,i=2,r=3,c=4,a=5,s=6,l=7},9635:(e,t,n)=>{n.d(t,{x:()=>o});const o=new BroadcastChannel("Freeschema_mftsccs_browser_channel")},9581:(e,t,n)=>{n.d(t,{B:()=>o});class o{static setRandomizer(e){console.log("set randomizer",e),this.BASE_RANDOMIZER=e}static getRandomizer(){return this.BASE_RANDOMIZER}static GetConceptUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/getConcept":this.NODE_CACHE_URL+"/api/getConcept"}static GetConnectionUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get-connection-by-id":this.NODE_CACHE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get_concept_bulk":this.NODE_CACHE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return""===this.NODE_CACHE_URL.trim()?this.BASE_URL+"/api/get_connection_bulk":this.NODE_CACHE_URL+"/api/get_connection_bulk"}static GetAllConceptsOfUserUrl(){return this.BASE_URL+"/api/get_all_concepts_of_user"}static GetAllConnectionsOfUserUrl(){return this.BASE_URL+"/api/get_all_connections_of_user"}static GetAllConnectionsOfCompositionUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition"}static GetAllConnectionsOfCompositionBulkUrl(){return this.BASE_URL+"/api/get_all_connections_of_composition_bulk"}static GetConceptByCharacterValueUrl(){return this.BASE_URL+"/api/get_concept_by_character_value"}static GetConceptByCharacterAndTypeUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_type"}static GetConceptByCharacterAndCategoryUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category"}static GetConceptByCharacterAndCategoryDirectUrl(){return this.BASE_URL+"/api/get_concept_by_character_and_category_direct"}static GetCharacterByCharacterUrl(){return this.BASE_URL+"/api/get_character_by_character"}static GetAllConceptsByTypeUrl(){return this.BASE_URL+"/api/get_all_concepts_by_type"}static GetAllConnectionsOfConceptUrl(){return this.BASE_URL+"/api/get-link-connections"}static GetAllAiData(){return this.BASE_URL+"/api/get-preloaded-concepts"}static getMyCacheServer(){return this.NODE_URL+"/api/v1/cache-server"}static PostPrefetchConceptConnections(){return this.NODE_URL+"/api/v1/access-tracker/sync-access-tracker"}static GetSuggestedConcepts(){return this.NODE_URL+"/api/v1/access-tracker/list-concepts-file"}static GetSuggestedConnections(){return this.NODE_URL+"/api/v1/access-tracker/list-connections-file"}static PostLogger(){return this.LOG_SERVER+"/api/logger"}static GetAllPrefetchConnectionsUrl(){return this.BASE_URL+"/api/get_all_connections_of_user?inpage=500"}static GetAllLinkerConnectionOfConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-from-concept"}static GetAllLinkerConnectionToConceptUrl(){return this.BASE_URL+"/api/get-all-linkers-to-concept"}static DeleteConceptUrl(){return this.BASE_URL+"/api/delete_concept"}static DeleteUserUrl(){return this.BASE_URL+"/api/deleteuser"}static RecursiveSearchUrl(){return this.BASE_URL+"/api/recursivesearch-concept-connection"}static SearchLinkMultipleAllApiUrl(){return this.BASE_URL+"/api/Connection/search-link-multiple-all-ccs"}static MakeTheNameInBackendUrl(){return this.BASE_URL+"/api/make-name-from-frontend"}static SearchAllTypeWithLinker(e=!0){return e?this.BASE_URL+"/api/search-all-with-linker-ccs":this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static LoginUrl(){return this.BASE_URL+"/api/auth/login"}static SignupUrl(){return this.BASE_URL+"/api/auth/signup"}static GetCompositionConnectionBetweenTwoConceptsUrl(){return this.BASE_URL+"/api/get-composition-connection-between-two-concepts"}static SearchCompositionsUrl(){return this.BASE_URL+"/api/search-compositions"}static SearchLinkMultipleAll(){return this.BASE_URL+"/api/Connection/search-link-multiple-all"}static CreateSessionId(){return this.BASE_URL+"/api/create-session-id-remote"}static CreateSessionVisitUrl(){return this.BASE_URL+"/api/create-remote-session-visit"}static ViewInternalDataUrl(){return this.BASE_URL+"/api/view-api-internal-data-ccs-id-bulk"}static SearchInternalWithAuthenticatedCcsUrl(){return this.BASE_URL+"/api/search-composition-internal-authenticated-ccs"}static SearchInternalWithCcsUrl(){return this.BASE_URL+"/api-search-compositions-internal-clean-ccs"}static CreateGhostConceptApiUrl(){return o.NODE_URL+"/api/v1/local-concepts"}static CreateGhostConnectionApiUrl(){return o.NODE_URL+"/api/v1/local-connections"}static GetRealConceptById(){return o.NODE_URL+"/api/v1/local-concepts-translate"}static GetReservedIdUrl(){return this.BASE_URL+"/api/get_reserved_ids"}static GetReservedConnectionIdUrl(){return this.BASE_URL+"/api/get_reserved_connection_ids"}static CreateTheTextDataUrl(){return this.BASE_URL+"/api/create_text_data"}static CreateTheCharacterDataUrl(){return this.BASE_URL+"/api/create_character_data"}static CreateTheConceptUrl(){return this.BASE_URL+"/api/create_the_concept"}static CreateTheConnectionUrl(){return this.BASE_URL+"/api/create_the_connection"}static CreateTheConnectionNewUrl(){return this.BASE_URL+"/api/create_the_connection_new"}static MakeTheTypeConceptUrl(){return this.BASE_URL+"/api/make_the_type_concept"}static DeleteTheConnectionUrl(){return this.BASE_URL+"/api/delete_connection"}static FreeschemaQueryUrl(){return this.BASE_URL+"/api/freeschema-query"}static uploadImageUrl(){return this.BASE_URL+"/api/Image/UploadImage"}static uploadFileUrl(){return this.BASE_URL+"/api/Image/UploadFile"}static sendMail(){return this.BASE_URL+"/api/sendmail"}static sendBulkMail(){return this.BASE_URL+"/api/sendmail/bulk"}static getWidgetData(){return this.BASE_URL+"/api/get-widget"}static getLatestWidgetData(){return this.BASE_URL+"/api/get-latest-widget"}static getConnectionsByTypes(){return this.BASE_URL+"/api/get-connection-by-types"}static CreatePrototypeUrl(){return this.BASE_URL+"/api/create-prototype"}}o.BASE_URL="https://localhost:7053/",o.NODE_CACHE_URL="",o.AI_URL="https://ai.freeschema.com",o.MQTT_URL="192.168.1.249",o.NODE_URL="http://localhost:5001",o.LOG_SERVER="https://logdev.freeschema.com",o.BASE_APPLICATION="",o.FLAGS={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1},o.BASE_RANDOMIZER=999},6963:(e,t,n)=>{n.d(t,{f:()=>c});var o=n(205),i=n(6731),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isCharacterLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static addNodeToTree(e){return r(this,void 0,void 0,(function*(){return null==this.characterRoot?(this.characterRoot=e,this.characterRoot):(this.characterRoot=this.characterRoot.addCharacterNode(e,this.characterRoot,this.characterRoot.height),this.characterRoot)}))}static removeNodeByCharacter(e,t){return r(this,void 0,void 0,(function*(){this.characterRoot&&this.characterRoot.removeNodeWithVariants(this.characterRoot,e,t)}))}static countNumberOfNodes(){return this.characterRoot?this.characterRoot.countNodeBelow(this.characterRoot):0}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.b(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getNodeFromTreeUpdated(e){return this.characterRoot?this.characterRoot.getCharacterFromNode(e,this.characterRoot):this.characterRoot}static getCharacterAndTypeFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return r(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndCategory(e,t,this.characterRoot):this.characterRoot}))}static removeConceptCharacter(e){this.characterRoot&&(this.characterRoot=this.characterRoot.removeNode(this.characterRoot,e))}}c.characterRoot=null},2202:(e,t,n)=>{n.d(t,{W:()=>s});var o=n(6963),i=n(6731),r=n(205),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static addConceptToTree(e){let t=new i.b(e.id,e,null,null),n=new i.b(e.characterValue,e,null,null);o.f.addNodeToTree(n),this.addNodeToTree(t)}static getNodeFromTree(e){return a(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return a(this,void 0,void 0,(function*(){if(this.root){let t=new Event(`${e}`);console.log("this is the fired event after delete",t),(0,c.dispatchIdEvent)(e),this.root=this.root.removeNode(this.root,e)}}))}static getConceptListFromIds(e,t,n){return a(this,void 0,void 0,(function*(){this.root&&this.root.checkIfIdsInNode(this.root,e,t,n)}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}s.root=null},5457:(e,t,n)=>{n.d(t,{c:()=>s});var o=n(2370),i=n(7282),r=n(205);class c{constructor(e,t){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=null,this.rightNode=null,this.currentNode=null}addType(e,t,n){var o,i,r,a;if(null==e)return new c(t,n);if(t<e.key)e.leftNode=this.addType(e.leftNode,t,n);else{if(!(t>e.key))return e.value.push(n),e;e.rightNode=this.addType(e.rightNode,t,n)}e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1;const s=this.getBalanceFactor(e);return s>1&&t<(null===(o=e.leftNode)||void 0===o?void 0:o.key)?this.rightRotate(e):s<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):s>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):s<-1&&t<(null===(a=e.rightNode)||void 0===a?void 0:a.key)?(e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)):e}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.value.length>0)for(let t=0;t<e.value.length;t++)if(n==e.value[t])return e.value.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static addType(e){return a(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,o.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root):(new CustomEvent(`${e.key}`,{detail:e.value[0]}),(0,o.dispatchIdEvent)(e.key,{detail:e.value[0]}),this.root=this.root.addType(this.root,e.key,e.value[0]),this.root)}))}static addConceptToTree(e){if(0!=e.typeId){let t=new c(e.typeId,e.id);this.addType(t)}}static removeTypeConcept(e,t){this.root&&(this.root=this.root.removeNodeWithVariants(this.root,e,t))}static getNodeFromTreeNew(e){return this.root?this.root.getFromNode(e,this.root):this.root}static getTypeVariantsFromTreeNew(e){return a(this,void 0,void 0,(function*(){let t=this.getNodeFromTreeNew(e),n=[],i=[];if(t){n=t.value;for(let e=0;e<n.length;e++){let t=!1;for(let o=0;o<i.length;o++)i[o].id==n[e]&&(t=!0);t||i.push(yield(0,o.GetTheConcept)(n[e]))}}return i}))}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isTypeLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return a(this,void 0,void 0,(function*(){let n=[],o=yield this.getTypeVariantsFromTreeNew(e);console.log("these are all the concepts",o);for(let e=0;e<o.length;e++)o[e].userId==t&&n.push(o[e]);return n}))}static getTypeVariantsWithCharacterValueNew(e,t){return a(this,void 0,void 0,(function*(){let n=yield this.getTypeVariantsFromTreeNew(t);console.log("this is all the concepts for character",n);let o=(0,i.o)();for(let t=0;t<n.length;t++)n[t].characterValue==e&&(o=n[t]);return o}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}s.typeRoot=null,s.root=null},2615:(e,t,n)=>{n.d(t,{j:()=>i});var o=n(2370);class i{constructor(e,t,n,i,r,c,a,s=!1,l,d,h){this.count=0,this.typeCharacter="",this.referent=null,this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=o.BaseUrl.getRandomizer(),this.x=0,this.y=0,this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=i,this.referentId=r,this.characterValue=`${c}`,this.accessId=a,this.typeCharacter=h,this.type=null,this.isNew=s,this.entryTimeStamp=l,this.updatedTimeStamp=d}getType(){console.log(this.typeId)}}},9639:(e,t,n)=>{n.d(t,{I:()=>d});var o=n(3655),i=n(2202),r=n(6963),c=n(5457),a=n(7282),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{constructor(){this.name="conceptsArray"}static CheckContains(e){for(var t=!1,n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].id==e.id&&(t=!0);return t}static AddNpc(e){this.NPC.includes(e)||(this.NPC.length>10&&(this.NPC=[]),this.NPC.push(e))}static GetNpc(e){return!!this.NPC.includes(e)}static AddConceptToStorage(e){e.id>0&&(0,o.kH)("concept",e)}static GetConceptBulkData(e,t,n){return l(this,void 0,void 0,(function*(){yield i.W.getConceptListFromIds(e,t,n)}))}static AddConcept(e){if(s.serviceWorker)try{(0,s.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,s.handleServiceWorkerException)(e)}e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(i.W.addConceptToTree(e),c.c.addConceptToTree(e))}static AddConceptTemporary(e){var t=this.CheckContains(e);this.conceptDictionary[e.id]=e,t&&this.RemoveConcept(e),this.conceptsArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsArray.length;t++)this.conceptsArray[t].id==e.id&&this.conceptsArray.splice(t,1);(0,o.wh)("concept",e.id)}static GetConcept(e){return l(this,void 0,void 0,(function*(){if(s.serviceWorker)try{return(yield(0,s.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,s.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,a.o)();var t=(0,a.o)(),n=yield i.W.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return l(this,void 0,void 0,(function*(){var t=(0,a.o)(),n=r.f.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterUpdated(e){return l(this,void 0,void 0,(function*(){var t=(0,a.o)(),n=r.f.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return l(this,void 0,void 0,(function*(){return(0,a.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var n=(0,a.o)(),o=yield r.f.getCharacterAndCategoryFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptsByTypeId(e){let t=[];for(var n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].typeId==e&&t.push(this.conceptsArray[n]);return t}static GetConceptsByTypeIdAndUser(e,t){var n=arguments;return l(this,void 0,void 0,(function*(){if(s.Logger.logfunction("ConceptsData.GetConceptsByTypeIdAndUser",n),s.serviceWorker)try{return(yield(0,s.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,s.handleServiceWorkerException)(e)}let o=[];return o=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),o}))}static GetBinaryCharacterTree(){return r.f.characterRoot}getName(){return this.name}}d.conceptsArray=[],d.NPC=[],d.conceptDictionary=[]},2155:(e,t,n)=>{n.d(t,{N:()=>r});var o=n(7282),i=n(9581);class r{constructor(e=0,t,n,r,c,a,s){this.count=0,this.isTemp=!1,this.toUpdate=!1,this.applicationId=i.B.getRandomizer(),this.type=(0,o.o)(),this.ofConcept=(0,o.o)(),this.toConcept=(0,o.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.userId=r,this.typeId=c,this.ghostId=e,this.orderId=a,this.accessId=s,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,n)=>{n.d(t,{O:()=>a});var o=n(205),i=n(2370);class r{constructor(e,t,n,o){this.leftNode=null,this.rightNode=null,this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let n=!1;e.value.id==t.value.id&&(n=!0);for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}getMax(e,t){return e>t?e:t}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(e.key<t.key)t.leftNode=this.addNode(e,o,n);else{if(!(e.key>t.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}throw console.log("this is the error in right rotation",e,t),new Error("Cannot perform right rotation: left node is null.")}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=this.getMax(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=this.getMax(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}throw console.log("this is the error in left rotation",e,t),new Error("Cannot perform left rotation: right node is null.")}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){try{if(t)return e==t.key?(t.value.count?t.value.count++:t.value.count=1,t):e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t}catch(n){console.log("this is the exception",e,t,null==t?void 0:t.leftNode,null==t?void 0:t.rightNode)}return t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}checkIfIdsInNode(e,t,n,o){if(e){if(t.includes(e.key)){n.push(e.value);let o=t.indexOf(e.key);t.splice(o,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,n,o),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,n,o)}}traverse(e){let t=0;return e&&(t+=1,(null==e?void 0:e.leftNode)&&(t+=this.traverse(e.leftNode)),e.rightNode&&(t+=this.traverse(e.rightNode))),t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(new Event(`${e.value.ofTheConceptId}`),(0,i.dispatchIdEvent)(e.value.ofTheConceptId),null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static addNodeToTree(e){try{if(null==this.connectionroot)return this.connectionroot=e,this.connectionroot;this.connectionroot=this.connectionroot.addNode(e,this.connectionroot,this.connectionroot.height)}catch(e){throw console.log("This is the error in making the tree",e),e}}static addConnectionToTree(e){let t=new r(e.id,e,null,null);this.addNodeToTree(t)}static traverse(){var e;return null===(e=this.connectionroot)||void 0===e?void 0:e.traverse(this.connectionroot)}static waitForDataToLoad(){return c(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isConnectionLoaded)return e("done");setTimeout(a.checkFlag,1e3,e)}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return c(this,void 0,void 0,(function*(){try{return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}catch(t){console.log("this is the getNodeFromTree",e,this.connectionroot)}}))}static getConnectionListFromIds(e,t,n){return c(this,void 0,void 0,(function*(){this.connectionroot&&this.connectionroot.checkIfIdsInNode(this.connectionroot,e,t,n)}))}}a.connectionroot=null},991:(e,t,n)=>{n.d(t,{H:()=>a});var o=n(2370),i=n(3996);class r extends i.i{constructor(e,t,n,o){super(e,t,n,o),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(this.getBalanceFactor(t.leftNode)>=0)return this.rightRotate(t);if(this.getBalanceFactor(t.leftNode)<0)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(this.getBalanceFactor(t.rightNode)<=0)return this.leftRotate(t);if(this.getBalanceFactor(t.rightNode)>0)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class a{static CreateCompositionKey(e,t){return e}static GetConnectionByOfTheConceptAndTypeId(e,t){let n=this.CreateCompositionKey(e,t);if(this.node){let e=this.node.getFromNode(n,this.node);if(e)return e.value}return null}static addConnection(e){if(e.id>0){let t=this.CreateCompositionKey(e.ofTheConceptId,e.typeId);if(this.node){let n=this.node.getFromNode(t,this.node);if(n){let t=null==n?void 0:n.value;0==t.length&&(n.value=[]),t.includes(e.id)||t.push(e.id)}else{let n=[];n.push(e.id);let o=new r(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new r(t,n,null,null);this.addNodeToTree(o)}new Event(`${t}`)}else console.log("cannot insert key id with n 0 to the connection tree",e)}static addNodeToTree(e){return c(this,void 0,void 0,(function*(){return null==this.node?(this.node=e,(0,o.dispatchIdEvent)(e.key),this.node):(this.node=this.node.addNode(e,this.node,this.node.height),this.node)}))}static removeNodeFromTree(e){return c(this,void 0,void 0,(function*(){this.node&&(this.node=this.node.removeNode(this.node,e))}))}}a.node=null},3996:(e,t,n)=>{n.d(t,{i:()=>o});class o{constructor(e,t,n,o){this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},8286:(e,t,n)=>{n.d(t,{d:()=>f});var o=n(1735),i=n(2370),r=n(3655),c=n(1863),a=n(2155),s=n(5239),l=n(991),d=n(3996);class h extends d.i{constructor(e,t,n,o){super(e,t,n,o),this.key="",this.value=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}}class u{static CreateCompositionKey(e){return e}static addNodeToTree(e){return t=this,n=void 0,i=function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=e,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addNode(e,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{s(i.next(e))}catch(e){r(e)}}function a(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}s((i=i.apply(t,n||[])).next())}));var t,n,o,i}static addConnectionToTree(e){if(e.id>0){let t=this.CreateCompositionKey(e.typeId);if(this.connectionTypeRoot){let n=this.connectionTypeRoot.getFromNode(t,this.connectionTypeRoot);if(n){let t=null==n?void 0:n.value;0==t.length&&(n.value=[]),t.includes(e.id)||t.push(e.id)}else{let n=[];n.push(e.id);let o=new h(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new h(t,n,null,null);this.addNodeToTree(o)}}else console.log("cannot insert key id with n 0 to the connection tree",e)}static GetConnectionByOfTheConceptAndTypeId(e,t){let n=this.CreateCompositionKey(t);if(this.connectionTypeRoot){let e=this.connectionTypeRoot.getFromNode(n,this.connectionTypeRoot);if(e)return e.value}return null}}u.connectionTypeRoot=null;var p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class f{constructor(){this.name="Connection Array"}static CheckContains(e){let t=!1;for(let n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e.id&&(t=!0);return t}static AddConnectionToStorage(e){(0,r.kH)("connection",e)}static AddConnection(e){try{s.O.addConnectionToTree(e),u.addConnectionToTree(e),l.H.addConnection(e)}catch(e){throw console.log("this is the error in making the connection"),e}}static AddConnectionToMemory(e){e.isTemp||(s.O.addConnectionToTree(e),u.addConnectionToTree(e),l.H.addConnection(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&((0,r.wh)("connection",e.id),s.O.removeNodeFromTree(e.id),l.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){l.H.node}static GetConnectionByOfTheConceptAndType(e,t){return p(this,void 0,void 0,(function*(){try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionByOfTheConceptAndType",{ofTheConceptId:e,typeId:t})).data}catch(e){console.error("GetConnectionByOfTheConceptAndType sw error: ",e),(0,i.handleServiceWorkerException)(e)}return l.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){const n=i.Logger.logfunction("ConnectionData.GetConnectionByOfType",arguments);let o=u.GetConnectionByOfTheConceptAndTypeId(e,t);return o?(i.Logger.logUpdate(n),o):(i.Logger.logUpdate(n),[])}static GetConnectionTree(){return s.O.connectionroot}static GetConnectionTypeTree(){return u.connectionTypeRoot}static GetConnectionBulkData(e,t,n){return p(this,void 0,void 0,(function*(){yield s.O.getConnectionListFromIds(e,t,n)}))}static GetConnection(e){return p(this,void 0,void 0,(function*(){o.J.incrementConnection(e);let t=new a.N(0,0,0,0,0,0,0);try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnection",{id:e})).data}catch(e){console.error("GetConnection sw error: ",e),(0,i.handleServiceWorkerException)(e)}let n=yield s.O.getNodeFromTree(e);if(null==n?void 0:n.value){let e=n.value;e&&(t=e)}return t}catch(e){return console.log("this is the error in GetConnection",e),t}}))}static GetConnectionsOfCompositionLocal(e){var t=arguments;return p(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("ConnectionData.GetConnectionsOfCompositionLocal",t)||{};let o=[];try{if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,c.ey)(n,"GetConnectionsOfCompositionLocal",e),(0,i.handleServiceWorkerException)(e)}}let t=[];t=f.GetConnectionByOfType(e,e);for(let e=0;e<t.length;e++){let r=yield s.O.getNodeFromTree(t[e]);r&&o.push(r.value),i.Logger.logUpdate(n)}}catch(t){console.log("this is the error GetConnectionsOfCompositionLocal",e,o),(0,c.ey)(n,"ConnectionData.GetConnectionsOfCompositionLocal",t)}return o}))}static GetConnectionsOfConcept(e){return p(this,void 0,void 0,(function*(){let t=[],n=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfConcept",{id:e})).data}catch(e){console.error("GetConnectionsOfConcept sw error: ",e),(0,i.handleServiceWorkerException)(e)}t=yield f.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<t.length;e++){let o=yield s.O.getNodeFromTree(t[e]);o&&n.push(o.value)}return n}catch(e){return console.log("this is the error in GetConnectionsOfConcept",e),n}}))}getName(){return this.name}}f.connectionArray=[],f.connectionDictionary=[]},205:(e,t,n)=>{n.d(t,{B:()=>o});class o{}o.isTypeLoaded=!1,o.isCharacterLoaded=!1,o.isDataLoaded=!1,o.isLocalDataLoaded=!1,o.isLocalCharacterLoaded=!1,o.isLocalTypeLoaded=!1,o.isConnectionLoaded=!1,o.isConnectionTypeLoaded=!1,o.isLocalConnectionLoaded=!1},2515:(e,t,n)=>{n.d(t,{x:()=>o});class o{constructor(e,t,n,o){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;var n=!1;for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}addCharacterNode(e,t,n){if(""!=e.value.characterValue){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}updateNodeSyncStatus(e,t,n){if(n){if(e==n.key){let e=n.value;return e.isSynced=t,n.value=e,n}return e<n.key?this.updateNodeSyncStatus(e,t,n.leftNode):e>n.key?this.updateNodeSyncStatus(e,t,n.rightNode):n}return n}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.typeId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.typeId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndType(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndType(e,t,n.rightNode)}return null}return n}getFromNodeWithCharacterAndCategory(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.categoryId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.categoryId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.rightNode)}return null}return n}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var n=this.inOrderSuccessor(e.rightNode);return e.value=n.value,e.key=n.key,e.variants=n.variants,e.currentNode=n.currentNode,e.rightNode=this.removeNode(e.rightNode,n.key),e}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){var o=e.variants[0];if(o)return e.value=o.value,e.key=o.key,e.currentNode=o.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var i=this.inOrderSuccessor(e.rightNode);return e.value=i.value,e.key=i.key,e.variants=i.variants,e.currentNode=i.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,i.key,n),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},9736:(e,t,n)=>{n.d(t,{v:()=>C});var o=n(205),i=n(2515),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.id,e,null,null);new i.x(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static getCharacterAndTypeFromTree(e,t){return this.root?this.root.getFromNodeWithCharacterAndType(e,t,this.root):this.root}static updateSyncStatus(e){return this.root?this.root.updateNodeSyncStatus(e,!0,this.root):this.root}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null;var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalCharacterLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static addNodeToTree(e){return a(this,void 0,void 0,(function*(){return null==this.LocalCharacterRoot?(this.LocalCharacterRoot=e,this.LocalCharacterRoot):(this.LocalCharacterRoot=this.LocalCharacterRoot.addCharacterNode(e,this.LocalCharacterRoot,this.LocalCharacterRoot.height),this.LocalCharacterRoot)}))}static addConceptToTree(e){if(""!=e.characterValue){var t=new i.x(e.characterValue,e,null,null);this.addNodeToTree(t)}}static getNodeFromTree(e){return this.LocalCharacterRoot?this.LocalCharacterRoot.getCharacterFromNode(e,this.LocalCharacterRoot):this.LocalCharacterRoot}static getCharacterAndTypeFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static getCharacterAndCategoryFromTree(e,t){return a(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndCategory(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(e,t){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,e,t))}}s.LocalCharacterRoot=null;var l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{static addNodeToTree(e){return l(this,void 0,void 0,(function*(){return null==this.LocalTypeRoot?(this.LocalTypeRoot=e,this.LocalTypeRoot):(this.LocalTypeRoot=this.LocalTypeRoot.addTypeNode(e,this.LocalTypeRoot,this.LocalTypeRoot.height),this.LocalTypeRoot)}))}static addConceptToTree(e){if(0!=e.typeId){var t=new i.x(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeConceptType(e,t){this.LocalTypeRoot&&(this.LocalTypeRoot=this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,e,t))}static getNodeFromTree(e){return this.LocalTypeRoot?this.LocalTypeRoot.getFromNode(e,this.LocalTypeRoot):this.LocalTypeRoot}static getTypeVariantsFromTree(e){var t=this.getNodeFromTree(e),n=[];if(t){n.push(null==t?void 0:t.value);for(let e=0;e<t.variants.length;e++)n.push(t.variants[e].value);return n}}static waitForDataToLoad(){return l(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalTypeLoaded)return e("done");setTimeout(d.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return l(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(e);if(o){console.log("this is the node to type",o),o.value.userId!=t&&999!=o.value.userId||n.push(null==o?void 0:o.value);for(let e=0;e<o.variants.length;e++)o.variants[e].value.userId!=t&&999!=o.value.userId||n.push(o.variants[e].value)}return n}))}}d.LocalTypeRoot=null;var h=n(6416),u=n(9639),p=n(7820),f=n(4864),y=n(628),v=n(2370),g=n(3278),m=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class C{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&(c.addConceptToTree(e),s.addConceptToTree(e),d.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(c.removeNodeFromTree(e.ghostId),s.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId),p.G.addConceptToTree(e),u.I.AddConcept(e),(0,v.AddGhostConcept)(e,e.userId,g.b.sessionId))}static RemoveConcept(e){return m(this,void 0,void 0,(function*(){try{0!=e.id&&(c.removeNodeFromTree(e.ghostId),s.removeConceptType(e.characterValue,e.ghostId),d.removeConceptType(e.typeId,e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return m(this,void 0,void 0,(function*(){try{let t=yield C.GetConcept(e);0!=t.id&&(c.removeNodeFromTree(e),s.removeConceptType(t.characterValue,t.ghostId),d.removeConceptType(t.typeId,t.ghostId),y.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(c.addConceptToTree(e),s.addConceptToTree(e),d.addConceptToTree(e))}static GetConcept(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=yield c.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static UpdateConceptSyncStatus(e){return m(this,void 0,void 0,(function*(){c.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=yield p.G.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return m(this,void 0,void 0,(function*(){var t=(0,h.u)(),n=s.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return m(this,void 0,void 0,(function*(){var n=(0,h.u)(),o=yield s.getCharacterAndTypeFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptByCharacterAndCategoryLocal(e,t){return m(this,void 0,void 0,(function*(){var n=(0,h.u)(),o=yield s.getCharacterAndCategoryFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptsByTypeId(e){let t=[];for(var n=0;n<this.localconceptsArray.length;n++)this.localconceptsArray[n].typeId==e&&t.push(this.localconceptsArray[n]);return t}static GetConceptsByTypeIdAndUser(e,t){return m(this,void 0,void 0,(function*(){let n=[];return n=yield d.getTypeVariantsFromTreeWithUserId(e,t),n}))}static ClearData(){return m(this,void 0,void 0,(function*(){this.localconceptsArray=[],f.G.connectionArray=[]}))}getName(){return this.name}}C.localconceptsArray=[]},4864:(e,t,n)=>{n.d(t,{G:()=>s});var o=n(2155),i=n(8286),r=n(205),c=n(628),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{constructor(){this.name="Connection Array"}static CheckContains(e){for(var t=!1,n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e.id&&(t=!0);return t}static AddConnection(e){this.CheckContains(e)&&this.RemoveConnection(e),e.id,this.connectionArray.push(e)}static AddConnectionToMemory(e){this.CheckContains(e)&&this.RemoveConnection(e),this.connectionArray.push(e)}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e.id&&this.connectionArray.splice(t,1);e.id}static RemoveConnectionById(e){for(var t=0;t<this.connectionArray.length;t++)this.connectionArray[t].id==e&&this.connectionArray.splice(t,1);c.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&i.d.AddConnection(function(e){let t=new o.N(0,0,0,0,0,0,0);return t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.typeId=e.typeId,t.orderId=e.orderId,t.id=e.id,t}(e))}static GetConnection(e){var t;t=null;for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==e&&(t=this.connectionArray[n]);return t}static waitForDataToLoad(){return a(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isLocalConnectionLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return a(this,void 0,void 0,(function*(){var t=[];try{for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].typeId==e&&t.push(this.connectionArray[n]);return t}catch(e){return t}}))}static GetConnectionOfCompositionAndTypeLocal(e,t){return a(this,void 0,void 0,(function*(){var n=[];try{for(var o=0;o<this.connectionArray.length;o++)this.connectionArray[o].typeId==e&&this.connectionArray[o].ofTheConceptId==t&&n.push(this.connectionArray[o]);return n}catch(e){return n}}))}getName(){return this.name}}s.connectionArray=[],s.connectionDictionary=[]},7820:(e,t,n)=>{n.d(t,{G:()=>c});var o=n(205),i=n(2515),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addConceptToTree(e){var t=new i.x(e.ghostId,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return r(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(o.B.isLocalDataLoaded)return e("done");setTimeout(c.checkFlag,1e3,e)}static getNodeFromTree(e){return r(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return r(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}c.root=null},5257:(e,t,n)=>{n.d(t,{R:()=>c});var o=n(9003),i=n(3075),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{static AddConceptId(e){this.localId=e.value,(0,o.kH)("localid",e)}static getConceptId(){return r(this,void 0,void 0,(function*(){try{if(this.localId){if(this.ReservedLocalId.length<5){yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let n=this.localId-t;this.ReservedLocalId.push(n),e=n}this.AddConceptId({id:0,value:e})})).catch((e=>(console.log(" getid: cannot get the id from indexdb"),-Math.floor(1e8*Math.random()))));let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}{let e=this.ReservedLocalId[0];return this.ReservedLocalId.shift(),e}}return yield(0,i.EO)().then((()=>{let e=this.localId;for(let t=1;t<10;t++){let n=this.localId-t;this.ReservedLocalId.push(n),e=n}this.AddConceptId({id:0,value:e})})),this.getConceptId()}catch(e){return console.log(" getid: this is the eror in concept",e),-Math.floor(1e8*Math.random())}}))}static AddConnectionId(e){this.localConnectionId=e.value}static getConnectionId(){return r(this,void 0,void 0,(function*(){try{if(this.localConnectionId){if(this.ReservedConnectionId.length<5){yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let n=this.localConnectionId-t;this.ReservedConnectionId.push(n),e=n}})).catch((e=>(console.log("this is the new event",e),-Math.floor(1e8*Math.random()))));let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}{let e=this.ReservedConnectionId[0];return this.ReservedConnectionId.shift(),e}}return yield(0,i.xd)().then((()=>{let e=this.localConnectionId;for(let t=1;t<10;t++){let n=this.localConnectionId-t;this.ReservedConnectionId.push(n),e=n}this.AddConnectionId({id:1,value:e})})),this.getConnectionId()}catch(e){return-Math.floor(1e8*Math.random())}}))}}c.ReservedLocalId=[],c.ReservedConnectionId=[]},628:(e,t,n)=>{n.d(t,{H:()=>y});var o=n(9581),i=n(3278),r=n(2370),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const s=(e,t)=>a(void 0,void 0,void 0,(function*(){let n={concepts:[],connections:[]};try{const r=new Headers;let a={concepts:e,connections:t};r.set("Content-Type","application/json"),r.set("Authorization","Bearer "+i.b.BearerAccessToken),r.set("Accept","application/json"),r.set("Randomizer",o.B.getRandomizer().toString());const s=yield fetch(o.B.CreateGhostConceptApiUrl(),{method:"POST",headers:r,body:JSON.stringify(a)});if(!s.ok)throw(0,c.ry)(s),new Error(`Error! status: ${s.status}`);const l=yield s.json();return n.concepts=l.concepts,n.connections=l.connections,n}catch(e){throw e instanceof Error?console.log("Create the concept api error message: ",e.message):console.log("Create the concept api unexpected error: ",e),e}}));function l(e,t){const n=[];for(let o=0;o<e.length;o+=t){const i=e.slice(o,o+t);n.push(i)}return n}const d=(...e)=>a(void 0,[...e],void 0,(function*(e=[]){return yield Promise.all(e.map((e=>{let t=JSON.parse(JSON.stringify(e));return delete t.type,delete t.ofConcept,delete t.toConcept,t})))}));var h=n(9003),u=n(9736),p=n(4864),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class y{static CheckContains(e){for(var t=!1,n=0;n<this.conceptsSyncArray.length;n++)this.conceptsSyncArray[n].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,n=0;n<this.connectionSyncArray.length;n++)this.connectionSyncArray[n].id==e.id&&(t=!0);return t}static AddConcept(e){try{let t=!1;0!=y.CheckIfTheConceptIdExists(e.id,this.conceptsSyncArray).id&&(t=!0),t||this.conceptsSyncArray.push(e)}catch(e){throw e}}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static SyncDataOnline(e,t){return f(this,void 0,void 0,(function*(){let n=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,r.handleServiceWorkerException)(e)}let n=[],o=[];if(e&&this.transactionCollections.some((t=>t.id==e))){const t=this.transactionCollections.find((t=>t.id==e));if(this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e)),this.transactionCollections=this.transactionCollections.filter((e=>new Date(e.createdDate).getTime()>(new Date).getTime()-6048e5)),!t)return;n=t.data.concepts.slice(),o=t.data.connections.slice()}else Array.isArray(null==t?void 0:t.concepts)&&Array.isArray(null==t?void 0:t.connections)?(console.log("this is the concepts and connections array",null==t?void 0:t.concepts,null==t?void 0:t.connections),n=t.concepts.filter((e=>this.conceptsSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),o=t.connections.filter((e=>this.connectionSyncArray.some((t=>e.id==t.id||e.ghostId==t.ghostId)))).slice(),console.log("this is the concepts and connections array",n,o),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>e.id==t.id||e.ghostId==t.ghostId)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>e.id==t.id||e.ghostId==t.ghostId))))):(console.warn("Syncing this way has been Depreceted in service worker."),console.info("Only if serive worker is not running"),n=this.conceptsSyncArray.slice()||[],o=this.connectionSyncArray.slice()||[]);this.connectionSyncArray=[],this.conceptsSyncArray=[];let i=[];for(let e=0;e<n.length;e++)i.push(n[e]),yield u.v.UpdateConceptSyncStatus(n[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(o,i);let h=yield function(e,t){return a(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("CreateTheGhostConceptApi",[e.length,t.length]);try{const o=1e3;let i={concepts:[],connections:[]};const c=yield d(e),a=yield d(t);if(e.length+t.length<=2*o){const e=yield s(c,a);return Array.isArray(null==e?void 0:e.concepts)&&(i.concepts=[...i.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(i.connections=[...i.connections,...e.connections]),r.Logger.logUpdate(n),i}const h=l(c,o),u=l(a,o),p=[],f=[];for(let e=0;e<h.length;e++){const t=h[e];p.push(s(t,[]))}const y=yield Promise.all(p);for(let e=0;e<y.length;e++){const t=y[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}for(let e=0;e<u.length;e++){const t=u[e];f.push(s([],t))}const v=yield Promise.all(f);for(let e=0;e<v.length;e++){const t=v[e];Array.isArray(null==t?void 0:t.concepts)&&(i.concepts=[...i.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(i.connections=[...i.connections,...t.connections])}return r.Logger.logUpdate(n),i}catch(e){throw console.log(e),(0,c.ey)(n,"CreateTheGhostConceptApi",e),e}}))}(i,o),f=h.concepts,y=h.connections;for(let e=0;e<f.length;e++)u.v.AddPermanentConcept(f[e]);for(let e=0;e<y.length;e++)p.G.AddPermanentConnection(y[e]);return n}catch(e){throw r.Logger.logError(n,"unknown",void 0,"unknown",void 0,500,e,"SyncDataOnline",[],"unknown",void 0),e}}))}static ConvertGhostIdsInConnections(e){var t,n,o;for(let i=0;i<e.length;i++){let r=e[i].ofTheConceptId,c=e[i].toTheConceptId,a=e[i].typeId,s=null!==(t=y.ghostIdMap.get(r))&&void 0!==t?t:r,l=null!==(n=y.ghostIdMap.get(c))&&void 0!==n?n:c,d=null!==(o=y.ghostIdMap.get(a))&&void 0!==o?o:a;e[i].ofTheConceptId=s,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return f(this,void 0,void 0,(function*(){for(let n=0;n<e.length;n++){let o=e[n].ofTheConceptId,i=e[n].toTheConceptId,r=e[n].typeId;if(o<0){let i=this.CheckIfTheConceptIdExists(o,t);0==i.id&&(i=yield u.v.GetConceptByGhostId(o),0!=i.id?i.id!=i.ghostId&&(e[n].ofTheConceptId=i.id):(i=yield u.v.GetConcept(o),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let o=this.CheckIfTheConceptIdExists(i,t);0==o.id&&(o=yield u.v.GetConceptByGhostId(i),0!=o.id?o.id!=o.ghostId&&(e[n].toTheConceptId=o.id):(o=yield u.v.GetConcept(i),this.AddConceptIfDoesNotExist(o,t)))}if(r<0){let o=this.CheckIfTheConceptIdExists(r,t);0==o.id&&(o=yield u.v.GetConceptByGhostId(r),0!=o.id?o.id!=o.ghostId&&(e[n].typeId=o.id):(o=yield u.v.GetConcept(r),this.AddConceptIfDoesNotExist(o,t)))}}}))}static AddConceptIfDoesNotExist(e,t=[]){let n=!1;for(let o=0;o<t.length;o++)e.ghostId==t[o].ghostId&&(n=!0);n||t.push(e)}static CheckIfTheConceptIdExists(e,t=[]){let n=(0,r.CreateDefaultLConcept)();for(let o=0;o<t.length;o++)e!=t[o].ghostId&&e!=t[o].id||(n=t[o]);return n}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static RemoveConnectionById(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e&&this.connectionSyncArray.splice(t,1)}static syncDataLocalDb(){return f(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,h.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,h.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections.push({id:e,data:{concepts:[],connections:[]},createdDate:(new Date).toISOString()})}catch(e){console.log("error in initializeTransaction",e)}}))}static markTransactionActions(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,r.handleServiceWorkerException)(e)}this.transactionCollections=this.transactionCollections.map((n=>n.id==e?Object.assign(Object.assign({},n),{data:JSON.parse(JSON.stringify(t))}):n)),this.conceptsSyncArray=this.conceptsSyncArray.filter((e=>!t.concepts.some((t=>t.id==e.id||t.ghostId==e.id)))),this.connectionSyncArray=this.connectionSyncArray.filter((e=>!t.connections.some((t=>t.id==e.id||t.ghostId==e.id))))}catch(e){console.log("error in markTransactionActions",e)}}))}static rollbackTransaction(e,t){return f(this,void 0,void 0,(function*(){try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,r.handleServiceWorkerException)(e)}if(this.transactionCollections.some((t=>t.id==e)))return;this.transactionCollections=this.transactionCollections.filter((t=>t.id!=e))}catch(e){console.log("LocalSyncData, roll",e)}}))}}y.conceptsSyncArray=[],y.connectionSyncArray=[],y.ghostIdMap=new Map,y.transactionCollections=[]},6731:(e,t,n)=>{n.d(t,{b:()=>o});class o{constructor(e,t,n,o){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(e,t){return null==t?t=e:(e.value.typeId!=t.value.typeId&&(t.currentNode=this.addCurrentNode(e,t.currentNode)),t)}addCurrentNodeType(e,t){if(null==t)return e;let n=!1;for(let o=0;o<t.variants.length;o++)t.variants[o].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}checkIfIdsInNode(e,t,n,o){if(e){if(t.includes(e.key)){n.push(e.value);let o=t.indexOf(e.key);t.splice(o,1)}e.leftNode&&this.checkIfIdsInNode(e.leftNode,t,n,o),e.rightNode&&this.checkIfIdsInNode(e.rightNode,t,n,o)}}addCharacterNode(e,t,n){if(""!=e.value.characterValue){if(null==t)return e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,o,n);else{if(!(t.key<e.key))return t.key==e.key&&""!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),t;t.rightNode=this.addCharacterNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}addTypeNode(e,t,n){if(0!=e.value.typeId){if(null==t)return console.log("adding the type node to the tree",e),e;let o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,o,n);else{if(!(t.key<e.key))return console.log("adding the type node to the tree down",e),t.key==e.key&&0!=t.key&&t.value.id!=e.value.id&&t.addCurrentNodeType(e,t),console.log("adding the type node to the tree last",t),t;t.rightNode=this.addTypeNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key){return this.rightRotate(t)}if(e.key>t.leftNode.key){return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key){return this.leftRotate(t)}if(e.key<t.rightNode.key){return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}}}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}getCharacterFromNode(e,t){return t?e==t.key?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getCharacterFromNodeUpdated(e,t){var n;return t?e==t.key||51==(null===(n=t.value)||void 0===n?void 0:n.typeId)?t:e<t.key?this.getCharacterFromNode(e,t.leftNode):e>t.key?this.getCharacterFromNode(e,t.rightNode):t:t}getFromNodeWithCharacterAndType(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.typeId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.typeId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndType(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndType(e,t,n.rightNode)}return null}return n}getFromNodeWithCharacterAndCategory(e,t,n){if(e=`${e}`,n){if(e==n.key){if(e==n.value.characterValue&&t==n.value.categoryId)return n;for(let e=0;e<n.variants.length;e++)if(n.variants[e].value.categoryId==t)return n.variants[e]}else{if(e<n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.leftNode);if(e>n.key)return this.getFromNodeWithCharacterAndCategory(e,t,n.rightNode)}return null}return n}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNode(e.rightNode,t.key),e}}removeNodeWithVariants(e,t,n){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNodeWithVariants(e.leftNode,t,n),e;if(e.key<t)return e.rightNode=this.removeNodeWithVariants(e.rightNode,t,n),e;if(e.variants.length>0)if(e.value.id==n){let t=e.variants[0];if(t)return e.value=t.value,e.key=t.key,e.currentNode=t.currentNode,e.variants.splice(0,1),e}else for(let t=0;t<e.variants.length;t++)if(n==e.variants[t].value.id)return e.variants.splice(t,1),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}{let t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.variants=t.variants,e.currentNode=t.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,t.key,n),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}},5976:(e,t,n)=>{n.d(t,{p:()=>l,B:()=>s});var o=n(9581),i=n(3518),r=n(1863),c=n(2370),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s{static getId(){return a(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){var e,t,n,a,l=arguments;return e=this,t=void 0,a=function*(){const e=c.Logger.logfunction("GetReservedIds",l);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const n=yield fetch(o.B.GetReservedIdUrl(),{method:"GET",headers:t});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);const a=yield n.json();for(let e=0;e<a.length;e++)s.AddId(a[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved ids error message: ",t.message):console.log("get reserved ids unexpected error: ",t),(0,r.Mb)(t,o.B.GetReservedIdUrl()),(0,r.ey)(e,"GetReservedIds",t)}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}s.ids=[];class l{static getId(){return a(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){var e,t,n,a,s=arguments;return e=this,t=void 0,a=function*(){const e=c.Logger.logfunction("GetReservedConnectionIds",s);try{let t=(0,i.Xr)("application/x-www-form-urlencoded");const n=yield fetch(o.B.GetReservedConnectionIdUrl(),{method:"GET",headers:t});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);const a=yield n.json();for(let e=0;e<a.length;e++)l.AddId(a[e]);c.Logger.logUpdate(e)}catch(t){t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),(0,r.Mb)(t,o.B.GetReservedConnectionIdUrl()),(0,r.ey)(e,"GetReservedConnectionIds",t)}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{s(a.next(e))}catch(e){i(e)}}function c(e){try{s(a.throw(e))}catch(e){i(e)}}function s(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}s((a=a.apply(e,t||[])).next())}))}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}l.connectionIds=[]},7273:(e,t,n)=>{n.d(t,{z:()=>i});var o=n(9581);class i{constructor(e,t,n,i){this.url=o.B.BASE_URL,this.message=e,this.ok=t,this.status=n,this.data=i}getMessage(){return this.message}setMessage(e){return this.message=e,this}getStatus(){return this.status}setStatus(e){return this.status=e,this}getData(){return this.data}setData(e){return this.data=e,this}getOk(){return this.ok}setOk(e){return this.ok=e,this}getUrl(){return this.url}setUrl(e){return this.url=e,this}}},3278:(e,t,n)=>{n.d(t,{b:()=>o});class o{}o.BearerAccessToken="",o.sessionId=998},2299:(e,t,n)=>{n.d(t,{B:()=>o});class o{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}},442:(e,t,n)=>{n.d(t,{Y:()=>h});var o=n(1167),i=n(2155),r=n(9581),c=n(3518),a=n(1863),s=n(9639),l=n(8286),d=n(2370);class h{static CheckContains(e){for(var t=!1,n=0;n<this.conceptsSyncArray.length;n++)this.conceptsSyncArray[n].id==e.id&&(t=!0);return t}static SyncDataDelete(e){for(var t=0;t<this.conceptsSyncArray.length;t++)e==this.conceptsSyncArray[t].id&&this.conceptsSyncArray.splice(t,1);for(t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].ofTheConceptId!=e&&this.connectionSyncArray[t].toTheConceptId!=e&&this.connectionSyncArray[t].typeId!=e||this.connectionSyncArray.splice(t,1)}static CheckContainsConnection(e){for(var t=!1,n=0;n<this.connectionSyncArray.length;n++)this.connectionSyncArray[n].id==e.id&&(t=!0);return t}static AddConcept(e){this.conceptsSyncArray.push(e)}static RemoveConcept(e){for(var t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t].id==e.id&&this.conceptsSyncArray.splice(t,1)}static AddConnection(e){this.connectionSyncArray.push(e)}static RemoveConnection(e){for(var t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t].id==e.id&&this.connectionSyncArray.splice(t,1)}static SyncDataOnline(){return e=this,t=void 0,h=function*(){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,d.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)s.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)l.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,o.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,n=void 0,s=function*(){let t=new i.N(0,0,0,0,0,0,0);try{var n=(0,c.Xr)(),o=JSON.stringify(e);const i=yield fetch(r.B.CreateTheConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?yield i.json():(console.log("Create the connection error message: ",i.status),(0,a.ry)(i)),t}catch(e){throw e instanceof Error?console.log("Create the connection error message: ",e.message):console.log(" Create the connection unexpected error: ",e),e}},new((o=void 0)||(o=Promise))((function(e,i){function r(e){try{a(s.next(e))}catch(e){i(e)}}function c(e){try{a(s.throw(e))}catch(e){i(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(r,c)}a((s=s.apply(t,n||[])).next())}));var t,n,o,s}(e)}return"done"},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(h.next(e))}catch(e){i(e)}}function c(e){try{a(h.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}a((h=h.apply(e,t||[])).next())}));var e,t,n,h}}h.conceptsSyncArray=[],h.connectionSyncArray=[]},9003:(e,t,n)=>{n.d(t,{S5:()=>l,kH:()=>h,qI:()=>s});var o=n(1863),i=n(2370),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};let c=10;class a{}function s(e){const t=i.Logger.logfunction("openDatabase",arguments);return new Promise((function(n,r){a.db&&(i.Logger.logUpdate(t),n(a.db));let l=i.BaseUrl.BASE_URL+"_FreeSchemaLocal"+i.BaseUrl.BASE_APPLICATION;const h=indexedDB.open(l,c);h.onupgradeneeded=e=>{var t=e.target.result,o="localconcept",r="localconnection",a="localid";console.log("this is the version upgrade",c),t.objectStoreNames.contains(o)&&t.deleteObjectStore(o),t.objectStoreNames.contains(r)&&t.deleteObjectStore(r),t.objectStoreNames.contains(a)&&t.deleteObjectStore(a),t.objectStoreNames.contains(o)||(t.createObjectStore(o,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(r)||(t.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t.objectStoreNames.contains(a)||(t.createObjectStore(a,{keyPath:"id"}).transaction.oncomplete=e=>{d(a,{id:0,value:-100}),d(a,{id:1,value:-200}),d(a,{id:3,value:i.BaseUrl.getRandomizer()})}),n(t)},h.onerror=n=>{console.error("Why didn't you allow my web app to use IndexedDB?!",n),indexedDB.deleteDatabase(l),s(e),(0,o.ey)(t,"openDatabase",n),r(n)},h.onsuccess=function(e){var o=e.target;a.db=o.result,i.Logger.logUpdate(t),n(a.db)}}))}function l(e){var t=arguments;return r(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("getObjectsFromLocalIndexDb",t);return new Promise((function(t,r){s(e).then((o=>{var r=[],c=o.transaction(e,"readwrite").objectStore(e).getAll();c.onsuccess=()=>{const e=c.result;for(var o=0;o<e.length;o++)r.push(e[o]);i.Logger.logUpdate(n),t(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e};(0,o.ey)(n,"getObjectsFromLocalIndexDb",t),r(t)}))}))}))}function d(e,t){const n=i.Logger.logfunction("storeToDatabase",[e,"localindexdb"]);return new Promise((function(r,c){s(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).add(t);s.onsuccess=e=>{i.Logger.logUpdate(n),r(t)},s.onerror=i=>{let r={status:400,ok:!1,message:"Cannot store to the Local database "+e,data:i,body:t};(0,o.ey)(n,"storeToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e};(0,o.ey)(n,"storeToDatabase",t),c(t)}))}))}function h(e,t){const n=i.Logger.logfunction("UpdateToDatabase",arguments);return new Promise((function(r,c){s(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).put(t);s.onsuccess=e=>{i.Logger.logUpdate(n),r(t)},s.onerror=i=>{let r={status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:i,body:t};(0,o.ey)(n,"UpdateToDatabase",r),c(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e};(0,o.ey)(n,"UpdateToDatabase",t),c(t)}))}))}},3655:(e,t,n)=>{n.d(t,{El:()=>u,b8:()=>h,kH:()=>d,qI:()=>l,wh:()=>p});var o=n(2299),i=n(9581),r=n(2370),c=n(1863);let a=10;class s{}function l(e){const t=r.Logger.logfunction("openDatabase",[e,"indexdb"]);return new Promise((function(n,o){s.db&&(r.Logger.logUpdate(t),n(s.db));let d=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const h=indexedDB.open(d,a);console.log("this is the update version",a,h),h.onupgradeneeded=e=>{let o=e.target.result,i="concept",c="connection",s="settings";console.log("this is the version update for index",a),o.objectStoreNames.contains(i)&&o.deleteObjectStore(i),o.objectStoreNames.contains(c)&&o.deleteObjectStore(c),o.objectStoreNames.contains(s)&&o.deleteObjectStore(s),o.objectStoreNames.contains(i)||(o.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),o.objectStoreNames.contains(c)||(o.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),o.objectStoreNames.contains(s)||(o.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{}),r.Logger.logUpdate(t),n(o)},h.onerror=n=>{console.error("Why didn't you allow my web app to use IndexedDB?!",n),indexedDB.deleteDatabase(d),l(e),(0,c.ey)(t,"openDatabase",n),o(n)},h.onsuccess=function(e){let o=e.target;s.db=o.result,r.Logger.logUpdate(t),n(s.db)}}))}function d(e,t){const n=r.Logger.logfunction("UpdateToDatabase",[e,"indexdb"]);return new Promise((function(o,i){l(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).put(t);s.onsuccess=e=>{r.Logger.logUpdate(n),o(t)},s.onerror=o=>{let r={status:400,ok:!1,message:"Cannot Update to the database"+e,data:o,body:t};(0,c.ey)(n,"UpdateToDatabase",r),i(r)}})).catch((e=>{let t={status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e};(0,c.ey)(n,"UpdateToDatabase",t),i(t)}))}))}function h(){const e=r.Logger.logfunction("GetLastSettingsFromDatabase",["indexdb"]);return new Promise((function(t,n){let i="settings";l(i).then((a=>{let s=a.transaction(i,"readwrite").objectStore(i).getAll();s.onsuccess=()=>{let n=new o.B(!1),i=s.result;for(let e=0;e<i.length;e++)n=i[e];r.Logger.logUpdate(e),t(n)},s.onerror=t=>{(0,c.ey)(e,"GetLastSettingsFromDatabase",t),n(t)}})).catch((t=>{let o={status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:t};(0,c.ey)(e,"GetLastSettingsFromDatabase",o),n(o)}))}))}function u(e){const t=r.Logger.logfunction("AiUpdateFlag",["indexdb"]);return new Promise((function(n,o){let i="settings";l(i).then((a=>{const s=a.transaction(i,"readwrite").objectStore(i).put(e);s.onsuccess=o=>{r.Logger.logUpdate(t),n(e)},s.onerror=n=>{let i={status:400,ok:!1,message:"Cannot update AI flag",data:n,body:e};(0,c.ey)(t,"AiUpdateFlag",i),o(i)}})).catch((e=>{let n={status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e};(0,c.ey)(t,"AiUpdateFlag",n),o(n)}))}))}function p(e,t){const n=r.Logger.logfunction("removeFromDatabase",[e,"indexdb"]);return new Promise((function(o,i){l(e).then((a=>{const s=a.transaction(e,"readwrite").objectStore(e).delete(Number(t));s.onsuccess=function(e){r.Logger.logUpdate(n),o(t)},s.onerror=t=>{let o={status:400,ok:!1,message:"Cannot remove from the database"+e,data:t};(0,c.ey)(n,"removeFromDatabase",o),i(o)}})).catch((e=>{let o={status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t};(0,c.ey)(n,"removeFromDatabase",o),i(o)}))}))}},4485:(e,t,n)=>{function o(e=[],t){var n,o;let i=[],r=null===(n=t.type)||void 0===n?void 0:n.characterValue;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(e))for(let n=0;n<e.length;n++){let c=null===(o=e[n].type)||void 0===o?void 0:o.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),t.typeId!=e[n].typeId&&r!=c||i.push(e[n])}return i}function i(e=[],t){let n=[],o=t.typeCharacter;if((null==o?void 0:o.startsWith("the_"))||(o="the_"+o),Array.isArray(e))for(let i=0;i<e.length;i++){let r=e[i].typeCharacter;(null==r?void 0:r.startsWith("the_"))||(r="the_"+r),t.typeId!=e[i].typeId&&o!=r||n.push(e[i])}return n}function r(e=[],t){let n=[];if(Array.isArray(e)){const o=e.find((e=>e.toTheConceptId==t));o&&n.push(o);const i=e.find((e=>e.ofTheConceptId==t));i&&n.push(i)}return n}function c(e=[],t){let n=[];if(Array.isArray(e)){const o=e.find((e=>e.toTheConceptId==t));o&&n.push(o);const i=e.find((e=>e.ofTheConceptId==t));i&&n.push(i)}return n}n.d(t,{gt:()=>c,nm:()=>i,vo:()=>o,wS:()=>r}),n(2155),n(7282)},9934:(e,t,n)=>{function o(e,t){return-1===e.indexOf(t)&&e.push(t),e}n.d(t,{A:()=>o})},9700:(e,t,n)=>{n.d(t,{R:()=>d,V:()=>l});var o,i=n(2370),r=n(3278),c=n(1863),a=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class l{static startAutoSync(){this.autoSyncInterval?console.warn("Auto-sync is already running."):(this.nextSyncTime=Date.now()+this.SYNC_INTERVAL_MS,setInterval((()=>{const e=Date.now();this.nextSyncTime&&e>=this.nextSyncTime&&(this.nextSyncTime=e+this.SYNC_INTERVAL_MS,this.sendPackageLogsToServer(),this.sendApplicationLogsToServer())}),3e4))}static stopAutoSync(){null!==this.autoSyncInterval&&(clearInterval(this.autoSyncInterval),this.autoSyncInterval=null,this.nextSyncTime=null)}static setLogLevel(e){this.logLevel=e}static shouldLog(e){return this.LOG_LEVELS.indexOf(e)>=this.LOG_LEVELS.indexOf(this.logLevel)}static formatLogData(e,t,n){const o=Object.assign({timestamp:(new Date).toISOString(),level:e,message:t},n);return this.packageLogsData.push(o),"ERROR"==e&&(this.sendPackageLogsToServer(),this.sendApplicationLogsToServer()),o}static log(e,t,n){if(this.logPackageActivationStatus)try{this.formatLogData(e,t,n||null)}catch(e){console.error("Error on Logger Log : ",e)}}static logUpdate(e){var t;try{if(!this.logPackageActivationStatus)return{};if(!e)return{};const n=Date.now();e.startTime=null!==(t=e.startTime)&&void 0!==t?t:n;const o=n-e.startTime;e.responseTime=`${o} ms`,1==!e.serviceWorker&&(e.serviceWorker=!1)}catch(t){(0,c.ey)(e,"Logger.logUpdate",t)}}static logfunction(e,...t){if(!this.logPackageActivationStatus)return{};const n=Date.now();let o=t;const c=i.BaseUrl.getRandomizer(),a=r.b.sessionId;let s={startTime:n,functionName:e,functionParameters:o,requestFrom:i.BaseUrl.BASE_APPLICATION,sessionId:a,applicationId:c};return this.formatLogData("INFO","function called",s)}static logError(e,t,n,o,i,r,c,a,s,l,h){try{const u=d("SessionId"),p={startTime:e,userId:t,operationType:n,requestFrom:o,requestIP:i,responseStatus:r,responseTime:`${(performance.now()-e).toFixed(3)}ms`,responseSize:c?`${JSON.stringify(c).length}`:"0",sessionId:null==u?void 0:u.toString(),functionName:a,functionParameters:s,userAgent:l,conceptsUsed:h};this.formatLogData("ERROR",`Information logged for ${a}`,p)}catch(e){console.error("Error on logError")}}static logApplication(e,t,n){if(this.logApplicationActivationStatus)try{const o={timestamp:(new Date).toISOString(),level:e,message:t,data:n||null};this.applicationLogsData.push(o)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return s(this,void 0,void 0,(function*(){const e=this.applicationLogsData;try{if(0===e.length)return;this.applicationLogsData=[],r.b.BearerAccessToken;const t=50;let n=(0,a.Xr)(),o=0;for(;0!=e.length;){const r=e.slice(0,t),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:n,body:JSON.stringify({logType:this.appLogs,logData:r})});c.ok||(yield c.text()),e.splice(0,t),o+=t,o++}}catch(e){}}))}static sendPackageLogsToServer(){return s(this,void 0,void 0,(function*(){const e=this.packageLogsData;try{if(0===e.length)return;this.packageLogsData=[];const t=300;let n=0;for(;0!=e.length;){const o=e.slice(0,t);let r=(0,a.Xr)();const c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:r,body:JSON.stringify({logType:this.mftsccsBrowser,logData:o})});if(!c.ok)return void(yield c.text());e.splice(0,t),n++}}catch(e){}}))}static saveLogToLocalStorage(e,t){try{if(void 0===typeof localStorage)return void console.warn("Local Storage type undefined");{const n=JSON.parse((null===localStorage||void 0===localStorage?void 0:localStorage.getItem(e))||"[]");n.push(t),null===localStorage||void 0===localStorage||localStorage.setItem(e,JSON.stringify(n))}}catch(e){console.error("Error on saving log in localstorage"),this.log("ERROR","Error while saving log in local storage")}}static clearLogsFromLocalStorage(e){void 0!==typeof localStorage?null===localStorage||void 0===localStorage||localStorage.removeItem(e):console.warn("localStorage is not available")}}function d(e){try{let t=e+"=",n=decodeURIComponent(document.cookie).split(";");for(let e=0;e<n.length;e++){let o=n[e];for(;" "==o.charAt(0);)o=o.substring(1);if(0==o.indexOf(t))return o.substring(t.length,o.length)}return""}catch(e){return console.error("Error on getcookie"),""}}o=l,l.logLevel="INFO",l.packageLogsData=[],l.applicationLogsData=[],l.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],l.SYNC_INTERVAL_MS=6e4,l.nextSyncTime=null,l.appLogs="app",l.mftsccsBrowser="mftsccs",l.logApplicationActivationStatus=!1,l.logPackageActivationStatus=!1,l.autoSyncInterval=null,o.startAutoSync()},1412:(e,t,n)=>{function o(e=[],t=[]){}n.d(t,{e:()=>o})},5898:(e,t,n)=>{n.d(t,{w:()=>a,V:()=>s});var o=n(7139),i=n(2370);class r{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e=[]){let t=[];if(e.length>0)for(let n=0;n<e.length;n++){let o=l(e[n]);t.push(o)}return t}function s(e){var t=arguments;return c(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConnectionTypeForCount",t);let r={};for(let t=0;t<e.length;t++){let n=yield(0,o.r)(e[t].connectionTypeId);e[t].connectionType=n.characterValue,r[e[t].conceptId]=e[t]}return i.Logger.logUpdate(n),r}))}function l(e){const t=e.split("_");if(3===t.length){let e=new r;return e.conceptId=Number(t[0]),e.connectionTypeId=Number(t[1]),e.count=Number(t[2]),e}throw new Error("Input string must contain exactly three parts separated by underscores.")}},1863:(e,t,n)=>{n.d(t,{ER:()=>c,Mb:()=>a,ey:()=>s,ry:()=>r});var o=n(2370),i=n(7273);function r(e){if(o.Logger.log("ERROR",e.statusText,{code:e.status,data:e.statusText}),401==e.status||406==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new i.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function c(e,t={}){if(o.Logger.log("ERROR",t.statusText,{code:e.status,data:e.status}),401==e.status||406==e.status){let n=new i.z(t.statusText,!1,e.status,"");throw n.setUrl(e.url),n}if(500==e.status){let n=new i.z(t.statusText,!1,e.status,"");throw n.setUrl(e.url),n}}function a(e,t=""){if(o.Logger.log("ERROR",e.message,{code:e.status,data:e.stack}),e.status){let n=new i.z(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new i.z(e.message,!1,500,e.stack);throw n.setUrl(t),n}}function s(e,t,n){var o;try{if(!e)return void console.error(`Error in ${t}: logData is undefined`);const i=Date.now();e.startTime=null!==(o=e.startTime)&&void 0!==o?o:i,e.responseTime=i-e.startTime+" ms",e.level="ERROR",e.errorMessage=(null==n?void 0:n.message)||"Unknown error occurred",console.error(`Error in function ${t}:`,n)}catch(e){console.error("Failed to handle package function error:",e)}}},176:(e,t,n)=>{n.d(t,{F4:()=>c,P6:()=>s,dp:()=>a});var o=n(2155),i=n(7282),r=n(6416);function c(e){var t,n;const o=(0,r.u)();return o.id=e.id,o.ghostId=e.ghostId,o.userId=e.userId,o.accessId=e.accessId,o.categoryId=e.categoryId,o.characterValue=e.characterValue,o.entryTimeStamp=e.entryTimeStamp,o.typeId=e.typeId,o.type=e.type,o.isTemp=!1,o.typeCharacter=null!==(n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"",o}function a(e){const t=(0,i.o)();return t.id=e.id,t.ghostId=e.ghostId,t.userId=e.userId,t.accessId=e.accessId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.categoryId=e.categoryId,t}function s(e){const t=new o.N(0,0,0,0,0,0,0);return t.id=e.id,t.ghostId=e.ghostId,t.accessId=e.accessId,t.ofTheConceptId=e.ofTheConceptId,t.toTheConceptId=e.toTheConceptId,t.entryTimeStamp=e.entryTimeStamp,t.typeId=e.typeId,t.isTemp=!1,t}},5020:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(2370),i=n(9639),r=n(205),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(){return c(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];i.I.AddConceptToMemory(n)}r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0}catch(e){throw yield(0,o.DelayFunctionExecution)(2e3,a()),{message:"Cannot create Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7282:(e,t,n)=>{n.d(t,{o:()=>i});var o=n(2615);function i(){let e=new Date,t=new Date;return new o.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},1218:(e,t,n)=>{n.d(t,{A:()=>s});var o=n(2370),i=n(7282),r=n(1666),c=n(8407),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,arguments,void 0,(function*(e,t=null,n=null,a=null,l=null,d=null,h=null){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:a,userId:l,accessId:d,sessionInformationId:h})).data}catch(e){console.error("CreateTheComposition sw error: ",e),(0,o.handleServiceWorkerException)(e)}let u=null!=l?l:999,p=null!=d?d:4,f=null!=h?h:999,y=null!=a?a:0,v=(0,i.o)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=y,n=yield(0,c.A)(o,"",!0,u,p,f);v=n,t=n.id,y=n.id,yield s(e[o],n.id,n.userId,t,l,d,h)}else{let i=null!=t?t:999,a=null!=n?n:999,g=y,m=yield(0,c.A)(o,"",!0,u,p,f);v=m,yield(0,r.q)(i,a,m.id,g),yield s(e[o],m.id,m.userId,g,l,d,h)}else{let i=null!=t?t:999,a=null!=n?n:10267,s=y,l=yield(0,c.A)(o,e[o].toString(),!1,u,p,f);yield(0,r.q)(i,a,l.id,s)}return v}))}},2212:(e,t,n)=>{n.d(t,{Ay:()=>l,N:()=>d});var o=n(1167),i=n(2615),r=n(5976),c=n(442),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n,o,a,l,d){return s(this,void 0,void 0,(function*(){let s=yield r.B.getId(),h=new Date,u=new Date,p=new i.j(s,t,o,n,a,e,l,!0,h,u,d);return p.isTemp=!1,c.Y.AddConcept(p),p}))}function d(e,t,n,c,l,d,h){return s(this,void 0,void 0,(function*(){let s=yield r.B.getId(),u=new Date,p=new Date,f=new i.j(s,t,c,n,l,e,d,!1,u,p,h);return a.ConceptsData.AddConcept(f),(0,o.Y)([f]),f}))}},1666:(e,t,n)=>{n.d(t,{q:()=>c});var o=n(2155),i=n(442),r=n(1863);function c(e,t,n,c){var a=t,s=new o.N(0,e,n,a,c,1,4);if(e==n)return s.ofTheConceptId=0,s.toTheConceptId=1,s;try{s.isTemp=!0,s.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(s)}catch(e){(0,r.Mb)(e)}return s}},1838:(e,t,n)=>{n.d(t,{m:()=>h});var o=n(2370),i=n(9581),r=n(1863),c=n(3518),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},s=n(5239),l=n(4864),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function h(e){var t=arguments;return d(this,void 0,void 0,(function*(){const n=o.Logger.logfunction("DeleteConnectionById",t);if(o.serviceWorker)try{return(yield(0,o.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,o.handleServiceWorkerException)(e)}e>0?(yield function(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=o.Logger.logfunction("DeleteTheConnection",t);try{const t=new FormData;t.append("id",e.toString());let a=(0,c.BZ)();const s=yield fetch(i.B.DeleteTheConnectionUrl(),{method:"POST",headers:a,body:t,redirect:"follow"});o.Logger.logUpdate(n),s.ok||(console.log("Delete connection error status: ",s.status),(0,r.ry)(s))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,r.Mb)(e,i.B.DeleteTheConnectionUrl()),(0,r.ey)(n,"DeleteTheConnection",e)}}))}(e),s.O.removeNodeFromTree(e)):l.G.RemoveConnectionById(e),o.Logger.logUpdate(n)}))}},4364:(e,t,n)=>{n.d(t,{s:()=>c});var o=n(1239),i=n(2370),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){const t=i.Logger.logfunction("FindConceptsFromConnections",[e.length]);let n=[];if(e.length>0){for(let t=0;t<e.length;t++)n.includes(e[t].ofTheConceptId)||n.push(e[t].ofTheConceptId),n.includes(e[t].toTheConceptId)||n.push(e[t].toTheConceptId),n.includes(e[t].typeId)||n.push(e[t].typeId);yield(0,o.r)(n)}i.Logger.logUpdate(t)}))}},5284:(e,t,n)=>{n.d(t,{B:()=>a});var o=n(2370),i=n(8286),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(){return c(this,arguments,void 0,(function*(e=[]){const t=o.Logger.logfunction("FindConnectionsOfCompositionsBulkInMemory",[e.length])||{};let n=[];try{if(o.serviceWorker){t.serviceWorker=!0;try{const n=yield(0,o.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e});return o.Logger.logUpdate(t),n.data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),(0,o.handleServiceWorkerException)(e)}}for(let t=0;t<e.length;t++){let o=yield i.d.GetConnectionsOfConcept(e[t]);n.push(...o)}return o.Logger.logUpdate(t),n}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),(0,r.ey)(t,"FindConnectionsOfCompositionsBulkInMemory",e),n}}))}},8939:(e,t,n)=>{n.d(t,{$N:()=>I,$V:()=>u,Ez:()=>w,JA:()=>C,Mb:()=>y,Nj:()=>f,PT:()=>T,RW:()=>m,XI:()=>g,ay:()=>h,hL:()=>d,kx:()=>v,re:()=>p,yz:()=>k,zN:()=>L});var o=n(7139),i=n(2),r=n(9639),c=n(8286),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){return l(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,a.handleServiceWorkerException)(e)}let n=yield(0,i.s)(e);t.connectionList=n;for(let e=0;e<t.connectionList.length;e++)t.compositionList.includes(t.connectionList[e].ofTheConceptId)||t.compositionList.push(t.connectionList[e].ofTheConceptId);return t}catch(e){return console.error("GetCompositionById error: ",e),t}}))}function h(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield L(e,t,n);return a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,a}))}function u(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield L(e,t,n);a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=s.entryTimeStamp,d.data=a,d.id=e,d}))}function p(e,t,n){return l(this,void 0,void 0,(function*(){var i,c;let a={},s=yield r.I.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield(0,o.r)(e));let l=yield A(s,t,n);return a[null!==(c=null===(i=null==s?void 0:s.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,a}))}function f(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,a.handleServiceWorkerException)(e)}let c=[],s={};c=yield(0,i.s)(e);let l=[];for(let e=0;e<c.length;e++)l.includes(c[e].ofTheConceptId)||l.push(c[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield L(e,c,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function y(e){return l(this,void 0,void 0,(function*(){var t,n;let c=[],a={};c=yield(0,i.s)(e);let s=[];for(let e=0;e<c.length;e++)s.includes(c[e].ofTheConceptId)||s.push(c[e].ofTheConceptId);let l=yield r.I.GetConcept(e);0==l.id&&null!=e&&null!=e&&(l=yield(0,o.r)(e));let d=yield S(e,c,s);return a[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=d,a}))}function v(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield N(d,i,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function g(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield A(d,i,l);return s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,s}))}function m(e){var t=arguments;return l(this,void 0,void 0,(function*(){var n,i;const l=a.Logger.logfunction("GetCompositionWithIdFromMemory",t)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return a.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.ey)(l,"GetCompositionWithIdFromMemory",e),(0,a.handleServiceWorkerException)(e)}}let d={},h=[],u={};try{h=yield c.d.GetConnectionsOfCompositionLocal(e);let t=[];for(let e=0;e<h.length;e++)t.includes(h[e].ofTheConceptId)||t.push(h[e].ofTheConceptId);let a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let s=yield N(a,h,t);u[null!==(i=null===(n=null==a?void 0:a.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=s,d.created_at=a.entryTimeStamp,d.data=u,d.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e),(0,s.ey)(l,"GetCompositionWithIdFromMemory",t)}return a.Logger.logUpdate(l),d}))}function C(e,t){var n=arguments;return l(this,void 0,void 0,(function*(){var i,c;const l=a.Logger.logfunction("GetCompositionFromMemoryWithConnections",n)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const n=yield(0,a.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t});return a.Logger.logUpdate(l),n.data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,s.ey)(l,"GetCompositionFromMemoryWithConnections",e),(0,a.handleServiceWorkerException)(e)}}let d={},h=[];for(let e=0;e<t.length;e++)h.includes(t[e].ofTheConceptId)||h.push(t[e].ofTheConceptId);let u=yield r.I.GetConcept(e);0==u.id&&null!=e&&null!=e&&(u=yield(0,o.r)(e));let p=yield N(u,t,h);d[null!==(c=null===(i=null==u?void 0:u.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=p;let f={};return f.created_at=u.entryTimeStamp,f.data=d,f.id=e,a.Logger.logUpdate(l),f}))}function T(e,t){return l(this,void 0,void 0,(function*(){var n,i;const c=a.Logger.logfunction("GetCompositionWithIdFromMemoryFromConnection",[e])||{};if(a.serviceWorker){c.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithIdFromMemory",{id:e});return a.Logger.logUpdate(c),t.data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.ey)(c,"GetCompositionWithIdFromMemoryFromConnection",e),(0,a.handleServiceWorkerException)(e)}}let l={},d=[];for(let e=0;e<t.length;e++)d.includes(t[e].ofTheConceptId)||d.push(t[e].ofTheConceptId);let h=yield r.I.GetConcept(e);0==h.id&&null!=e&&null!=e&&(h=yield(0,o.r)(e));let u=yield N(h,t,d);l[null!==(i=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=u;let p={};return p.created_at=h.entryTimeStamp,p.data=l,p.id=e,a.Logger.logUpdate(c),p}))}function I(e){return l(this,void 0,void 0,(function*(){var t;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,a.handleServiceWorkerException)(e)}let n=[],i={};n=yield c.d.GetConnectionsOfCompositionLocal(e);let s=[];for(let e=0;e<n.length;e++)s.includes(n[e].ofTheConceptId)||s.push(n[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(console.log("this concept you cannot find ",e),d=yield(0,o.r)(e)),(new Date).getTime();let h=yield function(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,s,l,d,h,u;let p={},f=e.id,y=((new Date).getTime(),null!==(r=null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"");if(!n.includes(f)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(o.includes(f))return"";o.push(f);for(let e=0;e<t.length;e++){let n=yield(0,a.GetTheConcept)(t[e].ofTheConceptId),o=yield(0,a.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=n,t[e].toConcept=o;let i=n.id,r="the_",l=(null!==(s=null===(c=null==o?void 0:o.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"").replace(r,"");null!=p[i]&&null!=p[i]||(p[i]={}),p[i][l]=o.characterValue}let v={};for(let e=0;e<t.length;e++){let n=t[e].ofConcept,o=t[e].toConcept,i=null!==(d=null===(l=null==n?void 0:n.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"",r="the_",c=(null!==(u=null===(h=null==o?void 0:o.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"").replace(r,"");null!=v[n.id]&&null!=v[n.id]||(v[n.id]={});let a=v[n.id];null!=a[i]&&null!=a[i]||(a[i]={}),null!=p[t[e].ofTheConceptId]&&null!=p[t[e].toTheConceptId]?a[i][c]=p[o.id]:a[i][c]=o.characterValue}return v[e.id]}))}(d,n,s);null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=h;let u={};return u.created_at=d.entryTimeStamp,u.data=i,u.id=e,u}))}function w(e){return l(this,void 0,void 0,(function*(){var t,n;if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,a.handleServiceWorkerException)(e)}let i=[],s={};i=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||l.push(i[e].ofTheConceptId);let d=yield r.I.GetConcept(e);0==d.id&&null!=e&&null!=e&&(d=yield(0,o.r)(e));let h=yield L(e,i,l);s[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h;let u={};return u.data=s,u.id=e,u.created_at=d.entryTimeStamp,u}))}function k(e){var t=arguments;return l(this,void 0,void 0,(function*(){var n,c;const l=a.Logger.logfunction("GetCompositionWithId",t)||{};if(a.serviceWorker){l.serviceWorker=!0;try{const t=yield(0,a.sendMessage)("GetCompositionWithId",{id:e});return a.Logger.logUpdate(l),t.data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,s.ey)(l,"GetCompositionWithId",e),(0,a.handleServiceWorkerException)(e)}}let d=[],h={};d=yield(0,i.s)(e);let u=[];for(let e=0;e<d.length;e++)u.includes(d[e].ofTheConceptId)||u.push(d[e].ofTheConceptId);let p=yield r.I.GetConcept(e);0==p.id&&null!=e&&null!=e&&(p=yield(0,o.r)(e));let f=yield L(e,d,u);h[null!==(c=null===(n=null==p?void 0:p.type)||void 0===n?void 0:n.characterValue)&&void 0!==c?c:""]=f;let y={};return y.data=h,y.id=e,a.Logger.logUpdate(l),y}))}function N(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[],h=e.id;if(null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!n.includes(h))return null==e?void 0:e.characterValue;if(i.includes(h))return"";i.push(h);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==h)if(h!=t[e].toTheConceptId){let c=t[e].toTheConceptId,h=yield r.I.GetConcept(c);if(null!=h&&0!=h.id||null==c||null==c||(h=yield(0,o.r)(c)),0!=h.id&&null==(null==h?void 0:h.type)){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}let u="the_",p=(null!==(s=null===(a=null==h?void 0:h.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(u,"");if(isNaN(Number(p))){if(p){const e=yield N(h,t,n,i);l[p]=e}}else{const e=yield N(h,t,n,i);d[p]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,l;const d=a.Logger.logfunction("recursiveFetchConceptNormal",[e]);(new Date).getTime();let h={},u=[],p=e.id;if(h.id=p,null===(c=null==e?void 0:e.type)||void 0===c?void 0:c.characterValue,!n.includes(p))return null==e?void 0:e.characterValue;if(i.includes(p))return"";i.push(p);for(let e=0;e<t.length;e++)if(t[e].ofTheConceptId==p)if(p!=t[e].toTheConceptId){let c=t[e].toTheConceptId,a=yield r.I.GetConcept(c);if(null!=a&&0!=a.id||null==c||null==c||(a=yield(0,o.r)(c)),0!=a.id&&null==(null==a?void 0:a.type)){let e=a.typeId,t=yield r.I.GetConcept(e);a.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),a.type=t)}let d="the_",p=(null!==(l=null===(s=null==a?void 0:a.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"").replace(d,"");if(isNaN(Number(p))){if(p){const e=yield N(a,t,n,i);h[p]=e}}else{const e=yield N(a,t,n,i);u[p]=e,h=u}}else console.log("this is the faulty connection ",t[e]);return a.Logger.logUpdate(d),h}))}function L(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[];if(0==e)return null;let h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==h.type){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}if(null===(c=null==h?void 0:h.type)||void 0===c?void 0:c.characterValue,!n.includes(e))return null==h?void 0:h.characterValue;if(i.includes(e))return"";i.push(e);for(let c=0;c<t.length;c++)if((new Date).getTime(),t[c].ofTheConceptId==e)if(e!=t[c].toTheConceptId){let e=t[c].toTheConceptId,h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==(null==h?void 0:h.type)){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}let u="the_",p=(null!==(s=null===(a=null==h?void 0:h.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(u,"");if(isNaN(Number(p))){if(p){const o=yield L(e,t,n,i);l[p]=o}}else{const o=yield L(e,t,n,i);d[p]=o,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,i=[]){var c,a,s;let l={},d=[];if(0==e)return null;let h=yield r.I.GetConcept(e);if(null!=h&&0!=h.id||null==e||null==e||(h=yield(0,o.r)(e)),0!=h.id&&null==h.type){let e=h.typeId,t=yield r.I.GetConcept(e);h.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),h.type=t)}if(null===(c=null==h?void 0:h.type)||void 0===c?void 0:c.characterValue,!n.includes(e))return null==h?void 0:h.characterValue;if(i.includes(e))return"";i.push(e),l.id=e;for(let i=0;i<t.length;i++)if(t[i].ofTheConceptId==e){let e=t[i].toTheConceptId,c=yield r.I.GetConcept(e);if(null!=c&&0!=c.id||null==e||null==e||(c=yield(0,o.r)(e)),c&&null==(null==c?void 0:c.type)){let e=c.typeId,t=yield r.I.GetConcept(e);c.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,o.r)(e),c.type=t)}let h="the_",u=(null!==(s=null===(a=null==c?void 0:c.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"").replace(h,"");if(isNaN(Number(u))){if(u){const o=yield S(e,t,n);l[u]=o}}else{const o=yield S(e,t,n);d[u]=o,l=d}}return l}))}},6687:(e,t,n)=>{n.d(t,{D:()=>I,MT:()=>T,Nt:()=>f,QL:()=>g,as:()=>y,cw:()=>h,dF:()=>d,hG:()=>v,km:()=>p,nr:()=>C,p8:()=>u,rv:()=>m});var o=n(8642),i=n(7467),r=n(2370),c=n(1863),a=n(5284),s=n(8939),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){yield(0,o.Y)(e);let t=[];for(let n=0;n<e.length;n++){let o=yield(0,s.kx)(e[n]);t.push(o)}return t}))}function h(){return l(this,arguments,void 0,(function*(e=[]){yield(0,o.Y)(e);let t=[];for(let n=0;n<e.length;n++){let o=yield(0,s.RW)(e[n]);t.push(o)}return t}))}function u(){return l(this,arguments,void 0,(function*(e=[],t=[]){const n=r.Logger.logfunction("GetCompositionFromConnectionsWithDataId",[e])||{};if(r.serviceWorker){n.serviceWorker=!0;try{const o=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t});return r.Logger.logUpdate(n),o.data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,c.ey)(n,"GetCompositionFromConnectionsWithDataId",e),(0,r.handleServiceWorkerException)(e)}}let o=[];for(let t=0;t<e.length;t++){let n=yield(0,s.RW)(e[t]);o.push(n)}return r.Logger.logUpdate(n),o}))}function p(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdFromConnections",e)||{};if(r.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:t,connectionIds:n});return r.Logger.logUpdate(o),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataIdFromConnections",e),(0,r.handleServiceWorkerException)(e)}}let a=yield(0,i.j)(n),l=[];for(let e=0;e<t.length;e++){let n=yield(0,s.PT)(t[e],a);l.push(n)}return r.Logger.logUpdate(o),l}))}function f(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdIndex",e)||{};if(r.serviceWorker){o.serviceWorker=!0;try{const e=yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:t,connectionIds:n});return r.Logger.logUpdate(o),e.data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,c.ey)(o,"GetCompositionFromConnectionsWithDataIdIndex",e),(0,r.handleServiceWorkerException)(e)}}yield(0,i.j)(n),yield(0,a.B)(t);let l={};for(let e=0;e<t.length;e++){let n=yield(0,s.RW)(t[e]);l[t[e]]=n}return r.Logger.logUpdate(o),l}))}function y(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,a.B)(e);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.kx)(e[t]);n[e[t]]=o}return n}))}function v(){return l(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithIndexFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithIndexFromConnections error sw: ",e),(0,r.handleServiceWorkerException)(e)}let n=yield(0,i.j)(t),o=[];for(let t=0;t<e.length;t++){let i=yield(0,s.JA)(e[t],n);o[e[t]]=i}return o}))}function g(e){var t=arguments;return l(this,void 0,void 0,(function*(){const n=r.Logger.logfunction("GetConnectionDataPrefetch",t)||{};if(r.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e});return r.Logger.logUpdate(n),t.data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,c.ey)(n,"GetConnectionDataPrefetch",e),(0,r.handleServiceWorkerException)(e)}}let o=[],a=[],s={};for(let t=0;t<e.length;t++){let n=yield r.ConnectionData.GetConnection(e[t]);0==n.id?o.push(e[t]):a.push(n)}for(let t=0;t<o.length;t++)s[e[t]]=!1;let l=[],d=yield(0,i.j)(o);a=[...a,...d];for(let e=0;e<a.length;e++)l.push(a[e].ofTheConceptId),l.push(a[e].toTheConceptId),l.push(a[e].typeId);return yield(0,r.GetConceptBulk)(l),r.Logger.logUpdate(n),a}))}function m(){var e=arguments;return l(this,arguments,void 0,(function*(t=[],n=[]){const o=r.Logger.logfunction("GetCompositionFromConnectionsWithDataIdInObject",e);yield(0,i.j)(n);let c={};for(let e=0;e<t.length;e++){let n=yield(0,s.RW)(t[e]);c[t[e]]=n}return r.Logger.logUpdate(o),c}))}function C(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.$N)(e[t]);n[e[t]]=o}return n}))}function T(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.kx)(e[t]);n[e[t]]=o}return n}))}function I(){return l(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.XI)(e[t]);n[e[t]]=o,console.log("this is the normal data",e[t],o)}return n}))}},2013:(e,t,n)=>{n.d(t,{A:()=>s,w:()=>l});var o=n(8146),i=n(2370),r=n(9639),c=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConceptByCharacter",t)||{};if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,c.ey)(n,"GetConceptByCharacter",e),(0,i.handleServiceWorkerException)(e)}}let a=yield r.I.GetConceptByCharacter(e),s=`${e}`;return null!=a&&0!=(null==a?void 0:a.id)||!s||(yield(0,o.Y)(e),a=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==a.id&&(a=yield r.I.GetConceptByCharacter(e))),i.Logger.logUpdate(n),a}))}function l(e){var t=arguments;return a(this,void 0,void 0,(function*(){const n=i.Logger.logfunction("GetConceptByCharacterUpdated",t)||{};if(i.serviceWorker){n.serviceWorker=!0;try{const t=yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e});return i.Logger.logUpdate(n),t.data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,c.ey)(n,"GetConceptByCharacterUpdated",e),(0,i.handleServiceWorkerException)(e)}}let a=yield r.I.GetConceptByCharacter(e),s=`${e}`;return null!=a&&0!=(null==a?void 0:a.id)||!s||(yield(0,o.Y)(e),a=yield r.I.GetConceptByCharacter(e)),i.Logger.logUpdate(n),a}))}},7887:(e,t,n)=>{n.d(t,{a:()=>c,p:()=>a});var o=n(8286),i=n(4864),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)o.d.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}function a(){return r(this,void 0,void 0,(function*(){try{let e=[];if(Array.isArray(e))for(let t=0;t<e.length;t++)i.G.AddConnectionToMemory(e[t])}catch(e){throw{message:"Cannot create Local Connection Binary Tree Concept",ok:!1,status:400,data:e}}}))}},7876:(e,t,n)=>{n.d(t,{A:()=>d});var o=n(1735),i=n(7139),r=n(2370),c=n(9639),a=n(7282),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const l=new Map;function d(e){return s(this,arguments,void 0,(function*(e,t=999){let n=performance.now();if(o.J.activateStatus)try{o.J.incrementConcept(e)}catch(e){console.error("Error adding connection in access tracker"),r.Logger.log("ERROR","Error Adding Connection")}if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConcept",{id:e,userId:t})).data}catch(e){console.error("GetTheConcept sw error: ",e),(0,r.handleServiceWorkerException)(e)}let d=(0,a.o)();if(l.has(e))return l.get(e)||d;const h=(()=>s(this,void 0,void 0,(function*(){try{if(e<0)return yield r.LocalConceptsData.GetConceptByGhostId(e);if(d=yield c.I.GetConcept(e),(null==d||0==d.id)&&null!=e&&null!=e){let t=yield(0,i.r)(e);d=t}if(0!=d.id&&null==d.type&&null==(yield c.I.GetConcept(d.typeId))&&null!=d.typeId&&null!=d.typeId){let e=yield(0,i.r)(d.typeId);d.type=e}return d}catch(o){throw console.error("this is the error in the getting concept",o),r.Logger.logError(n,t,"read","unknown",void 0,500,o,"GetTheConcept",[e,t],"unknown",void 0),o}finally{l.delete(e)}})))();return l.set(e,h),h}))}},7869:(e,t,n)=>{n.d(t,{_:()=>y,A:()=>f});var o=n(9581),i=n(9639),r=n(1863),c=n(3518),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},l=n(2299);class d{}d.isUpdated=!1,d.isOnlineSync=!1;var h=n(3655),u=n(9003),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function f(){return p(this,arguments,void 0,(function*(e=!0){try{if(yield(0,h.qI)("concepts"),yield(0,u.qI)("concepts"),e){if((yield(0,h.b8)()).isOnlineSync)return!0;yield function(){return s(this,void 0,void 0,(function*(){const e=a.Logger.logfunction("GetAiData");try{const s=(new Date).getTime();var t=(0,c.ab)("application/x-www-form-urlencoded");const l=yield fetch(o.B.GetAllAiData(),{method:"GET",headers:t});l.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.ry)(l));const d=yield l.json();for(var n=0;n<d.length;n++)i.I.AddConcept(d[n]);y();let h=(new Date).getTime()-s;console.log("The time taken is ",h),a.Logger.logUpdate(e)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.Mb)(e,o.B.GetAllAiData())}}))}()}return!0}catch(e){let t={message:"cannot initlize the AI system",ok:!1,status:400,data:e};return console.log(t),!0}}))}function y(){return p(this,void 0,void 0,(function*(){d.isOnlineSync=!0;var e=new l.B(d.isOnlineSync);(0,h.El)(e)}))}},8095:(e,t,n)=>{n.d(t,{h:()=>a});var o=n(2370),i=n(9700),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n){var a=arguments;return c(this,arguments,void 0,(function*(e,t,n,c=!1,s={concepts:[],connections:[]}){var l,d,h,u,p,f;const y=i.V.logfunction("CreateConnectionBetweenTwoConceptsLocal",a)||{};let v=performance.now();try{if(o.serviceWorker){y.serviceWorker=!0;try{const r=yield(0,o.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:n,both:c,actions:s});return(null===(d=null===(l=null==r?void 0:r.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(s.concepts=JSON.parse(JSON.stringify(r.actions.concepts))),(null===(u=null===(h=null==r?void 0:r.actions)||void 0===h?void 0:h.connections)||void 0===u?void 0:u.length)&&(s.connections=JSON.parse(JSON.stringify(r.actions.connections))),i.V.logUpdate(y),r.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",e),(0,o.handleServiceWorkerException)(e)}}if(e.userId,c){let i=(null===(p=t.type)||void 0===p?void 0:p.characterValue)+"_s_"+n+"_by";var g=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,s);yield(0,o.CreateTheConnectionLocal)(t.id,e.id,g.id,1e3,void 0,void 0,s)}let a=(null===(f=e.type)||void 0===f?void 0:f.characterValue)+"_s_"+n+"_s";var m=yield(0,o.MakeTheInstanceConceptLocal)("connection",a,!1,999,999,999,void 0,s);let v=yield(0,o.CreateTheConnectionLocal)(e.id,t.id,m.id,1e3,void 0,void 0,s);return i.V.logUpdate(y),v}catch(o){throw i.V.logError(v,e.userId,"create",void 0,void 0,500,o,"CreateConnectionBetweenTwoConceptsLocal",[e,t,n,c],void 0,void 0),(0,r.ey)(y,"CreateConnectionBetweenTwoConceptsLocal",o),o}}))}},6416:(e,t,n)=>{n.d(t,{u:()=>i});var o=n(2615);function i(){let e=new Date,t=new Date;return new o.j(0,0,0,0,0,"0",0,!1,e,t,"0")}},3075:(e,t,n)=>{n.d(t,{Ay:()=>d,EO:()=>h,xd:()=>u});var o=n(205),i=n(9736),r=n(5257),c=n(9003),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(){return l(this,void 0,void 0,(function*(){const e=a.Logger.logfunction("CreateLocalBinaryTreeFromIndexDb");try{let t=[];if(Array.isArray(t))for(let e=0;e<t.length;e++){let n=t[e];i.v.AddConceptToMemory(n)}o.B.isLocalDataLoaded=!0,o.B.isLocalTypeLoaded=!0,o.B.isLocalCharacterLoaded=!0,a.Logger.logUpdate(e)}catch(t){yield(0,a.DelayFunctionExecution)(2e3,d());let n={message:"Cannot create local binary tree from index db",data:t,ok:!1,status:400};throw(0,s.ey)(e,"CreateLocalBinaryTreeFromIndexDb",t),n}}))}function h(){return l(this,void 0,void 0,(function*(){var e;const t=a.Logger.logfunction("PopulateTheLocalConceptsToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[0]){let t=e[0].value;if(t)r.R.AddConceptId(e[0]),yield(0,c.kH)("localid",{id:0,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},n={id:0,value:t-10};r.R.AddConceptId(e),yield(0,c.kH)("localid",n)}}e[2]}})))),a.Logger.logUpdate(t)}catch(e){let n={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,s.ey)(t,"PopulateTheLocalConceptsToMemory",e),n}}))}function u(){return l(this,void 0,void 0,(function*(){var e;const t=a.Logger.logfunction("PopulateTheLocalConnectionToMemory");try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>l(this,void 0,void 0,(function*(){let e=yield(0,c.S5)("localid");if(Array.isArray(e)){if(e[1]){let t=e[1].value;if(t)r.R.AddConnectionId(e[1]),yield(0,c.kH)("localid",{id:1,value:t-10});else{t=-Math.floor(1e8*Math.random());let e={id:0,value:t},n={id:0,value:t-10};r.R.AddConnectionId(e),yield(0,c.kH)("localid",n)}}e[2]}})))),a.Logger.logUpdate(t)}catch(e){let n={message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400};throw(0,s.ey)(t,"PopulateTheLocalConnectionToMemory",e),n}}))}},999:(e,t,n)=>{n.d(t,{R:()=>l});var o=n(2370),i=n(1863),r=n(6416),c=n(4711),a=n(5868),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,d=null,h=null,u=null,p=!1,f={concepts:[],connections:[]}){var y,v,g,m;const C=o.Logger.logfunction("CreateTheCompositionLocal")||{};if(o.serviceWorker){C.serviceWorker=!0;try{const i=yield(0,o.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,userId:d,accessId:h,sessionInformationId:u,actions:f});return(null===(v=null===(y=null==i?void 0:i.actions)||void 0===y?void 0:y.concepts)||void 0===v?void 0:v.length)&&(f.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(m=null===(g=null==i?void 0:i.actions)||void 0===g?void 0:g.connections)||void 0===m?void 0:m.length)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),o.Logger.logUpdate(C),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,i.ey)(C,"CreateTheCompositionLocal",e),(0,o.handleServiceWorkerException)(e)}}let T=null!=d?d:999,I=null!=h?h:999,w=null!=u?u:999,k=null!=s?s:0,N=(0,r.u)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=k,n=yield(0,a.k)(o,"",!0,T,I,w,void 0,f);N=n,t=n.id,k=n.id,yield l(e[o],n.id,n.userId,t,d,h,u,void 0,f)}else{let n=null!=t?t:999,i=k,r=yield(0,a.k)(o,"",!0,T,I,w,void 0,f);yield(0,c.F)(n,r.id,i,void 0,void 0,void 0,f),yield l(e[o],r.id,r.userId,i,d,h,u,void 0,f)}else{let n=null!=t?t:999,i=k,r=yield(0,a.k)(o,e[o].toString(),!1,T,I,w,void 0,f);yield(0,c.F)(n,r.id,i,void 0,void 0,void 0,f)}return o.Logger.logUpdate(C),N}))}},3077:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(2370),i=n(2615),r=n(9736),c=n(5257),a=n(9700),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n,l,d,h){return s(this,arguments,void 0,(function*(e,t,n,s,l,d,h=!1,u=0,p={concepts:[],connections:[]}){var f,y,v,g;let m=performance.now();try{if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateTheConceptLocal",{referent:e,typecharacter:t,userId:n,categoryId:s,typeId:l,accessId:d,isComposition:h,referentId:u});return(null===(y=null===(f=null==i?void 0:i.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(g=null===(v=null==i?void 0:i.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let a=yield c.R.getConceptId(),m=!0,C=new Date,T=new Date;if("the"==e)return new i.j(1,999,5,5,u,e,d,m,C,T,t);let I=new i.j(a,n,l,s,u,e,d,m,C,T,t);return I.isTemp=!0,I.isComposition=h,r.v.AddConcept(I),p.concepts.push(I),I}catch(o){throw a.V.logError(m,n,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,n,s,l,d,h],void 0),o}}))}},4711:(e,t,n)=>{n.d(t,{F:()=>l});var o=n(2155),i=n(4864),r=n(5257),c=n(9700),a=n(2370),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t,n){return s(this,arguments,void 0,(function*(e,t,n,s=1,l="",d=999,h={concepts:[],connections:[]}){var u,p,f,y;let v=performance.now();if(a.serviceWorker)try{const o=yield(0,a.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:n,orderId:s,typeString:l,userId:d,actions:h});return(null===(p=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===p?void 0:p.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===y?void 0:y.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.log("CreateTheConnectionLocal error sw: ",e),(0,a.handleServiceWorkerException)(e)}try{let c=4,u=yield r.R.getConnectionId(),p=0,f=0,y=0;p=e,f=t,y=n;let v=new o.N(0,0,0,0,0,0,0);return e!=t&&(v=new o.N(u,p,f,d,n,s,c),v.isTemp=!0,v.typeCharacter=l,a.LocalSyncData.AddConnection(v),i.G.AddConnection(v),h.connections.push(v)),v}catch(o){throw c.V.logError(v,d,"create","Unknown","Unknown",500,void 0,"CreateTheConnectionLocal",[e,t,n,s,l,d],"UnknownUserAgent",[]),o}}))}},8064:(e,t,n)=>{n.d(t,{$I:()=>a,Ay:()=>c});var o=n(9736),i=(n(9581),n(3518),n(2370));n(1863);var r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function c(e){return r(this,void 0,void 0,(function*(){return yield o.v.GetConceptByCharacterAndTypeLocal(e,51)}))}function a(e){return r(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterAndCategoryLocal",{character:e})).data}catch(e){console.error("GetConceptByCharacterAndCategoryLocal error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=(0,i.CreateDefaultLConcept)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=(0,i.SplitStrings)(e);if(n.length>1){let i=1,c=yield a(n[0]);0!=c.id&&(i=c.id),t=yield function(e,t){return r(this,void 0,void 0,(function*(){return o.v.GetConceptByCharacterAndCategoryLocal(e,t)}))}(e,i)}else n[0]==e&&(t=yield c(e));return t}))}},1213:(e,t,n)=>{n.d(t,{f:()=>s});var o=n(9736),i=n(7820),r=n(2370),c=n(176),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function s(e){return a(this,void 0,void 0,(function*(){let t=performance.now();try{if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetTheConceptLocal",{id:e})).data}catch(e){console.error("GetTheConceptLocal error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=(0,r.CreateDefaultLConcept)();if(e<0){if(t=yield o.v.GetConcept(e),0==t.id){let n=yield i.G.getNodeFromTree(e);if(null==n?void 0:n.value){let e=n.value;e&&(t=e)}}}else{let n=yield(0,r.GetTheConcept)(e);t=(0,c.F4)(n)}return t}catch(n){throw r.Logger.logError(t,"unknown","read","unknown",void 0,200,void 0,"GetTheConceptLocal",[e],"unknown",void 0),n}}))}},9975:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(2370),i=n(9736),r=n(3077),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n,a,s){return c(this,arguments,void 0,(function*(e,t,n,c,a,s={concepts:[],connections:[]}){var l,d,h,u;if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("MakeTheConceptLocal",{referent:e,typeCharacter:t,userId:n,categoryId:c,typeId:a,actions:s});return(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.concepts)||void 0===d?void 0:d.length)&&(s.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(u=null===(h=null==i?void 0:i.actions)||void 0===h?void 0:h.connections)||void 0===u?void 0:u.length)&&(s.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let p=yield i.v.GetConceptByCharacterAndTypeLocal(e,a),f=p;return"the"==t&&(c=1),0==f.id&&(p=yield(0,r.A)(e,t,n,c,a,4,void 0,void 0,s),f=p),f}))}},5868:(e,t,n)=>{n.d(t,{k:()=>l});var o=n(3077),i=n(8357),r=n(9736),c=n(2370),a=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function l(e,t){var n=arguments;return s(this,arguments,void 0,(function*(e,t,s=!1,l,d,h=999,u=0,p={concepts:[],connections:[]}){var f,y,v,g;const m=c.Logger.logfunction("MakeTheInstanceConceptLocal",n)||{};if(c.serviceWorker){m.serviceWorker=!0;try{const n=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:s,userId:l,accessId:d,sessionInformationId:h,referentId:u,actions:p});return(null===(y=null===(f=null==n?void 0:n.actions)||void 0===f?void 0:f.concepts)||void 0===y?void 0:y.length)&&(p.concepts=JSON.parse(JSON.stringify(n.actions.concepts))),(null===(g=null===(v=null==n?void 0:n.actions)||void 0===v?void 0:v.connections)||void 0===g?void 0:g.length)&&(p.connections=JSON.parse(JSON.stringify(n.actions.connections))),c.Logger.logUpdate(m),n.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,a.ey)(m,"MakeTheInstanceConceptLocal",e),(0,c.handleServiceWorkerException)(e)}}try{let n,a,d=999,h=4,f=l,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,s)n=yield(0,i.$)(e,d,l,l,p),a=yield(0,o.A)(t,e,l,h,n.id,y,!0,u,p);else if(g>255)n=yield(0,i.$)(v,d,f,l,p),a=yield(0,o.A)(t,v,l,h,n.id,y,void 0,void 0,p);else{n=yield(0,i.$)(v,d,f,l,p);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,n.id);a=e,0==e.id&&0==e.userId&&(a=yield(0,o.A)(t,v,l,h,n.id,y,void 0,void 0,p))}return a.type=n,c.LocalSyncData.AddConcept(a),p.concepts.push(a),c.Logger.logUpdate(m),a}catch(e){throw(0,a.ey)(m,"MakeTheInstanceConceptLocal",e),e}}))}},8357:(e,t,n)=>{n.d(t,{$:()=>d});var o=n(3077),i=n(8064),r=n(6467),c=n(9975),a=n(2370),s=n(1863),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e,t,n,h){var u=arguments;return l(this,arguments,void 0,(function*(e,t,n,l,h={concepts:[],connections:[]}){var p,f,y,v;const g=a.Logger.logfunction("MakeTheTypeConceptLocal",u)||{};if(a.serviceWorker){g.serviceWorker=!0;try{const o=yield(0,a.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:n,userId:l,actions:h});return(null===(f=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(v=null===(y=null==o?void 0:o.actions)||void 0===y?void 0:y.connections)||void 0===v?void 0:v.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),a.Logger.logUpdate(g),o.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,s.ey)(g,"MakeTheTypeConceptLocal",e),(0,a.handleServiceWorkerException)(e)}}let m=yield(0,i.$I)(e);if(m&&(0==m.id||0==m.userId)){let i=(0,r.f)(e);if(i[0]==e)m=yield(0,c.A)(e,"the",l,1,51,h);else{let r=yield d(i[0],t,n,l,h),c=yield d(i[1],t,n,l,h);m=yield(0,o.A)(e,i[1],l,r.id,c.id,4,void 0,void 0,h)}}return a.Logger.logUpdate(g),m}))}},3729:(e,t,n)=>{n.d(t,{D:()=>p});var o=n(9934),i=n(4485),r=n(2),c=n(7876),a=n(1838),s=n(999),l=n(5868),d=n(2370),h=n(176),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function p(e){return u(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var n,u,p,f;if(performance.now(),d.serviceWorker)try{const o=yield(0,d.sendMessage)("UpdateCompositionLocal",{patcherStructure:e,actions:t});return(null===(u=null===(n=null==o?void 0:o.actions)||void 0===n?void 0:n.concepts)||void 0===u?void 0:u.length)&&(t.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(f=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.connections)||void 0===f?void 0:f.length)&&(t.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("UpdateCompositionLocal error sw: ",e),(0,d.handleServiceWorkerException)(e)}const y=e.userId,v=e.sessionId,g=e.accessId;let m=[];const C=[];let T=(0,d.CreateDefaultLConcept)(),I=(0,d.CreateDefaultLConcept)();const w=[],k=e.compositionId,N=e.ofTheCompositionId;let A=[],L=yield(0,r.s)(k);for(let e=0;e<L.length;e++)m.push((0,h.P6)(L[e]));const S=[],G=[];let _=[];for(let e=0;e<m.length;e++)(0,o.A)(G,m[e].ofTheConceptId),(0,o.A)(S,m[e].ofTheConceptId),(0,o.A)(S,m[e].toTheConceptId),_.push(m[e].ofTheConceptId);for(let e=0;e<S.length;e++){const t=yield(0,c.A)(S[e]);k==S[e]&&(T=(0,h.F4)(t)),N==S[e]&&(I=(0,h.F4)(t)),C.push((0,h.F4)(t))}const b=e.patchObject;for(const e in b){let n=(0,d.CreateDefaultLConcept)();const o=b[e];let r=T;I.id>0&&(r=I),Array.isArray(o)||"object"==typeof o?(n=yield(0,l.k)(e,"",!0,T.userId,4,999,void 0,t),yield(0,s.R)(b[e],n.id,n.userId,T.id,T.userId,4,999,void 0,t)):n=yield(0,l.k)(e,o,!1,y,g,v,void 0,t);const c=(0,i.nm)(C,n);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,i.gt)(m,c[e].id);A=A.concat(t),w.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,n.id,T.id,2,void 0,void 0,t),C.push(n)}for(let e=0;e<A.length;e++)yield(0,a.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,n)=>{n.d(t,{A:()=>f});var o=n(9581),i=n(3518),r=n(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},a=n(4402),s=n(2370),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class d{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.userId=e,this.data=t,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.entryTimestamp=s,this.isNew=l}}var h=n(7282),u=n(2212),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function f(e,t){var n=arguments;return p(this,arguments,void 0,(function*(e,t,p=!1,f,y=4,v=999,g=0){const m=s.Logger.logfunction("MakeTheInstanceConcept",n)||{};if(s.serviceWorker){m.serviceWorker=!0;try{const n=yield(0,s.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:p,userId:f,passedAccessId:y,passedSessionId:v,referentId:g});return s.Logger.logUpdate(m),n.data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,r.ey)(m,"MakeTheInstanceConcept",e),(0,s.handleServiceWorkerException)(e)}}let C,T=v,I=f,w=f,k=y,N=f,A="",L=t.length,S=(0,h.o)();if(A=e.startsWith("the_")?e:"the_"+e,p)S=yield(0,s.MakeTheTypeConceptApi)(e,f),C=yield(0,u.Ay)(t,f,4,S.id,g,k,e);else if(L>255)S=yield(0,s.MakeTheTypeConceptApi)(A,f),C=yield(0,u.Ay)(t,f,4,S.id,g,k,A),function(e){c(this,void 0,void 0,(function*(){try{var t=(0,i.Xr)();const n=yield fetch(o.B.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!n.ok)throw(0,r.ry)(n),new Error(`Error! status: ${n.status}`);return yield n.json()}catch(e){throw e instanceof Error?console.log("Create the text error message: ",e.message):console.log("Create the text unexpected error: ",e),e}}))}(new d(f,t,999,I,k,N,T,w,Date.now().toString(),!0));else{S=yield(0,s.MakeTheTypeConceptApi)(A,f);let e=yield(0,a.A)(t,S.id);C=e,0==e.id&&0==e.userId&&(C=yield(0,u.N)(t,f,4,S.id,12,k,A),function(e,t,n,c){var a=arguments;l(this,void 0,void 0,(function*(){const l=s.Logger.logfunction("MakeTheNameInBackend",a);try{let a={newConceptId:e,referent:t,typeId:n,typeUserId:c},d=(0,i.Xr)(),h=JSON.stringify(a);const u=yield fetch(o.B.MakeTheNameInBackendUrl(),{method:"POST",headers:d,body:h});s.Logger.logUpdate(l),u.ok||(0,r.ry)(u)}catch(e){e instanceof Error?console.log("make the name in backend error message: ",e.message):console.log("make the name in backend unexpected error: ",e),(0,r.Mb)(e,o.B.MakeTheNameInBackendUrl()),(0,r.ey)(l,"MakeTheNameInBackend",e)}}))}(C.id,`${t}`,S.id,f))}return C.type=S,s.Logger.logUpdate(m),C}))}},5312:(e,t,n)=>{n.d(t,{NK:()=>u,Ve:()=>p,cf:()=>d,vw:()=>f,y8:()=>h});var o=n(2832),i=n(3130),r=n(2370),c=n(1863),a=n(6687),s=n(7106),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function d(e){var t=arguments;return l(this,arguments,void 0,(function*(e,n="",d=null,u=i.y0){var p,y,v,g,m,C,T,I;const w=r.Logger.logfunction("SearchLinkMultipleAll",t)||{};try{try{if(r.serviceWorker){w.serviceWorker=!0;const t=yield(0,r.sendMessage)("SearchLinkMultipleAll",{searchQuery:e,token:n,caller:d,format:u});return r.Logger.logUpdate(w),t.data}}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),(0,c.ey)(w,"SearchLinkMultipleAll",e),(0,r.handleServiceWorkerException)(e)}let t=[],k=[],N=[],A=[],L=e[0].composition,S={},G={};(null==d?void 0:d.isDataLoaded)?(S.compositionIds=null===(p=d.conceptIds)||void 0===p?void 0:p.slice(),S.internalConnections=null===(y=d.internalConnections)||void 0===y?void 0:y.slice(),S.linkers=null===(v=d.linkers)||void 0===v?void 0:v.slice(),S.reverse=null===(g=d.reverse)||void 0===g?void 0:g.slice(),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse):(S=yield(0,o.j)(e,n),d&&(d.conceptIds=null===(m=S.compositionIds)||void 0===m?void 0:m.slice(),d.internalConnections=null===(C=S.internalConnections)||void 0===C?void 0:C.slice(),d.linkers=null===(T=S.linkers)||void 0===T?void 0:T.slice(),d.reverse=null===(I=S.reverse)||void 0===I?void 0:I.slice(),d.isDataLoaded=!0),G=S,t=G.compositionIds,N=G.internalConnections,k=G.linkers,A=G.reverse);let _=yield function(e,t,n,o,r,c){return l(this,arguments,void 0,(function*(e,t,n,o,r,c,l=i.y0){try{let d,u,p=yield(0,a.QL)(e);return l==i.ZJ?(d=yield(0,a.MT)(t,n),u=yield f(e,d,r,o)):l==i.yv?(d=yield(0,a.D)(t,n),u=yield f(e,d,r,o)):100==l?(d=yield(0,a.nr)(t,n),u=yield h(p,d,r,o)):l==i.SL?u=yield(0,s._W)(e,t,n,c.ofCompositions,o):(d=yield(0,a.rv)(t,n),u=yield h(p,d,r,o)),u}catch(e){return void console.log("Error Occured in build layer",e)}}))}(k,t,N,A,L,e[0],u);return r.Logger.logUpdate(w),_}catch(e){throw console.log("this is the error in the search link multiple",e),(0,c.ey)(w,"SearchLinkMultipleAll",e),e}}))}function h(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){(new Date).getTime();let i={},c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;if(o.includes(e[n].id)&&(i=!0),1==i){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{let o=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[a][o])||("string"==typeof c[a]&&(c[a]={}),c[a][o]=[]),c[a][o].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[a][i.characterValue])||("string"==typeof c[a]&&(c[a]={}),c[a][i.characterValue]=[]),c[a][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}function u(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){let i=[],c=[];for(let t=0;t<e.length;t++)c.push(e[t].toTheConceptId),c.push(e[t].ofTheConceptId),c.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;if(o.includes(e[n].id)&&(i=!0),1==i){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=Object.keys(o)[0];try{let r=i.characterValue+"_reverse";"string"==typeof o&&(o={}),Array.isArray(o[c][r])||("string"==typeof o[c]&&(o[c]={}),o[c][r]=[]),o[c][r].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=Object.keys(o)[0];try{"string"==typeof o&&(o={}),Array.isArray(o[c][i.characterValue])||("string"==typeof o[c]&&(o[c]={}),o[c][i.characterValue]=[]),o[c][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o&&i.push(o)}return i}))}function p(e,t,n,o){return l(this,arguments,void 0,(function*(e,t,n,o,i=[]){(new Date).getTime();let c=[],a=[];for(let t=0;t<e.length;t++)a.push(e[t].toTheConceptId),a.push(e[t].ofTheConceptId),a.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let o=!1;if(i.includes(e[n].id)&&(o=!0),1==o){if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].toTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{let o=i.characterValue+"_reverse";"string"==typeof c&&(c={}),Array.isArray(c[a][o])||("string"==typeof c[a]&&(c[a]={}),c[a][o]=[]),c[a][o].push(t[e[n].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[e[n].ofTheConceptId]&&t[e[n].toTheConceptId]){let o=t[e[n].ofTheConceptId],i=yield(0,r.GetTheConcept)(e[n].typeId),c=null==o?void 0:o.data,a=Object.keys(c)[0];try{"string"==typeof c&&(c={}),Array.isArray(c[a][i.characterValue])||("string"==typeof c[a]&&(c[a]={}),c[a][i.characterValue]=[]),c[a][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n=t[o[e]];n&&c.push(n)}return c}))}function f(e,t,n){return l(this,arguments,void 0,(function*(e,t,n,o=[]){let i={},c=yield(0,r.GetConnectionBulk)(e),a=[];for(let e=0;e<c.length;e++)a.push(c[e].toTheConceptId),a.push(c[e].ofTheConceptId),a.push(c[e].typeId);yield(0,r.GetConceptBulk)(a),c.sort((function(e,t){return t.id-e.id}));for(let e=0;e<c.length;e++){let n=!1;if(o.includes(c[e].id)&&(n=!0),1==n){if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let n=t[c[e].toTheConceptId],o=yield(0,r.GetTheConcept)(c[e].typeId),i=n,a=Object.keys(i)[0];try{let n=o.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[a][n])||("string"==typeof i[a]&&(i[a]={}),i[a][n]=[]),i[a][n].push(t[c[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[c[e].ofTheConceptId]&&t[c[e].toTheConceptId]){let n=t[c[e].ofTheConceptId],o=yield(0,r.GetTheConcept)(c[e].typeId),i=n,a=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[a][o.characterValue])||("string"==typeof i[a]&&(i[a]={}),i[a][o.characterValue]=[]),i[a][o.characterValue].push(t[c[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}},7106:(e,t,n)=>{n.d(t,{zl:()=>v,b6:()=>C,e$:()=>I,y6:()=>T,yV:()=>g,_W:()=>m});var o=n(2370),i=n(6687);function r(e){return e.startsWith("the_")?e.slice(4):e}var c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function a(e,t,n){return c(this,void 0,void 0,(function*(){var i,r,c,a,s,l,d,h;let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let p=!1;n.includes(e[u].id)&&(p=!0);let f=yield(0,o.GetTheConcept)(e[u].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[u].toTheConceptId);if(1==p&&0!=f.id&&0!=y.id){let n,s=null!==(r=null===(i=y.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self";e[u].toTheConceptId in t?n=t[e[u].toTheConceptId]:(n={},n[s]={},t[e[u].toTheConceptId]=n);let l=yield(0,o.GetTheConcept)(e[u].typeId);try{let e=null!==(a=null===(c=null==f?void 0:f.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"none",n=f.characterValue;l.characterValue,l.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}if(0!=f.id&&0!=y.id){let n,i=null!==(l=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self";e[u].ofTheConceptId in t?n=t[e[u].ofTheConceptId]:(n={},n[i]={},t[e[u].ofTheConceptId]=n);let r=yield(0,o.GetTheConcept)(e[u].typeId);try{let e=null!==(h=null===(d=null==y?void 0:y.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"none",n=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var s=n(5312),l=n(7876),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function h(e,t,n){if(e in t){let o=t[e];o&&(n[o.connectionType+"_count"]=o.count)}}var u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},p=n(5898);function f(e,t="DESC"){return"ASC"==t?e.sort((function(e,t){return e.id-t.id})):e.sort((function(e,t){return t.id-e.id})),e}var y=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function v(e,t){return y(this,arguments,void 0,(function*(e,t,n=""){let r=yield(0,o.SearchWithTypeAndLinkerApi)(e,t,n),c=r.compositionIds,a=r.internalConnections,l=r.linkers,d=r.reverse,h=r.mainCompositionIds,u=yield(0,i.QL)(l),p=yield(0,i.MT)(c,a);return yield(0,s.NK)(u,p,h,d)}))}function g(e,t,n,o,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),a=yield(0,i.rv)(t,n);return yield(0,s.Ve)(c,a,t,o,r)}))}function m(e,t,n,o,r){return y(this,void 0,void 0,(function*(){let c=yield(0,i.QL)(e),a=yield(0,i.D)(t,n);return yield(0,s.NK)(c,a,o,r)}))}function C(e,t,n,s,l){return y(this,void 0,void 0,(function*(){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnections",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:s,countInfos:l})).data}catch(e){console.error("formatConnections error sw: ",e),(0,o.handleServiceWorkerException)(e)}let d=yield(0,i.QL)(e);d=f(d);let h=[];h=yield a(d,h,s),h=yield function(e,t,n){return c(this,void 0,void 0,(function*(){var i,c,a,s,l,d,h,u;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let p=0;p<e.length;p++){let f=!1;n.includes(e[p].id)&&(f=!0);let y=yield(0,o.GetTheConcept)(e[p].ofTheConceptId),v=yield(0,o.GetTheConcept)(e[p].toTheConceptId);if(1==f&&0!=y.id&&0!=v.id){let n,l=null!==(c=null===(i=v.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self";e[p].toTheConceptId in t?(n=t[e[p].toTheConceptId],l in n||(n[l]={})):(n={},n[l]={},t[e[p].toTheConceptId]=n);let d=yield(0,o.GetTheConcept)(e[p].typeId);try{let e=null!==(s=null===(a=null==y?void 0:y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"none",t=y.characterValue,o=d.characterValue;""==o&&(o=e,o=r(o));let i={[e]:t},c=o+"_reverse";d.characterValue.includes("_s_")||("string"==typeof n[l]&&(n[l]={}),n[l][c]=i)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let n,i=null!==(d=null===(l=y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(n=t[e[p].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[p].ofTheConceptId]=n);let c=yield(0,o.GetTheConcept)(e[p].typeId);try{let e=null!==(u=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",t=v.characterValue,o=c.characterValue,a=(c.characterValue,!1);""==o&&(o=e,o=r(o),a=!0);let s={[e]:t};isNaN(Number(o))?c.characterValue.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][o]=a?t:s):(Array.isArray(n[i])||(n[i]=[]),n[i].push(t))}catch(e){console.log("this is error",e)}}}return t}))}(d,h,s);let u=yield function(e,t,n,i){return c(this,arguments,void 0,(function*(e,t,n,i,r=[]){var c,a,s,l,d,h;let u=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let i=!1;r.includes(e[n].id)&&(i=!0);let u=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),p=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(1==i&&0!=u.id&&0!=p.id&&p.id in t){let i,r=null!==(a=null===(c=p.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self";e[n].toTheConceptId in t?i=t[e[n].toTheConceptId]:(i={},i[r]={},t[e[n].toTheConceptId]=i);let s=yield(0,o.GetTheConcept)(e[n].typeId);try{let o=s.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(i[r][o])?i[r][o].push(c):s.characterValue.includes("_s_")?(i[r][o]=[],i[r][o].push(c)):i[r][o]=c)}catch(e){console.log("this is error",e)}}if(0!=u.id&&0!=p.id&&u.id in t){let i,r=null!==(l=null===(s=u.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self";e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],"string"==typeof i[r]&&(i[r]={})):(i={},i[r]={},t[e[n].ofTheConceptId]=i);let c=!1,a=(yield(0,o.GetTheConcept)(e[n].typeId)).characterValue;""==a&&(a=p.characterValue,c=!0),""==a&&(a=null!==(h=null===(d=null==p?void 0:p.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"");try{let o=t[e[n].toTheConceptId];o&&(Array.isArray(i[r])?c?i[r].push(o[a]):i[r].push(o):Array.isArray(i[r][a])?i[r][a].push(o):a.includes("_s_")?(i[r][a]=[],c?i[r][a].push(o[a]):i[r][a].push(o)):i[r][a]=c?o[a]:o)}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o=t[n[e]];o?(o.id=n[e],u.push(o)):(o={},o.id=n[e],u.push(o))}return u}))}(d,h,n,[],s);return u}))}function T(e,t,n,c,s){return y(this,arguments,void 0,(function*(e,t,n,c,s,u="DESC"){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnectionsJustId",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:c,countInfos:s,order:u})).data}catch(e){console.error("formatConnectionsJustId error sw: ",e),(0,o.handleServiceWorkerException)(e)}let y=yield(0,i.QL)(e),v=yield(0,p.V)(s);y=f(y,u);let g=[];g=yield a(y,g,c),g=yield function(e,t){return d(this,arguments,void 0,(function*(e,t,n=[]){var o,i,c,a,s,d,h,u;let p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let p=0;p<e.length;p++){let f=!1,y=yield(0,l.A)(e[p].ofTheConceptId),v=yield(0,l.A)(e[p].toTheConceptId);if(n.includes(e[p].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id){let n,s=yield(0,l.A)(e[p].typeId),d=null!==(i=null===(o=v.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[p].toTheConceptId in t?(n=t[e[p].toTheConceptId],d in n||(n[d]={})):(n={},n[d]={},t[e[p].toTheConceptId]=n);try{let t=null!==(a=null===(c=null==y?void 0:y.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"none",o=y.characterValue,i=s.characterValue;""==i&&(i=t,i=r(i));let l={id:y.id,[t]:o,created_on:e[p].entryTimeStamp},h=i+"_reverse";h.includes("_s_")||("string"==typeof n[d]&&(n[d]={}),n[d][h]=l)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let n,o=yield(0,l.A)(e[p].typeId),i=null!==(d=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==d?d:"self";e[p].ofTheConceptId in t?(n=t[e[p].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[p].ofTheConceptId]=n);try{let t=null!==(u=null===(h=null==v?void 0:v.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",c=v.characterValue,a=o.characterValue,s=!1;""==a&&(a=t,a=r(a),s=!0);let l={};l[t]={id:v.id,data:c,created_on:e[p].entryTimeStamp},isNaN(Number(a))?a.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][a]=s?l[t]:l):(Array.isArray(n[i])||(n[i]=[]),n[i].push(l[t]))}catch(e){console.log("this is error",e)}}}return t}))}(y,g,c);let m=yield function(e,t,n){return d(this,arguments,void 0,(function*(e,t,n,o=[],i){var r,c,a,s,d,u,p;(new Date).getTime();let f=[],y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,y=yield(0,l.A)(e[n].ofTheConceptId),v=yield(0,l.A)(e[n].toTheConceptId);if(o.includes(e[n].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id&&v.id in t){let o,i=yield(0,l.A)(e[n].typeId),a=null!==(c=null===(r=v.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",s=!1;e[n].toTheConceptId in t&&(s=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[a]&&(o[a]={})):(o={},o[a]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let r=t[e[n].ofTheConceptId];r&&(r.id=y.id,r.created_on=y.entryTimeStamp);let c=i.characterValue+"_reverse";Array.isArray(o[a][c])?o[a][c].push(r):c.includes("_s_")?(o[a][c]=[],o[a][c].push(r)):o[a][c]=r}}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id&&y.id in t){let o,r=yield(0,l.A)(e[n].typeId),c=null!==(s=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self",f=!1;e[n].toTheConceptId in t&&(f=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},t[e[n].ofTheConceptId]=o),h(y.id,i,o);let g=!1,m=r.characterValue;""==m&&(m=v.characterValue,g=!0),""==m&&(m=(null===(d=null==v?void 0:v.type)||void 0===d?void 0:d.characterValue)||"");try{let r=null!==(p=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==p?p:"none",a=t[e[n].toTheConceptId];if(a){let t={};t[r]={data:a[r],id:v.id,created_on:e[n].entryTimeStamp},Array.isArray(o[c])?g?o[c].push(a[m]):o[c].push(a):Array.isArray(o[c][m])?o[c][m].push(t):m.includes("_s_")?(o[c][m]=[],g?o[c][m].push(t[r]):o[c][m].push(t)):o[c][m]=g?t[r]:t,h(v.id,i,t)}}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let o={};o=t[n[e]],o||(o={}),o.id=n[e],f.push(o)}return f}))}(y,g,n,c,v);return m}))}function I(e,t,n,c,a){return y(this,arguments,void 0,(function*(e,t,n,c,a,s="DESC"){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("formatConnectionsDataId",{linkers:e,conceptIds:t,mainCompositionIds:n,reverse:c,countInfos:a,order:s})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,o.handleServiceWorkerException)(e)}let l=yield(0,i.QL)(e),d=yield(0,p.V)(a);l=f(l,s);let y=[];y=yield function(e,t){var n=arguments;return u(this,arguments,void 0,(function*(e,t,i=[]){var r,c,a,s,l,d,h,u;const p=o.Logger.logfunction("FormatFunctionData",n);let f=[];for(let t=0;t<e.length;t++)f.push(e[t].toTheConceptId),f.push(e[t].ofTheConceptId),f.push(e[t].typeId);for(let n=0;n<e.length;n++){let p=!1,f=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(p=!0),1==p&&0!=f.id&&0!=y.id){let i,l=yield(0,o.GetTheConcept)(e[n].typeId),d=null!==(c=null===(r=y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[n].toTheConceptId in t?i=t[e[n].toTheConceptId]:(i={},i[d]={},t[e[n].toTheConceptId]=i);try{let e=null!==(s=null===(a=null==f?void 0:f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"none",n=f.characterValue;(l.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}if(0!=f.id&&0!=y.id){let i,r=yield(0,o.GetTheConcept)(e[n].typeId),c=null!==(d=null===(l=f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"self";e[n].ofTheConceptId in t?i=t[e[n].ofTheConceptId]:(i={},i[c]={},t[e[n].ofTheConceptId]=i);try{let e=null!==(u=null===(h=null==y?void 0:y.type)||void 0===h?void 0:h.characterValue)&&void 0!==u?u:"none",n=y.characterValue;r.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return o.Logger.logUpdate(p),t}))}(l,y,c),y=yield function(e,t){var n=arguments;return u(this,arguments,void 0,(function*(e,t,i=[]){var c,a,s,l,d,h,u,p;const f=o.Logger.logfunction("FormatFunctionDataForData",n);let y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,y=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),v=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(f=!0),1==f&&0!=y.id&&0!=v.id){let i,d=yield(0,o.GetTheConcept)(e[n].typeId),h=null!==(a=null===(c=v.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self";e[n].toTheConceptId in t?(i=t[e[n].toTheConceptId],h in i||(i[h]={})):(i={},i[h]={},t[e[n].toTheConceptId]=i);try{let e=null!==(l=null===(s=null==y?void 0:y.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"none",t=y.characterValue,n=d.characterValue;""==n&&(n=e,n=r(n));let o={id:y.id,data:{[e]:t}},c=n+"_reverse";c.includes("_s_")||("string"==typeof i[h]&&(i[h]={}),i[h][c]=o)}catch(e){console.log("this is error",e)}}if(0!=y.id&&0!=v.id){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),a=null!==(h=null===(d=y.type)||void 0===d?void 0:d.characterValue)&&void 0!==h?h:"self";e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],a in i||(i[a]={})):(i={},i[a]={},t[e[n].ofTheConceptId]=i);try{let e=null!==(p=null===(u=null==v?void 0:v.type)||void 0===u?void 0:u.characterValue)&&void 0!==p?p:"none",t=v.characterValue,n=c.characterValue,o=!1;""==n&&(n=e,n=r(n),o=!0);let s={id:v.id,data:{[e]:t}};isNaN(Number(n))?n.includes("_s_")||("string"==typeof i[a]&&(i[a]={}),i[a][n]=s):(Array.isArray(i[a])||(i[a]=[]),i[a].push(s))}catch(e){console.log("this is error",e)}}}return o.Logger.logUpdate(f),t}))}(l,y,c);let v=yield function(e,t,n,i){var r=arguments;return u(this,arguments,void 0,(function*(e,t,n,i,c=[],a){var s,l,d,u,p,f;const y=o.Logger.logfunction("FormatFromConnectionsAlteredArrayExternal",r);let v=[],g=[];for(let t=0;t<e.length;t++)g.push(e[t].toTheConceptId),g.push(e[t].ofTheConceptId),g.push(e[t].typeId);for(let n=0;n<e.length;n++){let i=!1,r=yield(0,o.GetTheConcept)(e[n].ofTheConceptId),y=yield(0,o.GetTheConcept)(e[n].toTheConceptId);if(c.includes(e[n].id)&&(i=!0),1==i&&0!=r.id&&0!=y.id&&y.id in t){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),a=null!==(l=null===(s=y.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self",d=!1;e[n].toTheConceptId in t&&(d=!0),e[n].toTheConceptId in t?(i=t[e[n].toTheConceptId],"string"==typeof i[a]&&(i[a]={})):(i={},i[a]={},t[e[n].toTheConceptId]=i);try{if(t[e[n].ofTheConceptId]){let o={id:r.id,data:t[e[n].ofTheConceptId],created_on:e[n].entryTimeStamp},s=c.characterValue+"_reverse";Array.isArray(i[a][s])?i[a][s].push(o):s.includes("_s_")?(i[a][s]=[],i[a][s].push(o)):i[a][s]=o}}catch(e){console.log("this is error",e)}}if(0!=r.id&&0!=y.id&&r.id in t){let i,c=yield(0,o.GetTheConcept)(e[n].typeId),s=null!==(u=null===(d=r.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"self",l=!1;e[n].toTheConceptId in t&&(l=!0),e[n].ofTheConceptId in t?(i=t[e[n].ofTheConceptId],"string"==typeof i[s]&&(i[s]={})):(i={},i[s]={},t[e[n].ofTheConceptId]=i),h(r.id,a,i);let v=!0,g=c.characterValue;""==g&&(g=y.characterValue,v=!0),""==g&&(g=(null===(p=null==y?void 0:y.type)||void 0===p?void 0:p.characterValue)||"");try{null===(f=null==y?void 0:y.type)||void 0===f||f.characterValue;let o=t[e[n].toTheConceptId];if(o){let r={id:y.id,data:t[e[n].toTheConceptId],created_on:e[n].entryTimeStamp};Array.isArray(i[s])?i[s].push(o):Array.isArray(i[s][g])?i[s][c.characterValue].push(r):g.includes("_s_")?(i[s][g]=[],i[s][g].push(r)):i[s][g]=r,h(y.id,a,r)}}catch(e){console.log("this is error",e)}}}for(let e=0;e<i.length;e++){let n={};n.id=i[e];let r=yield(0,o.GetTheConcept)(n.id);n.data=t[i[e]],n.created_on=r.entryTimeStamp,v.push(n)}return o.Logger.logUpdate(y),v}))}(l,y,[],n,c,d);return v}))}},3518:(e,t,n)=>{n.d(t,{BZ:()=>c,Xr:()=>i,ab:()=>r});var o=n(3278);function i(e="application/json",t="application/json"){let n={};return n=""!=o.b.BearerAccessToken?{"Content-Type":e,Authorization:"Bearer "+o.b.BearerAccessToken,Accept:t}:{"Content-Type":e,Accept:t},n}function r(e="application/json",t="",n="application/json"){""==t&&(t=o.b.BearerAccessToken);let i={};return i=""!=t?{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}:{"Content-Type":e,Accept:n},i}function c(){let e=o.b.BearerAccessToken;const t=new Headers;return t.append("Authorization","Bearer "+e),t}},6467:(e,t,n)=>{function o(e){const t=e.lastIndexOf("_");let n=[];return n=t>0?[e.substring(0,t),e.substring(t+1,e.length)]:[e],n}n.d(t,{f:()=>o})},4310:(e,t,n)=>{n.d(t,{Cp:()=>h,ix:()=>p,qj:()=>u});var o=n(2370),i=n(5898),r=n(1863),c=n(7106),a=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const l=new Map,d=new Map;function h(e){var t=arguments;return s(this,void 0,void 0,(function*(){o.Logger.logfunction("BuildWidgetFromId",t);try{if(o.serviceWorker)return(yield(0,o.sendMessage)("BuildWidgetFromId",{id:e})).data}catch(e){console.error("BuildWidgetFromId error sw: ",e),(0,o.handleServiceWorkerException)(e)}let n={};if(l.has(e))return l.get(e)||n;const d=(()=>s(this,void 0,void 0,(function*(){try{let t=[],s=[],l=[],d=[],h="DESC",u=[],p={},f=(0,a.Xr)("application/json"),y=o.BaseUrl.getWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];p=yield v.json(),t=p.conceptIds,s=p.linkers,l=p.reverse,d=p.mainCompositionIds,u=p.countinfo;let g=(0,i.w)(u);return n=yield(0,c.e$)(s,t,d,l,g,h),n}catch(e){throw console.log("this is the error in the build widget",e),e}finally{l.delete(e)}})))();return l.set(e,d),d}))}function u(e){var t=arguments;return s(this,void 0,void 0,(function*(){o.Logger.logfunction("BuildWidgetFromIdForLatest",t);try{if(o.serviceWorker)return(yield(0,o.sendMessage)("BuildWidgetFromIdForLatest",{id:e})).data}catch(e){console.error("BuildWidgetFromIdForLatest error sw: ",e),(0,o.handleServiceWorkerException)(e)}let n={};if(d.has(e))return d.get(e)||n;const l=(()=>s(this,void 0,void 0,(function*(){try{let t=[],s=[],l=[],d=[],h="DESC",u=[],p={},f=(0,a.Xr)("application/json"),y=o.BaseUrl.getLatestWidgetData()+"?id="+e;const v=yield fetch(y,{method:"GET",headers:f});if(!v.ok)return(0,r.ry)(v),console.log("This is the BuildWidgetFromId error",v.status),[];p=yield v.json(),t=p.conceptIds,s=p.linkers,l=p.reverse,d=p.mainCompositionIds,u=p.countinfo;let g=(0,i.w)(u);return n=yield(0,c.e$)(s,t,d,l,g,h),{data:n,mainId:p.mainId}}catch(e){throw console.log("this is the error in the build widget",e),e}finally{d.delete(e)}})))();return d.set(e,l),l}))}function p(e,t){for(let n=0;n<e.length;n++)if(e[n].id==t)return e[n]}},4287:(e,t,n)=>{n.d(t,{w:()=>c});var o=n(2370),i=n(3130),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class c{constructor(){this.subscribers=[],this.mainConcept=0,this.compositionIds=[],this.conceptIds=[],this.internalConnections=[],this.reverse=[],this.linkers=[],this.dependency=[],this.isDataLoaded=!1,this.isUpdating=!1,this.fetched=!1,this.format=i.yv}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let n=e;if(!t.compositionIds.includes(null==n?void 0:n.detail)){t.compositionIds.unshift(null==n?void 0:n.detail),t.listenToEvent(null==n?void 0:n.detail);let e=null==n?void 0:n.detail,i=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)yield o.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}))}t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let n=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield o.ConnectionData.GetConnection(n[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}listenToEventConnectionType(e,t){window.addEventListener(`${e}`,(n=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let n=this;setTimeout((function(){return r(this,void 0,void 0,(function*(){let i=yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<i.length;e++)i.typeId==t&&(yield o.ConnectionData.GetConnection(i[e]).then((e=>{e.typeId==n.mainConcept?n.internalConnections.includes(e.id)||n.internalConnections.push(e.id):n.linkers.includes(e.id)||n.linkers.push(e.id),n.conceptIds.includes(e.toTheConceptId)||n.conceptIds.push(e.toTheConceptId),n.compositionIds.includes(e.ofTheConceptId)||n.compositionIds.push(e.ofTheConceptId)})));n.isUpdating=!1,yield n.bind(),n.notify()}))}),200)}}))}bind(){return r(this,void 0,void 0,(function*(){console.log("this is the old execute data")}))}update(){return r(this,void 0,void 0,(function*(){this.isDataLoaded=!1,yield this.bind(),this.notify()}))}subscribe(e){return r(this,void 0,void 0,(function*(){return this.subscribers.push(e),console.log("again executing data"),yield this.bind(),e(this.data,this)}))}unsubscribe(e){return this.subscribers.filter((t=>t!=e)),this.subscribers.length}notify(){console.log("notifiers",this.subscribers),this.subscribers.map((e=>{console.log("notify"),e(this.data,this)}))}}},5328:(e,t,n)=>{n.d(t,{d:()=>l});var o=n(2370),i=n(3130),r=n(8939),c=n(4287),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class s extends c.w{constructor(e,t,n,o,i){super(),this.connections=[],this.data=[],this.mainConcept=e,this.linker=t,this.inpage=n,this.page=o,this.format=i}bind(){return a(this,void 0,void 0,(function*(){var e;if(!this.isDataLoaded){let i=yield(0,o.GetTheConcept)(this.mainConcept),r=(null===(e=i.type)||void 0===e?void 0:e.characterValue)+"_s_"+this.linker,c=yield(0,o.GetConceptByCharacterAndType)(r,16);if(c.id>0){let e=yield(0,o.GetConnectionOfTheConcept)(c.id,i.id,i.userId,this.inpage,this.page);this.connections=e;for(var t=[],n=0;n<this.connections.length;n++)t.push(this.connections[n].toTheConceptId),this.linkers.push(this.connections[n].id),this.listenToEvent(this.connections[n].toTheConceptId);yield(0,o.GetAllConnectionsOfCompositionBulk)(t)}this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return a(this,void 0,void 0,(function*(){this.data=[],this.connections=yield(0,o.GetConnectionBulk)(this.linkers);for(var e=0;e<this.connections.length;e++){let t=this.connections[e].toTheConceptId,n=yield(0,o.GetTheConcept)(t);if(console.log("this is the format",this.format),this.format==i.yv){let e=yield(0,r.RW)(n.id);this.data.push(e)}else if(this.format==i.ZJ){let e=yield(0,r.kx)(n.id);this.data.push(e)}else if(this.format==i.iw){let e=yield(0,o.GetCompositionWithIdAndDateFromMemory)(n.id);this.data.push(e)}else{let e=yield(0,o.GetCompositionWithIdAndDateFromMemory)(n.id);this.data.push(e)}}return this.data}))}}function l(e,t,n,o,r=i.yv){return new s(e,t,n,o,r)}},2370:(e,t,n)=>{n.r(t),n.d(t,{ADMIN:()=>Dn,ALLID:()=>En.BG,AccessTracker:()=>qe.J,AddGhostConcept:()=>hn,Anomaly:()=>_o,BaseUrl:()=>l.B,BinaryTree:()=>Oe.W,BuildWidgetFromId:()=>Jo.Cp,BuilderStatefulWidget:()=>No,Composition:()=>Et,CompositionBinaryTree:()=>bt,CompositionNode:()=>Gt,Concept:()=>oo.j,ConceptsData:()=>s.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>D.A,CreateConnectionBetweenEntityLocal:()=>Ho,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Sn.h,CreateData:()=>ai,CreateDefaultConcept:()=>P.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>H,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>En.y0,DATAIDDATE:()=>En.iw,DelayFunctionExecution:()=>Rn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>_n,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Eo,DeleteUser:()=>$e,DependencyObserver:()=>Mn.w,FilterSearch:()=>lo,FormatFromConnections:()=>un.vw,FormatFromConnectionsAltered:()=>un.y8,FreeschemaQuery:()=>Fo,FreeschemaQueryApi:()=>Uo,GetAllConnectionsOfComposition:()=>E.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Do,GetComposition:()=>v.Nj,GetCompositionBulk:()=>tt.dF,GetCompositionBulkWithDataId:()=>tt.cw,GetCompositionFromConnectionsWithDataId:()=>tt.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>tt.km,GetCompositionFromConnectionsWithDataIdInObject:()=>tt.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>tt.Nt,GetCompositionFromConnectionsWithIndex:()=>tt.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>tt.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>w,GetCompositionListListener:()=>zn,GetCompositionListLocal:()=>x,GetCompositionListLocalWithId:()=>R,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Hn,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>_,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>qt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>ft.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>xn,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>no,GetLinkListener:()=>Xn.d,GetLinkRaw:()=>se,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>pn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>En.ZJ,LConcept:()=>io,LConnection:()=>ro,LISTNORMAL:()=>En.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>so.H,LocalTransaction:()=>Lo,Logger:()=>vo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>z.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>Ge,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>En.yv,PRIVATE:()=>Fn,PUBLIC:()=>Wn,PatcherStructure:()=>co,Prototype:()=>pi,RAW:()=>En.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>at,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>Kn,SchemaQueryListener:()=>Vo,SearchAllConcepts:()=>Mt,SearchLinkInternal:()=>An,SearchLinkInternalAll:()=>Ln,SearchLinkMultipleAll:()=>un.cf,SearchLinkMultipleAllObservable:()=>Pn,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>et,SearchStructure:()=>ho,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Qn.zl,SearchWithTypeAndLinkerApi:()=>On,SessionData:()=>ao,Signin:()=>kt,Signup:()=>Tt,SignupEntity:()=>It,SplitStrings:()=>a.f,StatefulWidget:()=>wo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Ut,UpdateCompositionLocal:()=>fn.D,UserBinaryTree:()=>sn,Validator:()=>Bo,ViewInternalData:()=>In,ViewInternalDataApi:()=>Cn,WidgetTree:()=>jo,convertFromConceptToLConcept:()=>wn.F4,convertFromLConceptToConcept:()=>wn.dp,convertWidgetTreeToWidget:()=>ti,convertWidgetTreeToWidgetWithWrapper:()=>ni,createFormFieldData:()=>xo,createPrototypeLocal:()=>vi,dispatchIdEvent:()=>bi,getFromDatabaseWithType:()=>ne,getObjectsFromIndexDb:()=>oe,getWidgetBulkFromId:()=>ei,getWidgetFromId:()=>Ko,handleServiceWorkerException:()=>xi,hasActivatedSW:()=>ki,init:()=>Li,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>xt,renderLatestWidget:()=>Xo,renderPage:()=>Qo,renderWidget:()=>Yo,searchLinkMultipleListener:()=>Vn,sendEmail:()=>Co,sendMessage:()=>Si,serviceWorker:()=>mi,setHasActivatedSW:()=>Ni,storeToDatabase:()=>te,subscribedListeners:()=>Ii,unwrapContainers:()=>ri,updateAccessToken:()=>Ai,uploadAttachment:()=>ht,uploadFile:()=>pt,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var o={};n.r(o),n.d(o,{ADMIN:()=>Dn,ALLID:()=>En.BG,AccessTracker:()=>qe.J,AddGhostConcept:()=>hn,Anomaly:()=>_o,BaseUrl:()=>l.B,BinaryTree:()=>Oe.W,BuildWidgetFromId:()=>Jo.Cp,BuilderStatefulWidget:()=>No,Composition:()=>Et,CompositionBinaryTree:()=>bt,CompositionNode:()=>Gt,Concept:()=>oo.j,ConceptsData:()=>s.I,Connection:()=>O.N,ConnectionData:()=>ze.d,CreateComposition:()=>D.A,CreateConnectionBetweenEntityLocal:()=>Ho,CreateConnectionBetweenTwoConcepts:()=>X,CreateConnectionBetweenTwoConceptsGeneral:()=>Z,CreateConnectionBetweenTwoConceptsLocal:()=>Sn.h,CreateData:()=>ai,CreateDefaultConcept:()=>P.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>F.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>ie.q,CreateTheConnectionGeneral:()=>H,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>En.y0,DATAIDDATE:()=>En.iw,DelayFunctionExecution:()=>Rn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>_n,DeleteConnectionById:()=>J.m,DeleteConnectionByType:()=>Eo,DeleteUser:()=>$e,DependencyObserver:()=>Mn.w,FilterSearch:()=>lo,FormatFromConnections:()=>un.vw,FormatFromConnectionsAltered:()=>un.y8,FreeschemaQuery:()=>Fo,FreeschemaQueryApi:()=>Uo,GetAllConnectionsOfComposition:()=>E.s,GetAllConnectionsOfCompositionBulk:()=>f.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Do,GetComposition:()=>v.Nj,GetCompositionBulk:()=>tt.dF,GetCompositionBulkWithDataId:()=>tt.cw,GetCompositionFromConnectionsWithDataId:()=>tt.p8,GetCompositionFromConnectionsWithDataIdFromConnections:()=>tt.km,GetCompositionFromConnectionsWithDataIdInObject:()=>tt.rv,GetCompositionFromConnectionsWithDataIdIndex:()=>tt.Nt,GetCompositionFromConnectionsWithIndex:()=>tt.as,GetCompositionFromConnectionsWithIndexFromConnections:()=>tt.hG,GetCompositionFromMemoryWithConnections:()=>v.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>w,GetCompositionListListener:()=>zn,GetCompositionListLocal:()=>x,GetCompositionListLocalWithId:()=>R,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>N,GetCompositionListener:()=>Hn,GetCompositionLocal:()=>G,GetCompositionLocalWithId:()=>_,GetCompositionWithAllIds:()=>v.Mb,GetCompositionWithCache:()=>Ht,GetCompositionWithDataIdBulk:()=>zt,GetCompositionWithDataIdWithCache:()=>qt,GetCompositionWithId:()=>v.yz,GetCompositionWithIdAndDateFromMemory:()=>v.Ez,GetConceptBulk:()=>ft.r,GetConceptByCharacter:()=>g.A,GetConceptByCharacterAndCategoryLocal:()=>m.$I,GetConceptByCharacterAndType:()=>re.A,GetConnectionBetweenTwoConceptsLinker:()=>xn,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>no,GetLinkListener:()=>Xn.d,GetLinkRaw:()=>se,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>pn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>En.ZJ,LConcept:()=>io,LConnection:()=>ro,LISTNORMAL:()=>En.SL,LocalConceptsData:()=>y.v,LocalSyncData:()=>so.H,LocalTransaction:()=>Lo,Logger:()=>vo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>z.A,MakeTheInstanceConceptLocal:()=>K.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>Ge,MakeTheTypeConceptLocal:()=>le.$,NORMAL:()=>En.yv,PRIVATE:()=>Fn,PUBLIC:()=>Wn,PatcherStructure:()=>co,Prototype:()=>pi,RAW:()=>En.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>at,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>Kn,SchemaQueryListener:()=>Vo,SearchAllConcepts:()=>Mt,SearchLinkInternal:()=>An,SearchLinkInternalAll:()=>Ln,SearchLinkMultipleAll:()=>un.cf,SearchLinkMultipleAllObservable:()=>Pn,SearchLinkMultipleApi:()=>c.j,SearchQuery:()=>et,SearchStructure:()=>ho,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Qn.zl,SearchWithTypeAndLinkerApi:()=>On,SessionData:()=>ao,Signin:()=>kt,Signup:()=>Tt,SignupEntity:()=>It,SplitStrings:()=>a.f,StatefulWidget:()=>wo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Ut,UpdateCompositionLocal:()=>fn.D,UserBinaryTree:()=>sn,Validator:()=>Bo,ViewInternalData:()=>In,ViewInternalDataApi:()=>Cn,WidgetTree:()=>jo,convertFromConceptToLConcept:()=>wn.F4,convertFromLConceptToConcept:()=>wn.dp,convertWidgetTreeToWidget:()=>ti,convertWidgetTreeToWidgetWithWrapper:()=>ni,createFormFieldData:()=>xo,createPrototypeLocal:()=>vi,dispatchIdEvent:()=>bi,getFromDatabaseWithType:()=>ne,getObjectsFromIndexDb:()=>oe,getWidgetBulkFromId:()=>ei,getWidgetFromId:()=>Ko,handleServiceWorkerException:()=>xi,hasActivatedSW:()=>ki,init:()=>Li,recursiveFetch:()=>v.zN,recursiveFetchNew:()=>xt,renderLatestWidget:()=>Xo,renderPage:()=>Qo,renderWidget:()=>Yo,searchLinkMultipleListener:()=>Vn,sendEmail:()=>Co,sendMessage:()=>Si,serviceWorker:()=>mi,setHasActivatedSW:()=>Ni,storeToDatabase:()=>te,subscribedListeners:()=>Ii,unwrapContainers:()=>ri,updateAccessToken:()=>Ai,uploadAttachment:()=>ht,uploadFile:()=>pt,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var i=n(5020),r=n(205),c=n(2832),a=n(6467),s=n(9639),l=n(9581),d=n(3518),h=n(1863),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function p(e,t){var n=arguments;return u(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetAllConceptsByType",n);try{var i=new URLSearchParams;i.append("type",e),i.append("user_id",t.toString());var r=(0,d.Xr)("application/x-www-form-urlencoded");const n=yield fetch(l.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:r,body:i});if(n.ok){const e=yield n.json();for(var c=0;c<e.length;c++)s.I.AddConcept(e[c])}else console.log("GetAllConceptsByType error",n.status),(0,h.ry)(n)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,h.Mb)(e,l.B.GetAllConceptsByTypeUrl()),(0,h.ey)(o,"GetAllConceptsByType",e)}}))}var f=n(8642),y=n(9736),v=n(8939),g=n(2013),m=n(8064),C=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function T(e,t){var n=arguments;return C(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetCompositionList",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetCompositionList",{compositionName:e,userId:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetCompositionList sw error: ",e),(0,h.ey)(r,"GetCompositionList",e),xi(e)}}let c=yield(0,g.A)(e),a=[];if(c){yield p(e,t);let n=yield s.I.GetConceptsByTypeIdAndUser(c.id,t),r=o*(i-1),l=[];for(let e=r;e<r+o;e++)n[e]&&l.push(n[e].id);yield(0,f.Y)(l);for(let e=r;e<r+o;e++)if(n[e]){let t=yield(0,v.kx)(n[e].id);a.push(t)}}return vo.V.logUpdate(r),a}))}function I(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=x(e,t),r=T(e,t),c=[];return Promise.race([i,r]).then((e=>{console.log("Promise result",e),c.push(...e)})).catch((e=>{console.log("error in handling",e)})),r.then((e=>{console.log("This is the second promise result",e),c.push(...e)})),c}))}function w(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){if(mi)try{return(yield Si("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),xi(e)}let i=yield(0,m.Ay)(e),r=yield(0,g.A)(e),c=[],a=[],l=[],d=[];0!=i.id&&(a=yield y.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),d=yield s.I.GetConceptsByTypeIdAndUser(r.id,t),c=d);for(let e=0;e<a.length;e++){let t=!1;for(let n=0;n<d.length;n++)a[e].ghostId==d[n].ghostId&&(t=!0);t||l.push(a[e])}console.log("This is the all list",l);let h=[];return h=yield function(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=[],r=n*(o-1),c=[],a=t.length;for(let t=r;t<r+n-a;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let n=yield _(t[e].id);i.push(n)}yield(0,f.Y)(c);for(let t=r;t<r+n-a;t++)if(e[t]){let n=yield(0,v.RW)(e[t].id);i.push(n)}return i}))}(c,l,n,o),h}))}function k(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){if(mi)try{return(yield Si("GetCompositionListWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),xi(e)}let i=yield(0,g.A)(e),r=[];if(i){yield p(e,t);let c=yield s.I.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),l=[];for(let e=a;e<a+n;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=a;e<a+n;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}function N(e,t){return C(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=yield(0,g.w)(e),r=[];if(i){yield p(e,t);let c=yield s.I.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),l=[];for(let e=a;e<a+n;e++)c[e]&&l.push(c[e].id);yield(0,f.Y)(l);for(let e=a;e<a+n;e++)if(c[e]){let t=yield(0,v.RW)(c[e].id);r.push(t)}}return r}))}var A=n(4864),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},S=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function G(e){return S(this,void 0,void 0,(function*(){var t,n;try{if(mi)try{return(yield Si("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),xi(e)}let o=[],i={};o=yield A.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<o.length;e++)r.includes(o[e].ofTheConceptId)||r.push(o[e].ofTheConceptId);let c=yield y.v.GetConcept(e);if(0==c.id){let t=yield function(e){var t=arguments;return L(this,void 0,void 0,(function*(){const n=vo.V.logfunction("TranslateLocalToReal",t);let o=(0,P.o)();try{var i=(0,d.ab)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetRealConceptById(),{method:"POST",headers:i,body:`id=${e}`});if(t.ok)return o=yield t.json(),o.id>0&&s.I.AddConcept(o),o;console.log("Error in Getting Translating concept Error",t.status),(0,h.ry)(t),vo.V.logUpdate(n)}catch(e){e instanceof Error?console.log("Error in Getting Translating concept error message: ",e):console.log("Error in Getting Translating concept unexpected error: ",e),(0,h.Mb)(e,l.B.GetRealConceptById()),(0,h.ey)(n,"TranslateLocalToReal",e)}return o}))}(e);if(t.id>0)return yield(0,v.Nj)(t.id)}let a=yield b(e,o,r);return i[null!==(n=null===(t=null==c?void 0:c.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=a,i}catch(e){throw e}}))}function _(e){return S(this,void 0,void 0,(function*(){var t,n;try{if(mi)try{return(yield Si("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),xi(e)}let o=[],i={},r={};o=yield A.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<o.length;e++)c.includes(o[e].ofTheConceptId)||c.push(o[e].ofTheConceptId);let a=yield y.v.GetConcept(e);if(0!=a.id){let r=yield b(e,o,c);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=r}return r.data=i,r.id=e,r}catch(e){throw e}}))}function b(e,t,n){return S(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c;let a={},s=[],l=yield y.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield y.v.GetConcept(e);l.type=t}if(null===(i=null==l?void 0:l.type)||void 0===i?void 0:i.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e);for(let o=0;o<t.length;o++)if(t[o].ofTheConceptId==e){let e=t[o].toTheConceptId,i=yield y.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield y.v.GetConcept(e);i.type=t}let l="the_",d=(null!==(c=null===(r=null==i?void 0:i.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace(l,"");if(isNaN(Number(d))){if(d){const o=yield b(e,t,n);a[d]=o}}else{const o=yield b(e,t,n);s[d]=o,a=s}}return a}))}var B=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function x(e,t){return B(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),xi(e)}try{let n=yield(0,m.Ay)(e),o=[];if(0!=n.id){let e=yield y.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield G(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}function R(e,t){return B(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),xi(e)}try{let n=yield(0,m.Ay)(e),o=[];if(0!=n.id){let e=yield y.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield _(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}var E=n(2),D=n(1218),F=n(999),W=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function U(e,t,n){var o=arguments;return W(this,arguments,void 0,(function*(e,t,n,i=10,r=1){const c=vo.V.logfunction("GetConnectionOfTheConcept",o)||{};let a=[];try{if(mi){c.serviceWorker=!0;try{const o=yield Si("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:n,inpage:i,page:r});return vo.V.logUpdate(c),o.data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),(0,h.ey)(c,"GetConnectionOfTheConcept",e),xi(e)}}let o=new URLSearchParams;o.append("typeId",`${e}`),o.append("ofTheConceptId",`${t}`),o.append("userId",`${n}`),o.append("inpage",`${i}`),o.append("page",`${r}`);let s=(0,d.Xr)("application/x-www-form-urlencoded");const u=yield fetch(l.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:s,body:o});return u.ok?a=yield u.json():((0,h.ey)(c,"GetConnectionOfTheConcept",u.status),(0,h.ry)(u),console.log("Get connection of concept error",u.status)),vo.V.logUpdate(c),a}catch(e){e instanceof Error?console.log("Get connection of concept error message: ",e.message):console.log("Get connection of concept unexpected error: ",e),(0,h.Mb)(e,l.B.GetAllConnectionsOfConceptUrl()),(0,h.ey)(c,"GetConnectionOfTheConcept",e)}}))}var O=n(2155),M=n(442),P=n(7282),V=n(5976),j=n(7273),$=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function H(e,t,n,o){return $(this,arguments,void 0,(function*(e,t,n,o,i=1,r=4){if(e>0&&n>0){var c=t,a=yield V.p.getId(),s=new O.N(a,e,n,c,o,i,r);return e==n?(s.ofTheConceptId=0,s.toTheConceptId=1,s):(s.toUpdate=!0,s.isTemp=!1,M.Y.AddConnection(s),s)}throw new j.z("cannot create connection because id are negative ",!1,400,"")}))}var J=n(1838),q=n(7876),z=n(8407),Q=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function X(e,t,n){return Q(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;if(mi)try{return(yield Si("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:n,both:o,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),xi(e)}let a=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Y(o,t,a));let s=yield(0,z.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,a,s.id,1e3,4);M.Y.AddConnection(l)}let s=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+s;i&&(yield Y(s,e,a));let d=yield(0,z.A)("connection",l,!1,999,999,999),h=new O.N(0,e.id,t.id,a,d.id,1e3,4);return M.Y.AddConnection(h),h}))}function Y(e,t){return Q(this,arguments,void 0,(function*(e,t,n=null){var o;let i=t,r=null!=n?n:t.userId,c=e+"_count",a=(null===(o=t.type)||void 0===o?void 0:o.characterValue)+"_s_"+c,s=yield(0,z.A)("connection",a,!1,r,4,999),l=yield U(s.id,t.id,r,10,1),d=[],h=(0,P.o)();for(let e=0;e<l.length;e++){let t=yield(0,q.A)(l[e].toTheConceptId);d.push(t)}if(d.length<1)h=yield(0,z.A)("count","1",!1,r,4,999);else{let e=d[0],t=0;try{t=Number(e.characterValue)}catch(e){t=0}t+=1,h=yield(0,z.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,J.m)(l[e].id)}let u=new O.N(0,i.id,h.id,i.userId,s.id,1e3,4);yield M.Y.AddConnection(u)}))}function Z(e,t,n){return Q(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;let a=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Y(o,t,a));let s=yield(0,z.A)("connection",c,!1,999,999,999),l=new O.N(0,t.id,e.id,a,s.id,1e3,4);M.Y.AddConnection(l)}let s=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+s;i&&(yield Y(s,e,a));let d=yield(0,z.A)("connection",l,!1,999,999,999);return yield H(e.id,e.userId,t.id,d.id,1e3,4)}))}var K=n(5868),ee=(n(3655),function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))});function te(e,t){const n=vo.V.logfunction("storeToDatabase",[e,"noindexdb"]);vo.V.logUpdate(n)}function ne(e,t,n){return ee(this,void 0,void 0,(function*(){const t=vo.V.logfunction("getFromDatabaseWithType",[e,"noindexdb"]);vo.V.logUpdate(t)}))}function oe(e){return ee(this,void 0,void 0,(function*(){const t=vo.V.logfunction("getObjectsFromIndexDb",[e,"noindexdb"]);vo.V.logUpdate(t)}))}var ie=n(1666),re=n(4402),ce=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ae(e,t){var n=arguments;return ce(this,arguments,void 0,(function*(e,t,o=10,i=1){var r;const c=vo.V.logfunction("GetLink",n)||{};if(mi){c.serviceWorker=!0;try{const n=yield Si("GetLink",{id:e,linker:t,inpage:o,page:i});return vo.V.logUpdate(c),n.data}catch(e){console.error("GetLink sw error: ",e),(0,h.ey)(c,"GetLink",e),xi(e)}}let a=[],s=yield(0,q.A)(e),l=(null===(r=s.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield U(d.id,s.id,s.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,v.Ez)(o.id);a.push(i)}}return vo.V.logUpdate(c),a}))}function se(e,t){var n=arguments;return ce(this,arguments,void 0,(function*(e,t,o=10,i=1){var r;const c=vo.V.logfunction("GetLinkRaw",n);let a=[],s=yield(0,q.A)(e),l=(null===(r=s.type)||void 0===r?void 0:r.characterValue)+"_s_"+t,d=yield(0,re.A)(l,16);if(d.id>0){let e=yield U(d.id,s.id,s.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n);a.push(o)}}return vo.V.logUpdate(c),a}))}var le=n(8357),de=n(2212);class he{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.isNew=l}}class ue{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new he(0,"0",0,0,0,0,0,0,"0",!1),n=0;n<this.characterData.length;n++)this.characterData[n].data==e&&(t=this.characterData[n]);return t}}ue.characterData=[];class pe{constructor(e,t,n,o){this.id=e,this.userId=t,this.referentId=n,this.isNew=o}}var fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},ye=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ve(e,t,n,o,i){return ye(this,void 0,void 0,(function*(){return new he(t,e,n,t,o,t,i,t,"",!1),yield function(){return fe(this,void 0,void 0,(function*(){var e;const t=vo.V.logfunction("CreateTheCharacter",e);try{if(0==(e=ue.GetCharacter(e.data)).id){var n=(0,d.Xr)();const i=yield fetch(l.B.CreateTheCharacterDataUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!i.ok)throw(0,h.ry)(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();var o=new he(r.userId,e.data,0,0,4,4,999,999,"",!1);return o.id=r.id,ue.AddCharacter(o),vo.V.logUpdate(t),r}return new pe(e.id,e.userId,0,!1)}catch(e){throw e instanceof Error?console.log("create the character error message: ",e.message):console.log("create the character unexpected error: ",e),(0,h.ey)(t,"CreateTheCharacter",e),e}}))}()}))}var ge=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function me(e,t,n,o,i,r,c){return ge(this,void 0,void 0,(function*(){let a=yield(0,re.A)(e,o),s=a;return 0==s.id&&(a=yield(0,de.Ay)(e,t,n,o,i,r,c),s=a),s}))}var Ce=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Te=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ie(e,t,n,o){var i=arguments;return Te(this,void 0,void 0,(function*(){const r=vo.V.logfunction("MakeTheTypeConcept",i)||{};if(mi){r.serviceWorker=!0;try{const i=yield Si("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:n,userId:o});return vo.V.logUpdate(r),i.data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),(0,h.ey)(r,"MakeTheTypeConcept",e),xi(e)}}let c=yield(0,g.A)(e);if(c&&(0==c.id||0==c.userId)){let i=(0,a.f)(e);if(i.length>0)if(i[0]==e){let n=yield function(e,t,n,o,i,r){return Ce(this,void 0,void 0,(function*(){let n;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ve(e,t,999,o,r),n=me(e,t,4,c,i,o,"the_character")}else{let i=yield ve(e,t,999,o,r);i.isNew,n=yield me(e,t,4,51,i.id,o,"the_characters")}return n}))}(e,o,0,999,0,t);c=n}else{let r=yield Ie(i[0],t,n,o),a=yield Ie(i[1],t,n,o);a&&(c=yield(0,de.N)(e,o,r.id,a.id,999,999,i[1]))}}return vo.V.logUpdate(r),c}))}var we=n(8146),ke=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ne=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ae(e){return Ne(this,void 0,void 0,(function*(){const t=vo.V.logfunction("GetConceptByCharacterAndCategory",e);let n=(0,P.o)();if("the"==e)return n.id=1,n.typeId=5,n.characterValue="the",n;let o=(0,a.f)(e);if(o.length>1){let t=1,i=yield Ae(o[0]);0!=i.id&&(t=i.id),n=yield function(e,t){var n=arguments;return Ne(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetConceptByCharacterAndCategoryFromMemory",n);let i=yield s.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==i.id&&(i=yield function(e,t){var n=arguments;return ke(this,void 0,void 0,(function*(){const o=vo.V.logfunction("GetConceptByCharacterAndCategoryDirectApi",n);let i=(0,P.o)();try{var r=(0,d.Xr)("application/x-www-form-urlencoded");const n=yield fetch(l.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:r,body:`character_value=${e}&category_id=${t}`});n.ok?(i=yield n.json(),s.I.AddConcept(i)):(console.log("This is the concept by category and character error",n.status),(0,h.ry)(n)),vo.V.logUpdate(o)}catch(e){e instanceof Error?console.log(" This is the concept by category and character error message: ",e.message):console.log(" This is the concept by category and character unexpected error: ",e),(0,h.Mb)(e,l.B.GetConceptByCharacterAndCategoryDirectUrl()),(0,h.ey)(o,"GetConceptByCharacterAndCategoryDirectApi",e)}return i}))}(e,t)),vo.V.logUpdate(o),i}))}(e,t)}else o[0]==e&&(n=yield function(e){var t=arguments;return Ne(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConceptByCharacter",t);let o=yield s.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==o.id&&(o=yield(0,we.Y)(e)),vo.V.logUpdate(n),o}))}(e));return vo.V.logUpdate(t),n}))}var Le=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const Se=new Map;function Ge(e,t){var n=arguments;return Le(this,void 0,void 0,(function*(){const t=vo.V.logfunction("MakeTheTypeConceptApi",n);let o=(0,P.o)();if(Se.has(e))return Se.get(e)||o;const i=(()=>Le(this,void 0,void 0,(function*(){try{if(o=yield Ae(e),0==o.id||4==o.typeId){let n=(0,d.Xr)("application/x-www-form-urlencoded");const i=yield fetch(l.B.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${e}`});if(!i.ok)throw(0,h.ry)(i),new Error(`Error! status: ${i.status}`);let r=yield i.json();o=r,vo.V.logUpdate(t)}}catch(e){e instanceof Error?console.log("Make The Type Concept Api error : ",e.message):console.log("Make The Type Concept Api error : ",e),(0,h.Mb)(e,l.B.MakeTheTypeConceptUrl()),(0,h.ey)(t,"MakeTheTypeConceptApi",e)}finally{Se.delete(e)}return o})))();return Se.set(e,i),i}))}var _e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function be(e){var t=arguments;return _e(this,void 0,void 0,(function*(){vo.V.logfunction("GetAllLinkerConnectionsFromTheConcept",t);var n=[];try{(new Date).getTime();var o=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:o});if(t.ok){const e=yield t.json();for(var i=0;i<e.length;i++){var r=e[i];n.push(r)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,h.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection from the concepts error: ",e.message):console.log("Get all linker connection from the concepts error(Unexpected): ",e),(0,h.Mb)(e,l.B.GetAllLinkerConnectionOfConceptUrl())}return n}))}var Be=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xe(e){var t=arguments;return Be(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetAllLinkerConnectionsToTheConcept",t);var o=[];try{(new Date).getTime();var i=(0,d.Xr)("application/x-www-form-urlencoded");const t=yield fetch(l.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:i});if(t.ok){const e=yield t.json();for(var r=0;r<e.length;r++){var c=e[r];o.push(c)}vo.V.logUpdate(n)}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,h.ry)(t)}catch(e){e instanceof Error?console.log("Get all linker connection To the concepts error: ",e.message):console.log("Get all linker connection To the concepts error(Unexpected): ",e),(0,h.Mb)(e,l.B.GetAllLinkerConnectionToConceptUrl()),(0,h.ey)(n,"GetAllLinkerConnectionsToTheConcept",e)}return o}))}var Re=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ee(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetLinkerConnectionFromConcepts",t);let o=yield be(e);for(let e=0;e<o.length;e++){let t=o[e],n=t.typeId,i=yield(0,q.A)(n);t.type=i}return vo.V.logUpdate(n),o}))}function De(e){var t=arguments;return Re(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetLinkerConnectionToConcepts",t);let o=yield xe(e);for(let e=0;e<o.length;e++){let t=o[e],n=t.typeId,i=yield(0,q.A)(n);t.type=i}return vo.V.logUpdate(n),o}))}var Fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},We=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ue=n(6963),Oe=n(2202),Me=n(5457),Pe=n(991),Ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function je(e){var t=arguments;return Ve(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteConceptById",t);if(mi)try{return(yield Si("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),xi(e)}if(e>0){var o=yield s.I.GetConcept(e);if(o.id>0){var i=o.typeId,r=o.characterValue;yield Me.c.removeTypeConcept(i,e),yield Ue.f.removeNodeByCharacter(r,e),yield function(e){var t=arguments;return We(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteTheConcept",t);try{const t=new FormData;t.append("id",e.toString());let o=(0,d.BZ)();const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",headers:o,body:t});i.ok||(console.log("Delete concept error",i.status),(0,h.ry)(i)),vo.V.logUpdate(n)}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl()),(0,h.ey)(n,"DeleteTheConcept",e)}}))}(e),yield Oe.W.removeNodeFromTree(e),yield Pe.H.removeNodeFromTree(e)}}else y.v.RemoveConceptById(e);vo.V.logUpdate(n)}))}function $e(e){return Ve(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),xi(e)}e>0?function(e){var t=arguments;Fe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("DeleteUserInBackend",t);try{var o=(0,d.ab)("application/json","");let t=l.B.DeleteUserUrl();t=t+"?conceptId="+e+"&apiKey=freeschema";const i=yield fetch(t,{method:"POST",headers:o});if(i.ok){let e=yield i.json(),t=Number(e.data);return console.log("this is the delete email concept",t),je(t),vo.V.logUpdate(n),t}throw(0,h.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl()),(0,h.ey)(n,"DeleteUserInBackend",e)}}))}(e):y.v.RemoveConceptById(e)}))}var He=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Je(e,t){return He(this,void 0,void 0,(function*(){try{const n=new Headers;n.append("Authorization","Bearer "+t);const o=new FormData;o.append("id",e.toString());const i=yield fetch(l.B.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw(0,h.ry)(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,h.Mb)(e,l.B.DeleteConceptUrl())}}))}var qe=n(1735),ze=n(8286),Qe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Xe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ye(e){var t=arguments;return Xe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConnectionById",t);if(console.log("AccessTracker activation status from GetConnectionById"),!0===qe.J.activateStatus)try{qe.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),vo.V.log("ERROR","Error Adding Connection")}if(mi)try{return(yield Si("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),xi(e)}let o=yield ze.d.GetConnection(e);if((null==o||0==o.id)&&null!=e&&null!=e){let t=yield function(e){var t=arguments;return Qe(this,void 0,void 0,(function*(){const n=vo.V.logfunction("GetConnection",t);let o=yield ze.d.GetConnection(e);try{if(0!=o.id)return o;{let t=(0,d.Xr)("application/x-www-form-urlencoded");const i=new FormData;i.append("id",e.toString());const r=yield fetch(l.B.GetConnectionUrl(),{method:"POST",headers:t,body:i});return r.ok?(o=yield r.json(),ze.d.AddConnection(o)):((0,h.ry)(r),console.log("Get Connection Error",r.status)),vo.V.logUpdate(n),o}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,h.Mb)(e,l.B.GetConnectionUrl()),(0,h.ey)(n,"GetConnection",e)}}))}(e);o=t}return vo.V.logUpdate(n),o}))}var Ze=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ke(e,t,n){return Ze(this,arguments,void 0,(function*(e,t,n,o=4,i=999){const r=vo.V.logfunction("MakeTheTimestamp")||{};if(mi){r.serviceWorker=!0;try{const c=yield Si("MakeTheTimestamp",{type:e,referent:t,userId:n,accessId:o,sessionInformationId:i});return vo.V.logUpdate(r),c.data}catch(e){console.error("MakeTheTimestamp sw error: ",e),(0,h.ey)(r,"MakeTheTimestamp",e),xi(e)}}let c,a="",s=e.startsWith("the_"),l=(0,P.o)();return a=s?e:"the_"+e,l=yield Ge(a,n),c=yield me(t,n,4,l.id,0,o,a),vo.V.logUpdate(r),c}))}class et{constructor(){this.composition=0,this.type="",this.linker="",this.inpage=10,this.page=1,this.listLinkers=[],this.fullLinkers=[],this.textSearch="",this.logic="or",this.reverse=!1,this.doFilter=!1,this.filterSearches=[],this.selectors=[],this.ofCompositions=[]}}var tt=n(6687),nt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ot(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApi",e)||{};let r=[];try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApi",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApi sw error: ",e),(0,h.ey)(i,"RecursiveSearchApi",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let c=JSON.stringify(e),a=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:a,body:c});if(s.ok){const e=yield s.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,r=yield(0,tt.p8)(t,n)}else console.log("recursive search error ",s.status),(0,h.ey)(i,"RecursiveSearchApi",s.status),(0,h.ry)(s);vo.V.logUpdate(i)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"RecursiveSearchApi",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function it(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiWithInternalConnections",e)||{};let r=[];try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiWithInternalConnections",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiWithInternalConnections",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let c=JSON.stringify(e),a=(0,d.Xr)();const s=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:a,body:c});if(s.ok){const e=yield s.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,r=yield(0,tt.km)(t,n),vo.V.logUpdate(i)}else console.log("recursive search error ",s.status),(0,h.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",s.status),(0,h.ry)(s)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"GetCompositionConnectionsBetweenTwoConcepts",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}return r}))}function rt(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRaw",e)||{};try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiRaw",{composition:t,listLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiRaw",e),xi(e)}}let e=new et;e.composition=t,e.listLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiRaw",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.ey)(i,"RecursiveSearchApiRaw",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl())}}))}function ct(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRawFullLinker",e)||{};try{if(mi){i.serviceWorker=!0;try{const e=yield Si("RecursiveSearchApiRawFullLinker",{composition:t,fullLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",e),xi(e)}}let e=new et;e.composition=t,e.fullLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl()),(0,h.ey)(i,"RecursiveSearchApiRawFullLinker",e)}}))}function at(){var e=arguments;return nt(this,arguments,void 0,(function*(t=0,n=[],o=""){const i=vo.V.logfunction("RecursiveSearchApiRawFullLinker",e)||{};try{if(mi)try{i.serviceWorker=!0;const e=yield Si("RecursiveSearchApiNewRawFullLinker",{composition:t,fullLinkers:n,textSearch:o});return vo.V.logUpdate(i),e.data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",e),xi(e)}let e=new et;e.composition=t,e.fullLinkers=n,e.textSearch=o;let r=JSON.stringify(e),c=(0,d.Xr)();const a=yield fetch(l.B.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(a.ok){const e=yield a.json();return e.compositionIds,e.internalConnections,e.externalConnections,vo.V.logUpdate(i),e}return console.log("recursive search error ",a.status),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",a.status),(0,h.ry)(a),vo.V.logUpdate(i),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,h.Mb)(e,l.B.RecursiveSearchUrl()),(0,h.ey)(i,"RecursiveSearchApiNewRawFullLinker",e)}}))}var st=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const lt=["image/jpeg","image/jpg","image/png","image/webp"],dt=["application/msword","application/vnd.ms-excel","application/vnd.ms-powerpoint","text/plain","application/pdf"];function ht(e,t){return st(this,void 0,void 0,(function*(){const n=vo.V.logfunction("uploadAttachment");try{console.log("File Type",e.type);const o=new FormData;let i;if(dt.includes(e.type))o.append("file",e,e.name),i=yield pt(o,t);else{if(!lt.includes(e.type))return{message:"Invalid File Format",success:!1};o.append("image",e,e.name),i=yield ut(o,t)}return(null==i?void 0:i.data)?(vo.V.logUpdate(n),{message:"Upload Success",success:!0,url:i.data}):{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),(0,h.ey)(n,"uploadAttachment",e),e}}))}function ut(e){return st(this,arguments,void 0,(function*(e,t=""){const n=vo.V.logfunction("uploadImage");try{const o=yield fetch(l.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!o.ok){const e=o.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==o?void 0:o.text());const t=yield null==o?void 0:o.text();return console.error(`${o.status} ${t}`),vo.V.logUpdate(n),null}return yield o.json()}catch(e){return console.error(e),(0,h.ey)(n,"uploadImage",e),null}}))}function pt(e){return st(this,arguments,void 0,(function*(e,t=""){const n=vo.V.logfunction("uploadFile");try{const o=yield fetch(l.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!o.ok){const e=o.headers.get("content-type");e&&e.includes("text/plain")&&console.info(o.text());const t=yield o.text();return console.error(`${o.status} ${t}`),null}return vo.V.logUpdate(n),yield o.json()}catch(e){return console.error(e),(0,h.ey)(n,"uploadFile",e),null}}))}var ft=n(1239),yt=n(7467),vt=n(3278),gt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function mt(e,t){var n=arguments;return gt(this,void 0,void 0,(function*(){const o=vo.V.logfunction("LoginToBackend",n);try{let n={email:e,password:t},i=new Headers;i.append("Content-Type","application/json");let r=JSON.stringify(n);const c=yield fetch(l.B.LoginUrl(),{method:"POST",headers:i,body:r}),a=yield c.json();if(c.ok)return vt.b.BearerAccessToken=a.data.token,vo.V.logUpdate(o),a;console.log("Login tsccs error message: ",c.status),(0,h.ER)(c,a)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,h.Mb)(e,l.B.LoginUrl()),(0,h.ey)(o,"LoginToBackend",e)}}))}var Ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Tt(e){return Ct(this,void 0,void 0,(function*(){const t=yield function(){return Ct(this,arguments,void 0,(function*(e="",t={}){let n={message:"success",status:!1,statusCode:200,data:"cannot signup"};try{const o=yield fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(t)}),i=yield o.json();return o.ok?n={message:"success",status:!0,statusCode:200,data:i}:(0,h.ER)(o,i),n}catch(t){console.log("Signup Error: ",t),(0,h.Mb)(t,e)}}))}(l.B.SignupUrl(),e);return t}))}function It(e){return Ct(this,void 0,void 0,(function*(){const t=l.B.NODE_URL,n=yield fetch(`${t}/api/v1/entity/signup`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok)return n.json();if(404===n.status)throw new Error("404, Not found");if(500===n.status)throw new Error("500, internal server error");throw new Error(n.status)}))}var wt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function kt(e){return wt(this,void 0,void 0,(function*(){const t=JSON.stringify({email:e.email,password:e.password});let n={message:"success",status:!1,statusCode:200,data:""};const o=new Headers;o.append("Content-Type","application/json");const i=l.B.LoginUrl();try{const e=yield fetch(i,{method:"POST",headers:o,body:t,redirect:"follow"}),r=yield e.json();return e.ok?n={message:"success",status:!0,statusCode:200,data:null==r?void 0:r.data}:(0,h.ER)(e,r),n}catch(e){console.log("Sign in api error",e),(0,h.Mb)(e,i)}}))}var Nt=n(9934),At=n(4485);function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function St(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class Gt{constructor(e,t,n,o){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=o}isValid(){const e=new Date(Date.now());return!(this.expiryTime<e&&(bt.removeNodeFromTree(this.key),1))}saveToCache(e){this.value.cached=e}addNode(e,t,n){if(null==t)return e;const o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return this.isValid(),e;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));const r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return this.isValid(),t}rightRotate(e){if(e){const t=e.leftNode;if(t){const n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){const t=e.rightNode;if(t){const n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key&&t.isValid()?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){const t=e.rightNode;return e=null,t}if(null==e.rightNode){const t=e.leftNode;return e=null,t}{const t=this.inOrderSuccessor(e.rightNode);return e.value=t.value,e.key=t.key,e.rightNode=this.removeNode(e.rightNode,t.key),e}}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var _t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class bt{static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static addCompositionToTree(e){const t=new Gt(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return _t(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return _t(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}bt.root=null;var Bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xt(e,t,n,o){return Bt(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c;let a={};const l=[];if(0==e)return"";let d=Rt(n,e);if(null!=d&&0!=d.id||null==e||null==e||(d=yield(0,q.A)(e)),0!=d.id&&null==d.type){const e=d.typeId;let t=Rt(n,e);d.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,q.A)(e),d.type=t)}if(!o.includes(e))return null==d?void 0:d.characterValue;if(i.includes(e))return"";i.push(e);for(let d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){const h=t[d].toTheConceptId;if(o.includes(e)){let e=Rt(n,h);if(null!=e&&0!=e.id||null==h||null==h||(e=yield(0,q.A)(h)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield s.I.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield(0,q.A)(t),e.type=n)}const d="the_",u=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(d,"");if(isNaN(Number(u))){if(u){const e=yield xt(h,t,n,o,i);a[u]=e}}else{const e=yield xt(h,t,n,o,i);l[u]=e,a=l}}}return a}))}function Rt(e,t){let n=(0,P.o)();for(let o=0;o<e.length;o++)if(t==e[o].id)return n=e[o],n;return n}class Et{constructor(){this.id=0,this.mainConcept=(0,P.o)(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return e=this,t=void 0,o=function*(){if(0==this.mainConcept.id)for(let e=0;e<this.concepts.length;e++)this.concepts[e].id==this.id&&(this.mainConcept=this.concepts[e]);this.cached=yield xt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&(t=null===(e=this.id)||void 0===e?void 0:e.toString(),l.B.MQTT_CONNECTION&&l.B.MQTT_CONNECTION.publish("compositionUpdate",t))}catch(e){console.log("Error while publishing message",e)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var e,t,n;const o={};o[null!==(n=null===(t=null===(e=this.mainConcept)||void 0===e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=this.cached;const i={};return i.data=o,i.id=this.id,i}}var Dt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ft(e){return Dt(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,a=null){const s=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let h=null!=o?o:0,u=(0,P.o)();null==a&&(a=new Et);for(const o in e)if("object"==typeof e[o]||Array.isArray(e[o])){const p=yield(0,z.A)(o,"",!0,s,l,d);if(null==t&&null==n){let t=h;u=p,t=p.id,h=p.id,a.concepts.push(p),a.id=p.id,yield Ft(e[o],p.id,p.userId,t,i,r,c,a)}else{const s=null!=t?t:999,l=null!=n?n:999,d=h;u=p,a.concepts.push(p);const f=yield(0,ie.q)(s,l,p.id,d);a.connections.push(f),yield Ft(e[o],p.id,p.userId,d,i,r,c,a)}null!=e[o]&&null!=e[o]&&a.subcompositions.push(p.id)}else{const i=null!=t?t:999,r=null!=n?n:999,c=h,u=yield(0,z.A)(o,e[o],!1,s,l,d);a.concepts.push(u);const p=yield(0,ie.q)(i,r,u.id,c);a.connections.push(p)}return u}))}var Wt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ut(e){return Wt(this,void 0,void 0,(function*(){const t=vo.V.logfunction("UpdateComposition")||{};if(mi){t.serviceWorker=!0;try{const n=yield Si("UpdateComposition",{patcherStructure:e});return vo.V.logUpdate(t),n.data}catch(e){console.error("UpdateComposition sw error: ",e),(0,h.ey)(t,"UpdateComposition",e),xi(e)}}const n=e.userId,o=e.sessionId,i=e.accessId;let r=[];const c=[];let a=(0,P.o)(),s=(0,P.o)();const l=[];let d=e.compositionId;const u=e.ofTheCompositionId;let p=[];if(d<0){let e=yield(0,q.A)(d,n);if(!(e.id>0))return null;d=e.id}r=yield(0,E.s)(d);const f=[],y=new Et,v=[];y.id=d,y.isUpdating();let g=[];for(let e=0;e<r.length;e++)(0,Nt.A)(v,r[e].ofTheConceptId),(0,Nt.A)(f,r[e].ofTheConceptId),(0,Nt.A)(f,r[e].toTheConceptId),g.push(r[e].ofTheConceptId);y.subcompositions=v,y.connections=r;for(let e=0;e<f.length;e++){const t=yield(0,q.A)(f[e]);d==f[e]&&(a=t),u==f[e]&&(s=t),c.push(t)}const m=e.patchObject;for(const e in m){let t=(0,P.o)();const r=m[e];let d=a;if(s.id>0&&(d=s),Array.isArray(r)||"object"==typeof r){t=yield(0,z.A)(e,"",!0,a.userId,4,999),y.subcompositions.push(t.id);const n=(0,At.vo)(c,t);for(let e=0;e<n.length;e++)if(n[e].id>0){const t=(0,At.wS)(y.connections,n[e].id);p=p.concat(t),l.push(n[e])}yield Ft(m[e],t.id,t.userId,a.id,a.userId,4,999,y)}else{t=yield(0,z.A)(e,r,!1,n,i,o);const a=(0,At.vo)(c,t);for(let e=0;e<a.length;e++)if(a[e].id>0){const t=(0,At.wS)(y.connections,a[e].id);p=p.concat(t),l.push(a[e])}}const h=(0,ie.q)(d.id,d.userId,t.id,a.id);c.push(t),y.connections.push(h)}for(let e=0;e<p.length;e++)St(y.connections,p[e]),(0,J.m)(p[e].id);for(let e=0;e<l.length;e++)Lt(c,l[e]);y.concepts=y.concepts.concat(c),y.mainConcept=a,y.id=a.id,yield y.updateCache(),bt.addCompositionToTree(y),M.Y.SyncDataOnline();let C=y.GetDataCache();return vo.V.logUpdate(t),C}))}var Ot=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Mt(e,t,n,o){return Ot(this,arguments,void 0,(function*(e,t,n,o,i=10,r=1){var c=(0,d.ab)("application/x-www-form-urlencoded",o),a=new URLSearchParams;a.append("type",e),a.append("search",t),a.append("composition",n),a.append("inpage",i.toString()),a.append("page",r.toString());const s=l.B.SearchCompositionsUrl()+"?"+a.toString();try{const e=yield fetch(s,{method:"GET",headers:c});return e.ok?yield e.json():((0,h.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,h.Mb)(e,s)}}))}var Pt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Vt(e){return Pt(this,arguments,void 0,(function*(e,t=""){var n=(0,d.ab)("application/json",t);const o=l.B.SearchLinkMultipleAll(),i=JSON.stringify(e);try{const e=yield fetch(o,{method:"POST",headers:n,body:i});return e.ok?yield e.json():(console.log("This is the searching error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching error",e),(0,h.Mb)(e,o)}}))}var jt=n(7139),$t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ht(e){return $t(this,arguments,void 0,(function*(e,t=[]){var n,o;let i=[];const r=[];let c={},a={};const l=yield bt.getNodeFromTree(e),d=[];let h=yield s.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,jt.r)(e)),null==l){let s=[];s=t.length>0?Jt(e,t):yield(0,E.s)(e),i=s;for(let e=0;e<i.length;e++)d.includes(i[e].ofTheConceptId)||(d.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);Qt(h,i,r,d);let l=[];a=yield(0,v.zN)(e,i,d,l),c[null!==(o=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a}else a=l.value.GetDataCache(),c=a;return 0==h.id?"":c}))}function Jt(e,t){const n=[];for(let o=0;o<t.length;o++)t[o].typeId==e&&n.push(t[o]);return n}function qt(e){return $t(this,arguments,void 0,(function*(e,t=[]){var n,o;let i={},r=[];const c=[];let a;const l={},d=yield bt.getNodeFromTree(e),h=[];let u=yield s.I.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield(0,jt.r)(e)),null==d){let s=[];s=t.length>0?Jt(e,t):yield(0,E.s)(e),r=s;for(let e=0;e<r.length;e++)h.includes(r[e].ofTheConceptId)||(h.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);Qt(u,r,c,h),a=yield(0,v.zN)(e,r,h),l[null!==(o=null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a,i.created_at=u.entryTimeStamp,i.data=l,i.id=e}else a=d.value.GetDataCache(),i=a;return 0==u.id?"":i}))}function zt(e,t){return $t(this,void 0,void 0,(function*(){let n=[];const o=[];n=yield(0,yt.j)(t);for(let t=0;t<e.length;t++){const i=yield qt(e[t],n);i&&o.push(i)}return o}))}function Qt(e,t,n,o){return $t(this,void 0,void 0,(function*(){const i=new Et,r=yield function(e){return $t(this,void 0,void 0,(function*(){let t=[];const n=[];for(let o=0;o<(null==e?void 0:e.length);o++){const i=yield s.I.GetConcept(e[o]);0==i.id?n.push(e[o]):t.push(i)}return 0==(null==n?void 0:n.length)||(t=yield(0,ft.I)(n)),t}))}(n);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=o,i.mainConcept=e;const c=yield xt(e.id,t,r,o,[]);i.cached=c,bt.addCompositionToTree(i)}))}var Xt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Yt(e){return Xt(this,void 0,void 0,(function*(){try{var t=(0,d.Xr)();const n=JSON.stringify(e),o=yield fetch(l.B.CreateSessionId(),{method:"POST",headers:t,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),(0,h.ry)(o),null)}catch(e){console.log("Creating session failed",e),(0,h.Mb)(e,l.B.CreateSessionId())}}))}var Zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Kt(e,t){return Zt(this,void 0,void 0,(function*(){try{var n=(0,d.Xr)("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",e.toString()),o.append("url",t);const i=yield fetch(l.B.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,h.ry)(i),null)}catch(e){console.log("Creating session url failed",e),(0,h.Mb)(e,l.B.CreateSessionVisitUrl())}}))}var en=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function tn(e,t){var n=arguments;return en(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetRelation",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetRelation",{id:e,relation:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetRelation error sw: ",e),(0,h.ey)(r,"GetRelation",e),xi(e)}}let c=[],a=yield(0,q.A)(e),s=yield Ae(t);if(s.id>0){let e=yield U(s.id,a.id,a.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,f.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,v.Ez)(o.id);c.push(i)}}return vo.V.logUpdate(r),c}))}function nn(e,t){var n=arguments;return en(this,arguments,void 0,(function*(e,t,o=10,i=1){const r=vo.V.logfunction("GetRelationRaw",n)||{};if(mi){r.serviceWorker=!0;try{const n=yield Si("GetRelationRaw",{id:e,relation:t,inpage:o,page:i});return vo.V.logUpdate(r),n.data}catch(e){console.error("GetRelationRaw error sw: ",e),(0,h.ey)(r,"GetRelationRaw",e),xi(e)}}let c=[],a=yield(0,q.A)(e),s=yield Ae(t);if(s.id>0){let e=yield U(s.id,a.id,a.userId,o,i),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n);c.push(o)}}return vo.V.logUpdate(r),c}))}var on=n(6416),rn=n(4711);class cn{constructor(e,t,n,o){this.value=[],this.height=1,this.key=e,this.value.push(t),this.leftNode=n,this.rightNode=o}addNode(e,t,n){if(null==t)return e;var o=t.leftNode,i=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,o,n);else{if(!(t.key<e.key))return t.value.push(...e.value),t;t.rightNode=this.addNode(e,i,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let r=this.getBalanceFactor(t);if(r>1&&t.leftNode){if(e.key<t.leftNode.key)return this.rightRotate(t);if(e.key>t.leftNode.key)return t.leftNode=this.leftRotate(t.leftNode),this.rightRotate(t)}if(r<-1&&t.rightNode){if(e.key>t.rightNode.key)return this.leftRotate(t);if(e.key<t.rightNode.key)return t.rightNode=this.rightRotate(t.rightNode),this.leftRotate(t)}return t}rightRotate(e){if(e){let t=e.leftNode;if(t){let n=t.rightNode;return e.leftNode=n,t.rightNode=e,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,t}}return e}leftRotate(e){if(e){let t=e.rightNode;if(t){let n=t.leftNode;return t.leftNode=e,e.rightNode=n,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(e.rightNode))+1,t}}return e}getHeight(e){return e?e.height:0}getBalanceFactor(e){return null==e?0:this.getHeight(e.leftNode)-this.getHeight(e.rightNode)}getFromNode(e,t){return t?e==t.key?t:e<t.key?this.getFromNode(e,t.leftNode):e>t.key?this.getFromNode(e,t.rightNode):t:t}removeNode(e,t){if(null==e)return e;if(e.key>t)return e.leftNode=this.removeNode(e.leftNode,t),e;if(e.key<t)return e.rightNode=this.removeNode(e.rightNode,t),e;if(null==e.leftNode){let t=e.rightNode;return e=null,t}if(null==e.rightNode){let t=e.leftNode;return e=null,t}var n=this.inOrderSuccessor(e.rightNode);return e.value=n.value,e.key=n.key,e.rightNode=this.removeNode(e.rightNode,n.key),e}countNodeBelow(e){return null==e?0:1+this.countNodeBelow(e.leftNode)+this.countNodeBelow(e.rightNode)}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var an=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class sn{static compositeKey(e,t){return("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+t.toString(16).toUpperCase()).slice(-4)}static addNodeToTree(e){if(null==this.root)return this.root=e,this.root;this.root=this.root.addNode(e,this.root,this.root.height)}static waitForDataToLoad(){return an(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(r.B.isDataLoaded)return e("done");setTimeout(sn.checkFlag,1e3,e)}static addConceptToTree(e,t,n=999){let o=this.compositeKey(t,n);var i=new cn(o,e,null,null);this.addNodeToTree(i)}static getNodeFromTree(e,t){return an(this,void 0,void 0,(function*(){let n=this.compositeKey(e,t);return this.root?this.root.getFromNode(n,this.root):null}))}static removeNodeFromTree(e){return an(this,arguments,void 0,(function*(e,t=999){if(this.root){let n=this.compositeKey(e,t);this.root=this.root.removeNode(this.root,n)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}sn.root=null;var ln=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function dn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){let o=yield sn.getNodeFromTree(e,n),i=(0,on.u)();if(o)for(let e=0;e<o.value.length;e++){let n=o.value[e];n.ghostId==t&&(i=n)}return i}))}function hn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){sn.addConceptToTree(e,t,n)}))}var un=n(5312),pn=n(1213),fn=n(3729),yn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function gn(e,t,n){return vn(this,void 0,void 0,(function*(){try{if(mi)try{return(yield Si("GetRelationLocal",{id:e,relation:t,userId:n})).data}catch(e){console.error("GetRelationLocal error sw: ",e),xi(e)}let o=yield(0,m.$I)(t),i=[];0!=o.id&&(i=yield function(e,t){return yn(this,void 0,void 0,(function*(){try{return yield A.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,o.id));let r=[];for(let e=0;e<i.length;e++){let t=yield G(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Cn(e){return mn(this,void 0,void 0,(function*(){let t=[];try{var n=(0,d.Xr)();const o=yield fetch(l.B.ViewInternalDataUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(o.ok){let e=yield o.json(),n={};for(let o=0;o<e.length;o++){let i=e[o].concepts;t=e[o].connections;let r=e[o].id;(0,ft.r)(i),n[r]=t}return n}return console.log("View Internal Data error",o.status),(0,h.ry)(o),t}catch(e){throw e instanceof Error?console.log(" This is the view internal data error message: ",e.message):console.log(" This is the view internal data unexpected error: ",e),e}}))}var Tn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function In(e){return Tn(this,void 0,void 0,(function*(){var t;try{let n=yield Cn(e),o=[];for(let i=0;i<e.length;i++){let r=e[i],c=n[r];if(r&&c){let e=[],t={};for(let t=0;t<c.length;t++)e.includes(c[t].ofTheConceptId)||e.push(c[t].ofTheConceptId);let n=yield(0,v.zN)(r,c,e);t.data=n,t.id=r,o.push(t)}else{let e={};e.id=r;let n=yield(0,q.A)(r),i={};n.type&&(i[null===(t=null==n?void 0:n.type)||void 0===t?void 0:t.characterValue]=n.characterValue,e.data=i,o.push(e))}}return o}catch(e){throw e}}))}var wn=n(176),kn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Nn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function An(e){return Nn(this,arguments,void 0,(function*(e,t=""){try{let n=yield function(e){return kn(this,arguments,void 0,(function*(e,t=""){var n=(0,d.ab)("application/json",t);let o=l.B.SearchInternalWithAuthenticatedCcsUrl();o=o+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(o,{method:"GET",headers:n});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,h.Mb)(e,o)}}))}(e,t);return yield In(n)}catch(e){throw e}}))}function Ln(e){return Nn(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return kn(this,void 0,void 0,(function*(){var t=(0,d.ab)("application/json","");let n=l.B.SearchInternalWithCcsUrl();n=n+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(n,{method:"GET",headers:t});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),(0,h.ry)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,h.Mb)(e,n)}}))}(e)}catch(e){throw e}}))}var Sn=n(8095),Gn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function _n(e){return Gn(this,void 0,void 0,(function*(){if(mi)try{return(yield Si("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),xi(e)}let t=yield(0,pn.f)(e);y.v.RemoveConcept(t)}))}var bn=n(2803),Bn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xn(e,t,n,o){return Bn(this,arguments,void 0,(function*(e,t,n,o,i=!0){var r,c;const a=vo.V.logfunction("GetConnectionBetweenTwoConceptsLinker")||{};if(mi){a.serviceWorker=!0;try{const r=yield Si("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:n,fullLinker:o,forward:i});return vo.V.logUpdate(a),r.data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),(0,h.ey)(a,"GetConnectionBetweenTwoConceptsLinker",e),xi(e)}}let s=(0,P.o)();if(""!=n){let o="";o=i?(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s_"+n+"_s":(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s_"+n+"_by",s=yield(0,z.A)("connection",o,!1,999)}""!=o&&(s=yield Ge(o,999));let l=[];return l=i?yield(0,bn.x)(e.id,t.id,s.id):yield(0,bn.x)(t.id,e.id,s.id),vo.V.logUpdate(a),l}))}function Rn(e,t){return new Promise(((n,o)=>{setTimeout((()=>{n(t)}),e)}))}var En=n(3130);const Dn=3,Fn=4,Wn=5;var Un=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function On(e,t){return Un(this,arguments,void 0,(function*(e,t,n=""){let o=l.B.SearchAllTypeWithLinker(e.auth);var i=(0,d.ab)("application/json",n);o=o+"?search="+e.search+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;const r=JSON.stringify(t);try{const e=yield fetch(o,{method:"POST",headers:i,body:r});return e.ok?yield e.json():((0,h.ry)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,h.Mb)(e,o)}}))}var Mn=n(4287);class Pn extends Mn.w{constructor(e,t,n=En.y0){super(),this.searchQuery=[],this.format=En.y0,this.searchQuery=e,this.format=n}bind(){return e=this,t=void 0,o=function*(){return this.data=yield(0,un.cf)(this.searchQuery,"",this,this.format),this.mainConcept=this.searchQuery[0].composition,this.listenToEvent(this.mainConcept),console.log("this is the data",this.data),this.data},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}}function Vn(e,t,n=En.y0){return new Pn(e,null!=t?t:"",n)}var jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class $n extends Mn.w{constructor(e,t=En.ZJ){super(),this.id=e,this.format=t}bind(){return jn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,v.hL)(this.id);this.mainConcept=this.id,this.compositionIds=e.compositionList;let t=e.connectionList;for(let e=0;e<t.length;e++)this.internalConnections.push(t[e].id);this.isDataLoaded=!0,this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return jn(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let n=0;n<t.length;n++)e.push(yield ze.d.GetConnection(t[n]));return this.format==En.ZJ?this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds):this.format==En.y0?this.data=yield(0,v.$V)(this.mainConcept,e,this.compositionIds):this.format==En.yv?this.data=yield(0,v.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,v.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function Hn(e,t=En.ZJ){return new $n(e,t)}var Jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class qn extends Mn.w{constructor(e,t,n,o,i){super(),this.data=[],this.startPage=0,this.compositionName=e,this.userId=t,this.inpage=n,this.page=o,this.format=i}bind(){return Jn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){var e=yield(0,g.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId);let o=yield s.I.GetConceptsByTypeIdAndUser(e.id,this.userId);for(var t=this.inpage*(this.page-1),n=t;n<t+this.inpage;n++)o[n]&&this.compositionIds.push(o[n].id)}yield(0,f.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return Jn(this,void 0,void 0,(function*(){if(this.data=[],this.format==En.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==En.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==En.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.XI)(this.compositionIds[e]);this.data.push(t)}}else for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,v.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function zn(e,t,n,o,i=En.ZJ){return new qn(e,t,n,o,i)}var Qn=n(7106),Xn=n(5328),Yn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Zn extends Mn.w{constructor(e,t,n="",o){super(),this.searchText="",this.connections=[],this.externalConnectionIds=[],this.data=[],this.mainConcept=e,this.searchLinkers=t,this.textSearch=n,o&&(this.format=o)}listenToEvent(e){window.addEventListener(`${e}`,(t=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return Yn(this,void 0,void 0,(function*(){let n=yield ze.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield ze.d.GetConnection(n[e]).then((e=>{e.typeId==t.mainConcept?t.internalConnections.includes(e.id)||t.internalConnections.push(e.id):t.linkers.includes(e.id)||t.linkers.push(e.id),t.conceptIds.includes(e.toTheConceptId)||t.conceptIds.push(e.toTheConceptId),t.compositionIds.includes(e.ofTheConceptId)||t.compositionIds.push(e.ofTheConceptId),t.compositionIds.includes(e.toTheConceptId)||t.compositionIds.push(e.toTheConceptId)}));t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return Yn(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;const e=yield rt(this.mainConcept,this.searchLinkers,this.textSearch);this.compositionIds=e.compositionIds||[],this.internalConnections=e.internalConnections||[],this.externalConnectionIds=e.externalConnections||[],this.linkers=this.externalConnectionIds,this.connections=yield(0,yt.j)(this.externalConnectionIds);for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);this.listenToEvent(this.mainConcept)}return yield this.build()}))}build(){return Yn(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==En.XZ?this.data={compositionIds:this.compositionIds,internalConnections:this.internalConnections,externalConnections:this.externalConnectionIds}:this.data=yield(0,tt.p8)(this.compositionIds,this.internalConnections),this.data}))}}function Kn(e,t,n="",o){return new Zn(e,t,n,o)}var eo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class to extends Mn.w{constructor(e,t,n,o=En.y0){super(),this.searchQuery=[],this.format=En.y0,this.mainCompositionIds=[],this.searchCharacter="",this.token="",this.searchStructure=e,this.searchQuery=t,this.searchQuery[0].type=e.composition,this.searchCharacter=e.composition,this.format=o,this.token=vt.b.BearerAccessToken}listenToEventType(e){window.addEventListener(`${e}`,(e=>{if(this.isUpdating)console.log("rejected this");else{this.isUpdating=!0;let t=this;setTimeout((function(){return eo(this,void 0,void 0,(function*(){let n=e;t.mainCompositionIds.includes(null==n?void 0:n.detail)||(t.mainCompositionIds.unshift(null==n?void 0:n.detail),t.conceptIds.push(null==n?void 0:n.detail),t.listenToEvent(null==n?void 0:n.detail),ze.d.GetConnectionsOfConcept(null==n?void 0:n.detail).then((e=>{for(let n=0;n<e.length;n++)t.linkers.push(e[n].id)}))),t.isUpdating=!1,yield t.bind(),t.notify()}))}),200)}}))}bind(){return eo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,g.A)(this.searchCharacter);let t=yield On(this.searchStructure,this.searchQuery,this.token);this.conceptIds=t.compositionIds,this.internalConnections=t.internalConnections,this.linkers=t.linkers,this.reverse=t.reverse,this.mainCompositionIds=t.mainCompositionIds,this.listenToEventType(e.id);for(let e=0;e<this.mainCompositionIds.length;e++)this.listenToEvent(this.mainCompositionIds[e])}return yield this.build()}))}build(){return eo(this,void 0,void 0,(function*(){return yield(0,ft.r)(this.conceptIds),this.format==En.y0?this.data=yield(0,Qn.yV)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield(0,Qn._W)(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function no(e,t,n,o=En.y0){return new to(e,t,n,o)}var oo=n(2615);class io{constructor(e,t,n,o,i,r,c,a=!1,s,d,h){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=l.B.getRandomizer(),this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=o,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=a,this.typeCharacter=c,this.entryTimeStamp=s,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=h}getType(){console.log(this.typeId)}}class ro{constructor(e,t,n,o,i,r){this.isTemp=!1,this.applicationId=l.B.getRandomizer(),this.type=(0,P.o)(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.typeId=o,this.ghostId=e,this.orderId=i,this.typeCharacter="",this.accessId=r,this.typeCharacter="",this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class co{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class ao{constructor(){this.id="0",this.remote_address="",this.server_port="",this.server_address="",this.server_name="",this.server_software="",this.http_user_agent="",this.self="",this.port="",this.userId="",this.email=""}}var so=n(628);class lo{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class ho{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var uo=n(7887),po=n(3075),fo=n(7869),yo=n(9635),vo=n(9700);class go{static initialize(){try{console.warn("Initialized Application Monitoring for tracking errors..."),this.initGlobalErrorHandlers(),this.logCatchError(),this.logErrorEvent(),this.logUnhandledError(),this.logUserInteractions(),this.logNetworkRequests(),this.logRouteChanges(),this.logPerformanceMetrics(),this.logWebSocketEvents()}catch(e){console.error("Error during Application Monitoring initialization:",e)}}static initGlobalErrorHandlers(){try{if(console.log("this is the window",window),void 0===typeof window)return;const e=vt.b.sessionId||"unknown";window.onerror=(t,n,o,i,r)=>{const c={message:t,source:n,lineno:o,colno:i,stack:(null==r?void 0:r.stack)||"undefined",requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("ERROR","Runtime Error",c),vo.V.log("ERROR","Runtime Error",c)},window.onunhandledrejection=t=>{vo.V.logApplication("ERROR","Unhandled Promise Rejection",{message:t.reason?t.reason.message:t.reason,stack:t.reason?t.reason.stack:null,requestFrom:l.B.BASE_APPLICATION,sessionId:e}),vo.V.log("ERROR","Unhandled Promise Rejection",{message:t.reason?t.reason.message:t.reason,stack:t.reason?t.reason.stack:null,requestFrom:l.B.BASE_APPLICATION,sessionId:e})}}catch(e){console.warn("Failed to initialize global error handlers:",e)}}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError...");const t=vt.b.sessionId||"unknown";console.error=function(...n){const o="Console Error",i={arguments:n.map((e=>mo(e))),requestFrom:l.B.BASE_APPLICATION,sessionId:t};vo.V.logApplication("ERROR",o,i),vo.V.log("ERROR",o,i),e.apply(console,n)}}catch(e){console.warn("Failed to override console.error:",e)}}static logErrorEvent(){try{window.addEventListener("error",(e=>{var t;console.log("Inside error event...");const n=vt.b.sessionId||"unknown",o={error:(null===(t=e.error)||void 0===t?void 0:t.message)||e.message,source:e.filename,line:e.lineno,column:e.colno,stack:e.error?mo(e.error.stack):void 0,requestFrom:l.B.BASE_APPLICATION,sessionId:n},i="Unhandled Error";vo.V.logApplication("ERROR",i,o),vo.V.log("ERROR",i,o)}))}catch(e){console.warn("Failed to add error event listener:",e)}}static logUnhandledError(){try{window.addEventListener("unhandledrejection",(e=>{var t,n;console.log("Inside unhandledrejection...");const o=vt.b.sessionId||"unknown",i={reason:(null===(t=e.reason)||void 0===t?void 0:t.message)||String(e.reason),stack:(null===(n=e.reason)||void 0===n?void 0:n.stack)||"No stack trace available",requestFrom:l.B.BASE_APPLICATION,sessionId:o};vo.V.logApplication("ERROR","Unhandled Promise Rejection",i),vo.V.log("ERROR","Unhandled Promise Rejection",i)}))}catch(e){console.warn("Failed to add unhandled rejection event listener:",e)}}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const n=vt.b.sessionId||"unknown",o=e.target,i={element:o.tagName,id:o.id,classes:o.className,text:null===(t=o.innerText)||void 0===t?void 0:t.slice(0,50),requestFrom:l.B.BASE_APPLICATION,sessionId:n};vo.V.logApplication("INFO","User Click",i)})),document.addEventListener("input",(e=>{const t=e.target;vt.b.sessionId,t.tagName,t.id,t.value,l.B.BASE_APPLICATION})),document.addEventListener("scroll",(()=>{vt.b.sessionId,window.scrollY,l.B.BASE_APPLICATION}))}static logNetworkRequests(){try{if(void 0===typeof window)return;const e=vt.b.sessionId||"unknown",t=null===window||void 0===window?void 0:window.fetch;if(!t)throw new Error("Original fetch is not available.");const n=[l.B.PostLogger(),l.B.PostPrefetchConceptConnections()];window.fetch=(...o)=>{return i=this,r=void 0,a=function*(){const[i,r]=o,c=i instanceof Request?i.url:i instanceof URL?i.toString():i;if(n.includes(c))return console.log("Ignored URLs detected : ",c),t(...o);let a={request:{type:"REQUEST",message:"Network Request",method:(null==r?void 0:r.method)||"GET",url:c,body:null==r?void 0:r.body,requestFrom:l.B.BASE_APPLICATION,sessionId:e}};try{const n=yield t(...o);return a.response={type:"RESPONSE",message:"Network Response",url:c,status:n.status,requestFrom:l.B.BASE_APPLICATION,sessionId:e},n}catch(t){throw a.response={type:"ERROR",message:"Network Request Failed",url:c,error:t instanceof Error?t.message:String(t),requestFrom:l.B.BASE_APPLICATION,sessionId:e},vo.V.logApplication("ERROR","Failed Network Request",a),new Error(`Network request failed for ${c}: ${t.message}`)}},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{s(a.next(e))}catch(e){t(e)}}function o(e){try{s(a.throw(e))}catch(e){t(e)}}function s(t){var i;t.done?e(t.value):(i=t.value,i instanceof c?i:new c((function(e){e(i)}))).then(n,o)}s((a=a.apply(i,r||[])).next())}));var i,r,c,a}}catch(e){console.warn("Failed to override network requests:",e)}}static logPerformanceMetrics(){void 0!==typeof window&&(null===window||void 0===window||window.addEventListener("load",(()=>{const e=performance.timing;vt.b.sessionId,e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart,l.B.BASE_APPLICATION})))}static logRouteChanges(){const e=history.pushState,t=vt.b.sessionId||"unknown";history.pushState=function(...n){var o;const i={url:null===(o=n[2])||void 0===o?void 0:o.toString(),requestFrom:l.B.BASE_APPLICATION,sessionId:t};return vo.V.logApplication("INFO","Route Change",i),e.apply(this,n)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href,requestFrom:l.B.BASE_APPLICATION,sessionId:t};vo.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=vt.b.sessionId||"unknown",t=WebSocket;window.WebSocket=class extends t{constructor(t,n){super(t,n);const o={url:t.toString(),requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Open",o),this.addEventListener("message",(n=>{const o={url:t,data:n.data,requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Message",o)})),this.addEventListener("error",(n=>{const o={url:t,error:n instanceof Error?n.message:String(n),requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("ERROR","WebSocket Error",o)})),this.addEventListener("close",(()=>{const n={url:t,requestFrom:l.B.BASE_APPLICATION,sessionId:e};vo.V.logApplication("INFO","WebSocket Closed",n)}))}}}}function mo(e){try{return JSON.stringify(e,((e,t)=>t&&"object"==typeof t&&t instanceof Error?{message:t.message,stack:t.stack}:t))}catch(e){return"Error while serializing value"}}const Co=(e,t,...n)=>{return o=void 0,i=[e,t,...n],c=function*(e,t,n=!1){try{let o=l.B.sendMail();n&&(o=l.B.sendBulkMail());const i=yield fetch(o,{method:"POST",body:e instanceof FormData?e:JSON.stringify(e),headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}}),r=i.headers.get("content-type");if(!i.ok){const e=yield i.json();return console.info(`${i.status} ${e}`),null}const c=yield i.json();return r&&r.includes("text/plain")?yield i.text():c}catch(e){return console.error(e),null}},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{s(c.next(e))}catch(e){t(e)}}function a(e){try{s(c.throw(e))}catch(e){t(e)}}function s(t){var o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r((function(e){e(o)}))).then(n,a)}s((c=c.apply(o,i||[])).next())}));var o,i,r,c};class To{constructor(){this.inDevelopment=!1,this.subscribers=[]}notify(e=null){this.subscribers.map((t=>{t(e||this.data)}))}dataChange(e){this.subscribers.push(e)}}class Io extends To{constructor(){super(...arguments),this.element=null,this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return this.element}getElementById(e){let t=this.getComponent(),n=document.body;if(t){let o=t.querySelector("#"+e);if(o)return n=o,n}return null}createWidgetWrapperIdentifier(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier.toString()}}class wo extends Io{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.state={},this.previousState={},this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement=""}querySelector(e){return this.element?this.element.querySelector(e):null}querySelectorAll(e){return this.element?this.element.querySelectorAll(e):null}getElement(){return this.element}setTitle(e){document.title=e}getHtml(){return this.html}UpdateChildData(e,t){let n=t;n.data=e,n.render(),n.update()}update(){}setState(e){this.previousState=Object.assign({},this),this.data=e,this.state=Object.assign({},this),this.hasStateChanged()&&(this.notify(),this.render())}setProperty(e){this.previousState=Object.assign({},this),Object.assign(this,e),this.state=Object.assign({},this),this.hasStateChanged()&&(this.notify(),this.render())}hasStateChanged(){return!this.isPropertyEqual(this.state,this.previousState)}isPropertyEqual(e,t){if(e===t)return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(let i of n){if(!o.includes(i))return!1;for(let n of o)if(i==n&&"state"!=i&&"previousState"!=i&&e[i]!=t[i])return!1}return!0}loadChildWidgets(){this.childWidgets.map((e=>{let t=this.getElementById(e.parentElement);t&&(t.innerHTML=""),e.mount(t)}))}render(){this.element&&(this.element.innerHTML=this.getHtml()),this.loadChildWidgets(),this.after_render()}getElementByClassName(e){let t=this.getComponent();return t?null==t?void 0:t.querySelectorAll("."+e):[]}mount_child(){}mount(e){return t=this,n=void 0,i=function*(){e&&(this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier(),this.element.innerHTML=this.getHtml(),e.appendChild(this.element),this.parentElement=e.id,this.before_render(),this.mount_child(),this.widgetMounted=!0)},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{s(i.next(e))}catch(e){r(e)}}function a(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}s((i=i.apply(t,n||[])).next())}));var t,n,o,i}before_render(){this.render()}after_render(){console.log("this is calling the after render",this)}renderChildWidgets(){function e(t){var n;t&&(null===(n=t.childWidgets)||void 0===n||n.forEach((t=>{e(t)})),t.render())}console.log("this is the render child widget",this),this.childWidgets.forEach((t=>{e(t)}))}setWidgetState(e,t){this.widgetState[e]=t,function e(t){t&&Array.isArray(t.childWidgets)&&t.childWidgets.forEach((n=>{n.widgetState=Object.assign(Object.assign({},n.widgetState),t.widgetState),e(n)}))}(this),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var ko=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class No extends wo{constructor(){super(...arguments),this.childComponents=[],this.componentMounted=!1,this.oldHtml=null,this.phonebooks=[],this.childrenData={},this.childWidgets=[],this.typeValueList=[],this.widgetType="the_element_name",this.parentConceptList=[]}getUserId(){return ko(this,void 0,void 0,(function*(){const e=yield new Promise((e=>{let t=(null===localStorage||void 0===localStorage?void 0:localStorage.getItem("profile"))||"";t?e(JSON.parse(t)):e()}));return null==e?void 0:e.userId}))}getTypeValueList(){return ko(this,arguments,void 0,(function*(e=""){return new Promise((t=>ko(this,void 0,void 0,(function*(){const n=null==(e=this.widgetType)?void 0:e.match(/^[a-z0-9]+_[a-z0-9]+/i),o=n?n[0]:"",i=null==e?void 0:e.match(/^([a-z0-9]+).*_([a-z0-9]+)$/i),r=i?`${i[1]}_${i[2]}`:"";let c=[],a=new lo;a.type=r,a.search="1",a.logicoperator=">",a.name="emailfilter",a.operateon="entityEmail",a.composition=!1,c.push(a);let s=new Fo;s.typeConnection=e,s.name="entityEmail";let l=new Fo;l.type=o,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[s],l.outputFormat=En.y0,Vo(l,"").subscribe((n=>{if(null==n?void 0:n.length){const i=null==n?void 0:n.map((t=>{var n,i,c,a,s,l,d;const h=null===(a=null===(c=null===(i=null===(n=t.data)||void 0===n?void 0:n[o])||void 0===i?void 0:i[e])||void 0===c?void 0:c.data)||void 0===a?void 0:a[r];return{id:null===(d=null===(l=null===(s=t.data)||void 0===s?void 0:s[o])||void 0===l?void 0:l[e])||void 0===d?void 0:d.id,name:h,text:h}}));return this.typeValueList=i,t(i),i}}))}))))}))}setTitle(e){document.title=e}getHtml(){return this.html}createRandomNumber(){return this.elementIdentifier=1e4*Math.random(),this.elementIdentifier}mount_child(){return ko(this,void 0,void 0,(function*(){try{new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the mount child",e),e}}))}setProperty(e){return ko(this,void 0,void 0,(function*(){return this.widgetType=e,this.getTypeValueList(this.widgetType).then((()=>{var e,t,n;null===(e=this.element)||void 0===e||e.setAttribute("data-type-value",this.widgetType),null===(n=null===(t=this.element)||void 0===t?void 0:t.parentElement)||void 0===n||n.setAttribute("data-type-value",this.widgetType),this.render()})),this}))}createTypeEditor(e){!function(e,t){if(e){const n=document.querySelector("#widget-properties #widget-type"),o=null==n?void 0:n.querySelectorAll("input");null==o||o.forEach((e=>{null==e||e.remove()}));const i=e.target.closest(".added-widget-container"),r=e.target.closest("div");let c="";i?c=null==i?void 0:i.getAttribute("data-type-value"):r&&(c=null==r?void 0:r.getAttribute("data-type-value"));const a=document.createElement("input");a.setAttribute("type","text"),a.setAttribute("name","input-widgetTypeValue"),a.setAttribute("of",t.elementIdentifier.toString()),a.setAttribute("class","form-control"),a.setAttribute("id","widgetType"),a.setAttribute("onchange","updateWidgetTypeValue(event)"),t.widgetType?a.value=t.widgetType:a.setAttribute("placeholder","e.g. the_entity");let s=t;a.addEventListener("change",(function(e){var t,n,o;const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;s.widgetType=i,s.before_render(),s.loadChildWidgets(),null===(o=null===(n=s.element)||void 0===n?void 0:n.parentElement)||void 0===o||o.setAttribute("data-type-value",s.widgetType)})),null==n||n.appendChild(a)}}(e,this)}mount(e){return ko(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div"),this.element.id=this.createWidgetWrapperIdentifier();let t=this;this.inDevelopment&&(this.element.onclick=function(e){e.preventDefault(),t.createTypeEditor(e)},this.element.className="mftsccs-marking-element"),this.element.innerHTML=this.getHtml(),null==e||e.setAttribute("data-type-value",t.widgetType),e.appendChild(this.element),this.parentElement=e.id,this.inDevelopment||(0==this.componentMounted||0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0,this.componentMounted=!0):this.render()),this.childWidgetElement=this.getElementByClassName("added-widget-container")}}))}before_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the before render",e),e}}after_render(){try{new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(o)}catch(e){throw console.log("This is the error in the after render",e),e}}CreateConnectionBetweenEntityLocal(e,t,n){return ko(this,void 0,void 0,(function*(){var o;const i=e.userId,r=(null===(o=e.type)||void 0===o?void 0:o.characterValue)+"_"+n,c=yield(0,le.$)(r,999,999,i);return yield(0,rn.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Ao=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Lo{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Ao(this,void 0,void 0,(function*(){yield so.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Ao(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield so.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Ao(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield so.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Ao(this,void 0,void 0,(function*(){yield so.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Ao(this,arguments,void 0,(function*(e,t,n=!1,o,i,r=999,c=0){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,K.k)(e,t,n,o,i,r,c,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,n,o){return Ao(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,le.$)(e,t,n,o,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateConnectionBetweenTwoConceptsLocal(e,t,n){return Ao(this,arguments,void 0,(function*(e,t,n,o=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Sn.h)(e,t,n,o,this.actions);return yield this.markAction(),i}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheConnectionLocal(e,t,n){return Ao(this,arguments,void 0,(function*(e,t,n,o=1,i="",r=999){try{if(!this.success)throw Error("Query Transaction Expired");const c=yield(0,rn.F)(e,t,n,o,i,r,this.actions);return yield this.markAction(),c}catch(e){throw console.log(e),this.success=!1,e}}))}CreateTheCompositionLocal(e){return Ao(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,a=!1){try{if(!this.success)throw Error("Query Transaction Expired");const s=yield(0,F.R)(e,t,n,o,i,r,c,a,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}}const So={number:/^\d+(\.\d+)?$/,text:/^[\s\S]*$/,textOnly:/^[A-Za-z\s]+$/,email:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,document:/\.(pdf|docx?|pptx?|xlsx?)$/i,sound:/\.(mp3|wav|ogg|flac)$/i,image:/\.(jpg|jpeg|png|gif|bmp|svg|webp)$/i,video:/\.(mp4|avi|mov|mkv|flv|webm)$/i,url:/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)*\/?$/,date:/^\d{4}-\d{2}-\d{2}$/,time:/^(?:[01]\d|2[0-3]):[0-5]\d$/,password:/^.{6,}$/,ipaddress:/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$|^([0-9a-fA-F]{1,4}:){7}([0-9a-fA-F]{1,4})$/,uuid:/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/};var Go=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class _o{constructor(){_o.cacheInitialized||_o.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Go(this,void 0,void 0,(function*(){try{yield _o.getAnomalyParameters(),_o.refreshCache(),_o.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Go(this,void 0,void 0,(function*(){const e=Date.now();if(_o.anomalyParamsCache&&e-_o.lastFetchedTime<_o.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),_o.anomalyParamsCache;try{return yield _o.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Go(this,void 0,void 0,(function*(){try{const e=yield fetch("https://devai.freeschema.com/v1/get-frontend-anomaly-parameters",{method:"GET",headers:{"Content-Type":"application/json"}});if(!e.ok)throw new Error("Failed to fetch anomaly parameters");const t=yield e.json();return _o.anomalyParamsCache=t.data,_o.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Go(this,void 0,void 0,(function*(){try{Date.now()-_o.lastFetchedTime>_o.cacheExpiryThreshold&&(yield _o.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,n]of Object.entries(So))if(n.test(e))return t;return null}checkConceptAnomaly(e,t){return Go(this,void 0,void 0,(function*(){const n=[];try{if(!t)return n.push("Null value"),{valid:!1,warnings:n};const o=_o.anomalyParamsCache;e.startsWith("the_")||(e=`the_${e}`);const i=o[e];if(console.log("Concept Details : ",i),!i)return console.warn(`No concept details found for type: ${e}`),n.push(`No concept details found for type: ${e}`),{valid:!1,warnings:n};const r=t.length,{min_length:c,max_length:a,data_types:s}=i,l=r>=c&&r<=a,d=this.detectDataType(t),h=s.includes(d);return l||n.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${a}). Current length: ${r}.`),h||n.push(`Type mismatch for '${t}'. Expected types: ${s.join(", ")}, detected type: ${d}.`),l&&h&&n.push(`Concept ${e} is valid. Length: ${r}, Type: ${d}`),{valid:l&&h,warnings:n}}catch(o){return console.error(`Error checking anomaly for ${e} with value ${t}:`,o),{valid:!1,warnings:n}}}))}static checkAnomalyInBulk(e){return Go(this,void 0,void 0,(function*(){_o.cacheInitialized||(yield _o.initializeAnomalyParameters());try{const t={};for(const[n,o]of Object.entries(e)){const e=o.value,{valid:i,warnings:r}=yield(new _o).checkConceptAnomaly(n,e);t[n]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){console.log("Main : ",o);const e=Object.keys(o);return console.log("The exported List : ",e),e}static getFunctionaAnomalyParameters(){}}_o.anomalyParamsCache=null,_o.cacheInitialized=!1,_o.lastFetchedTime=0,_o.cacheExpiryThreshold=6e5;var bo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Bo{checkUniqueness(e,t){return bo(this,void 0,void 0,(function*(){const n=vo.V.logfunction("checkUniqueness");e.startsWith("the_")||(e="the_"+e);let o=(yield Ge(e,999)).id,i=yield(0,re.A)(t,o);return console.log("This is the concept for validator",i),!(i.id>0||(vo.V.logUpdate(n),0))}))}validateField(e){return bo(this,void 0,void 0,(function*(){var t;const n=vo.V.logfunction("validateField");try{performance.now();const o={},{name:i,value:r,type:c,dataType:a,pattern:s,conceptType:l,maxLength:d,minLength:h,minValue:u,maxValue:p,accept:f,file:y,required:v,isUnique:g}=e;if(console.log("Validation is happening on : \n",e),!v||null!==r&&""!==r||(o.required=`The field ${i} is required.`),a&&r){let e=So[a];e&&""!==r&&!e.test(r)&&(o.dataType=`Invalid value for ${a}`)}if(s&&r){const e="string"==typeof s?new RegExp(s):s;""===r||e.test(r)||(o.pattern="Pattern doesn't match with value")}if(r&&null!=d&&r.length>d&&(o.maxLength=`Length exceeds the maximum length of ${d}`),r&&null!=h&&r.length<h&&(o.minLength=`Length must be at least ${h} characters long`),null!=u&&r&&!isNaN(Number(r))&&Number(r)<u&&(o.minValue=`Value must be greater than or equal to ${u}`),null!=p&&r&&!isNaN(Number(r))&&Number(r)>p&&(o.maxValue=`Value must be less than or equal to ${p}`),y&&c&&f){const e=f.split(",").map((e=>e.trim().toLowerCase())),n=null===(t=y.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();n&&!e.includes(n)&&(o.accept=`File must be a valid file type: ${e.join(", ")}`)}return l&&g&&r&&((yield this.checkUniqueness(l,r))||(o.unique="Value is not unique")),vo.V.logUpdate(n),console.log("Before Validation Result : ",o),o}catch(e){throw(0,h.ey)(n,"Validator.validateField",e),e}}))}validateForm(e){return bo(this,void 0,void 0,(function*(){const t=vo.V.logfunction("validateForm");try{performance.now();const n={};for(const t in e){const o=yield this.validateField(e[t]);Object.keys(o).length>0&&(n[t]=o)}return vo.V.logUpdate(t),n}catch(e){throw(0,h.ey)(t,"Validator.validateForm",e),e}}))}validate(e){const t=vo.V.logfunction("validate");try{let n={};return this.validateField(e).then((e=>{Object.keys(e).length>0?(n.status=!1,n.details=e):n.status=!0})),console.error("Error on validate object"),vo.V.logUpdate(t),n}catch(e){(0,h.ey)(t,"Validator.validate",e)}}}const xo=e=>{var t;const n=document.getElementsByName(e)[0];if(!n)return console.warn(`Element with NAME "${e}" not found.`),{name:null,value:null,type:null,dataType:null,pattern:null,conceptType:null,maxLength:null,minLength:null,minValue:null,maxValue:null,accept:null,file:null,required:!1,isUnique:!0};const o=n.hasAttribute("required")||"true"===n.getAttribute("data-required"),i=n.hasAttribute("isUnique")&&"true"===n.getAttribute("isUnique");return{name:n.name,value:n.value,type:n.type,dataType:n.getAttribute("data-type"),pattern:n.getAttribute("data-pattern"),conceptType:n.getAttribute("concept-type"),maxLength:n.getAttribute("maxlength")?parseInt(n.getAttribute("maxlength")):null,minLength:n.getAttribute("minlength")?parseInt(n.getAttribute("minlength")):null,minValue:n.getAttribute("min")?parseInt(n.getAttribute("min")):null,maxValue:n.getAttribute("max")?parseInt(n.getAttribute("max")):null,accept:n.getAttribute("accept")||null,file:"file"===n.type&&(null===(t=n.files)||void 0===t?void 0:t[0])||null,required:o,isUnique:i}};var Ro=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Eo(e,t){var n=arguments;return Ro(this,void 0,void 0,(function*(){const o=vo.V.logfunction("DeleteConnectionByType",n)||{};if(mi){o.serviceWorker=!0;try{const n=yield Si("DeleteConnectionByType",{id:e,linker:t});return vo.V.logUpdate(o),n.data}catch(e){console.error("DeleteConnectionByType sw error: ",e),(0,h.ey)(o,"DeleteConnectionByType",e),xi(e)}}let i=yield be(e);for(let e=0;e<i.length;e++)ze.d.AddConnection(i[e]);let r=yield ze.d.GetConnectionsOfConcept(e),c=yield(0,g.A)(t),a=[];for(let e=0;e<r.length;e++)r[e].typeId==c.id&&a.push(r[e]);for(let e=0;e<a.length;e++)(0,J.m)(a[e].id);vo.V.logUpdate(o)}))}function Do(e,t){return Ro(this,arguments,void 0,(function*(e,t,n=!1){if(mi)try{return(yield Si("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:n})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),xi(e)}let o=[];if(n){let n=yield xe(e),i=yield Ge(t,999);for(let e=0;e<n.length;e++)n[e].typeId==i.id&&o.push(n[e])}else{let n=yield be(e);for(let e=0;e<n.length;e++)ze.d.AddConnection(n[e]);let i=yield ze.d.GetConnectionsOfConcept(e),r=yield(0,g.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&o.push(i[e])}return o}))}class Fo{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=En.yv,this.name="",this.reverse=!1,this.limit=!1,this.isSecure=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var Wo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Uo(e){var t=arguments;return Wo(this,arguments,void 0,(function*(e,n=""){const o=vo.V.logfunction("FreeschemaQueryApi",t);var i=(0,d.ab)("application/json",n);const r=l.B.FreeschemaQueryUrl(),c=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:i,body:c});return e.ok?yield e.json():((0,h.ry)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,h.Mb)(e,r),(0,h.ey)(o,"FreeschemaQueryApi",e)}}))}var Oo=n(5898),Mo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Po extends Mn.w{constructor(e,t){super(),this.query=new Fo,this.countInfoStrings=[],this.order="DESC",this.totalCount=0,this.query=e,this.format=e.outputFormat,this.order=e.order}bind(){return Mo(this,void 0,void 0,(function*(){var e,t;if(this.isDataLoaded)for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);else{if(this.isDataLoaded=!0,this.query.outputFormat=En.BG,""!=this.query.type){let e=yield Ge(this.query.type,999);this.listenToEventType(e.id)}let n=yield Uo(this.query,"");this.conceptIds=n.conceptIds,this.internalConnections=null!==(e=n.internalConnections)&&void 0!==e?e:[],this.linkers=null!==(t=n.linkers)&&void 0!==t?t:[],this.reverse=n.reverse,this.compositionIds=n.mainCompositionIds,this.totalCount=n.mainCount,this.countInfoStrings=n.countinfo}let n=yield this.build();for(let e=0;e<this.compositionIds.length;e++)this.listenToEvent(this.compositionIds[e]);if(""!=this.query.type){let e=yield Ge(this.query.type,999);console.log("this is the listening to the type",e),this.listenToEventType(e.id)}return n}))}build(){return Mo(this,void 0,void 0,(function*(){vo.V.logfunction("build",["schemaquery",this.compositionIds]);let e=(0,Oo.w)(this.countInfoStrings);return this.format==En.y0?this.data=yield(0,Qn.e$)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e,this.order):this.format==En.ZJ?this.data=yield(0,Qn.y6)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e,this.order):this.data=yield(0,Qn.b6)(this.linkers,this.conceptIds,this.compositionIds,this.reverse,e),this.data}))}}function Vo(e,t){return new Po(e,t)}class jo{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",this.library={css:[],js:[]},this.assistant={id:"",input:"",type:""},this.timestamp="",this.widgetId=0,this.type="",this.clean="",this.after_render="",this.before_render="",this.update="",this.origin=0,this.version=0,this.mount_child="",this.children=[],this.wrapper="0",this.widget=new No}}var $o=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ho(e,t,n){return $o(this,void 0,void 0,(function*(){var o;const i=vo.V.logfunction("CreateConnectionBetweenEntityLocal",[e.id,t.id,n]),r=e.userId,c=(null===(o=e.type)||void 0===o?void 0:o.characterValue)+"_"+n,a=yield(0,le.$)(c,999,999,r);console.log(yield(0,rn.F)(e.id,t.id,a.id,1e3)),vo.V.logUpdate(i)}))}var Jo=n(4310);const qo='\n/* CKEditor content styles */\n.ck-content {\n /* Container styles */\n max-width: 100%;\n margin: 0 auto;\n font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;\n line-height: 1.5;\n padding: 0.75rem;\n background: #fff;\n color: #333;\n border: 1px solid #ccced1;\n}\n\n/* Headings */\n.ck-content h1, .ck-content h2, .ck-content h3, \n.ck-content h4, .ck-content h5, .ck-content h6 {\n font-weight: 700;\n line-height: 1.2;\n margin: 1em 0 0.5em;\n}\n\n.ck-content h1 { font-size: 2.5em; }\n.ck-content h2 { font-size: 2em; }\n.ck-content h3 { font-size: 1.75em; }\n.ck-content h4 { font-size: 1.5em; }\n.ck-content h5 { font-size: 1.25em; }\n.ck-content h6 { font-size: 1em; }\n\n/* Paragraphs and spacing */\n.ck-content p {\n margin: 1em 0;\n line-height: 1.6;\n}\n\n/* Links */\n.ck-content a {\n color: #1a73e8;\n text-decoration: none;\n}\n\n.ck-content a:hover {\n text-decoration: underline;\n}\n\n/* Lists */\n.ck-content ul,\n.ck-content ol {\n padding-left: 2em;\n margin: 1em 0;\n}\n\n.ck-content ul {\n list-style: disc;\n}\n\n.ck-content ol {\n list-style: decimal;\n}\n\n.ck-content li {\n margin: 0.5em 0;\n}\n\n/* Blockquotes */\n.ck-content blockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 5px solid #ccc;\n font-style: italic;\n color: #666;\n}\n\n/* Code blocks */\n.ck-content pre {\n background: #f5f5f5;\n border: 1px solid #ddd;\n border-radius: 4px;\n padding: 1em;\n margin: 1em 0;\n overflow-x: auto;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;\n}\n\n.ck-content code {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n border-radius: 3px;\n font-size: 0.9em;\n font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;\n}\n\n/* Tables */\n.ck-content table {\n border-collapse: collapse;\n width: 100%;\n margin: 1em 0;\n}\n\n.ck-content table th,\n.ck-content table td {\n border: 1px solid #ddd;\n padding: 0.75em;\n text-align: left;\n}\n\n.ck-content table th {\n background: #f5f5f5;\n font-weight: bold;\n}\n\n/* Images */\n.ck-content img {\n max-width: 100%;\n height: auto;\n margin: 1em 0;\n}\n\n.ck-content figure {\n margin: 1em 0;\n text-align: center;\n}\n\n.ck-content figure img {\n margin: 0;\n}\n\n.ck-content figcaption {\n color: #666;\n font-size: 0.9em;\n margin-top: 0.5em;\n}\n\n/* Dark mode */\n/*\n@media (prefers-color-scheme: dark) {\n .ck-content {\n background: #1a1a1a;\n color: #e0e0e0;\n }\n\n .ck-content a {\n color: #64b5f6;\n }\n\n .ck-content blockquote {\n border-left-color: #404040;\n color: #b0b0b0;\n }\n\n .ck-content pre,\n .ck-content code {\n background: #2d2d2d;\n border-color: #404040;\n }\n\n .ck-content table th,\n .ck-content table td {\n border-color: #404040;\n }\n\n .ck-content table th {\n background: #2d2d2d;\n }\n\n .ck-content figcaption {\n color: #b0b0b0;\n }\n}\n*/\n\n/* CUSTOM DOCUMENTATION CSS */\n\n#documentation-preview {\n border: 1px solid #ccc;\n padding: 1rem;\n}\n\n#documentation-preview h3 {\n font-size: 1.5rem;\n margin-bottom: 1rem;\n}\n\n.pre-wrapper {\n background: #f2f5f9;\n border: 1px solid #cecece;\n display: block;\n padding: 1rem;\n border-radius: 0.25rem;\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n\n.pre-wrapper pre {\n margin: 0;\n color: #e87aa2;\n}\n\n.widget-doc-section pre {\n background-color: transparent;\n}\n\n.widget-doc-section p {\n margin: 0;\n}\n\n.widget-doc-section code {\n color: #e87aa2;\n font-size: 0.875rem;\n}\n\n.mv-3 {\n margin-top: 1rem;\n margin-bottom: 1rem;\n}\n\n.pv-3 {\n padding-top: 1rem;\n padding-bottom: 1rem;\n}\n\n.documentation-creator {\n text-align: right;\n color: #666;\n margin-top: 0.5rem;\n padding-bottom: 1rem;\n}\n\n.documentation-creator span {\n font-style: italic;\n}\n\n.documentation-attachments {\n display: flex;\n flex-wrap: wrap;\n}\n\n.documentation-attachments img {\n width: 25%;\n height: auto;\n border: 1px solid #ccc;\n padding: 0.25rem;\n margin-top: 0.5rem;\n margin-bottom: 0.5rem;\n}\n\n';var zo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Qo(e,t,n){return zo(this,void 0,void 0,(function*(){var o;const i=yield tn(e,"the_page_body");(null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.id)?yield Yo(i[0].id,t,n):t.innerHTML="<h4>Invalid or Page doesn't exist</h4>"}))}function Xo(e,t,n){return zo(this,void 0,void 0,(function*(){try{t.innerHTML='\n <div style="display: flex; align-items: center; gap: 10px; width: 100%">\n <div style="\n width: 20px;\n height: 20px;\n border: 3px solid #f3f3f3;\n border-top: 3px solid #3498db;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n "></div>\n <span>Please Wait...</span>\n </div>\n \n <style>\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n </style>\n';const o=yield(0,Jo.qj)(e);let i=o.mainId,r=o.data;return yield Zo(i,r,t,n)}catch(e){console.error(`Error Caught Rendering Widget: ${e}`),t.textContent=`Error: ${e.message}`}}))}function Yo(e,t,n){return zo(this,void 0,void 0,(function*(){try{const o=yield(0,Jo.Cp)(e);return yield Zo(e,o,t,n)}catch(e){console.error(`Error Caught Rendering Widget: ${e}`)}}))}function Zo(e,t,n,o){return zo(this,void 0,void 0,(function*(){const i=yield ei(e,[],t);if(!i.name)return void(n.innerHTML="<h4>Invalid or Widget doesn't exist</h4>");const r=n,c=yield ti(i,r,void 0,o),a=Array.from({length:32},(()=>"abcdef"[Math.floor(6*Math.random())])).join("");n.classList.add(`${a}`),n.style.position="relative";const s=document.createElement("style");s.id="mystyleid",s.innerHTML=`\n .${a} {\n ${i.css+c.css+qo} \n /* DOCUMENTATION */\n }\n\n #widget-details {\n position: absolute;\n right: 0px;\n top: 0px;\n }\n\n #widget-details button {\n background: #fff;\n border: 1px solid #ccc;\n border-radius: 0 0 0 0.25rem;\n height: auto;\n width: auto;\n }\n\n #widget-details button:hover, \n #widget-details button:focus {\n opacity: 0.75;\n }\n\n #widget-details button span {\n pointer-events: none;\n font-size: 1rem;\n }\n`,document.head.appendChild(s);const l=document.createElement("script");l.innerHTML=i.js,r.appendChild(l);const d=document.createElement("div");d.id="widget-details",d.innerHTML="",d.innerHTML='\n <button id="widget-documentation-btn" class="d-flex align-items-center gap-1" title="Documentation">\n <span class="material-symbols-outlined"> visibility </span>\n </button>\n ',r.appendChild(d);const h=document.createElement("dialog");h.id="widget-documentation-preview-modal",h.className="col-md-8",h.innerHTML="",h.innerHTML='\n <div class="py-2 px-3 bg-secondary text-light fs-4 d-flex justify-content-between align-items-center">\n <span>Documentation</span>\n <span class="material-symbols-outlined document-preview-close-button" style="cursor: pointer;">close</span>\n </div>\n\n <div id="documentation-preview" class="ck-content"></div>\n\n <div class="text-end mt-3">\n <button class="btn btn-secondary document-preview-close-button">Close</button>\n </div>\n ',r.appendChild(h),document.getElementById("widget-documentation-btn").addEventListener("click",(()=>{!function(e){zo(this,void 0,void 0,(function*(){const t=new Fo;t.typeConnection="the_widget_documentation",t.name="documentationText",t.selectors=["the_documentation_text"];const n=new Fo;n.typeConnection="the_widget_s_documentation",n.name="documentationBlank",n.selectors=["the_documentation_text","the_documentation_content","the_documentation_language","the_documentation_doc_title","the_documentation_folder","the_documentation_creator_email","the_documentation_created_by","the_documentation_content","the_documentation_type","the_documentation_s_doc_url","the_documentation_s_image_url","the_documentation_auth_type","the_documentation_bearer_token","the_documentation_method","the_documentation_method_url","the_documentation_username","the_documentation_password","the_documentation_s_json_list","the_documentation_code_editor","the_documentation_return"];const o=new Fo;o.typeConnection="the_documentation_s_json_list",o.name="documentationJSON",o.selectors=["the_json_list_key","the_json_list_value"],n.freeschemaQueries=[o];const i=new Fo;i.conceptIds=[e],i.freeschemaQueries=[t,n],i.inpage=100,i.outputFormat=En.y0,yield Vo(i,"").subscribe((e=>zo(this,void 0,void 0,(function*(){var t,n,o,i,r,c,a,s,l,d,h;let u;console.log("widget documentation preview data ->",e);const p=(null===(s=null===(a=null===(c=null===(r=null===(i=null===(o=null===(n=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.data)||void 0===n?void 0:n.the_widget)||void 0===o?void 0:o.the_widget_documentation)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_documentation)||void 0===c?void 0:c.the_documentation_text)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_text)||"";p&&(u=p);const f=null===(h=null===(d=null===(l=null==e?void 0:e[0])||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_widget)||void 0===h?void 0:h.the_widget_s_documentation;if(null==f?void 0:f.length){const e=null==f?void 0:f.map((e=>{var t,n,o,i,r,c,a,s,l,d,h,u,p,f,y,v,g,m,C,T,I,w,k,N,A,L,S;const G=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_documentation,_=null===(o=null===(n=null==G?void 0:G.the_documentation_type)||void 0===n?void 0:n.data)||void 0===o?void 0:o.the_type,b=null===(r=null===(i=null==G?void 0:G.the_documentation_content)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_content,B=null===(a=null===(c=null==G?void 0:G.the_documentation_creator_email)||void 0===c?void 0:c.data)||void 0===a?void 0:a.the_creator_email,x=null===(l=null===(s=null==G?void 0:G.the_documentation_doc_title)||void 0===s?void 0:s.data)||void 0===l?void 0:l.the_doc_title,R=null===(h=null===(d=null==G?void 0:G.the_documentation_method)||void 0===d?void 0:d.data)||void 0===h?void 0:h.the_method,E=null===(p=null===(u=null==G?void 0:G.the_documentation_method_url)||void 0===u?void 0:u.data)||void 0===p?void 0:p.the_method_url,D=null===(y=null===(f=null==G?void 0:G.the_documentation_bearer_token)||void 0===f?void 0:f.data)||void 0===y?void 0:y.the_bearer_token,F=null===(g=null===(v=null==G?void 0:G.the_documentation_username)||void 0===v?void 0:v.data)||void 0===g?void 0:g.the_username,W=null===(C=null===(m=null==G?void 0:G.the_documentation_password)||void 0===m?void 0:m.data)||void 0===C?void 0:C.the_password,U=null===(I=null===(T=null==G?void 0:G.the_documentation_auth_type)||void 0===T?void 0:T.data)||void 0===I?void 0:I.the_auth_type,O=null==G?void 0:G.the_documentation_s_json_list,M=null===(k=null===(w=null==G?void 0:G.the_documentation_language)||void 0===w?void 0:w.data)||void 0===k?void 0:k.the_language,P=null===(A=null===(N=null==G?void 0:G.the_documentation_return)||void 0===N?void 0:N.data)||void 0===A?void 0:A.the_return,V=null===(S=null===(L=null==G?void 0:G.the_documentation_code_editor)||void 0===L?void 0:L.data)||void 0===S?void 0:S.the_code_editor,j=null==G?void 0:G.the_documentation_s_doc_url,$=null==G?void 0:G.the_documentation_s_image_url;let H={type:_,content:b,creatorEmail:B,title:x};if("blank"===_)H=Object.assign({},H);else if("api"===_){const e=[];(null==O?void 0:O.length)&&(null==O||O.forEach((t=>{var n,o,i,r,c,a,s,l;e.push({key:null===(r=null===(i=null===(o=null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.the_json_list)||void 0===o?void 0:o.the_json_list_key)||void 0===i?void 0:i.data)||void 0===r?void 0:r.the_key,value:null===(l=null===(s=null===(a=null===(c=null==t?void 0:t.data)||void 0===c?void 0:c.the_json_list)||void 0===a?void 0:a.the_json_list_value)||void 0===s?void 0:s.data)||void 0===l?void 0:l.the_value})}))),H=Object.assign(Object.assign({},H),{method:R,methodURL:E,authType:U,username:F,password:W,bearerToken:D,json:e})}else if("function"===_)H=Object.assign(Object.assign({},H),{language:M,return:P,codeEditor:V});else if("imgAndLink"===_){const e=[],t=[];(null==$?void 0:$.length)&&(null==$||$.forEach((t=>{var n;e.push(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.the_image_url)}))),(null==j?void 0:j.length)&&(null==j||j.forEach((e=>{var n;t.push(null===(n=e.data)||void 0===n?void 0:n.the_doc_url)}))),H=Object.assign(Object.assign({},H),{imageList:e,linkList:t})}return H}));u=e}yield function(){return zo(this,void 0,void 0,(function*(){document.getElementById("widget-documentation-preview-modal").showModal()}))}(),function(e){const t=document.getElementById("documentation-preview");t.innerHTML="",e.length&&"string"!=typeof e?null==e||e.forEach((e=>{var n,o;const i=document.createElement("h3");let r="";switch(null==e?void 0:e.type){case"api":r="API";break;case"function":r="Functions and Classes";break;case"imgAndLink":r="Images and Links";break;default:r=""}i.innerHTML=`\n ${null==e?void 0:e.title} ${r?"("+r+")":""}\n `,null==t||t.appendChild(i);const c=document.createElement("div");c.classList.add("widget-doc-content"),(null==e?void 0:e.content)&&(c.innerHTML=e.content,null==t||t.appendChild(c));const a=document.createElement("div");if(a.classList.add("widget-doc-section"),"blank"===e.type)a.innerHTML=`\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `;else if("api"===e.type){let t="";"basicAuth"===e.authType?t=`\n <p>username: <code>${null==e?void 0:e.username}</code></p>\n <p>password: <code>${null==e?void 0:e.password}</code></p>\n `:"bearerToken"===e.authType&&(t=`\n <h6>Token: <code>${null==e?void 0:e.bearerToken}</code></h6>\n `);const n=e.json.map((e=>`${null==e?void 0:e.key}: ${null==e?void 0:e.value}`)).join(", ");a.innerHTML=`\n <div class="pv-3">\n <h6>Method Type: <code>${null==e?void 0:e.method.toUpperCase()}</code></h6>\n <h6>Endpoint: <code>${null==e?void 0:e.methodURL}</code></h6>\n </div>\n <div class="pv-3">\n <h6>Auth Type: <code>${null==e?void 0:e.authType.toUpperCase()}</code></h6>\n ${t}\n </div>\n <div class="pv-3">\n <h6>JSON</h6>\n <code class="pre-wrapper">\n<pre>{\n ${n}\n}\n</pre>\n </code>\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `}else if("function"===e.type)a.innerHTML=`\n <div class="mv-3">\n <h6>Parameter</h6>\n <p>Language: ${null==e?void 0:e.language}</p>\n <code class="pre-wrapper"><pre>${null==e?void 0:e.codeEditor}</pre></code>\n <h6>Returns</h6>\n <code class="pre-wrapper"><pre>${null==e?void 0:e.return}</pre></code>\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `;else if("imgAndLink"===e.type){const t=null===(n=null==e?void 0:e.linkList)||void 0===n?void 0:n.map((e=>`\n <p>${e}</p>\n `)).join(""),i=null===(o=null==e?void 0:e.imageList)||void 0===o?void 0:o.map((e=>`\n <img src="${e}">\n `)).join(""),r=(null==t?void 0:t.length)?`\n <div class="mv-3">\n <h6>Web links</h6>\n ${t}\n </div>\n `:"",c=(null==i?void 0:i.length)?`\n <h6>Attachments</h6>\n <div class="documentation-attachments">\n ${i}\n </div>\n `:"";a.innerHTML=`\n <div class="mv-3">\n ${r}\n ${c}\n </div>\n <p class="documentation-creator">- added by: <span>${null==e?void 0:e.creatorEmail}</span></p>\n `}null==t||t.appendChild(a)})):t.innerHTML=e}(u)}))))}))}((null==i?void 0:i.origin)||(null==i?void 0:i.widgetId))}));const u=r.querySelectorAll(".document-preview-close-button");return null==u||u.forEach((e=>{e.addEventListener("click",(()=>{!function(){zo(this,void 0,void 0,(function*(){const e=document.getElementById("widget-documentation-preview-modal"),t=null==e?void 0:e.querySelector("form");null==t||t.reset(),null==e||e.close()}))}()}))})),r.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")})),c}))}function Ko(e){return zo(this,arguments,void 0,(function*(e,t=[],n=""){const o=yield(0,Jo.Cp)(e);return yield ei(e,[],o)}))}function ei(e){return zo(this,arguments,void 0,(function*(e,t=[],n,o=""){var i,r,c,a,s,l,d,h,u,p,f,y,v,g,m,C,T,I,w,k,N,A,L,S,G,_,b,B,x,R,E,D,F,W,U,O,M,P,V,j,$,H,J,q,z,Q,X,Y,Z,K,ee,te,ne,oe;try{const ie=new jo,re=(0,Jo.ix)(n,e);t.push(e);const ce=null===(i=null==re?void 0:re.data)||void 0===i?void 0:i.the_widget;ie.name=null===(c=null===(r=null==ce?void 0:ce.the_widget_name)||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,ie.html=null===(s=null===(a=null==ce?void 0:ce.the_widget_html)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_html,ie.css=null===(d=null===(l=null==ce?void 0:ce.the_widget_css)||void 0===l?void 0:l.data)||void 0===d?void 0:d.the_css,ie.js=null===(u=null===(h=null==ce?void 0:ce.the_widget_js)||void 0===h?void 0:h.data)||void 0===u?void 0:u.the_js,ie.origin=Number(null===(f=null===(p=null==ce?void 0:ce.the_widget_origin)||void 0===p?void 0:p.data)||void 0===f?void 0:f.the_origin),ie.version=null===(v=null===(y=null==ce?void 0:ce.the_widget_version)||void 0===y?void 0:y.data)||void 0===v?void 0:v.the_version,ie.clean=null===(m=null===(g=null==ce?void 0:ce.the_widget_clean)||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_clean,ie.timestamp=null===(T=null===(C=null==ce?void 0:ce.the_widget_timestamp)||void 0===C?void 0:C.data)||void 0===T?void 0:T.the_timestamp,ie.id=re.id;const ae=null===(w=null===(I=null==ce?void 0:ce.the_widget_type)||void 0===I?void 0:I.data)||void 0===w?void 0:w.the_type;ie.type="null"==ae||null==ae?"the_element_name":ae,ie.after_render=null===(N=null===(k=null==ce?void 0:ce.the_widget_after_render)||void 0===k?void 0:k.data)||void 0===N?void 0:N.the_after_render,ie.before_render=null===(L=null===(A=null==ce?void 0:ce.the_widget_before_render)||void 0===A?void 0:A.data)||void 0===L?void 0:L.the_before_render,ie.update=null===(G=null===(S=null==ce?void 0:ce.the_widget_update)||void 0===S?void 0:S.data)||void 0===G?void 0:G.the_update,ie.widgetId=e,ie.mount_child=null===(b=null===(_=null==ce?void 0:ce.the_widget_mount_child)||void 0===_?void 0:_.data)||void 0===b?void 0:b.the_mount_child;const se=null==ce?void 0:ce.the_widget_s_child,le=null===(B=null==ce?void 0:ce.the_widget_s_css_library)||void 0===B?void 0:B.map((e=>{var t,n,o,i,r,c,a,s;return{order:null===(i=null===(o=null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_css_library)||void 0===n?void 0:n.the_css_library_order)||void 0===o?void 0:o.data)||void 0===i?void 0:i.the_order,url:null===(s=null===(a=null===(c=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.the_css_library)||void 0===c?void 0:c.the_css_library_url)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_url}})),de=null===(x=null==ce?void 0:ce.the_widget_s_js_library)||void 0===x?void 0:x.map((e=>{var t,n,o,i,r,c,a,s;return{order:null===(i=null===(o=null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.the_js_library)||void 0===n?void 0:n.the_js_library_order)||void 0===o?void 0:o.data)||void 0===i?void 0:i.the_order,url:null===(s=null===(a=null===(c=null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.the_js_library)||void 0===c?void 0:c.the_js_library_url)||void 0===a?void 0:a.data)||void 0===s?void 0:s.the_url}}));ie.library={css:le||[],js:de||[]};const he=null===(E=null===(R=null==ce?void 0:ce.the_widget_assistant)||void 0===R?void 0:R.data)||void 0===E?void 0:E.the_assistant;if(ie.assistant={id:null===(F=null===(D=null==he?void 0:he.the_assistant_id)||void 0===D?void 0:D.data)||void 0===F?void 0:F.the_id,input:null===(U=null===(W=null==he?void 0:he.the_assistant_input)||void 0===W?void 0:W.data)||void 0===U?void 0:U.the_input,type:null===(M=null===(O=null==he?void 0:he.the_assistant_type)||void 0===O?void 0:O.data)||void 0===M?void 0:M.the_type},null==se?void 0:se.length)for(let e=0;e<se.length;e++){const i=(null===(j=null===(V=null===(P=se[e])||void 0===P?void 0:P.data.the_child_widget)||void 0===V?void 0:V.the_child_widget_info)||void 0===j?void 0:j.id)||(null===(q=null===(J=null===(H=null===($=se[e])||void 0===$?void 0:$.data.the_child_widget)||void 0===H?void 0:H.the_child_widget_parent)||void 0===J?void 0:J.data)||void 0===q?void 0:q.the_parent),r=yield ei(i,t,n,o),c=null===(Z=null===(Y=null===(X=null===(Q=null===(z=se[e])||void 0===z?void 0:z.data)||void 0===Q?void 0:Q.the_child_widget)||void 0===X?void 0:X.the_child_widget_type)||void 0===Y?void 0:Y.data)||void 0===Z?void 0:Z.the_type,a=null===(oe=null===(ne=null===(te=null===(ee=null===(K=se[e])||void 0===K?void 0:K.data)||void 0===ee?void 0:ee.the_child_widget)||void 0===te?void 0:te.the_child_widget_wrapper)||void 0===ne?void 0:ne.data)||void 0===oe?void 0:oe.the_wrapper;r.type="null"==c||null==c?"the_element_name":c,r.wrapper=a,ie.children.push(r)}return ie}catch(e){throw console.error("error",e),e}}))}function ti(e,t){return zo(this,arguments,void 0,(function*(e,t,n=!0,o,i){var r,c;const a=new No;a.html=e.html,a.widgetType=e.type,a.componentDidMountFunction=e.before_render,a.addEventFunction=e.after_render,a.mountChildWidgetsFunction=e.mount_child,a.widgetState=Object.assign({},i),o&&(a.data=o),t.innerHTML="";const s=t;if(s&&(yield a.mount(s),e.widget=a,e.children.length>0&&(null===(r=a.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){const n=e.children[t];for(let e=0;e<a.childWidgetElement.length;e++){const t=a.childWidgetElement[e];if(n.wrapper===t.id){const e=oi(n);n.html=`<div id="${n.wrapper}">${n.html}</div>`;const o=yield ti(e,t,!1,a.data,a.widgetState);a.childWidgets.push(o),a.css=a.css+o.css+`#${t.id} { ${n.css} }`,o.dataChange((e=>{var t;const n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(a.childrenData[n]=e)}))}}}return console.log("newWidget ->",a,e),yield ri(t,".widget_container"),a}))}function ni(e,t){return zo(this,arguments,void 0,(function*(e,t,n=!0,o,i){var r,c;let a=new No;a.html=e.html,a.widgetState=Object.assign({},o),a.widgetType=e.type,a.componentDidMountFunction=e.before_render,a.addEventFunction=e.after_render,a.mountChildWidgetsFunction=e.mount_child,a.inDevelopment=!1!==i,t.innerHTML="";let s=t;if(s&&(yield a.mount(s),e.widget=a,e.children.length>0&&(null===(r=a.childWidgetElement)||void 0===r?void 0:r.length)>0))for(let t=0;t<(null===(c=e.children)||void 0===c?void 0:c.length);t++){let n=e.children[t];for(let e=0;e<a.childWidgetElement.length;e++){let t=a.childWidgetElement[e];if(n.wrapper===t.id){const e=oi(n),o=yield ni(e,t,!1,a.widgetState,i);a.childWidgets.push(o),a.css=a.css+o.css+`#${t.id} { ${n.css} }`,o.dataChange((e=>{var t;console.log("This is the data change in child",e);let n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(a.childrenData[n]=e),console.log("new child data",a.childrenData)}))}}}return console.log("newWidget ->",a,e),a}))}function oi(e){return e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),e.html=e.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),e.html=e.html.replace(/<[^>]*onclick="widgetSelected\(event\)"\s*,?\s*ondragover="_dragService\.dragOverWidgetElement\(event\)"\s*,?\s*ondrop="_dragService\.dropWidgetElement\(event\)"\s*,?\s*ondragstart="_dragService\.dragStartWidgetElement\(event\)"\s*,?\s*ondragend="_dragService\.dragEndWidgetElement\(event\)"[^>]*>/g,(e=>e.replace(/onclick="widgetSelected\(event\)"/g,'onclick=""').replace(/ondragover="_dragService\.dragOverWidgetElement\(event\)"/g,'ondragover=""').replace(/ondrop="_dragService\.dropWidgetElement\(event\)"/g,'ondrop=""').replace(/ondragstart="_dragService\.dragStartWidgetElement\(event\)"/g,'ondragstart=""').replace(/ondragend="_dragService\.dragEndWidgetElement\(event\)"/g,'ondragend=""').trim())),e.html=e.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),e}function ii(e,t){return zo(this,void 0,void 0,(function*(){return e&&1===e.nodeType&&e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function ri(e,t){return zo(this,void 0,void 0,(function*(){const n=e.querySelectorAll(t);for(const e of n){const n=e.parentElement;if(n){for(;e.firstChild;){const o=yield ii(e.firstChild,t);n.insertBefore(o,e)}n.removeChild(e)}}}))}var ci=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ai(e){return ci(this,arguments,void 0,(function*(e,t=null,n="",o={concepts:[],connections:[]}){var i,r,c,a;if(mi)try{const s=yield Si("CreateData",{json:e,ofConcept:t,typeConcept:n,actions:o});return(null===(r=null===(i=null==s?void 0:s.actions)||void 0===i?void 0:i.concepts)||void 0===r?void 0:r.length)&&(o.concepts=JSON.parse(JSON.stringify(s.actions.concepts))),(null===(a=null===(c=null==s?void 0:s.actions)||void 0===c?void 0:c.connections)||void 0===a?void 0:a.length)&&(o.connections=JSON.parse(JSON.stringify(s.actions.connections))),s.data}catch(e){console.error("CreateTheComposition sw error: ",e),xi(e)}let s=999,l=999,d=(0,P.o)();for(const i in e){let r=si(i);if("string"!=typeof e[i]&&"number"!=typeof e[i])if(null==t||0==t.id)d=yield(0,K.k)(r,"",!0,s,4,l,void 0,o),Array.isArray(e[i])&&(r=li(r)),yield ai(e[i],d,r,o);else{Array.isArray(e[i])&&(r=di(r));let c=di(i),a=yield(0,K.k)(r,"",!0,s,4,l,void 0,o);d=a;let h=ui(n,c),u=yield(0,le.$)(h,l,s,s,o);yield(0,rn.F)(t.id,a.id,u.id,1e3,u.characterValue,s,o),Array.isArray(e[i])&&(r=li(r)),yield ai(e[i],a,r,o)}else{let r=ui(n,i),c=yield(0,le.$)(r,l,s,s,o),a=yield(0,K.k)(i,e[i].toString(),!1,s,4,l,void 0,o);console.log("this is the type concept in down",c,a),null!=t&&(yield(0,rn.F)(t.id,a.id,c.id,1e3,r,s,o))}}return d}))}function si(e){return e.startsWith("the_")?e:"the_"+e}function li(e){return e.endsWith("_s")?e:e+"_s"}function di(e){return e.replace(/_s$/,"")}const hi=e=>/^[+-]?\d+(\.\d+)?$/.test(e);function ui(e,t){return hi(t)?e+"_":e+"_"+function(e){return e.startsWith("the_")?e.slice(4):e}(t)}class pi{constructor(){this.prototype="",this.required=[],this.optional=[],this.concepts=[],this.connections=[],this.addedConcepts=[],this.addedConnections=[],this.childPrototypes=[]}}var fi=n(3077),yi=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function vi(e){return yi(this,void 0,void 0,(function*(){let t=[],n=yield function(e){return yi(this,void 0,void 0,(function*(){let t=yield(0,le.$)("the_prototype_of",999,999,999),n=yield(0,le.$)(e,999,999,999);return yield function(e,t){return yi(this,void 0,void 0,(function*(){let n=yield(0,fi.A)("","",999,e.id,t.id,4,!1);return n.characterValue=t.characterValue,n.typeCharacter=t.characterValue,n.isComposition=!0,n.type=t,n}))}(t,n)}))}(e.prototype),o=yield gi(e.required,n,t,!0),i=yield gi(e.optional,n,t);if(t.push(n),e.childPrototypes.length>0)for(let t=0;t<e.childPrototypes.length;t++)yield vi(e.childPrototypes[t]);return o=[...o,...i],e.concepts=[...t,...e.addedConcepts],e.connections=[...o,...e.addedConnections],{concepts:t,connections:o}}))}function gi(e,t,n){return yi(this,arguments,void 0,(function*(e,t,n,o=!1){var i;let r=[],c=[],a=(null===(i=t.type)||void 0===i?void 0:i.characterValue)+"_prototype";a+=o?"_requires":"_optional";let s=yield(0,le.$)(a,999,999,999);n.push(s);for(let t=0;t<e.length;t++){let n=yield(0,le.$)(e[t],999,999,999);r.push(n)}for(let e=0;e<r.length;e++){let n=yield(0,rn.F)(t.id,r[e].id,s.id,1e3,a,999);c.push(n)}for(let e=0;e<r.length;e++)n.push(r[e]);return c}))}var mi,Ci=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const Ti=Date.now().toString(36)+Math.random().toString(36).substring(2);let Ii=[],wi=[],ki=!1;function Ni(e){ki=e}function Ai(e="",t){vt.b.BearerAccessToken=e,null==typeof document?vt.b.sessionId=t:vt.b.sessionId=parseInt((0,vo.R)("SessionId")),mi&&Si("updateAccessToken",{accessToken:e,session:parseInt((0,vo.R)("SessionId"))})}function Li(){return Ci(this,arguments,void 0,(function*(e="",t="",n="",o="",i=!0,c="",a=void 0,s={},d={}){var u;try{l.B.BASE_URL=e,l.B.AI_URL=t,l.B.NODE_URL=o,l.B.BASE_APPLICATION=c,l.B.LOG_SERVER=null!==(u=d.logserver)&&void 0!==u?u:"https://logdev.freeschema.com",console.log("setting the logserver",l.B.LOG_SERVER,d.logserver),Ai(n);let i=Math.floor(1e8*Math.random());l.B.setRandomizer(i);const p={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(l.B.FLAGS=p,l.B.FLAGS=Object.assign(Object.assign({},p),s),function(e){const t=vo.V.logfunction("initializeFlags",arguments);try{return e.logApplication&&(go.initialize(),vo.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(vo.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(qe.J.activateStatus=!0,console.warn("Access Tracker Activated.")),e.isTest&&(r.B.isDataLoaded=!0,r.B.isCharacterLoaded=!0,r.B.isTypeLoaded=!0,r.B.isLocalDataLoaded=!0,r.B.isLocalTypeLoaded=!0,r.B.isLocalCharacterLoaded=!0,r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0,r.B.isLocalConnectionLoaded=!0),vo.V.logUpdate(t),e}catch(e){throw(0,h.ey)(t,"initializeFlags",e),e}}(l.B.FLAGS),!("serviceWorker"in navigator))return yield _i(),void console.warn("Service Worker not supported in this browser.");if(yield function(){return Ci(this,void 0,void 0,(function*(){const e=sessionStorage.getItem("myCacheServer");function t(e){return Ci(this,void 0,void 0,(function*(){try{const t=yield fetch(l.B.getMyCacheServer(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({"my-coords":e?e.coords:"location denied"})});if(!t.ok)throw new Error("Failed to sync data to the server.");const n=yield t.json();n.success&&(sessionStorage.setItem("myCacheServer",n.nearestServer),l.B.NODE_CACHE_URL=n.nearestServer)}catch(e){console.error("error getting cache server",e.message)}}))}e?l.B.NODE_CACHE_URL=e:navigator.geolocation.getCurrentPosition((e=>Ci(this,void 0,void 0,(function*(){yield t(e)}))),(e=>Ci(this,void 0,void 0,(function*(){e.code===e.PERMISSION_DENIED&&(yield t())}))))}))}(),function(){navigator.serviceWorker.addEventListener("message",(e=>Ci(this,void 0,void 0,(function*(){var t,n,o,i;try{if(e.data&&"API_401"===e.data.type){const{requestDetails:o}=e.data,i={method:o.method,headers:new Headers(o.headers),body:o.body},r=yield fetch(o.url,i),c=yield null==r?void 0:r.json();null===(n=null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||void 0===n||n.postMessage({type:"API_RESPONSE",messageId:e.data.messageId,response:new Response(c,{status:r.status,statusText:r.statusText,headers:r.headers})})}}catch(t){console.error("Error during listenPostMessage",t),null===(i=null===(o=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===o?void 0:o.controller)||void 0===i||i.postMessage({type:"API_RESPONSE",messageId:e.data.messageId})}}))))}(),function(){yo.x.addEventListener("message",(e=>Ci(this,void 0,void 0,(function*(){const{type:t,payload:n}=e.data;if(!t)return;let o={success:!1,data:void 0};Gi[t]?yield Gi[t](n):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),a&&a.activate&&a.manual)yield new Promise(((e,t)=>{navigator.serviceWorker.ready.then((t=>Ci(this,void 0,void 0,(function*(){console.log("registraions ready",t),mi=t.active,yield Ri(),e("done")})))).catch((e=>{console.error("Error: Ready service worker",e),t(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>t("Timeout ready")),3e4)}));else if(a&&(null==a?void 0:a.activate))try{console.log("service worker initialiing"),yield function(e){var t=arguments;return Ci(this,void 0,void 0,(function*(){const n=vo.V.logfunction("handleRegisterServiceWorker",t);yield new Promise(((t,o)=>{var i,r;let c=!1;navigator.serviceWorker.register(null!==(i=e.pathToSW)&&void 0!==i?i:"./serviceWorker.bundle.js",{scope:null!==(r=e.scope)&&void 0!==r?r:"/"}).then((e=>Ci(this,void 0,void 0,(function*(){console.log("Service Worker registered:",e),setInterval((()=>{wi.length&&Bi()}),2e3),console.log("update listen start"),e.onupdatefound=()=>{const n=e.installing;console.log("new worker",n),n&&(n.onstatechange=()=>Ci(this,void 0,void 0,(function*(){console.warn("on state change triggered",n.state,navigator.serviceWorker.controller),"installing"===n.state&&(console.log("Service Worker installing"),mi=void 0),"activated"!==n.state&&"redundant"!==n.state||!navigator.serviceWorker.controller||(mi=n,console.log("New Service Worker is active",e),setTimeout((()=>{console.log("Message Processed after some time"),Bi()}),5e3),yield Ri(),c=!0,Bi(),t())})))},e.addEventListener("controllerchange",(()=>Ci(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(mi=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield Ri())})))),(e.installing||e.waiting||e.active)&&e.addEventListener("statechange",(e=>Ci(this,void 0,void 0,(function*(){var t;"activating"===(null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.state)&&(mi=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield Ri())})))),e.active?(console.log("active sw"),mi=e.active,yield Ri(),Bi(),t()):setTimeout((()=>{c||o("Not Completed Initialization")}),1e4)})))).catch((e=>Ci(this,void 0,void 0,(function*(){yield _i(),o(e),console.error("Service Worker registration failed:",e),(0,h.ey)(n,"handleRegisterServiceWorker",e)}))))}))}))}(a)}catch(e){yield _i(),console.error("Unable to start service worker",e)}else yield _i(),console.warn("Service Worker not activated");return!0}catch(e){yield _i(),console.warn("Cannot initialize the system",e)}}))}function Si(e,t){return Ci(this,arguments,void 0,(function*(e,t,n=0){let o=!1;const i=Math.random().toString(36).substring(2);t.messageId=i,t.TABID=Ti;const r=JSON.parse(JSON.stringify(t));let c;return"checkProcess"!=e&&0==n&&(c=setInterval((()=>Ci(this,void 0,void 0,(function*(){if(console.log("process took more than one second",i,e,o),!o&&!(yield function(e,t){return Ci(this,void 0,void 0,(function*(){var n;try{const o=yield Si("checkProcess",{checkMessageId:e});if(console.log("check interval data res for type ",t,e,o.data),null===(n=null==o?void 0:o.data)||void 0===n?void 0:n.processing)return!0}catch(n){return console.error("error on checing executing process",t,e,n),!1}}))}(i,e))&&(clearInterval(c),!o)){if(console.log("Failed to handle type "+e+" message not found "+i,"retrying: ",0==n,e),0==n&&"checkProcess"!=e)return console.log("retrying ",e,i),yield Si(e,t,n+1);console.log("Failed to handle type "+e+" "+i)}}))),2e3)),new Promise(((n,a)=>{if(navigator.serviceWorker.controller||mi||console.log("will go to queue",navigator.serviceWorker.controller,mi,e),navigator.serviceWorker.controller||mi){const s=r=>{var l,d,u,p,f,y;(null===(l=null==r?void 0:r.data)||void 0===l?void 0:l.messageId)==i&&(o=!0,clearInterval(c),r.data.success||(401==(null===(d=null==r?void 0:r.data)||void 0===d?void 0:d.status)?a((0,h.ry)(new Response("Unauthorized",{status:401,statusText:null===(u=null==r?void 0:r.data)||void 0===u?void 0:u.statusText}))):500==(null===(p=null==r?void 0:r.data)||void 0===p?void 0:p.status)?a((0,h.Mb)(new Response("Internal Server Error",{status:500,statusText:null===(f=null==r?void 0:r.data)||void 0===f?void 0:f.statusText}))):(console.error("Error in the response from worker:",r),a(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(r.data)}`))),(null===(y=r.data)||void 0===y?void 0:y.actions)&&(t.actions=JSON.parse(JSON.stringify(r.data.actions))),n(r.data),navigator.serviceWorker.removeEventListener("message",s))};if(navigator.serviceWorker.addEventListener("message",s),navigator.serviceWorker.controller)"checkProcess"!=e&&console.log("sent to sw",e,i),navigator.serviceWorker.controller.postMessage({type:e,payload:r});else if(mi){console.warn(`controller not found but serviceWorker is available. messageId: ${i}, type: ${e}`);try{mi.postMessage({type:e,payload:r})}catch(t){console.log("Retrying again on catch service worker",t),mi.postMessage({type:e,payload:r})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${i}, type: ${e}`),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${i}, type: ${e}`),mi?(console.info("This is triggered "),null==mi||mi.postMessage({type:e,payload:t})):(console.log("not ready",e),clearInterval(c),a("Service worker not ready"))}),3e4);setTimeout((()=>{clearInterval(c),a(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",s)}),21e4)}else wi.push({message:{type:e,payload:r}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller,mi,e),"init"==e&&(clearInterval(c),n(null))}))}))}const Gi={GetLinkListener:e=>Ci(void 0,void 0,void 0,(function*(){const t=Ii.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>Ci(void 0,void 0,void 0,(function*(){if(mi){let t=new CustomEvent(e.id||"",e.data);dispatchEvent(t)}return{success:!0}})),checkInit:e=>Ci(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),mi=navigator.serviceWorker.controller),yield Ri(),{success:!0}}))};function _i(){return Ci(this,void 0,void 0,(function*(){yield(0,fo.A)();const e=(new Date).getTime();yield(0,i.A)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})).catch((e=>{throw e})),yield(0,po.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,uo.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,po.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,uo.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)})).catch((e=>{throw e}))}))}function bi(e,t={}){if(mi||"undefined"!=typeof window){let n=new CustomEvent(`${e}`,t);dispatchEvent(n)}else yo.x.postMessage({type:"dispatchEvent",payload:{id:e,data:t}})}function Bi(){return Ci(this,void 0,void 0,(function*(){console.log("message queue",wi);const e=wi.find((e=>{var t;return"init"==(null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.type)}));if(e){console.log("Processing Init Queue poped",null==e?void 0:e.type,e);const t=wi.indexOf(e);t>-1&&wi.splice(t,1),yield Si(null==e?void 0:e.type,null==e?void 0:e.payload)}for(console.log("message queue while",wi);wi.length>0;){const{message:e,resolve:t,reject:n}=wi.shift();console.log("Queue poped",e.type,e),yield Si(e.type,e.payload)}}))}const xi=e=>{if(e instanceof j.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)};function Ri(){return Ci(this,void 0,void 0,(function*(){yield Si("init",{url:l.B.BASE_URL,aiurl:l.B.AI_URL,accessToken:vt.b.BearerAccessToken,nodeUrl:l.B.NODE_URL,enableAi:!1,applicationName:l.B.BASE_APPLICATION,flags:l.B.FLAGS})}))}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o=n(2370),i=o.ADMIN,r=o.ALLID,c=o.AccessTracker,a=o.AddGhostConcept,s=o.Anomaly,l=o.BaseUrl,d=o.BinaryTree,h=o.BuildWidgetFromId,u=o.BuilderStatefulWidget,p=o.Composition,f=o.CompositionBinaryTree,y=o.CompositionNode,v=o.Concept,g=o.ConceptsData,m=o.Connection,C=o.ConnectionData,T=o.CreateComposition,I=o.CreateConnectionBetweenEntityLocal,w=o.CreateConnectionBetweenTwoConcepts,k=o.CreateConnectionBetweenTwoConceptsGeneral,N=o.CreateConnectionBetweenTwoConceptsLocal,A=o.CreateData,L=o.CreateDefaultConcept,S=o.CreateDefaultLConcept,G=o.CreateSession,_=o.CreateSessionVisit,b=o.CreateTheCompositionLocal,B=o.CreateTheCompositionWithCache,x=o.CreateTheConnection,R=o.CreateTheConnectionGeneral,E=o.CreateTheConnectionLocal,D=o.DATAID,F=o.DATAIDDATE,W=o.DelayFunctionExecution,U=o.DeleteConceptById,O=o.DeleteConceptLocal,M=o.DeleteConnectionById,P=o.DeleteConnectionByType,V=o.DeleteUser,j=o.DependencyObserver,$=o.FilterSearch,H=o.FormatFromConnections,J=o.FormatFromConnectionsAltered,q=o.FreeschemaQuery,z=o.FreeschemaQueryApi,Q=o.GetAllConnectionsOfComposition,X=o.GetAllConnectionsOfCompositionBulk,Y=o.GetAllTheConnectionsByTypeAndOfTheConcept,Z=o.GetComposition,K=o.GetCompositionBulk,ee=o.GetCompositionBulkWithDataId,te=o.GetCompositionFromConnectionsWithDataId,ne=o.GetCompositionFromConnectionsWithDataIdFromConnections,oe=o.GetCompositionFromConnectionsWithDataIdInObject,ie=o.GetCompositionFromConnectionsWithDataIdIndex,re=o.GetCompositionFromConnectionsWithIndex,ce=o.GetCompositionFromConnectionsWithIndexFromConnections,ae=o.GetCompositionFromMemoryWithConnections,se=o.GetCompositionList,le=o.GetCompositionListAll,de=o.GetCompositionListAllWithId,he=o.GetCompositionListListener,ue=o.GetCompositionListLocal,pe=o.GetCompositionListLocalWithId,fe=o.GetCompositionListWithId,ye=o.GetCompositionListWithIdUpdated,ve=o.GetCompositionListener,ge=o.GetCompositionLocal,me=o.GetCompositionLocalWithId,Ce=o.GetCompositionWithAllIds,Te=o.GetCompositionWithCache,Ie=o.GetCompositionWithDataIdBulk,we=o.GetCompositionWithDataIdWithCache,ke=o.GetCompositionWithId,Ne=o.GetCompositionWithIdAndDateFromMemory,Ae=o.GetConceptBulk,Le=o.GetConceptByCharacter,Se=o.GetConceptByCharacterAndCategoryLocal,Ge=o.GetConceptByCharacterAndType,_e=o.GetConnectionBetweenTwoConceptsLinker,be=o.GetConnectionBulk,Be=o.GetConnectionById,xe=o.GetConnectionDataPrefetch,Re=o.GetConnectionOfTheConcept,Ee=o.GetLink,De=o.GetLinkListListener,Fe=o.GetLinkListener,We=o.GetLinkRaw,Ue=o.GetLinkerConnectionFromConcepts,Oe=o.GetLinkerConnectionToConcepts,Me=o.GetRelation,Pe=o.GetRelationLocal,Ve=o.GetRelationRaw,je=o.GetTheConcept,$e=o.GetTheConceptLocal,He=o.GetUserGhostId,Je=o.JUSTDATA,qe=o.LConcept,ze=o.LConnection,Qe=o.LISTNORMAL,Xe=o.LocalConceptsData,Ye=o.LocalSyncData,Ze=o.LocalTransaction,Ke=o.Logger,et=o.LoginToBackend,tt=o.MakeTheInstanceConcept,nt=o.MakeTheInstanceConceptLocal,ot=o.MakeTheTimestamp,it=o.MakeTheTypeConcept,rt=o.MakeTheTypeConceptApi,ct=o.MakeTheTypeConceptLocal,at=o.NORMAL,st=o.PRIVATE,lt=o.PUBLIC,dt=o.PatcherStructure,ht=o.Prototype,ut=o.RAW,pt=o.RecursiveSearchApi,ft=o.RecursiveSearchApiNewRawFullLinker,yt=o.RecursiveSearchApiRaw,vt=o.RecursiveSearchApiRawFullLinker,gt=o.RecursiveSearchApiWithInternalConnections,mt=o.RecursiveSearchListener,Ct=o.SchemaQueryListener,Tt=o.SearchAllConcepts,It=o.SearchLinkInternal,wt=o.SearchLinkInternalAll,kt=o.SearchLinkMultipleAll,Nt=o.SearchLinkMultipleAllObservable,At=o.SearchLinkMultipleApi,Lt=o.SearchQuery,St=o.SearchStructure,Gt=o.SearchWithLinker,_t=o.SearchWithTypeAndLinker,bt=o.SearchWithTypeAndLinkerApi,Bt=o.SessionData,xt=o.Signin,Rt=o.Signup,Et=o.SignupEntity,Dt=o.SplitStrings,Ft=o.StatefulWidget,Wt=o.SyncData,Ut=o.TrashTheConcept,Ot=o.UpdateComposition,Mt=o.UpdateCompositionLocal,Pt=o.UserBinaryTree,Vt=o.Validator,jt=o.ViewInternalData,$t=o.ViewInternalDataApi,Ht=o.WidgetTree,Jt=o.convertFromConceptToLConcept,qt=o.convertFromLConceptToConcept,zt=o.convertWidgetTreeToWidget,Qt=o.convertWidgetTreeToWidgetWithWrapper,Xt=o.createFormFieldData,Yt=o.createPrototypeLocal,Zt=o.dispatchIdEvent,Kt=o.getFromDatabaseWithType,en=o.getObjectsFromIndexDb,tn=o.getWidgetBulkFromId,nn=o.getWidgetFromId,on=o.handleServiceWorkerException,rn=o.hasActivatedSW,cn=o.init,an=o.recursiveFetch,sn=o.recursiveFetchNew,ln=o.renderLatestWidget,dn=o.renderPage,hn=o.renderWidget,un=o.searchLinkMultipleListener,pn=o.sendEmail,fn=o.sendMessage,yn=o.serviceWorker,vn=o.setHasActivatedSW,gn=o.storeToDatabase,mn=o.subscribedListeners,Cn=o.unwrapContainers,Tn=o.updateAccessToken,In=o.uploadAttachment,wn=o.uploadFile,kn=o.uploadImage,Nn=o.validDocumentFormats,An=o.validImageFormats;export{i as ADMIN,r as ALLID,c as AccessTracker,a as AddGhostConcept,s as Anomaly,l as BaseUrl,d as BinaryTree,h as BuildWidgetFromId,u as BuilderStatefulWidget,p as Composition,f as CompositionBinaryTree,y as CompositionNode,v as Concept,g as ConceptsData,m as Connection,C as ConnectionData,T as CreateComposition,I as CreateConnectionBetweenEntityLocal,w as CreateConnectionBetweenTwoConcepts,k as CreateConnectionBetweenTwoConceptsGeneral,N as CreateConnectionBetweenTwoConceptsLocal,A as CreateData,L as CreateDefaultConcept,S as CreateDefaultLConcept,G as CreateSession,_ as CreateSessionVisit,b as CreateTheCompositionLocal,B as CreateTheCompositionWithCache,x as CreateTheConnection,R as CreateTheConnectionGeneral,E as CreateTheConnectionLocal,D as DATAID,F as DATAIDDATE,W as DelayFunctionExecution,U as DeleteConceptById,O as DeleteConceptLocal,M as DeleteConnectionById,P as DeleteConnectionByType,V as DeleteUser,j as DependencyObserver,$ as FilterSearch,H as FormatFromConnections,J as FormatFromConnectionsAltered,q as FreeschemaQuery,z as FreeschemaQueryApi,Q as GetAllConnectionsOfComposition,X as GetAllConnectionsOfCompositionBulk,Y as GetAllTheConnectionsByTypeAndOfTheConcept,Z as GetComposition,K as GetCompositionBulk,ee as GetCompositionBulkWithDataId,te as GetCompositionFromConnectionsWithDataId,ne as GetCompositionFromConnectionsWithDataIdFromConnections,oe as GetCompositionFromConnectionsWithDataIdInObject,ie as GetCompositionFromConnectionsWithDataIdIndex,re as GetCompositionFromConnectionsWithIndex,ce as GetCompositionFromConnectionsWithIndexFromConnections,ae as GetCompositionFromMemoryWithConnections,se as GetCompositionList,le as GetCompositionListAll,de as GetCompositionListAllWithId,he as GetCompositionListListener,ue as GetCompositionListLocal,pe as GetCompositionListLocalWithId,fe as GetCompositionListWithId,ye as GetCompositionListWithIdUpdated,ve as GetCompositionListener,ge as GetCompositionLocal,me as GetCompositionLocalWithId,Ce as GetCompositionWithAllIds,Te as GetCompositionWithCache,Ie as GetCompositionWithDataIdBulk,we as GetCompositionWithDataIdWithCache,ke as GetCompositionWithId,Ne as GetCompositionWithIdAndDateFromMemory,Ae as GetConceptBulk,Le as GetConceptByCharacter,Se as GetConceptByCharacterAndCategoryLocal,Ge as GetConceptByCharacterAndType,_e as GetConnectionBetweenTwoConceptsLinker,be as GetConnectionBulk,Be as GetConnectionById,xe as GetConnectionDataPrefetch,Re as GetConnectionOfTheConcept,Ee as GetLink,De as GetLinkListListener,Fe as GetLinkListener,We as GetLinkRaw,Ue as GetLinkerConnectionFromConcepts,Oe as GetLinkerConnectionToConcepts,Me as GetRelation,Pe as GetRelationLocal,Ve as GetRelationRaw,je as GetTheConcept,$e as GetTheConceptLocal,He as GetUserGhostId,Je as JUSTDATA,qe as LConcept,ze as LConnection,Qe as LISTNORMAL,Xe as LocalConceptsData,Ye as LocalSyncData,Ze as LocalTransaction,Ke as Logger,et as LoginToBackend,tt as MakeTheInstanceConcept,nt as MakeTheInstanceConceptLocal,ot as MakeTheTimestamp,it as MakeTheTypeConcept,rt as MakeTheTypeConceptApi,ct as MakeTheTypeConceptLocal,at as NORMAL,st as PRIVATE,lt as PUBLIC,dt as PatcherStructure,ht as Prototype,ut as RAW,pt as RecursiveSearchApi,ft as RecursiveSearchApiNewRawFullLinker,yt as RecursiveSearchApiRaw,vt as RecursiveSearchApiRawFullLinker,gt as RecursiveSearchApiWithInternalConnections,mt as RecursiveSearchListener,Ct as SchemaQueryListener,Tt as SearchAllConcepts,It as SearchLinkInternal,wt as SearchLinkInternalAll,kt as SearchLinkMultipleAll,Nt as SearchLinkMultipleAllObservable,At as SearchLinkMultipleApi,Lt as SearchQuery,St as SearchStructure,Gt as SearchWithLinker,_t as SearchWithTypeAndLinker,bt as SearchWithTypeAndLinkerApi,Bt as SessionData,xt as Signin,Rt as Signup,Et as SignupEntity,Dt as SplitStrings,Ft as StatefulWidget,Wt as SyncData,Ut as TrashTheConcept,Ot as UpdateComposition,Mt as UpdateCompositionLocal,Pt as UserBinaryTree,Vt as Validator,jt as ViewInternalData,$t as ViewInternalDataApi,Ht as WidgetTree,Jt as convertFromConceptToLConcept,qt as convertFromLConceptToConcept,zt as convertWidgetTreeToWidget,Qt as convertWidgetTreeToWidgetWithWrapper,Xt as createFormFieldData,Yt as createPrototypeLocal,Zt as dispatchIdEvent,Kt as getFromDatabaseWithType,en as getObjectsFromIndexDb,tn as getWidgetBulkFromId,nn as getWidgetFromId,on as handleServiceWorkerException,rn as hasActivatedSW,cn as init,an as recursiveFetch,sn as recursiveFetchNew,ln as renderLatestWidget,dn as renderPage,hn as renderWidget,un as searchLinkMultipleListener,pn as sendEmail,fn as sendMessage,yn as serviceWorker,vn as setHasActivatedSW,gn as storeToDatabase,mn as subscribedListeners,Cn as unwrapContainers,Tn as updateAccessToken,In as uploadAttachment,wn as uploadFile,kn as uploadImage,Nn as validDocumentFormats,An as validImageFormats};
|