mftsccs-browser 2.0.23-beta → 2.0.24-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.
@@ -1 +1 @@
1
- var e={1735:(e,t,n)=>{n.d(t,{J:()=>s});var o,i=n(6366),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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=s,s.conceptsData={},s.connectionsData={},s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=Date.now(),s.activateStatus=!1,s.accessData="Access Data",o.startAutoSync()},1167:(e,t,n)=>{n.d(t,{Y:()=>a});var o=n(9581),i=n(3518),r=n(6366),c=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=(0,r.CreateDefaultConcept)();try{var n=(0,i.Xr)();const r=yield fetch(o.B.CreateTheConceptUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!r.ok)throw(0,c.r)(r),new Error(`Error! status: ${r.status}`);return t=yield r.json(),t}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.M)(e,o.B.CreateTheConceptUrl())}}))}},2:(e,t,n)=>{n.d(t,{s:()=>l});var o=n(8286),i=n(9581),r=n(1412),c=n(3518),s=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){var t=[];if(0==(t=yield o.d.GetConnectionsOfConcept(e)).length)t=yield d(e);else{var n=yield d(e);(0,r.e)(n,t),t=n}return t}))}function d(e){return a(this,void 0,void 0,(function*(){var t=[];try{(0,c.Xr)("application/json");const r=new Headers,a=new FormData;a.append("composition_id",e.toString());const l=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:r,body:a});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!l.ok)throw(0,s.r)(l),new Error(`Error! status: ${l.status}`);const d=yield l.json();for(var n=0;n<d.length;n++)o.d.AddConnection(d[n]),t.push(d[n]);return t}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,s.M)(e,i.B.GetAllConnectionsOfCompositionUrl())}}))}},8642:(e,t,n)=>{n.d(t,{Y:()=>u});var o=n(8286),i=n(9581),r=n(4364),c=n(5284),s=n(1412),a=n(3518),l=n(1863),d=n(6366),h=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function u(){return h(this,arguments,void 0,(function*(e=[]){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:e})).data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,d.handleServiceWorkerException)(e)}var t=[];if(e.length<=0)return t;var n=yield(0,c.B)(e),u=yield function(){return h(this,arguments,void 0,(function*(e=[]){var t=[];try{var n=(0,a.Xr)();const c=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(c.ok){const e=yield c.json();for(var r=0;r<e.length;r++)o.d.AddConnection(e[r]),t.push(e[r])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.r)(c);return t}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.M)(e,i.B.GetAllConnectionsOfCompositionBulkUrl())}}))}(e);return t=u,(0,s.e)(t,n),yield(0,r.s)(t),t}))}},2803:(e,t,n)=>{n.d(t,{x:()=>a});var o=n(8286),i=n(9581),r=n(1863),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e,t,n){return s(this,void 0,void 0,(function*(){var s=[];try{if(c.serviceWorker)try{return(yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:n})).data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,c.handleServiceWorkerException)(e)}var a=new FormData;a.append("ofConceptId",e.toString()),a.append("mainKey",n.toString()),a.append("toConceptId",t.toString());const d=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:a,redirect:"follow"});if(d.ok){const e=yield d.json();for(var l=0;l<e.length;l++)o.d.AddConnection(e[l]),s.push(e[l])}else console.log("Get composition connection between two concepts",d.status),(0,r.r)(d)}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.M)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl())}return s}))}},7139:(e,t,n)=>{n.d(t,{r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(6366),s=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){try{if(c.serviceWorker)try{return(yield(0,c.sendMessage)("GetConcept",{id:e})).data}catch(e){console.error("GetConcept sw error: ",e),(0,c.handleServiceWorkerException)(e)}let n=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return n;var t=yield o.I.GetConcept(e);let a=o.I.GetNpc(e);if(0!=t.id||a)return t;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const t=new FormData;t.append("id",e.toString());const c=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:t});return c.ok?(n=yield c.json(),n.id>0?o.I.AddConcept(n):o.I.AddNpc(e)):(console.log("Get the concept error",c.status),(0,s.r)(c)),n}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,s.M)(e,i.B.GetConceptUrl())}}))}},1239:(e,t,n)=>{n.d(t,{I:()=>d,r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){let t=[],n=((new Date).getTime(),performance.now()),a=Array.from(new Set(e));try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptBulk",{passedConcepts:e})).data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,s.handleServiceWorkerException)(e)}if(a.length>0){let e=[];for(let t=0;t<a.length;t++)0==(yield o.I.GetConcept(a[t])).id&&e.push(a[t]);if(0==e.length)return t;{let a=(0,r.Xr)();const l=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:a,body:JSON.stringify(e)});if(l.ok){if(t=yield l.json(),t.length>0)for(let e=0;e<t.length;e++){let n=t[e];o.I.AddConcept(n)}console.log("added the concepts")}else console.log("Get Concept Bulk error",l.status),s.Logger.logError(n,"unknown","read","unknown",void 0,l.status,l,"GetConceptBulk",["passedConcepts"],"unknown",void 0),(0,c.r)(l)}}}catch(e){e instanceof Error?console.log("Get Concept Bulk error message: ",e.message):console.log("Get Concept Bulk unexpected error: ",e),s.Logger.logError(n,"unknown","read","unknown",void 0,500,e,"GetConceptBulk",["passedConcepts"],"unknown",void 0),(0,c.M)(e,i.B.GetConceptBulkUrl())}return t}))}function d(e){return a(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.r)(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.M)(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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t){return a(this,void 0,void 0,(function*(){try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,s.handleServiceWorkerException)(e)}let d=yield o.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==d||0==d.id){var n={character_value:`${e}`,type_id:t},a=JSON.stringify(n),l=(0,r.Xr)();const s=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:l,body:a});s.ok?(d=yield s.json(),o.I.AddConcept(d)):((0,c.r)(s),console.log("This is the concept by type and character error",s.status))}return d}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.M)(e,i.B.GetConceptByCharacterAndTypeUrl())}}))}},8146:(e,t,n)=>{n.d(t,{Y:()=>a});var o=n(9639),i=n(9581),r=n(6366),c=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=(0,r.CreateDefaultConcept)();try{const n=new FormData;n.append("character_value",e);const r=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:n});r.ok?(t=yield r.json(),t.id>0&&o.I.AddConcept(t)):((0,c.r)(r),console.log("Error in Getting concept by character value Error",r.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.M)(e,i.B.GetConceptByCharacterValueUrl())}return t}))}},7467:(e,t,n)=>{n.d(t,{j:()=>d});var o=n(8286),i=n(9581),r=n(4364),c=n(3518),s=n(1863),a=n(6366),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){let t=[];try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetConnectionBulk",{connectionIds:e})).data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(e.length>0){let n=[];for(let i=0;i<e.length;i++){let r=yield o.d.GetConnection(e[i]);0==r.id?n.push(e[i]):t.push(r)}if(0==n.length)return t;{let e=(0,c.Xr)();const r=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(n)});if(r.ok){const e=yield r.json();if(e.length>0)for(let n=0;n<e.length;n++){let i=e[n];t.push(i),o.d.AddConnection(i)}}else(0,s.r)(r),console.log("Get Connection Bulk error",r.status)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,s.M)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(t),t}))}},3130:(e,t,n)=>{n.d(t,{BG:()=>a,SL:()=>l,XZ:()=>s,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>o});const o=1,i=2,r=3,c=4,s=5,a=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.BASE_URL+"/api/getConcept"}static GetConnectionUrl(){return this.BASE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return this.BASE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return this.BASE_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 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.NODE_URL+"/api/v1/logger/logs"}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"}}o.BASE_URL="https://localhost:7053/",o.AI_URL="https://ai.freeschema.com",o.MQTT_URL="192.168.1.249",o.NODE_URL="http://localhost:5001",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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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:()=>a});var o=n(6963),i=n(6731),r=n(205),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a{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 s(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(a.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 s(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return s(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 s(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}}a.root=null},5457:(e,t,n)=>{n.d(t,{c:()=>a});var o=n(6366),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,s;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 a=this.getBalanceFactor(e);return a>1&&t<(null===(o=e.leftNode)||void 0===o?void 0:o.key)?this.rightRotate(e):a<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):a>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):a<-1&&t<(null===(s=e.rightNode)||void 0===s?void 0:s.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 s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a{static addType(e){return s(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,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 s(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 s(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(a.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return s(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 s(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}}a.typeRoot=null,a.root=null},2615:(e,t,n)=>{n.d(t,{j:()=>i});var o=n(6366);class i{constructor(e,t,n,i,r,c,s,a=!1,l,d,h){this.count=0,this.typeCharacter="",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=s,this.typeCharacter=h,this.type=null,this.isNew=a,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),s=n(7282),a=n(6366),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(a.serviceWorker)try{(0,a.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,a.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(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,s.o)();var t=(0,s.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,s.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,s.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,s.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var n=(0,s.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){return l(this,void 0,void 0,(function*(){if(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,a.handleServiceWorkerException)(e)}let n=[];return n=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),n}))}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,s,a){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=s,this.accessId=a,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,n)=>{n.d(t,{O:()=>s});var o=n(205),i=n(6366);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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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(s.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)}))}}s.connectionroot=null},991:(e,t,n)=>{n.d(t,{H:()=>s});var o=n(6366),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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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}`),(0,o.dispatchIdEvent)(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,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))}))}}s.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(6366),r=n(3655),c=n(2155),s=n(5239),a=n(991),l=n(3996);class d extends l.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 h{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{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((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 d(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new d(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}}h.connectionTypeRoot=null;var u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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),h.addConnectionToTree(e),a.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),h.addConnectionToTree(e),a.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),a.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){a.H.node}static GetConnectionByOfTheConceptAndType(e,t){return u(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 a.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){return h.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}static GetConnectionTree(){return s.O.connectionroot}static GetConnectionTypeTree(){return h.connectionTypeRoot}static GetConnectionBulkData(e,t,n){return u(this,void 0,void 0,(function*(){yield s.O.getConnectionListFromIds(e,t,n)}))}static GetConnection(e){return u(this,void 0,void 0,(function*(){o.J.incrementConnection(e);let t=new c.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){return u(this,void 0,void 0,(function*(){let t=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e})).data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,i.handleServiceWorkerException)(e)}let n=[];n=f.GetConnectionByOfType(e,e);for(let e=0;e<n.length;e++){let o=yield s.O.getNodeFromTree(n[e]);o&&t.push(o.value)}}catch(n){console.log("this is the error GetConnectionsOfCompositionLocal",e,t)}return t}))}static GetConnectionsOfConcept(e){return u(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:()=>m});var o=n(9003),i=n(205),r=n(2515),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 addConceptToTree(e){var t=new r.x(e.id,e,null,null);new r.x(e.characterValue,e,null,null),this.addNodeToTree(t)}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(i.B.isLocalDataLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static getNodeFromTree(e){return c(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 c(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}s.root=null;var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{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(i.B.isLocalCharacterLoaded)return e("done");setTimeout(l.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 r.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))}}l.LocalCharacterRoot=null;var d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class h{static addNodeToTree(e){return d(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 r.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 d(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(i.B.isLocalTypeLoaded)return e("done");setTimeout(h.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return d(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}))}}h.LocalTypeRoot=null;var u=n(6416),f=n(9639),p=n(7820),y=n(4864),v=n(628),g=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class m{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&((0,o.kH)("localconcept",e),s.addConceptToTree(e),l.addConceptToTree(e),h.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),h.removeConceptType(e.typeId,e.ghostId),p.G.addConceptToTree(e),(0,o.wh)("localconcept",e.ghostId),f.I.AddConcept(e))}static RemoveConcept(e){return g(this,void 0,void 0,(function*(){try{0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),h.removeConceptType(e.typeId,e.ghostId),yield(0,o.wh)("localconcept",e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return g(this,void 0,void 0,(function*(){try{let t=yield m.GetConcept(e);0!=t.id&&(s.removeNodeFromTree(e),l.removeConceptType(t.characterValue,t.ghostId),h.removeConceptType(t.typeId,t.ghostId),v.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(s.addConceptToTree(e),l.addConceptToTree(e),h.addConceptToTree(e))}static GetConcept(e){return g(this,void 0,void 0,(function*(){var t=(0,u.u)(),n=yield s.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static UpdateConceptSyncStatus(e){return g(this,void 0,void 0,(function*(){s.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return g(this,void 0,void 0,(function*(){var t=(0,u.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 g(this,void 0,void 0,(function*(){var t=(0,u.u)(),n=l.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return g(this,void 0,void 0,(function*(){var n=(0,u.u)(),o=yield l.getCharacterAndTypeFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptByCharacterAndCategoryLocal(e,t){return g(this,void 0,void 0,(function*(){var n=(0,u.u)(),o=yield l.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 g(this,void 0,void 0,(function*(){let n=[];return n=yield h.getTypeVariantsFromTreeWithUserId(e,t),n}))}static ClearData(){return g(this,void 0,void 0,(function*(){this.localconceptsArray=[],y.G.connectionArray=[]}))}getName(){return this.name}}m.localconceptsArray=[]},4864:(e,t,n)=>{n.d(t,{G:()=>l});var o=n(9003),i=n(2155),r=n(8286),c=n(205),s=n(628),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{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),0!=e.id&&(0,o.kH)("localconnection",e),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);s.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&((0,o.wh)("localconnection",e.ghostId),r.d.AddConnection(function(e){let t=new i.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(c.B.isLocalConnectionLoaded)return e("done");setTimeout(l.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{console.log("this is the connections",this.connectionArray,e,t);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}}l.connectionArray=[],l.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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const s=(e,t)=>c(void 0,void 0,void 0,(function*(){let n={concepts:[],connections:[]};try{const c=new Headers;let s={concepts:e,connections:t};c.set("Content-Type","application/json"),c.set("Authorization","Bearer "+i.b.BearerAccessToken),c.set("Accept","application/json"),c.set("Randomizer",o.B.getRandomizer().toString());const a=yield fetch(o.B.CreateGhostConceptApiUrl(),{method:"POST",headers:c,body:JSON.stringify(s)});if(!a.ok)throw(0,r.r)(a),new Error(`Error! status: ${a.status}`);const l=yield a.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 a(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 l=(...e)=>c(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 d=n(9003),h=n(9736),u=n(6366),f=n(4864),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 p(this,void 0,void 0,(function*(){let n=performance.now();try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,u.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)?(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(),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 h.v.UpdateConceptSyncStatus(n[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(o,i);let r=yield function(e,t){return c(this,void 0,void 0,(function*(){try{const n=1e3;let o={concepts:[],connections:[]};const i=yield l(e),r=yield l(t);if(e.length+t.length<=2*n){const e=yield s(i,r);return Array.isArray(null==e?void 0:e.concepts)&&(o.concepts=[...o.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(o.connections=[...o.connections,...e.connections]),o}const c=a(i,n),d=a(r,n),h=[],u=[];for(let e=0;e<c.length;e++){const t=c[e];h.push(s(t,[]))}const f=yield Promise.all(h);for(let e=0;e<f.length;e++){const t=f[e];Array.isArray(null==t?void 0:t.concepts)&&(o.concepts=[...o.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(o.connections=[...o.connections,...t.connections])}for(let e=0;e<d.length;e++){const t=d[e];u.push(s([],t))}const p=yield Promise.all(u);for(let e=0;e<p.length;e++){const t=p[e];Array.isArray(null==t?void 0:t.concepts)&&(o.concepts=[...o.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(o.connections=[...o.connections,...t.connections])}return o}catch(e){throw console.log(e),e}}))}(i,o),d=r.concepts,p=r.connections;for(let e=0;e<d.length;e++)h.v.AddPermanentConcept(d[e]);for(let e=0;e<p.length;e++)f.G.AddPermanentConnection(p[e]);return n}catch(e){throw u.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,s=e[i].typeId,a=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(s))&&void 0!==o?o:s;e[i].ofTheConceptId=a,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return p(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 h.v.GetConceptByGhostId(o),0!=i.id?i.id!=i.ghostId&&(e[n].ofTheConceptId=i.id):(i=yield h.v.GetConcept(o),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let o=this.CheckIfTheConceptIdExists(i,t);0==o.id&&(o=yield h.v.GetConceptByGhostId(i),0!=o.id?o.id!=o.ghostId&&(e[n].toTheConceptId=o.id):(o=yield h.v.GetConcept(i),this.AddConceptIfDoesNotExist(o,t)))}if(r<0){let o=this.CheckIfTheConceptIdExists(r,t);0==o.id&&(o=yield h.v.GetConceptByGhostId(r),0!=o.id?o.id!=o.ghostId&&(e[n].typeId=o.id):(o=yield h.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,u.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 p(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,d.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,d.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,u.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 p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,u.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 p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,u.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:()=>a,B:()=>s});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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{static getId(){return c(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){return e=this,t=void 0,c=function*(){try{let e=(0,i.Xr)("application/x-www-form-urlencoded");const t=yield fetch(o.B.GetReservedIdUrl(),{method:"GET",headers:e});if(!t.ok)throw(0,r.r)(t),new Error(`Error! status: ${t.status}`);const n=yield t.json();for(let e=0;e<n.length;e++)s.AddId(n[e])}catch(e){e instanceof Error?console.log("get reserved ids error message: ",e.message):console.log("get reserved ids unexpected error: ",e),(0,r.M)(e,o.B.GetReservedIdUrl())}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(c.next(e))}catch(e){i(e)}}function s(e){try{a(c.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,s)}a((c=c.apply(e,t||[])).next())}));var e,t,n,c}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}s.ids=[];class a{static getId(){return c(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){return e=this,t=void 0,c=function*(){try{let e=(0,i.Xr)("application/x-www-form-urlencoded");const t=yield fetch(o.B.GetReservedConnectionIdUrl(),{method:"GET",headers:e});if(!t.ok)throw(0,r.r)(t),new Error(`Error! status: ${t.status}`);const n=yield t.json();for(let e=0;e<n.length;e++)a.AddId(n[e])}catch(e){e instanceof Error?console.log("get reserved connection ids error message: ",e.message):console.log("get reserved connection ids unexpected error: ",e),(0,r.M)(e,o.B.GetReservedConnectionIdUrl())}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(c.next(e))}catch(e){i(e)}}function s(e){try{a(c.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,s)}a((c=c.apply(e,t||[])).next())}));var e,t,n,c}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}a.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=""},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:()=>f});var o=n(3655),i=n(1167),r=n(2155),c=n(9581),s=n(3518),a=n(1863),l=n(9639),d=n(8286),h=n(6366),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class f{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 u(this,void 0,void 0,(function*(){if(h.serviceWorker)try{return(yield(0,h.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,h.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)l.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)d.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,i.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,n=void 0,i=function*(){let t=new r.N(0,0,0,0,0,0,0);try{var n=(0,s.Xr)(),o=JSON.stringify(e);const i=yield fetch(c.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.r)(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,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((i=i.apply(t,n||[])).next())}));var t,n,o,i}(e)}return"done"}))}static syncDataLocalDb(){return u(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,o.eD)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,o.eD)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}}f.conceptsSyncArray=[],f.connectionSyncArray=[]},9003:(e,t,n)=>{n.d(t,{S5:()=>a,kH:()=>d,qI:()=>s,wh:()=>h});var o=n(6366),i=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},r=9;class c{}function s(e){return new Promise((function(t,n){c.db&&t(c.db);let i=o.BaseUrl.BASE_URL+"_FreeSchemaLocal"+o.BaseUrl.BASE_APPLICATION;const a=indexedDB.open(i,r);a.onerror=t=>{console.error("Why didn't you allow my web app to use IndexedDB?!",t),indexedDB.deleteDatabase(i),s(e),n(t)},a.onsuccess=function(e){var n=e.target;c.db=n.result,t(c.db)},a.onupgradeneeded=e=>{var n=e.target.result,i="localconcept",c="localconnection",s="localid";console.log("this is the version upgrade",r),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(c)&&n.deleteObjectStore(c),n.objectStoreNames.contains(s)&&n.deleteObjectStore(s),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(c)||(n.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(s)||(n.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{l(s,{id:0,value:-100}),l(s,{id:1,value:-200}),l(s,{id:3,value:o.BaseUrl.getRandomizer()})}),t(n)}}))}function a(e){return i(this,void 0,void 0,(function*(){return new Promise((function(t,n){s(e).then((n=>{var o=[],i=n.transaction(e,"readwrite").objectStore(e).getAll();i.onsuccess=()=>{const e=i.result;for(var n=0;n<e.length;n++)o.push(e[n]);t(o)}})).catch((e=>{n({status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e})}))}))}))}function l(e,t){return new Promise((function(n,o){s(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).add(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot store to the Local database "+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e})}))}))}function d(e,t){return new Promise((function(n,o){s(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).put(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e})}))}))}function h(e,t){return new Promise((function(n,o){s(e).then((i=>{let r=i.transaction(e,"readwrite").objectStore(e).delete(t);r.onsuccess=function(e){n(t)},r.onerror=function(n){o({status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot remove object from database because you cannot open the Local database",data:e})}))}))}},3655:(e,t,n)=>{n.d(t,{D3:()=>f,El:()=>u,b8:()=>h,eD:()=>l,kH:()=>d,qI:()=>a,wh:()=>p});var o=n(2299),i=n(9581),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},c=9;class s{}function a(e){return new Promise((function(t,n){s.db&&t(s.db);let o=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const r=indexedDB.open(o,c);r.onerror=t=>{console.error("Why didn't you allow my web app to use IndexedDB?!",t),indexedDB.deleteDatabase(o),a(e),n(t)},r.onsuccess=function(e){let n=e.target;s.db=n.result,t(s.db)},r.onupgradeneeded=e=>{let n=e.target.result,o="concept",i="connection",r="settings";console.log("this is the version update for index",c),n.objectStoreNames.contains(o)&&n.deleteObjectStore(o),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(r)&&n.deleteObjectStore(r),n.objectStoreNames.contains(o)||(n.createObjectStore(o,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(r)||(n.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t(n)}}))}function l(e,t){return new Promise((function(n,o){console.log("this is storing to the database",t),a(e).then((i=>{if(0!=t.id){const r=i.transaction(e,"readwrite").objectStore(e).add(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot store to the database"+e,data:n,body:t})}}})).catch((e=>{o({status:400,ok:!1,message:"Cannot store to the database because you cannot open the database",data:e})}))}))}function d(e,t){return new Promise((function(n,o){a(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).put(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot Update to the database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e})}))}))}function h(){return new Promise((function(e,t){let n="settings";a(n).then((i=>{let r=i.transaction(n,"readwrite").objectStore(n).getAll();r.onsuccess=()=>{let t=new o.B(!1),n=r.result;for(let e=0;e<n.length;e++)t=n[e];e(t)},r.onerror=e=>{t(e)}})).catch((e=>{t({status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:e})}))}))}function u(e){return new Promise((function(t,n){let o="settings";a(o).then((i=>{const r=i.transaction(o,"readwrite").objectStore(o).put(e);r.onsuccess=n=>{t(e)},r.onerror=t=>{n({status:400,ok:!1,message:"Cannot update AI flag",data:t,body:e})}})).catch((e=>{n({status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e})}))}))}function f(e){return r(this,void 0,void 0,(function*(){return new Promise((function(t,n){a(e).then((n=>{let o=[],i=n.transaction(e,"readwrite").objectStore(e).getAll();i.onsuccess=()=>{const e=i.result;for(let t=0;t<e.length;t++)o.push(e[t]);t(o)}})).catch((e=>{n({status:400,ok:!1,message:"Cannot get objects from the database because you cannot open the database",data:e})}))}))}))}function p(e,t){return new Promise((function(n,o){a(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).delete(Number(t));r.onsuccess=function(e){n(t)},r.onerror=t=>{o({status:400,ok:!1,message:"Cannot remove from the database"+e,data:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t})}))}))}},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,{V:()=>s});var o,i=n(6366),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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())}),6e4))}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){if(!this.shouldLog(e))return;const o=Object.assign({timestamp:(new Date).toLocaleString(),level:e,message:t},n);this.packageLogsData.push(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 logInfo(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.log("INFO",`Information logged for ${s}`,f)}catch(e){console.error("Error on logInfo")}}static logError(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("ERROR",`Information logged for ${s}`,f)}catch(e){console.error("Error on logError")}}static logWarning(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("WARNING",`Information logged for ${s}`,f)}catch(e){console.error("Error on logWarning")}}static logDebug(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("DEBUG",`Information logged for ${s}`,f)}catch(e){console.error("Error on logDebug")}}static logApplication(e,t,n){if(console.log("LogApplicationActivationStatus : ",this.logApplicationActivationStatus),this.logApplicationActivationStatus)try{const o={timestamp:(new Date).toLocaleString(),type:e,message:t,data:n||null};this.applicationLogsData.push(o)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return c(this,void 0,void 0,(function*(){try{if(console.log("Log from sendApplicationLogsToServer : ",this.applicationLogsData),0===this.applicationLogsData.length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.applicationLogsData,n=50;for(let o=0;o<t.length;o+=n){const r=t.slice(o,o+n),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({logType:this.appLogs,logData:r})});if(!c.ok){const e=yield c.text();console.error("Failed to send app-logs:-",c.status,c.statusText,e)}}this.applicationLogsData=[]}catch(e){console.error("Network error while sending logs:",e)}}))}static sendPackageLogsToServer(){return c(this,void 0,void 0,(function*(){try{if(console.log("Log from sendPackageLogsToServer : ",this.packageLogsData),0===this.packageLogsData.length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.packageLogsData,n=50;for(let o=0;o<t.length;o+=n){const r=t.slice(o,o+n),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({logType:this.mftsccsBrowser,logData:r})});if(!c.ok){const e=yield c.text();return void console.error("Failed to send logs:-",c.status,c.statusText,e)}}this.packageLogsData=[]}catch(e){console.error("Error while sending logs to server:",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 a(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=s,s.logLevel="INFO",s.packageLogsData=[],s.applicationLogsData=[],s.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=null,s.appLogs="app",s.mftsccsBrowser="mftsccs",s.logApplicationActivationStatus=!1,s.logPackageActivationStatus=!1,s.autoSyncInterval=null,o.startAutoSync()},1412:(e,t,n)=>{function o(e=[],t=[]){}n.d(t,{e:()=>o})},1863:(e,t,n)=>{n.d(t,{M:()=>r,r:()=>i});var o=n(7273);function i(e){if(401==e.status||406==e.status){let t=new o.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new o.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function r(e,t=""){if(e.status){let n=new o.z(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new o.z(e.message,!1,500,e.stack);throw n.setUrl(t),n}}},176:(e,t,n)=>{n.d(t,{F4:()=>c,P6:()=>a,dp:()=>s});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 s(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 a(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(6366),i=n(3655),r=n(9639),c=n(205),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,i.D3)("concept");if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];r.I.AddConceptToMemory(n)}c.B.isDataLoaded=!0,c.B.isCharacterLoaded=!0,c.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:()=>a});var o=n(6366),i=n(7282),r=n(1666),c=n(8407),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,l=null,d=null,h=null){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,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,f=null!=d?d:4,p=null!=h?h:999,y=null!=s?s: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,f,p);v=n,t=n.id,y=n.id,yield a(e[o],n.id,n.userId,t,l,d,h)}else{let i=null!=t?t:999,s=null!=n?n:999,g=y,m=yield(0,c.A)(o,"",!0,u,f,p);v=m,yield(0,r.q)(i,s,m.id,g),yield a(e[o],m.id,m.userId,g,l,d,h)}else{let i=null!=t?t:999,s=null!=n?n:10267,a=y,l=yield(0,c.A)(o,e[o].toString(),!1,u,f,p);yield(0,r.q)(i,s,l.id,a)}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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,o,s,l,d){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),h=new Date,u=new Date,f=new i.j(a,t,o,n,s,e,l,!0,h,u,d);return f.isTemp=!1,c.Y.AddConcept(f),f}))}function d(e,t,n,c,l,d,h){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),u=new Date,f=new Date,p=new i.j(a,t,c,n,l,e,d,!1,u,f,h);return s.ConceptsData.AddConcept(p),(0,o.Y)([p]),p}))}},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 s=t,a=new o.N(0,e,n,s,c,1,4);if(e==n)return a.ofTheConceptId=0,a.toTheConceptId=1,a;try{a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(a)}catch(e){(0,r.M)(e)}return a}},1838:(e,t,n)=>{n.d(t,{m:()=>h});var o=n(9581),i=n(1863),r=n(3518),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},s=n(5239),a=n(4864),l=n(6366),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function h(e){return d(this,void 0,void 0,(function*(){if(l.serviceWorker)try{return(yield(0,l.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,l.handleServiceWorkerException)(e)}e>0?(yield function(e){return c(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());let n=(0,r.BZ)();const c=yield fetch(o.B.DeleteTheConnectionUrl(),{method:"POST",headers:n,body:t,redirect:"follow"});c.ok||(console.log("Delete connection error status: ",c.status),(0,i.r)(c))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,i.M)(e,o.B.DeleteTheConnectionUrl())}}))}(e),s.O.removeNodeFromTree(e)):a.G.RemoveConnectionById(e)}))}},4364:(e,t,n)=>{n.d(t,{s:()=>r});var o=n(1239),i=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function r(){return i(this,arguments,void 0,(function*(e=[]){let t=[];if(e.length>0){for(let n=0;n<e.length;n++)t.includes(e[n].ofTheConceptId)||t.push(e[n].ofTheConceptId),t.includes(e[n].toTheConceptId)||t.push(e[n].toTheConceptId),t.includes(e[n].typeId)||t.push(e[n].typeId);yield(0,o.r)(t)}}))}},5284:(e,t,n)=>{n.d(t,{B:()=>c});var o=n(6366),i=n(8286),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){let t=[];try{if(o.serviceWorker)try{return(yield(0,o.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e})).data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,o.handleServiceWorkerException)(e)}for(let n=0;n<e.length;n++){let o=yield i.d.GetConnectionsOfConcept(e[n]);t.push(...o)}return t}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),t}}))}},8939:(e,t,n)=>{n.d(t,{$N:()=>w,$V:()=>h,Ez:()=>T,JA:()=>m,Mb:()=>p,Nj:()=>f,PT:()=>C,RW:()=>g,XI:()=>v,ay:()=>d,hL:()=>l,kx:()=>y,re:()=>u,yz:()=>I,zN:()=>A});var o=n(7139),i=n(2),r=n(9639),c=n(8286),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,s.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 d(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield A(e,t,n);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function h(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield A(e,t,n);s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=a.entryTimeStamp,d.data=s,d.id=e,d}))}function u(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield k(a,t,n);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function f(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};c=yield(0,i.s)(e),console.log("this is the connection list online",c);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 A(e,c,l);return a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function p(e){return a(this,void 0,void 0,(function*(){var t,n;let c=[],s={};c=yield(0,i.s)(e);let a=[];for(let e=0;e<c.length;e++)a.includes(c[e].ofTheConceptId)||a.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,a);return s[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=d,s}))}function y(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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 a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function v(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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 k(d,i,l);return a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function g(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i={},a=[],l={};try{a=yield c.d.GetConnectionsOfCompositionLocal(e);let s=[];for(let e=0;e<a.length;e++)s.includes(a[e].ofTheConceptId)||s.push(a[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,a,s);l[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,i.created_at=d.entryTimeStamp,i.data=l,i.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e)}return i}))}function m(e,t){return a(this,void 0,void 0,(function*(){var n,i;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t})).data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c={},a=[];for(let e=0;e<t.length;e++)a.includes(t[e].ofTheConceptId)||a.push(t[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 N(l,t,a);c[null!==(i=null===(n=null==l?void 0:l.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=d;let h={};return h.created_at=l.entryTimeStamp,h.data=c,h.id=e,h}))}function C(e,t){return a(this,void 0,void 0,(function*(){var n,i;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c={},a=[];for(let e=0;e<t.length;e++)a.includes(t[e].ofTheConceptId)||a.push(t[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 N(l,t,a);console.log("this is the output",d,l),c[null!==(i=null===(n=null==l?void 0:l.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=d;let h={};return h.created_at=l.entryTimeStamp,h.data=c,h.id=e,h}))}function w(e){return a(this,void 0,void 0,(function*(){var t;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,s.handleServiceWorkerException)(e)}let n=[],i={};n=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<n.length;e++)l.includes(n[e].ofTheConceptId)||l.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));let h=(new Date).getTime(),u=yield function(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,a,l,d,h,u;let f={},p=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(p)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(o.includes(p))return"";o.push(p);for(let e=0;e<t.length;e++){let n=yield(0,s.GetTheConcept)(t[e].ofTheConceptId),o=yield(0,s.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=n,t[e].toConcept=o;let i=n.id,r="the_",l=(null!==(a=null===(c=null==o?void 0:o.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"").replace(r,"");null!=f[i]&&null!=f[i]||(f[i]={}),f[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 s=v[n.id];null!=s[i]&&null!=s[i]||(s[i]={}),null!=f[t[e].ofTheConceptId]&&null!=f[t[e].toTheConceptId]?s[i][c]=f[o.id]:s[i][c]=o.characterValue}return v[e.id]}))}(d,n,l);console.log("this is the time for the data to be made",(new Date).getTime()-h),null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=u;let f={};return f.created_at=d.entryTimeStamp,f.data=i,f.id=e,f}))}function T(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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(e,i,l);a[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=a,u.id=e,u.created_at=d.entryTimeStamp,u}))}function I(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithId",{id:e})).data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};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 A(e,c,l);a[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=a,u.id=e,u}))}function N(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const e=yield N(h,t,n,i);l[f]=e}}else{const e=yield N(h,t,n,i);d[f]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function k(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;(new Date).getTime();let l={},d=[],h=e.id;if(l.id=h,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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const e=yield N(h,t,n,i);l[f]=e}}else{const e=yield N(h,t,n,i);d[f]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const o=yield A(e,t,n,i);l[f]=o}}else{const o=yield A(e,t,n,i);d[f]=o,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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!==(a=null===(s=null==c?void 0:c.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").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:()=>w,MT:()=>C,Nt:()=>f,QL:()=>v,as:()=>p,cw:()=>d,dF:()=>l,hG:()=>y,km:()=>u,nr:()=>m,p8:()=>h,rv:()=>g});var o=n(8642),i=n(7467),r=n(6366),c=n(5284),s=n(8939),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(){return a(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 d(){return a(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 h(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,r.handleServiceWorkerException)(e)}let n=[];for(let t=0;t<e.length;t++){let o=yield(0,s.RW)(e[t]);n.push(o)}return n}))}function u(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections 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.PT)(e[t],n);o.push(i)}return o}))}function f(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,r.handleServiceWorkerException)(e)}yield(0,i.j)(t),yield(0,c.B)(e);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.RW)(e[t]);n[e[t]]=o}return n}))}function p(){return a(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,c.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 y(){return a(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 v(e){return a(this,void 0,void 0,(function*(){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=[],n=[],o={};for(let o=0;o<e.length;o++){let i=yield r.ConnectionData.GetConnection(e[o]);0==i.id?t.push(e[o]):n.push(i)}for(let n=0;n<t.length;n++)o[e[n]]=!1;let c=[],s=yield(0,i.j)(t);n=[...n,...s];for(let e=0;e<n.length;e++)c.push(n[e].ofTheConceptId),c.push(n[e].toTheConceptId),c.push(n[e].typeId);return yield(0,r.GetConceptBulk)(c),n}))}function g(){return a(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.RW)(e[t]);n[e[t]]=o}return n}))}function m(){return a(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 C(){return a(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 w(){return a(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}return n}))}},2013:(e,t,n)=>{n.d(t,{A:()=>s,w:()=>a});var o=n(8146),i=n(6366),r=n(9639),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function s(e){return c(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e})).data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,i.handleServiceWorkerException)(e)}let t=yield r.I.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield(0,o.Y)(e),t=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==t.id&&(t=yield r.I.GetConceptByCharacter(e))),t}))}function a(e){return c(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e})).data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=yield r.I.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield(0,o.Y)(e),t=yield r.I.GetConceptByCharacter(e)),t}))}},7887:(e,t,n)=>{n.d(t,{a:()=>a,p:()=>l});var o=n(8286),i=n(4864),r=n(9003),c=n(3655),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,c.D3)("connection");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 l(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,r.S5)("localconnection");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:()=>l});var o=n(1735),i=n(7139),r=n(6366),c=n(9639),s=n(7282),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(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")}try{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 n=(0,s.o)();if(e<0){let o=yield(0,r.GetUserGhostId)(t,e);return n=(0,r.convertFromLConceptToConcept)(o),n}if(n=yield c.I.GetConcept(e),null!=n&&0!=n.id||null==e||null==e||(n=yield(0,i.r)(e)),0!=n.id&&null==n.type&&null==(yield c.I.GetConcept(n.typeId))&&null!=n.typeId&&null!=n.typeId){let e=yield(0,i.r)(n.typeId);n.type=e}return n}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}}))}},7869:(e,t,n)=>{n.d(t,{_:()=>p,A:()=>f});var o=n(9581),i=n(9639),r=n(1863),c=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},a=n(2299);class l{}l.isUpdated=!1,l.isOnlineSync=!1;var d=n(3655),h=n(9003),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function f(){return u(this,arguments,void 0,(function*(e=!0){try{if(yield(0,d.qI)("concepts"),yield(0,h.qI)("concepts"),e){if((yield(0,d.b8)()).isOnlineSync)return!0;yield function(){return s(this,void 0,void 0,(function*(){try{const n=(new Date).getTime();var e=(0,c.ab)("application/x-www-form-urlencoded");const s=yield fetch(o.B.GetAllAiData(),{method:"GET",headers:e});s.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.r)(s));const a=yield s.json();for(var t=0;t<a.length;t++)i.I.AddConcept(a[t]);p();let l=(new Date).getTime()-n;console.log("The time taken is ",l)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.M)(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 p(){return u(this,void 0,void 0,(function*(){l.isOnlineSync=!0;var e=new a.B(l.isOnlineSync);(0,d.El)(e)}))}},8095:(e,t,n)=>{n.d(t,{h:()=>c});var o=n(6366),i=n(9700),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function c(e,t,n){return r(this,arguments,void 0,(function*(e,t,n,r=!1,c={concepts:[],connections:[]}){var s,a,l,d,h,u;let f=performance.now();try{if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:n,both:r,actions:c});return(null===(a=null===(s=null==i?void 0:i.actions)||void 0===s?void 0:s.concepts)||void 0===a?void 0:a.length)&&(c.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.connections)||void 0===d?void 0:d.length)&&(c.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,o.handleServiceWorkerException)(e)}if(e.userId,r){let i=(null===(h=t.type)||void 0===h?void 0:h.characterValue)+"_s_"+n+"_by";var p=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,c);yield(0,o.CreateTheConnectionLocal)(t.id,e.id,p.id,1e3,void 0,void 0,c)}let i=(null===(u=e.type)||void 0===u?void 0:u.characterValue)+"_s_"+n+"_s";var y=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,void 0,c);return yield(0,o.CreateTheConnectionLocal)(e.id,t.id,y.id,1e3,void 0,void 0,c)}catch(o){throw i.V.logError(f,e.userId,"create",void 0,void 0,500,o,"CreateConnectionBetweenTwoConceptsLocal",[e,t,n,r],void 0,void 0),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:()=>l,EO:()=>d,xd:()=>h});var o=n(205),i=n(9736),r=n(5257),c=n(9003),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(){return a(this,void 0,void 0,(function*(){console.log("this is trying to create local binary tree");try{let e=yield(0,c.S5)("localconcept");if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];i.v.AddConceptToMemory(n)}o.B.isLocalDataLoaded=!0,o.B.isLocalTypeLoaded=!0,o.B.isLocalCharacterLoaded=!0}catch(e){throw yield(0,s.DelayFunctionExecution)(2e3,l()),{message:"Cannot create local binary tree from index db",data:e,ok:!1,status:400}}}))}function d(){return a(this,void 0,void 0,(function*(){var e;try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>a(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]&&s.BaseUrl.setRandomizer(e[2].value)}}))))}catch(e){throw{message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400}}}))}function h(){return a(this,void 0,void 0,(function*(){var e;try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>a(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]&&s.BaseUrl.setRandomizer(e[2].value)}}))))}catch(e){throw{message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400}}}))}},999:(e,t,n)=>{n.d(t,{R:()=>a});var o=n(6366),i=n(6416),r=n(4711),c=n(5868),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,l=null,d=null,h=null,u=!1,f={concepts:[],connections:[]}){var p,y,v,g;if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,userId:l,accessId:d,sessionInformationId:h,actions:f});return(null===(y=null===(p=null==i?void 0:i.actions)||void 0===p?void 0:p.concepts)||void 0===y?void 0:y.length)&&(f.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)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let m=null!=l?l:999,C=null!=d?d:999,w=null!=h?h:999,T=null!=s?s:0,I=(0,i.u)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=T,n=yield(0,c.k)(o,"",!0,m,C,w,void 0,f);I=n,t=n.id,T=n.id,yield a(e[o],n.id,n.userId,t,l,d,h,void 0,f)}else{let n=null!=t?t:999,i=T,s=yield(0,c.k)(o,"",!0,m,C,w,void 0,f);yield(0,r.F)(n,s.id,i,void 0,void 0,void 0,f),yield a(e[o],s.id,s.userId,i,l,d,h,void 0,f)}else{let n=null!=t?t:999,i=T,s=yield(0,c.k)(o,e[o].toString(),!1,m,C,w,void 0,f);yield(0,r.F)(n,s.id,i,void 0,void 0,void 0,f)}return I}))}},3077:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(6366),i=n(2615),r=n(9736),c=n(5257),s=n(9700),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,l,d,h){return a(this,arguments,void 0,(function*(e,t,n,a,l,d,h=!1,u=0,f={concepts:[],connections:[]}){var p,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:a,typeId:l,accessId:d,isComposition:h,referentId:u});return(null===(y=null===(p=null==i?void 0:i.actions)||void 0===p?void 0:p.concepts)||void 0===y?void 0:y.length)&&(f.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)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let s=yield c.R.getConceptId(),m=!0,C=new Date,w=new Date;if("the"==e)return new i.j(1,999,5,5,u,e,d,m,C,w,t);let T=new i.j(s,n,l,a,u,e,d,m,C,w,t);return T.isTemp=!0,T.isComposition=h,r.v.AddConcept(T),f.concepts.push(T),T}catch(o){throw s.V.logError(m,n,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,n,a,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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,a=1,l="",d=999,h={concepts:[],connections:[]}){var u,f,p,y;let v=performance.now();if(s.serviceWorker)try{const o=yield(0,s.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:n,orderId:a,typeString:l,userId:d,actions:h});return(null===(f=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.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,s.handleServiceWorkerException)(e)}try{let c=4,u=yield r.R.getConnectionId(),f=0,p=0,y=0;f=e,p=t,y=n;let v=new o.N(0,0,0,0,0,0,0);return e!=t&&(v=new o.N(u,f,p,d,n,a,c),v.isTemp=!0,v.typeCharacter=l,s.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,a,l,d],"UnknownUserAgent",[]),o}}))}},8064:(e,t,n)=>{n.d(t,{$I:()=>s,Ay:()=>c});var o=n(9736),i=(n(9581),n(3518),n(6366));n(1863);var r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 s(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 s(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:()=>a});var o=n(9736),i=n(7820),r=n(6366),c=n(176),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(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:()=>s});var o=n(6366),i=n(9736),r=n(3077),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function s(e,t,n,s,a){return c(this,arguments,void 0,(function*(e,t,n,c,s,a={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:s,actions:a});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)&&(a.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)&&(a.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let f=yield i.v.GetConceptByCharacterAndTypeLocal(e,s),p=f;return"the"==t&&(c=1),0==p.id&&(f=yield(0,r.A)(e,t,n,c,s,4,void 0,void 0,a),p=f),p}))}},5868:(e,t,n)=>{n.d(t,{k:()=>a});var o=n(3077),i=n(8357),r=n(9736),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e,t){return s(this,arguments,void 0,(function*(e,t,n=!1,s,a,l=999,d=0,h={concepts:[],connections:[]}){var u,f,p,y;let v=performance.now();if(c.serviceWorker)try{const o=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:n,userId:s,accessId:a,sessionInformationId:l,referentId:d,actions:h});return(null===(f=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.connections)||void 0===y?void 0:y.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,c.handleServiceWorkerException)(e)}try{let a,l,u=999,f=4,p=s,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,n)a=yield(0,i.$)(e,u,s,s,h),l=yield(0,o.A)(t,e,s,f,a.id,y,!0,d,h);else if(g>255)a=yield(0,i.$)(v,u,p,s,h),l=yield(0,o.A)(t,v,s,f,a.id,y,void 0,void 0,h);else{a=yield(0,i.$)(v,u,p,s,h);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,a.id);l=e,0==e.id&&0==e.userId&&(l=yield(0,o.A)(t,v,s,f,a.id,y,void 0,void 0,h))}return l.type=a,c.LocalSyncData.AddConcept(l),h.concepts.push(l),l}catch(o){throw c.Logger.logError(v,s,"create","Unknown","Unknown",500,void 0,"MakeTheInstanceConceptLocal",[e,t,n,s,a,l,d],"UnknownUserAgent",[]),o}}))}},8357:(e,t,n)=>{n.d(t,{$:()=>l});var o=n(3077),i=n(8064),r=n(6467),c=n(9975),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,d){return a(this,arguments,void 0,(function*(e,t,n,a,d={concepts:[],connections:[]}){var h,u,f,p;if(s.serviceWorker)try{const o=yield(0,s.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:n,userId:a,actions:d});return(null===(u=null===(h=null==o?void 0:o.actions)||void 0===h?void 0:h.concepts)||void 0===u?void 0:u.length)&&(d.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(p=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===p?void 0:p.length)&&(d.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let y=yield(0,i.$I)(e);if(y&&(0==y.id||0==y.userId)){let i=(0,r.f)(e);if(i[0]==e)y=yield(0,c.A)(e,"the",a,1,51,d);else{let r=yield l(i[0],t,n,a,d),c=yield l(i[1],t,n,a,d);y=yield(0,o.A)(e,i[1],a,r.id,c.id,4,void 0,void 0,d)}}return y}))}},3729:(e,t,n)=>{n.d(t,{D:()=>f});var o=n(9934),i=n(4485),r=n(2),c=n(7876),s=n(1838),a=n(999),l=n(5868),d=n(6366),h=n(176),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function f(e){return u(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var n,u,f,p;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===(p=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===p?void 0:p.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 w=(0,d.CreateDefaultLConcept)(),T=(0,d.CreateDefaultLConcept)();const I=[],N=e.compositionId,k=e.ofTheCompositionId;let A=[],S=yield(0,r.s)(N);for(let e=0;e<S.length;e++)m.push((0,h.P6)(S[e]));const L=[],x=[];let B=[];for(let e=0;e<m.length;e++)(0,o.A)(x,m[e].ofTheConceptId),(0,o.A)(L,m[e].ofTheConceptId),(0,o.A)(L,m[e].toTheConceptId),B.push(m[e].ofTheConceptId);for(let e=0;e<L.length;e++){const t=yield(0,c.A)(L[e]);N==L[e]&&(w=(0,h.F4)(t)),k==L[e]&&(T=(0,h.F4)(t)),C.push((0,h.F4)(t))}const G=e.patchObject;for(const e in G){let n=(0,d.CreateDefaultLConcept)();const o=G[e];let r=w;T.id>0&&(r=T),Array.isArray(o)||"object"==typeof o?(n=yield(0,l.k)(e,"",!0,w.userId,4,999,void 0,t),yield(0,a.R)(G[e],n.id,n.userId,w.id,w.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),I.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,n.id,w.id,2,void 0,void 0,t),C.push(n)}for(let e=0;e<A.length;e++)yield(0,s.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,n)=>{n.d(t,{A:()=>p});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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},s=n(4402),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{constructor(e,t,n,o,i,r,c,s,a,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=s,this.entryTimestamp=a,this.isNew=l}}var d=n(6366),h=n(7282),u=n(2212),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function p(e,t){return f(this,arguments,void 0,(function*(e,t,n=!1,f,p=4,y=999,v=0){if(performance.now(),d.serviceWorker)try{return(yield(0,d.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:n,userId:f,passedAccessId:p,passedSessionId:y,referentId:v})).data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,d.handleServiceWorkerException)(e)}let g,m=y,C=f,w=f,T=p,I=f,N="",k=t.length,A=(0,h.o)();if(N=e.startsWith("the_")?e:"the_"+e,n)A=yield(0,d.MakeTheTypeConceptApi)(e,f),g=yield(0,u.Ay)(t,f,4,A.id,v,T,e);else if(k>255)A=yield(0,d.MakeTheTypeConceptApi)(N,f),g=yield(0,u.Ay)(t,f,4,A.id,v,T,N),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.r)(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 l(f,t,999,C,T,I,m,w,Date.now().toString(),!0));else{A=yield(0,d.MakeTheTypeConceptApi)(N,f);let e=yield(0,s.A)(t,A.id);g=e,0==e.id&&0==e.userId&&(g=yield(0,u.N)(t,f,4,A.id,12,T,N),function(e,t,n,c){a(this,void 0,void 0,(function*(){try{let s={newConceptId:e,referent:t,typeId:n,typeUserId:c},a=(0,i.Xr)(),l=JSON.stringify(s);const d=yield fetch(o.B.MakeTheNameInBackendUrl(),{method:"POST",headers:a,body:l});d.ok||(0,r.r)(d)}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.M)(e,o.B.MakeTheNameInBackendUrl())}}))}(g.id,`${t}`,A.id,f))}return g.type=A,g}))}},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"){return{"Content-Type":e,Authorization:"Bearer "+o.b.BearerAccessToken,Accept:t}}function r(e="application/json",t="",n="application/json"){return""==t&&(t=o.b.BearerAccessToken),{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}}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})},4287:(e,t,n)=>{n.d(t,{w:()=>c});var o=n(6366),i=n(3130),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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;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)),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")}))}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)}))}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)}))}}},5328:(e,t,n)=>{n.d(t,{d:()=>l});var o=n(6366),i=n(3130),r=n(8939),c=n(4287),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a 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 s(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 s(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 a(e,t,n,o,r)}},6366:(e,t,n)=>{n.r(t),n.d(t,{ADMIN:()=>zn,ALLID:()=>un.BG,AccessTracker:()=>ze.J,AddGhostConcept:()=>hn,Anomaly:()=>Wo,BaseUrl:()=>c.B,BinaryTree:()=>Ue.W,BuilderStatefulWidget:()=>Ro,Composition:()=>Et,CompositionBinaryTree:()=>Gt,CompositionNode:()=>xt,Concept:()=>yo.j,ConceptsData:()=>u.I,Connection:()=>P.N,ConnectionData:()=>qe.d,CreateComposition:()=>F.A,CreateConnectionBetweenEntityLocal:()=>ei,CreateConnectionBetweenTwoConcepts:()=>Y,CreateConnectionBetweenTwoConceptsGeneral:()=>K,CreateConnectionBetweenTwoConceptsLocal:()=>Pn.h,CreateDefaultConcept:()=>V.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>O.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>re.q,CreateTheConnectionGeneral:()=>J,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>un.y0,DATAIDDATE:()=>un.iw,DelayFunctionExecution:()=>Jn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>Vn,DeleteConnectionById:()=>z.m,DeleteConnectionByType:()=>Ho,DeleteUser:()=>He,DependencyObserver:()=>Zn.w,FilterSearch:()=>To,FormatFromConnections:()=>An,FormatFromConnectionsAltered:()=>Nn,FreeschemaQuery:()=>Jo,FreeschemaQueryApi:()=>qo,GetAllConnectionsOfComposition:()=>D.s,GetAllConnectionsOfCompositionBulk:()=>y.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>$o,GetComposition:()=>g.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:()=>g.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>N,GetCompositionListListener:()=>co,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>E,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>A,GetCompositionListener:()=>oo,GetCompositionLocal:()=>B,GetCompositionLocalWithId:()=>G,GetCompositionWithAllIds:()=>g.Mb,GetCompositionWithCache:()=>$t,GetCompositionWithDataIdBulk:()=>qt,GetCompositionWithDataIdWithCache:()=>zt,GetCompositionWithId:()=>g.yz,GetCompositionWithIdAndDateFromMemory:()=>g.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>m.A,GetConceptByCharacterAndCategoryLocal:()=>C.$I,GetConceptByCharacterAndType:()=>ce.A,GetConnectionBetweenTwoConceptsLinker:()=>$n,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>po,GetLinkListener:()=>so.d,GetLinkRaw:()=>le,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>Gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>Sn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>un.ZJ,LConcept:()=>vo,LConnection:()=>go,LISTNORMAL:()=>un.SL,LocalConceptsData:()=>v.v,LocalSyncData:()=>wo.H,LocalTransaction:()=>Do,Logger:()=>Lo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>Q.A,MakeTheInstanceConceptLocal:()=>ee.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>xe,MakeTheTypeConceptLocal:()=>de.$,NORMAL:()=>un.yv,PRIVATE:()=>qn,PUBLIC:()=>Qn,PatcherStructure:()=>mo,RAW:()=>un.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>st,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>ho,SchemaQueryListener:()=>Yo,SearchAllConcepts:()=>Pt,SearchLinkInternal:()=>Wn,SearchLinkInternalAll:()=>Un,SearchLinkMultipleAll:()=>In,SearchLinkMultipleAllObservable:()=>Kn,SearchLinkMultipleApi:()=>d,SearchQuery:()=>et,SearchStructure:()=>Io,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Cn,SearchWithTypeAndLinkerApi:()=>Yn,SessionData:()=>Co,Signin:()=>Nt,Signup:()=>wt,SignupEntity:()=>Tt,SplitStrings:()=>h.f,StatefulWidget:()=>_o,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Wt,UpdateCompositionLocal:()=>Ln.D,UserBinaryTree:()=>an,Validator:()=>Mo,ViewInternalData:()=>En,ViewInternalDataApi:()=>bn,WidgetTree:()=>Zo,convertFromConceptToLConcept:()=>Dn.F4,convertFromLConceptToConcept:()=>Dn.dp,createFormFieldData:()=>Vo,dispatchIdEvent:()=>Ii,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ie,handleServiceWorkerException:()=>ki,hasActivatedSW:()=>yi,init:()=>mi,recursiveFetch:()=>g.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>oi,renderPage:()=>ni,renderWidget:()=>ii,searchLinkMultipleListener:()=>eo,sendMessage:()=>Ci,serviceWorker:()=>li,setHasActivatedSW:()=>vi,storeToDatabase:()=>ne,subscribedListeners:()=>ui,updateAccessToken:()=>gi,uploadAttachment:()=>ht,uploadFile:()=>ft,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var o={};n.r(o),n.d(o,{ADMIN:()=>zn,ALLID:()=>un.BG,AccessTracker:()=>ze.J,AddGhostConcept:()=>hn,Anomaly:()=>Wo,BaseUrl:()=>c.B,BinaryTree:()=>Ue.W,BuilderStatefulWidget:()=>Ro,Composition:()=>Et,CompositionBinaryTree:()=>Gt,CompositionNode:()=>xt,Concept:()=>yo.j,ConceptsData:()=>u.I,Connection:()=>P.N,ConnectionData:()=>qe.d,CreateComposition:()=>F.A,CreateConnectionBetweenEntityLocal:()=>ei,CreateConnectionBetweenTwoConcepts:()=>Y,CreateConnectionBetweenTwoConceptsGeneral:()=>K,CreateConnectionBetweenTwoConceptsLocal:()=>Pn.h,CreateDefaultConcept:()=>V.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>O.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>re.q,CreateTheConnectionGeneral:()=>J,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>un.y0,DATAIDDATE:()=>un.iw,DelayFunctionExecution:()=>Jn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>Vn,DeleteConnectionById:()=>z.m,DeleteConnectionByType:()=>Ho,DeleteUser:()=>He,DependencyObserver:()=>Zn.w,FilterSearch:()=>To,FormatFromConnections:()=>An,FormatFromConnectionsAltered:()=>Nn,FreeschemaQuery:()=>Jo,FreeschemaQueryApi:()=>qo,GetAllConnectionsOfComposition:()=>D.s,GetAllConnectionsOfCompositionBulk:()=>y.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>$o,GetComposition:()=>g.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:()=>g.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>N,GetCompositionListListener:()=>co,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>E,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>A,GetCompositionListener:()=>oo,GetCompositionLocal:()=>B,GetCompositionLocalWithId:()=>G,GetCompositionWithAllIds:()=>g.Mb,GetCompositionWithCache:()=>$t,GetCompositionWithDataIdBulk:()=>qt,GetCompositionWithDataIdWithCache:()=>zt,GetCompositionWithId:()=>g.yz,GetCompositionWithIdAndDateFromMemory:()=>g.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>m.A,GetConceptByCharacterAndCategoryLocal:()=>C.$I,GetConceptByCharacterAndType:()=>ce.A,GetConnectionBetweenTwoConceptsLinker:()=>$n,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>po,GetLinkListener:()=>so.d,GetLinkRaw:()=>le,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>Gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>Sn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>un.ZJ,LConcept:()=>vo,LConnection:()=>go,LISTNORMAL:()=>un.SL,LocalConceptsData:()=>v.v,LocalSyncData:()=>wo.H,LocalTransaction:()=>Do,Logger:()=>Lo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>Q.A,MakeTheInstanceConceptLocal:()=>ee.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>xe,MakeTheTypeConceptLocal:()=>de.$,NORMAL:()=>un.yv,PRIVATE:()=>qn,PUBLIC:()=>Qn,PatcherStructure:()=>mo,RAW:()=>un.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>st,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>ho,SchemaQueryListener:()=>Yo,SearchAllConcepts:()=>Pt,SearchLinkInternal:()=>Wn,SearchLinkInternalAll:()=>Un,SearchLinkMultipleAll:()=>In,SearchLinkMultipleAllObservable:()=>Kn,SearchLinkMultipleApi:()=>d,SearchQuery:()=>et,SearchStructure:()=>Io,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Cn,SearchWithTypeAndLinkerApi:()=>Yn,SessionData:()=>Co,Signin:()=>Nt,Signup:()=>wt,SignupEntity:()=>Tt,SplitStrings:()=>h.f,StatefulWidget:()=>_o,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Wt,UpdateCompositionLocal:()=>Ln.D,UserBinaryTree:()=>an,Validator:()=>Mo,ViewInternalData:()=>En,ViewInternalDataApi:()=>bn,WidgetTree:()=>Zo,convertFromConceptToLConcept:()=>Dn.F4,convertFromLConceptToConcept:()=>Dn.dp,createFormFieldData:()=>Vo,dispatchIdEvent:()=>Ii,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ie,handleServiceWorkerException:()=>ki,hasActivatedSW:()=>yi,init:()=>mi,recursiveFetch:()=>g.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>oi,renderPage:()=>ni,renderWidget:()=>ii,searchLinkMultipleListener:()=>eo,sendMessage:()=>Ci,serviceWorker:()=>li,setHasActivatedSW:()=>vi,storeToDatabase:()=>ne,subscribedListeners:()=>ui,updateAccessToken:()=>gi,uploadAttachment:()=>ht,uploadFile:()=>ft,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var i=n(5020),r=n(205),c=n(9581),s=n(1863),a=n(3518),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function d(e){return l(this,arguments,void 0,(function*(e,t=""){let n=performance.now();var o=(0,a.ab)("application/json",t);const i=c.B.SearchLinkMultipleAllApiUrl(),r=JSON.stringify(e);try{const e=yield fetch(i,{method:"POST",headers:o,body:r});return e.ok?yield e.json():((0,s.r)(e),console.log("This is the searching multiple error",e.status),Lo.V.logWarning(n,"unknown","search","unknown",void 0,e.status,e,"SearchLinkMultipleApi",["searchQuery","token"],"unknown",void 0),[])}catch(e){console.log("This is the searching multiple error",e),Lo.V.logWarning(n,"unknown","search","unknown",void 0,500,e,"SearchLinkMultipleApi",["searchQuery","token"],"unknown",void 0),(0,s.M)(e,i)}}))}var h=n(6467),u=n(9639),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function p(e,t){return f(this,void 0,void 0,(function*(){try{var n=new URLSearchParams;n.append("type",e),n.append("user_id",t.toString());var o=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:o,body:n});if(r.ok){const e=yield r.json();for(var i=0;i<e.length;i++)u.I.AddConcept(e[i])}else console.log("GetAllConceptsByType error",r.status),(0,s.r)(r)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,s.M)(e,c.B.GetAllConceptsByTypeUrl())}}))}var y=n(8642),v=n(9736),g=n(8939),m=n(2013),C=n(8064),w=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function T(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(li)try{return(yield Ci("GetCompositionList",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionList sw error: ",e),ki(e)}let i=yield(0,m.A)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.kx)(c[e].id);r.push(t)}}return r}))}function I(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=R(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 N(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(li)try{return(yield Ci("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),ki(e)}let i=yield(0,C.Ay)(e),r=yield(0,m.A)(e),c=[],s=[],a=[],l=[];0!=i.id&&(s=yield v.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),l=yield u.I.GetConceptsByTypeIdAndUser(r.id,t),c=l);for(let e=0;e<s.length;e++){let t=!1;for(let n=0;n<l.length;n++)s[e].ghostId==l[n].ghostId&&(t=!0);t||a.push(s[e])}console.log("This is the all list",a);let d=[];return d=yield function(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=[],r=n*(o-1),c=[],s=t.length;for(let t=r;t<r+n-s;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let n=yield G(t[e].id);i.push(n)}yield(0,y.Y)(c);for(let t=r;t<r+n-s;t++)if(e[t]){let n=yield(0,g.RW)(e[t].id);i.push(n)}return i}))}(c,a,n,o),d}))}function k(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(li)try{return(yield Ci("GetCompositionListWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),ki(e)}let i=yield(0,m.A)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.RW)(c[e].id);r.push(t)}}return r}))}function A(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=yield(0,m.w)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.RW)(c[e].id);r.push(t)}}return r}))}var S=n(4864),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},x=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function B(e){return x(this,void 0,void 0,(function*(){var t,n;try{if(li)try{return(yield Ci("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),ki(e)}let o=[],i={};o=yield S.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<o.length;e++)r.includes(o[e].ofTheConceptId)||r.push(o[e].ofTheConceptId);let l=yield v.v.GetConcept(e);if(0==l.id){let t=yield function(e){return L(this,void 0,void 0,(function*(){let t=(0,V.o)();try{var n=(0,a.ab)("application/x-www-form-urlencoded");const o=yield fetch(c.B.GetRealConceptById(),{method:"POST",headers:n,body:`id=${e}`});if(o.ok)return t=yield o.json(),t.id>0&&u.I.AddConcept(t),t;console.log("Error in Getting Translating concept Error",o.status),(0,s.r)(o)}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,s.M)(e,c.B.GetRealConceptById())}return t}))}(e);if(t.id>0)return yield(0,g.Nj)(t.id)}let d=yield _(e,o,r);return i[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=d,i}catch(e){throw e}}))}function G(e){return x(this,void 0,void 0,(function*(){var t,n;try{if(li)try{return(yield Ci("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),ki(e)}let o=[],i={},r={};o=yield S.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<o.length;e++)c.includes(o[e].ofTheConceptId)||c.push(o[e].ofTheConceptId);let s=yield v.v.GetConcept(e);if(0!=s.id){let r=yield _(e,o,c);i[null!==(n=null===(t=null==s?void 0:s.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 _(e,t,n){return x(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c;let s={},a=[],l=yield v.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield v.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 v.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield v.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 _(e,t,n);s[d]=o}}else{const o=yield _(e,t,n);a[d]=o,s=a}}return s}))}var b=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function R(e,t){return b(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),ki(e)}try{let n=yield(0,C.Ay)(e),o=[];if(0!=n.id){let e=yield v.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield B(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}function E(e,t){return b(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),ki(e)}try{let n=yield(0,C.Ay)(e),o=[];if(0!=n.id){let e=yield v.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}}))}var D=n(2),F=n(1218),O=n(999),W=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function U(e,t,n){return W(this,arguments,void 0,(function*(e,t,n,o=10,i=1){let r=[];try{if(li)try{return(yield Ci("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:n,inpage:o,page:i})).data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),ki(e)}let l=new URLSearchParams;l.append("typeId",`${e}`),l.append("ofTheConceptId",`${t}`),l.append("userId",`${n}`),l.append("inpage",`${o}`),l.append("page",`${i}`);let d=(0,a.Xr)("application/x-www-form-urlencoded");const h=yield fetch(c.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:d,body:l});return h.ok?r=yield h.json():((0,s.r)(h),console.log("Get connection of concept error",h.status)),r}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,s.M)(e,c.B.GetAllConnectionsOfConceptUrl())}}))}var P=n(2155),M=n(442),V=n(7282),j=n(5976),H=n(7273),$=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function J(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,s=yield j.p.getId(),a=new P.N(s,e,n,c,o,i,r);return e==n?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.toUpdate=!0,a.isTemp=!1,M.Y.AddConnection(a),a)}throw new H.z("cannot create connection because id are negative ",!1,400,"")}))}var z=n(1838),q=n(7876),Q=n(8407),X=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Y(e,t,n){return X(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;if(li)try{return(yield Ci("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:n,both:o,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),ki(e)}let s=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Z(o,t,s));let a=yield(0,Q.A)("connection",c,!1,999,999,999),l=new P.N(0,t.id,e.id,s,a.id,1e3,4);M.Y.AddConnection(l)}let a=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Z(a,e,s));let d=yield(0,Q.A)("connection",l,!1,999,999,999),h=new P.N(0,e.id,t.id,s,d.id,1e3,4);return M.Y.AddConnection(h),h}))}function Z(e,t){return X(this,arguments,void 0,(function*(e,t,n=null){var o;let i=t,r=null!=n?n:t.userId,c=e+"_count",s=(null===(o=t.type)||void 0===o?void 0:o.characterValue)+"_s_"+c,a=yield(0,Q.A)("connection",s,!1,r,4,999),l=yield U(a.id,t.id,r,10,1),d=[],h=(0,V.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,Q.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,Q.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,z.m)(l[e].id)}let u=new P.N(0,i.id,h.id,i.userId,a.id,1e3,4);yield M.Y.AddConnection(u)}))}function K(e,t,n){return X(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;let s=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Z(o,t,s));let a=yield(0,Q.A)("connection",c,!1,999,999,999),l=new P.N(0,t.id,e.id,s,a.id,1e3,4);M.Y.AddConnection(l)}let a=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Z(a,e,s));let d=yield(0,Q.A)("connection",l,!1,999,999,999);return yield J(e.id,e.userId,t.id,d.id,1e3,4)}))}var ee=n(5868),te=(n(3655),function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))});function ne(e,t){}function oe(e,t,n){return te(this,void 0,void 0,(function*(){}))}function ie(e){return te(this,void 0,void 0,(function*(){}))}var re=n(1666),ce=n(4402),se=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ae(e,t){return se(this,arguments,void 0,(function*(e,t,n=10,o=1){var i;if(performance.now(),li)try{return(yield Ci("GetLink",{id:e,linker:t,inpage:n,page:o})).data}catch(e){console.error("GetLink sw error: ",e),ki(e)}let r=[],c=yield(0,q.A)(e),s=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,a=yield(0,ce.A)(s,16);if(a.id>0){let e=yield U(a.id,c.id,c.userId,n,o),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,y.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,g.Ez)(o.id);r.push(i)}}return r}))}function le(e,t){return se(this,arguments,void 0,(function*(e,t,n=10,o=1){var i;let r=[],c=yield(0,q.A)(e),s=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,a=yield(0,ce.A)(s,16);if(a.id>0){let e=yield U(a.id,c.id,c.userId,n,o),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);r.push(o)}}return r}))}var de=n(8357),he=n(2212);class ue{constructor(e,t,n,o,i,r,c,s,a,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=s,this.isNew=l}}class fe{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new ue(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}}fe.characterData=[];class pe{constructor(e,t,n,o){this.id=e,this.userId=t,this.referentId=n,this.isNew=o}}var ye=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ge(e,t,n,o,i){return ve(this,void 0,void 0,(function*(){return new ue(t,e,n,t,o,t,i,t,"",!1),yield function(){return ye(this,void 0,void 0,(function*(){var e;try{if(0==(e=fe.GetCharacter(e.data)).id){var t=(0,a.Xr)();const o=yield fetch(c.B.CreateTheCharacterDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!o.ok)throw(0,s.r)(o),new Error(`Error! status: ${o.status}`);const i=yield o.json();var n=new ue(i.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=i.id,fe.AddCharacter(n),i}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),e}}))}()}))}var me=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ce(e,t,n,o,i,r,c){return me(this,void 0,void 0,(function*(){let s=yield(0,ce.A)(e,o),a=s;return 0==a.id&&(s=yield(0,he.Ay)(e,t,n,o,i,r,c),a=s),a}))}var we=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Te=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ie(e,t,n,o){return Te(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:n,userId:o})).data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),ki(e)}let i=yield(0,m.A)(e);if(i&&(0==i.id||0==i.userId)){let r=(0,h.f)(e);if(r.length>0)if(r[0]==e){let n=yield function(e,t,n,o,i,r){return we(this,void 0,void 0,(function*(){let n;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ge(e,t,999,o,r),n=Ce(e,t,4,c,i,o,"the_character")}else{let i=yield ge(e,t,999,o,r);i.isNew,n=yield Ce(e,t,4,51,i.id,o,"the_characters")}return n}))}(e,o,0,999,0,t);i=n}else{let c=yield Ie(r[0],t,n,o),s=yield Ie(r[1],t,n,o);s&&(i=yield(0,he.N)(e,o,c.id,s.id,999,999,r[1]))}}return i}))}var Ne=n(8146),ke=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Ae=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Se(e){return Ae(this,void 0,void 0,(function*(){let t=(0,V.o)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=(0,h.f)(e);if(n.length>1){let o=1,i=yield Se(n[0]);0!=i.id&&(o=i.id),t=yield function(e,t){return Ae(this,void 0,void 0,(function*(){let n=yield u.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==n.id&&(n=yield function(e,t){return ke(this,void 0,void 0,(function*(){let n=(0,V.o)();try{var o=(0,a.Xr)("application/x-www-form-urlencoded");const i=yield fetch(c.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:o,body:`character_value=${e}&category_id=${t}`});i.ok?(n=yield i.json(),u.I.AddConcept(n)):(console.log("This is the concept by category and character error",i.status),(0,s.r)(i))}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,s.M)(e,c.B.GetConceptByCharacterAndCategoryDirectUrl())}return n}))}(e,t)),n}))}(e,o)}else n[0]==e&&(t=yield function(e){return Ae(this,void 0,void 0,(function*(){let t=yield u.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==t.id&&(t=yield(0,Ne.Y)(e)),t}))}(e));return t}))}var Le=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function xe(e,t){return Le(this,void 0,void 0,(function*(){let t=(0,V.o)();try{if(t=yield Se(e),0==t.id||4==t.typeId){let n=(0,a.Xr)("application/x-www-form-urlencoded");const o=yield fetch(c.B.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${e}`});if(!o.ok)throw(0,s.r)(o),new Error(`Error! status: ${o.status}`);t=yield o.json()}}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,s.M)(e,c.B.MakeTheTypeConceptUrl())}return t}))}var Be=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ge(e){return Be(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(r.ok){const e=yield r.json();for(var o=0;o<e.length;o++){var i=e[o];t.push(i)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,s.r)(r)}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,s.M)(e,c.B.GetAllLinkerConnectionOfConceptUrl())}return t}))}var _e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function be(e){return _e(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(r.ok){const e=yield r.json();for(var o=0;o<e.length;o++){var i=e[o];t.push(i)}}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,s.r)(r)}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,s.M)(e,c.B.GetAllLinkerConnectionToConceptUrl())}return t}))}var Re=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ee(e){return Re(this,void 0,void 0,(function*(){let t=yield Ge(e);for(let e=0;e<t.length;e++){let n=t[e],o=n.typeId,i=yield(0,q.A)(o);n.type=i}return t}))}function De(e){return Re(this,void 0,void 0,(function*(){let t=yield be(e);for(let e=0;e<t.length;e++){let n=t[e],o=n.typeId,i=yield(0,q.A)(o);n.type=i}return t}))}var Fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Oe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},We=n(6963),Ue=n(2202),Pe=n(5457),Me=n(991),Ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function je(e){return Ve(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),ki(e)}if(e>0){var t=yield(0,q.A)(e);if(t.id>0){var n=t.typeId,o=t.characterValue;yield Pe.c.removeTypeConcept(n,e),yield We.f.removeNodeByCharacter(o,e),yield function(e){return Oe(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());let n=(0,a.BZ)();const o=yield fetch(c.B.DeleteConceptUrl(),{method:"POST",headers:n,body:t});o.ok||(console.log("Delete concept error",o.status),(0,s.r)(o))}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,s.M)(e,c.B.DeleteConceptUrl())}}))}(e),yield Ue.W.removeNodeFromTree(e),yield Me.H.removeNodeFromTree(e)}}else v.v.RemoveConceptById(e)}))}function He(e){return Ve(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),ki(e)}e>0?function(e){Fe(this,void 0,void 0,(function*(){try{var t=(0,a.ab)("application/json","");let n=c.B.DeleteUserUrl();n=n+"?conceptId="+e+"&apiKey=freeschema";const o=yield fetch(n,{method:"POST",headers:t});if(o.ok){let e=yield o.json(),t=Number(e.data);return console.log("this is the delete email concept",t),je(t),t}throw(0,s.r)(o),new Error(`Delete composition Error! status: ${o.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,s.M)(e,c.B.DeleteConceptUrl())}}))}(e):v.v.RemoveConceptById(e)}))}var $e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Je(e,t){return $e(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(c.B.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw(0,s.r)(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,s.M)(e,c.B.DeleteConceptUrl())}}))}var ze=n(1735),qe=n(8286),Qe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Xe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ye(e){return Xe(this,void 0,void 0,(function*(){if(performance.now(),console.log("AccessTracker activation status from GetConnectionById"),!0===ze.J.activateStatus)try{ze.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),Lo.V.log("ERROR","Error Adding Connection")}if(li)try{return(yield Ci("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),ki(e)}let t=yield qe.d.GetConnection(e);if((null==t||0==t.id)&&null!=e&&null!=e){let n=yield function(e){return Qe(this,void 0,void 0,(function*(){let t=yield qe.d.GetConnection(e);try{if(0!=t.id)return t;{let n=(0,a.Xr)("application/x-www-form-urlencoded");const o=new FormData;o.append("id",e.toString());const i=yield fetch(c.B.GetConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?(t=yield i.json(),qe.d.AddConnection(t)):((0,s.r)(i),console.log("Get Connection Error",i.status)),t}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,s.M)(e,c.B.GetConnectionUrl())}}))}(e);t=n}return t}))}var Ze=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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){if(li)try{return(yield Ci("MakeTheTimestamp",{type:e,referent:t,userId:n,accessId:o,sessionInformationId:i})).data}catch(e){console.error("MakeTheTimestamp sw error: ",e),ki(e)}let r,c="",s=e.startsWith("the_"),a=(0,V.o)();return c=s?e:"the_"+e,a=yield xe(c),r=yield Ce(t,n,4,a.id,0,o,c),r}))}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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ot(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){let o=[];try{if(li)try{return(yield Ci("RecursiveSearchApi",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApi sw error: ",e),ki(e)}let i=new et;i.composition=e,i.listLinkers=t,i.textSearch=n;let r=JSON.stringify(i),l=(0,a.Xr)();const d=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:l,body:r});if(d.ok){const e=yield d.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,o=yield(0,tt.p8)(t,n)}else console.log("recursive search error ",d.status),(0,s.r)(d)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}return o}))}function it(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){let o=[];try{if(li)try{return(yield Ci("RecursiveSearchApiWithInternalConnections",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),ki(e)}let i=new et;i.composition=e,i.listLinkers=t,i.textSearch=n;let r=JSON.stringify(i),l=(0,a.Xr)();const d=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:l,body:r});if(d.ok){const e=yield d.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,o=yield(0,tt.km)(t,n)}else console.log("recursive search error ",d.status),(0,s.r)(d)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}return o}))}function rt(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(li)try{return(yield Ci("RecursiveSearchApiRaw",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),ki(e)}let o=new et;o.composition=e,o.listLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}function ct(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(li)try{return(yield Ci("RecursiveSearchApiRawFullLinker",{composition:e,fullLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),ki(e)}let o=new et;o.composition=e,o.fullLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}function st(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(li)try{return(yield Ci("RecursiveSearchApiNewRawFullLinker",{composition:e,fullLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),ki(e)}let o=new et;o.composition=e,o.fullLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}var at=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 at(this,void 0,void 0,(function*(){try{console.log("File Type",e.type);const n=new FormData;let o;if(dt.includes(e.type))n.append("file",e,e.name),o=yield ft(n,t);else{if(!lt.includes(e.type))return{message:"Invalid File Format",success:!1};n.append("image",e,e.name),o=yield ut(n,t)}return(null==o?void 0:o.data)?{message:"Upload Success",success:!0,url:o.data}:{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),e}}))}function ut(e){return at(this,arguments,void 0,(function*(e,t=""){try{const n=yield fetch(c.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==n?void 0:n.text());const t=yield null==n?void 0:n.text();return console.error(`${n.status} ${t}`),null}return yield n.json()}catch(e){return console.error(e),null}}))}function ft(e){return at(this,arguments,void 0,(function*(e,t=""){try{const n=yield fetch(c.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(n.text());const t=yield n.text();return console.error(`${n.status} ${t}`),null}return yield n.json()}catch(e){return console.error(e),null}}))}var pt=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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function mt(e,t){return gt(this,void 0,void 0,(function*(){try{let n={email:e,password:t},o=new Headers;o.append("Content-Type","application/json");let i=JSON.stringify(n);const r=yield fetch(c.B.LoginUrl(),{method:"POST",headers:o,body:i});if(r.ok){const e=yield r.json();return vt.b.BearerAccessToken=e.data.token,e}console.log("Login tsccs error message: ",r.status),(0,s.r)(r)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,s.M)(e,c.B.LoginUrl())}}))}var Ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function wt(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:""};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,s.r)(o),n}catch(t){console.log("Signup Error: ",t),(0,s.M)(t,e)}}))}(c.B.SignupUrl(),e);return t}))}function Tt(e){return Ct(this,void 0,void 0,(function*(){const t=c.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 It=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Nt(e){return It(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=c.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,s.r)(e),n}catch(e){console.log("Sign in api error",e),(0,s.M)(e,i)}}))}var kt=n(9934),At=n(4485);function St(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class xt{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&&(Gt.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 Bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Gt{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 xt(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Bt(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Bt(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}}Gt.root=null;var _t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function bt(e,t,n,o){return _t(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c;let s={};const a=[];if(0==e)return"";let l=Rt(n,e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield(0,q.A)(e)),0!=l.id&&null==l.type){const e=l.typeId;let t=Rt(n,e);l.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,q.A)(e),l.type=t)}if(!o.includes(e))return null==l?void 0:l.characterValue;if(i.includes(e))return"";i.push(e);for(let l=0;l<t.length;l++)if(t[l].ofTheConceptId==e){const d=t[l].toTheConceptId;if(o.includes(e)){let e=Rt(n,d);if(null!=e&&0!=e.id||null==d||null==d||(e=yield(0,q.A)(d)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield u.I.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield(0,q.A)(t),e.type=n)}const l="the_",h=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(l,"");if(isNaN(Number(h))){if(h){const e=yield bt(d,t,n,o,i);s[h]=e}}else{const e=yield bt(d,t,n,o,i);a[h]=e,s=a}}}return s}))}function Rt(e,t){let n=(0,V.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,V.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 bt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(),c.B.MQTT_CONNECTION&&c.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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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,s=null){const a=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let h=null!=o?o:0,u=(0,V.o)();null==s&&(s=new Et);for(const o in e)if("object"==typeof e[o]||Array.isArray(e[o])){const f=yield(0,Q.A)(o,"",!0,a,l,d);if(null==t&&null==n){let t=h;u=f,t=f.id,h=f.id,s.concepts.push(f),s.id=f.id,yield Ft(e[o],f.id,f.userId,t,i,r,c,s)}else{const a=null!=t?t:999,l=null!=n?n:999,d=h;u=f,s.concepts.push(f);const p=yield(0,re.q)(a,l,f.id,d);s.connections.push(p),yield Ft(e[o],f.id,f.userId,d,i,r,c,s)}null!=e[o]&&null!=e[o]&&s.subcompositions.push(f.id)}else{const i=null!=t?t:999,r=null!=n?n:999,c=h,u=yield(0,Q.A)(o,e[o],!1,a,l,d);s.concepts.push(u);const f=yield(0,re.q)(i,r,u.id,c);s.connections.push(f)}return u}))}var Ot=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Wt(e){return Ot(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("UpdateComposition",{patcherStructure:e})).data}catch(e){console.error("UpdateComposition sw error: ",e),ki(e)}const t=e.userId,n=e.sessionId,o=e.accessId;let i=[];const r=[];let c=(0,V.o)(),s=(0,V.o)();const a=[];let l=e.compositionId;const d=e.ofTheCompositionId;let h=[];if(l<0){let e=yield(0,q.A)(l,t);if(!(e.id>0))return null;l=e.id}i=yield(0,D.s)(l);const u=[],f=new Et,p=[];f.id=l,f.isUpdating();let y=[];for(let e=0;e<i.length;e++)(0,kt.A)(p,i[e].ofTheConceptId),(0,kt.A)(u,i[e].ofTheConceptId),(0,kt.A)(u,i[e].toTheConceptId),y.push(i[e].ofTheConceptId);f.subcompositions=p,f.connections=i;for(let e=0;e<u.length;e++){const t=yield(0,q.A)(u[e]);l==u[e]&&(c=t),d==u[e]&&(s=t),r.push(t)}const v=e.patchObject;for(const e in v){let i=(0,V.o)();const l=v[e];let d=c;if(s.id>0&&(d=s),Array.isArray(l)||"object"==typeof l){i=yield(0,Q.A)(e,"",!0,c.userId,4,999),f.subcompositions.push(i.id);const t=(0,At.vo)(r,i);for(let e=0;e<t.length;e++)if(t[e].id>0){const n=(0,At.wS)(f.connections,t[e].id);h=h.concat(n),a.push(t[e])}yield Ft(v[e],i.id,i.userId,c.id,c.userId,4,999,f)}else{i=yield(0,Q.A)(e,l,!1,t,o,n);const c=(0,At.vo)(r,i);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,At.wS)(f.connections,c[e].id);h=h.concat(t),a.push(c[e])}}const u=(0,re.q)(d.id,d.userId,i.id,c.id);r.push(i),f.connections.push(u)}for(let e=0;e<h.length;e++)Lt(f.connections,h[e]),(0,z.m)(h[e].id);for(let e=0;e<a.length;e++)St(r,a[e]);return f.concepts=f.concepts.concat(r),f.mainConcept=c,f.id=c.id,yield f.updateCache(),Gt.addCompositionToTree(f),M.Y.SyncDataOnline(),f.GetDataCache()}))}var Ut=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Pt(e,t,n,o){return Ut(this,arguments,void 0,(function*(e,t,n,o,i=10,r=1){var l=(0,a.ab)("application/x-www-form-urlencoded",o),d=new URLSearchParams;d.append("type",e),d.append("search",t),d.append("composition",n),d.append("inpage",i.toString()),d.append("page",r.toString());const h=c.B.SearchCompositionsUrl()+"?"+d.toString();try{const e=yield fetch(h,{method:"GET",headers:l});return e.ok?yield e.json():((0,s.r)(e),[])}catch(e){console.log("This is the searching error",e),(0,s.M)(e,h)}}))}var Mt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Vt(e){return Mt(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);const o=c.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,s.r)(e),[])}catch(e){console.log("This is the searching error",e),(0,s.M)(e,o)}}))}var jt=n(7139),Ht=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function $t(e){return Ht(this,arguments,void 0,(function*(e,t=[]){var n,o;let i=[];const r=[];let c={},s={};const a=yield Gt.getNodeFromTree(e),l=[];let d=yield u.I.GetConcept(e);if(0==d.id&&null!=e&&null!=e&&(d=yield(0,jt.r)(e)),null==a){let a=[];a=t.length>0?Jt(e,t):yield(0,D.s)(e),i=a;for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||(l.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);Qt(d,i,r,l);let h=[];s=yield(0,g.zN)(e,i,l,h),c[null!==(o=null===(n=null==d?void 0:d.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=s}else s=a.value.GetDataCache(),c=s;return 0==d.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 zt(e){return Ht(this,arguments,void 0,(function*(e,t=[]){var n,o;let i={},r=[];const c=[];let s;const a={},l=yield Gt.getNodeFromTree(e),d=[];let h=yield u.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,jt.r)(e)),null==l){let l=[];l=t.length>0?Jt(e,t):yield(0,D.s)(e),r=l;for(let e=0;e<r.length;e++)d.includes(r[e].ofTheConceptId)||(d.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);Qt(h,r,c,d),s=yield(0,g.zN)(e,r,d),a[null!==(o=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=s,i.created_at=h.entryTimeStamp,i.data=a,i.id=e}else s=l.value.GetDataCache(),i=s;return 0==h.id?"":i}))}function qt(e,t){return Ht(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 zt(e[t],n);i&&o.push(i)}return o}))}function Qt(e,t,n,o){return Ht(this,void 0,void 0,(function*(){const i=new Et,r=yield function(e){return Ht(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 u.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,pt.I)(n)),t}))}(n);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=o,i.mainConcept=e;const c=yield bt(e.id,t,r,o,[]);i.cached=c,Gt.addCompositionToTree(i)}))}var Xt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Yt(e){return Xt(this,void 0,void 0,(function*(){try{var t=(0,a.Xr)();const n=JSON.stringify(e),o=yield fetch(c.B.CreateSessionId(),{method:"POST",headers:t,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),(0,s.r)(o),null)}catch(e){console.log("Creating session failed",e),(0,s.M)(e,c.B.CreateSessionId())}}))}var Zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Kt(e,t){return Zt(this,void 0,void 0,(function*(){try{var n=(0,a.Xr)("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",e.toString()),o.append("url",t);const i=yield fetch(c.B.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,s.r)(i),null)}catch(e){console.log("Creating session url failed",e),(0,s.M)(e,c.B.CreateSessionVisitUrl())}}))}var en=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function tn(e,t){return en(this,arguments,void 0,(function*(e,t,n=10,o=1){if(li)try{return(yield Ci("GetRelation",{id:e,relation:t,inpage:n,page:o})).data}catch(e){console.error("GetRelation error sw: ",e),ki(e)}let i=[],r=yield(0,q.A)(e),c=yield Se(t);if(c.id>0){let e=yield U(c.id,r.id,r.userId,n,o),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,y.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),r=yield(0,g.Ez)(o.id);i.push(r)}}return i}))}function nn(e,t){return en(this,arguments,void 0,(function*(e,t,n=10,o=1){if(li)try{return(yield Ci("GetRelationRaw",{id:e,relation:t,inpage:n,page:o})).data}catch(e){console.error("GetRelationRaw error sw: ",e),ki(e)}let i=[],r=yield(0,q.A)(e),c=yield Se(t);if(c.id>0){let e=yield U(c.id,r.id,r.userId,n,o),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);i.push(o)}}return i}))}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 sn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class an{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 sn(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(an.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 sn(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 sn(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}}an.root=null;var ln=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function dn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){let o=yield an.getNodeFromTree(e,n);console.log("this is the ghost id",e,n);let 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){an.addConceptToTree(e,t,n)}))}var un=n(3130);function fn(e){return e.startsWith("the_")?e.slice(4):e}var pn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function yn(e,t,n){return pn(this,void 0,void 0,(function*(){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1;n.includes(e[h].id)&&(u=!0);let f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(1==u){if(0!=f.id&&0!=p.id){let n,s=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield(0,q.A)(e[h].typeId);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",n=f.characterValue;a.characterValue,a.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[o]={},t[e[h].ofTheConceptId]=n);let i=yield(0,q.A)(e[h].typeId);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=p.characterValue;i.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},gn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Cn(e,t){return mn(this,arguments,void 0,(function*(e,t,n=""){let o=yield Yn(e,t,n),i=o.compositionIds,r=o.internalConnections,c=o.linkers,s=o.reverse,a=o.mainCompositionIds,l=yield(0,tt.QL)(c),d=yield(0,tt.MT)(i,r);return yield kn(l,d,a,s)}))}function wn(e,t,n,o,i){return mn(this,void 0,void 0,(function*(){let r=yield(0,tt.QL)(e),c=yield(0,tt.D)(t,n);return yield kn(r,c,o,i)}))}var Tn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function In(e){return Tn(this,arguments,void 0,(function*(e,t="",n=null,o=un.y0){var i,r,c,s,a,l,h,u;try{try{if(li)return(yield Ci("SearchLinkMultipleAll",{searchQuery:e,token:t,caller:n,format:o})).data}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),ki(e)}let f=[],p=[],y=[],v=[],g=e[0].composition,m={},C={};(null==n?void 0:n.isDataLoaded)?(m.compositionIds=null===(i=n.conceptIds)||void 0===i?void 0:i.slice(),m.internalConnections=null===(r=n.internalConnections)||void 0===r?void 0:r.slice(),m.linkers=null===(c=n.linkers)||void 0===c?void 0:c.slice(),m.reverse=null===(s=n.reverse)||void 0===s?void 0:s.slice(),C=m,f=C.compositionIds,y=C.internalConnections,p=C.linkers,v=C.reverse):(m=yield d(e,t),n&&(n.conceptIds=null===(a=m.compositionIds)||void 0===a?void 0:a.slice(),n.internalConnections=null===(l=m.internalConnections)||void 0===l?void 0:l.slice(),n.linkers=null===(h=m.linkers)||void 0===h?void 0:h.slice(),n.reverse=null===(u=m.reverse)||void 0===u?void 0:u.slice(),n.isDataLoaded=!0),C=m,f=C.compositionIds,y=C.internalConnections,p=C.linkers,v=C.reverse);let w=yield function(e,t,n,o,i,r){return Tn(this,arguments,void 0,(function*(e,t,n,o,i,r,c=un.y0){try{let s,a,l=yield(0,tt.QL)(e);return c==un.ZJ?(s=yield(0,tt.MT)(t,n),a=yield An(e,s,i,o)):c==un.yv?(s=yield(0,tt.D)(t,n),a=yield An(e,s,i,o)):100==c?(s=yield(0,tt.nr)(t,n),a=yield Nn(l,s,i,o)):c==un.SL?a=yield wn(e,t,n,r.ofCompositions,o):(s=yield(0,tt.rv)(t,n),a=yield Nn(l,s,i,o)),a}catch(e){return void console.log("Error Occured in build layer",e)}}))}(p,f,y,v,g,e[0],o);return w}catch(e){throw console.log("this is the error in the search link multiple",e),e}}))}function Nn(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){(new Date).getTime();let i={},r=[];for(let t=0;t<e.length;t++)r.push(e[t].toTheConceptId),r.push(e[t].ofTheConceptId),r.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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{let o=i.characterValue+"_reverse";"string"==typeof r&&(r={}),Array.isArray(r[c][o])||("string"==typeof r[c]&&(r[c]={}),r[c][o]=[]),r[c][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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{"string"==typeof r&&(r={}),Array.isArray(r[c][i.characterValue])||("string"==typeof r[c]&&(r[c]={}),r[c][i.characterValue]=[]),r[c][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}function kn(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){let i=[],r=[];for(let t=0;t<e.length;t++)r.push(e[t].toTheConceptId),r.push(e[t].ofTheConceptId),r.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,q.A)(e[n].typeId),r=Object.keys(o)[0];try{let c=i.characterValue+"_reverse";"string"==typeof o&&(o={}),Array.isArray(o[r][c])||("string"==typeof o[r]&&(o[r]={}),o[r][c]=[]),o[r][c].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,q.A)(e[n].typeId),r=Object.keys(o)[0];try{"string"==typeof o&&(o={}),Array.isArray(o[r][i.characterValue])||("string"==typeof o[r]&&(o[r]={}),o[r][i.characterValue]=[]),o[r][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 An(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){let i={},r=yield(0,yt.j)(e),c=[];for(let e=0;e<r.length;e++)c.push(r[e].toTheConceptId),c.push(r[e].ofTheConceptId),c.push(r[e].typeId);yield(0,pt.r)(c),r.sort((function(e,t){return t.id-e.id}));for(let e=0;e<r.length;e++){let n=!1;if(o.includes(r[e].id)&&(n=!0),1==n){if(t[r[e].ofTheConceptId]&&t[r[e].toTheConceptId]){let n=t[r[e].toTheConceptId],o=yield(0,q.A)(r[e].typeId),i=n,c=Object.keys(i)[0];try{let n=o.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[c][n])||("string"==typeof i[c]&&(i[c]={}),i[c][n]=[]),i[c][n].push(t[r[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[r[e].ofTheConceptId]&&t[r[e].toTheConceptId]){let n=t[r[e].ofTheConceptId],o=yield(0,q.A)(r[e].typeId),i=n,c=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[c][o.characterValue])||("string"==typeof i[c]&&(i[c]={}),i[c][o.characterValue]=[]),i[c][o.characterValue].push(t[r[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}var Sn=n(1213),Ln=n(3729),xn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Bn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Gn(e,t,n){return Bn(this,void 0,void 0,(function*(){try{if(li)try{return(yield Ci("GetRelationLocal",{id:e,relation:t,userId:n})).data}catch(e){console.error("GetRelationLocal error sw: ",e),ki(e)}let o=yield(0,C.$I)(t),i=[];0!=o.id&&(i=yield function(e,t){return xn(this,void 0,void 0,(function*(){try{return yield S.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,o.id));let r=[];for(let e=0;e<i.length;e++){let t=yield B(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var _n=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function bn(e){return _n(this,void 0,void 0,(function*(){let t=[];try{var n=(0,a.Xr)();const o=yield fetch(c.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,pt.r)(i),n[r]=t}return n}return console.log("View Internal Data error",o.status),(0,s.r)(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 Rn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function En(e){return Rn(this,void 0,void 0,(function*(){var t;try{let n=yield bn(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,g.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 Dn=n(176),Fn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},On=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Wn(e){return On(this,arguments,void 0,(function*(e,t=""){try{let n=yield function(e){return Fn(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);let o=c.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,s.r)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,s.M)(e,o)}}))}(e,t);return yield En(n)}catch(e){throw e}}))}function Un(e){return On(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return Fn(this,void 0,void 0,(function*(){var t=(0,a.ab)("application/json","");let n=c.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,s.r)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,s.M)(e,n)}}))}(e)}catch(e){throw e}}))}var Pn=n(8095),Mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Vn(e){return Mn(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),ki(e)}let t=yield(0,Sn.f)(e);v.v.RemoveConcept(t)}))}var jn=n(2803),Hn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function $n(e,t,n,o){return Hn(this,arguments,void 0,(function*(e,t,n,o,i=!0){var r,c;if(li)try{return(yield Ci("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:n,fullLinker:o,forward:i})).data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),ki(e)}let s=(0,V.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,Q.A)("connection",o,!1,999)}""!=o&&(s=yield xe(o));let a=[];return a=i?yield(0,jn.x)(e.id,t.id,s.id):yield(0,jn.x)(t.id,e.id,s.id),a}))}function Jn(e,t){return new Promise(((n,o)=>{setTimeout((()=>{n(t)}),e)}))}const zn=3,qn=4,Qn=5;var Xn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Yn(e,t){return Xn(this,arguments,void 0,(function*(e,t,n=""){let o=c.B.SearchAllTypeWithLinker(e.auth);var i=(0,a.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,s.r)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,s.M)(e,o)}}))}var Zn=n(4287);class Kn extends Zn.w{constructor(e,t,n=un.y0){super(),this.searchQuery=[],this.format=un.y0,this.searchQuery=e,this.format=n}bind(){return e=this,t=void 0,o=function*(){return this.data=yield In(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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}));var e,t,n,o}}function eo(e,t,n=un.y0){return new Kn(e,null!=t?t:"",n)}var to=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class no extends Zn.w{constructor(e,t=un.ZJ){super(),this.id=e,this.format=t}bind(){return to(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,g.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 to(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let n=0;n<t.length;n++)e.push(yield qe.d.GetConnection(t[n]));return this.format==un.ZJ?(console.log("this is the data for the build layer",e,this.mainConcept,this.internalConnections,this.compositionIds),this.data=yield(0,g.ay)(this.mainConcept,e,this.compositionIds)):this.format==un.y0?this.data=yield(0,g.$V)(this.mainConcept,e,this.compositionIds):this.format==un.yv?this.data=yield(0,g.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,g.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function oo(e,t=un.ZJ){return new no(e,t)}var io=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class ro extends Zn.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 io(this,void 0,void 0,(function*(){if(!this.isDataLoaded){console.log("again data loading mechanism");var e=yield(0,m.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId),console.log("getting the user data",e.id,this.userId);let o=yield u.I.GetConceptsByTypeIdAndUser(e.id,this.userId);console.log("this is the concept list",o);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,y.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)console.log("list listen",this.compositionIds[e]),this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return io(this,void 0,void 0,(function*(){if(this.data=[],console.log("this is building the data list"),this.format==un.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==un.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==un.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.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,g.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function co(e,t,n,o,i=un.ZJ){return performance.now(),new ro(e,t,n,o,i)}var so=n(5328),ao=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class lo extends Zn.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 ao(this,void 0,void 0,(function*(){let n=yield qe.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield qe.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 ao(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 ao(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==un.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 ho(e,t,n="",o){return new lo(e,t,n,o)}var uo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class fo extends Zn.w{constructor(e,t,n,o=un.y0){super(),this.searchQuery=[],this.format=un.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 uo(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),qe.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 uo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,m.A)(this.searchCharacter);let t=yield Yn(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 uo(this,void 0,void 0,(function*(){return yield(0,pt.r)(this.conceptIds),this.format==un.y0?this.data=yield function(e,t,n,o,i){return mn(this,void 0,void 0,(function*(){let r=yield(0,tt.QL)(e),c=yield(0,tt.rv)(t,n),s=yield function(e,t,n,o){return Tn(this,arguments,void 0,(function*(e,t,n,o,i=[]){(new Date).getTime();let r=[],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 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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{let o=i.characterValue+"_reverse";"string"==typeof r&&(r={}),Array.isArray(r[c][o])||("string"==typeof r[c]&&(r[c]={}),r[c][o]=[]),r[c][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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{"string"==typeof r&&(r={}),Array.isArray(r[c][i.characterValue])||("string"==typeof r[c]&&(r[c]={}),r[c][i.characterValue]=[]),r[c][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&&r.push(n)}return r}))}(r,c,t,o,i);return s}))}(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield wn(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function po(e,t,n,o=un.y0){return new fo(e,t,n,o)}var yo=n(2615);class vo{constructor(e,t,n,o,i,r,s,a=!1,l,d,h){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=c.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=s,this.entryTimeStamp=l,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=h}getType(){console.log(this.typeId)}}class go{constructor(e,t,n,o,i,r){this.isTemp=!1,this.applicationId=c.B.getRandomizer(),this.type=(0,V.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 mo{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class Co{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 wo=n(628);class To{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class Io{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var No=n(7887),ko=n(3075),Ao=n(7869),So=n(9635),Lo=n(9700);class xo{static initialize(){console.warn("Initialized Application Moniroring for tracking error..."),this.initGlobalErrorHandlers(),this.logCatchError(),this.logErrorEvent(),this.logUnhandledError(),this.logUserInteractions(),this.logNetworkRequests(),this.logRouteChanges()}static initGlobalErrorHandlers(){void 0!==typeof window&&(window.onerror=(e,t,n,o,i)=>{const r={message:e,source:t,lineno:n,colno:o,stack:(null==i?void 0:i.stack)||"undefined"};Lo.V.logApplication("ERROR","Runtime Error",r)},window.onunhandledrejection=e=>{Lo.V.logApplication("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null})})}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError..."),console.error=function(...t){const n={arguments:t};Lo.V.logApplication("ERROR","Console Error",n),e.apply(console,t)}}catch(e){console.warn("Failed to override console.error:",e)}}static logErrorEvent(){window.addEventListener("error",(e=>{var t,n;console.log("Inside error event...");const 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:null===(n=e.error)||void 0===n?void 0:n.stack};Lo.V.logApplication("Error","Unhandled Error",o)}))}static logUnhandledError(){window.addEventListener("unhandledrejection",(e=>{var t,n;console.log("Inside unhandledrejection...");const o={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"};Lo.V.logApplication("ERROR","Unhandled Promise Rejection",o)}))}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const n=e.target;n.tagName,n.id,n.className,null===(t=n.innerText)||void 0===t||t.slice(0,50)})),document.addEventListener("input",(e=>{const t=e.target;t.tagName,t.id,t.value})),document.addEventListener("scroll",(()=>{window.scrollY}))}static logNetworkRequests(){if(void 0===typeof window)return;const e=null===window||void 0===window?void 0:window.fetch;if(!e)throw new Error("Original fetch is not available.");const t=[c.B.PostLogger(),c.B.PostPrefetchConceptConnections()];window.fetch=(...n)=>{return o=this,i=void 0,c=function*(){const[o,i]=n,r=o instanceof Request?o.url:o instanceof URL?o.toString():o;if(t.includes(r)){console.log("Ignored URLs detected : ",r);let t={url:r,detail:"skip"};return Lo.V.logApplication("INFO","Network Request",t),e(...n)}let c={request:{type:"REQUEST",message:"Network Request",method:(null==i?void 0:i.method)||"GET",url:r,body:null==i?void 0:i.body}};try{const t=yield e(...n);return c.response={type:"RESPONSE",message:"Network Response",url:r,status:t.status},t}catch(e){throw c.response={type:"ERROR",message:"Network Request Failed",url:r,error:e instanceof Error?e.message:String(e)},Lo.V.logApplication("ERROR","Failed Network Request",c),new Error(`Network request failed for ${r}: ${e.message}`)}},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r((function(e){e(o)}))).then(n,s)}a((c=c.apply(o,i||[])).next())}));var o,i,r,c}}static logPerformanceMetrics(){void 0!==typeof window&&(null===window||void 0===window||window.addEventListener("load",(()=>{const e=performance.timing;e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart})))}static logRouteChanges(){const e=history.pushState;history.pushState=function(...t){var n;const o={url:null===(n=t[2])||void 0===n?void 0:n.toString()};return Lo.V.logApplication("INFO","Route Change",o),e.apply(this,t)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href};Lo.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=WebSocket;window.WebSocket=class extends e{constructor(e,t){super(e,t);const n={url:e.toString()};Lo.V.logApplication("INFO","WebSocket Open",n),this.addEventListener("message",(t=>{const n={url:e,data:t.data};Lo.V.logApplication("INFO","WebSocket Message",n)})),this.addEventListener("error",(t=>{const n={url:e,error:t instanceof Error?t.message:String(t)};Lo.V.logApplication("ERROR","WebSocket Error",n)})),this.addEventListener("close",(()=>{const t={url:e};Lo.V.logApplication("INFO","WebSocket Closed",t)}))}}}}class Bo{constructor(){this.subscribers=[]}notify(){this.subscribers.map((e=>{e(this.data)}))}dataChange(e){return this.subscribers.push(e),e(this.data)}}class Go extends Bo{constructor(){super(...arguments),this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return document.getElementById(this.elementIdentifier.toString())}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 _o extends Go{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement="",this.element=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.data=e,this.notify(),this.render()}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.after_render(),this.widgetMounted&&this.loadChildWidgets()}getElementByClassName(e){let t=this.getComponent();if(t){let n=null==t?void 0:t.querySelectorAll("."+e);return console.log("this is the element",t,n,e),n}return[]}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,0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0):this.render())},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((i=i.apply(t,n||[])).next())}));var t,n,o,i}before_render(){this.render()}after_render(){}renderChildWidgets(){var e;null===(e=this.childWidgets)||void 0===e||e.forEach((e=>{e.render()}))}setWidgetState(e,t){var n;this.widgetState[e]=t,(n=this)&&n.childWidgets.forEach((e=>{e.widgetState=Object.assign(Object.assign({},e.widgetState),n.widgetState)})),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var bo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Ro extends _o{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 bo(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 bo(this,arguments,void 0,(function*(e=""){return new Promise((t=>bo(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=[],s=new To;s.type=r,s.search="1",s.logicoperator=">",s.name="emailfilter",s.operateon="entityEmail",s.composition=!1,c.push(s);let a=new Jo;a.typeConnection=e,a.name="entityEmail";let l=new Jo;l.type=o,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[a],l.outputFormat=un.y0,Yo(l,"").subscribe((n=>{if(null==n?void 0:n.length){const i=null==n?void 0:n.map((t=>{var n,i,c,s,a,l,d;const h=null===(s=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===s?void 0:s[r];return{id:null===(d=null===(l=null===(a=t.data)||void 0===a?void 0:a[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 bo(this,void 0,void 0,(function*(){new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(o)}))}setProperty(e){return bo(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");console.log("This is the input val container",n,t,e);const o=null==n?void 0:n.querySelectorAll("input");null==o||o.forEach((e=>{null==e||e.remove()})),console.log("event.target",e.target);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 s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("name","input-widgetTypeValue"),s.setAttribute("of",t.elementIdentifier.toString()),s.setAttribute("class","form-control"),s.setAttribute("id","widgetType"),t.widgetType?s.value=t.widgetType:s.setAttribute("placeholder","e.g. the_entity");let a=t;s.onchange=function(e){var t,n,o;e.preventDefault(),e.stopPropagation();const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;a.widgetType=i,a.before_render(),a.loadChildWidgets(),null===(o=null===(n=a.element)||void 0===n?void 0:n.parentElement)||void 0===o||o.setAttribute("data-type-value",a.widgetType)},null==n||n.appendChild(s)}}(e,this)}mount(e){return bo(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div");let t=this;this.element.onclick=function(e){e.preventDefault(),e.stopPropagation(),t.createTypeEditor(e)},this.element.id=this.createWidgetWrapperIdentifier(),this.element.className="p-2 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(){new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(o)}after_render(){new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(o)}CreateConnectionBetweenEntityLocal(e,t,n){return bo(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,de.$)(r,999,999,i);return yield(0,rn.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Eo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Do{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Eo(this,void 0,void 0,(function*(){yield wo.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Eo(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield wo.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Eo(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield wo.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Eo(this,void 0,void 0,(function*(){yield wo.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Eo(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 s=yield(0,ee.k)(e,t,n,o,i,r,c,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,n,o){return Eo(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,de.$)(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 Eo(this,arguments,void 0,(function*(e,t,n,o=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Pn.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 Eo(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 Eo(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,s=!1){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,O.R)(e,t,n,o,i,r,c,s,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}}const Fo={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 Oo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Wo{constructor(){Wo.cacheInitialized||Wo.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Oo(this,void 0,void 0,(function*(){try{yield Wo.getAnomalyParameters(),Wo.refreshCache(),Wo.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Oo(this,void 0,void 0,(function*(){const e=Date.now();if(Wo.anomalyParamsCache&&e-Wo.lastFetchedTime<Wo.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),Wo.anomalyParamsCache;try{return yield Wo.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Oo(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 Wo.anomalyParamsCache=t.data,Wo.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Oo(this,void 0,void 0,(function*(){try{Date.now()-Wo.lastFetchedTime>Wo.cacheExpiryThreshold&&(yield Wo.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,n]of Object.entries(Fo))if(n.test(e))return t;return null}checkConceptAnomaly(e,t){return Oo(this,void 0,void 0,(function*(){const n=[];try{if(!t)return n.push("Null value"),{valid:!1,warnings:n};const o=Wo.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:s,data_types:a}=i,l=r>=c&&r<=s,d=this.detectDataType(t),h=a.includes(d);return l||n.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${s}). Current length: ${r}.`),h||n.push(`Type mismatch for '${t}'. Expected types: ${a.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 Oo(this,void 0,void 0,(function*(){Wo.cacheInitialized||(yield Wo.initializeAnomalyParameters());try{const t={};for(const[n,o]of Object.entries(e)){const e=o.value,{valid:i,warnings:r}=yield(new Wo).checkConceptAnomaly(n,e);t[n]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){return console.log("Main : ",o),Object.keys(o),[]}}function Uo(e,t){if(e){const n={message:e.message||"Unknown function error",stack:e.stack||"No stack trace",context:t||"No context provided"};Lo.V.log("ERROR","Function Error",n)}}Wo.anomalyParamsCache=null,Wo.cacheInitialized=!1,Wo.lastFetchedTime=0,Wo.cacheExpiryThreshold=6e5;var Po=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Mo{checkUniqueness(e,t){return Po(this,void 0,void 0,(function*(){e.startsWith("the_")||(e="the_"+e);let n=(yield xe(e)).id,o=yield(0,ce.A)(t,n);return console.log("This is the concept for validator",o),!(o.id>0)}))}validateField(e,t,n,o,i,r,c,s,a,l,d,h,u){return Po(this,arguments,void 0,(function*(e,t,n,o,i,r,c,s,a,l,d,h,u,f=!1){var p;try{performance.now();const e={};if(!u||null!==o&&""!==o||(e.required="This is required field"),n&&o){let t=Fo[n];t&&""!==o&&!t.test(o)&&(e.dataType=`Invalid value for ${n}`)}if(i&&o){const t="string"==typeof i?new RegExp(i):i;""===o||t.test(o)||(e.pattern="Pattern doesn't match with value")}if(o&&null!==c&&o.length>c&&(e.maxLength=`Length exceeds the maximum length of ${c}`),o&&null!==s&&o.length<s&&(e.minLength=`Length must be at least ${s} characters long`),null!==a&&o&&!isNaN(Number(o))&&Number(o)<a&&(e.minValue=`Value must be greater than or equal to ${a}`),null!==l&&o&&!isNaN(Number(o))&&Number(o)>l&&(e.maxValue=`Value must be less than or equal to ${l}`),h&&t&&d){const t=d.split(",").map((e=>e.trim().toLowerCase())),n=null===(p=h.name.split(".").pop())||void 0===p?void 0:p.toLowerCase();n&&!t.includes(n)&&(e.accept=`File must be a valid file type: ${t.join(", ")}`)}return r&&f&&o&&((yield this.checkUniqueness(r,o))||(e.unique="Value is not unique")),e}catch(e){throw console.error("Error on validate field.."),Uo(e,"Validation Field Error"),e}}))}validateForm(e){return Po(this,void 0,void 0,(function*(){try{performance.now();const t={};for(const n in e){const{value:o,fieldType:i,dataType:r,pattern:c,conceptType:s,maxLength:a=null,minLength:l=null,minValue:d=null,maxValue:h=null,accept:u=null,file:f=null,required:p,isUnique:y}=e[n],v=yield this.validateField(n,i,r,o,c,s,a,l,d,h,u,f,p,y);Object.keys(v).length>0&&(t[n]=v)}return t}catch(e){throw Uo(e,""),e}}))}validate(e,t,n,o,i,r,c,s,a,l,d,h,u,f=!1){let p={};return this.validateField(e,t,n,o,i,r,c,s,a,l,d,h,u,f).then((e=>{Object.keys(e).length>0?(p.status=!1,p.details=e):p.status=!0})),console.error("Error on validate object"),p}}const Vo=e=>{var t;const n=document.getElementsByName(e)[0];if(!n)return console.warn(`Element with NAME "${e}" not found.`),{value:null,fieldType: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{value:n.value,fieldType:n.type,dataType:n.getAttribute("data-type"),pattern:n.getAttribute("data-pattern"),conceptType:n.getAttribute("concept-type"),maxLength:n.getAttribute("data-maxlength")?parseInt(n.getAttribute("data-maxlength")):null,minLength:n.getAttribute("data-minlength")?parseInt(n.getAttribute("data-minlength")):null,minValue:n.getAttribute("data-min")?parseInt(n.getAttribute("data-min")):null,maxValue:n.getAttribute("data-max")?parseInt(n.getAttribute("data-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 jo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ho(e,t){return jo(this,void 0,void 0,(function*(){if(li)try{return(yield Ci("DeleteConnectionByType",{id:e,linker:t})).data}catch(e){console.error("DeleteConnectionByType sw error: ",e),ki(e)}let n=yield Ge(e);for(let e=0;e<n.length;e++)qe.d.AddConnection(n[e]);let o=yield qe.d.GetConnectionsOfConcept(e),i=yield(0,m.A)(t),r=[];for(let e=0;e<o.length;e++)o[e].typeId==i.id&&r.push(o[e]);for(let e=0;e<r.length;e++)(0,z.m)(r[e].id)}))}function $o(e,t){return jo(this,arguments,void 0,(function*(e,t,n=!1){if(li)try{return(yield Ci("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:n})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),ki(e)}let o=[];if(n){let n=yield be(e),i=yield xe(t);for(let e=0;e<n.length;e++)n[e].typeId==i.id&&o.push(n[e])}else{let n=yield Ge(e);for(let e=0;e<n.length;e++)qe.d.AddConnection(n[e]);let i=yield qe.d.GetConnectionsOfConcept(e),r=yield(0,m.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&o.push(i[e])}return o}))}class Jo{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.outputFormat=un.yv,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var zo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function qo(e){return zo(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);const o=c.B.FreeschemaQueryUrl(),i=JSON.stringify(e);try{const e=yield fetch(o,{method:"POST",headers:n,body:i});return e.ok?yield e.json():((0,s.r)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,s.M)(e,o)}}))}var Qo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Xo extends Zn.w{constructor(e,t){super(),this.mainCompositionIds=[],this.query=new Jo,this.query=e,this.format=e.outputFormat}bind(){return Qo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0,this.query.outputFormat=un.BG;let e=yield qo(this.query,"");this.conceptIds=e.conceptIds,this.internalConnections=e.internalConnections,this.linkers=e.linkers,this.reverse=e.reverse,this.mainCompositionIds=e.mainCompositionIds}return yield this.build()}))}build(){return Qo(this,void 0,void 0,(function*(){return this.format==un.y0?this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield function(e,t){return gn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",n=f.characterValue;(s.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=p.characterValue;o.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o),i=yield function(e,t){return gn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=s.characterValue;""==o&&(o=e,o=fn(o));let i={id:f.id,data:{[e]:t}},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=o.characterValue,c=!1;""==r&&(r=e,r=fn(r),c=!0);let s={id:p.id,data:{[e]:t}};isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=s):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o),console.log("this is the composition data",i);let r=yield function(e,t,n,o){return gn(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c,s,a,l,d;(new Date).getTime();let h=[],u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.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,h=yield(0,q.A)(e[n].ofTheConceptId),u=yield(0,q.A)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(o=!0),1==o){if(0!=h.id&&0!=u.id&&u.id in t){let o,i=yield(0,q.A)(e[n].typeId),s=null!==(c=null===(r=u.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[s]&&(o[s]={})):(o={},o[s]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let r={id:h.id,data:t[e[n].ofTheConceptId]},c=i.characterValue+"_reverse";Array.isArray(o[s][c])?o[s][c].push(r):c.includes("_s_")?(o[s][c]=[],o[s][c].push(r)):o[s][c]=r}}catch(e){console.log("this is error",e)}}}else if(0!=h.id&&0!=u.id&&h.id in t){let o,i=yield(0,q.A)(e[n].typeId),r=null!==(a=null===(s=h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self",c=!1;e[n].toTheConceptId in t&&(c=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[r]&&(o[r]={})):(o={},o[r]={},t[e[n].ofTheConceptId]=o);let f=!0,p=i.characterValue;""==p&&(p=u.characterValue,f=!0),""==p&&(p=null===(l=null==u?void 0:u.type)||void 0===l?void 0:l.characterValue);try{null===(d=null==u?void 0:u.type)||void 0===d||d.characterValue;let c=t[e[n].toTheConceptId];if(c){let s={id:u.id,data:t[e[n].toTheConceptId]};Array.isArray(o[r])?o[r].push(c):Array.isArray(o[r][p])?o[r][i.characterValue].push(s):p.includes("_s_")?(o[r][p]=[],o[r][p].push(s)):o[r][p]=s}}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n={};n.id=o[e],n.data=t[o[e]],h.push(n)}return h}))}(t,i,[],n,o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse):this.format==un.ZJ?this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield yn(t,i,o),i=yield function(e,t){return vn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=s.characterValue;""==o&&(o=e,o=fn(o));let i={id:f.id,[e]:t},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=o.characterValue,c=!1;""==r&&(r=e,r=fn(r),c=!0);let s={};s[e]={id:p.id,data:t},isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=c?s[e]:s):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o);let r=yield function(e,t,n){return vn(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,s,a,l,d;(new Date).getTime();let h=[],u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let h=!1,u=yield(0,q.A)(e[n].ofTheConceptId),f=yield(0,q.A)(e[n].toTheConceptId);if(o.includes(e[n].id)&&(h=!0),1==h){if(0!=u.id&&0!=f.id&&f.id in t){let o,c=yield(0,q.A)(e[n].typeId),s=null!==(r=null===(i=f.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[s]&&(o[s]={})):(o={},o[s]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let i=t[e[n].ofTheConceptId];i&&(i.id=u.id);let r=c.characterValue+"_reverse";Array.isArray(o[s][r])?o[s][r].push(i):r.includes("_s_")?(o[s][r]=[],o[s][r].push(i)):o[s][r]=i}}catch(e){console.log("this is error",e)}}}else if(0!=u.id&&0!=f.id&&u.id in t){let o,i=yield(0,q.A)(e[n].typeId),r=null!==(s=null===(c=u.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self",h=!1;e[n].toTheConceptId in t&&(h=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[r]&&(o[r]={})):(o={},o[r]={},t[e[n].ofTheConceptId]=o);let p=!1,y=i.characterValue;""==y&&(y=f.characterValue,p=!0),""==y&&(y=null===(a=null==f?void 0:f.type)||void 0===a?void 0:a.characterValue);try{let i=null!==(d=null===(l=null==f?void 0:f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",c=t[e[n].toTheConceptId];if(c){let e={};e[i]={data:c[i],id:f.id},Array.isArray(o[r])?p?o[r].push(c[y]):o[r].push(c):Array.isArray(o[r][y])?o[r][y].push(e):y.includes("_s_")?(o[r][y]=[],p?o[r][y].push(e[i]):o[r][y].push(e)):o[r][y]=p?e[i]:e}}catch(e){console.log("this is error",e)}}}console.log("this is the main compositions",n);for(let e=0;e<n.length;e++){let o={};console.log("this is the main compositions DATA",t[n[e]]),o=t[n[e]],o&&(o.id=n[e]),h.push(o)}return h}))}(t,i,n,o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse):this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield yn(t,i,o),i=yield function(e,t,n){return pn(this,void 0,void 0,(function*(){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1;n.includes(e[h].id)&&(u=!0);let f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(1==u){if(0!=f.id&&0!=p.id){let n,s=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield(0,q.A)(e[h].typeId);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=a.characterValue;""==o&&(o=e,o=fn(o));let i={[e]:t},l=o+"_reverse";a.characterValue.includes("_s_")||("string"==typeof n[s]&&(n[s]={}),n[s][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},t[e[h].ofTheConceptId]=n);let i=yield(0,q.A)(e[h].typeId);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=i.characterValue,c=(i.characterValue,!1);""==r&&(r=e,r=fn(r),c=!0);let s={[e]:t};isNaN(Number(r))?i.characterValue.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][r]=c?t:s):n[o]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o);let r=yield function(e,t,n,o){return pn(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c,s,a,l;let d=[],h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.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;i.includes(e[n].id)&&(o=!0);let d=yield(0,q.A)(e[n].ofTheConceptId),h=yield(0,q.A)(e[n].toTheConceptId);if(1==o){if(0!=d.id&&0!=h.id&&h.id in t){let o,i=null!==(c=null===(r=h.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[n].toTheConceptId in t?o=t[e[n].toTheConceptId]:(o={},o[i]={},t[e[n].toTheConceptId]=o);let s=yield(0,q.A)(e[n].typeId);try{let r=s.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(o[i][r])?o[i][r].push(c):s.characterValue.includes("_s_")?(o[i][r]=[],o[i][r].push(c)):o[i][r]=c)}catch(e){console.log("this is error",e)}}}else if(0!=d.id&&0!=h.id&&d.id in t){let o,i=null!==(a=null===(s=d.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[i]&&(o[i]={})):(o={},o[i]={},t[e[n].ofTheConceptId]=o);let r=!1,c=(yield(0,q.A)(e[n].typeId)).characterValue;""==c&&(c=h.characterValue,r=!0),""==c&&(c=null===(l=null==h?void 0:h.type)||void 0===l?void 0:l.characterValue);try{let s=t[e[n].toTheConceptId];s&&(Array.isArray(o[i])?r?(console.log("this is the data",s,e[n].toTheConceptId),o[i].push(s[c])):o[i].push(s):Array.isArray(o[i][c])?o[i][c].push(s):c.includes("_s_")?(o[i][c]=[],r?o[i][c].push(s[c]):o[i][c].push(s)):o[i][c]=r?s[c]:s)}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],d.push(o))}return d}))}(t,i,n,[],o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse),this.data}))}}function Yo(e,t){return new Xo(e,t)}class Zo{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",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 Ro}}var Ko=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ei(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,de.$)(r,999,999,i);console.log(yield(0,rn.F)(e.id,t.id,c.id,1e3))}))}var ti=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ni(e,t,n){return ti(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 ii(i[0].id,t,n))}))}function oi(e,t,n){return ti(this,void 0,void 0,(function*(){var o;const i=yield tn(e,"the_widget_latest");if(0==(null==i?void 0:i.length))yield ii(e,t,n);else{const e=null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.id;e&&(yield ii(e,t,n))}}))}function ii(e,t,n){return ti(this,void 0,void 0,(function*(){try{const o=yield ri(e),i=t;yield ci(o,i,void 0,n);const r=document.createElement("style");r.innerHTML=o.css,i.appendChild(r);const c=document.createElement("script");c.innerHTML=o.js,i.appendChild(c),i.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")}))}catch(e){console.error("Error Caught Rendering Widget")}}))}function ri(e){return ti(this,arguments,void 0,(function*(e,t=[],n=""){var o,i,r,c,s,a,l,d,h,u,f,p,y,v,g,m,C,w,T,I,N,k,A,S,L,x,B,G,_,b,R,E,D,F,O,W,U,P,M,V,j,H,$,J,z,q,Q,X,Y,Z,K,ee,te,ne,oe,ie,re,ce,se,ae,le;try{const de=new Zo,he=yield function(e,t){return ti(this,void 0,void 0,(function*(){try{const n=new et;n.composition=e,n.fullLinkers=["the_widget","the_widget_widget","the_widget_name","the_widget_html","the_widget_css","the_widget_js","the_widget_timestamp","the_widget_type","the_widget_after_render","the_widget_before_render","the_widget_update","the_widget_mount_child","the_widget_clean","the_widget_s_child","the_widget_version","the_widget_origin"],n.inpage=100;const o=new et;o.fullLinkers=["the_child_widget","the_child_widget_type","the_child_widget_parent","the_child_widget_wrapper","the_child_widget_info"],o.inpage=100;const i=[n,o],r=yield In(i,t);return console.log("getWidgetCodeFromId output ->",r),r}catch(e){throw console.error("error",e),e}}))}(e,n);t.push(e);const ue=null===(o=null==he?void 0:he.data)||void 0===o?void 0:o.the_widget;de.name=null===(c=null===(r=null===(i=null==ue?void 0:ue.the_widget_name)||void 0===i?void 0:i[0])||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,de.html=null===(l=null===(a=null===(s=null==ue?void 0:ue.the_widget_html)||void 0===s?void 0:s[0])||void 0===a?void 0:a.data)||void 0===l?void 0:l.the_html,de.css=null===(u=null===(h=null===(d=null==ue?void 0:ue.the_widget_css)||void 0===d?void 0:d[0])||void 0===h?void 0:h.data)||void 0===u?void 0:u.the_css,de.js=null===(y=null===(p=null===(f=null==ue?void 0:ue.the_widget_js)||void 0===f?void 0:f[0])||void 0===p?void 0:p.data)||void 0===y?void 0:y.the_js,de.origin=Number(null===(m=null===(g=null===(v=null==ue?void 0:ue.the_widget_origin)||void 0===v?void 0:v[0])||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_originid),de.version=null===(T=null===(w=null===(C=null==ue?void 0:ue.the_widget_version)||void 0===C?void 0:C[0])||void 0===w?void 0:w.data)||void 0===T?void 0:T.the_version,de.clean=null===(k=null===(N=null===(I=null==ue?void 0:ue.the_widget_clean)||void 0===I?void 0:I[0])||void 0===N?void 0:N.data)||void 0===k?void 0:k.the_clean,de.timestamp=null===(L=null===(S=null===(A=null==ue?void 0:ue.the_widget_timestamp)||void 0===A?void 0:A[0])||void 0===S?void 0:S.data)||void 0===L?void 0:L.the_timestamp,de.id=he.id;const fe=null===(G=null===(B=null===(x=null==ue?void 0:ue.the_widget_type)||void 0===x?void 0:x[0])||void 0===B?void 0:B.data)||void 0===G?void 0:G.the_type;de.type="null"==fe||null==fe?"the_element_name":fe,de.after_render=null===(R=null===(b=null===(_=null==ue?void 0:ue.the_widget_after_render)||void 0===_?void 0:_[0])||void 0===b?void 0:b.data)||void 0===R?void 0:R.the_after_render,de.before_render=null===(F=null===(D=null===(E=null==ue?void 0:ue.the_widget_before_render)||void 0===E?void 0:E[0])||void 0===D?void 0:D.data)||void 0===F?void 0:F.the_before_render,de.update=null===(U=null===(W=null===(O=null==ue?void 0:ue.the_widget_update)||void 0===O?void 0:O[0])||void 0===W?void 0:W.data)||void 0===U?void 0:U.the_update,de.widgetId=e,de.mount_child=null===(V=null===(M=null===(P=null==ue?void 0:ue.the_widget_mount_child)||void 0===P?void 0:P[0])||void 0===M?void 0:M.data)||void 0===V?void 0:V.the_mount_child;const pe=null==ue?void 0:ue.the_widget_s_child;if(null==pe?void 0:pe.length)for(let e=0;e<pe.length;e++){const o=(null===(J=null===($=null===(H=null===(j=pe[e])||void 0===j?void 0:j.data.the_child_widget)||void 0===H?void 0:H.the_child_widget_info)||void 0===$?void 0:$[0])||void 0===J?void 0:J.id)||(null===(Y=null===(X=null===(Q=null===(q=null===(z=pe[e])||void 0===z?void 0:z.data.the_child_widget)||void 0===q?void 0:q.the_child_widget_parent)||void 0===Q?void 0:Q[0])||void 0===X?void 0:X.data)||void 0===Y?void 0:Y.the_parent),i=yield ri(o,t,n),r=null===(oe=null===(ne=null===(te=null===(ee=null===(K=null===(Z=pe[e])||void 0===Z?void 0:Z.data)||void 0===K?void 0:K.the_child_widget)||void 0===ee?void 0:ee.the_child_widget_type)||void 0===te?void 0:te[0])||void 0===ne?void 0:ne.data)||void 0===oe?void 0:oe.the_type,c=null===(le=null===(ae=null===(se=null===(ce=null===(re=null===(ie=pe[e])||void 0===ie?void 0:ie.data)||void 0===re?void 0:re.the_child_widget)||void 0===ce?void 0:ce.the_child_widget_wrapper)||void 0===se?void 0:se[0])||void 0===ae?void 0:ae.data)||void 0===le?void 0:le.the_wrapper;i.type="null"==r||null==r?"the_element_name":r,i.wrapper=c,de.children.push(i)}return de}catch(e){throw console.error("error",e),e}}))}function ci(e,t){return ti(this,arguments,void 0,(function*(e,t,n=!0,o){var i,r;const c=new Ro;c.html=e.html,c.widgetType=e.type,c.componentDidMountFunction=e.before_render,c.addEventFunction=e.after_render,c.mountChildWidgetsFunction=e.mount_child,o&&(c.data=o),t.innerHTML="";const s=t;if(s&&(yield c.mount(s),e.widget=c,e.children.length>0&&(null===(i=c.childWidgetElement)||void 0===i?void 0:i.length)>0))for(let t=0;t<(null===(r=e.children)||void 0===r?void 0:r.length);t++){const n=e.children[t];for(let e=0;e<c.childWidgetElement.length;e++){const t=c.childWidgetElement[e];if(n.id===Number(t.getAttribute("data-widgetid"))&&n.wrapper===t.id){const e=((a=n).html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),a.html=a.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),a.html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),a.html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),a.html=a.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())),a.html=a.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),a),o=yield ci(e,t,!1);c.childWidgets.push(o),c.css=c.css+`div[data-widgetid="${n.id}"] { ${n.css} }`,o.dataChange((e=>{var t;console.log("This is the data change in child",e);const n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(c.childrenData[n]=e),console.log("new child data",c.childrenData)}))}}}var a;return console.log("newWidget ->",c),yield ai(t,".mftsccs-marking-element"),yield ai(t,".widget_container"),c}))}function si(e,t){return ti(this,void 0,void 0,(function*(){return e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function ai(e,t){return ti(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 si(e.firstChild,t);n.insertBefore(o,e)}n.removeChild(e)}}}))}var li,di=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const hi=Date.now().toString(36)+Math.random().toString(36).substring(2);let ui=[],fi=!1,pi=[],yi=!1;function vi(e){yi=e}function gi(e=""){vt.b.BearerAccessToken=e,li&&Ci("updateAccessToken",{accessToken:e})}function mi(){return di(this,arguments,void 0,(function*(e="",t="",n="",o="",i=!0,s="",a=void 0,l={}){try{c.B.BASE_URL=e,c.B.AI_URL=t,c.B.NODE_URL=o,c.B.BASE_APPLICATION=s,vt.b.BearerAccessToken=n;let d=Math.floor(1e8*Math.random());c.B.setRandomizer(d);const h={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(c.B.FLAGS=h,c.B.FLAGS=Object.assign(Object.assign({},h),l),function(e){try{return e.logApplication&&(xo.initialize(),Lo.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(Lo.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(ze.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),e}catch(e){throw console.error("Failed to initialize flags:",e),e}}(c.B.FLAGS),!("serviceWorker"in navigator))return yield Ti(),void console.warn("Service Worker not supported in this browser.");if(function(){navigator.serviceWorker.addEventListener("message",(e=>di(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(){So.x.addEventListener("message",(e=>di(this,void 0,void 0,(function*(){const{type:t,payload:n}=e.data;if(!t)return;let o={success:!1,data:void 0};wi[t]?yield wi[t](n):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),a&&a.activate&&a.manual)yield new Promise(((r,c)=>{navigator.serviceWorker.ready.then((c=>di(this,void 0,void 0,(function*(){console.log("registraions ready",c),li=c.active,yield Ci("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),r("done")})))).catch((e=>{console.error("Error: Ready service worker",e),c(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>c("Timeout ready")),3e4)}));else if(a&&(null==a?void 0:a.activate))try{console.log("service worker initialiing"),yield new Promise(((r,c)=>{var d,h;let u=!1;navigator.serviceWorker.register(null!==(d=a.pathToSW)&&void 0!==d?d:"./serviceWorker.bundle.js",{scope:null!==(h=a.scope)&&void 0!==h?h:"/"}).then((a=>di(this,void 0,void 0,(function*(){console.log("Service Worker registered:",a),console.log("update listen start"),a.onupdatefound=()=>{const c=a.installing;console.log("new worker",c),c&&(c.onstatechange=()=>di(this,void 0,void 0,(function*(){console.warn("on state change triggered",c.state,navigator.serviceWorker.controller),"installing"===c.state&&(console.log("Service Worker installing"),li=void 0,fi=!1),"activated"!==c.state&&"redundant"!==c.state||!navigator.serviceWorker.controller||(console.log("New Service Worker is active",a),li=c,console.log("This is a flag after sw init : ",l),setTimeout((()=>{console.log("Message Processed after some time"),Ni()}),5e3),yield Ci("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),u=!0,fi=!0,Ni(),r())})))},a.addEventListener("controllerchange",(()=>di(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(li=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield Ci("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}))})))),(a.installing||a.waiting||a.active)&&a.addEventListener("statechange",(r=>di(this,void 0,void 0,(function*(){var c;"activating"===(null===(c=null==r?void 0:r.target)||void 0===c?void 0:c.state)&&(li=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield Ci("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}))})))),a.active?(fi=!0,console.log("active sw"),li=a.active,yield Ci("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),Ni(),r()):setTimeout((()=>{u||c("Not Completed Initialization")}),1e4)})))).catch((e=>di(this,void 0,void 0,(function*(){yield Ti(),c(e),console.error("Service Worker registration failed:",e)}))))}))}catch(e){yield Ti(),console.error("Unable to start service worker",e)}else yield Ti(),console.warn("Service Worker not activated");return!0}catch(e){yield Ti(),console.warn("Cannot initialize the system",e)}}))}function Ci(e,t){return di(this,void 0,void 0,(function*(){const n=Math.random().toString(36).substring(2);t.messageId=n,t.TABID=hi;const o=JSON.parse(JSON.stringify(t));return new Promise(((i,r)=>{if((!navigator.serviceWorker.controller&&!li||!fi&&"init"!=e)&&console.log("will go to queue",navigator.serviceWorker.controller,li,fi,"init"==e),!navigator.serviceWorker.controller&&!li||!fi&&"init"!=e)pi.push({message:{type:e,payload:o}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller||li,fi||"init"==e),"init"==e&&i(null);else{const c=o=>{var a,l,d,h,u,f;(null===(a=null==o?void 0:o.data)||void 0===a?void 0:a.messageId)==n&&(o.data.success||(401==(null===(l=null==o?void 0:o.data)||void 0===l?void 0:l.status)?r((0,s.r)(new Response("Unauthorized",{status:401,statusText:null===(d=null==o?void 0:o.data)||void 0===d?void 0:d.statusText}))):500==(null===(h=null==o?void 0:o.data)||void 0===h?void 0:h.status)?r((0,s.M)(new Response("Internal Server Error",{status:500,statusText:null===(u=null==o?void 0:o.data)||void 0===u?void 0:u.statusText}))):(console.error("Error in the response from worker:",o),r(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(o.data)}`))),(null===(f=o.data)||void 0===f?void 0:f.actions)&&(t.actions=JSON.parse(JSON.stringify(o.data.actions))),i(o.data),navigator.serviceWorker.removeEventListener("message",c))};if(navigator.serviceWorker.addEventListener("message",c),navigator.serviceWorker.controller)navigator.serviceWorker.controller.postMessage({type:e,payload:o});else if(li){console.warn(`controller not found but serviceWorker is available. messageId: ${n}, type: ${e}`),fi&&console.warn("service worker was registered already but navigator is empty!!!",li);try{li.postMessage({type:e,payload:o})}catch(t){console.log("Retrying again on catch service worker",t),li.postMessage({type:e,payload:o})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${n}, type: ${e}`),fi&&console.warn("service worker was registered already but is not available NOW!!!"),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${n}, type: ${e}`),li?(console.info("This is triggered "),null==li||li.postMessage({type:e,payload:t})):(console.log("not ready",e),r("Service worker not ready"))}),3e4);setTimeout((()=>{r(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",c)}),21e4)}}))}))}const wi={GetLinkListener:e=>di(void 0,void 0,void 0,(function*(){const t=ui.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>di(void 0,void 0,void 0,(function*(){if(li){let t=new Event(e.id||"");dispatchEvent(t)}return{success:!0}})),checkInit:e=>di(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),li=navigator.serviceWorker.controller),yield Ci("init",{url:c.B.BASE_URL,aiurl:c.B.AI_URL,accessToken:vt.b.BearerAccessToken,nodeUrl:c.B.NODE_URL,enableAi:!1,applicationName:c.B.BASE_APPLICATION,flags:c.B.FLAGS}),{success:!0}}))};function Ti(){return di(this,void 0,void 0,(function*(){yield(0,Ao.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,ko.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,No.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,ko.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,No.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 Ii(e,t={}){if(li||null!=typeof window){let n=new CustomEvent(`${e}`,t);dispatchEvent(n)}else So.x.postMessage({type:"dispatchEvent",payload:{id:e}})}function Ni(){return di(this,void 0,void 0,(function*(){for(;pi.length>0;){const{message:e,resolve:t,reject:n}=pi.shift();yield Ci(e.type,e.payload)}}))}const ki=e=>{if(e instanceof H.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)}}},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(6366),i=n(9635),r=n(205),c=n(3278),s=n(5020),a=n(7887),l=n(7869),d=n(3075),h=n(2803),u=n(7139),f=n(5284),p=n(8939),y=n(6687),v=n(2013),g=n(1213),m=n(5328),C=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const w={GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,u.r)(e.id)}})),GetTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetTheConcept)(e.id,e.userId)}})),GetConceptBulk:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptBulk)(e.passedConcepts)}})),GetLink:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetLink)(e.id,e.linker,e.inpage,e.page)}})),GetRelation:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetRelation)(e.id,e.relation,e.inpage,e.page)}})),GetRelationRaw:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetRelationRaw)(e.id,e.relation,e.inpage,e.page)}})),GetComposition:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.Nj)(e.id)}})),GetCompositionList:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionList)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionListWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionById:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.hL)(e.id)}})),GetCompositionWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.yz)(e.id)}})),GetCompositionListAllWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListAllWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetConceptByCharacter:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacter)(e.characterValue)}})),GetConceptByCharacterUpdated:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,v.w)(e.characterValue)}})),GetConceptByCharacterAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacterAndType)(e.characterValue,e.typeId)}})),GetCompositionFromConnectionsWithDataId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.p8)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdIndex:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.Nt)(e.conceptIds,e.connectionIds)}})),GetCompositionConnectionsBetweenTwoConcepts:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,h.x)(e.ofConceptId,e.toConcept,e.mainKey)}})),GetConnectionDataPrefetch:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.QL)(e.connectionIds)}})),GetCompositionWithIdFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.RW)(e.id)}})),GetCompositionWithIdAndDateFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.Ez)(e.id)}})),GetCompositionFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.kx)(e.id)}})),GetCompositionFromMemoryNormal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.XI)(e.id)}})),GetCompositionWithIdFromMemoryNew:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.$N)(e.id)}})),FindConnectionsOfCompositionsBulkInMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.B)(e.composition_ids)}})),GetAllTheConnectionsByTypeAndOfTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetAllTheConnectionsByTypeAndOfTheConcept)(e.id,e.linker,e.reverse)}})),GetCompositionFromMemoryWithConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.JA)(e.id,e.connectionList)}})),GetCompositionFromConnectionsWithIndexFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.hG)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.km)(e.conceptIds,e.connectionIds)}})),GetTheConceptLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,g.f)(e.id)}})),GetCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionLocal)(e.id)}})),GetCompositionLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionLocalWithId)(e.id)}})),GetCompositionListLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListLocal)(e.compositionName,e.userId)}})),GetCompositionListLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListLocalWithId)(e.compositionName,e.userId)}})),GetConceptByCharacterAndCategoryLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacterAndCategoryLocal)(e.character)}})),ConceptsData__AddConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.AddConcept(e.concept)}})),ConceptsData__GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.GetConcept(e.id)}})),ConceptsData__GetConceptsByTypeIdAndUser:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.GetConceptsByTypeIdAndUser(e.typeId,e.userId)}})),ConnectionData__GetConnectionByOfTheConceptAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e.ofTheConceptId,e.typeId)}})),ConnectionData__GetConnection:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnection(e.id)}})),ConnectionData__GetConnectionsOfCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionsOfCompositionLocal(e.id)}})),ConnectionData__GetConnectionsOfConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionsOfConcept(e.id)}})),GetLinkListener:e=>C(void 0,void 0,void 0,(function*(){let t=!1;return new Promise(((n,o)=>{(0,m.d)(e.id,e.linker,e.inpage,e.page,e.format).subscribe((o=>{var r,c;t?(console.log("isSubscribed",t),n({success:!0,data:o}),t=!0):(console.log("is not isSubscribed",t),i.x.postMessage({type:"GetLinkListener",payload:{id:null===(r=null==e?void 0:e.listener)||void 0===r?void 0:r.listenerId,listenerId:null===(c=null==e?void 0:e.listener)||void 0===c?void 0:c.listenerId,data:o}}))})).catch((e=>{console.log("Error : ",e),o("Error Occured")}))}))}))};var T=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const I={SearchLinkMultipleAll:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.SearchLinkMultipleAll)(e.searchQuery,e.token,e.caller,e.format)}})),RecursiveSearchApi:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApi)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiWithInternalConnections:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiWithInternalConnections)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRaw:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiRaw)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRawFullLinker:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),RecursiveSearchApiNewRawFullLinker:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiNewRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}}))};var N=n(1218),k=n(3077),A=n(9975),S=n(5868),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const x={MakeTheInstanceConcept:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheInstanceConcept)(e.type,e.referent,e.composition,e.userId,e.passedAccessId,e.passedSessionId,e.referentId)}})),MakeTheConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,A.A)(e.referent,e.typeCharacter,e.userId,e.categoryId,e.typeId,e.actions)}})),MakeTheTypeConcept:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTypeConcept)(e.typeString,e.sessionId,e.sessionUserId,e.userId)}})),MakeTheTimestamp:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTimestamp)(e.type,e.referent,e.userId,e.accessId,e.sessionInformationId)}})),CreateTheComposition:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,N.A)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId)}})),MakeTheInstanceConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,S.k)(e.type,e.referent,e.composition,e.userId,e.accessId,e.sessionInformationId,e.referentId,e.actions),actions:e.actions}})),MakeTheTypeConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTypeConceptLocal)(e.typeString,e.sessionId,e.sessionUserId,e.userId,e.actions),actions:e.actions}})),CreateTheConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,k.A)(e.referent,e.typecharacter,e.userId,e.categoryId,e.typeId,e.accessId,e.isComposition,e.referentId,e.actions),actions:e.actions}})),CreateTheCompositionLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateTheCompositionLocal)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId,e.automaticSync,e.actions),actions:e.actions}}))};var B=n(3729),G=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const _={UpdateComposition:e=>G(void 0,void 0,void 0,(function*(){return yield(0,o.UpdateComposition)(e.patcherStructure),{success:!0}})),UpdateCompositionLocal:e=>G(void 0,void 0,void 0,(function*(){return yield(0,B.D)(e.patcherStructure,e.actions),{success:!0}}))};var b=n(8095),R=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const E={GetConnectionById:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionById)(e.id)}})),GetConnectionBulk:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionBulk)(e.connectionIds)}})),GetConnectionOfTheConcept:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionOfTheConcept)(e.typeId,e.ofTheConceptId,e.userId,e.inpage,e.page)}})),GetAllConnectionsOfCompositionBulk:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetAllConnectionsOfCompositionBulk)(e.composition_ids)}})),GetConnectionBetweenTwoConceptsLinker:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionBetweenTwoConceptsLinker)(e.ofTheConcept,e.toTheConcept,e.linker,e.fullLinker,e.forward)}})),CreateConnectionBetweenTwoConcepts:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateConnectionBetweenTwoConcepts)(e.ofTheConcept,e.toTheConcept,e.linker,e.both)}})),CreateConnectionBetweenTwoConceptsLocal:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,b.h)(e.ofTheConcept,e.toTheConcept,e.linker,e.both,e.actions),actions:e.actions}})),CreateTheConnectionLocal:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateTheConnectionLocal)(e.ofTheConceptId,e.toTheConceptId,e.typeId,e.orderId,e.typeString,e.userId,e.actions),actions:e.actions}}))};var D=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const F={DeleteConceptById:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConceptById)(e.id)}})),DeleteConnectionById:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConnectionById)(e.id)}})),DeleteUser:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteUser)(e.id)}})),DeleteConnectionByType:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConnectionByType)(e.id,e.linker)}})),DeleteConceptLocal:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConceptLocal)(e.id)}}))};var O=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const W={SyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.SyncData.SyncDataOnline()}})),LocalSyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.SyncDataOnline(e.transactionId)}})),LocalSyncData__initializeTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.initializeTransaction(e.transactionId)}})),LocalSyncData__markTransactionActions:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.markTransactionActions(e.transactionId,e.actions),actions:e.actions}})),LocalSyncData__rollbackTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.rollbackTransaction(e.transactionId,e.actions),actions:e.actions}}))};var U=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};let P=new Map,M=!1,V=!1;self.addEventListener("install",(e=>{console.log("Service Worker installing... sw"),e.waitUntil(self.skipWaiting())})),self.addEventListener("activate",(e=>U(void 0,void 0,void 0,(function*(){yield(0,o.setHasActivatedSW)(!0),console.log("Service Worker activating... sw"),e.waitUntil(new Promise(((e,t)=>{try{self.clients.claim(),console.log("claimed"),H(),e(void 0)}catch(e){console.error("Error during service worker activation:",e),t(e)}})))})))),self.addEventListener("fetch",(e=>{e.clientId||e.respondWith($(e))}));const j=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({init:e=>U(void 0,void 0,void 0,(function*(){return M?(console.warn("Already Initialized"),{success:!0,name:"init"}):(M=!0,console.log("Payload log in service worker : ",e),yield function(){return U(this,arguments,void 0,(function*(e="",t="",n="",i="",h=!0,u="",f){var p,y;o.BaseUrl.BASE_URL=e,o.BaseUrl.AI_URL=t,o.BaseUrl.NODE_URL=i,o.BaseUrl.BASE_APPLICATION=u,c.b.BearerAccessToken=n;let v=Math.floor(1e8*Math.random());if(console.log("Flags came in init of service worker is ",f),o.BaseUrl.setRandomizer(v),o.BaseUrl.FLAGS=f,null===(p=o.BaseUrl.FLAGS)||void 0===p?void 0:p.isTest)return 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,!0;console.log("This is the base url",o.BaseUrl.BASE_URL,v),console.log("service worker BaseUrl.FLAGS is ",o.BaseUrl.FLAGS),(null===(y=o.BaseUrl.FLAGS)||void 0===y?void 0:y.accessTracker)&&(console.log("From service worker, flag of Access Tracker."),o.AccessTracker.activateStatus=!0,console.log("Access Tracker Activation status from service worker",o.AccessTracker.activateStatus)),yield(0,l.A)();const g=(new Date).getTime();yield(0,s.A)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare concept data is ",e)})).catch((e=>{throw e})),yield(0,d.Ay)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare local concept ",e)})).catch((e=>{throw e})),yield(0,a.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,d.xd)(),yield(0,a.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let e=(new Date).getTime()-g;console.log("The time taken to prepare connections ",e)})).catch((e=>{throw e}))}))}(null==e?void 0:e.url,null==e?void 0:e.aiurl,null==e?void 0:e.accessToken,null==e?void 0:e.nodeUrl,null==e?void 0:e.enableAi,null==e?void 0:e.applicationName,null==e?void 0:e.flags),{success:!0,data:void 0,name:"init"})})),updateAccessToken:e=>U(void 0,void 0,void 0,(function*(){return yield(0,o.updateAccessToken)(e.accessToken),{success:!0,name:"updateAccessToken"}}))},w),I),x),_),E),F),W);self.addEventListener("message",(e=>U(void 0,void 0,void 0,(function*(){var t,n;let i={success:!1,data:void 0};const{type:r,payload:c}=e.data,s=c.TABID;let a=!1;try{if(!r||!c.TABID)return;"init"==r||H()||(console.warn("Message received before sw initialization",r),yield new Promise((e=>{const t=setInterval((()=>{console.log("Interval check 0",M),M?(console.log("Interval check 2",M),clearInterval(t),e(void 0)):console.warn("Watring for init 1:",r)}),200);setTimeout((()=>{console.warn("Tried waiting for init but couldn't complete in time: ",r),clearInterval(t),e(void 0)}),9e4)})),console.log("After timeout promise",M),M||e.source.postMessage(i)),P.has(s)||P.set(s,{concepts:[],connections:[]});let l=P.get(s);if(Array.isArray(null===(t=null==c?void 0:c.actions)||void 0===t?void 0:t.concepts)&&Array.isArray(null===(n=null==c?void 0:c.actions)||void 0===n?void 0:n.connections)||(c.actions={concepts:[],connections:[]},a=!0),"LocalSyncData__SyncDataOnline"==r&&!c.transactionId&&l){const e=o.LocalSyncData.SyncDataOnline(void 0,JSON.parse(JSON.stringify(l)));P.delete(s),l=void 0,console.log("Syncing the tab here",r),i={success:!0,data:yield e,actions:{concepts:[],connections:[]}}}else j[r]?i=yield j[r](c):console.warn(`Unable to handle "${r}" case in service worker`);if(i.messageId=c.messageId,V&&console.warn("Race condition has been met",r),V=!0,l=P.get(s),i.actions&&l){let e={concepts:[...l.concepts,...i.actions.concepts],connections:[...l.connections,...i.actions.connections]};const[t,n]=yield Promise.all([Promise.all(Array.from(new Map(e.concepts.map((e=>[`${e.id}-${e.ghostId}`,e]))).values())),Promise.all(Array.from(new Map(e.connections.map((e=>[`${e.id}-${e.ghostId}`,e]))).values()))]);P.set(s,JSON.parse(JSON.stringify({concepts:t,connections:n})))}V=!1,a&&delete i.actions,e.source.postMessage(i)}catch(t){console.error("Service worker Message Handle Error: ",r,t),401!=(null==t?void 0:t.status)&&500!=(null==t?void 0:t.status)||(i={success:!1,data:{status:t.status,statusText:null==t?void 0:t.url},messageId:c.messageId}),e.source.postMessage(i)}}))));const H=()=>!!M||(i.x.postMessage({type:"checkInit",payload:{}}),console.log("Message posted to broadcastChannel"),!1),$=e=>U(void 0,void 0,void 0,(function*(){try{const t=yield fetch(e.request);if(401===t.status){const n=Math.random().toString(36).substring(2);return e.waitUntil(e.source.postMessage({type:"API_401",messageId:n,message:"Unauthorized",payload:{method:e.request.method,url:e.request.url,headers:Array.from(e.request.headers.entries()),body:yield e.request.clone().json()}})),yield new Promise((e=>{console.log("Re resolving 401",t.url),setTimeout((()=>e(t)),6e4),navigator.serviceWorker.addEventListener("message",(o=>{var i,r,c;o.data&&(null===(i=o.data)||void 0===i?void 0:i.messageId)==n&&"API_RESPONSE"===(null===(r=o.data)||void 0===r?void 0:r.type)&&((null===(c=null==o?void 0:o.data)||void 0===c?void 0:c.response)?e(o.data.response):(console.log("Unable to resolve re 401",t.url),e(t)))}))}))}return t}catch(e){throw console.error("Error occured during 401 intercepting",e),e}}));
1
+ var e={1735:(e,t,n)=>{n.d(t,{J:()=>s});var o,i=n(6366),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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=s,s.conceptsData={},s.connectionsData={},s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=Date.now(),s.activateStatus=!1,s.accessData="Access Data",o.startAutoSync()},1167:(e,t,n)=>{n.d(t,{Y:()=>a});var o=n(9581),i=n(3518),r=n(6366),c=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=(0,r.CreateDefaultConcept)();try{var n=(0,i.Xr)();const r=yield fetch(o.B.CreateTheConceptUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!r.ok)throw(0,c.r)(r),new Error(`Error! status: ${r.status}`);return t=yield r.json(),t}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.M)(e,o.B.CreateTheConceptUrl())}}))}},2:(e,t,n)=>{n.d(t,{s:()=>l});var o=n(8286),i=n(9581),r=n(1412),c=n(3518),s=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){var t=[];if(0==(t=yield o.d.GetConnectionsOfConcept(e)).length)t=yield d(e);else{var n=yield d(e);(0,r.e)(n,t),t=n}return t}))}function d(e){return a(this,void 0,void 0,(function*(){var t=[];try{(0,c.Xr)("application/json");const r=new Headers,a=new FormData;a.append("composition_id",e.toString());const l=yield fetch(i.B.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:r,body:a});if(console.log("this is getting connection from online",i.B.GetAllConnectionsOfCompositionUrl(),e),!l.ok)throw(0,s.r)(l),new Error(`Error! status: ${l.status}`);const d=yield l.json();for(var n=0;n<d.length;n++)o.d.AddConnection(d[n]),t.push(d[n]);return t}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,s.M)(e,i.B.GetAllConnectionsOfCompositionUrl())}}))}},8642:(e,t,n)=>{n.d(t,{Y:()=>u});var o=n(8286),i=n(9581),r=n(4364),c=n(5284),s=n(1412),a=n(3518),l=n(1863),d=n(6366),h=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function u(){return h(this,arguments,void 0,(function*(e=[]){if(d.serviceWorker)try{return(yield(0,d.sendMessage)("GetAllConnectionsOfCompositionBulk",{composition_ids:e})).data}catch(e){console.error("GetAllConnectionsOfCompositionBulk sw error: ",e),(0,d.handleServiceWorkerException)(e)}var t=[];if(e.length<=0)return t;var n=yield(0,c.B)(e),u=yield function(){return h(this,arguments,void 0,(function*(e=[]){var t=[];try{var n=(0,a.Xr)();const c=yield fetch(i.B.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(c.ok){const e=yield c.json();for(var r=0;r<e.length;r++)o.d.AddConnection(e[r]),t.push(e[r])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),(0,l.r)(c);return t}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.M)(e,i.B.GetAllConnectionsOfCompositionBulkUrl())}}))}(e);return t=u,(0,s.e)(t,n),yield(0,r.s)(t),t}))}},2803:(e,t,n)=>{n.d(t,{x:()=>a});var o=n(8286),i=n(9581),r=n(1863),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e,t,n){return s(this,void 0,void 0,(function*(){var s=[];try{if(c.serviceWorker)try{return(yield(0,c.sendMessage)("GetCompositionConnectionsBetweenTwoConcepts",{ofConceptId:e,toConcept:t,mainKey:n})).data}catch(e){console.error("GetCompositionConnectionsBetweenTwoConcepts sw error: ",e),(0,c.handleServiceWorkerException)(e)}var a=new FormData;a.append("ofConceptId",e.toString()),a.append("mainKey",n.toString()),a.append("toConceptId",t.toString());const d=yield fetch(i.B.GetCompositionConnectionBetweenTwoConceptsUrl(),{method:"POST",body:a,redirect:"follow"});if(d.ok){const e=yield d.json();for(var l=0;l<e.length;l++)o.d.AddConnection(e[l]),s.push(e[l])}else console.log("Get composition connection between two concepts",d.status),(0,r.r)(d)}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.M)(e,i.B.GetCompositionConnectionBetweenTwoConceptsUrl())}return s}))}},7139:(e,t,n)=>{n.d(t,{r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(6366),s=n(1863),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){try{if(c.serviceWorker)try{return(yield(0,c.sendMessage)("GetConcept",{id:e})).data}catch(e){console.error("GetConcept sw error: ",e),(0,c.handleServiceWorkerException)(e)}let n=(0,c.CreateDefaultConcept)();if(0==e||null==e||null==e)return n;var t=yield o.I.GetConcept(e);let a=o.I.GetNpc(e);if(0!=t.id||a)return t;{(0,r.Xr)(),console.log("this is the url",i.B.GetConceptUrl());const t=new FormData;t.append("id",e.toString());const c=yield fetch(i.B.GetConceptUrl(),{method:"POST",body:t});return c.ok?(n=yield c.json(),n.id>0?o.I.AddConcept(n):o.I.AddNpc(e)):(console.log("Get the concept error",c.status),(0,s.r)(c)),n}}catch(e){e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),(0,s.M)(e,i.B.GetConceptUrl())}}))}},1239:(e,t,n)=>{n.d(t,{I:()=>d,r:()=>l});var o=n(9639),i=n(9581),r=n(3518),c=n(1863),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){let t=[],n=((new Date).getTime(),performance.now()),a=Array.from(new Set(e));try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptBulk",{passedConcepts:e})).data}catch(e){console.error("GetConceptBulk sw error: ",e),(0,s.handleServiceWorkerException)(e)}if(a.length>0){let e=[];for(let t=0;t<a.length;t++)0==(yield o.I.GetConcept(a[t])).id&&e.push(a[t]);if(0==e.length)return t;{let a=(0,r.Xr)();const l=yield fetch(i.B.GetConceptBulkUrl(),{method:"POST",headers:a,body:JSON.stringify(e)});if(l.ok){if(t=yield l.json(),t.length>0)for(let e=0;e<t.length;e++){let n=t[e];o.I.AddConcept(n)}console.log("added the concepts")}else console.log("Get Concept Bulk error",l.status),s.Logger.logError(n,"unknown","read","unknown",void 0,l.status,l,"GetConceptBulk",["passedConcepts"],"unknown",void 0),(0,c.r)(l)}}}catch(e){e instanceof Error?console.log("Get Concept Bulk error message: ",e.message):console.log("Get Concept Bulk unexpected error: ",e),s.Logger.logError(n,"unknown","read","unknown",void 0,500,e,"GetConceptBulk",["passedConcepts"],"unknown",void 0),(0,c.M)(e,i.B.GetConceptBulkUrl())}return t}))}function d(e){return a(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.r)(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.M)(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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t){return a(this,void 0,void 0,(function*(){try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetConceptByCharacterAndType",{characterValue:e,typeId:t})).data}catch(e){console.error("GetConceptByCharacterAndType sw error: ",e),(0,s.handleServiceWorkerException)(e)}let d=yield o.I.GetConceptByCharacterAndTypeLocal(e,t);if(null==d||0==d.id){var n={character_value:`${e}`,type_id:t},a=JSON.stringify(n),l=(0,r.Xr)();const s=yield fetch(i.B.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:l,body:a});s.ok?(d=yield s.json(),o.I.AddConcept(d)):((0,c.r)(s),console.log("This is the concept by type and character error",s.status))}return d}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.M)(e,i.B.GetConceptByCharacterAndTypeUrl())}}))}},8146:(e,t,n)=>{n.d(t,{Y:()=>a});var o=n(9639),i=n(9581),r=n(6366),c=n(1863),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,void 0,void 0,(function*(){let t=(0,r.CreateDefaultConcept)();try{const n=new FormData;n.append("character_value",e);const r=yield fetch(i.B.GetConceptByCharacterValueUrl(),{method:"POST",body:n});r.ok?(t=yield r.json(),t.id>0&&o.I.AddConcept(t)):((0,c.r)(r),console.log("Error in Getting concept by character value Error",r.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.M)(e,i.B.GetConceptByCharacterValueUrl())}return t}))}},7467:(e,t,n)=>{n.d(t,{j:()=>d});var o=n(8286),i=n(9581),r=n(4364),c=n(3518),s=n(1863),a=n(6366),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function d(){return l(this,arguments,void 0,(function*(e=[]){let t=[];try{if(a.serviceWorker)try{return(yield(0,a.sendMessage)("GetConnectionBulk",{connectionIds:e})).data}catch(e){console.error("GetConnectionBulk sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(e.length>0){let n=[];for(let i=0;i<e.length;i++){let r=yield o.d.GetConnection(e[i]);0==r.id?n.push(e[i]):t.push(r)}if(0==n.length)return t;{let e=(0,c.Xr)();const r=yield fetch(i.B.GetConnectionBulkUrl(),{method:"POST",headers:e,body:JSON.stringify(n)});if(r.ok){const e=yield r.json();if(e.length>0)for(let n=0;n<e.length;n++){let i=e[n];t.push(i),o.d.AddConnection(i)}}else(0,s.r)(r),console.log("Get Connection Bulk error",r.status)}}}catch(e){e instanceof Error?console.log("Get Connection Bulk error message: ",e):console.log("Get Connection Bulk unexpected error: ",e),(0,s.M)(e,i.B.GetConnectionBulkUrl())}return yield(0,r.s)(t),t}))}},3130:(e,t,n)=>{n.d(t,{BG:()=>a,SL:()=>l,XZ:()=>s,ZJ:()=>r,iw:()=>c,y0:()=>i,yv:()=>o});const o=1,i=2,r=3,c=4,s=5,a=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.BASE_URL+"/api/getConcept"}static GetConnectionUrl(){return this.BASE_URL+"/api/get-connection-by-id"}static GetConceptBulkUrl(){return this.BASE_URL+"/api/get_concept_bulk"}static GetConnectionBulkUrl(){return this.BASE_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 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.NODE_URL+"/api/v1/logger/logs"}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"}}o.BASE_URL="https://localhost:7053/",o.AI_URL="https://ai.freeschema.com",o.MQTT_URL="192.168.1.249",o.NODE_URL="http://localhost:5001",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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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:()=>a});var o=n(6963),i=n(6731),r=n(205),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a{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 s(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(a.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 s(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return s(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 s(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}}a.root=null},5457:(e,t,n)=>{n.d(t,{c:()=>a});var o=n(6366),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,s;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 a=this.getBalanceFactor(e);return a>1&&t<(null===(o=e.leftNode)||void 0===o?void 0:o.key)?this.rightRotate(e):a<-1&&t>(null===(i=e.rightNode)||void 0===i?void 0:i.key)?this.leftRotate(e):a>1&&t>(null===(r=e.leftNode)||void 0===r?void 0:r.key)?(e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)):a<-1&&t<(null===(s=e.rightNode)||void 0===s?void 0:s.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 s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a{static addType(e){return s(this,void 0,void 0,(function*(){return null==this.root?(this.root=e,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 s(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 s(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(a.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserIdNew(e,t){return s(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 s(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}}a.typeRoot=null,a.root=null},2615:(e,t,n)=>{n.d(t,{j:()=>i});var o=n(6366);class i{constructor(e,t,n,i,r,c,s,a=!1,l,d,h){this.count=0,this.typeCharacter="",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=s,this.typeCharacter=h,this.type=null,this.isNew=a,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),s=n(7282),a=n(6366),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(a.serviceWorker)try{(0,a.sendMessage)("ConceptsData__AddConcept",{concept:e})}catch(e){console.error("Concept Data, Add Concpet sw error: ",e),(0,a.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(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConcept",{id:e})).data}catch(e){console.error("Concept Data, Get Concpet sw error: ",e),(0,a.handleServiceWorkerException)(e)}if(0==e||null==e||null==e)return(0,s.o)();var t=(0,s.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,s.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,s.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,s.o)(),yield c.c.getTypeVariantsWithCharacterValueNew(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return l(this,void 0,void 0,(function*(){var n=(0,s.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){return l(this,void 0,void 0,(function*(){if(a.serviceWorker)try{return(yield(0,a.sendMessage)("ConceptsData__GetConceptsByTypeIdAndUser",{typeId:e,userId:t})).data}catch(e){console.error("Concept Data, Get Concpet sw error:",e),(0,a.handleServiceWorkerException)(e)}let n=[];return n=yield c.c.getTypeVariantsFromTreeWithUserIdNew(e,t),n}))}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,s,a){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=s,this.accessId=a,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.typeCharacter=""}}},5239:(e,t,n)=>{n.d(t,{O:()=>s});var o=n(205),i=n(6366);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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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(s.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)}))}}s.connectionroot=null},991:(e,t,n)=>{n.d(t,{H:()=>s});var o=n(6366),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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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}`),(0,o.dispatchIdEvent)(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,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))}))}}s.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(6366),r=n(3655),c=n(2155),s=n(5239),a=n(991),l=n(3996);class d extends l.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 h{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{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((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 d(t,n,null,null);this.addNodeToTree(o)}}else{let n=[];n.push(e.id);let o=new d(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}}h.connectionTypeRoot=null;var u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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),h.addConnectionToTree(e),a.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),h.addConnectionToTree(e),a.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),a.H.removeNodeFromTree(e.id))}static GetConnectionTypeOfTree(){a.H.node}static GetConnectionByOfTheConceptAndType(e,t){return u(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 a.H.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}catch(e){return console.log("this is the error in GetConnectionByOfTheConceptAndType",e),[]}}))}static GetConnectionByOfType(e,t){return h.GetConnectionByOfTheConceptAndTypeId(e,t)||[]}static GetConnectionTree(){return s.O.connectionroot}static GetConnectionTypeTree(){return h.connectionTypeRoot}static GetConnectionBulkData(e,t,n){return u(this,void 0,void 0,(function*(){yield s.O.getConnectionListFromIds(e,t,n)}))}static GetConnection(e){return u(this,void 0,void 0,(function*(){o.J.incrementConnection(e);let t=new c.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){return u(this,void 0,void 0,(function*(){let t=[];try{if(i.serviceWorker)try{return(yield(0,i.sendMessage)("ConnectionData__GetConnectionsOfCompositionLocal",{id:e})).data}catch(e){console.error("GetConnectionsOfCompositionLocal sw error: ",e),(0,i.handleServiceWorkerException)(e)}let n=[];n=f.GetConnectionByOfType(e,e);for(let e=0;e<n.length;e++){let o=yield s.O.getNodeFromTree(n[e]);o&&t.push(o.value)}}catch(n){console.log("this is the error GetConnectionsOfCompositionLocal",e,t)}return t}))}static GetConnectionsOfConcept(e){return u(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:()=>m});var o=n(9003),i=n(205),r=n(2515),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 addConceptToTree(e){var t=new r.x(e.id,e,null,null);new r.x(e.characterValue,e,null,null),this.addNodeToTree(t)}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(i.B.isLocalDataLoaded)return e("done");setTimeout(s.checkFlag,1e3,e)}static getNodeFromTree(e){return c(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 c(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}s.root=null;var a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{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(i.B.isLocalCharacterLoaded)return e("done");setTimeout(l.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 r.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))}}l.LocalCharacterRoot=null;var d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class h{static addNodeToTree(e){return d(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 r.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 d(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(i.B.isLocalTypeLoaded)return e("done");setTimeout(h.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return d(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}))}}h.LocalTypeRoot=null;var u=n(6416),f=n(9639),p=n(7820),y=n(4864),v=n(628),g=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class m{constructor(){this.name="conceptsArray"}static AddConcept(e){0!=e.id&&((0,o.kH)("localconcept",e),s.addConceptToTree(e),l.addConceptToTree(e),h.addConceptToTree(e),this.localconceptsArray.push(e))}static AddPermanentConcept(e){0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),h.removeConceptType(e.typeId,e.ghostId),p.G.addConceptToTree(e),(0,o.wh)("localconcept",e.ghostId),f.I.AddConcept(e))}static RemoveConcept(e){return g(this,void 0,void 0,(function*(){try{0!=e.id&&(s.removeNodeFromTree(e.ghostId),l.removeConceptType(e.characterValue,e.ghostId),h.removeConceptType(e.typeId,e.ghostId),yield(0,o.wh)("localconcept",e.ghostId))}catch(e){throw e}}))}static RemoveConceptById(e){return g(this,void 0,void 0,(function*(){try{let t=yield m.GetConcept(e);0!=t.id&&(s.removeNodeFromTree(e),l.removeConceptType(t.characterValue,t.ghostId),h.removeConceptType(t.typeId,t.ghostId),v.H.RemoveConcept(t))}catch(e){throw e}}))}static AddConceptToMemory(e){0!=e.id&&(s.addConceptToTree(e),l.addConceptToTree(e),h.addConceptToTree(e))}static GetConcept(e){return g(this,void 0,void 0,(function*(){var t=(0,u.u)(),n=yield s.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static UpdateConceptSyncStatus(e){return g(this,void 0,void 0,(function*(){s.updateSyncStatus(e)}))}static GetConceptByGhostId(e){return g(this,void 0,void 0,(function*(){var t=(0,u.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 g(this,void 0,void 0,(function*(){var t=(0,u.u)(),n=l.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return g(this,void 0,void 0,(function*(){var n=(0,u.u)(),o=yield l.getCharacterAndTypeFromTree(e,t);return o&&(n=o.value),n}))}static GetConceptByCharacterAndCategoryLocal(e,t){return g(this,void 0,void 0,(function*(){var n=(0,u.u)(),o=yield l.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 g(this,void 0,void 0,(function*(){let n=[];return n=yield h.getTypeVariantsFromTreeWithUserId(e,t),n}))}static ClearData(){return g(this,void 0,void 0,(function*(){this.localconceptsArray=[],y.G.connectionArray=[]}))}getName(){return this.name}}m.localconceptsArray=[]},4864:(e,t,n)=>{n.d(t,{G:()=>l});var o=n(9003),i=n(2155),r=n(8286),c=n(205),s=n(628),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{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),0!=e.id&&(0,o.kH)("localconnection",e),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);s.H.RemoveConnectionById(e)}static AddPermanentConnection(e){e.id>0&&((0,o.wh)("localconnection",e.ghostId),r.d.AddConnection(function(e){let t=new i.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(c.B.isLocalConnectionLoaded)return e("done");setTimeout(l.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{console.log("this is the connections",this.connectionArray,e,t);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}}l.connectionArray=[],l.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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(1863),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const s=(e,t)=>c(void 0,void 0,void 0,(function*(){let n={concepts:[],connections:[]};try{const c=new Headers;let s={concepts:e,connections:t};c.set("Content-Type","application/json"),c.set("Authorization","Bearer "+i.b.BearerAccessToken),c.set("Accept","application/json"),c.set("Randomizer",o.B.getRandomizer().toString());const a=yield fetch(o.B.CreateGhostConceptApiUrl(),{method:"POST",headers:c,body:JSON.stringify(s)});if(!a.ok)throw(0,r.r)(a),new Error(`Error! status: ${a.status}`);const l=yield a.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 a(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 l=(...e)=>c(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 d=n(9003),h=n(9736),u=n(6366),f=n(4864),p=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 p(this,void 0,void 0,(function*(){let n=performance.now();try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__SyncDataOnline",{transactionId:e})).data}catch(e){console.error("LocalSyncData__SyncDataOnline sw error: ",e),(0,u.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)?(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(),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 h.v.UpdateConceptSyncStatus(n[e].id);yield this.UpdateConceptListToIncludeRelatedConcepts(o,i);let r=yield function(e,t){return c(this,void 0,void 0,(function*(){try{const n=1e3;let o={concepts:[],connections:[]};const i=yield l(e),r=yield l(t);if(e.length+t.length<=2*n){const e=yield s(i,r);return Array.isArray(null==e?void 0:e.concepts)&&(o.concepts=[...o.concepts,...e.concepts]),Array.isArray(null==e?void 0:e.connections)&&(o.connections=[...o.connections,...e.connections]),o}const c=a(i,n),d=a(r,n),h=[],u=[];for(let e=0;e<c.length;e++){const t=c[e];h.push(s(t,[]))}const f=yield Promise.all(h);for(let e=0;e<f.length;e++){const t=f[e];Array.isArray(null==t?void 0:t.concepts)&&(o.concepts=[...o.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(o.connections=[...o.connections,...t.connections])}for(let e=0;e<d.length;e++){const t=d[e];u.push(s([],t))}const p=yield Promise.all(u);for(let e=0;e<p.length;e++){const t=p[e];Array.isArray(null==t?void 0:t.concepts)&&(o.concepts=[...o.concepts,...t.concepts]),Array.isArray(null==t?void 0:t.connections)&&(o.connections=[...o.connections,...t.connections])}return o}catch(e){throw console.log(e),e}}))}(i,o),d=r.concepts,p=r.connections;for(let e=0;e<d.length;e++)h.v.AddPermanentConcept(d[e]);for(let e=0;e<p.length;e++)f.G.AddPermanentConnection(p[e]);return n}catch(e){throw u.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,s=e[i].typeId,a=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(s))&&void 0!==o?o:s;e[i].ofTheConceptId=a,e[i].toTheConceptId=l,e[i].typeId=d}}static UpdateConceptListToIncludeRelatedConcepts(e,t){return p(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 h.v.GetConceptByGhostId(o),0!=i.id?i.id!=i.ghostId&&(e[n].ofTheConceptId=i.id):(i=yield h.v.GetConcept(o),this.AddConceptIfDoesNotExist(i,t)))}if(i<0){let o=this.CheckIfTheConceptIdExists(i,t);0==o.id&&(o=yield h.v.GetConceptByGhostId(i),0!=o.id?o.id!=o.ghostId&&(e[n].toTheConceptId=o.id):(o=yield h.v.GetConcept(i),this.AddConceptIfDoesNotExist(o,t)))}if(r<0){let o=this.CheckIfTheConceptIdExists(r,t);0==o.id&&(o=yield h.v.GetConceptByGhostId(r),0!=o.id?o.id!=o.ghostId&&(e[n].typeId=o.id):(o=yield h.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,u.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 p(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,d.kH)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,d.kH)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}static initializeTransaction(e){return p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__initializeTransaction",{transactionId:e})).data}catch(e){console.error("LocalSyncData__initializeTransaction sw error: ",e),(0,u.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 p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__markTransactionActions",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__markTransactionActions sw error: ",e),(0,u.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 p(this,void 0,void 0,(function*(){try{if(u.serviceWorker)try{return(yield(0,u.sendMessage)("LocalSyncData__rollbackTransaction",{transactionId:e,actions:t})).data}catch(e){console.error("LocalSyncData__rollbackTransaction sw error: ",e),(0,u.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:()=>a,B:()=>s});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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{static getId(){return c(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){return e=this,t=void 0,c=function*(){try{let e=(0,i.Xr)("application/x-www-form-urlencoded");const t=yield fetch(o.B.GetReservedIdUrl(),{method:"GET",headers:e});if(!t.ok)throw(0,r.r)(t),new Error(`Error! status: ${t.status}`);const n=yield t.json();for(let e=0;e<n.length;e++)s.AddId(n[e])}catch(e){e instanceof Error?console.log("get reserved ids error message: ",e.message):console.log("get reserved ids unexpected error: ",e),(0,r.M)(e,o.B.GetReservedIdUrl())}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(c.next(e))}catch(e){i(e)}}function s(e){try{a(c.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,s)}a((c=c.apply(e,t||[])).next())}));var e,t,n,c}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}s.ids=[];class a{static getId(){return c(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){return e=this,t=void 0,c=function*(){try{let e=(0,i.Xr)("application/x-www-form-urlencoded");const t=yield fetch(o.B.GetReservedConnectionIdUrl(),{method:"GET",headers:e});if(!t.ok)throw(0,r.r)(t),new Error(`Error! status: ${t.status}`);const n=yield t.json();for(let e=0;e<n.length;e++)a.AddId(n[e])}catch(e){e instanceof Error?console.log("get reserved connection ids error message: ",e.message):console.log("get reserved connection ids unexpected error: ",e),(0,r.M)(e,o.B.GetReservedConnectionIdUrl())}},new((n=void 0)||(n=Promise))((function(o,i){function r(e){try{a(c.next(e))}catch(e){i(e)}}function s(e){try{a(c.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,s)}a((c=c.apply(e,t||[])).next())}));var e,t,n,c}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}a.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=""},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:()=>f});var o=n(3655),i=n(1167),r=n(2155),c=n(9581),s=n(3518),a=n(1863),l=n(9639),d=n(8286),h=n(6366),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class f{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 u(this,void 0,void 0,(function*(){if(h.serviceWorker)try{return(yield(0,h.sendMessage)("SyncData__SyncDataOnline",{})).data}catch(e){console.error("SyncData__SyncDataOnline sw error: ",e),(0,h.handleServiceWorkerException)(e)}for(let e=0;e<this.conceptsSyncArray.length;e++)l.I.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)d.d.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],(0,i.Y)(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,n=void 0,i=function*(){let t=new r.N(0,0,0,0,0,0,0);try{var n=(0,s.Xr)(),o=JSON.stringify(e);const i=yield fetch(c.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.r)(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,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((i=i.apply(t,n||[])).next())}));var t,n,o,i}(e)}return"done"}))}static syncDataLocalDb(){return u(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)(0,o.eD)("localconcept",this.conceptsSyncArray[e]);this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)(0,o.eD)("localconnection",this.connectionSyncArray[e]);this.connectionSyncArray=[]}return"done"}))}}f.conceptsSyncArray=[],f.connectionSyncArray=[]},9003:(e,t,n)=>{n.d(t,{S5:()=>a,kH:()=>d,qI:()=>s,wh:()=>h});var o=n(6366),i=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},r=9;class c{}function s(e){return new Promise((function(t,n){c.db&&t(c.db);let i=o.BaseUrl.BASE_URL+"_FreeSchemaLocal"+o.BaseUrl.BASE_APPLICATION;const a=indexedDB.open(i,r);a.onerror=t=>{console.error("Why didn't you allow my web app to use IndexedDB?!",t),indexedDB.deleteDatabase(i),s(e),n(t)},a.onsuccess=function(e){var n=e.target;c.db=n.result,t(c.db)},a.onupgradeneeded=e=>{var n=e.target.result,i="localconcept",c="localconnection",s="localid";console.log("this is the version upgrade",r),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(c)&&n.deleteObjectStore(c),n.objectStoreNames.contains(s)&&n.deleteObjectStore(s),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(c)||(n.createObjectStore(c,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(s)||(n.createObjectStore(s,{keyPath:"id"}).transaction.oncomplete=e=>{l(s,{id:0,value:-100}),l(s,{id:1,value:-200}),l(s,{id:3,value:o.BaseUrl.getRandomizer()})}),t(n)}}))}function a(e){return i(this,void 0,void 0,(function*(){return new Promise((function(t,n){s(e).then((n=>{var o=[],i=n.transaction(e,"readwrite").objectStore(e).getAll();i.onsuccess=()=>{const e=i.result;for(var n=0;n<e.length;n++)o.push(e[n]);t(o)}})).catch((e=>{n({status:400,ok:!1,message:"Cannot get objects from database because you cannot open the Local database",data:e})}))}))}))}function l(e,t){return new Promise((function(n,o){s(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).add(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot store to the Local database "+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot store to database because you cannot open the Local database",data:e})}))}))}function d(e,t){return new Promise((function(n,o){s(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).put(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot update to database because you cannot open the Local database",data:e})}))}))}function h(e,t){return new Promise((function(n,o){s(e).then((i=>{let r=i.transaction(e,"readwrite").objectStore(e).delete(t);r.onsuccess=function(e){n(t)},r.onerror=function(n){o({status:400,ok:!1,message:"Cannot Update to the Local database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot remove object from database because you cannot open the Local database",data:e})}))}))}},3655:(e,t,n)=>{n.d(t,{D3:()=>f,El:()=>u,b8:()=>h,eD:()=>l,kH:()=>d,qI:()=>a,wh:()=>p});var o=n(2299),i=n(9581),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},c=9;class s{}function a(e){return new Promise((function(t,n){s.db&&t(s.db);let o=i.B.BASE_URL+"_FreeSchema"+i.B.BASE_APPLICATION;const r=indexedDB.open(o,c);r.onerror=t=>{console.error("Why didn't you allow my web app to use IndexedDB?!",t),indexedDB.deleteDatabase(o),a(e),n(t)},r.onsuccess=function(e){let n=e.target;s.db=n.result,t(s.db)},r.onupgradeneeded=e=>{let n=e.target.result,o="concept",i="connection",r="settings";console.log("this is the version update for index",c),n.objectStoreNames.contains(o)&&n.deleteObjectStore(o),n.objectStoreNames.contains(i)&&n.deleteObjectStore(i),n.objectStoreNames.contains(r)&&n.deleteObjectStore(r),n.objectStoreNames.contains(o)||(n.createObjectStore(o,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(i)||(n.createObjectStore(i,{keyPath:"id"}).transaction.oncomplete=e=>{}),n.objectStoreNames.contains(r)||(n.createObjectStore(r,{keyPath:"id"}).transaction.oncomplete=e=>{}),t(n)}}))}function l(e,t){return new Promise((function(n,o){console.log("this is storing to the database",t),a(e).then((i=>{if(0!=t.id){const r=i.transaction(e,"readwrite").objectStore(e).add(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot store to the database"+e,data:n,body:t})}}})).catch((e=>{o({status:400,ok:!1,message:"Cannot store to the database because you cannot open the database",data:e})}))}))}function d(e,t){return new Promise((function(n,o){a(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).put(t);r.onsuccess=e=>{n(t)},r.onerror=n=>{o({status:400,ok:!1,message:"Cannot Update to the database"+e,data:n,body:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot update to database because you cannot open the database",data:e})}))}))}function h(){return new Promise((function(e,t){let n="settings";a(n).then((i=>{let r=i.transaction(n,"readwrite").objectStore(n).getAll();r.onsuccess=()=>{let t=new o.B(!1),n=r.result;for(let e=0;e<n.length;e++)t=n[e];e(t)},r.onerror=e=>{t(e)}})).catch((e=>{t({status:400,ok:!1,message:"Cannot get last object from database because you cannot open the database",data:e})}))}))}function u(e){return new Promise((function(t,n){let o="settings";a(o).then((i=>{const r=i.transaction(o,"readwrite").objectStore(o).put(e);r.onsuccess=n=>{t(e)},r.onerror=t=>{n({status:400,ok:!1,message:"Cannot update AI flag",data:t,body:e})}})).catch((e=>{n({status:400,ok:!1,message:"Cannot update AI flag because you cannot open the database",data:e})}))}))}function f(e){return r(this,void 0,void 0,(function*(){return new Promise((function(t,n){a(e).then((n=>{let o=[],i=n.transaction(e,"readwrite").objectStore(e).getAll();i.onsuccess=()=>{const e=i.result;for(let t=0;t<e.length;t++)o.push(e[t]);t(o)}})).catch((e=>{n({status:400,ok:!1,message:"Cannot get objects from the database because you cannot open the database",data:e})}))}))}))}function p(e,t){return new Promise((function(n,o){a(e).then((i=>{const r=i.transaction(e,"readwrite").objectStore(e).delete(Number(t));r.onsuccess=function(e){n(t)},r.onerror=t=>{o({status:400,ok:!1,message:"Cannot remove from the database"+e,data:t})}})).catch((e=>{o({status:400,ok:!1,message:"Cannot remove from the database because you cannot open the database",data:e,body:t})}))}))}},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,{V:()=>s});var o,i=n(6366),r=n(3278),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class s{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())}),6e4))}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){if(!this.shouldLog(e))return;const o=Object.assign({timestamp:(new Date).toLocaleString(),level:e,message:t},n);this.packageLogsData.push(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 logInfo(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.log("INFO",`Information logged for ${s}`,f)}catch(e){console.error("Error on logInfo")}}static logError(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("ERROR",`Information logged for ${s}`,f)}catch(e){console.error("Error on logError")}}static logWarning(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("WARNING",`Information logged for ${s}`,f)}catch(e){console.error("Error on logWarning")}}static logDebug(e,t,n,o,i,r,c,s,l,d,h){try{const u=a("SessionId"),f={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:s,functionParameters:l,userAgent:d,conceptsUsed:h};this.formatLogData("DEBUG",`Information logged for ${s}`,f)}catch(e){console.error("Error on logDebug")}}static logApplication(e,t,n){if(console.log("LogApplicationActivationStatus : ",this.logApplicationActivationStatus),this.logApplicationActivationStatus)try{const o={timestamp:(new Date).toLocaleString(),type:e,message:t,data:n||null};this.applicationLogsData.push(o)}catch(e){console.error("Failed to log application activity:",e)}}static sendApplicationLogsToServer(){return c(this,void 0,void 0,(function*(){try{if(console.log("Log from sendApplicationLogsToServer : ",this.applicationLogsData),0===this.applicationLogsData.length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.applicationLogsData,n=50;for(let o=0;o<t.length;o+=n){const r=t.slice(o,o+n),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({logType:this.appLogs,logData:r})});if(!c.ok){const e=yield c.text();console.error("Failed to send app-logs:-",c.status,c.statusText,e)}}this.applicationLogsData=[]}catch(e){console.error("Network error while sending logs:",e)}}))}static sendPackageLogsToServer(){return c(this,void 0,void 0,(function*(){try{if(console.log("Log from sendPackageLogsToServer : ",this.packageLogsData),0===this.packageLogsData.length)return;const e=r.b.BearerAccessToken;if(!e)return;const t=this.packageLogsData,n=50;for(let o=0;o<t.length;o+=n){const r=t.slice(o,o+n),c=yield fetch(i.BaseUrl.PostLogger(),{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`},body:JSON.stringify({logType:this.mftsccsBrowser,logData:r})});if(!c.ok){const e=yield c.text();return void console.error("Failed to send logs:-",c.status,c.statusText,e)}}this.packageLogsData=[]}catch(e){console.error("Error while sending logs to server:",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 a(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=s,s.logLevel="INFO",s.packageLogsData=[],s.applicationLogsData=[],s.LOG_LEVELS=["DEBUG","INFO","WARNING","ERROR"],s.SYNC_INTERVAL_MS=12e4,s.nextSyncTime=null,s.appLogs="app",s.mftsccsBrowser="mftsccs",s.logApplicationActivationStatus=!1,s.logPackageActivationStatus=!1,s.autoSyncInterval=null,o.startAutoSync()},1412:(e,t,n)=>{function o(e=[],t=[]){}n.d(t,{e:()=>o})},1863:(e,t,n)=>{n.d(t,{M:()=>r,r:()=>i});var o=n(7273);function i(e){if(401==e.status||406==e.status){let t=new o.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}if(500==e.status){let t=new o.z(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}function r(e,t=""){if(e.status){let n=new o.z(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new o.z(e.message,!1,500,e.stack);throw n.setUrl(t),n}}},176:(e,t,n)=>{n.d(t,{F4:()=>c,P6:()=>a,dp:()=>s});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 s(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 a(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(6366),i=n(3655),r=n(9639),c=n(205),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,i.D3)("concept");if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];r.I.AddConceptToMemory(n)}c.B.isDataLoaded=!0,c.B.isCharacterLoaded=!0,c.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:()=>a});var o=n(6366),i=n(7282),r=n(1666),c=n(8407),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,l=null,d=null,h=null){if(o.serviceWorker)try{return(yield(0,o.sendMessage)("CreateTheComposition",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,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,f=null!=d?d:4,p=null!=h?h:999,y=null!=s?s: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,f,p);v=n,t=n.id,y=n.id,yield a(e[o],n.id,n.userId,t,l,d,h)}else{let i=null!=t?t:999,s=null!=n?n:999,g=y,m=yield(0,c.A)(o,"",!0,u,f,p);v=m,yield(0,r.q)(i,s,m.id,g),yield a(e[o],m.id,m.userId,g,l,d,h)}else{let i=null!=t?t:999,s=null!=n?n:10267,a=y,l=yield(0,c.A)(o,e[o].toString(),!1,u,f,p);yield(0,r.q)(i,s,l.id,a)}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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,o,s,l,d){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),h=new Date,u=new Date,f=new i.j(a,t,o,n,s,e,l,!0,h,u,d);return f.isTemp=!1,c.Y.AddConcept(f),f}))}function d(e,t,n,c,l,d,h){return a(this,void 0,void 0,(function*(){let a=yield r.B.getId(),u=new Date,f=new Date,p=new i.j(a,t,c,n,l,e,d,!1,u,f,h);return s.ConceptsData.AddConcept(p),(0,o.Y)([p]),p}))}},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 s=t,a=new o.N(0,e,n,s,c,1,4);if(e==n)return a.ofTheConceptId=0,a.toTheConceptId=1,a;try{a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),i.Y.AddConnection(a)}catch(e){(0,r.M)(e)}return a}},1838:(e,t,n)=>{n.d(t,{m:()=>h});var o=n(9581),i=n(1863),r=n(3518),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},s=n(5239),a=n(4864),l=n(6366),d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function h(e){return d(this,void 0,void 0,(function*(){if(l.serviceWorker)try{return(yield(0,l.sendMessage)("DeleteConnectionById",{id:e})).data}catch(e){console.error("DeleteConnectionById sw error: ",e),(0,l.handleServiceWorkerException)(e)}e>0?(yield function(e){return c(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());let n=(0,r.BZ)();const c=yield fetch(o.B.DeleteTheConnectionUrl(),{method:"POST",headers:n,body:t,redirect:"follow"});c.ok||(console.log("Delete connection error status: ",c.status),(0,i.r)(c))}catch(e){e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),(0,i.M)(e,o.B.DeleteTheConnectionUrl())}}))}(e),s.O.removeNodeFromTree(e)):a.G.RemoveConnectionById(e)}))}},4364:(e,t,n)=>{n.d(t,{s:()=>r});var o=n(1239),i=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function r(){return i(this,arguments,void 0,(function*(e=[]){let t=[];if(e.length>0){for(let n=0;n<e.length;n++)t.includes(e[n].ofTheConceptId)||t.push(e[n].ofTheConceptId),t.includes(e[n].toTheConceptId)||t.push(e[n].toTheConceptId),t.includes(e[n].typeId)||t.push(e[n].typeId);yield(0,o.r)(t)}}))}},5284:(e,t,n)=>{n.d(t,{B:()=>c});var o=n(6366),i=n(8286),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function c(){return r(this,arguments,void 0,(function*(e=[]){let t=[];try{if(o.serviceWorker)try{return(yield(0,o.sendMessage)("FindConnectionsOfCompositionsBulkInMemory",{composition_ids:e})).data}catch(e){console.error("FindConnectionsOfCompositionsBulkInMemory sw error: ",e),(0,o.handleServiceWorkerException)(e)}for(let n=0;n<e.length;n++){let o=yield i.d.GetConnectionsOfConcept(e[n]);t.push(...o)}return t}catch(e){return console.error("FindConnectionsOfCompositionsBulkInMemory error: ",e),t}}))}},8939:(e,t,n)=>{n.d(t,{$N:()=>w,$V:()=>h,Ez:()=>T,JA:()=>m,Mb:()=>p,Nj:()=>f,PT:()=>C,RW:()=>g,XI:()=>v,ay:()=>d,hL:()=>l,kx:()=>y,re:()=>u,yz:()=>I,zN:()=>A});var o=n(7139),i=n(2),r=n(9639),c=n(8286),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(this,void 0,void 0,(function*(){let t={connectionList:[],compositionList:[]};try{if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionById",{id:e})).data}catch(e){console.error("GetCompositionById error sw: ",e),(0,s.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 d(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield A(e,t,n);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function h(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield A(e,t,n);s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l;let d={};return d.created_at=a.entryTimeStamp,d.data=s,d.id=e,d}))}function u(e,t,n){return a(this,void 0,void 0,(function*(){var i,c;let s={},a=yield r.I.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield(0,o.r)(e));let l=yield k(a,t,n);return s[null!==(c=null===(i=null==a?void 0:a.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:""]=l,s}))}function f(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetComposition",{id:e})).data}catch(e){console.error("GetComposition error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};c=yield(0,i.s)(e),console.log("this is the connection list online",c);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 A(e,c,l);return a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function p(e){return a(this,void 0,void 0,(function*(){var t,n;let c=[],s={};c=yield(0,i.s)(e);let a=[];for(let e=0;e<c.length;e++)a.includes(c[e].ofTheConceptId)||a.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,a);return s[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=d,s}))}function y(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemory",{id:e})).data}catch(e){console.error("GetCompositionFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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 a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function v(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryNormal",{id:e})).data}catch(e){console.error("GetCompositionFromMemoryNormal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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 k(d,i,l);return a[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,a}))}function g(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i={},a=[],l={};try{a=yield c.d.GetConnectionsOfCompositionLocal(e);let s=[];for(let e=0;e<a.length;e++)s.includes(a[e].ofTheConceptId)||s.push(a[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,a,s);l[null!==(n=null===(t=null==d?void 0:d.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=h,i.created_at=d.entryTimeStamp,i.data=l,i.id=e}catch(t){console.log("this is the exception in GetCompositionWithIdFromMemory",e)}return i}))}function m(e,t){return a(this,void 0,void 0,(function*(){var n,i;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionFromMemoryWithConnections",{id:e,connectionList:t})).data}catch(e){console.error("GetCompositionFromMemoryWithConnections error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c={},a=[];for(let e=0;e<t.length;e++)a.includes(t[e].ofTheConceptId)||a.push(t[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 N(l,t,a);c[null!==(i=null===(n=null==l?void 0:l.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=d;let h={};return h.created_at=l.entryTimeStamp,h.data=c,h.id=e,h}))}function C(e,t){return a(this,void 0,void 0,(function*(){var n,i;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c={},a=[];for(let e=0;e<t.length;e++)a.includes(t[e].ofTheConceptId)||a.push(t[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 N(l,t,a);console.log("this is the output",d,l),c[null!==(i=null===(n=null==l?void 0:l.type)||void 0===n?void 0:n.characterValue)&&void 0!==i?i:""]=d;let h={};return h.created_at=l.entryTimeStamp,h.data=c,h.id=e,h}))}function w(e){return a(this,void 0,void 0,(function*(){var t;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdFromMemoryNew",{id:e})).data}catch(e){console.error("GetCompositionWithIdFromMemoryNew error sw: ",e),(0,s.handleServiceWorkerException)(e)}let n=[],i={};n=yield c.d.GetConnectionsOfCompositionLocal(e);let l=[];for(let e=0;e<n.length;e++)l.includes(n[e].ofTheConceptId)||l.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));let h=(new Date).getTime(),u=yield function(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,a,l,d,h,u;let f={},p=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(p)){let t=y;return{[t]:null==e?void 0:e.characterValue}}if(o.includes(p))return"";o.push(p);for(let e=0;e<t.length;e++){let n=yield(0,s.GetTheConcept)(t[e].ofTheConceptId),o=yield(0,s.GetTheConcept)(t[e].toTheConceptId);t[e].ofConcept=n,t[e].toConcept=o;let i=n.id,r="the_",l=(null!==(a=null===(c=null==o?void 0:o.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"").replace(r,"");null!=f[i]&&null!=f[i]||(f[i]={}),f[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 s=v[n.id];null!=s[i]&&null!=s[i]||(s[i]={}),null!=f[t[e].ofTheConceptId]&&null!=f[t[e].toTheConceptId]?s[i][c]=f[o.id]:s[i][c]=o.characterValue}return v[e.id]}))}(d,n,l);console.log("this is the time for the data to be made",(new Date).getTime()-h),null===(t=null==d?void 0:d.type)||void 0===t||t.characterValue,i=u;let f={};return f.created_at=d.entryTimeStamp,f.data=i,f.id=e,f}))}function T(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithIdAndDateFromMemory",{id:e})).data}catch(e){console.error("GetCompositionWithIdAndDateFromMemory error sw: ",e),(0,s.handleServiceWorkerException)(e)}let i=[],a={};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(e,i,l);a[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=a,u.id=e,u.created_at=d.entryTimeStamp,u}))}function I(e){return a(this,void 0,void 0,(function*(){var t,n;if(s.serviceWorker)try{return(yield(0,s.sendMessage)("GetCompositionWithId",{id:e})).data}catch(e){console.error("GetCompositionWithId error sw: ",e),(0,s.handleServiceWorkerException)(e)}let c=[],a={};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 A(e,c,l);a[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=a,u.id=e,u}))}function N(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const e=yield N(h,t,n,i);l[f]=e}}else{const e=yield N(h,t,n,i);d[f]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function k(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;(new Date).getTime();let l={},d=[],h=e.id;if(l.id=h,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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const e=yield N(h,t,n,i);l[f]=e}}else{const e=yield N(h,t,n,i);d[f]=e,l=d}}else console.log("this is the faulty connection ",t[e]);return l}))}function A(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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_",f=(null!==(a=null===(s=null==h?void 0:h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").replace(u,"");if(isNaN(Number(f))){if(f){const o=yield A(e,t,n,i);l[f]=o}}else{const o=yield A(e,t,n,i);d[f]=o,l=d}}else console.log("this is the faulty connection ",t[c]);return l}))}function S(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,i=[]){var c,s,a;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!==(a=null===(s=null==c?void 0:c.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"").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:()=>w,MT:()=>C,Nt:()=>f,QL:()=>v,as:()=>p,cw:()=>d,dF:()=>l,hG:()=>y,km:()=>u,nr:()=>m,p8:()=>h,rv:()=>g});var o=n(8642),i=n(7467),r=n(6366),c=n(5284),s=n(8939),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(){return a(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 d(){return a(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 h(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataId",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataId error sw: ",e),(0,r.handleServiceWorkerException)(e)}let n=[];for(let t=0;t<e.length;t++){let o=yield(0,s.RW)(e[t]);n.push(o)}return n}))}function u(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdFromConnections",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdFromConnections 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.PT)(e[t],n);o.push(i)}return o}))}function f(){return a(this,arguments,void 0,(function*(e=[],t=[]){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetCompositionFromConnectionsWithDataIdIndex",{conceptIds:e,connectionIds:t})).data}catch(e){console.error("GetCompositionFromConnectionsWithDataIdIndex error sw: ",e),(0,r.handleServiceWorkerException)(e)}yield(0,i.j)(t),yield(0,c.B)(e);let n={};for(let t=0;t<e.length;t++){let o=yield(0,s.RW)(e[t]);n[e[t]]=o}return n}))}function p(){return a(this,arguments,void 0,(function*(e=[],t=[]){yield(0,i.j)(t),yield(0,c.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 y(){return a(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 v(e){return a(this,void 0,void 0,(function*(){if(r.serviceWorker)try{return(yield(0,r.sendMessage)("GetConnectionDataPrefetch",{connectionIds:e})).data}catch(e){console.error("GetConnectionDataPrefetch error sw: ",e),(0,r.handleServiceWorkerException)(e)}let t=[],n=[],o={};for(let o=0;o<e.length;o++){let i=yield r.ConnectionData.GetConnection(e[o]);0==i.id?t.push(e[o]):n.push(i)}for(let n=0;n<t.length;n++)o[e[n]]=!1;let c=[],s=yield(0,i.j)(t);n=[...n,...s];for(let e=0;e<n.length;e++)c.push(n[e].ofTheConceptId),c.push(n[e].toTheConceptId),c.push(n[e].typeId);return yield(0,r.GetConceptBulk)(c),n}))}function g(){return a(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.RW)(e[t]);n[e[t]]=o}return n}))}function m(){return a(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 C(){return a(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 w(){return a(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}return n}))}},2013:(e,t,n)=>{n.d(t,{A:()=>s,w:()=>a});var o=n(8146),i=n(6366),r=n(9639),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function s(e){return c(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacter",{characterValue:e})).data}catch(e){console.error("GetConceptByCharacter sw error: ",e),(0,i.handleServiceWorkerException)(e)}let t=yield r.I.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield(0,o.Y)(e),t=yield r.I.GetConceptByCharacterAndTypeLocal(e,51),0==t.id&&(t=yield r.I.GetConceptByCharacter(e))),t}))}function a(e){return c(this,void 0,void 0,(function*(){if(i.serviceWorker)try{return(yield(0,i.sendMessage)("GetConceptByCharacterUpdated",{characterValue:e})).data}catch(e){console.error("GetConceptByCharacterUpdated error sw: ",e),(0,i.handleServiceWorkerException)(e)}let t=yield r.I.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield(0,o.Y)(e),t=yield r.I.GetConceptByCharacter(e)),t}))}},7887:(e,t,n)=>{n.d(t,{a:()=>a,p:()=>l});var o=n(8286),i=n(4864),r=n(9003),c=n(3655),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,c.D3)("connection");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 l(){return s(this,void 0,void 0,(function*(){try{let e=yield(0,r.S5)("localconnection");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:()=>l});var o=n(1735),i=n(7139),r=n(6366),c=n(9639),s=n(7282),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e){return a(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")}try{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 n=(0,s.o)();if(e<0){let o=yield(0,r.GetUserGhostId)(t,e);return n=(0,r.convertFromLConceptToConcept)(o),n}if(n=yield c.I.GetConcept(e),null!=n&&0!=n.id||null==e||null==e||(n=yield(0,i.r)(e)),0!=n.id&&null==n.type&&null==(yield c.I.GetConcept(n.typeId))&&null!=n.typeId&&null!=n.typeId){let e=yield(0,i.r)(n.typeId);n.type=e}return n}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}}))}},7869:(e,t,n)=>{n.d(t,{_:()=>p,A:()=>f});var o=n(9581),i=n(9639),r=n(1863),c=n(3518),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},a=n(2299);class l{}l.isUpdated=!1,l.isOnlineSync=!1;var d=n(3655),h=n(9003),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function f(){return u(this,arguments,void 0,(function*(e=!0){try{if(yield(0,d.qI)("concepts"),yield(0,h.qI)("concepts"),e){if((yield(0,d.b8)()).isOnlineSync)return!0;yield function(){return s(this,void 0,void 0,(function*(){try{const n=(new Date).getTime();var e=(0,c.ab)("application/x-www-form-urlencoded");const s=yield fetch(o.B.GetAllAiData(),{method:"GET",headers:e});s.ok||(console.log("Ai Error Message: ","Cannot get response"),(0,r.r)(s));const a=yield s.json();for(var t=0;t<a.length;t++)i.I.AddConcept(a[t]);p();let l=(new Date).getTime()-n;console.log("The time taken is ",l)}catch(e){e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),(0,r.M)(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 p(){return u(this,void 0,void 0,(function*(){l.isOnlineSync=!0;var e=new a.B(l.isOnlineSync);(0,d.El)(e)}))}},8095:(e,t,n)=>{n.d(t,{h:()=>c});var o=n(6366),i=n(9700),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function c(e,t,n){return r(this,arguments,void 0,(function*(e,t,n,r=!1,c={concepts:[],connections:[]}){var s,a,l,d,h,u;let f=performance.now();try{if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateConnectionBetweenTwoConceptsLocal",{ofTheConcept:e,toTheConcept:t,linker:n,both:r,actions:c});return(null===(a=null===(s=null==i?void 0:i.actions)||void 0===s?void 0:s.concepts)||void 0===a?void 0:a.length)&&(c.concepts=JSON.parse(JSON.stringify(i.actions.concepts))),(null===(d=null===(l=null==i?void 0:i.actions)||void 0===l?void 0:l.connections)||void 0===d?void 0:d.length)&&(c.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateConnectionBetweenTwoConceptsLocal sw error: ",e),(0,o.handleServiceWorkerException)(e)}if(e.userId,r){let i=(null===(h=t.type)||void 0===h?void 0:h.characterValue)+"_s_"+n+"_by";var p=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,0,c);yield(0,o.CreateTheConnectionLocal)(t.id,e.id,p.id,1e3,void 0,void 0,c)}let i=(null===(u=e.type)||void 0===u?void 0:u.characterValue)+"_s_"+n+"_s";var y=yield(0,o.MakeTheInstanceConceptLocal)("connection",i,!1,999,999,999,void 0,c);return yield(0,o.CreateTheConnectionLocal)(e.id,t.id,y.id,1e3,void 0,void 0,c)}catch(o){throw i.V.logError(f,e.userId,"create",void 0,void 0,500,o,"CreateConnectionBetweenTwoConceptsLocal",[e,t,n,r],void 0,void 0),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:()=>l,EO:()=>d,xd:()=>h});var o=n(205),i=n(9736),r=n(5257),c=n(9003),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(){return a(this,void 0,void 0,(function*(){console.log("this is trying to create local binary tree");try{let e=yield(0,c.S5)("localconcept");if(Array.isArray(e))for(let t=0;t<e.length;t++){let n=e[t];i.v.AddConceptToMemory(n)}o.B.isLocalDataLoaded=!0,o.B.isLocalTypeLoaded=!0,o.B.isLocalCharacterLoaded=!0}catch(e){throw yield(0,s.DelayFunctionExecution)(2e3,l()),{message:"Cannot create local binary tree from index db",data:e,ok:!1,status:400}}}))}function d(){return a(this,void 0,void 0,(function*(){var e;try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>a(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]&&s.BaseUrl.setRandomizer(e[2].value)}}))))}catch(e){throw{message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400}}}))}function h(){return a(this,void 0,void 0,(function*(){var e;try{yield null===(e=navigator.locks)||void 0===e?void 0:e.request("dblock",(e=>a(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]&&s.BaseUrl.setRandomizer(e[2].value)}}))))}catch(e){throw{message:"Cannot populate Local Ids from the Index Db",data:e,ok:!1,status:400}}}))}},999:(e,t,n)=>{n.d(t,{R:()=>a});var o=n(6366),i=n(6416),r=n(4711),c=n(5868),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(this,arguments,void 0,(function*(e,t=null,n=null,s=null,l=null,d=null,h=null,u=!1,f={concepts:[],connections:[]}){var p,y,v,g;if(o.serviceWorker)try{const i=yield(0,o.sendMessage)("CreateTheCompositionLocal",{json:e,ofTheConceptId:t,ofTheConceptUserId:n,mainKey:s,userId:l,accessId:d,sessionInformationId:h,actions:f});return(null===(y=null===(p=null==i?void 0:i.actions)||void 0===p?void 0:p.concepts)||void 0===y?void 0:y.length)&&(f.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)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheCompositionLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let m=null!=l?l:999,C=null!=d?d:999,w=null!=h?h:999,T=null!=s?s:0,I=(0,i.u)();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){let t=T,n=yield(0,c.k)(o,"",!0,m,C,w,void 0,f);I=n,t=n.id,T=n.id,yield a(e[o],n.id,n.userId,t,l,d,h,void 0,f)}else{let n=null!=t?t:999,i=T,s=yield(0,c.k)(o,"",!0,m,C,w,void 0,f);yield(0,r.F)(n,s.id,i,void 0,void 0,void 0,f),yield a(e[o],s.id,s.userId,i,l,d,h,void 0,f)}else{let n=null!=t?t:999,i=T,s=yield(0,c.k)(o,e[o].toString(),!1,m,C,w,void 0,f);yield(0,r.F)(n,s.id,i,void 0,void 0,void 0,f)}return I}))}},3077:(e,t,n)=>{n.d(t,{A:()=>l});var o=n(6366),i=n(2615),r=n(9736),c=n(5257),s=n(9700),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,l,d,h){return a(this,arguments,void 0,(function*(e,t,n,a,l,d,h=!1,u=0,f={concepts:[],connections:[]}){var p,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:a,typeId:l,accessId:d,isComposition:h,referentId:u});return(null===(y=null===(p=null==i?void 0:i.actions)||void 0===p?void 0:p.concepts)||void 0===y?void 0:y.length)&&(f.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)&&(f.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("CreateTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let s=yield c.R.getConceptId(),m=!0,C=new Date,w=new Date;if("the"==e)return new i.j(1,999,5,5,u,e,d,m,C,w,t);let T=new i.j(s,n,l,a,u,e,d,m,C,w,t);return T.isTemp=!0,T.isComposition=h,r.v.AddConcept(T),f.concepts.push(T),T}catch(o){throw s.V.logError(m,n,"create","unknown","unknown",500,void 0,"createTheConceptLocal",[e,t,n,a,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),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n){return a(this,arguments,void 0,(function*(e,t,n,a=1,l="",d=999,h={concepts:[],connections:[]}){var u,f,p,y;let v=performance.now();if(s.serviceWorker)try{const o=yield(0,s.sendMessage)("CreateTheConnectionLocal",{ofTheConceptId:e,toTheConceptId:t,typeId:n,orderId:a,typeString:l,userId:d,actions:h});return(null===(f=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.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,s.handleServiceWorkerException)(e)}try{let c=4,u=yield r.R.getConnectionId(),f=0,p=0,y=0;f=e,p=t,y=n;let v=new o.N(0,0,0,0,0,0,0);return e!=t&&(v=new o.N(u,f,p,d,n,a,c),v.isTemp=!0,v.typeCharacter=l,s.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,a,l,d],"UnknownUserAgent",[]),o}}))}},8064:(e,t,n)=>{n.d(t,{$I:()=>s,Ay:()=>c});var o=n(9736),i=(n(9581),n(3518),n(6366));n(1863);var r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 s(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 s(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:()=>a});var o=n(9736),i=n(7820),r=n(6366),c=n(176),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e){return s(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:()=>s});var o=n(6366),i=n(9736),r=n(3077),c=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function s(e,t,n,s,a){return c(this,arguments,void 0,(function*(e,t,n,c,s,a={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:s,actions:a});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)&&(a.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)&&(a.connections=JSON.parse(JSON.stringify(i.actions.connections))),i.data}catch(e){console.error("MakeTheConceptLocal error sw: ",e),(0,o.handleServiceWorkerException)(e)}let f=yield i.v.GetConceptByCharacterAndTypeLocal(e,s),p=f;return"the"==t&&(c=1),0==p.id&&(f=yield(0,r.A)(e,t,n,c,s,4,void 0,void 0,a),p=f),p}))}},5868:(e,t,n)=>{n.d(t,{k:()=>a});var o=n(3077),i=n(8357),r=n(9736),c=n(6366),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function a(e,t){return s(this,arguments,void 0,(function*(e,t,n=!1,s,a,l=999,d=0,h={concepts:[],connections:[]}){var u,f,p,y;let v=performance.now();if(c.serviceWorker)try{const o=yield(0,c.sendMessage)("MakeTheInstanceConceptLocal",{type:e,referent:t,composition:n,userId:s,accessId:a,sessionInformationId:l,referentId:d,actions:h});return(null===(f=null===(u=null==o?void 0:o.actions)||void 0===u?void 0:u.concepts)||void 0===f?void 0:f.length)&&(h.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(y=null===(p=null==o?void 0:o.actions)||void 0===p?void 0:p.connections)||void 0===y?void 0:y.length)&&(h.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("MakeTheInstanceConceptLocal error sw: ",e),(0,c.handleServiceWorkerException)(e)}try{let a,l,u=999,f=4,p=s,y=4,v="",g=t.length;if(v=e.startsWith("the_")?e:"the_"+e,n)a=yield(0,i.$)(e,u,s,s,h),l=yield(0,o.A)(t,e,s,f,a.id,y,!0,d,h);else if(g>255)a=yield(0,i.$)(v,u,p,s,h),l=yield(0,o.A)(t,v,s,f,a.id,y,void 0,void 0,h);else{a=yield(0,i.$)(v,u,p,s,h);let e=yield r.v.GetConceptByCharacterAndTypeLocal(t,a.id);l=e,0==e.id&&0==e.userId&&(l=yield(0,o.A)(t,v,s,f,a.id,y,void 0,void 0,h))}return l.type=a,c.LocalSyncData.AddConcept(l),h.concepts.push(l),l}catch(o){throw c.Logger.logError(v,s,"create","Unknown","Unknown",500,void 0,"MakeTheInstanceConceptLocal",[e,t,n,s,a,l,d],"UnknownUserAgent",[]),o}}))}},8357:(e,t,n)=>{n.d(t,{$:()=>l});var o=n(3077),i=n(8064),r=n(6467),c=n(9975),s=n(6366),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function l(e,t,n,d){return a(this,arguments,void 0,(function*(e,t,n,a,d={concepts:[],connections:[]}){var h,u,f,p;if(s.serviceWorker)try{const o=yield(0,s.sendMessage)("MakeTheTypeConceptLocal",{typeString:e,sessionId:t,sessionUserId:n,userId:a,actions:d});return(null===(u=null===(h=null==o?void 0:o.actions)||void 0===h?void 0:h.concepts)||void 0===u?void 0:u.length)&&(d.concepts=JSON.parse(JSON.stringify(o.actions.concepts))),(null===(p=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===p?void 0:p.length)&&(d.connections=JSON.parse(JSON.stringify(o.actions.connections))),o.data}catch(e){console.error("MakeTheTypeConceptLocal error sw: ",e),(0,s.handleServiceWorkerException)(e)}let y=yield(0,i.$I)(e);if(y&&(0==y.id||0==y.userId)){let i=(0,r.f)(e);if(i[0]==e)y=yield(0,c.A)(e,"the",a,1,51,d);else{let r=yield l(i[0],t,n,a,d),c=yield l(i[1],t,n,a,d);y=yield(0,o.A)(e,i[1],a,r.id,c.id,4,void 0,void 0,d)}}return y}))}},3729:(e,t,n)=>{n.d(t,{D:()=>f});var o=n(9934),i=n(4485),r=n(2),c=n(7876),s=n(1838),a=n(999),l=n(5868),d=n(6366),h=n(176),u=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function f(e){return u(this,arguments,void 0,(function*(e,t={concepts:[],connections:[]}){var n,u,f,p;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===(p=null===(f=null==o?void 0:o.actions)||void 0===f?void 0:f.connections)||void 0===p?void 0:p.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 w=(0,d.CreateDefaultLConcept)(),T=(0,d.CreateDefaultLConcept)();const I=[],N=e.compositionId,k=e.ofTheCompositionId;let A=[],S=yield(0,r.s)(N);for(let e=0;e<S.length;e++)m.push((0,h.P6)(S[e]));const L=[],x=[];let B=[];for(let e=0;e<m.length;e++)(0,o.A)(x,m[e].ofTheConceptId),(0,o.A)(L,m[e].ofTheConceptId),(0,o.A)(L,m[e].toTheConceptId),B.push(m[e].ofTheConceptId);for(let e=0;e<L.length;e++){const t=yield(0,c.A)(L[e]);N==L[e]&&(w=(0,h.F4)(t)),k==L[e]&&(T=(0,h.F4)(t)),C.push((0,h.F4)(t))}const G=e.patchObject;for(const e in G){let n=(0,d.CreateDefaultLConcept)();const o=G[e];let r=w;T.id>0&&(r=T),Array.isArray(o)||"object"==typeof o?(n=yield(0,l.k)(e,"",!0,w.userId,4,999,void 0,t),yield(0,a.R)(G[e],n.id,n.userId,w.id,w.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),I.push(c[e])}yield(0,d.CreateTheConnectionLocal)(r.id,n.id,w.id,2,void 0,void 0,t),C.push(n)}for(let e=0;e<A.length;e++)yield(0,s.m)(A[e].id);yield d.LocalSyncData.SyncDataOnline(void 0,t)}))}},8407:(e,t,n)=>{n.d(t,{A:()=>p});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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},s=n(4402),a=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class l{constructor(e,t,n,o,i,r,c,s,a,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=s,this.entryTimestamp=a,this.isNew=l}}var d=n(6366),h=n(7282),u=n(2212),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function p(e,t){return f(this,arguments,void 0,(function*(e,t,n=!1,f,p=4,y=999,v=0){if(performance.now(),d.serviceWorker)try{return(yield(0,d.sendMessage)("MakeTheInstanceConcept",{type:e,referent:t,composition:n,userId:f,passedAccessId:p,passedSessionId:y,referentId:v})).data}catch(e){console.error("MakeTheInstanceConcept sw error: ",e),(0,d.handleServiceWorkerException)(e)}let g,m=y,C=f,w=f,T=p,I=f,N="",k=t.length,A=(0,h.o)();if(N=e.startsWith("the_")?e:"the_"+e,n)A=yield(0,d.MakeTheTypeConceptApi)(e,f),g=yield(0,u.Ay)(t,f,4,A.id,v,T,e);else if(k>255)A=yield(0,d.MakeTheTypeConceptApi)(N,f),g=yield(0,u.Ay)(t,f,4,A.id,v,T,N),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.r)(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 l(f,t,999,C,T,I,m,w,Date.now().toString(),!0));else{A=yield(0,d.MakeTheTypeConceptApi)(N,f);let e=yield(0,s.A)(t,A.id);g=e,0==e.id&&0==e.userId&&(g=yield(0,u.N)(t,f,4,A.id,12,T,N),function(e,t,n,c){a(this,void 0,void 0,(function*(){try{let s={newConceptId:e,referent:t,typeId:n,typeUserId:c},a=(0,i.Xr)(),l=JSON.stringify(s);const d=yield fetch(o.B.MakeTheNameInBackendUrl(),{method:"POST",headers:a,body:l});d.ok||(0,r.r)(d)}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.M)(e,o.B.MakeTheNameInBackendUrl())}}))}(g.id,`${t}`,A.id,f))}return g.type=A,g}))}},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"){return{"Content-Type":e,Authorization:"Bearer "+o.b.BearerAccessToken,Accept:t}}function r(e="application/json",t="",n="application/json"){return""==t&&(t=o.b.BearerAccessToken),{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}}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})},4287:(e,t,n)=>{n.d(t,{w:()=>c});var o=n(6366),i=n(3130),r=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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;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)),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")}))}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)}))}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)}))}}},5328:(e,t,n)=>{n.d(t,{d:()=>l});var o=n(6366),i=n(3130),r=n(8939),c=n(4287),s=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class a 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 s(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 s(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 a(e,t,n,o,r)}},6366:(e,t,n)=>{n.r(t),n.d(t,{ADMIN:()=>zn,ALLID:()=>un.BG,AccessTracker:()=>ze.J,AddGhostConcept:()=>hn,Anomaly:()=>Uo,BaseUrl:()=>c.B,BinaryTree:()=>Ue.W,BuilderStatefulWidget:()=>Eo,Composition:()=>Et,CompositionBinaryTree:()=>Gt,CompositionNode:()=>xt,Concept:()=>yo.j,ConceptsData:()=>u.I,Connection:()=>P.N,ConnectionData:()=>qe.d,CreateComposition:()=>F.A,CreateConnectionBetweenEntityLocal:()=>ti,CreateConnectionBetweenTwoConcepts:()=>Y,CreateConnectionBetweenTwoConceptsGeneral:()=>K,CreateConnectionBetweenTwoConceptsLocal:()=>Pn.h,CreateDefaultConcept:()=>V.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>O.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>re.q,CreateTheConnectionGeneral:()=>J,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>un.y0,DATAIDDATE:()=>un.iw,DelayFunctionExecution:()=>Jn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>Vn,DeleteConnectionById:()=>z.m,DeleteConnectionByType:()=>$o,DeleteUser:()=>He,DependencyObserver:()=>Zn.w,FilterSearch:()=>To,FormatFromConnections:()=>An,FormatFromConnectionsAltered:()=>Nn,FreeschemaQuery:()=>zo,FreeschemaQueryApi:()=>Qo,GetAllConnectionsOfComposition:()=>D.s,GetAllConnectionsOfCompositionBulk:()=>y.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Jo,GetComposition:()=>g.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:()=>g.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>N,GetCompositionListListener:()=>co,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>E,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>A,GetCompositionListener:()=>oo,GetCompositionLocal:()=>B,GetCompositionLocalWithId:()=>G,GetCompositionWithAllIds:()=>g.Mb,GetCompositionWithCache:()=>$t,GetCompositionWithDataIdBulk:()=>qt,GetCompositionWithDataIdWithCache:()=>zt,GetCompositionWithId:()=>g.yz,GetCompositionWithIdAndDateFromMemory:()=>g.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>m.A,GetConceptByCharacterAndCategoryLocal:()=>C.$I,GetConceptByCharacterAndType:()=>ce.A,GetConnectionBetweenTwoConceptsLinker:()=>$n,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>po,GetLinkListener:()=>so.d,GetLinkRaw:()=>le,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>Gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>Sn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>un.ZJ,LConcept:()=>vo,LConnection:()=>go,LISTNORMAL:()=>un.SL,LocalConceptsData:()=>v.v,LocalSyncData:()=>wo.H,LocalTransaction:()=>Fo,Logger:()=>Lo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>Q.A,MakeTheInstanceConceptLocal:()=>ee.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>xe,MakeTheTypeConceptLocal:()=>de.$,NORMAL:()=>un.yv,PRIVATE:()=>qn,PUBLIC:()=>Qn,PatcherStructure:()=>mo,RAW:()=>un.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>st,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>ho,SchemaQueryListener:()=>Zo,SearchAllConcepts:()=>Pt,SearchLinkInternal:()=>Wn,SearchLinkInternalAll:()=>Un,SearchLinkMultipleAll:()=>In,SearchLinkMultipleAllObservable:()=>Kn,SearchLinkMultipleApi:()=>d,SearchQuery:()=>et,SearchStructure:()=>Io,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Cn,SearchWithTypeAndLinkerApi:()=>Yn,SessionData:()=>Co,Signin:()=>Nt,Signup:()=>wt,SignupEntity:()=>Tt,SplitStrings:()=>h.f,StatefulWidget:()=>bo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Wt,UpdateCompositionLocal:()=>Ln.D,UserBinaryTree:()=>an,Validator:()=>Vo,ViewInternalData:()=>En,ViewInternalDataApi:()=>bn,WidgetTree:()=>Ko,convertFromConceptToLConcept:()=>Dn.F4,convertFromLConceptToConcept:()=>Dn.dp,createFormFieldData:()=>jo,dispatchIdEvent:()=>Ni,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ie,handleServiceWorkerException:()=>Ai,hasActivatedSW:()=>vi,init:()=>Ci,recursiveFetch:()=>g.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>ii,renderPage:()=>oi,renderWidget:()=>ri,searchLinkMultipleListener:()=>eo,sendMessage:()=>wi,serviceWorker:()=>di,setHasActivatedSW:()=>gi,storeToDatabase:()=>ne,subscribedListeners:()=>fi,updateAccessToken:()=>mi,uploadAttachment:()=>ht,uploadFile:()=>ft,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var o={};n.r(o),n.d(o,{ADMIN:()=>zn,ALLID:()=>un.BG,AccessTracker:()=>ze.J,AddGhostConcept:()=>hn,Anomaly:()=>Uo,BaseUrl:()=>c.B,BinaryTree:()=>Ue.W,BuilderStatefulWidget:()=>Eo,Composition:()=>Et,CompositionBinaryTree:()=>Gt,CompositionNode:()=>xt,Concept:()=>yo.j,ConceptsData:()=>u.I,Connection:()=>P.N,ConnectionData:()=>qe.d,CreateComposition:()=>F.A,CreateConnectionBetweenEntityLocal:()=>ti,CreateConnectionBetweenTwoConcepts:()=>Y,CreateConnectionBetweenTwoConceptsGeneral:()=>K,CreateConnectionBetweenTwoConceptsLocal:()=>Pn.h,CreateDefaultConcept:()=>V.o,CreateDefaultLConcept:()=>on.u,CreateSession:()=>Yt,CreateSessionVisit:()=>Kt,CreateTheCompositionLocal:()=>O.R,CreateTheCompositionWithCache:()=>Ft,CreateTheConnection:()=>re.q,CreateTheConnectionGeneral:()=>J,CreateTheConnectionLocal:()=>rn.F,DATAID:()=>un.y0,DATAIDDATE:()=>un.iw,DelayFunctionExecution:()=>Jn,DeleteConceptById:()=>je,DeleteConceptLocal:()=>Vn,DeleteConnectionById:()=>z.m,DeleteConnectionByType:()=>$o,DeleteUser:()=>He,DependencyObserver:()=>Zn.w,FilterSearch:()=>To,FormatFromConnections:()=>An,FormatFromConnectionsAltered:()=>Nn,FreeschemaQuery:()=>zo,FreeschemaQueryApi:()=>Qo,GetAllConnectionsOfComposition:()=>D.s,GetAllConnectionsOfCompositionBulk:()=>y.Y,GetAllTheConnectionsByTypeAndOfTheConcept:()=>Jo,GetComposition:()=>g.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:()=>g.JA,GetCompositionList:()=>T,GetCompositionListAll:()=>I,GetCompositionListAllWithId:()=>N,GetCompositionListListener:()=>co,GetCompositionListLocal:()=>R,GetCompositionListLocalWithId:()=>E,GetCompositionListWithId:()=>k,GetCompositionListWithIdUpdated:()=>A,GetCompositionListener:()=>oo,GetCompositionLocal:()=>B,GetCompositionLocalWithId:()=>G,GetCompositionWithAllIds:()=>g.Mb,GetCompositionWithCache:()=>$t,GetCompositionWithDataIdBulk:()=>qt,GetCompositionWithDataIdWithCache:()=>zt,GetCompositionWithId:()=>g.yz,GetCompositionWithIdAndDateFromMemory:()=>g.Ez,GetConceptBulk:()=>pt.r,GetConceptByCharacter:()=>m.A,GetConceptByCharacterAndCategoryLocal:()=>C.$I,GetConceptByCharacterAndType:()=>ce.A,GetConnectionBetweenTwoConceptsLinker:()=>$n,GetConnectionBulk:()=>yt.j,GetConnectionById:()=>Ye,GetConnectionDataPrefetch:()=>tt.QL,GetConnectionOfTheConcept:()=>U,GetLink:()=>ae,GetLinkListListener:()=>po,GetLinkListener:()=>so.d,GetLinkRaw:()=>le,GetLinkerConnectionFromConcepts:()=>Ee,GetLinkerConnectionToConcepts:()=>De,GetRelation:()=>tn,GetRelationLocal:()=>Gn,GetRelationRaw:()=>nn,GetTheConcept:()=>q.A,GetTheConceptLocal:()=>Sn.f,GetUserGhostId:()=>dn,JUSTDATA:()=>un.ZJ,LConcept:()=>vo,LConnection:()=>go,LISTNORMAL:()=>un.SL,LocalConceptsData:()=>v.v,LocalSyncData:()=>wo.H,LocalTransaction:()=>Fo,Logger:()=>Lo.V,LoginToBackend:()=>mt,MakeTheInstanceConcept:()=>Q.A,MakeTheInstanceConceptLocal:()=>ee.k,MakeTheTimestamp:()=>Ke,MakeTheTypeConcept:()=>Ie,MakeTheTypeConceptApi:()=>xe,MakeTheTypeConceptLocal:()=>de.$,NORMAL:()=>un.yv,PRIVATE:()=>qn,PUBLIC:()=>Qn,PatcherStructure:()=>mo,RAW:()=>un.XZ,RecursiveSearchApi:()=>ot,RecursiveSearchApiNewRawFullLinker:()=>st,RecursiveSearchApiRaw:()=>rt,RecursiveSearchApiRawFullLinker:()=>ct,RecursiveSearchApiWithInternalConnections:()=>it,RecursiveSearchListener:()=>ho,SchemaQueryListener:()=>Zo,SearchAllConcepts:()=>Pt,SearchLinkInternal:()=>Wn,SearchLinkInternalAll:()=>Un,SearchLinkMultipleAll:()=>In,SearchLinkMultipleAllObservable:()=>Kn,SearchLinkMultipleApi:()=>d,SearchQuery:()=>et,SearchStructure:()=>Io,SearchWithLinker:()=>Vt,SearchWithTypeAndLinker:()=>Cn,SearchWithTypeAndLinkerApi:()=>Yn,SessionData:()=>Co,Signin:()=>Nt,Signup:()=>wt,SignupEntity:()=>Tt,SplitStrings:()=>h.f,StatefulWidget:()=>bo,SyncData:()=>M.Y,TrashTheConcept:()=>Je,UpdateComposition:()=>Wt,UpdateCompositionLocal:()=>Ln.D,UserBinaryTree:()=>an,Validator:()=>Vo,ViewInternalData:()=>En,ViewInternalDataApi:()=>bn,WidgetTree:()=>Ko,convertFromConceptToLConcept:()=>Dn.F4,convertFromLConceptToConcept:()=>Dn.dp,createFormFieldData:()=>jo,dispatchIdEvent:()=>Ni,getFromDatabaseWithType:()=>oe,getObjectsFromIndexDb:()=>ie,handleServiceWorkerException:()=>Ai,hasActivatedSW:()=>vi,init:()=>Ci,recursiveFetch:()=>g.zN,recursiveFetchNew:()=>bt,renderLatestWidget:()=>ii,renderPage:()=>oi,renderWidget:()=>ri,searchLinkMultipleListener:()=>eo,sendMessage:()=>wi,serviceWorker:()=>di,setHasActivatedSW:()=>gi,storeToDatabase:()=>ne,subscribedListeners:()=>fi,updateAccessToken:()=>mi,uploadAttachment:()=>ht,uploadFile:()=>ft,uploadImage:()=>ut,validDocumentFormats:()=>dt,validImageFormats:()=>lt});var i=n(5020),r=n(205),c=n(9581),s=n(1863),a=n(3518),l=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function d(e){return l(this,arguments,void 0,(function*(e,t=""){let n=performance.now();var o=(0,a.ab)("application/json",t);const i=c.B.SearchLinkMultipleAllApiUrl(),r=JSON.stringify(e);try{const e=yield fetch(i,{method:"POST",headers:o,body:r});return e.ok?yield e.json():((0,s.r)(e),console.log("This is the searching multiple error",e.status),Lo.V.logWarning(n,"unknown","search","unknown",void 0,e.status,e,"SearchLinkMultipleApi",["searchQuery","token"],"unknown",void 0),[])}catch(e){console.log("This is the searching multiple error",e),Lo.V.logWarning(n,"unknown","search","unknown",void 0,500,e,"SearchLinkMultipleApi",["searchQuery","token"],"unknown",void 0),(0,s.M)(e,i)}}))}var h=n(6467),u=n(9639),f=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function p(e,t){return f(this,void 0,void 0,(function*(){try{var n=new URLSearchParams;n.append("type",e),n.append("user_id",t.toString());var o=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllConceptsByTypeUrl(),{method:"POST",headers:o,body:n});if(r.ok){const e=yield r.json();for(var i=0;i<e.length;i++)u.I.AddConcept(e[i])}else console.log("GetAllConceptsByType error",r.status),(0,s.r)(r)}catch(e){e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),(0,s.M)(e,c.B.GetAllConceptsByTypeUrl())}}))}var y=n(8642),v=n(9736),g=n(8939),m=n(2013),C=n(8064),w=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function T(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(di)try{return(yield wi("GetCompositionList",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionList sw error: ",e),Ai(e)}let i=yield(0,m.A)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.kx)(c[e].id);r.push(t)}}return r}))}function I(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=R(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 N(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(di)try{return(yield wi("GetCompositionListAllWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListAllWithId sw error: ",e),Ai(e)}let i=yield(0,C.Ay)(e),r=yield(0,m.A)(e),c=[],s=[],a=[],l=[];0!=i.id&&(s=yield v.v.GetConceptsByTypeIdAndUser(i.id,t)),0!=r.id&&(yield p(e,t),l=yield u.I.GetConceptsByTypeIdAndUser(r.id,t),c=l);for(let e=0;e<s.length;e++){let t=!1;for(let n=0;n<l.length;n++)s[e].ghostId==l[n].ghostId&&(t=!0);t||a.push(s[e])}console.log("This is the all list",a);let d=[];return d=yield function(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=[],r=n*(o-1),c=[],s=t.length;for(let t=r;t<r+n-s;t++)e[t]&&c.push(e[t].id);for(let e=0;e<t.length;e++){let n=yield G(t[e].id);i.push(n)}yield(0,y.Y)(c);for(let t=r;t<r+n-s;t++)if(e[t]){let n=yield(0,g.RW)(e[t].id);i.push(n)}return i}))}(c,a,n,o),d}))}function k(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){if(di)try{return(yield wi("GetCompositionListWithId",{compositionName:e,userId:t,inpage:n,page:o})).data}catch(e){console.error("GetCompositionListWithId sw error: ",e),Ai(e)}let i=yield(0,m.A)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.RW)(c[e].id);r.push(t)}}return r}))}function A(e,t){return w(this,arguments,void 0,(function*(e,t,n=10,o=1){let i=yield(0,m.w)(e),r=[];if(i){yield p(e,t);let c=yield u.I.GetConceptsByTypeIdAndUser(i.id,t),s=n*(o-1),a=[];for(let e=s;e<s+n;e++)c[e]&&a.push(c[e].id);yield(0,y.Y)(a);for(let e=s;e<s+n;e++)if(c[e]){let t=yield(0,g.RW)(c[e].id);r.push(t)}}return r}))}var S=n(4864),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},x=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function B(e){return x(this,void 0,void 0,(function*(){var t,n;try{if(di)try{return(yield wi("GetCompositionLocal",{id:e})).data}catch(e){console.error("GetCompositionLocal error sw: ",e),Ai(e)}let o=[],i={};o=yield S.G.GetConnectionsOfCompositionLocal(e);let r=[];for(let e=0;e<o.length;e++)r.includes(o[e].ofTheConceptId)||r.push(o[e].ofTheConceptId);let l=yield v.v.GetConcept(e);if(0==l.id){let t=yield function(e){return L(this,void 0,void 0,(function*(){let t=(0,V.o)();try{var n=(0,a.ab)("application/x-www-form-urlencoded");const o=yield fetch(c.B.GetRealConceptById(),{method:"POST",headers:n,body:`id=${e}`});if(o.ok)return t=yield o.json(),t.id>0&&u.I.AddConcept(t),t;console.log("Error in Getting Translating concept Error",o.status),(0,s.r)(o)}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,s.M)(e,c.B.GetRealConceptById())}return t}))}(e);if(t.id>0)return yield(0,g.Nj)(t.id)}let d=yield _(e,o,r);return i[null!==(n=null===(t=null==l?void 0:l.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=d,i}catch(e){throw e}}))}function G(e){return x(this,void 0,void 0,(function*(){var t,n;try{if(di)try{return(yield wi("GetCompositionLocalWithId",{id:e})).data}catch(e){console.error("GetCompositionLocalWithId error sw: ",e),Ai(e)}let o=[],i={},r={};o=yield S.G.GetConnectionsOfCompositionLocal(e);let c=[];for(let e=0;e<o.length;e++)c.includes(o[e].ofTheConceptId)||c.push(o[e].ofTheConceptId);let s=yield v.v.GetConcept(e);if(0!=s.id){let r=yield _(e,o,c);i[null!==(n=null===(t=null==s?void 0:s.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 _(e,t,n){return x(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c;let s={},a=[],l=yield v.v.GetConcept(e);if(0!=l.id&&null==l.type){let e=l.typeId,t=yield v.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 v.v.GetConcept(e);if(0!=i.id&&null==(null==i?void 0:i.type)){let e=i.typeId,t=yield v.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 _(e,t,n);s[d]=o}}else{const o=yield _(e,t,n);a[d]=o,s=a}}return s}))}var b=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function R(e,t){return b(this,void 0,void 0,(function*(){if(di)try{return(yield wi("GetCompositionListLocal",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocal error sw: ",e),Ai(e)}try{let n=yield(0,C.Ay)(e),o=[];if(0!=n.id){let e=yield v.v.GetConceptsByTypeIdAndUser(n.id,t);for(let t=0;t<e.length;t++){let n=yield B(e[t].id);o.push(n)}}return o}catch(e){throw e}}))}function E(e,t){return b(this,void 0,void 0,(function*(){if(di)try{return(yield wi("GetCompositionListLocalWithId",{compositionName:e,userId:t})).data}catch(e){console.error("GetCompositionListLocalWithId error sw: ",e),Ai(e)}try{let n=yield(0,C.Ay)(e),o=[];if(0!=n.id){let e=yield v.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}}))}var D=n(2),F=n(1218),O=n(999),W=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function U(e,t,n){return W(this,arguments,void 0,(function*(e,t,n,o=10,i=1){let r=[];try{if(di)try{return(yield wi("GetConnectionOfTheConcept",{typeId:e,ofTheConceptId:t,userId:n,inpage:o,page:i})).data}catch(e){console.error("GetConnectionOfTheConcept sw error: ",e),Ai(e)}let l=new URLSearchParams;l.append("typeId",`${e}`),l.append("ofTheConceptId",`${t}`),l.append("userId",`${n}`),l.append("inpage",`${o}`),l.append("page",`${i}`);let d=(0,a.Xr)("application/x-www-form-urlencoded");const h=yield fetch(c.B.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:d,body:l});return h.ok?r=yield h.json():((0,s.r)(h),console.log("Get connection of concept error",h.status)),r}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,s.M)(e,c.B.GetAllConnectionsOfConceptUrl())}}))}var P=n(2155),M=n(442),V=n(7282),j=n(5976),H=n(7273),$=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function J(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,s=yield j.p.getId(),a=new P.N(s,e,n,c,o,i,r);return e==n?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.toUpdate=!0,a.isTemp=!1,M.Y.AddConnection(a),a)}throw new H.z("cannot create connection because id are negative ",!1,400,"")}))}var z=n(1838),q=n(7876),Q=n(8407),X=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Y(e,t,n){return X(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;if(di)try{return(yield wi("CreateConnectionBetweenTwoConcepts",{ofTheConcept:e,toTheConcept:t,linker:n,both:o,count:i})).data}catch(e){console.error("CreateConnectionBetweenTwoConcepts sw error: ",e),Ai(e)}let s=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Z(o,t,s));let a=yield(0,Q.A)("connection",c,!1,999,999,999),l=new P.N(0,t.id,e.id,s,a.id,1e3,4);M.Y.AddConnection(l)}let a=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Z(a,e,s));let d=yield(0,Q.A)("connection",l,!1,999,999,999),h=new P.N(0,e.id,t.id,s,d.id,1e3,4);return M.Y.AddConnection(h),h}))}function Z(e,t){return X(this,arguments,void 0,(function*(e,t,n=null){var o;let i=t,r=null!=n?n:t.userId,c=e+"_count",s=(null===(o=t.type)||void 0===o?void 0:o.characterValue)+"_s_"+c,a=yield(0,Q.A)("connection",s,!1,r,4,999),l=yield U(a.id,t.id,r,10,1),d=[],h=(0,V.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,Q.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,Q.A)("count",t.toString(),!1,r,4,999);for(let e=0;e<l.length;e++)(0,z.m)(l[e].id)}let u=new P.N(0,i.id,h.id,i.userId,a.id,1e3,4);yield M.Y.AddConnection(u)}))}function K(e,t,n){return X(this,arguments,void 0,(function*(e,t,n,o=!1,i=!1){var r,c;let s=e.userId;if(o){let o=n+"_by",c=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+o;i&&(yield Z(o,t,s));let a=yield(0,Q.A)("connection",c,!1,999,999,999),l=new P.N(0,t.id,e.id,s,a.id,1e3,4);M.Y.AddConnection(l)}let a=n+"_s",l=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+a;i&&(yield Z(a,e,s));let d=yield(0,Q.A)("connection",l,!1,999,999,999);return yield J(e.id,e.userId,t.id,d.id,1e3,4)}))}var ee=n(5868),te=(n(3655),function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))});function ne(e,t){}function oe(e,t,n){return te(this,void 0,void 0,(function*(){}))}function ie(e){return te(this,void 0,void 0,(function*(){}))}var re=n(1666),ce=n(4402),se=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ae(e,t){return se(this,arguments,void 0,(function*(e,t,n=10,o=1){var i;if(performance.now(),di)try{return(yield wi("GetLink",{id:e,linker:t,inpage:n,page:o})).data}catch(e){console.error("GetLink sw error: ",e),Ai(e)}let r=[],c=yield(0,q.A)(e),s=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,a=yield(0,ce.A)(s,16);if(a.id>0){let e=yield U(a.id,c.id,c.userId,n,o),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,y.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),i=yield(0,g.Ez)(o.id);r.push(i)}}return r}))}function le(e,t){return se(this,arguments,void 0,(function*(e,t,n=10,o=1){var i;let r=[],c=yield(0,q.A)(e),s=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,a=yield(0,ce.A)(s,16);if(a.id>0){let e=yield U(a.id,c.id,c.userId,n,o),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);r.push(o)}}return r}))}var de=n(8357),he=n(2212);class ue{constructor(e,t,n,o,i,r,c,s,a,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=s,this.isNew=l}}class fe{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new ue(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}}fe.characterData=[];class pe{constructor(e,t,n,o){this.id=e,this.userId=t,this.referentId=n,this.isNew=o}}var ye=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ge(e,t,n,o,i){return ve(this,void 0,void 0,(function*(){return new ue(t,e,n,t,o,t,i,t,"",!1),yield function(){return ye(this,void 0,void 0,(function*(){var e;try{if(0==(e=fe.GetCharacter(e.data)).id){var t=(0,a.Xr)();const o=yield fetch(c.B.CreateTheCharacterDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!o.ok)throw(0,s.r)(o),new Error(`Error! status: ${o.status}`);const i=yield o.json();var n=new ue(i.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=i.id,fe.AddCharacter(n),i}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),e}}))}()}))}var me=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ce(e,t,n,o,i,r,c){return me(this,void 0,void 0,(function*(){let s=yield(0,ce.A)(e,o),a=s;return 0==a.id&&(s=yield(0,he.Ay)(e,t,n,o,i,r,c),a=s),a}))}var we=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Te=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ie(e,t,n,o){return Te(this,void 0,void 0,(function*(){if(di)try{return(yield wi("MakeTheTypeConcept",{typeString:e,sessionId:t,sessionUserId:n,userId:o})).data}catch(e){console.error("MakeTheTypeConcept sw error: ",e),Ai(e)}let i=yield(0,m.A)(e);if(i&&(0==i.id||0==i.userId)){let r=(0,h.f)(e);if(r.length>0)if(r[0]==e){let n=yield function(e,t,n,o,i,r){return we(this,void 0,void 0,(function*(){let n;if(1==e.length){let i=e.charCodeAt(0),c=49;yield ge(e,t,999,o,r),n=Ce(e,t,4,c,i,o,"the_character")}else{let i=yield ge(e,t,999,o,r);i.isNew,n=yield Ce(e,t,4,51,i.id,o,"the_characters")}return n}))}(e,o,0,999,0,t);i=n}else{let c=yield Ie(r[0],t,n,o),s=yield Ie(r[1],t,n,o);s&&(i=yield(0,he.N)(e,o,c.id,s.id,999,999,r[1]))}}return i}))}var Ne=n(8146),ke=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Ae=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Se(e){return Ae(this,void 0,void 0,(function*(){let t=(0,V.o)();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=(0,h.f)(e);if(n.length>1){let o=1,i=yield Se(n[0]);0!=i.id&&(o=i.id),t=yield function(e,t){return Ae(this,void 0,void 0,(function*(){let n=yield u.I.GetConceptByCharacterAndCategoryLocal(e,t);return 0==n.id&&(n=yield function(e,t){return ke(this,void 0,void 0,(function*(){let n=(0,V.o)();try{var o=(0,a.Xr)("application/x-www-form-urlencoded");const i=yield fetch(c.B.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:o,body:`character_value=${e}&category_id=${t}`});i.ok?(n=yield i.json(),u.I.AddConcept(n)):(console.log("This is the concept by category and character error",i.status),(0,s.r)(i))}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,s.M)(e,c.B.GetConceptByCharacterAndCategoryDirectUrl())}return n}))}(e,t)),n}))}(e,o)}else n[0]==e&&(t=yield function(e){return Ae(this,void 0,void 0,(function*(){let t=yield u.I.GetConceptByCharacterAndTypeLocal(e,51);return 0==t.id&&(t=yield(0,Ne.Y)(e)),t}))}(e));return t}))}var Le=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function xe(e,t){return Le(this,void 0,void 0,(function*(){let t=(0,V.o)();try{if(t=yield Se(e),0==t.id||4==t.typeId){let n=(0,a.Xr)("application/x-www-form-urlencoded");const o=yield fetch(c.B.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${e}`});if(!o.ok)throw(0,s.r)(o),new Error(`Error! status: ${o.status}`);t=yield o.json()}}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,s.M)(e,c.B.MakeTheTypeConceptUrl())}return t}))}var Be=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ge(e){return Be(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(r.ok){const e=yield r.json();for(var o=0;o<e.length;o++){var i=e[o];t.push(i)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),(0,s.r)(r)}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,s.M)(e,c.B.GetAllLinkerConnectionOfConceptUrl())}return t}))}var _e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function be(e){return _e(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=(0,a.Xr)("application/x-www-form-urlencoded");const r=yield fetch(c.B.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(r.ok){const e=yield r.json();for(var o=0;o<e.length;o++){var i=e[o];t.push(i)}}else console.log("Get all linker connection To the concepts error","cannot get respone"),(0,s.r)(r)}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,s.M)(e,c.B.GetAllLinkerConnectionToConceptUrl())}return t}))}var Re=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ee(e){return Re(this,void 0,void 0,(function*(){let t=yield Ge(e);for(let e=0;e<t.length;e++){let n=t[e],o=n.typeId,i=yield(0,q.A)(o);n.type=i}return t}))}function De(e){return Re(this,void 0,void 0,(function*(){let t=yield be(e);for(let e=0;e<t.length;e++){let n=t[e],o=n.typeId,i=yield(0,q.A)(o);n.type=i}return t}))}var Fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Oe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},We=n(6963),Ue=n(2202),Pe=n(5457),Me=n(991),Ve=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function je(e){return Ve(this,void 0,void 0,(function*(){if(di)try{return(yield wi("DeleteConceptById",{id:e})).data}catch(e){console.error("DeleteConceptById sw error: ",e),Ai(e)}if(e>0){var t=yield(0,q.A)(e);if(t.id>0){var n=t.typeId,o=t.characterValue;yield Pe.c.removeTypeConcept(n,e),yield We.f.removeNodeByCharacter(o,e),yield function(e){return Oe(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());let n=(0,a.BZ)();const o=yield fetch(c.B.DeleteConceptUrl(),{method:"POST",headers:n,body:t});o.ok||(console.log("Delete concept error",o.status),(0,s.r)(o))}catch(e){e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),(0,s.M)(e,c.B.DeleteConceptUrl())}}))}(e),yield Ue.W.removeNodeFromTree(e),yield Me.H.removeNodeFromTree(e)}}else v.v.RemoveConceptById(e)}))}function He(e){return Ve(this,void 0,void 0,(function*(){if(di)try{return(yield wi("DeleteUser",{id:e})).data}catch(e){console.error("DeleteUser sw error: ",e),Ai(e)}e>0?function(e){Fe(this,void 0,void 0,(function*(){try{var t=(0,a.ab)("application/json","");let n=c.B.DeleteUserUrl();n=n+"?conceptId="+e+"&apiKey=freeschema";const o=yield fetch(n,{method:"POST",headers:t});if(o.ok){let e=yield o.json(),t=Number(e.data);return console.log("this is the delete email concept",t),je(t),t}throw(0,s.r)(o),new Error(`Delete composition Error! status: ${o.status}`)}catch(e){e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),(0,s.M)(e,c.B.DeleteConceptUrl())}}))}(e):v.v.RemoveConceptById(e)}))}var $e=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Je(e,t){return $e(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(c.B.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw(0,s.r)(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,s.M)(e,c.B.DeleteConceptUrl())}}))}var ze=n(1735),qe=n(8286),Qe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Xe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Ye(e){return Xe(this,void 0,void 0,(function*(){if(performance.now(),console.log("AccessTracker activation status from GetConnectionById"),!0===ze.J.activateStatus)try{ze.J.incrementConnection(e)}catch(e){console.error("Error adding connection in access tracker"),Lo.V.log("ERROR","Error Adding Connection")}if(di)try{return(yield wi("GetConnectionById",{id:e})).data}catch(e){console.error("GetConnectionById sw error: ",e),Ai(e)}let t=yield qe.d.GetConnection(e);if((null==t||0==t.id)&&null!=e&&null!=e){let n=yield function(e){return Qe(this,void 0,void 0,(function*(){let t=yield qe.d.GetConnection(e);try{if(0!=t.id)return t;{let n=(0,a.Xr)("application/x-www-form-urlencoded");const o=new FormData;o.append("id",e.toString());const i=yield fetch(c.B.GetConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?(t=yield i.json(),qe.d.AddConnection(t)):((0,s.r)(i),console.log("Get Connection Error",i.status)),t}}catch(e){e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),(0,s.M)(e,c.B.GetConnectionUrl())}}))}(e);t=n}return t}))}var Ze=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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){if(di)try{return(yield wi("MakeTheTimestamp",{type:e,referent:t,userId:n,accessId:o,sessionInformationId:i})).data}catch(e){console.error("MakeTheTimestamp sw error: ",e),Ai(e)}let r,c="",s=e.startsWith("the_"),a=(0,V.o)();return c=s?e:"the_"+e,a=yield xe(c),r=yield Ce(t,n,4,a.id,0,o,c),r}))}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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ot(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){let o=[];try{if(di)try{return(yield wi("RecursiveSearchApi",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApi sw error: ",e),Ai(e)}let i=new et;i.composition=e,i.listLinkers=t,i.textSearch=n;let r=JSON.stringify(i),l=(0,a.Xr)();const d=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:l,body:r});if(d.ok){const e=yield d.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,o=yield(0,tt.p8)(t,n)}else console.log("recursive search error ",d.status),(0,s.r)(d)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}return o}))}function it(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){let o=[];try{if(di)try{return(yield wi("RecursiveSearchApiWithInternalConnections",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiWithInternalConnections sw error: ",e),Ai(e)}let i=new et;i.composition=e,i.listLinkers=t,i.textSearch=n;let r=JSON.stringify(i),l=(0,a.Xr)();const d=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:l,body:r});if(d.ok){const e=yield d.json();let t=e.compositionIds,n=e.internalConnections;e.externalConnections,o=yield(0,tt.km)(t,n)}else console.log("recursive search error ",d.status),(0,s.r)(d)}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}return o}))}function rt(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(di)try{return(yield wi("RecursiveSearchApiRaw",{composition:e,listLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiRaw sw error: ",e),Ai(e)}let o=new et;o.composition=e,o.listLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}function ct(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(di)try{return(yield wi("RecursiveSearchApiRawFullLinker",{composition:e,fullLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiRawFullLinker sw error: ",e),Ai(e)}let o=new et;o.composition=e,o.fullLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}function st(){return nt(this,arguments,void 0,(function*(e=0,t=[],n=""){try{if(di)try{return(yield wi("RecursiveSearchApiNewRawFullLinker",{composition:e,fullLinkers:t,textSearch:n})).data}catch(e){console.error("RecursiveSearchApiNewRawFullLinker sw error: ",e),Ai(e)}let o=new et;o.composition=e,o.fullLinkers=t,o.textSearch=n;let i=JSON.stringify(o),r=(0,a.Xr)();const l=yield fetch(c.B.RecursiveSearchUrl(),{method:"POST",headers:r,body:i});if(l.ok){const e=yield l.json();return e.compositionIds,e.internalConnections,e.externalConnections,e}return console.log("recursive search error ",l.status),(0,s.r)(l),[]}catch(e){e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),(0,s.M)(e,c.B.RecursiveSearchUrl())}}))}var at=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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 at(this,void 0,void 0,(function*(){try{console.log("File Type",e.type);const n=new FormData;let o;if(dt.includes(e.type))n.append("file",e,e.name),o=yield ft(n,t);else{if(!lt.includes(e.type))return{message:"Invalid File Format",success:!1};n.append("image",e,e.name),o=yield ut(n,t)}return(null==o?void 0:o.data)?{message:"Upload Success",success:!0,url:o.data}:{message:"File Upload Failed",success:!1}}catch(e){throw console.error(e),e}}))}function ut(e){return at(this,arguments,void 0,(function*(e,t=""){try{const n=yield fetch(c.B.uploadImageUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(null==n?void 0:n.text());const t=yield null==n?void 0:n.text();return console.error(`${n.status} ${t}`),null}return yield n.json()}catch(e){return console.error(e),null}}))}function ft(e){return at(this,arguments,void 0,(function*(e,t=""){try{const n=yield fetch(c.B.uploadFileUrl(),{method:"POST",body:e,headers:{Authorization:`Bearer ${t}`}});if(!n.ok){const e=n.headers.get("content-type");e&&e.includes("text/plain")&&console.info(n.text());const t=yield n.text();return console.error(`${n.status} ${t}`),null}return yield n.json()}catch(e){return console.error(e),null}}))}var pt=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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function mt(e,t){return gt(this,void 0,void 0,(function*(){try{let n={email:e,password:t},o=new Headers;o.append("Content-Type","application/json");let i=JSON.stringify(n);const r=yield fetch(c.B.LoginUrl(),{method:"POST",headers:o,body:i});if(r.ok){const e=yield r.json();return vt.b.BearerAccessToken=e.data.token,e}console.log("Login tsccs error message: ",r.status),(0,s.r)(r)}catch(e){e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),(0,s.M)(e,c.B.LoginUrl())}}))}var Ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function wt(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:""};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,s.r)(o),n}catch(t){console.log("Signup Error: ",t),(0,s.M)(t,e)}}))}(c.B.SignupUrl(),e);return t}))}function Tt(e){return Ct(this,void 0,void 0,(function*(){const t=c.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 It=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Nt(e){return It(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=c.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,s.r)(e),n}catch(e){console.log("Sign in api error",e),(0,s.M)(e,i)}}))}var kt=n(9934),At=n(4485);function St(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Lt(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class xt{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&&(Gt.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 Bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Gt{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 xt(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Bt(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Bt(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}}Gt.root=null;var _t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function bt(e,t,n,o){return _t(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c;let s={};const a=[];if(0==e)return"";let l=Rt(n,e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield(0,q.A)(e)),0!=l.id&&null==l.type){const e=l.typeId;let t=Rt(n,e);l.type=t,null==t&&null!=e&&null!=e&&(t=yield(0,q.A)(e),l.type=t)}if(!o.includes(e))return null==l?void 0:l.characterValue;if(i.includes(e))return"";i.push(e);for(let l=0;l<t.length;l++)if(t[l].ofTheConceptId==e){const d=t[l].toTheConceptId;if(o.includes(e)){let e=Rt(n,d);if(null!=e&&0!=e.id||null==d||null==d||(e=yield(0,q.A)(d)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield u.I.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield(0,q.A)(t),e.type=n)}const l="the_",h=(null!==(c=null===(r=null==e?void 0:e.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(l,"");if(isNaN(Number(h))){if(h){const e=yield bt(d,t,n,o,i);s[h]=e}}else{const e=yield bt(d,t,n,o,i);a[h]=e,s=a}}}return s}))}function Rt(e,t){let n=(0,V.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,V.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 bt(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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(),c.B.MQTT_CONNECTION&&c.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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((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,s=null){const a=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let h=null!=o?o:0,u=(0,V.o)();null==s&&(s=new Et);for(const o in e)if("object"==typeof e[o]||Array.isArray(e[o])){const f=yield(0,Q.A)(o,"",!0,a,l,d);if(null==t&&null==n){let t=h;u=f,t=f.id,h=f.id,s.concepts.push(f),s.id=f.id,yield Ft(e[o],f.id,f.userId,t,i,r,c,s)}else{const a=null!=t?t:999,l=null!=n?n:999,d=h;u=f,s.concepts.push(f);const p=yield(0,re.q)(a,l,f.id,d);s.connections.push(p),yield Ft(e[o],f.id,f.userId,d,i,r,c,s)}null!=e[o]&&null!=e[o]&&s.subcompositions.push(f.id)}else{const i=null!=t?t:999,r=null!=n?n:999,c=h,u=yield(0,Q.A)(o,e[o],!1,a,l,d);s.concepts.push(u);const f=yield(0,re.q)(i,r,u.id,c);s.connections.push(f)}return u}))}var Ot=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Wt(e){return Ot(this,void 0,void 0,(function*(){if(di)try{return(yield wi("UpdateComposition",{patcherStructure:e})).data}catch(e){console.error("UpdateComposition sw error: ",e),Ai(e)}const t=e.userId,n=e.sessionId,o=e.accessId;let i=[];const r=[];let c=(0,V.o)(),s=(0,V.o)();const a=[];let l=e.compositionId;const d=e.ofTheCompositionId;let h=[];if(l<0){let e=yield(0,q.A)(l,t);if(!(e.id>0))return null;l=e.id}i=yield(0,D.s)(l);const u=[],f=new Et,p=[];f.id=l,f.isUpdating();let y=[];for(let e=0;e<i.length;e++)(0,kt.A)(p,i[e].ofTheConceptId),(0,kt.A)(u,i[e].ofTheConceptId),(0,kt.A)(u,i[e].toTheConceptId),y.push(i[e].ofTheConceptId);f.subcompositions=p,f.connections=i;for(let e=0;e<u.length;e++){const t=yield(0,q.A)(u[e]);l==u[e]&&(c=t),d==u[e]&&(s=t),r.push(t)}const v=e.patchObject;for(const e in v){let i=(0,V.o)();const l=v[e];let d=c;if(s.id>0&&(d=s),Array.isArray(l)||"object"==typeof l){i=yield(0,Q.A)(e,"",!0,c.userId,4,999),f.subcompositions.push(i.id);const t=(0,At.vo)(r,i);for(let e=0;e<t.length;e++)if(t[e].id>0){const n=(0,At.wS)(f.connections,t[e].id);h=h.concat(n),a.push(t[e])}yield Ft(v[e],i.id,i.userId,c.id,c.userId,4,999,f)}else{i=yield(0,Q.A)(e,l,!1,t,o,n);const c=(0,At.vo)(r,i);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=(0,At.wS)(f.connections,c[e].id);h=h.concat(t),a.push(c[e])}}const u=(0,re.q)(d.id,d.userId,i.id,c.id);r.push(i),f.connections.push(u)}for(let e=0;e<h.length;e++)Lt(f.connections,h[e]),(0,z.m)(h[e].id);for(let e=0;e<a.length;e++)St(r,a[e]);return f.concepts=f.concepts.concat(r),f.mainConcept=c,f.id=c.id,yield f.updateCache(),Gt.addCompositionToTree(f),M.Y.SyncDataOnline(),f.GetDataCache()}))}var Ut=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Pt(e,t,n,o){return Ut(this,arguments,void 0,(function*(e,t,n,o,i=10,r=1){var l=(0,a.ab)("application/x-www-form-urlencoded",o),d=new URLSearchParams;d.append("type",e),d.append("search",t),d.append("composition",n),d.append("inpage",i.toString()),d.append("page",r.toString());const h=c.B.SearchCompositionsUrl()+"?"+d.toString();try{const e=yield fetch(h,{method:"GET",headers:l});return e.ok?yield e.json():((0,s.r)(e),[])}catch(e){console.log("This is the searching error",e),(0,s.M)(e,h)}}))}var Mt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Vt(e){return Mt(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);const o=c.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,s.r)(e),[])}catch(e){console.log("This is the searching error",e),(0,s.M)(e,o)}}))}var jt=n(7139),Ht=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function $t(e){return Ht(this,arguments,void 0,(function*(e,t=[]){var n,o;let i=[];const r=[];let c={},s={};const a=yield Gt.getNodeFromTree(e),l=[];let d=yield u.I.GetConcept(e);if(0==d.id&&null!=e&&null!=e&&(d=yield(0,jt.r)(e)),null==a){let a=[];a=t.length>0?Jt(e,t):yield(0,D.s)(e),i=a;for(let e=0;e<i.length;e++)l.includes(i[e].ofTheConceptId)||(l.push(i[e].ofTheConceptId),r.push(i[e].ofTheConceptId)),r.includes(i[e].toTheConceptId)||r.push(i[e].toTheConceptId);Qt(d,i,r,l);let h=[];s=yield(0,g.zN)(e,i,l,h),c[null!==(o=null===(n=null==d?void 0:d.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=s}else s=a.value.GetDataCache(),c=s;return 0==d.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 zt(e){return Ht(this,arguments,void 0,(function*(e,t=[]){var n,o;let i={},r=[];const c=[];let s;const a={},l=yield Gt.getNodeFromTree(e),d=[];let h=yield u.I.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield(0,jt.r)(e)),null==l){let l=[];l=t.length>0?Jt(e,t):yield(0,D.s)(e),r=l;for(let e=0;e<r.length;e++)d.includes(r[e].ofTheConceptId)||(d.push(r[e].ofTheConceptId),c.push(r[e].ofTheConceptId)),c.includes(r[e].toTheConceptId)||c.push(r[e].toTheConceptId);Qt(h,r,c,d),s=yield(0,g.zN)(e,r,d),a[null!==(o=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=s,i.created_at=h.entryTimeStamp,i.data=a,i.id=e}else s=l.value.GetDataCache(),i=s;return 0==h.id?"":i}))}function qt(e,t){return Ht(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 zt(e[t],n);i&&o.push(i)}return o}))}function Qt(e,t,n,o){return Ht(this,void 0,void 0,(function*(){const i=new Et,r=yield function(e){return Ht(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 u.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,pt.I)(n)),t}))}(n);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=o,i.mainConcept=e;const c=yield bt(e.id,t,r,o,[]);i.cached=c,Gt.addCompositionToTree(i)}))}var Xt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Yt(e){return Xt(this,void 0,void 0,(function*(){try{var t=(0,a.Xr)();const n=JSON.stringify(e),o=yield fetch(c.B.CreateSessionId(),{method:"POST",headers:t,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),(0,s.r)(o),null)}catch(e){console.log("Creating session failed",e),(0,s.M)(e,c.B.CreateSessionId())}}))}var Zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Kt(e,t){return Zt(this,void 0,void 0,(function*(){try{var n=(0,a.Xr)("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",e.toString()),o.append("url",t);const i=yield fetch(c.B.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),(0,s.r)(i),null)}catch(e){console.log("Creating session url failed",e),(0,s.M)(e,c.B.CreateSessionVisitUrl())}}))}var en=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function tn(e,t){return en(this,arguments,void 0,(function*(e,t,n=10,o=1){if(di)try{return(yield wi("GetRelation",{id:e,relation:t,inpage:n,page:o})).data}catch(e){console.error("GetRelation error sw: ",e),Ai(e)}let i=[],r=yield(0,q.A)(e),c=yield Se(t);if(c.id>0){let e=yield U(c.id,r.id,r.userId,n,o),t=[];for(let n=0;n<e.length;n++)t.push(e[n].toTheConceptId);yield(0,y.Y)(t);for(let t=0;t<e.length;t++){let n=e[t].toTheConceptId,o=yield(0,q.A)(n),r=yield(0,g.Ez)(o.id);i.push(r)}}return i}))}function nn(e,t){return en(this,arguments,void 0,(function*(e,t,n=10,o=1){if(di)try{return(yield wi("GetRelationRaw",{id:e,relation:t,inpage:n,page:o})).data}catch(e){console.error("GetRelationRaw error sw: ",e),Ai(e)}let i=[],r=yield(0,q.A)(e),c=yield Se(t);if(c.id>0){let e=yield U(c.id,r.id,r.userId,n,o),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);i.push(o)}}return i}))}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 sn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class an{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 sn(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(an.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 sn(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 sn(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}}an.root=null;var ln=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function dn(e,t){return ln(this,arguments,void 0,(function*(e,t,n=999){let o=yield an.getNodeFromTree(e,n);console.log("this is the ghost id",e,n);let 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){an.addConceptToTree(e,t,n)}))}var un=n(3130);function fn(e){return e.startsWith("the_")?e.slice(4):e}var pn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function yn(e,t,n){return pn(this,void 0,void 0,(function*(){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1;n.includes(e[h].id)&&(u=!0);let f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(1==u){if(0!=f.id&&0!=p.id){let n,s=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield(0,q.A)(e[h].typeId);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",n=f.characterValue;a.characterValue,a.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[o]={},t[e[h].ofTheConceptId]=n);let i=yield(0,q.A)(e[h].typeId);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=p.characterValue;i.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},gn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Cn(e,t){return mn(this,arguments,void 0,(function*(e,t,n=""){let o=yield Yn(e,t,n),i=o.compositionIds,r=o.internalConnections,c=o.linkers,s=o.reverse,a=o.mainCompositionIds,l=yield(0,tt.QL)(c),d=yield(0,tt.MT)(i,r);return yield kn(l,d,a,s)}))}function wn(e,t,n,o,i){return mn(this,void 0,void 0,(function*(){let r=yield(0,tt.QL)(e),c=yield(0,tt.D)(t,n);return yield kn(r,c,o,i)}))}var Tn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function In(e){return Tn(this,arguments,void 0,(function*(e,t="",n=null,o=un.y0){var i,r,c,s,a,l,h,u;try{try{if(di)return(yield wi("SearchLinkMultipleAll",{searchQuery:e,token:t,caller:n,format:o})).data}catch(e){console.error("SearchLinkMultipleAll error sw: ",e),Ai(e)}let f=[],p=[],y=[],v=[],g=e[0].composition,m={},C={};(null==n?void 0:n.isDataLoaded)?(m.compositionIds=null===(i=n.conceptIds)||void 0===i?void 0:i.slice(),m.internalConnections=null===(r=n.internalConnections)||void 0===r?void 0:r.slice(),m.linkers=null===(c=n.linkers)||void 0===c?void 0:c.slice(),m.reverse=null===(s=n.reverse)||void 0===s?void 0:s.slice(),C=m,f=C.compositionIds,y=C.internalConnections,p=C.linkers,v=C.reverse):(m=yield d(e,t),n&&(n.conceptIds=null===(a=m.compositionIds)||void 0===a?void 0:a.slice(),n.internalConnections=null===(l=m.internalConnections)||void 0===l?void 0:l.slice(),n.linkers=null===(h=m.linkers)||void 0===h?void 0:h.slice(),n.reverse=null===(u=m.reverse)||void 0===u?void 0:u.slice(),n.isDataLoaded=!0),C=m,f=C.compositionIds,y=C.internalConnections,p=C.linkers,v=C.reverse);let w=yield function(e,t,n,o,i,r){return Tn(this,arguments,void 0,(function*(e,t,n,o,i,r,c=un.y0){try{let s,a,l=yield(0,tt.QL)(e);return c==un.ZJ?(s=yield(0,tt.MT)(t,n),a=yield An(e,s,i,o)):c==un.yv?(s=yield(0,tt.D)(t,n),a=yield An(e,s,i,o)):100==c?(s=yield(0,tt.nr)(t,n),a=yield Nn(l,s,i,o)):c==un.SL?a=yield wn(e,t,n,r.ofCompositions,o):(s=yield(0,tt.rv)(t,n),a=yield Nn(l,s,i,o)),a}catch(e){return void console.log("Error Occured in build layer",e)}}))}(p,f,y,v,g,e[0],o);return w}catch(e){throw console.log("this is the error in the search link multiple",e),e}}))}function Nn(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){(new Date).getTime();let i={},r=[];for(let t=0;t<e.length;t++)r.push(e[t].toTheConceptId),r.push(e[t].ofTheConceptId),r.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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{let o=i.characterValue+"_reverse";"string"==typeof r&&(r={}),Array.isArray(r[c][o])||("string"==typeof r[c]&&(r[c]={}),r[c][o]=[]),r[c][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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{"string"==typeof r&&(r={}),Array.isArray(r[c][i.characterValue])||("string"==typeof r[c]&&(r[c]={}),r[c][i.characterValue]=[]),r[c][i.characterValue].push(t[e[n].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}function kn(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){let i=[],r=[];for(let t=0;t<e.length;t++)r.push(e[t].toTheConceptId),r.push(e[t].ofTheConceptId),r.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,q.A)(e[n].typeId),r=Object.keys(o)[0];try{let c=i.characterValue+"_reverse";"string"==typeof o&&(o={}),Array.isArray(o[r][c])||("string"==typeof o[r]&&(o[r]={}),o[r][c]=[]),o[r][c].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,q.A)(e[n].typeId),r=Object.keys(o)[0];try{"string"==typeof o&&(o={}),Array.isArray(o[r][i.characterValue])||("string"==typeof o[r]&&(o[r]={}),o[r][i.characterValue]=[]),o[r][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 An(e,t,n){return Tn(this,arguments,void 0,(function*(e,t,n,o=[]){let i={},r=yield(0,yt.j)(e),c=[];for(let e=0;e<r.length;e++)c.push(r[e].toTheConceptId),c.push(r[e].ofTheConceptId),c.push(r[e].typeId);yield(0,pt.r)(c),r.sort((function(e,t){return t.id-e.id}));for(let e=0;e<r.length;e++){let n=!1;if(o.includes(r[e].id)&&(n=!0),1==n){if(t[r[e].ofTheConceptId]&&t[r[e].toTheConceptId]){let n=t[r[e].toTheConceptId],o=yield(0,q.A)(r[e].typeId),i=n,c=Object.keys(i)[0];try{let n=o.characterValue+"_reverse";"string"==typeof i&&(i={}),Array.isArray(i[c][n])||("string"==typeof i[c]&&(i[c]={}),i[c][n]=[]),i[c][n].push(t[r[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[r[e].ofTheConceptId]&&t[r[e].toTheConceptId]){let n=t[r[e].ofTheConceptId],o=yield(0,q.A)(r[e].typeId),i=n,c=Object.keys(i)[0];try{"string"==typeof i&&(i={}),Array.isArray(i[c][o.characterValue])||("string"==typeof i[c]&&(i[c]={}),i[c][o.characterValue]=[]),i[c][o.characterValue].push(t[r[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return i=t[n],i}))}var Sn=n(1213),Ln=n(3729),xn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},Bn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Gn(e,t,n){return Bn(this,void 0,void 0,(function*(){try{if(di)try{return(yield wi("GetRelationLocal",{id:e,relation:t,userId:n})).data}catch(e){console.error("GetRelationLocal error sw: ",e),Ai(e)}let o=yield(0,C.$I)(t),i=[];0!=o.id&&(i=yield function(e,t){return xn(this,void 0,void 0,(function*(){try{return yield S.G.GetConnectionOfCompositionAndTypeLocal(t,e)}catch(e){throw e}}))}(e,o.id));let r=[];for(let e=0;e<i.length;e++){let t=yield B(i[e].toTheConceptId);r.push(t)}return r}catch(e){throw e}}))}var _n=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function bn(e){return _n(this,void 0,void 0,(function*(){let t=[];try{var n=(0,a.Xr)();const o=yield fetch(c.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,pt.r)(i),n[r]=t}return n}return console.log("View Internal Data error",o.status),(0,s.r)(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 Rn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function En(e){return Rn(this,void 0,void 0,(function*(){var t;try{let n=yield bn(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,g.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 Dn=n(176),Fn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))},On=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Wn(e){return On(this,arguments,void 0,(function*(e,t=""){try{let n=yield function(e){return Fn(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);let o=c.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,s.r)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,s.M)(e,o)}}))}(e,t);return yield En(n)}catch(e){throw e}}))}function Un(e){return On(this,arguments,void 0,(function*(e,t=""){try{return yield function(e){return Fn(this,void 0,void 0,(function*(){var t=(0,a.ab)("application/json","");let n=c.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,s.r)(e),[])}catch(e){console.log("This is the searching internal error",e),(0,s.M)(e,n)}}))}(e)}catch(e){throw e}}))}var Pn=n(8095),Mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Vn(e){return Mn(this,void 0,void 0,(function*(){if(di)try{return(yield wi("DeleteConceptLocal",{id:e})).data}catch(e){console.error("DeleteConceptLocal error sw: ",e),Ai(e)}let t=yield(0,Sn.f)(e);v.v.RemoveConcept(t)}))}var jn=n(2803),Hn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function $n(e,t,n,o){return Hn(this,arguments,void 0,(function*(e,t,n,o,i=!0){var r,c;if(di)try{return(yield wi("GetConnectionBetweenTwoConceptsLinker",{ofTheConcept:e,toTheConcept:t,linker:n,fullLinker:o,forward:i})).data}catch(e){console.error("GetConnectionBetweenTwoConceptsLinker sw error: ",e),Ai(e)}let s=(0,V.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,Q.A)("connection",o,!1,999)}""!=o&&(s=yield xe(o));let a=[];return a=i?yield(0,jn.x)(e.id,t.id,s.id):yield(0,jn.x)(t.id,e.id,s.id),a}))}function Jn(e,t){return new Promise(((n,o)=>{setTimeout((()=>{n(t)}),e)}))}const zn=3,qn=4,Qn=5;var Xn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Yn(e,t){return Xn(this,arguments,void 0,(function*(e,t,n=""){let o=c.B.SearchAllTypeWithLinker(e.auth);var i=(0,a.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,s.r)(e),console.log("This is the searching multiple error",e.status),[])}catch(e){console.log("This is the searching SearchWithTypeAndLinker error",e),(0,s.M)(e,o)}}))}var Zn=n(4287);class Kn extends Zn.w{constructor(e,t,n=un.y0){super(),this.searchQuery=[],this.format=un.y0,this.searchQuery=e,this.format=n}bind(){return e=this,t=void 0,o=function*(){return this.data=yield In(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{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}));var e,t,n,o}}function eo(e,t,n=un.y0){return new Kn(e,null!=t?t:"",n)}var to=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class no extends Zn.w{constructor(e,t=un.ZJ){super(),this.id=e,this.format=t}bind(){return to(this,void 0,void 0,(function*(){if(!this.isDataLoaded){let e=yield(0,g.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 to(this,void 0,void 0,(function*(){let e=[],t=this.internalConnections;for(let n=0;n<t.length;n++)e.push(yield qe.d.GetConnection(t[n]));return this.format==un.ZJ?(console.log("this is the data for the build layer",e,this.mainConcept,this.internalConnections,this.compositionIds),this.data=yield(0,g.ay)(this.mainConcept,e,this.compositionIds)):this.format==un.y0?this.data=yield(0,g.$V)(this.mainConcept,e,this.compositionIds):this.format==un.yv?this.data=yield(0,g.re)(this.mainConcept,e,this.compositionIds):this.data=yield(0,g.ay)(this.mainConcept,e,this.compositionIds),this.data}))}}function oo(e,t=un.ZJ){return new no(e,t)}var io=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class ro extends Zn.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 io(this,void 0,void 0,(function*(){if(!this.isDataLoaded){console.log("again data loading mechanism");var e=yield(0,m.A)(this.compositionName);if(e){yield p(this.compositionName,this.userId),console.log("getting the user data",e.id,this.userId);let o=yield u.I.GetConceptsByTypeIdAndUser(e.id,this.userId);console.log("this is the concept list",o);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,y.Y)(this.compositionIds),this.isDataLoaded=!0,this.listenToEventType(e.id);for(let e=0;e<this.compositionIds.length;e++)console.log("list listen",this.compositionIds[e]),this.listenToEvent(this.compositionIds[e])}return yield this.build()}))}build(){return io(this,void 0,void 0,(function*(){if(this.data=[],console.log("this is building the data list"),this.format==un.ZJ){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.kx)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==un.y0){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.RW)(this.compositionIds[e]);this.data.push(t)}}else if(this.format==un.yv){for(let e=this.startPage;e<this.startPage+this.inpage;e++)if(this.compositionIds[e]){let t=yield(0,g.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,g.kx)(this.compositionIds[e]);this.data.push(t)}return this.data}))}}function co(e,t,n,o,i=un.ZJ){return performance.now(),new ro(e,t,n,o,i)}var so=n(5328),ao=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class lo extends Zn.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 ao(this,void 0,void 0,(function*(){let n=yield qe.d.GetConnectionByOfTheConceptAndType(e,e);for(let e=0;e<n.length;e++)yield qe.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 ao(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 ao(this,void 0,void 0,(function*(){return this.externalConnectionIds=this.linkers,this.format&&this.format==un.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 ho(e,t,n="",o){return new lo(e,t,n,o)}var uo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class fo extends Zn.w{constructor(e,t,n,o=un.y0){super(),this.searchQuery=[],this.format=un.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 uo(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),qe.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 uo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0;var e=yield(0,m.A)(this.searchCharacter);let t=yield Yn(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 uo(this,void 0,void 0,(function*(){return yield(0,pt.r)(this.conceptIds),this.format==un.y0?this.data=yield function(e,t,n,o,i){return mn(this,void 0,void 0,(function*(){let r=yield(0,tt.QL)(e),c=yield(0,tt.rv)(t,n),s=yield function(e,t,n,o){return Tn(this,arguments,void 0,(function*(e,t,n,o,i=[]){(new Date).getTime();let r=[],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 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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{let o=i.characterValue+"_reverse";"string"==typeof r&&(r={}),Array.isArray(r[c][o])||("string"==typeof r[c]&&(r[c]={}),r[c][o]=[]),r[c][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,q.A)(e[n].typeId),r=null==o?void 0:o.data,c=Object.keys(r)[0];try{"string"==typeof r&&(r={}),Array.isArray(r[c][i.characterValue])||("string"==typeof r[c]&&(r[c]={}),r[c][i.characterValue]=[]),r[c][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&&r.push(n)}return r}))}(r,c,t,o,i);return s}))}(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse):this.data=yield wn(this.linkers,this.conceptIds,this.internalConnections,this.mainCompositionIds,this.reverse),this.data}))}}function po(e,t,n,o=un.y0){return new fo(e,t,n,o)}var yo=n(2615);class vo{constructor(e,t,n,o,i,r,s,a=!1,l,d,h){this.structureType="lconcept",this.isComposition=!1,this.isTemp=!1,this.isSynced=!1,this.applicationId=c.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=s,this.entryTimeStamp=l,this.updatedTimeStamp=d,this.isSynced=!1,this.referentId=h}getType(){console.log(this.typeId)}}class go{constructor(e,t,n,o,i,r){this.isTemp=!1,this.applicationId=c.B.getRandomizer(),this.type=(0,V.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 mo{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class Co{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 wo=n(628);class To{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class Io{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1,this.auth=!0}}var No=n(7887),ko=n(3075),Ao=n(7869),So=n(9635),Lo=n(9700);class xo{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(void 0===typeof window)return;window.onerror=(e,t,n,o,i)=>{const r={message:e,source:t,lineno:n,colno:o,stack:(null==i?void 0:i.stack)||"undefined"};Lo.V.logApplication("ERROR","Runtime Error",r)},window.onunhandledrejection=e=>{Lo.V.logApplication("ERROR","Unhandled Promise Rejection",{message:e.reason?e.reason.message:e.reason,stack:e.reason?e.reason.stack:null})}}catch(e){console.warn("Failed to initialize global error handlers:",e)}}static logCatchError(){try{const e=console.error;console.log("Inside originalConsoleError..."),console.error=function(...t){const n={arguments:t.map((e=>Bo(e)))};Lo.V.logApplication("ERROR","Console Error",n),e.apply(console,t)}}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={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?Bo(e.error.stack):void 0};Lo.V.logApplication("Error","Unhandled Error",n)}))}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={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"};Lo.V.logApplication("ERROR","Unhandled Promise Rejection",o)}))}catch(e){console.warn("Failed to add unhandled rejection event listener:",e)}}static logUserInteractions(){document.addEventListener("click",(e=>{var t;const n=e.target;n.tagName,n.id,n.className,null===(t=n.innerText)||void 0===t||t.slice(0,50)})),document.addEventListener("input",(e=>{const t=e.target;t.tagName,t.id,t.value})),document.addEventListener("scroll",(()=>{window.scrollY}))}static logNetworkRequests(){try{if(void 0===typeof window)return;const e=null===window||void 0===window?void 0:window.fetch;if(!e)throw new Error("Original fetch is not available.");const t=[c.B.PostLogger(),c.B.PostPrefetchConceptConnections()];window.fetch=(...n)=>{return o=this,i=void 0,c=function*(){const[o,i]=n,r=o instanceof Request?o.url:o instanceof URL?o.toString():o;if(t.includes(r)){console.log("Ignored URLs detected : ",r);let t={url:r,detail:"skip"};return Lo.V.logApplication("INFO","Network Request",t),e(...n)}let c={request:{type:"REQUEST",message:"Network Request",method:(null==i?void 0:i.method)||"GET",url:r,body:null==i?void 0:i.body}};try{const t=yield e(...n);return c.response={type:"RESPONSE",message:"Network Response",url:r,status:t.status},t}catch(e){throw c.response={type:"ERROR",message:"Network Request Failed",url:r,error:e instanceof Error?e.message:String(e)},Lo.V.logApplication("ERROR","Failed Network Request",c),new Error(`Network request failed for ${r}: ${e.message}`)}},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{a(c.next(e))}catch(e){t(e)}}function s(e){try{a(c.throw(e))}catch(e){t(e)}}function a(t){var o;t.done?e(t.value):(o=t.value,o instanceof r?o:new r((function(e){e(o)}))).then(n,s)}a((c=c.apply(o,i||[])).next())}));var o,i,r,c}}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;e.loadEventEnd,e.navigationStart,e.domContentLoadedEventEnd,e.navigationStart})))}static logRouteChanges(){const e=history.pushState;history.pushState=function(...t){var n;const o={url:null===(n=t[2])||void 0===n?void 0:n.toString()};return Lo.V.logApplication("INFO","Route Change",o),e.apply(this,t)},null===window||void 0===window||window.addEventListener("popstate",(()=>{const e={url:location.href};Lo.V.logApplication("INFO","Route Changed (Back/Forward)",e)}))}static logWebSocketEvents(){if(void 0===typeof window)return;const e=WebSocket;window.WebSocket=class extends e{constructor(e,t){super(e,t);const n={url:e.toString()};Lo.V.logApplication("INFO","WebSocket Open",n),this.addEventListener("message",(t=>{const n={url:e,data:t.data};Lo.V.logApplication("INFO","WebSocket Message",n)})),this.addEventListener("error",(t=>{const n={url:e,error:t instanceof Error?t.message:String(t)};Lo.V.logApplication("ERROR","WebSocket Error",n)})),this.addEventListener("close",(()=>{const t={url:e};Lo.V.logApplication("INFO","WebSocket Closed",t)}))}}}}function Bo(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"}}class Go{constructor(){this.subscribers=[]}notify(){this.subscribers.map((e=>{e(this.data)}))}dataChange(e){return this.subscribers.push(e),e(this.data)}}class _o extends Go{constructor(){super(...arguments),this.elementIdentifier=0,this.widgetMounted=!1}getComponent(){return document.getElementById(this.elementIdentifier.toString())}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 bo extends _o{constructor(){super(...arguments),this.html="",this.css="",this.js="",this.childWidgets=[],this.childWidgetElement=[],this.widgetState={},this.parentElement="",this.element=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.data=e,this.notify(),this.render()}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.after_render(),this.widgetMounted&&this.loadChildWidgets()}getElementByClassName(e){let t=this.getComponent();if(t){let n=null==t?void 0:t.querySelectorAll("."+e);return console.log("this is the element",t,n,e),n}return[]}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,0==this.widgetMounted?(this.before_render(),this.mount_child(),this.widgetMounted=!0):this.render())},new((o=void 0)||(o=Promise))((function(e,r){function c(e){try{a(i.next(e))}catch(e){r(e)}}function s(e){try{a(i.throw(e))}catch(e){r(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(c,s)}a((i=i.apply(t,n||[])).next())}));var t,n,o,i}before_render(){this.render()}after_render(){}renderChildWidgets(){var e;null===(e=this.childWidgets)||void 0===e||e.forEach((e=>{e.render()}))}setWidgetState(e,t){var n;this.widgetState[e]=t,(n=this)&&n.childWidgets.forEach((e=>{e.widgetState=Object.assign(Object.assign({},e.widgetState),n.widgetState)})),this.renderChildWidgets()}getWidgetState(e,t){return Object.keys.length&&this.widgetState[e]?this.widgetState[e]:t}}var Ro=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Eo extends bo{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 Ro(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 Ro(this,arguments,void 0,(function*(e=""){return new Promise((t=>Ro(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=[],s=new To;s.type=r,s.search="1",s.logicoperator=">",s.name="emailfilter",s.operateon="entityEmail",s.composition=!1,c.push(s);let a=new zo;a.typeConnection=e,a.name="entityEmail";let l=new zo;l.type=o,l.filterLogic="( emailfilter )",l.filters=c,l.name="top",l.inpage=100,l.freeschemaQueries=[a],l.outputFormat=un.y0,Zo(l,"").subscribe((n=>{if(null==n?void 0:n.length){const i=null==n?void 0:n.map((t=>{var n,i,c,s,a,l,d;const h=null===(s=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===s?void 0:s[r];return{id:null===(d=null===(l=null===(a=t.data)||void 0===a?void 0:a[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 Ro(this,void 0,void 0,(function*(){new Function("tsccs",`\n return (async function() {\n ${this.mountChildWidgetsFunction}\n }).call(this);\n `).bind(this)(o)}))}setProperty(e){return Ro(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");console.log("This is the input val container",n,t,e);const o=null==n?void 0:n.querySelectorAll("input");null==o||o.forEach((e=>{null==e||e.remove()})),console.log("event.target",e.target);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 s=document.createElement("input");s.setAttribute("type","text"),s.setAttribute("name","input-widgetTypeValue"),s.setAttribute("of",t.elementIdentifier.toString()),s.setAttribute("class","form-control"),s.setAttribute("id","widgetType"),t.widgetType?s.value=t.widgetType:s.setAttribute("placeholder","e.g. the_entity");let a=t;s.onchange=function(e){var t,n,o;e.preventDefault(),e.stopPropagation();const i=null===(t=null==e?void 0:e.target)||void 0===t?void 0:t.value;a.widgetType=i,a.before_render(),a.loadChildWidgets(),null===(o=null===(n=a.element)||void 0===n?void 0:n.parentElement)||void 0===o||o.setAttribute("data-type-value",a.widgetType)},null==n||n.appendChild(s)}}(e,this)}mount(e){return Ro(this,void 0,void 0,(function*(){if(e){this.element=document.createElement("div");let t=this;this.element.onclick=function(e){e.preventDefault(),e.stopPropagation(),t.createTypeEditor(e)},this.element.id=this.createWidgetWrapperIdentifier(),this.element.className="p-2 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(){new Function("tsccs",`\n return (async function() {\n ${this.componentDidMountFunction}\n }).call(this);\n `).bind(this)(o)}after_render(){new Function("tsccs",`\n return (async function() {\n ${this.addEventFunction}\n }).call(this);\n `).bind(this)(o)}CreateConnectionBetweenEntityLocal(e,t,n){return Ro(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,de.$)(r,999,999,i);return yield(0,rn.F)(e.id,t.id,c.id,1e3),"connection created"}))}}var Do=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Fo{constructor(){this.actions={concepts:[],connections:[]},this.success=!0,this.transactionId=Math.random().toString().substring(5)}initialize(){return Do(this,void 0,void 0,(function*(){yield wo.H.initializeTransaction(this.transactionId)}))}commitTransaction(){return Do(this,void 0,void 0,(function*(){if(!this.success)throw Error("Query Transaction Expired");yield wo.H.SyncDataOnline(this.transactionId),this.actions={concepts:[],connections:[]},this.success=!1}))}rollbackTransaction(){return Do(this,void 0,void 0,(function*(){this.success=!1,this.actions={concepts:[],connections:[]},yield wo.H.rollbackTransaction(this.transactionId,this.actions)}))}markAction(){return Do(this,void 0,void 0,(function*(){yield wo.H.markTransactionActions(this.transactionId,this.actions)}))}MakeTheInstanceConceptLocal(e,t){return Do(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 s=yield(0,ee.k)(e,t,n,o,i,r,c,this.actions);return yield this.markAction(),s}catch(e){throw console.log(e),this.success=!1,e}}))}MakeTheTypeConceptLocal(e,t,n,o){return Do(this,void 0,void 0,(function*(){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,de.$)(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 Do(this,arguments,void 0,(function*(e,t,n,o=!1){try{if(!this.success)throw Error("Query Transaction Expired");const i=yield(0,Pn.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 Do(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 Do(this,arguments,void 0,(function*(e,t=null,n=null,o=null,i=null,r=null,c=null,s=!1){try{if(!this.success)throw Error("Query Transaction Expired");const a=yield(0,O.R)(e,t,n,o,i,r,c,s,this.actions);return yield this.markAction(),a}catch(e){throw console.log(e),this.success=!1,e}}))}}const Oo={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 Wo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Uo{constructor(){Uo.cacheInitialized||Uo.initializeAnomalyParameters()}static initializeAnomalyParameters(){return Wo(this,void 0,void 0,(function*(){try{yield Uo.getAnomalyParameters(),Uo.refreshCache(),Uo.cacheInitialized=!0}catch(e){console.error("Error during anomaly parameter initialization:",e)}}))}static getAnomalyParameters(){return Wo(this,void 0,void 0,(function*(){const e=Date.now();if(Uo.anomalyParamsCache&&e-Uo.lastFetchedTime<Uo.cacheExpiryThreshold)return console.log("Returning cached anomaly parameters"),Uo.anomalyParamsCache;try{return yield Uo.fetchAnomalyParameters()}catch(e){throw console.error("Error fetching anomaly parameters:",e),e}}))}static fetchAnomalyParameters(){return Wo(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 Uo.anomalyParamsCache=t.data,Uo.lastFetchedTime=Date.now(),t.data}catch(e){throw console.error("API Fetch Error:",e),e}}))}static refreshCache(){return Wo(this,void 0,void 0,(function*(){try{Date.now()-Uo.lastFetchedTime>Uo.cacheExpiryThreshold&&(yield Uo.getAnomalyParameters())}catch(e){console.error("Error refreshing anomaly parameters cache:",e)}}))}detectDataType(e){for(const[t,n]of Object.entries(Oo))if(n.test(e))return t;return null}checkConceptAnomaly(e,t){return Wo(this,void 0,void 0,(function*(){const n=[];try{if(!t)return n.push("Null value"),{valid:!1,warnings:n};const o=Uo.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:s,data_types:a}=i,l=r>=c&&r<=s,d=this.detectDataType(t),h=a.includes(d);return l||n.push(`Length of '${t}' is outside the allowed range (min: ${c}, max: ${s}). Current length: ${r}.`),h||n.push(`Type mismatch for '${t}'. Expected types: ${a.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 Wo(this,void 0,void 0,(function*(){Uo.cacheInitialized||(yield Uo.initializeAnomalyParameters());try{const t={};for(const[n,o]of Object.entries(e)){const e=o.value,{valid:i,warnings:r}=yield(new Uo).checkConceptAnomaly(n,e);t[n]={valid:i,warnings:r}}return t}catch(e){throw console.error("Bulk Anomaly Check Error:",e),e}}))}static getExportedFunction(){return console.log("Main : ",o),Object.keys(o),[]}}function Po(e,t){if(e){const n={message:e.message||"Unknown function error",stack:e.stack||"No stack trace",context:t||"No context provided"};Lo.V.log("ERROR","Function Error",n)}}Uo.anomalyParamsCache=null,Uo.cacheInitialized=!1,Uo.lastFetchedTime=0,Uo.cacheExpiryThreshold=6e5;var Mo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Vo{checkUniqueness(e,t){return Mo(this,void 0,void 0,(function*(){e.startsWith("the_")||(e="the_"+e);let n=(yield xe(e)).id,o=yield(0,ce.A)(t,n);return console.log("This is the concept for validator",o),!(o.id>0)}))}validateField(e,t,n,o,i,r,c,s,a,l,d,h,u){return Mo(this,arguments,void 0,(function*(e,t,n,o,i,r,c,s,a,l,d,h,u,f=!1){var p;try{performance.now();const e={};if(!u||null!==o&&""!==o||(e.required="This is required field"),n&&o){let t=Oo[n];t&&""!==o&&!t.test(o)&&(e.dataType=`Invalid value for ${n}`)}if(i&&o){const t="string"==typeof i?new RegExp(i):i;""===o||t.test(o)||(e.pattern="Pattern doesn't match with value")}if(o&&null!==c&&o.length>c&&(e.maxLength=`Length exceeds the maximum length of ${c}`),o&&null!==s&&o.length<s&&(e.minLength=`Length must be at least ${s} characters long`),null!==a&&o&&!isNaN(Number(o))&&Number(o)<a&&(e.minValue=`Value must be greater than or equal to ${a}`),null!==l&&o&&!isNaN(Number(o))&&Number(o)>l&&(e.maxValue=`Value must be less than or equal to ${l}`),h&&t&&d){const t=d.split(",").map((e=>e.trim().toLowerCase())),n=null===(p=h.name.split(".").pop())||void 0===p?void 0:p.toLowerCase();n&&!t.includes(n)&&(e.accept=`File must be a valid file type: ${t.join(", ")}`)}return r&&f&&o&&((yield this.checkUniqueness(r,o))||(e.unique="Value is not unique")),e}catch(e){throw console.error("Error on validate field.."),Po(e,"Validation Field Error"),e}}))}validateForm(e){return Mo(this,void 0,void 0,(function*(){try{performance.now();const t={};for(const n in e){const{value:o,fieldType:i,dataType:r,pattern:c,conceptType:s,maxLength:a=null,minLength:l=null,minValue:d=null,maxValue:h=null,accept:u=null,file:f=null,required:p,isUnique:y}=e[n],v=yield this.validateField(n,i,r,o,c,s,a,l,d,h,u,f,p,y);Object.keys(v).length>0&&(t[n]=v)}return t}catch(e){throw Po(e,""),e}}))}validate(e,t,n,o,i,r,c,s,a,l,d,h,u,f=!1){let p={};return this.validateField(e,t,n,o,i,r,c,s,a,l,d,h,u,f).then((e=>{Object.keys(e).length>0?(p.status=!1,p.details=e):p.status=!0})),console.error("Error on validate object"),p}}const jo=e=>{var t;const n=document.getElementsByName(e)[0];if(!n)return console.warn(`Element with NAME "${e}" not found.`),{value:null,fieldType: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{value:n.value,fieldType:n.type,dataType:n.getAttribute("data-type"),pattern:n.getAttribute("data-pattern"),conceptType:n.getAttribute("concept-type"),maxLength:n.getAttribute("data-maxlength")?parseInt(n.getAttribute("data-maxlength")):null,minLength:n.getAttribute("data-minlength")?parseInt(n.getAttribute("data-minlength")):null,minValue:n.getAttribute("data-min")?parseInt(n.getAttribute("data-min")):null,maxValue:n.getAttribute("data-max")?parseInt(n.getAttribute("data-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 Ho=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function $o(e,t){return Ho(this,void 0,void 0,(function*(){if(di)try{return(yield wi("DeleteConnectionByType",{id:e,linker:t})).data}catch(e){console.error("DeleteConnectionByType sw error: ",e),Ai(e)}let n=yield Ge(e);for(let e=0;e<n.length;e++)qe.d.AddConnection(n[e]);let o=yield qe.d.GetConnectionsOfConcept(e),i=yield(0,m.A)(t),r=[];for(let e=0;e<o.length;e++)o[e].typeId==i.id&&r.push(o[e]);for(let e=0;e<r.length;e++)(0,z.m)(r[e].id)}))}function Jo(e,t){return Ho(this,arguments,void 0,(function*(e,t,n=!1){if(di)try{return(yield wi("GetAllTheConnectionsByTypeAndOfTheConcept",{id:e,linker:t,reverse:n})).data}catch(e){console.error("GetAllTheConnectionsByTypeAndOfTheConcept sw error: ",e),Ai(e)}let o=[];if(n){let n=yield be(e),i=yield xe(t);for(let e=0;e<n.length;e++)n[e].typeId==i.id&&o.push(n[e])}else{let n=yield Ge(e);for(let e=0;e<n.length;e++)qe.d.AddConnection(n[e]);let i=yield qe.d.GetConnectionsOfConcept(e),r=yield(0,m.A)(t);for(let e=0;e<i.length;e++)i[e].typeId==r.id&&o.push(i[e])}return o}))}class zo{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.outputFormat=un.yv,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}var qo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function Qo(e){return qo(this,arguments,void 0,(function*(e,t=""){var n=(0,a.ab)("application/json",t);const o=c.B.FreeschemaQueryUrl(),i=JSON.stringify(e);try{const e=yield fetch(o,{method:"POST",headers:n,body:i});return e.ok?yield e.json():((0,s.r)(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),(0,s.M)(e,o)}}))}var Xo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};class Yo extends Zn.w{constructor(e,t){super(),this.mainCompositionIds=[],this.query=new zo,this.query=e,this.format=e.outputFormat}bind(){return Xo(this,void 0,void 0,(function*(){if(!this.isDataLoaded){this.isDataLoaded=!0,this.query.outputFormat=un.BG;let e=yield Qo(this.query,"");this.conceptIds=e.conceptIds,this.internalConnections=e.internalConnections,this.linkers=e.linkers,this.reverse=e.reverse,this.mainCompositionIds=e.mainCompositionIds}return yield this.build()}))}build(){return Xo(this,void 0,void 0,(function*(){return this.format==un.y0?this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield function(e,t){return gn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",n=f.characterValue;(s.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=p.characterValue;o.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o),i=yield function(e,t){return gn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=s.characterValue;""==o&&(o=e,o=fn(o));let i={id:f.id,data:{[e]:t}},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=o.characterValue,c=!1;""==r&&(r=e,r=fn(r),c=!0);let s={id:p.id,data:{[e]:t}};isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=s):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o),console.log("this is the composition data",i);let r=yield function(e,t,n,o){return gn(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c,s,a,l,d;(new Date).getTime();let h=[],u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.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,h=yield(0,q.A)(e[n].ofTheConceptId),u=yield(0,q.A)(e[n].toTheConceptId);if(i.includes(e[n].id)&&(o=!0),1==o){if(0!=h.id&&0!=u.id&&u.id in t){let o,i=yield(0,q.A)(e[n].typeId),s=null!==(c=null===(r=u.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[s]&&(o[s]={})):(o={},o[s]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let r={id:h.id,data:t[e[n].ofTheConceptId]},c=i.characterValue+"_reverse";Array.isArray(o[s][c])?o[s][c].push(r):c.includes("_s_")?(o[s][c]=[],o[s][c].push(r)):o[s][c]=r}}catch(e){console.log("this is error",e)}}}else if(0!=h.id&&0!=u.id&&h.id in t){let o,i=yield(0,q.A)(e[n].typeId),r=null!==(a=null===(s=h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self",c=!1;e[n].toTheConceptId in t&&(c=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[r]&&(o[r]={})):(o={},o[r]={},t[e[n].ofTheConceptId]=o);let f=!0,p=i.characterValue;""==p&&(p=u.characterValue,f=!0),""==p&&(p=null===(l=null==u?void 0:u.type)||void 0===l?void 0:l.characterValue);try{null===(d=null==u?void 0:u.type)||void 0===d||d.characterValue;let c=t[e[n].toTheConceptId];if(c){let s={id:u.id,data:t[e[n].toTheConceptId]};Array.isArray(o[r])?o[r].push(c):Array.isArray(o[r][p])?o[r][i.characterValue].push(s):p.includes("_s_")?(o[r][p]=[],o[r][p].push(s)):o[r][p]=s}}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let n={};n.id=o[e],n.data=t[o[e]],h.push(n)}return h}))}(t,i,[],n,o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse):this.format==un.ZJ?this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield yn(t,i,o),i=yield function(e,t){return vn(this,arguments,void 0,(function*(e,t,n=[]){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1,f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(n.includes(e[h].id)&&(u=!0),1==u){if(0!=f.id&&0!=p.id){let n,s=yield(0,q.A)(e[h].typeId),a=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=s.characterValue;""==o&&(o=e,o=fn(o));let i={id:f.id,[e]:t},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=yield(0,q.A)(e[h].typeId),i=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=o.characterValue,c=!1;""==r&&(r=e,r=fn(r),c=!0);let s={};s[e]={id:p.id,data:t},isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=c?s[e]:s):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o);let r=yield function(e,t,n){return vn(this,arguments,void 0,(function*(e,t,n,o=[]){var i,r,c,s,a,l,d;(new Date).getTime();let h=[],u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let h=!1,u=yield(0,q.A)(e[n].ofTheConceptId),f=yield(0,q.A)(e[n].toTheConceptId);if(o.includes(e[n].id)&&(h=!0),1==h){if(0!=u.id&&0!=f.id&&f.id in t){let o,c=yield(0,q.A)(e[n].typeId),s=null!==(r=null===(i=f.type)||void 0===i?void 0:i.characterValue)&&void 0!==r?r:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[s]&&(o[s]={})):(o={},o[s]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let i=t[e[n].ofTheConceptId];i&&(i.id=u.id);let r=c.characterValue+"_reverse";Array.isArray(o[s][r])?o[s][r].push(i):r.includes("_s_")?(o[s][r]=[],o[s][r].push(i)):o[s][r]=i}}catch(e){console.log("this is error",e)}}}else if(0!=u.id&&0!=f.id&&u.id in t){let o,i=yield(0,q.A)(e[n].typeId),r=null!==(s=null===(c=u.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self",h=!1;e[n].toTheConceptId in t&&(h=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[r]&&(o[r]={})):(o={},o[r]={},t[e[n].ofTheConceptId]=o);let p=!1,y=i.characterValue;""==y&&(y=f.characterValue,p=!0),""==y&&(y=null===(a=null==f?void 0:f.type)||void 0===a?void 0:a.characterValue);try{let i=null!==(d=null===(l=null==f?void 0:f.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",c=t[e[n].toTheConceptId];if(c){let e={};e[i]={data:c[i],id:f.id},Array.isArray(o[r])?p?o[r].push(c[y]):o[r].push(c):Array.isArray(o[r][y])?o[r][y].push(e):y.includes("_s_")?(o[r][y]=[],p?o[r][y].push(e[i]):o[r][y].push(e)):o[r][y]=p?e[i]:e}}catch(e){console.log("this is error",e)}}}console.log("this is the main compositions",n);for(let e=0;e<n.length;e++){let o={};console.log("this is the main compositions DATA",t[n[e]]),o=t[n[e]],o&&(o.id=n[e]),h.push(o)}return h}))}(t,i,n,o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse):this.data=yield function(e,t,n,o){return mn(this,void 0,void 0,(function*(){let t=yield(0,tt.QL)(e),i=[];i=yield yn(t,i,o),i=yield function(e,t,n){return pn(this,void 0,void 0,(function*(){var o,i,r,c,s,a,l,d;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let u=!1;n.includes(e[h].id)&&(u=!0);let f=yield(0,q.A)(e[h].ofTheConceptId),p=yield(0,q.A)(e[h].toTheConceptId);if(1==u){if(0!=f.id&&0!=p.id){let n,s=null!==(i=null===(o=p.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield(0,q.A)(e[h].typeId);try{let e=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",t=f.characterValue,o=a.characterValue;""==o&&(o=e,o=fn(o));let i={[e]:t},l=o+"_reverse";a.characterValue.includes("_s_")||("string"==typeof n[s]&&(n[s]={}),n[s][l]=i)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},t[e[h].ofTheConceptId]=n);let i=yield(0,q.A)(e[h].typeId);try{let e=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=p.characterValue,r=i.characterValue,c=(i.characterValue,!1);""==r&&(r=e,r=fn(r),c=!0);let s={[e]:t};isNaN(Number(r))?i.characterValue.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][r]=c?t:s):n[o]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o);let r=yield function(e,t,n,o){return pn(this,arguments,void 0,(function*(e,t,n,o,i=[]){var r,c,s,a,l;let d=[],h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.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;i.includes(e[n].id)&&(o=!0);let d=yield(0,q.A)(e[n].ofTheConceptId),h=yield(0,q.A)(e[n].toTheConceptId);if(1==o){if(0!=d.id&&0!=h.id&&h.id in t){let o,i=null!==(c=null===(r=h.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";e[n].toTheConceptId in t?o=t[e[n].toTheConceptId]:(o={},o[i]={},t[e[n].toTheConceptId]=o);let s=yield(0,q.A)(e[n].typeId);try{let r=s.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(o[i][r])?o[i][r].push(c):s.characterValue.includes("_s_")?(o[i][r]=[],o[i][r].push(c)):o[i][r]=c)}catch(e){console.log("this is error",e)}}}else if(0!=d.id&&0!=h.id&&d.id in t){let o,i=null!==(a=null===(s=d.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[i]&&(o[i]={})):(o={},o[i]={},t[e[n].ofTheConceptId]=o);let r=!1,c=(yield(0,q.A)(e[n].typeId)).characterValue;""==c&&(c=h.characterValue,r=!0),""==c&&(c=null===(l=null==h?void 0:h.type)||void 0===l?void 0:l.characterValue);try{let s=t[e[n].toTheConceptId];s&&(Array.isArray(o[i])?r?(console.log("this is the data",s,e[n].toTheConceptId),o[i].push(s[c])):o[i].push(s):Array.isArray(o[i][c])?o[i][c].push(s):c.includes("_s_")?(o[i][c]=[],r?o[i][c].push(s[c]):o[i][c].push(s)):o[i][c]=r?s[c]:s)}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],d.push(o))}return d}))}(t,i,n,[],o);return r}))}(this.linkers,this.conceptIds,this.mainCompositionIds,this.reverse),this.data}))}}function Zo(e,t){return new Yo(e,t)}class Ko{constructor(){this.id=0,this.name="",this.html="",this.css="",this.js="",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 Eo}}var ei=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function ti(e,t,n){return ei(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,de.$)(r,999,999,i);console.log(yield(0,rn.F)(e.id,t.id,c.id,1e3))}))}var ni=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};function oi(e,t,n){return ni(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 ri(i[0].id,t,n))}))}function ii(e,t,n){return ni(this,void 0,void 0,(function*(){var o;const i=yield tn(e,"the_widget_latest");if(0==(null==i?void 0:i.length))yield ri(e,t,n);else{const e=null===(o=null==i?void 0:i[0])||void 0===o?void 0:o.id;e&&(yield ri(e,t,n))}}))}function ri(e,t,n){return ni(this,void 0,void 0,(function*(){try{const o=yield ci(e),i=t,r=yield si(o,i,void 0,n),c=document.createElement("style");c.innerHTML=o.css+r.css,i.appendChild(c);const s=document.createElement("script");s.innerHTML=o.js,i.appendChild(s),i.querySelectorAll(".wb-initial-empty").forEach((e=>{e.classList.remove("wb-initial-empty")})),document.querySelectorAll('[onclick="widgetSelected(event)"]').forEach((e=>{e.removeAttribute("onclick")}))}catch(e){console.error("Error Caught Rendering Widget")}}))}function ci(e){return ni(this,arguments,void 0,(function*(e,t=[],n=""){var o,i,r,c,s,a,l,d,h,u,f,p,y,v,g,m,C,w,T,I,N,k,A,S,L,x,B,G,_,b,R,E,D,F,O,W,U,P,M,V,j,H,$,J,z,q,Q,X,Y,Z,K,ee,te,ne,oe,ie,re,ce,se,ae,le;try{const de=new Ko,he=yield function(e,t){return ni(this,void 0,void 0,(function*(){try{const n=new et;n.composition=e,n.fullLinkers=["the_widget","the_widget_widget","the_widget_name","the_widget_html","the_widget_css","the_widget_js","the_widget_timestamp","the_widget_type","the_widget_after_render","the_widget_before_render","the_widget_update","the_widget_mount_child","the_widget_clean","the_widget_s_child","the_widget_version","the_widget_origin"],n.inpage=100;const o=new et;o.fullLinkers=["the_child_widget","the_child_widget_type","the_child_widget_parent","the_child_widget_wrapper","the_child_widget_info"],o.inpage=100;const i=[n,o],r=yield In(i,t);return console.log("getWidgetCodeFromId output ->",r),r}catch(e){throw console.error("error",e),e}}))}(e,n);t.push(e);const ue=null===(o=null==he?void 0:he.data)||void 0===o?void 0:o.the_widget;de.name=null===(c=null===(r=null===(i=null==ue?void 0:ue.the_widget_name)||void 0===i?void 0:i[0])||void 0===r?void 0:r.data)||void 0===c?void 0:c.the_name,de.html=null===(l=null===(a=null===(s=null==ue?void 0:ue.the_widget_html)||void 0===s?void 0:s[0])||void 0===a?void 0:a.data)||void 0===l?void 0:l.the_html,de.css=null===(u=null===(h=null===(d=null==ue?void 0:ue.the_widget_css)||void 0===d?void 0:d[0])||void 0===h?void 0:h.data)||void 0===u?void 0:u.the_css,de.js=null===(y=null===(p=null===(f=null==ue?void 0:ue.the_widget_js)||void 0===f?void 0:f[0])||void 0===p?void 0:p.data)||void 0===y?void 0:y.the_js,de.origin=Number(null===(m=null===(g=null===(v=null==ue?void 0:ue.the_widget_origin)||void 0===v?void 0:v[0])||void 0===g?void 0:g.data)||void 0===m?void 0:m.the_originid),de.version=null===(T=null===(w=null===(C=null==ue?void 0:ue.the_widget_version)||void 0===C?void 0:C[0])||void 0===w?void 0:w.data)||void 0===T?void 0:T.the_version,de.clean=null===(k=null===(N=null===(I=null==ue?void 0:ue.the_widget_clean)||void 0===I?void 0:I[0])||void 0===N?void 0:N.data)||void 0===k?void 0:k.the_clean,de.timestamp=null===(L=null===(S=null===(A=null==ue?void 0:ue.the_widget_timestamp)||void 0===A?void 0:A[0])||void 0===S?void 0:S.data)||void 0===L?void 0:L.the_timestamp,de.id=he.id;const fe=null===(G=null===(B=null===(x=null==ue?void 0:ue.the_widget_type)||void 0===x?void 0:x[0])||void 0===B?void 0:B.data)||void 0===G?void 0:G.the_type;de.type="null"==fe||null==fe?"the_element_name":fe,de.after_render=null===(R=null===(b=null===(_=null==ue?void 0:ue.the_widget_after_render)||void 0===_?void 0:_[0])||void 0===b?void 0:b.data)||void 0===R?void 0:R.the_after_render,de.before_render=null===(F=null===(D=null===(E=null==ue?void 0:ue.the_widget_before_render)||void 0===E?void 0:E[0])||void 0===D?void 0:D.data)||void 0===F?void 0:F.the_before_render,de.update=null===(U=null===(W=null===(O=null==ue?void 0:ue.the_widget_update)||void 0===O?void 0:O[0])||void 0===W?void 0:W.data)||void 0===U?void 0:U.the_update,de.widgetId=e,de.mount_child=null===(V=null===(M=null===(P=null==ue?void 0:ue.the_widget_mount_child)||void 0===P?void 0:P[0])||void 0===M?void 0:M.data)||void 0===V?void 0:V.the_mount_child;const pe=null==ue?void 0:ue.the_widget_s_child;if(null==pe?void 0:pe.length)for(let e=0;e<pe.length;e++){const o=(null===(J=null===($=null===(H=null===(j=pe[e])||void 0===j?void 0:j.data.the_child_widget)||void 0===H?void 0:H.the_child_widget_info)||void 0===$?void 0:$[0])||void 0===J?void 0:J.id)||(null===(Y=null===(X=null===(Q=null===(q=null===(z=pe[e])||void 0===z?void 0:z.data.the_child_widget)||void 0===q?void 0:q.the_child_widget_parent)||void 0===Q?void 0:Q[0])||void 0===X?void 0:X.data)||void 0===Y?void 0:Y.the_parent),i=yield ci(o,t,n),r=null===(oe=null===(ne=null===(te=null===(ee=null===(K=null===(Z=pe[e])||void 0===Z?void 0:Z.data)||void 0===K?void 0:K.the_child_widget)||void 0===ee?void 0:ee.the_child_widget_type)||void 0===te?void 0:te[0])||void 0===ne?void 0:ne.data)||void 0===oe?void 0:oe.the_type,c=null===(le=null===(ae=null===(se=null===(ce=null===(re=null===(ie=pe[e])||void 0===ie?void 0:ie.data)||void 0===re?void 0:re.the_child_widget)||void 0===ce?void 0:ce.the_child_widget_wrapper)||void 0===se?void 0:se[0])||void 0===ae?void 0:ae.data)||void 0===le?void 0:le.the_wrapper;i.type="null"==r||null==r?"the_element_name":r,i.wrapper=c,de.children.push(i)}return de}catch(e){throw console.error("error",e),e}}))}function si(e,t){return ni(this,arguments,void 0,(function*(e,t,n=!0,o){var i,r;const c=new Eo;c.html=e.html,c.widgetType=e.type,c.componentDidMountFunction=e.before_render,c.addEventFunction=e.after_render,c.mountChildWidgetsFunction=e.mount_child,o&&(c.data=o),t.innerHTML="";const s=t;if(s&&(yield c.mount(s),e.widget=c,e.children.length>0&&(null===(i=c.childWidgetElement)||void 0===i?void 0:i.length)>0))for(let t=0;t<(null===(r=e.children)||void 0===r?void 0:r.length);t++){const n=e.children[t];for(let e=0;e<c.childWidgetElement.length;e++){const t=c.childWidgetElement[e];if(n.id===Number(t.getAttribute("data-widgetid"))&&n.wrapper===t.id){const e=((a=n).html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bwidget_container\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwidget_container\b/g,"").trim())),a.html=a.html.replace(/<[^>]*\bdraggable=["'][^"']*\btrue\b[^"']*["'][^>]*>/g,(e=>e.replace(/\btrue\b/g,"false").trim())),a.html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bhover-element\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bhover-element\b/g,"").trim())),a.html=a.html.replace(/<[^>]*\bclass=["'][^"']*\bwb-block\b[^"']*["'][^>]*>/g,(e=>e.replace(/\bwb-block\b/g,"").trim())),a.html=a.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())),a.html=a.html.replace(/<[^>]*\bondragstart=["'][^"']*\b_dragService\.onWidgetDragStart\(event\)\b[^"']*["'][^>]*>/g,(e=>e.replace(/\b_dragService\.onWidgetDragStart\(event\)\b/g,"").trim())),a);n.html=`<div id="${n.wrapper}">${n.html}</div>`;const o=yield si(e,t,!1);c.childWidgets.push(o),c.css=c.css+`#${n.wrapper} { ${n.css} }`,o.dataChange((e=>{var t;console.log("This is the data change in child",e);const n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue;n&&(c.childrenData[n]=e),console.log("new child data",c.childrenData)}))}}}var a;return console.log("newWidget ->",c),yield li(t,".mftsccs-marking-element"),yield li(t,".widget_container"),c}))}function ai(e,t){return ni(this,void 0,void 0,(function*(){return e.querySelectorAll(t).forEach((e=>{for(;e.firstChild;)e.parentNode.insertBefore(e.firstChild,e);e.remove()})),e}))}function li(e,t){return ni(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 ai(e.firstChild,t);n.insertBefore(o,e)}n.removeChild(e)}}}))}var di,hi=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const ui=Date.now().toString(36)+Math.random().toString(36).substring(2);let fi=[],pi=!1,yi=[],vi=!1;function gi(e){vi=e}function mi(e=""){vt.b.BearerAccessToken=e,di&&wi("updateAccessToken",{accessToken:e})}function Ci(){return hi(this,arguments,void 0,(function*(e="",t="",n="",o="",i=!0,s="",a=void 0,l={}){try{c.B.BASE_URL=e,c.B.AI_URL=t,c.B.NODE_URL=o,c.B.BASE_APPLICATION=s,vt.b.BearerAccessToken=n;let d=Math.floor(1e8*Math.random());c.B.setRandomizer(d);const h={logApplication:!1,logPackage:!1,accessTracker:!1,isTest:!1};if(c.B.FLAGS=h,c.B.FLAGS=Object.assign(Object.assign({},h),l),function(e){try{return e.logApplication&&(xo.initialize(),Lo.V.logApplicationActivationStatus=!0,console.warn("Application log started.")),e.logPackage&&(Lo.V.logPackageActivationStatus=!0,console.warn("Package log started.")),e.accessTracker&&(ze.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),e}catch(e){throw console.error("Failed to initialize flags:",e),e}}(c.B.FLAGS),!("serviceWorker"in navigator))return yield Ii(),void console.warn("Service Worker not supported in this browser.");if(function(){navigator.serviceWorker.addEventListener("message",(e=>hi(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(){So.x.addEventListener("message",(e=>hi(this,void 0,void 0,(function*(){const{type:t,payload:n}=e.data;if(!t)return;let o={success:!1,data:void 0};Ti[t]?yield Ti[t](n):console.warn(`Unable to handle "${t}" case in BC service worker`)}))))}(),a&&a.activate&&a.manual)yield new Promise(((r,c)=>{navigator.serviceWorker.ready.then((c=>hi(this,void 0,void 0,(function*(){console.log("registraions ready",c),di=c.active,yield wi("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),r("done")})))).catch((e=>{console.error("Error: Ready service worker",e),c(e)})).finally((()=>console.log("Finally service worker ready done"))),setTimeout((()=>c("Timeout ready")),3e4)}));else if(a&&(null==a?void 0:a.activate))try{console.log("service worker initialiing"),yield new Promise(((r,c)=>{var d,h;let u=!1;navigator.serviceWorker.register(null!==(d=a.pathToSW)&&void 0!==d?d:"./serviceWorker.bundle.js",{scope:null!==(h=a.scope)&&void 0!==h?h:"/"}).then((a=>hi(this,void 0,void 0,(function*(){console.log("Service Worker registered:",a),console.log("update listen start"),a.onupdatefound=()=>{const c=a.installing;console.log("new worker",c),c&&(c.onstatechange=()=>hi(this,void 0,void 0,(function*(){console.warn("on state change triggered",c.state,navigator.serviceWorker.controller),"installing"===c.state&&(console.log("Service Worker installing"),di=void 0,pi=!1),"activated"!==c.state&&"redundant"!==c.state||!navigator.serviceWorker.controller||(console.log("New Service Worker is active",a),di=c,console.log("This is a flag after sw init : ",l),setTimeout((()=>{console.log("Message Processed after some time"),ki()}),5e3),yield wi("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),u=!0,pi=!0,ki(),r())})))},a.addEventListener("controllerchange",(()=>hi(this,void 0,void 0,(function*(){console.warn("controller change triggered",navigator.serviceWorker.controller),navigator.serviceWorker.controller&&(di=navigator.serviceWorker.controller,console.warn("Service worker has been activated; controller change"),yield wi("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}))})))),(a.installing||a.waiting||a.active)&&a.addEventListener("statechange",(r=>hi(this,void 0,void 0,(function*(){var c;"activating"===(null===(c=null==r?void 0:r.target)||void 0===c?void 0:c.state)&&(di=navigator.serviceWorker.controller,console.warn("Service Worker is activating statechange"),yield wi("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}))})))),a.active?(pi=!0,console.log("active sw"),di=a.active,yield wi("init",{url:e,aiurl:t,accessToken:n,nodeUrl:o,enableAi:i,applicationName:s,flags:l}),ki(),r()):setTimeout((()=>{u||c("Not Completed Initialization")}),1e4)})))).catch((e=>hi(this,void 0,void 0,(function*(){yield Ii(),c(e),console.error("Service Worker registration failed:",e)}))))}))}catch(e){yield Ii(),console.error("Unable to start service worker",e)}else yield Ii(),console.warn("Service Worker not activated");return!0}catch(e){yield Ii(),console.warn("Cannot initialize the system",e)}}))}function wi(e,t){return hi(this,void 0,void 0,(function*(){const n=Math.random().toString(36).substring(2);t.messageId=n,t.TABID=ui;const o=JSON.parse(JSON.stringify(t));return new Promise(((i,r)=>{if((!navigator.serviceWorker.controller&&!di||!pi&&"init"!=e)&&console.log("will go to queue",navigator.serviceWorker.controller,di,pi,"init"==e),!navigator.serviceWorker.controller&&!di||!pi&&"init"!=e)yi.push({message:{type:e,payload:o}}),console.log("Message Queued",e,t),console.log(navigator.serviceWorker.controller||di,pi||"init"==e),"init"==e&&i(null);else{const c=o=>{var a,l,d,h,u,f;(null===(a=null==o?void 0:o.data)||void 0===a?void 0:a.messageId)==n&&(o.data.success||(401==(null===(l=null==o?void 0:o.data)||void 0===l?void 0:l.status)?r((0,s.r)(new Response("Unauthorized",{status:401,statusText:null===(d=null==o?void 0:o.data)||void 0===d?void 0:d.statusText}))):500==(null===(h=null==o?void 0:o.data)||void 0===h?void 0:h.status)?r((0,s.M)(new Response("Internal Server Error",{status:500,statusText:null===(u=null==o?void 0:o.data)||void 0===u?void 0:u.statusText}))):(console.error("Error in the response from worker:",o),r(`Failed to handle action ${e} ${JSON.stringify(t)}, Response: ${JSON.stringify(o.data)}`))),(null===(f=o.data)||void 0===f?void 0:f.actions)&&(t.actions=JSON.parse(JSON.stringify(o.data.actions))),i(o.data),navigator.serviceWorker.removeEventListener("message",c))};if(navigator.serviceWorker.addEventListener("message",c),navigator.serviceWorker.controller)navigator.serviceWorker.controller.postMessage({type:e,payload:o});else if(di){console.warn(`controller not found but serviceWorker is available. messageId: ${n}, type: ${e}`),pi&&console.warn("service worker was registered already but navigator is empty!!!",di);try{di.postMessage({type:e,payload:o})}catch(t){console.log("Retrying again on catch service worker",t),di.postMessage({type:e,payload:o})}}else console.warn(`Service Worker hasn't loaded yet. messageId: ${n}, type: ${e}`),pi&&console.warn("service worker was registered already but is not available NOW!!!"),console.info("ready",navigator.serviceWorker.ready),setTimeout((()=>{console.warn(`Re-Trying after certain time. messageId: ${n}, type: ${e}`),di?(console.info("This is triggered "),null==di||di.postMessage({type:e,payload:t})):(console.log("not ready",e),r("Service worker not ready"))}),3e4);setTimeout((()=>{r(`No response from service worker after timeout: ${e}`),navigator.serviceWorker.removeEventListener("message",c)}),21e4)}}))}))}const Ti={GetLinkListener:e=>hi(void 0,void 0,void 0,(function*(){const t=fi.find((t=>t.listenerId==e.listenerId));return null==t||t.callback(e.data),{success:!0}})),dispatchEvent:e=>hi(void 0,void 0,void 0,(function*(){if(di){let t=new Event(e.id||"");dispatchEvent(t)}return{success:!0}})),checkInit:e=>hi(void 0,void 0,void 0,(function*(){return console.log("service worker init 0"),navigator.serviceWorker.controller&&(console.log("service worker init 1"),di=navigator.serviceWorker.controller),yield wi("init",{url:c.B.BASE_URL,aiurl:c.B.AI_URL,accessToken:vt.b.BearerAccessToken,nodeUrl:c.B.NODE_URL,enableAi:!1,applicationName:c.B.BASE_APPLICATION,flags:c.B.FLAGS}),{success:!0}}))};function Ii(){return hi(this,void 0,void 0,(function*(){yield(0,Ao.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,ko.Ay)().then((()=>{let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})).catch((e=>{throw e})),yield(0,No.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,ko.xd)().catch((e=>{throw console.log("This is the error in populating binary tree"),e})),yield(0,No.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 Ni(e,t={}){if(di||null!=typeof window){let n=new CustomEvent(`${e}`,t);dispatchEvent(n)}else So.x.postMessage({type:"dispatchEvent",payload:{id:e}})}function ki(){return hi(this,void 0,void 0,(function*(){for(;yi.length>0;){const{message:e,resolve:t,reject:n}=yi.shift();yield wi(e.type,e.payload)}}))}const Ai=e=>{if(e instanceof H.z)throw console.error("FreeSchemaResponse Error",e),e;console.error("Service Worker Error",e)}}},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(6366),i=n(9635),r=n(205),c=n(3278),s=n(5020),a=n(7887),l=n(7869),d=n(3075),h=n(2803),u=n(7139),f=n(5284),p=n(8939),y=n(6687),v=n(2013),g=n(1213),m=n(5328),C=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const w={GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,u.r)(e.id)}})),GetTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetTheConcept)(e.id,e.userId)}})),GetConceptBulk:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptBulk)(e.passedConcepts)}})),GetLink:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetLink)(e.id,e.linker,e.inpage,e.page)}})),GetRelation:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetRelation)(e.id,e.relation,e.inpage,e.page)}})),GetRelationRaw:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetRelationRaw)(e.id,e.relation,e.inpage,e.page)}})),GetComposition:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.Nj)(e.id)}})),GetCompositionList:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionList)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionListWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetCompositionById:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.hL)(e.id)}})),GetCompositionWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.yz)(e.id)}})),GetCompositionListAllWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListAllWithId)(e.compositionName,e.userId,e.inpage,e.page)}})),GetConceptByCharacter:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacter)(e.characterValue)}})),GetConceptByCharacterUpdated:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,v.w)(e.characterValue)}})),GetConceptByCharacterAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacterAndType)(e.characterValue,e.typeId)}})),GetCompositionFromConnectionsWithDataId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.p8)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdIndex:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.Nt)(e.conceptIds,e.connectionIds)}})),GetCompositionConnectionsBetweenTwoConcepts:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,h.x)(e.ofConceptId,e.toConcept,e.mainKey)}})),GetConnectionDataPrefetch:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.QL)(e.connectionIds)}})),GetCompositionWithIdFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.RW)(e.id)}})),GetCompositionWithIdAndDateFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.Ez)(e.id)}})),GetCompositionFromMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.kx)(e.id)}})),GetCompositionFromMemoryNormal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.XI)(e.id)}})),GetCompositionWithIdFromMemoryNew:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.$N)(e.id)}})),FindConnectionsOfCompositionsBulkInMemory:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,f.B)(e.composition_ids)}})),GetAllTheConnectionsByTypeAndOfTheConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetAllTheConnectionsByTypeAndOfTheConcept)(e.id,e.linker,e.reverse)}})),GetCompositionFromMemoryWithConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,p.JA)(e.id,e.connectionList)}})),GetCompositionFromConnectionsWithIndexFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.hG)(e.conceptIds,e.connectionIds)}})),GetCompositionFromConnectionsWithDataIdFromConnections:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,y.km)(e.conceptIds,e.connectionIds)}})),GetTheConceptLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,g.f)(e.id)}})),GetCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionLocal)(e.id)}})),GetCompositionLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionLocalWithId)(e.id)}})),GetCompositionListLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListLocal)(e.compositionName,e.userId)}})),GetCompositionListLocalWithId:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetCompositionListLocalWithId)(e.compositionName,e.userId)}})),GetConceptByCharacterAndCategoryLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConceptByCharacterAndCategoryLocal)(e.character)}})),ConceptsData__AddConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.AddConcept(e.concept)}})),ConceptsData__GetConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.GetConcept(e.id)}})),ConceptsData__GetConceptsByTypeIdAndUser:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConceptsData.GetConceptsByTypeIdAndUser(e.typeId,e.userId)}})),ConnectionData__GetConnectionByOfTheConceptAndType:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionByOfTheConceptAndType(e.ofTheConceptId,e.typeId)}})),ConnectionData__GetConnection:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnection(e.id)}})),ConnectionData__GetConnectionsOfCompositionLocal:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionsOfCompositionLocal(e.id)}})),ConnectionData__GetConnectionsOfConcept:e=>C(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.ConnectionData.GetConnectionsOfConcept(e.id)}})),GetLinkListener:e=>C(void 0,void 0,void 0,(function*(){let t=!1;return new Promise(((n,o)=>{(0,m.d)(e.id,e.linker,e.inpage,e.page,e.format).subscribe((o=>{var r,c;t?(console.log("isSubscribed",t),n({success:!0,data:o}),t=!0):(console.log("is not isSubscribed",t),i.x.postMessage({type:"GetLinkListener",payload:{id:null===(r=null==e?void 0:e.listener)||void 0===r?void 0:r.listenerId,listenerId:null===(c=null==e?void 0:e.listener)||void 0===c?void 0:c.listenerId,data:o}}))})).catch((e=>{console.log("Error : ",e),o("Error Occured")}))}))}))};var T=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const I={SearchLinkMultipleAll:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.SearchLinkMultipleAll)(e.searchQuery,e.token,e.caller,e.format)}})),RecursiveSearchApi:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApi)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiWithInternalConnections:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiWithInternalConnections)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRaw:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiRaw)(e.composition,e.listLinkers,e.textSearch)}})),RecursiveSearchApiRawFullLinker:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}})),RecursiveSearchApiNewRawFullLinker:e=>T(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.RecursiveSearchApiNewRawFullLinker)(e.composition,e.fullLinkers,e.textSearch)}}))};var N=n(1218),k=n(3077),A=n(9975),S=n(5868),L=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const x={MakeTheInstanceConcept:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheInstanceConcept)(e.type,e.referent,e.composition,e.userId,e.passedAccessId,e.passedSessionId,e.referentId)}})),MakeTheConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,A.A)(e.referent,e.typeCharacter,e.userId,e.categoryId,e.typeId,e.actions)}})),MakeTheTypeConcept:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTypeConcept)(e.typeString,e.sessionId,e.sessionUserId,e.userId)}})),MakeTheTimestamp:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTimestamp)(e.type,e.referent,e.userId,e.accessId,e.sessionInformationId)}})),CreateTheComposition:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,N.A)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId)}})),MakeTheInstanceConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,S.k)(e.type,e.referent,e.composition,e.userId,e.accessId,e.sessionInformationId,e.referentId,e.actions),actions:e.actions}})),MakeTheTypeConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.MakeTheTypeConceptLocal)(e.typeString,e.sessionId,e.sessionUserId,e.userId,e.actions),actions:e.actions}})),CreateTheConceptLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,k.A)(e.referent,e.typecharacter,e.userId,e.categoryId,e.typeId,e.accessId,e.isComposition,e.referentId,e.actions),actions:e.actions}})),CreateTheCompositionLocal:e=>L(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateTheCompositionLocal)(e.json,e.ofTheConceptId,e.ofTheConceptUserId,e.mainKey,e.userId,e.accessId,e.sessionInformationId,e.automaticSync,e.actions),actions:e.actions}}))};var B=n(3729),G=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const _={UpdateComposition:e=>G(void 0,void 0,void 0,(function*(){return yield(0,o.UpdateComposition)(e.patcherStructure),{success:!0}})),UpdateCompositionLocal:e=>G(void 0,void 0,void 0,(function*(){return yield(0,B.D)(e.patcherStructure,e.actions),{success:!0}}))};var b=n(8095),R=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const E={GetConnectionById:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionById)(e.id)}})),GetConnectionBulk:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionBulk)(e.connectionIds)}})),GetConnectionOfTheConcept:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionOfTheConcept)(e.typeId,e.ofTheConceptId,e.userId,e.inpage,e.page)}})),GetAllConnectionsOfCompositionBulk:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetAllConnectionsOfCompositionBulk)(e.composition_ids)}})),GetConnectionBetweenTwoConceptsLinker:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.GetConnectionBetweenTwoConceptsLinker)(e.ofTheConcept,e.toTheConcept,e.linker,e.fullLinker,e.forward)}})),CreateConnectionBetweenTwoConcepts:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateConnectionBetweenTwoConcepts)(e.ofTheConcept,e.toTheConcept,e.linker,e.both)}})),CreateConnectionBetweenTwoConceptsLocal:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,b.h)(e.ofTheConcept,e.toTheConcept,e.linker,e.both,e.actions),actions:e.actions}})),CreateTheConnectionLocal:e=>R(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.CreateTheConnectionLocal)(e.ofTheConceptId,e.toTheConceptId,e.typeId,e.orderId,e.typeString,e.userId,e.actions),actions:e.actions}}))};var D=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const F={DeleteConceptById:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConceptById)(e.id)}})),DeleteConnectionById:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConnectionById)(e.id)}})),DeleteUser:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteUser)(e.id)}})),DeleteConnectionByType:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConnectionByType)(e.id,e.linker)}})),DeleteConceptLocal:e=>D(void 0,void 0,void 0,(function*(){return{success:!0,data:yield(0,o.DeleteConceptLocal)(e.id)}}))};var O=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};const W={SyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.SyncData.SyncDataOnline()}})),LocalSyncData__SyncDataOnline:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.SyncDataOnline(e.transactionId)}})),LocalSyncData__initializeTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.initializeTransaction(e.transactionId)}})),LocalSyncData__markTransactionActions:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.markTransactionActions(e.transactionId,e.actions),actions:e.actions}})),LocalSyncData__rollbackTransaction:e=>O(void 0,void 0,void 0,(function*(){return{success:!0,data:yield o.LocalSyncData.rollbackTransaction(e.transactionId,e.actions),actions:e.actions}}))};var U=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{a(o.next(e))}catch(e){r(e)}}function s(e){try{a(o.throw(e))}catch(e){r(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((o=o.apply(e,t||[])).next())}))};let P=new Map,M=!1,V=!1;self.addEventListener("install",(e=>{console.log("Service Worker installing... sw"),e.waitUntil(self.skipWaiting())})),self.addEventListener("activate",(e=>U(void 0,void 0,void 0,(function*(){yield(0,o.setHasActivatedSW)(!0),console.log("Service Worker activating... sw"),e.waitUntil(new Promise(((e,t)=>{try{self.clients.claim(),console.log("claimed"),H(),e(void 0)}catch(e){console.error("Error during service worker activation:",e),t(e)}})))})))),self.addEventListener("fetch",(e=>{e.clientId||e.respondWith($(e))}));const j=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({init:e=>U(void 0,void 0,void 0,(function*(){return M?(console.warn("Already Initialized"),{success:!0,name:"init"}):(M=!0,console.log("Payload log in service worker : ",e),yield function(){return U(this,arguments,void 0,(function*(e="",t="",n="",i="",h=!0,u="",f){var p,y;o.BaseUrl.BASE_URL=e,o.BaseUrl.AI_URL=t,o.BaseUrl.NODE_URL=i,o.BaseUrl.BASE_APPLICATION=u,c.b.BearerAccessToken=n;let v=Math.floor(1e8*Math.random());if(console.log("Flags came in init of service worker is ",f),o.BaseUrl.setRandomizer(v),o.BaseUrl.FLAGS=f,null===(p=o.BaseUrl.FLAGS)||void 0===p?void 0:p.isTest)return 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,!0;console.log("This is the base url",o.BaseUrl.BASE_URL,v),console.log("service worker BaseUrl.FLAGS is ",o.BaseUrl.FLAGS),(null===(y=o.BaseUrl.FLAGS)||void 0===y?void 0:y.accessTracker)&&(console.log("From service worker, flag of Access Tracker."),o.AccessTracker.activateStatus=!0,console.log("Access Tracker Activation status from service worker",o.AccessTracker.activateStatus)),yield(0,l.A)();const g=(new Date).getTime();yield(0,s.A)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare concept data is ",e)})).catch((e=>{throw e})),yield(0,d.Ay)().then((()=>{let e=(new Date).getTime()-g;console.log("The time taken to prepare local concept ",e)})).catch((e=>{throw e})),yield(0,a.p)().then((()=>{r.B.isLocalConnectionLoaded=!0})).catch((e=>{throw e})),yield(0,d.xd)(),yield(0,a.a)().then((()=>{r.B.isConnectionLoaded=!0,r.B.isConnectionTypeLoaded=!0;let e=(new Date).getTime()-g;console.log("The time taken to prepare connections ",e)})).catch((e=>{throw e}))}))}(null==e?void 0:e.url,null==e?void 0:e.aiurl,null==e?void 0:e.accessToken,null==e?void 0:e.nodeUrl,null==e?void 0:e.enableAi,null==e?void 0:e.applicationName,null==e?void 0:e.flags),{success:!0,data:void 0,name:"init"})})),updateAccessToken:e=>U(void 0,void 0,void 0,(function*(){return yield(0,o.updateAccessToken)(e.accessToken),{success:!0,name:"updateAccessToken"}}))},w),I),x),_),E),F),W);self.addEventListener("message",(e=>U(void 0,void 0,void 0,(function*(){var t,n;let i={success:!1,data:void 0};const{type:r,payload:c}=e.data,s=c.TABID;let a=!1;try{if(!r||!c.TABID)return;"init"==r||H()||(console.warn("Message received before sw initialization",r),yield new Promise((e=>{const t=setInterval((()=>{console.log("Interval check 0",M),M?(console.log("Interval check 2",M),clearInterval(t),e(void 0)):console.warn("Watring for init 1:",r)}),200);setTimeout((()=>{console.warn("Tried waiting for init but couldn't complete in time: ",r),clearInterval(t),e(void 0)}),9e4)})),console.log("After timeout promise",M),M||e.source.postMessage(i)),P.has(s)||P.set(s,{concepts:[],connections:[]});let l=P.get(s);if(Array.isArray(null===(t=null==c?void 0:c.actions)||void 0===t?void 0:t.concepts)&&Array.isArray(null===(n=null==c?void 0:c.actions)||void 0===n?void 0:n.connections)||(c.actions={concepts:[],connections:[]},a=!0),"LocalSyncData__SyncDataOnline"==r&&!c.transactionId&&l){const e=o.LocalSyncData.SyncDataOnline(void 0,JSON.parse(JSON.stringify(l)));P.delete(s),l=void 0,console.log("Syncing the tab here",r),i={success:!0,data:yield e,actions:{concepts:[],connections:[]}}}else j[r]?i=yield j[r](c):console.warn(`Unable to handle "${r}" case in service worker`);if(i.messageId=c.messageId,V&&console.warn("Race condition has been met",r),V=!0,l=P.get(s),i.actions&&l){let e={concepts:[...l.concepts,...i.actions.concepts],connections:[...l.connections,...i.actions.connections]};const[t,n]=yield Promise.all([Promise.all(Array.from(new Map(e.concepts.map((e=>[`${e.id}-${e.ghostId}`,e]))).values())),Promise.all(Array.from(new Map(e.connections.map((e=>[`${e.id}-${e.ghostId}`,e]))).values()))]);P.set(s,JSON.parse(JSON.stringify({concepts:t,connections:n})))}V=!1,a&&delete i.actions,e.source.postMessage(i)}catch(t){console.error("Service worker Message Handle Error: ",r,t),401!=(null==t?void 0:t.status)&&500!=(null==t?void 0:t.status)||(i={success:!1,data:{status:t.status,statusText:null==t?void 0:t.url},messageId:c.messageId}),e.source.postMessage(i)}}))));const H=()=>!!M||(i.x.postMessage({type:"checkInit",payload:{}}),console.log("Message posted to broadcastChannel"),!1),$=e=>U(void 0,void 0,void 0,(function*(){try{const t=yield fetch(e.request);if(401===t.status){const n=Math.random().toString(36).substring(2);return e.waitUntil(e.source.postMessage({type:"API_401",messageId:n,message:"Unauthorized",payload:{method:e.request.method,url:e.request.url,headers:Array.from(e.request.headers.entries()),body:yield e.request.clone().json()}})),yield new Promise((e=>{console.log("Re resolving 401",t.url),setTimeout((()=>e(t)),6e4),navigator.serviceWorker.addEventListener("message",(o=>{var i,r,c;o.data&&(null===(i=o.data)||void 0===i?void 0:i.messageId)==n&&"API_RESPONSE"===(null===(r=o.data)||void 0===r?void 0:r.type)&&((null===(c=null==o?void 0:o.data)||void 0===c?void 0:c.response)?e(o.data.response):(console.log("Unable to resolve re 401",t.url),e(t)))}))}))}return t}catch(e){throw console.error("Error occured during 401 intercepting",e),e}}));