mftsccs-node 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1 +1 @@
1
- (()=>{"use strict";var t={d:(e,n)=>{for(var o in n)t.o(n,o)&&!t.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:n[o]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{AddGhostConcept:()=>uo,AddGhostConnection:()=>ho,BaseUrl:()=>w,BinaryTree:()=>f,Composition:()=>Dn,CompositionBinaryTree:()=>Un,CompositionNode:()=>Gn,Concept:()=>y,ConceptsData:()=>m,Connection:()=>G,ConnectionData:()=>O,CreateComposition:()=>ee,CreateConnectionBetweenTwoConcepts:()=>xe,CreateConnectionBetweenTwoConceptsGeneral:()=>Se,CreateDefaultConcept:()=>v,CreateDefaultLConcept:()=>wt,CreateSession:()=>Yn,CreateSessionVisit:()=>to,CreateTheCompositionLocal:()=>he,CreateTheCompositionWithCache:()=>En,CreateTheConnection:()=>bt,CreateTheConnectionGeneral:()=>pe,CreateTheConnectionLocal:()=>oe,DeleteConceptById:()=>en,DeleteConnectionById:()=>we,FilterSearch:()=>Go,FormatFromConnections:()=>po,FreeSchemaResponse:()=>x,GetAllConnectionsOfComposition:()=>q,GetAllConnectionsOfCompositionBulk:()=>J,GetComposition:()=>Z,GetCompositionBulk:()=>un,GetCompositionBulkWithDataId:()=>hn,GetCompositionFromConnectionsWithDataId:()=>fn,GetCompositionFromConnectionsWithDataIdInObject:()=>yn,GetCompositionList:()=>ht,GetCompositionListLocal:()=>Bt,GetCompositionListLocalWithId:()=>Pt,GetCompositionListWithId:()=>ft,GetCompositionLocal:()=>St,GetCompositionLocalWithId:()=>Lt,GetCompositionWithAllIds:()=>tt,GetCompositionWithCache:()=>Jn,GetCompositionWithDataIdBulk:()=>zn,GetCompositionWithDataIdWithCache:()=>Qn,GetCompositionWithId:()=>it,GetConceptBulk:()=>V,GetConceptByCharacter:()=>dt,GetConnectionBulk:()=>ln,GetConnectionById:()=>Ce,GetConnectionOfTheConcept:()=>ye,GetLink:()=>Ge,GetLinkRaw:()=>_e,GetLinkerConnectionFromConcepts:()=>Xe,GetLinkerConnectionToConcepts:()=>Ye,GetRelation:()=>no,GetRelationRaw:()=>oo,GetTheConcept:()=>Ie,GetUserGhostConnectionId:()=>lo,GetUserGhostId:()=>so,HandleHttpError:()=>R,LConcept:()=>Tt,LConnection:()=>ne,LoginToBackend:()=>Nn,MakeTheInstanceConcept:()=>Zt,MakeTheInstanceConceptLocal:()=>de,MakeTheTimestamp:()=>cn,MakeTheTypeConcept:()=>Me,MakeTheTypeConceptApi:()=>Ke,PatcherStructure:()=>So,RecursiveSearchApi:()=>pn,SearchAllConcepts:()=>Mn,SearchLinkInternal:()=>Ro,SearchLinkMultipleAll:()=>vo,SearchQuery:()=>an,SearchStructure:()=>_o,SearchWithLinker:()=>jn,SessionData:()=>Lo,Signin:()=>wn,Signup:()=>Cn,SplitStrings:()=>T,SyncData:()=>Vt,TrashTheConcept:()=>on,UpdateComposition:()=>bn,UpdateCompositionLocal:()=>To,UserBinaryTree:()=>co,ViewInternalData:()=>Io,convertFromLConceptToConcept:()=>No,getFromDatabaseWithType:()=>r,getFromDatabaseWithTypeOld:()=>c,init:()=>Eo,recursiveFetch:()=>rt,recursiveFetchNew:()=>Bn,storeToDatabase:()=>i,updateAccessToken:()=>Oo});class n{constructor(t){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=t}}var o=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function i(t,e){}function r(t,e,n){return o(this,void 0,void 0,(function*(){}))}function c(t){return o(this,void 0,void 0,(function*(){}))}function a(t){return o(this,void 0,void 0,(function*(){}))}class s{}s.isTypeLoaded=!1,s.isCharacterLoaded=!1,s.isDataLoaded=!1,s.isLocalDataLoaded=!1,s.isLocalCharacterLoaded=!1,s.isLocalTypeLoaded=!1,s.isConnectionLoaded=!1,s.isConnectionTypeLoaded=!1,s.isLocalConnectionLoaded=!1;class l{constructor(t,e,n,o){this.variants=[],this.height=1,this.key=t,this.value=e,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(t,e){return null==e?e=t:(t.value.typeId!=e.value.typeId&&(e.currentNode=this.addCurrentNode(t,e.currentNode)),e)}addCurrentNodeType(t,e){if(null==e)return t;var n=!1;for(let o=0;o<e.variants.length;o++)e.variants[o].value.id==t.value.id&&(n=!0);return n||e.variants.push(t),e}addNode(t,e,n){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addNode(t,o,n);else{if(!(e.key<t.key))return e;e.rightNode=this.addNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}return e}addCharacterNode(t,e,n){if(""!=t.value.characterValue){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addCharacterNode(t,o,n);else{if(!(e.key<t.key))return e.key==t.key&&""!=e.key&&e.value.id!=t.value.id&&e.addCurrentNodeType(t,e),e;e.rightNode=this.addCharacterNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}}return e}addTypeNode(t,e,n){if(0!=t.value.typeId){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addTypeNode(t,o,n);else{if(!(e.key<t.key))return e.key==t.key&&0!=e.key&&e.value.id!=t.value.id&&e.addCurrentNodeType(t,e),e;e.rightNode=this.addTypeNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}}return e}rightRotate(t){if(t){let e=t.leftNode;if(e){let n=e.rightNode;return t.leftNode=n,e.rightNode=t,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,e}}return t}leftRotate(t){if(t){let e=t.rightNode;if(e){let n=e.leftNode;return e.leftNode=t,t.rightNode=n,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(t.rightNode))+1,e}}return t}getHeight(t){return t?t.height:0}getBalanceFactor(t){return null==t?0:this.getHeight(t.leftNode)-this.getHeight(t.rightNode)}getFromNode(t,e){return e?t==e.key?e:t<e.key?this.getFromNode(t,e.leftNode):t>e.key?this.getFromNode(t,e.rightNode):e:e}getCharacterFromNode(t,e){return e?t==e.key?e:t<e.key?this.getCharacterFromNode(t,e.leftNode):t>e.key?this.getCharacterFromNode(t,e.rightNode):e:e}getCharacterFromNodeUpdated(t,e){var n;return e?t==e.key||51==(null===(n=e.value)||void 0===n?void 0:n.typeId)?e:t<e.key?this.getCharacterFromNode(t,e.leftNode):t>e.key?this.getCharacterFromNode(t,e.rightNode):e:e}getFromNodeWithCharacterAndType(t,e,n){if(t=`${t}`,n){if(t==n.key){if(t==n.value.characterValue&&e==n.value.typeId)return n;for(let t=0;t<n.variants.length;t++)if(n.variants[t].value.typeId==e)return n.variants[t]}else{if(t<n.key)return this.getFromNodeWithCharacterAndType(t,e,n.leftNode);if(t>n.key)return this.getFromNodeWithCharacterAndType(t,e,n.rightNode)}return null}return n}getFromNodeWithCharacterAndCategory(t,e,n){if(t=`${t}`,n){if(t==n.key){if(t==n.value.characterValue&&e==n.value.categoryId)return n;for(let t=0;t<n.variants.length;t++)if(n.variants[t].value.categoryId==e)return n.variants[t]}else{if(t<n.key)return this.getFromNodeWithCharacterAndCategory(t,e,n.leftNode);if(t>n.key)return this.getFromNodeWithCharacterAndCategory(t,e,n.rightNode)}return null}return n}removeNode(t,e){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNode(t.leftNode,e),t;if(t.key<e)return t.rightNode=this.removeNode(t.rightNode,e),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var n=this.inOrderSuccessor(t.rightNode);return t.value=n.value,t.key=n.key,t.variants=n.variants,t.currentNode=n.currentNode,t.rightNode=this.removeNode(t.rightNode,n.key),t}removeNodeWithVariants(t,e,n){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNodeWithVariants(t.leftNode,e,n),t;if(t.key<e)return t.rightNode=this.removeNodeWithVariants(t.rightNode,e,n),t;if(t.variants.length>0)if(t.value.id==n){var o=t.variants[0];if(o)return t.value=o.value,t.key=o.key,t.currentNode=o.currentNode,t.variants.splice(0,1),t}else for(let e=0;e<t.variants.length;e++)if(n==t.variants[e].value.id)return t.variants.splice(e,1),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var i=this.inOrderSuccessor(t.rightNode);return t.value=i.value,t.key=i.key,t.variants=i.variants,t.currentNode=i.currentNode,t.rightNode=this.removeNodeWithVariants(t.rightNode,i.key,n),t}countNodeBelow(t){return null==t?0:1+this.countNodeBelow(t.leftNode)+this.countNodeBelow(t.rightNode)}inOrderSuccessor(t){for(;null!=t.leftNode;)t=t.leftNode;return t}}var d=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class u{static waitForDataToLoad(){return d(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isCharacterLoaded)return t("done");setTimeout(u.checkFlag,1e3,t)}static addNodeToTree(t){return d(this,void 0,void 0,(function*(){return null==this.characterRoot?(this.characterRoot=t,this.characterRoot):(this.characterRoot=this.characterRoot.addCharacterNode(t,this.characterRoot,this.characterRoot.height),this.characterRoot)}))}static removeNodeByCharacter(t,e){return d(this,void 0,void 0,(function*(){this.characterRoot&&this.characterRoot.removeNodeWithVariants(this.characterRoot,t,e)}))}static countNumberOfNodes(){return this.characterRoot?this.characterRoot.countNodeBelow(this.characterRoot):0}static addConceptToTree(t){if(""!=t.characterValue){var e=new l(t.characterValue,t,null,null);this.addNodeToTree(e)}}static getNodeFromTree(t){return this.characterRoot?this.characterRoot.getCharacterFromNode(t,this.characterRoot):this.characterRoot}static getNodeFromTreeUpdated(t){return this.characterRoot?this.characterRoot.getCharacterFromNode(t,this.characterRoot):this.characterRoot}static getCharacterAndTypeFromTree(t,e){return d(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(t,e,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(t,e){return d(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndCategory(t,e,this.characterRoot):this.characterRoot}))}static removeConceptCharacter(t){this.characterRoot&&(this.characterRoot=this.characterRoot.removeNode(this.characterRoot,t))}}u.characterRoot=null;var h=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class f{static addNodeToTree(t){if(null==this.root)return this.root=t,this.root;this.root=this.root.addNode(t,this.root,this.root.height)}static waitForDataToLoad(){return h(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isDataLoaded)return t("done");setTimeout(f.checkFlag,1e3,t)}static addConceptToTree(t){var e=new l(t.id,t,null,null),n=new l(t.characterValue,t,null,null);u.addNodeToTree(n),this.addNodeToTree(e)}static getNodeFromTree(t){return h(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(t,this.root):null}))}static removeNodeFromTree(t){return h(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,t))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}f.root=null;class y{constructor(t,e,n,o,i,r,c,a,s,l,d,u,h,f,y,v=!1,p,g){this.isTemp=!1,this.id=t,this.userId=e,this.typeId=n,this.typeUserId=o,this.ghostId=t,this.categoryId=i,this.categoryUserId=r,this.referentId=c,this.referent=c,this.referentUserId=a,this.characterValue=`${s}`,this.securityId=l,this.securityUserId=d,this.accessId=u,this.accessUserId=h,this.sessionInformationId=f,this.sessionInformationUserId=y,this.x=0,this.y=0,this.type=null,this.isNew=v,this.entryTimeStamp=p,this.updatedTimeStamp=g}getType(){console.log(this.typeId)}}function v(){let t=new Date,e=new Date;return new y(0,0,0,0,0,0,0,0,"0",0,0,0,0,0,0,!1,t,e)}var p=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class g{static addNodeToTree(t){return p(this,void 0,void 0,(function*(){return null==this.typeRoot?(this.typeRoot=t,this.typeRoot):(this.typeRoot=this.typeRoot.addTypeNode(t,this.typeRoot,this.typeRoot.height),this.typeRoot)}))}static addConceptToTree(t){if(0!=t.typeId){var e=new l(t.typeId,t,null,null);this.addNodeToTree(e)}}static removeTypeConcept(t,e){this.typeRoot&&(this.typeRoot=this.typeRoot.removeNodeWithVariants(this.typeRoot,t,e))}static getNodeFromTree(t){return this.typeRoot?this.typeRoot.getFromNode(t,this.typeRoot):this.typeRoot}static getTypeVariantsFromTree(t){var e=this.getNodeFromTree(t),n=[];if(e){n.push(null==e?void 0:e.value);for(let t=0;t<e.variants.length;t++)n.push(e.variants[t].value);return n}}static waitForDataToLoad(){return p(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isTypeLoaded)return t("done");setTimeout(g.checkFlag,1e3,t)}static getTypeVariantsFromTreeWithUserId(t,e){return p(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(t);if(o){o.value.userId==e&&n.push(null==o?void 0:o.value);for(let t=0;t<o.variants.length;t++)if(o.variants[t].value.userId==e){var i=!1;for(let e=0;e<n.length;e++)n[e].id==o.variants[t].value.id&&(i=!0);i||n.push(o.variants[t].value)}}return n}))}static getTypeVariantsWithCharacterValue(t,e){return p(this,void 0,void 0,(function*(){let n=v();var o=this.getNodeFromTree(e);if(o){o.value.characterValue==t&&(n=o.value);for(let e=0;e<o.variants.length;e++)o.variants[e].value.characterValue==t&&(n=o.variants[e].value)}return n}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}g.typeRoot=null;var N=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class m{constructor(){this.name="conceptsArray"}static CheckContains(t){for(var e=!1,n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].id==t.id&&(e=!0);return e}static AddNpc(t){this.NPC.includes(t)||(this.NPC.length>10&&(this.NPC=[]),this.NPC.push(t))}static GetNpc(t){return!!this.NPC.includes(t)}static AddConceptToStorage(t){t.id}static AddConcept(t){t.id>0&&(f.addConceptToTree(t),g.addConceptToTree(t),u.addConceptToTree(t))}static AddConceptToMemory(t){t.id>0&&(f.addConceptToTree(t),g.addConceptToTree(t),u.addConceptToTree(t))}static AddConceptTemporary(t){var e=this.CheckContains(t);this.conceptDictionary[t.id]=t,e&&this.RemoveConcept(t),this.conceptsArray.push(t)}static RemoveConcept(t){for(var e=0;e<this.conceptsArray.length;e++)this.conceptsArray[e].id==t.id&&this.conceptsArray.splice(e,1);t.id}static GetConcept(t){return N(this,void 0,void 0,(function*(){var e=v(),n=yield f.getNodeFromTree(t);if(null==n?void 0:n.value){var o=n.value;o&&(e=o)}return e}))}static GetConceptByCharacter(t){return N(this,void 0,void 0,(function*(){var e=v(),n=u.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterUpdated(t){return N(this,void 0,void 0,(function*(){var e=v(),n=u.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterAndTypeLocal(t,e){return N(this,void 0,void 0,(function*(){return v(),yield g.getTypeVariantsWithCharacterValue(t,e)}))}static GetConceptByCharacterAndCategoryLocal(t,e){return N(this,void 0,void 0,(function*(){var n=v(),o=yield u.getCharacterAndCategoryFromTree(t,e);return o&&(n=o.value),n}))}static GetConceptsByTypeId(t){let e=[];for(var n=0;n<this.conceptsArray.length;n++)this.conceptsArray[n].typeId==t&&e.push(this.conceptsArray[n]);return e}static GetConceptsByTypeIdAndUser(t,e){return N(this,void 0,void 0,(function*(){let n=[];return n=yield g.getTypeVariantsFromTreeWithUserId(t,e),n}))}static GetBinaryCharacterTree(){return u.characterRoot}getName(){return this.name}}m.conceptsArray=[],m.NPC=[],m.conceptDictionary=[];var C=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function T(t){const e=t.lastIndexOf("_");let n=[];return n=e>0?[t.substring(0,e),t.substring(e+1,t.length)]:[t],n}class w{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 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 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 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 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"}}w.BASE_URL="https://localhost:7053/",w.AI_URL="https://ai.freeschema.com",w.MQTT_URL="192.168.1.249",w.NODE_URL="http://localhost:5001/";class k{}function I(t="application/json",e="application/json"){return{"Content-Type":t,Authorization:"Bearer "+k.BearerAccessToken,Accept:e}}function A(t="application/json",e="",n="application/json"){return""==e&&(e=k.BearerAccessToken),{"Content-Type":t,Authorization:"Bearer "+e,Accept:n}}k.BearerAccessToken="";class x{constructor(t,e,n,o){this.url=w.BASE_URL,this.message=t,this.ok=e,this.status=n,this.data=o}getMessage(){return this.message}setMessage(t){return this.message=t,this}getStatus(){return this.status}setStatus(t){return this.status=t,this}getData(){return this.data}setData(t){return this.data=t,this}getOk(){return this.ok}setOk(t){return this.ok=t,this}getUrl(){return this.url}setUrl(t){return this.url=t,this}}function R(t){if(401==t.status){let e=new x(t.statusText,!1,t.status,"");throw e.setUrl(t.url),e}}var S=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function L(t,e){return S(this,void 0,void 0,(function*(){try{var n=new URLSearchParams;n.append("type",t),n.append("user_id",e.toString());var o=I("application/x-www-form-urlencoded");const r=yield fetch(w.GetAllConceptsByTypeUrl(),{method:"POST",headers:o,body:n});if(r.ok){const t=yield r.json();for(var i=0;i<t.length;i++)m.AddConcept(t[i])}console.log("GetAllConceptsByType error",r.status),R(r)}catch(t){throw t instanceof Error?console.log("GetAllConceptsByType error message: ",t.message):console.log("GetAllConceptsByType unexpected error: ",t),t}}))}class G{constructor(t=0,e,n,o,i,r,c,a,s,l,d,u,h,f,y,p){this.isTemp=!1,this.toUpdate=!1,this.type=v(),this.id=t,this.ofTheConceptId=e,this.toTheConceptId=n,this.OfTheConceptUserId=o,this.ToTheConceptUserId=i,this.userId=r,this.typeId=c,this.ghostId=t,this.typeUserId=a,this.orderId=s,this.orderUserId=l,this.securityId=d,this.securityUserId=u,this.accessId=h,this.accessUserId=f,this.sessionInformationId=y,this.sessionInformationUserId=p,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class _{constructor(t,e,n,o){this.variants=[],this.height=1,this.key=t,this.value=e,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(t,e){return null==e?e=t:(t.value.typeId!=e.value.typeId&&(e.currentNode=this.addCurrentNode(t,e.currentNode)),e)}addCurrentNodeType(t,e){if(null==e)return t;var n=!1;t.value.id==e.value.id&&(n=!0);for(let o=0;o<e.variants.length;o++)e.variants[o].value.id==t.value.id&&(n=!0);return n||e.variants.push(t),e}addNode(t,e,n){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addNode(t,o,n);else{if(!(e.key<t.key))return e;e.rightNode=this.addNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}return e}addTypeNode(t,e,n){if(0!=t.value.typeId){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addTypeNode(t,o,n);else{if(!(e.key<t.key))return e.key==t.key&&0!=e.key&&e.addCurrentNodeType(t,e),e;e.rightNode=this.addTypeNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}}return e}rightRotate(t){if(t){let e=t.leftNode;if(e){let n=e.rightNode;return t.leftNode=n,e.rightNode=t,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,e}}return t}leftRotate(t){if(t){let e=t.rightNode;if(e){let n=e.leftNode;return e.leftNode=t,t.rightNode=n,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(t.rightNode))+1,e}}return t}getHeight(t){return t?t.height:0}getBalanceFactor(t){return null==t?0:this.getHeight(t.leftNode)-this.getHeight(t.rightNode)}getFromNode(t,e){return e?t==e.key?e:t<e.key?this.getFromNode(t,e.leftNode):t>e.key?this.getFromNode(t,e.rightNode):e:e}getCharacterFromNode(t,e){return e?t==e.key?e:t<e.key?this.getCharacterFromNode(t,e.leftNode):t>e.key?this.getCharacterFromNode(t,e.rightNode):e:e}removeNode(t,e){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNode(t.leftNode,e),t;if(t.key<e)return t.rightNode=this.removeNode(t.rightNode,e),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var n=this.inOrderSuccessor(t.rightNode);return t.value=n.value,t.key=n.key,t.variants=n.variants,t.currentNode=n.currentNode,t.rightNode=this.removeNode(t.rightNode,n.key),t}removeNodeWithVariants(t,e,n){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNodeWithVariants(t.leftNode,e,n),t;if(t.key<e)return t.rightNode=this.removeNodeWithVariants(t.rightNode,e,n),t;if(t.variants.length>0)if(t.value.id==n){var o=t.variants[0];if(o)return t.value=o.value,t.key=o.key,t.currentNode=o.currentNode,t.variants.splice(0,1),t}else for(let e=0;e<t.variants.length;e++)if(n==t.variants[e].value.id)return t.variants.splice(e,1),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var i=this.inOrderSuccessor(t.rightNode);return t.value=i.value,t.key=i.key,t.variants=i.variants,t.currentNode=i.currentNode,t.rightNode=this.removeNodeWithVariants(t.rightNode,i.key,n),t}inOrderSuccessor(t){for(;null!=t.leftNode;)t=t.leftNode;return t}}var U=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class F{static addNodeToTree(t){if(null==this.connectionroot)return this.connectionroot=t,this.connectionroot;this.connectionroot=this.connectionroot.addNode(t,this.connectionroot,this.connectionroot.height)}static addConnectionToTree(t){var e=new _(t.id,t,null,null);this.addNodeToTree(e)}static waitForDataToLoad(){return U(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isConnectionLoaded)return t("done");setTimeout(F.checkFlag,1e3,t)}static removeNodeFromTree(t){return U(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,t))}))}static getNodeFromTree(t){return U(this,void 0,void 0,(function*(){return this.connectionroot?this.connectionroot.getFromNode(t,this.connectionroot):this.connectionroot}))}}F.connectionroot=null;var B=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class P{static addNodeToTree(t){return B(this,void 0,void 0,(function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=t,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addTypeNode(t,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)}))}static waitForDataToLoad(){return B(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isConnectionTypeLoaded)return t("done");setTimeout(P.checkFlag,1e3,t)}static addConnectionToTree(t){if(0!=t.typeId){var e=new _(t.typeId,t,null,null);this.addNodeToTree(e)}}static removeTypeConcept(t,e){this.connectionTypeRoot&&(this.connectionTypeRoot=this.connectionTypeRoot.removeNodeWithVariants(this.connectionTypeRoot,t,e))}static getNodeFromTree(t){return this.connectionTypeRoot?this.connectionTypeRoot.getFromNode(t,this.connectionTypeRoot):this.connectionTypeRoot}static getTypeVariantsFromTree(t){return B(this,void 0,void 0,(function*(){var e=[],n=this.getNodeFromTree(t);if(n){e.push(null==n?void 0:n.value);for(let t=0;t<n.variants.length;t++)e.push(n.variants[t].value);return e}}))}static getTypeVariantsFromTreeWithUserId(t,e){return B(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(t);if(o){o.value.userId==e&&n.push(null==o?void 0:o.value);for(let t=0;t<o.variants.length;t++)o.variants[t].value.userId==e&&n.push(o.variants[t].value)}return n}))}}P.connectionTypeRoot=null;var D=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class O{constructor(){this.name="Connection Array"}static CheckContains(t){for(var e=!1,n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==t.id&&(e=!0);return e}static AddConnectionToStorage(t){}static AddConnection(t){t.isTemp||(F.addConnectionToTree(t),P.addConnectionToTree(t))}static AddConnectionToMemory(t){t.isTemp||(F.addConnectionToTree(t),P.addConnectionToTree(t))}static AddToDictionary(t){this.connectionDictionary[t.id]=t}static RemoveConnection(t){0!=t.id&&(t.id,F.removeNodeFromTree(t.id),P.removeTypeConcept(t.typeId,t.id))}static GetConnectionTree(){return F.connectionroot}static GetConnectionTypeTree(){return P.connectionTypeRoot}static GetConnection(t){return D(this,void 0,void 0,(function*(){var e=new G(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),n=yield F.getNodeFromTree(t);if(null==n?void 0:n.value){var o=n.value;o&&(e=o)}return e}))}static GetConnectionsOfCompositionLocal(t){return D(this,void 0,void 0,(function*(){var e=[],n=yield P.getNodeFromTree(t);if(null==n?void 0:n.value){var o=n.value;if(o){let t=o;e.push(t);for(let t=0;t<n.variants.length;t++)e.push(n.variants[t].value)}}return e}))}getName(){return this.name}}O.connectionArray=[],O.connectionDictionary=[];var E=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function V(t){return E(this,void 0,void 0,(function*(){let e=[];try{var n=[];for(let o=0;o<t.length;o++){let i=yield m.GetConcept(t[o]);0==i.id?n.push(t[o]):e.push(i)}if(0==n.length)return e;{var o=I();const t=yield fetch(w.GetConceptBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(n)});if(t.ok){let n=yield t.json();if(n.length>0)for(let t=0;t<n.length;t++){let o=n[t];e.push(o),m.AddConcept(o)}}else console.log("Get Concept Bulk error",t.status),R(t);return e}}catch(t){throw t instanceof Error?console.log("Get Concept Bulk error message: ",t.message):console.log("Get Concept Bulk unexpected error: ",t),t}}))}var b=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function H(t=[]){return b(this,void 0,void 0,(function*(){var e=[];if(t.length>0){for(let n=0;n<t.length;n++)e.includes(t[n].ofTheConceptId)||e.push(t[n].ofTheConceptId),e.includes(t[n].toTheConceptId)||e.push(t[n].toTheConceptId);yield V(e)}}))}var M=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function W(t=[]){return M(this,void 0,void 0,(function*(){var e=[];for(let o=0;o<t.length;o++){var n=yield O.GetConnectionsOfCompositionLocal(t[o]);e.push(...n)}return e}))}function j(t=[],e=[]){for(let n=0;n<e.length;n++)Array.isArray(t)&&(t.find((t=>t.id===e[n].id))||O.RemoveConnection(e[n]))}var $=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function J(t=[]){return $(this,void 0,void 0,(function*(){var e=[];if(t.length<=0)return e;var n=yield W(t),o=yield function(t=[]){return $(this,void 0,void 0,(function*(){var e=[];try{var n=I();const i=yield fetch(w.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(t)});if(i.ok){const t=yield i.json();for(var o=0;o<t.length;o++)O.AddConnection(t[o]),e.push(t[o])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),R(i);return e}catch(t){throw t instanceof Error?console.log("Get all connections of composition bulk error message: ",t.message):console.log("Get all connections of composition bulk unexpected error: ",t),t}}))}(t);return j(e=o,n),yield H(e),e}))}var K=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Q(t){return K(this,void 0,void 0,(function*(){let e=v();console.log("id",t);try{var n=yield m.GetConcept(t);let i=m.GetNpc(t);if(0!=n.id||i)return n;{var o=I("application/x-www-form-urlencoded");const n=yield fetch(w.GetConceptUrl(),{method:"POST",headers:o,body:`id=${t}`});return console.log("response",n),n.ok?(e=yield n.json(),e.id>0?m.AddConcept(e):m.AddNpc(t)):(console.log("Get the concept error",n.status),R(n)),e}}catch(t){throw t instanceof Error?console.log("Get the concept error message: ",t.message):console.log("Get the concept unexpected error: ",t),t}}))}var z=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function q(t){return z(this,void 0,void 0,(function*(){var e=[];if(0==(e=yield O.GetConnectionsOfCompositionLocal(t)).length)e=yield X(t);else{var n=yield X(t);j(n,e),e=n}return e}))}function X(t){return z(this,void 0,void 0,(function*(){var e=[];try{var n=I("application/x-www-form-urlencoded");const i=yield fetch(w.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:n,body:`composition_id=${t}`});if(!i.ok)throw R(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();for(var o=0;o<r.length;o++)O.AddConnection(r[o]),e.push(r[o]);return e}catch(t){throw t instanceof Error?console.log("Get all connection of composition error : ",t.message):console.log("Get all connection of composition error : ",t),t}}))}var Y=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Z(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield q(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield rt(t,o,r);return i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s,i}))}function tt(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield q(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield ct(t,o,r);return i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s,i}))}function et(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield O.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield rt(t,o,r);return i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s,i}))}function nt(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield O.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield rt(t,o,r);i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s;var l={};return l.created_at=a.entryTimeStamp,l.data=i,l.id=t,l}))}function ot(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield O.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield rt(t,o,r);i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s;var l={};return l.data=i,l.id=t,l.created_at=a.entryTimeStamp,l}))}function it(t){var e,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield q(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield m.GetConcept(t);0==a.id&&null!=t&&null!=t&&(a=yield Q(t));var s=yield rt(t,o,r);i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=s;var l={};return l.data=i,l.id=t,l}))}function rt(t,e,n,o=[]){var i,r,c;return Y(this,void 0,void 0,(function*(){var a={},s=[];if(0==t)return null;var l=yield m.GetConcept(t);if(null!=l&&0!=l.id||null==t||null==t||(l=yield Q(t)),0!=l.id&&null==l.type){var d=l.typeId,u=yield m.GetConcept(d);l.type=u,null==u&&null!=d&&null!=d&&(u=yield Q(d),l.type=u)}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(t))return null==l?void 0:l.characterValue;if(o.includes(t))return"";o.push(t);for(var h=0;h<e.length;h++)if(e[h].ofTheConceptId==t){var f=e[h].toTheConceptId,y=yield m.GetConcept(f);null!=y&&0!=y.id||null==f||null==f||(y=yield Q(f)),y&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield m.GetConcept(d),y.type=u,null==u&&null!=d&&null!=d&&(u=yield Q(d),y.type=u));var v=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(v))){if(v){const t=yield rt(f,e,n,o);a[v]=t}}else{const t=yield rt(f,e,n,o);s[v]=t,a=s}}return a}))}function ct(t,e,n,o=[]){var i,r,c;return Y(this,void 0,void 0,(function*(){var a={},s=[];if(0==t)return null;var l=yield m.GetConcept(t);if(null!=l&&0!=l.id||null==t||null==t||(l=yield Q(t)),0!=l.id&&null==l.type){var d=l.typeId,u=yield m.GetConcept(d);l.type=u,null==u&&null!=d&&null!=d&&(u=yield Q(d),l.type=u)}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(t))return null==l?void 0:l.characterValue;if(o.includes(t))return"";o.push(t),a.id=t;for(var h=0;h<e.length;h++)if(e[h].ofTheConceptId==t){var f=e[h].toTheConceptId,y=yield m.GetConcept(f);null!=y&&0!=y.id||null==f||null==f||(y=yield Q(f)),y&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield m.GetConcept(d),y.type=u,null==u&&null!=d&&null!=d&&(u=yield Q(d),y.type=u));var v=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(v))){if(v){const t=yield ct(f,e,n);a[v]=t}}else{const t=yield ct(f,e,n);s[v]=t,a=s}}return a}))}var at=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function st(t){return at(this,void 0,void 0,(function*(){let e=v();try{var n=I("application/x-www-form-urlencoded");const o=yield fetch(w.GetConceptByCharacterValueUrl(),{method:"POST",headers:n,body:`character_value=${t}`});return o.ok?(e=yield o.json(),e.id>0&&m.AddConcept(e)):(console.log("Error in Getting concept by character value Error",o.status),R(o)),e}catch(t){throw t instanceof Error?console.log("Error in Getting concept by character value error message: ",t):console.log("Error in Getting concept by character value unexpected error: ",t),t}}))}var lt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function dt(t){return lt(this,void 0,void 0,(function*(){var e=yield m.GetConceptByCharacter(t),n=`${t}`;return null!=e&&0!=(null==e?void 0:e.id)||!n||(yield st(t),e=yield m.GetConceptByCharacter(t)),e}))}var ut=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function ht(t,e,n=10,o=1){return ut(this,void 0,void 0,(function*(){var i=yield dt(t),r=[];if(i){yield L(t,e);for(var c=yield m.GetConceptsByTypeIdAndUser(i.id,e),a=n*(o-1),s=[],l=a;l<a+n;l++)c[l]&&s.push(c[l].id);for(yield J(s),l=a;l<a+n;l++)if(c[l]){var d=yield et(c[l].id);r.push(d)}}return r}))}function ft(t,e,n=10,o=1){return ut(this,void 0,void 0,(function*(){var i=yield dt(t),r=[];if(i){yield L(t,e);for(var c=yield m.GetConceptsByTypeIdAndUser(i.id,e),a=n*(o-1),s=[],l=a;l<a+n;l++)c[l]&&s.push(c[l].id);for(yield J(s),l=a;l<a+n;l++)if(c[l]){var d=yield nt(c[l].id);r.push(d)}}return r}))}class yt{constructor(t,e,n,o){this.variants=[],this.height=1,this.key=t,this.value=e,this.leftNode=n,this.rightNode=o,this.currentNode=null}addCurrentNode(t,e){return null==e?e=t:(t.value.typeId!=e.value.typeId&&(e.currentNode=this.addCurrentNode(t,e.currentNode)),e)}addCurrentNodeType(t,e){if(null==e)return t;var n=!1;for(let o=0;o<e.variants.length;o++)e.variants[o].value.id==t.value.id&&(n=!0);return n||e.variants.push(t),e}addNode(t,e,n){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addNode(t,o,n);else{if(!(e.key<t.key))return e;e.rightNode=this.addNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}return e}addCharacterNode(t,e,n){if(""!=t.value.characterValue){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addCharacterNode(t,o,n);else{if(!(e.key<t.key))return e.key==t.key&&""!=e.key&&e.value.id!=t.value.id&&e.addCurrentNodeType(t,e),e;e.rightNode=this.addCharacterNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}}return e}addTypeNode(t,e,n){if(0!=t.value.typeId){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addTypeNode(t,o,n);else{if(!(e.key<t.key))return e.key==t.key&&0!=e.key&&e.value.id!=t.value.id&&e.addCurrentNodeType(t,e),e;e.rightNode=this.addTypeNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}}return e}rightRotate(t){if(t){let e=t.leftNode;if(e){let n=e.rightNode;return t.leftNode=n,e.rightNode=t,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,e}}return t}leftRotate(t){if(t){let e=t.rightNode;if(e){let n=e.leftNode;return e.leftNode=t,t.rightNode=n,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(t.rightNode))+1,e}}return t}getHeight(t){return t?t.height:0}getBalanceFactor(t){return null==t?0:this.getHeight(t.leftNode)-this.getHeight(t.rightNode)}getFromNode(t,e){return e?t==e.key?e:t<e.key?this.getFromNode(t,e.leftNode):t>e.key?this.getFromNode(t,e.rightNode):e:e}getCharacterFromNode(t,e){return e?t==e.key?e:t<e.key?this.getCharacterFromNode(t,e.leftNode):t>e.key?this.getCharacterFromNode(t,e.rightNode):e:e}getFromNodeWithCharacterAndType(t,e,n){if(t=`${t}`,n){if(t==n.key){if(t==n.value.characterValue&&e==n.value.typeId)return n;for(let t=0;t<n.variants.length;t++)if(n.variants[t].value.typeId==e)return n.variants[t]}else{if(t<n.key)return this.getFromNodeWithCharacterAndType(t,e,n.leftNode);if(t>n.key)return this.getFromNodeWithCharacterAndType(t,e,n.rightNode)}return null}return n}removeNode(t,e){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNode(t.leftNode,e),t;if(t.key<e)return t.rightNode=this.removeNode(t.rightNode,e),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var n=this.inOrderSuccessor(t.rightNode);return t.value=n.value,t.key=n.key,t.variants=n.variants,t.currentNode=n.currentNode,t.rightNode=this.removeNode(t.rightNode,n.key),t}removeNodeWithVariants(t,e,n){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNodeWithVariants(t.leftNode,e,n),t;if(t.key<e)return t.rightNode=this.removeNodeWithVariants(t.rightNode,e,n),t;if(t.variants.length>0)if(t.value.id==n){var o=t.variants[0];if(o)return t.value=o.value,t.key=o.key,t.currentNode=o.currentNode,t.variants.splice(0,1),t}else for(let e=0;e<t.variants.length;e++)if(n==t.variants[e].value.id)return t.variants.splice(e,1),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var i=this.inOrderSuccessor(t.rightNode);return t.value=i.value,t.key=i.key,t.variants=i.variants,t.currentNode=i.currentNode,t.rightNode=this.removeNodeWithVariants(t.rightNode,i.key,n),t}countNodeBelow(t){return null==t?0:1+this.countNodeBelow(t.leftNode)+this.countNodeBelow(t.rightNode)}inOrderSuccessor(t){for(;null!=t.leftNode;)t=t.leftNode;return t}}var vt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class pt{static addNodeToTree(t){if(null==this.root)return this.root=t,this.root;this.root=this.root.addNode(t,this.root,this.root.height)}static addConceptToTree(t){var e=new yt(t.id,t,null,null);new yt(t.characterValue,t,null,null),this.addNodeToTree(e)}static waitForDataToLoad(){return vt(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isLocalDataLoaded)return t("done");setTimeout(pt.checkFlag,1e3,t)}static getNodeFromTree(t){return vt(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(t,this.root):null}))}static getCharacterAndTypeFromTree(t,e){return this.root?this.root.getFromNodeWithCharacterAndType(t,e,this.root):this.root}static removeNodeFromTree(t){return vt(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,t))}))}}pt.root=null;var gt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Nt{static waitForDataToLoad(){return gt(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isLocalCharacterLoaded)return t("done");setTimeout(Nt.checkFlag,1e3,t)}static addNodeToTree(t){return gt(this,void 0,void 0,(function*(){return null==this.LocalCharacterRoot?(this.LocalCharacterRoot=t,this.LocalCharacterRoot):(this.LocalCharacterRoot=this.LocalCharacterRoot.addCharacterNode(t,this.LocalCharacterRoot,this.LocalCharacterRoot.height),this.LocalCharacterRoot)}))}static addConceptToTree(t){if(""!=t.characterValue){var e=new yt(t.characterValue,t,null,null);this.addNodeToTree(e)}}static getNodeFromTree(t){return this.LocalCharacterRoot?this.LocalCharacterRoot.getCharacterFromNode(t,this.LocalCharacterRoot):this.LocalCharacterRoot}static getCharacterAndTypeFromTree(t,e){return gt(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(t,e,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(t,e){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,t,e))}}Nt.LocalCharacterRoot=null;var mt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Ct{static addNodeToTree(t){return mt(this,void 0,void 0,(function*(){return null==this.LocalTypeRoot?(this.LocalTypeRoot=t,this.LocalTypeRoot):(this.LocalTypeRoot=this.LocalTypeRoot.addTypeNode(t,this.LocalTypeRoot,this.LocalTypeRoot.height),this.LocalTypeRoot)}))}static addConceptToTree(t){if(0!=t.typeId){var e=new yt(t.typeId,t,null,null);this.addNodeToTree(e)}}static removeConceptType(t,e){this.LocalTypeRoot&&(this.LocalTypeRoot=this.LocalTypeRoot.removeNodeWithVariants(this.LocalTypeRoot,t,e))}static getNodeFromTree(t){return this.LocalTypeRoot?this.LocalTypeRoot.getFromNode(t,this.LocalTypeRoot):this.LocalTypeRoot}static getTypeVariantsFromTree(t){var e=this.getNodeFromTree(t),n=[];if(e){n.push(null==e?void 0:e.value);for(let t=0;t<e.variants.length;t++)n.push(e.variants[t].value);return n}}static waitForDataToLoad(){return mt(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isLocalTypeLoaded)return t("done");setTimeout(Ct.checkFlag,1e3,t)}static getTypeVariantsFromTreeWithUserId(t,e){return mt(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(t);if(o){o.value.userId==e&&n.push(null==o?void 0:o.value);for(let t=0;t<o.variants.length;t++)o.variants[t].value.userId==e&&n.push(o.variants[t].value)}return n}))}}Ct.LocalTypeRoot=null;class Tt{constructor(t,e,n,o,i,r,c,a=!1,s,l,d,u=999){this.isComposition=!1,this.isTemp=!1,this.applicationId=999,this.id=t,this.userId=e,this.typeId=n,this.ghostId=t,this.categoryId=o,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=a,this.typeCharacter=c,this.entryTimeStamp=s,this.updatedTimeStamp=l,this.referentId=d,this.applicationId=u}getType(){console.log(this.typeId)}}function wt(){let t=new Date,e=new Date;return new Tt(0,0,0,0,0,"0","0",!1,t,e,0)}var kt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class It{constructor(){this.name="conceptsArray"}static AddConcept(t){t.id>0&&(pt.addConceptToTree(t),Nt.addConceptToTree(t),Ct.addConceptToTree(t),this.localconceptsArray.push(t))}static AddConceptToMemory(t){t.id>0&&(pt.addConceptToTree(t),Nt.addConceptToTree(t),Ct.addConceptToTree(t))}static GetConcept(t){return kt(this,void 0,void 0,(function*(){var e=wt(),n=yield pt.getNodeFromTree(t);if(null==n?void 0:n.value){var o=n.value;o&&(e=o)}return e}))}static GetConceptByCharacter(t){return kt(this,void 0,void 0,(function*(){var e=wt(),n=Nt.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterAndTypeLocal(t,e){return kt(this,void 0,void 0,(function*(){var n=wt(),o=yield Nt.getCharacterAndTypeFromTree(t,e);return o&&(n=o.value),n}))}static GetConceptsByTypeId(t){let e=[];for(var n=0;n<this.localconceptsArray.length;n++)this.localconceptsArray[n].typeId==t&&e.push(this.localconceptsArray[n]);return e}static GetConceptsByTypeIdAndUser(t,e){return kt(this,void 0,void 0,(function*(){let n=[];return n=yield Ct.getTypeVariantsFromTreeWithUserId(t,e),n}))}getName(){return this.name}}It.localconceptsArray=[];var At=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class xt{constructor(){this.name="Connection Array"}static CheckContains(t){for(var e=!1,n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==t.id&&(e=!0);return e}static AddConnection(t){this.CheckContains(t)&&this.RemoveConnection(t),0!=t.id||t.isTemp,this.connectionArray.push(t)}static AddToDictionary(t){this.connectionDictionary[t.id]=t}static RemoveConnection(t){for(var e=0;e<this.connectionArray.length;e++)this.connectionArray[e].id==t.id&&this.connectionArray.splice(e,1);t.id}static GetConnection(t){var e;e=null;for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].id==t&&(e=this.connectionArray[n]);return e}static waitForDataToLoad(){return At(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isLocalConnectionLoaded)return t("done");setTimeout(xt.checkFlag,1e3,t)}static GetConnectionsOfCompositionLocal(t){return At(this,void 0,void 0,(function*(){var e=[];try{for(var n=0;n<this.connectionArray.length;n++)this.connectionArray[n].typeId==t&&e.push(this.connectionArray[n]);return e}catch(t){return e}}))}getName(){return this.name}}xt.connectionArray=[],xt.connectionDictionary=[];var Rt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function St(t){var e,n;return Rt(this,void 0,void 0,(function*(){var o,i={};o=yield xt.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield It.GetConcept(t),s=yield Gt(t,o,r);return i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:"top"]=s,i}))}function Lt(t){var e,n;return Rt(this,void 0,void 0,(function*(){var o,i={};o=yield xt.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield It.GetConcept(t);if(0!=a.id){var s=yield Gt(t,o,r);i[null!==(n=null===(e=null==a?void 0:a.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:"top"]=s;var l={}}return l.data=i,l.id=t,l}))}function Gt(t,e,n,o=[]){var i,r,c;return Rt(this,void 0,void 0,(function*(){var a={},s=[],l=yield It.GetConcept(t);if(0!=l.id&&null==l.type){var d=l.typeId,u=yield It.GetConcept(d);l.type=u}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(t))return null==l?void 0:l.characterValue;if(o.includes(t))return"";o.push(t);for(var h=0;h<e.length;h++)if(e[h].ofTheConceptId==t){var f=e[h].toTheConceptId,y=yield It.GetConcept(f);0!=y.id&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield It.GetConcept(d),y.type=u);var v=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace("the_","");if(isNaN(Number(v))){if(v){const t=yield Gt(f,e,n);a[v]=t}}else{const t=yield Gt(f,e,n);s[v]=t,a=s}}return a}))}var _t=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ut(t){return _t(this,void 0,void 0,(function*(){return yield It.GetConceptByCharacter(t)}))}var Ft=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Bt(t,e){return Ft(this,void 0,void 0,(function*(){var n=yield Ut(t),o=[];if(n)for(var i=yield It.GetConceptsByTypeIdAndUser(n.id,e),r=0;r<i.length;r++){var c=yield St(i[r].id);o.push(c)}return o}))}function Pt(t,e){return Ft(this,void 0,void 0,(function*(){var n=yield Ut(t),o=[];if(n)for(var i=yield It.GetConceptsByTypeIdAndUser(n.id,e),r=0;r<i.length;r++){var c=yield Lt(i[r].id);o.push(c)}return o}))}var Dt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ot(t){return Dt(this,void 0,void 0,(function*(){let e=v();try{var n=I();const o=yield fetch(w.CreateTheConceptUrl(),{method:"POST",headers:n,body:JSON.stringify(t)});if(!o.ok)throw R(o),new Error(`Error! status: ${o.status}`);return e=yield o.json(),e}catch(t){throw t instanceof Error?console.log("Create the concept api error message: ",t):console.log("Create the concept api unexpected error: ",t),t}}))}var Et=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Vt{static CheckContains(t){for(var e=!1,n=0;n<this.conceptsSyncArray.length;n++)this.conceptsSyncArray[n].id==t.id&&(e=!0);return e}static SyncDataDelete(t){for(var e=0;e<this.conceptsSyncArray.length;e++)t==this.conceptsSyncArray[e].id&&this.conceptsSyncArray.splice(e,1);for(e=0;e<this.connectionSyncArray.length;e++)this.connectionSyncArray[e].ofTheConceptId!=t&&this.connectionSyncArray[e].toTheConceptId!=t&&this.connectionSyncArray[e].typeId!=t||this.connectionSyncArray.splice(e,1)}static CheckContainsConnection(t){for(var e=!1,n=0;n<this.connectionSyncArray.length;n++)this.connectionSyncArray[n].id==t.id&&(e=!0);return e}static AddConcept(t){this.conceptsSyncArray.push(t)}static RemoveConcept(t){for(var e=0;e<this.conceptsSyncArray.length;e++)this.conceptsSyncArray[e].id==t.id&&this.conceptsSyncArray.splice(e,1)}static AddConnection(t){this.connectionSyncArray.push(t)}static RemoveConnection(t){for(var e=0;e<this.connectionSyncArray.length;e++)this.connectionSyncArray[e].id==t.id&&this.connectionSyncArray.splice(e,1)}static SyncDataOnline(){return Et(this,void 0,void 0,(function*(){try{for(let t=0;t<this.conceptsSyncArray.length;t++)m.AddConcept(this.conceptsSyncArray[t]);for(let t=0;t<this.connectionSyncArray.length;t++)O.AddConnection(this.connectionSyncArray[t]);if(this.conceptsSyncArray.length>0){let t=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],Ot(t)}if(this.connectionSyncArray.length>0){let t=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(t){return e=this,n=void 0,i=function*(){let e=new G(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);try{var n=I(),o=JSON.stringify(t);const i=yield fetch(w.CreateTheConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?yield i.json():(console.log("Create the connection error message: ",i),R(i)),e}catch(t){throw t instanceof Error?console.log("Create the connection error message: ",t.message):console.log(" Create the connection unexpected error: ",t),t}},new((o=void 0)||(o=Promise))((function(t,r){function c(t){try{s(i.next(t))}catch(t){r(t)}}function a(t){try{s(i.throw(t))}catch(t){r(t)}}function s(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o((function(t){t(n)}))).then(c,a)}s((i=i.apply(e,n||[])).next())}));var e,n,o,i}(t)}return"done"}catch(t){throw t}}))}static syncDataLocalDb(){return Et(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let t=0;t<this.conceptsSyncArray.length;t++)this.conceptsSyncArray[t];this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let t=0;t<this.connectionSyncArray.length;t++)this.connectionSyncArray[t];this.connectionSyncArray=[]}return"done"}))}}function bt(t,e,n,o,i,r,c){var a=new G(0,t,n,e,o,e,i,e,1,e,0,e,4,e,r,c);return t==n?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),Vt.AddConnection(a),a)}Vt.conceptsSyncArray=[],Vt.connectionSyncArray=[];var Ht=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},Mt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Wt(t,e){return Mt(this,void 0,void 0,(function*(){let n=yield m.GetConceptByCharacterAndTypeLocal(t,e);try{if(null==n||0==n.id){var o={character_value:`${t}`,type_id:e},i=JSON.stringify(o),r=I();const c=yield fetch(w.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:r,body:i});c.ok?(n=yield c.json(),m.AddConcept(n)):(console.log("This is the concept by type and character error",c.status),R(c))}return n}catch(t){throw t instanceof Error?console.log(" This is the concept by type and character error message: ",t.message):console.log(" This is the concept by type and character unexpected error: ",t),t}}))}var jt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class $t{constructor(t,e,n,o,i,r,c,a,s,l){this.id=0,this.userId=t,this.data=e,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.entryTimestamp=s,this.isNew=l}}var Jt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Kt{static getId(){return Jt(this,void 0,void 0,(function*(){this.ids.length<5&&(yield function(){return t=this,e=void 0,o=function*(){try{var t=I("application/x-www-form-urlencoded");const n=yield fetch(w.GetReservedIdUrl(),{method:"GET",headers:t});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`);const o=yield n.json();for(var e=0;e<o.length;e++)Kt.AddId(o[e])}catch(t){throw t instanceof Error?console.log("get reserved ids error message: ",t.message):console.log("get reserved ids unexpected error: ",t),t}},new((n=void 0)||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}));var t,e,n,o}());var t=this.ids[0];return this.ids.shift(),t}))}static AddId(t){this.ids.includes(t)||this.ids.push(t)}}Kt.ids=[];class Qt{static getId(){return Jt(this,void 0,void 0,(function*(){this.connectionIds.length<5&&(yield function(){return t=this,e=void 0,o=function*(){try{var t=I("application/x-www-form-urlencoded");const n=yield fetch(w.GetReservedConnectionIdUrl(),{method:"GET",headers:t});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`);const o=yield n.json();for(var e=0;e<o.length;e++)Qt.AddId(o[e])}catch(t){throw t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),t}},new((n=void 0)||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}));var t,e,n,o}());var t=this.connectionIds[0];return this.connectionIds.shift(),t}))}static AddId(t){this.connectionIds.includes(t)||this.connectionIds.push(t)}}Qt.connectionIds=[];var zt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function qt(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return zt(this,void 0,void 0,(function*(){var v=yield Kt.getId();let p=new Date,g=new Date;var N=new y(v,e,i,r,n,o,c,a,t,s,l,d,u,h,f,!0,p,g);return N.isTemp=!1,Vt.AddConcept(N),N}))}function Xt(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return zt(this,void 0,void 0,(function*(){var v=yield Kt.getId();let p=new Date,g=new Date;var N=new y(v,e,i,r,n,o,c,a,t,s,l,d,u,h,f,!1,p,g);return m.AddConcept(N),Ot([N]),N}))}var Yt=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Zt(t,e,n=!1,o,i,r=999,c=0){return Yt(this,void 0,void 0,(function*(){let a,s=r,l=999,d=o,u=o,h=i,f=o,y="",p=e.length,g=v();if(y=t.startsWith("the_")?t:"the_"+t,n)g=yield Ke(t),a=yield qt(e,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u);else if(p>255)g=yield Ke(y),a=yield qt(e,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u),function(t){Ht(this,void 0,void 0,(function*(){try{var e=I();const n=yield fetch(w.CreateTheTextDataUrl(),{method:"POST",headers:e,body:JSON.stringify(t)});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`);return yield n.json()}catch(t){throw t instanceof Error?console.log("Create the text error message: ",t.message):console.log("Create the text unexpected error: ",t),t}}))}(new $t(o,e,l,d,h,f,s,u,Date.now().toString(),!0));else{g=yield Ke(y);let t=yield Wt(e,g.id);a=t,0==t.id&&0==t.userId&&(a=yield Xt(e,o,4,o,g.id,g.userId,12,12,l,d,h,f,s,u),function(t,e,n,o){jt(this,void 0,void 0,(function*(){try{var i={newConceptId:t,referent:e,typeId:n,typeUserId:o},r=I(),c=JSON.stringify(i);const a=yield fetch(w.MakeTheNameInBackendUrl(),{method:"POST",headers:r,body:c});a.ok||R(a)}catch(t){throw t instanceof Error?console.log("make the name in backend error message: ",t.message):console.log("make the name in backend unexpected error: ",t),t}}))}(a.id,`${e}`,g.id,o))}return a.type=g,a}))}var te=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function ee(t,e=null,n=null,o=null,i=null,r=null,c=null){return te(this,void 0,void 0,(function*(){var a=null!=i?i:999,s=null!=r?r:4,l=null!=c?c:999,d=null!=o?o:0,u=v();for(const o in t)if("string"!=typeof t[o]&&"number"!=typeof t[o])if(null==e&&null==n){var h=d;u=p=yield Zt(o,"",!0,a,s,l),h=p.id,d=p.id,yield ee(t[o],p.id,p.userId,h,i,r,c)}else{var f=null!=e?e:999,y=null!=n?n:999;h=d,u=p=yield Zt(o,"",!0,a,s,l),yield bt(f,y,p.id,p.userId,h,l,p.userId),yield ee(t[o],p.id,p.userId,h,i,r,c)}else{f=null!=e?e:999,y=null!=n?n:10267,h=d;var p=yield Zt(o,t[o],!1,a,s,l);yield bt(f,y,p.id,p.userId,h,l,p.userId)}return u}))}class ne{constructor(t=0,e,n,o,i,r,c=999){this.isTemp=!1,this.applicationId=999,this.type=wt(),this.id=t,this.ofTheConceptId=e,this.toTheConceptId=n,this.typeId=o,this.ghostId=t,this.orderId=i,this.typeCharacter="",this.accessId=r,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.applicationId=c}}function oe(t,e,n,o=1){Math.floor(1e8*Math.random());let i=0,r=0,c=0;i=t,r=e,c=n;let a=new ne(0,0,0,0,0,0);return t!=e&&(a=new ne(0,t,e,n,o,4),a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),xt.AddConnection(a)),a}var ie=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function re(t,e,n,o,i,r,c=0){return ie(this,void 0,void 0,(function*(){var a=Math.floor(1e8*Math.random());let s=new Date,l=new Date;var d=new Tt(a,n,i,o,r,t,e,!0,s,l,c);return d.isTemp=!0,It.AddConcept(d),d}))}var ce=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},ae=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function se(t,e,n,o){return ae(this,void 0,void 0,(function*(){var i=yield Ut(t);if(i&&(0==i.id||0==i.userId)){var r=T(t);if(r[0]==t){var c=yield function(t,e,n,o,i){return ce(this,void 0,void 0,(function*(){var e=yield It.GetConceptByCharacterAndTypeLocal(t,51),o=e;return 0==o.id&&(o=e=yield re(t,"the",n,4,51,4)),o}))}(t,0,o);i=c}else{var a=yield se(r[0],e,n,o),s=yield se(r[1],e,n,o);s&&(i=c=yield re(t,r[1],o,a.id,s.id,4))}}return i}))}var le=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function de(t,e,n=!1,o,i,r=999,c=0){return le(this,void 0,void 0,(function*(){var i,r,a,s=o,l=e.length;if(a=t.startsWith("the_")?t:"the_"+t,n)i=yield se(t,999,o,o),r=yield re(e,t,o,4,i.id,4,c);else if(l>255)i=yield se(a,999,s,o),r=yield re(e,a,o,4,i.id,4);else{i=yield se(a,999,s,o);var d=yield It.GetConceptByCharacterAndTypeLocal(e,i.id);r=d,0==d.id&&0==d.userId&&(r=yield re(e,a,o,4,i.id,4))}return r.type=i,r}))}var ue=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function he(t,e=null,n=null,o=null,i=null,r=null,c=null){return ue(this,void 0,void 0,(function*(){var a=null!=i?i:999,s=null!=c?c:4,l=null!=o?o:0,d=wt();for(const o in t)if("string"!=typeof t[o]&&"number"!=typeof t[o])if(null==e&&null==n){var u=l;d=f=yield de(o,"",!0,a,0,s),u=f.id,l=f.id,yield he(t[o],f.id,f.userId,u,i,r,c)}else{var h=null!=e?e:999,f=(u=l,yield de(o,"",!0,a,0,s));yield oe(h,f.id,u),yield he(t[o],f.id,f.userId,u,i,r,c)}else h=null!=e?e:999,u=l,f=yield de(o,t[o],!1,a,0,s),yield oe(h,f.id,u);return d}))}var fe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function ye(t,e,n,o=10,i=1){return fe(this,void 0,void 0,(function*(){let r=[];try{var c=new URLSearchParams;c.append("typeId",`${t}`),c.append("ofTheConceptId",`${e}`),c.append("userId",`${n}`),c.append("inpage",`${o}`),c.append("page",`${i}`);var a=I("application/x-www-form-urlencoded");const s=yield fetch(w.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:a,body:c});return s.ok?r=yield s.json():(console.log("Get connection of concept error",s.status),R(s)),r}catch(t){throw t instanceof Error?console.log("Get connection of concept error message: ",t.message):console.log("Get connection of concept unexpected error: ",t),t}}))}var ve=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function pe(t,e,n,o,i,r,c,a=1,s=4){return ve(this,void 0,void 0,(function*(){var l=e,d=e,u=e,h=e,f=e,y=yield Qt.getId(),v=new G(y,t,n,e,o,u,i,d,a,l,0,h,s,f,r,c);return t==n?(v.ofTheConceptId=0,v.toTheConceptId=1,v):(v.toUpdate=!0,v.isTemp=!1,Vt.AddConnection(v),v)}))}var ge=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},Ne=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},me=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ce(t){return me(this,void 0,void 0,(function*(){var e=yield O.GetConnection(t);if((null==e||0==e.id)&&null!=t&&null!=t){var n=yield function(t){return Ne(this,void 0,void 0,(function*(){var e=yield O.GetConnection(t);try{if(0!=e.id)return e;{var n=I("application/x-www-form-urlencoded");const o=yield fetch(w.GetConnectionUrl(),{method:"POST",headers:n,body:`id=${t}`});return o.ok?(e=yield o.json(),O.AddConnection(e)):(console.log("Get Connection Error",o.status),R(o)),e}}catch(t){throw t instanceof Error?console.log("Get Connection error message: ",t.message):console.log("Get Connection unexpected error: ",t),t}}))}(t);e=n}return e}))}var Te=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function we(t){return Te(this,void 0,void 0,(function*(){var e=yield Ce(t);!function(t){ge(this,void 0,void 0,(function*(){try{const e=new FormData;e.append("id",t.toString());const n=yield fetch(w.DeleteTheConnectionUrl(),{method:"POST",body:e,redirect:"follow"});n.ok||(console.log("Delete connection error status: ",n.status),R(n))}catch(t){throw t instanceof Error?console.log("Delete connection error message: ",t.message):console.log("Delete connection unexpected error: ",t),t}}))}(t),F.removeNodeFromTree(t),P.removeTypeConcept(e.typeId,t)}))}var ke=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ie(t,e=999){return ke(this,void 0,void 0,(function*(){var n=v();if(t<0)return No(yield so(e,t));if(null!=(n=yield m.GetConcept(t))&&0!=n.id||null==t||null==t||(n=yield Q(t)),0!=n.id&&null==n.type&&null==(yield m.GetConcept(n.typeId))&&null!=n.typeId&&null!=n.typeId){var o=yield Q(n.typeId);n.type=o}return n}))}var Ae=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function xe(t,e,n,o=!1,i=!1){var r,c;return Ae(this,void 0,void 0,(function*(){var a=t.userId,s=a,l=a;if(o){let o=(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s",c=n+"_by",u=o+"_"+c;i&&(yield Re(c,e,a));var d=yield Zt("connection",u,!1,999,999,999);let h=new G(0,e.id,t.id,e.userId,t.userId,e.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Vt.AddConnection(h)}let u=(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Re(h,t,a));var y=yield Zt("connection",f,!1,999,999,999);let v=new G(0,t.id,e.id,t.userId,e.userId,t.userId,y.id,y.userId,1e3,a,999,s,4,l,999,999);return Vt.AddConnection(v),v}))}function Re(t,e,n=null){var o;return Ae(this,void 0,void 0,(function*(){for(var i=e,r=null!=n?n:e.userId,c=r,a=r,s=999,l=t+"_count",d=(null===(o=e.type)||void 0===o?void 0:o.characterValue)+"_s_"+l,u=yield Zt("connection",d,!1,r,4,s),h=yield ye(u.id,e.id,r,10,1),f=[],y=v(),p=0;p<h.length;p++){let t=yield Ie(h[p].toTheConceptId);f.push(t)}if(f.length<1)y=yield Zt("count","1",!1,r,4,s);else{var g=f[0];let t=0;try{t=Number(g.characterValue)}catch(e){t=0}t+=1,y=yield Zt("count",t.toString(),!1,r,4,s);for(let t=0;t<h.length;t++)we(h[t].id)}let N=new G(0,i.id,y.id,i.userId,y.userId,i.userId,u.id,u.userId,1e3,r,999,c,4,a,s,999);yield Vt.AddConnection(N)}))}function Se(t,e,n,o=!1,i=!1){var r,c;return Ae(this,void 0,void 0,(function*(){var a=t.userId,s=a,l=a;if(o){let o=(null===(r=e.type)||void 0===r?void 0:r.characterValue)+"_s",c=n+"_by",u=o+"_"+c;i&&(yield Re(c,e,a));var d=yield Zt("connection",u,!1,999,999,999);let h=new G(0,e.id,t.id,e.userId,t.userId,e.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Vt.AddConnection(h)}let u=(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Re(h,t,a));var y=yield Zt("connection",f,!1,999,999,999);return yield pe(t.id,t.userId,e.id,e.userId,y.id,999,999,1e3,4)}))}var Le=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ge(t,e,n=10,o=1){var i;return Le(this,void 0,void 0,(function*(){var r=[],c=yield Ie(t),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+e,s=yield Wt(a,16);if(s.id>0){for(var l=yield ye(s.id,c.id,c.userId,n,o),d=[],u=0;u<l.length;u++)d.push(l[u].toTheConceptId);for(yield J(d),u=0;u<l.length;u++){let t=l[u].toTheConceptId,e=yield Ie(t),n=yield ot(e.id);r.push(n)}}return r}))}function _e(t,e,n=10,o=1){var i;return Le(this,void 0,void 0,(function*(){var r=[],c=yield Ie(t),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+e,s=yield Wt(a,16);if(s.id>0){for(var l=yield ye(s.id,c.id,c.userId,n,o),d=[],u=0;u<l.length;u++)d.push(l[u].toTheConceptId);for(u=0;u<l.length;u++){let t=l[u].toTheConceptId,e=yield Ie(t);r.push(e)}}return r}))}class Ue{constructor(t,e,n,o,i,r,c,a,s,l){this.id=0,this.isNew=!1,this.userId=t,this.data=`${e}`,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.isNew=l}}class Fe{constructor(){this.name="character Repository"}static AddCharacter(t){this.characterData[t.id]=t}static GetCharacter(t){for(var e=new Ue(0,"0",0,0,0,0,0,0,"0",!1),n=0;n<this.characterData.length;n++)this.characterData[n].data==t&&(e=this.characterData[n]);return e}}Fe.characterData=[];class Be{constructor(t,e,n,o){this.id=t,this.userId=e,this.referentId=n,this.isNew=o}}var Pe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},De=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Oe(t,e,n,o,i){return De(this,void 0,void 0,(function*(){var r=new Ue(e,t,n,e,o,e,i,e,"",!1);return yield function(t){return Pe(this,void 0,void 0,(function*(){try{if(0==(t=Fe.GetCharacter(t.data)).id){var e=I();const o=yield fetch(w.CreateTheCharacterDataUrl(),{method:"POST",headers:e,body:JSON.stringify(t)});if(!o.ok)throw R(o),new Error(`Error! status: ${o.status}`);const i=yield o.json();var n=new Ue(i.userId,t.data,0,0,4,4,999,999,"",!1);return n.id=i.id,Fe.AddCharacter(n),i}return new Be(t.id,t.userId,0,!1)}catch(t){throw t instanceof Error?console.log("create the character error message: ",t.message):console.log("create the character unexpected error: ",t),t}}))}(r)}))}var Ee=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ve(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return Ee(this,void 0,void 0,(function*(){var y=yield Wt(t,i),v=y;return 0==v.id&&(v=y=yield qt(t,e,n,o,i,r,c,a,s,l,d,u,h,f)),v}))}var be=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},He=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Me(t,e,n,o){return He(this,void 0,void 0,(function*(){var i=o,r=yield dt(t);if(r&&(0==r.id||0==r.userId)){var c=T(t);if(c.length>0)if(console.log(c),c[0]==t){var a=yield function(t,e,n,o,i,r){return be(this,void 0,void 0,(function*(){var c=e,a=e;i=e;var s,l=e,d=e,u=e;if(1==t.length){var h=t.charCodeAt(0);yield Oe(t,e,n,o,r),s=Ve(t,e,4,c,h,u,49,l,n,a,o,i,r,d)}else{var f=yield Oe(t,e,n,o,r);f.isNew,s=yield Ve(t,e,4,c,51,l,f.id,f.userId,n,a,o,i,r,d)}return s}))}(t,o,999,999,i,e);r=a}else{var s=yield Me(c[0],e,n,o),l=yield Me(c[1],e,n,o);l&&(r=yield Xt(t,o,s.id,o,l.id,o,999,o,999,o,999,o,e,o))}}return r}))}var We=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},je=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function $e(t){return je(this,void 0,void 0,(function*(){let e=v();if("the"==t)return e.id=1,e.typeId=5,e.characterValue="the",e;var n=T(t);if(n.length>1){let o=1,i=yield $e(n[0]);0!=i.id&&(o=i.id),e=yield function(t,e){return je(this,void 0,void 0,(function*(){let n=yield m.GetConceptByCharacterAndCategoryLocal(t,e);return 0==n.id&&(n=yield function(t,e){return We(this,void 0,void 0,(function*(){let n=v();try{var o=I("application/x-www-form-urlencoded");const i=yield fetch(w.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:o,body:`character_value=${t}&category_id=${e}`});return i.ok?(n=yield i.json(),m.AddConcept(n)):(console.log("This is the concept by category and character error",i.status),R(i)),n}catch(t){throw t instanceof Error?console.log(" This is the concept by category and character error message: ",t.message):console.log(" This is the concept by category and character unexpected error: ",t),t}}))}(t,e)),n}))}(t,o)}else n[0]==t&&(e=yield function(t){return je(this,void 0,void 0,(function*(){var e=yield m.GetConceptByCharacterAndTypeLocal(t,51);return 0==e.id&&(e=yield st(t)),e}))}(t));return e}))}var Je=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ke(t,e){return Je(this,void 0,void 0,(function*(){let e=v();try{if(e=yield $e(t),0==e.id||4==e.typeId){var n=I("application/x-www-form-urlencoded");const o=yield fetch(w.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${t}`});if(!o.ok)throw R(o),new Error(`Error! status: ${o.status}`);e=yield o.json()}return e}catch(t){throw t instanceof Error?console.log("Make The Type Concept Api error : ",t.message):console.log("Make The Type Concept Api error : ",t),t}}))}var Qe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},ze=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},qe=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Xe(t){return qe(this,void 0,void 0,(function*(){for(var e=yield function(t){return Qe(this,void 0,void 0,(function*(){var e=[];try{(new Date).getTime();var n=I("application/x-www-form-urlencoded");const r=yield fetch(w.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${t}`,{method:"GET",headers:n});if(r.ok){const t=yield r.json();for(var o=0;o<t.length;o++){var i=t[o];e.push(i)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),R(r);return e}catch(t){throw t instanceof Error?console.log("Get all linker connection from the concepts error: ",t.message):console.log("Get all linker connection from the concepts error(Unexpected): ",t),t}}))}(t),n=0;n<e.length;n++){let t=e[n];var o=t.typeId;let i=yield Ie(o);t.type=i}return e}))}function Ye(t){return qe(this,void 0,void 0,(function*(){for(var e=yield function(t){return ze(this,void 0,void 0,(function*(){var e=[];try{(new Date).getTime();var n=I("application/x-www-form-urlencoded");const r=yield fetch(w.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${t}`,{method:"GET",headers:n});if(r.ok){const t=yield r.json();for(var o=0;o<t.length;o++){var i=t[o];e.push(i)}}else console.log("Get all linker connection To the concepts error","cannot get respone"),R(r);return e}catch(t){throw t instanceof Error?console.log("Get all linker connection To the concepts error: ",t.message):console.log("Get all linker connection To the concepts error(Unexpected): ",t),t}}))}(t),n=0;n<e.length;n++){let t=e[n];var o=t.typeId;let i=yield Ie(o);t.type=i}return e}))}var Ze=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},tn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function en(t){return tn(this,void 0,void 0,(function*(){var e=yield Ie(t);yield f.removeNodeFromTree(t);var n=e.typeId,o=e.characterValue;yield g.removeTypeConcept(n,t),yield u.removeNodeByCharacter(o,t),function(t){Ze(this,void 0,void 0,(function*(){try{const e=new FormData;e.append("id",t.toString());const n=yield fetch(w.DeleteConceptUrl(),{method:"POST",body:e});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`)}catch(t){throw t instanceof Error?console.log("Delete concept error message: ",t.message):console.log("Delete concept unexpected error: ",t),t}}))}(t)}))}var nn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function on(t,e){return nn(this,void 0,void 0,(function*(){try{const n=new Headers;n.append("Authorization","Bearer "+e);const o=new FormData;o.append("id",t.toString());const i=yield fetch(w.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw R(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(t){throw t instanceof Error?console.log("Delete composition error message: ",t.message):console.log("Delete composition unexpected error: ",t),t}}))}var rn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function cn(t,e,n,o,i=999){return rn(this,void 0,void 0,(function*(){var o,i=n,r=n,c=n,a=t.startsWith("the_"),s=v();return o=a?t:"the_"+t,s=yield Ke(o),yield Ve(e,n,4,n,s.id,s.userId,0,999,999,i,4,c,999,r)}))}class an{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=[]}}var sn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function ln(t=[]){return sn(this,void 0,void 0,(function*(){var e=[];try{var n=[];for(let o=0;o<t.length;o++){let i=yield O.GetConnection(t[o]);0==i.id?n.push(t[o]):e.push(i)}if(0==n.length)return e;{var o=I();const t=yield fetch(w.GetConnectionBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(n)});if(t.ok){const n=yield t.json();if(n.length>0){for(let t=0;t<n.length;t++){let o=n[t];e.push(o),O.AddConnection(o)}yield H(e)}}else console.log("Get Connection Bulk error",t.status),R(t);return e}}catch(t){throw t instanceof Error?console.log("Get Connection Bulk error message: ",t.message):console.log("Get Connection Bulk unexpected error: ",t),t}}))}var dn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function un(t=[]){return dn(this,void 0,void 0,(function*(){yield J(t);var e=[];for(let o=0;o<t.length;o++){var n=yield et(t[o]);e.push(n)}return e}))}function hn(t=[]){return dn(this,void 0,void 0,(function*(){yield J(t);var e=[];for(let o=0;o<t.length;o++){var n=yield nt(t[o]);e.push(n)}return e}))}function fn(t=[],e=[]){return dn(this,void 0,void 0,(function*(){yield ln(e);var n=yield W(t);!function(t=[],e=[]){for(let n=0;n<e.length;n++)t.includes(e[n].id)||O.RemoveConnection(e[n])}(e,n);var o=[];for(let e=0;e<t.length;e++){var i=yield nt(t[e]);o.push(i)}return o}))}function yn(t=[],e=[]){return dn(this,void 0,void 0,(function*(){let n=[];for(let t=0;t<e.length;t++)0==(yield O.GetConnection(e[t])).id&&n.push(e[t]);yield ln(n);var o={};for(let e=0;e<t.length;e++){var i=yield nt(t[e]);o[t[e]]=i}return o}))}var vn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function pn(t=0,e=[],n=""){return vn(this,void 0,void 0,(function*(){var o=[];try{var i=new an;i.composition=t,i.listLinkers=e,i.textSearch=n;var r=JSON.stringify(i),c=I();const l=yield fetch(w.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(l.ok){const t=yield l.json();var a=t.compositionIds,s=t.internalConnections;t.externalConnections,o=yield fn(a,s)}else console.log("recursive search error ",l.status),R(l);return o}catch(t){throw t instanceof Error?console.log("recursive search error message: ",t.message):console.log("recursive search unexpected error: ",t),t}}))}var gn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Nn(t,e){return gn(this,void 0,void 0,(function*(){try{var n={email:t,password:e},o=new Headers;o.append("Content-Type","application/json");var i=JSON.stringify(n);const r=yield fetch(w.LoginUrl(),{method:"POST",headers:o,body:i});if(r.ok){const t=yield r.json();return k.BearerAccessToken=t.data.token,t}console.log("Login tsccs error message: ",r.status),R(r)}catch(t){throw t instanceof Error?console.log("Login tsccs error message: ",t.message):console.log(" Login tsccs unexpected error: ",t),t}}))}var mn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Cn(t){return mn(this,void 0,void 0,(function*(){return yield function(t="",e={}){return mn(this,void 0,void 0,(function*(){let n={message:"success",status:!1,statusCode:200,data:""};try{const o=yield fetch(t,{method:"POST",mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{"Content-Type":"application/json"},redirect:"follow",referrerPolicy:"no-referrer",body:JSON.stringify(e)}),i=yield o.json();return o.ok?n={message:"success",status:!0,statusCode:200,data:i}:R(o),n}catch(t){throw console.log("Signup Error: ",t),t}}))}(w.SignupUrl(),t)}))}var Tn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function wn(t){return Tn(this,void 0,void 0,(function*(){const e=JSON.stringify({email:t.email,password:t.password});let n={message:"success",status:!1,statusCode:200,data:""};const o=new Headers;o.append("Content-Type","application/json");const i=w.LoginUrl();try{const t=yield fetch(i,{method:"POST",headers:o,body:e,redirect:"follow"}),r=yield t.json();return t.ok?n={message:"success",status:!0,statusCode:200,data:null==r?void 0:r.data}:R(t),n}catch(t){throw console.log("Sign in api error",t),t}}))}function kn(t,e){return-1===t.indexOf(e)&&t.push(e),t}function In(t=[],e){var n,o;let i=[],r=null===(n=e.type)||void 0===n?void 0:n.characterValue;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(t))for(let n=0;n<t.length;n++){let c=null===(o=t[n].type)||void 0===o?void 0:o.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),e.typeId!=t[n].typeId&&r!=c||i.push(t[n])}return i}function An(t=[],e){let n=[],o=e.typeCharacter;if((null==o?void 0:o.startsWith("the_"))||(o="the_"+o),Array.isArray(t))for(let i=0;i<t.length;i++){let r=t[i].typeCharacter;(null==r?void 0:r.startsWith("the_"))||(r="the_"+r),e.typeId!=t[i].typeId&&o!=r||n.push(t[i])}return n}function xn(t=[],e){let n=[];if(Array.isArray(t)){const o=t.find((t=>t.toTheConceptId==e));o&&n.push(o);const i=t.find((t=>t.ofTheConceptId==e));i&&n.push(i)}return n}function Rn(t=[],e){let n=[];if(Array.isArray(t)){const o=t.find((t=>t.toTheConceptId==e));o&&n.push(o);const i=t.find((t=>t.ofTheConceptId==e));i&&n.push(i)}return n}function Sn(t=[],e){Array.isArray(t)&&t.splice(t.findIndex((function(t){return t.id===e.id})),1)}function Ln(t=[],e){Array.isArray(t)&&t.splice(t.findIndex((function(t){return t.id===e.id})),1)}class Gn{constructor(t,e,n,o){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=t,this.value=e,this.leftNode=n,this.rightNode=o}isValid(){const t=new Date(Date.now());return!(this.expiryTime<t&&(Un.removeNodeFromTree(this.key),1))}saveToCache(t){this.value.cached=t}addNode(t,e,n){if(null==e)return t;const o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addNode(t,o,n);else{if(!(e.key<t.key))return this.isValid(),t;e.rightNode=this.addNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));const r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}return this.isValid(),e}rightRotate(t){if(t){const e=t.leftNode;if(e){const n=e.rightNode;return t.leftNode=n,e.rightNode=t,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,e}}return t}leftRotate(t){if(t){const e=t.rightNode;if(e){const n=e.leftNode;return e.leftNode=t,t.rightNode=n,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(t.rightNode))+1,e}}return t}getHeight(t){return t?t.height:0}getBalanceFactor(t){return null==t?0:this.getHeight(t.leftNode)-this.getHeight(t.rightNode)}getFromNode(t,e){return e?t==e.key&&e.isValid()?e:t<e.key?this.getFromNode(t,e.leftNode):t>e.key?this.getFromNode(t,e.rightNode):e:e}removeNode(t,e){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNode(t.leftNode,e),t;if(t.key<e)return t.rightNode=this.removeNode(t.rightNode,e),t;if(null==t.leftNode){const e=t.rightNode;return t=null,e}if(null==t.rightNode){const e=t.leftNode;return t=null,e}{const e=this.inOrderSuccessor(t.rightNode);return t.value=e.value,t.key=e.key,t.rightNode=this.removeNode(t.rightNode,e.key),t}}countNodeBelow(t){return null==t?0:1+this.countNodeBelow(t.leftNode)+this.countNodeBelow(t.rightNode)}inOrderSuccessor(t){for(;null!=t.leftNode;)t=t.leftNode;return t}}var _n=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Un{static addNodeToTree(t){if(null==this.root)return this.root=t,this.root;this.root=this.root.addNode(t,this.root,this.root.height)}static addCompositionToTree(t){const e=new Gn(t.id,t,null,null);this.addNodeToTree(e)}static getNodeFromTree(t){return _n(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(t,this.root):null}))}static removeNodeFromTree(t){return _n(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,t))}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}Un.root=null;var Fn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Bn(t,e,n,o,i=[]){var r,c;return Fn(this,void 0,void 0,(function*(){let a={};const s=[];if(0==t)return"";let l=Pn(n,t);if(null!=l&&0!=l.id||null==t||null==t||(l=yield Ie(t)),0!=l.id&&null==l.type){const t=l.typeId;let e=Pn(n,t);l.type=e,null==e&&null!=t&&null!=t&&(e=yield Ie(t),l.type=e)}if(!o.includes(t))return null==l?void 0:l.characterValue;if(i.includes(t))return"";i.push(t);for(let l=0;l<e.length;l++)if(e[l].ofTheConceptId==t){const d=e[l].toTheConceptId;if(o.includes(t)){let t=Pn(n,d);if(null!=t&&0!=t.id||null==d||null==d||(t=yield Ie(d)),0!=t.id&&null==(null==t?void 0:t.type)){const e=t.typeId;let n=yield m.GetConcept(e);t.type=n,null==n&&null!=e&&null!=e&&(n=yield Ie(e),t.type=n)}const l="the_",u=(null!==(c=null===(r=null==t?void 0:t.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace(l,"");if(isNaN(Number(u))){if(u){const t=yield Bn(d,e,n,o,i);a[u]=t}}else{const t=yield Bn(d,e,n,o,i);s[u]=t,a=s}}}return a}))}function Pn(t,e){let n=v();for(let o=0;o<t.length;o++)if(e==t[o].id)return n=t[o],n;return n}class Dn{constructor(){this.id=0,this.mainConcept=v(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return t=this,e=void 0,o=function*(){if(0==this.mainConcept.id)for(let t=0;t<this.concepts.length;t++)this.concepts[t].id==this.id&&(this.mainConcept=this.concepts[t]);this.cached=yield Bn(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}));var t,e,n,o}UpdateAcrossDistributedSystem(){var t,e;try{0!=this.id&&("compositionUpdate",e=null===(t=this.id)||void 0===t?void 0:t.toString(),w.MQTT_CONNECTION&&w.MQTT_CONNECTION.publish("compositionUpdate",e))}catch(t){console.log("Error while publishing message",t)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var t,e,n;const o={};o[null!==(n=null===(e=null===(t=this.mainConcept)||void 0===t?void 0:t.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:""]=this.cached;const i={};return i.data=o,i.id=this.id,i}}var On=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function En(t,e=null,n=null,o=null,i=null,r=null,c=null,a=null){return On(this,void 0,void 0,(function*(){const s=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let u=null!=o?o:0,h=v();null==a&&(a=new Dn);for(const o in t)if("object"==typeof t[o]||Array.isArray(t[o])){const f=yield Zt(o,"",!0,s,l,d);if(null==e&&null==n){let e=u;h=f,e=f.id,u=f.id,a.concepts.push(f),a.id=f.id,yield En(t[o],f.id,f.userId,e,i,r,c,a)}else{const s=null!=e?e:999,l=null!=n?n:999,y=u;h=f,a.concepts.push(f);const v=yield bt(s,l,f.id,f.userId,y,d,f.userId);a.connections.push(v),yield En(t[o],f.id,f.userId,y,i,r,c,a)}null!=t[o]&&null!=t[o]&&a.subcompositions.push(f.id)}else{const i=null!=e?e:999,r=null!=n?n:999,c=u,h=yield Zt(o,t[o],!1,s,l,d);a.concepts.push(h);const f=yield bt(i,r,h.id,h.userId,c,d,h.userId);a.connections.push(f)}return h}))}var Vn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function bn(t){return Vn(this,void 0,void 0,(function*(){const e=t.userId,n=t.sessionId,o=t.accessId;let i=[];const r=[];let c=v(),a=v();const s=[];let l=t.compositionId;const d=t.ofTheCompositionId;let u=[];if(l<0){let t=yield Ie(l,e);if(!(t.id>0))return null;l=t.id}i=yield q(l);const h=[],f=new Dn,y=[];f.id=l,f.isUpdating();let p=[];for(let t=0;t<i.length;t++)kn(y,i[t].ofTheConceptId),kn(h,i[t].ofTheConceptId),kn(h,i[t].toTheConceptId),p.push(i[t].ofTheConceptId);f.subcompositions=y,f.connections=i;for(let t=0;t<h.length;t++){const e=yield Ie(h[t]);l==h[t]&&(c=e),d==h[t]&&(a=e),r.push(e)}const g=t.patchObject;for(const t in g){let i=v();const l=g[t];let d=c;if(a.id>0&&(d=a),Array.isArray(l)||"object"==typeof l){i=yield Zt(t,"",!0,c.userId,4,999),f.subcompositions.push(i.id);const e=In(r,i);for(let t=0;t<e.length;t++)if(e[t].id>0){const n=xn(f.connections,e[t].id);u=u.concat(n),s.push(e[t])}yield En(g[t],i.id,i.userId,c.id,c.userId,4,999,f)}else{i=yield Zt(t,l,!1,e,o,n);const c=In(r,i);for(let t=0;t<c.length;t++)if(c[t].id>0){const e=xn(f.connections,c[t].id);u=u.concat(e),s.push(c[t])}}const h=bt(d.id,d.userId,i.id,i.userId,c.id,n,e);r.push(i),f.connections.push(h)}for(let t=0;t<u.length;t++)Ln(f.connections,u[t]),we(u[t].id);for(let t=0;t<s.length;t++)Sn(r,s[t]);return f.concepts=f.concepts.concat(r),f.mainConcept=c,f.id=c.id,yield f.updateCache(),Un.addCompositionToTree(f),Vt.SyncDataOnline(),f.GetDataCache()}))}var Hn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Mn(t,e,n,o,i=10,r=1){return Hn(this,void 0,void 0,(function*(){var c=A("application/x-www-form-urlencoded",o),a=new URLSearchParams;a.append("type",t),a.append("search",e),a.append("composition",n),a.append("inpage",i.toString()),a.append("page",r.toString());const s=w.SearchCompositionsUrl()+"?"+a.toString();try{const t=yield fetch(s,{method:"GET",headers:c});return t.ok?yield t.json():(R(t),[])}catch(t){throw console.log("This is the searching error",t),t}}))}var Wn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function jn(t,e=""){return Wn(this,void 0,void 0,(function*(){var n=A("application/json",e);const o=w.SearchLinkMultipleAll(),i=JSON.stringify(t);try{const t=yield fetch(o,{method:"POST",headers:n,body:i});return t.ok?yield t.json():(console.log("This is the searching error",t.status),R(t),[])}catch(t){throw console.log("This is the searching error",t),t}}))}var $n=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Jn(t,e=[]){var n,o;return $n(this,void 0,void 0,(function*(){let i=[];const r=[];let c={},a={};const s=yield Un.getNodeFromTree(t),l=[];let d=yield m.GetConcept(t);if(0==d.id&&null!=t&&null!=t&&(d=yield Q(t)),null==s){let s=[];s=e.length>0?Kn(t,e):yield q(t),i=s;for(let t=0;t<i.length;t++)l.includes(i[t].ofTheConceptId)||(l.push(i[t].ofTheConceptId),r.push(i[t].ofTheConceptId)),r.includes(i[t].toTheConceptId)||r.push(i[t].toTheConceptId);qn(d,i,r,l);let u=[];a=yield rt(t,i,l,u),c[null!==(o=null===(n=null==d?void 0:d.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a}else a=s.value.GetDataCache(),c=a;return 0==d.id?"":c}))}function Kn(t,e){const n=[];for(let o=0;o<e.length;o++)e[o].typeId==t&&n.push(e[o]);return n}function Qn(t,e=[]){var n,o;return $n(this,void 0,void 0,(function*(){let i={},r=[];const c=[];let a;const s={},l=yield Un.getNodeFromTree(t),d=[];let u=yield m.GetConcept(t);if(0==u.id&&null!=t&&null!=t&&(u=yield Q(t)),null==l){let l=[];l=e.length>0?Kn(t,e):yield q(t),r=l;for(let t=0;t<r.length;t++)d.includes(r[t].ofTheConceptId)||(d.push(r[t].ofTheConceptId),c.push(r[t].ofTheConceptId)),c.includes(r[t].toTheConceptId)||c.push(r[t].toTheConceptId);qn(u,r,c,d),a=yield rt(t,r,d),s[null!==(o=null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a,i.created_at=u.entryTimeStamp,i.data=s,i.id=t}else a=l.value.GetDataCache(),i=a;return 0==u.id?"":i}))}function zn(t,e){return $n(this,void 0,void 0,(function*(){let n=[];const o=[];n=yield ln(e);for(let e=0;e<t.length;e++){const i=yield Qn(t[e],n);i&&o.push(i)}return o}))}function qn(t,e,n,o){return $n(this,void 0,void 0,(function*(){const i=new Dn,r=yield function(t){return $n(this,void 0,void 0,(function*(){let e=[];const n=[];for(let o=0;o<(null==t?void 0:t.length);o++){const i=yield m.GetConcept(t[o]);0==i.id?n.push(t[o]):e.push(i)}return 0==(null==n?void 0:n.length)||(e=yield function(t){return E(this,void 0,void 0,(function*(){const e=[];if(t.length>0){const n={"Content-Type":"application/json"};try{const o=yield fetch(w.GetConceptBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(t)});if(o.ok){const t=yield o.json();if(t.length>0)for(let n=0;n<t.length;n++){const o=t[n];e.push(o),m.AddConcept(o)}}else R(o)}catch(t){throw t instanceof Error?console.log("bulk concept getter api error: ",t.message):console.log("bulk concept getter api error: ",t),t}}return e}))}(n)),e}))}(n);i.connections=e,i.concepts=r,i.id=t.id,i.subcompositions=o,i.mainConcept=t;const c=yield Bn(t.id,e,r,o,[]);i.cached=c,Un.addCompositionToTree(i)}))}var Xn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Yn(t){return Xn(this,void 0,void 0,(function*(){try{var e=I();const n=JSON.stringify(t),o=yield fetch(w.CreateSessionId(),{method:"POST",headers:e,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),R(o),null)}catch(t){throw console.log("Creating session failed",t),t}}))}var Zn=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function to(t,e){return Zn(this,void 0,void 0,(function*(){try{var n=I("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",t.toString()),o.append("url",e);const i=yield fetch(w.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),R(i),null)}catch(t){throw console.log("Creating session url failed",t),t}}))}var eo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function no(t,e,n=10,o=1){return eo(this,void 0,void 0,(function*(){var i=[],r=yield Ie(t),c=yield $e(e);if(c.id>0){for(var a=yield ye(c.id,r.id,r.userId,n,o),s=[],l=0;l<a.length;l++)s.push(a[l].toTheConceptId);for(yield J(s),l=0;l<a.length;l++){let t=a[l].toTheConceptId,e=yield Ie(t),n=yield ot(e.id);i.push(n)}}return i}))}function oo(t,e,n=10,o=1){return eo(this,void 0,void 0,(function*(){var i=[],r=yield Ie(t),c=yield $e(e);if(c.id>0){for(var a=yield ye(c.id,r.id,r.userId,n,o),s=[],l=0;l<a.length;l++)s.push(a[l].toTheConceptId);for(l=0;l<a.length;l++){let t=a[l].toTheConceptId,e=yield Ie(t);i.push(e)}}return i}))}class io{constructor(t,e,n,o,i){this.connectionValue=[],this.value=[],this.height=1,this.key=t,e.id>0&&this.value.push(e),n.id>0&&this.connectionValue.push(n),this.leftNode=o,this.rightNode=i}addNode(t,e,n){if(null==e)return t;var o=e.leftNode,i=e.rightNode;if(e.key>t.key)e.leftNode=this.addNode(t,o,n);else{if(!(e.key<t.key))return e.value.push(...t.value),e.connectionValue.push(...t.connectionValue),e;e.rightNode=this.addNode(t,i,n)}e.height=1+Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode));let r=this.getBalanceFactor(e);if(r>1&&e.leftNode){if(t.key<e.leftNode.key)return this.rightRotate(e);if(t.key>e.leftNode.key)return e.leftNode=this.leftRotate(e.leftNode),this.rightRotate(e)}if(r<-1&&e.rightNode){if(t.key>e.rightNode.key)return this.leftRotate(e);if(t.key<e.rightNode.key)return e.rightNode=this.rightRotate(e.rightNode),this.leftRotate(e)}return e}rightRotate(t){if(t){let e=t.leftNode;if(e){let n=e.rightNode;return t.leftNode=n,e.rightNode=t,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(e.rightNode))+1,e}}return t}leftRotate(t){if(t){let e=t.rightNode;if(e){let n=e.leftNode;return e.leftNode=t,t.rightNode=n,t.height=Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode))+1,e.height=Math.max(this.getHeight(e.leftNode),this.getHeight(t.rightNode))+1,e}}return t}getHeight(t){return t?t.height:0}getBalanceFactor(t){return null==t?0:this.getHeight(t.leftNode)-this.getHeight(t.rightNode)}getFromNode(t,e){return e?t==e.key?e:t<e.key?this.getFromNode(t,e.leftNode):t>e.key?this.getFromNode(t,e.rightNode):e:e}removeNode(t,e){if(null==t)return t;if(t.key>e)return t.leftNode=this.removeNode(t.leftNode,e),t;if(t.key<e)return t.rightNode=this.removeNode(t.rightNode,e),t;if(null==t.leftNode){let e=t.rightNode;return t=null,e}if(null==t.rightNode){let e=t.leftNode;return t=null,e}var n=this.inOrderSuccessor(t.rightNode);return t.value=n.value,t.key=n.key,t.rightNode=this.removeNode(t.rightNode,n.key),t}countNodeBelow(t){return null==t?0:1+this.countNodeBelow(t.leftNode)+this.countNodeBelow(t.rightNode)}inOrderSuccessor(t){for(;null!=t.leftNode;)t=t.leftNode;return t}}var ro=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class co{static compositeKey(t,e,n=999){return("0000"+t.toString(16).toUpperCase()).slice(-4)+("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+n.toString(16).toUpperCase()).slice(-4)}static addNodeToTree(t){if(null==this.root)return this.root=t,this.root;this.root=this.root.addNode(t,this.root,this.root.height)}static waitForDataToLoad(){return ro(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{this.checkFlag(t),setTimeout((()=>{e("not")}),25e3)}))}))}static checkFlag(t){if(s.isDataLoaded)return t("done");setTimeout(co.checkFlag,1e3,t)}static addConceptToTree(t,e,n=999){let o=this.compositeKey(e,n,t.applicationId),i=new ne(0,0,0,0,0,0);var r=new io(o,t,i,null,null);this.addNodeToTree(r)}static addConnectionToTree(t,e,n=999){let o=this.compositeKey(e,n,t.applicationId),i=wt();var r=new io(o,i,t,null,null);this.addNodeToTree(r)}static getNodeFromTree(t,e,n=999){return ro(this,void 0,void 0,(function*(){let o=this.compositeKey(t,e,n);return this.root?this.root.getFromNode(o,this.root):null}))}static removeNodeFromTree(t,e=999,n=999){return ro(this,void 0,void 0,(function*(){if(this.root){let o=this.compositeKey(t,e,n);this.root=this.root.removeNode(this.root,o)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}co.root=null;var ao=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function so(t,e,n=999,o=999){return ao(this,void 0,void 0,(function*(){let i=yield co.getNodeFromTree(t,n,o),r=wt();if(i)for(let t=0;t<i.value.length;t++){let n=i.value[t];n.ghostId==e&&(r=n)}return r}))}function lo(t,e,n=999,o=999){return ao(this,void 0,void 0,(function*(){let i=yield co.getNodeFromTree(t,n,o),r=new ne(0,0,0,0,0,0);if(i)for(let t=0;t<i.connectionValue.length;t++){let n=i.connectionValue[t];n.ghostId==e&&(r=n)}return r}))}function uo(t,e,n=999){return ao(this,void 0,void 0,(function*(){co.addConceptToTree(t,e,n)}))}function ho(t,e,n=999){return ao(this,void 0,void 0,(function*(){co.addConnectionToTree(t,e,n)}))}var fo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},yo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function vo(t,e=""){return yo(this,void 0,void 0,(function*(){let n=[],o=yield function(t,e=""){return fo(this,void 0,void 0,(function*(){var n=A("application/json",e);const o=w.SearchLinkMultipleAllApiUrl(),i=JSON.stringify(t);try{const t=yield fetch(o,{method:"POST",headers:n,body:i});return t.ok?yield t.json():(console.log("This is the searching multiple error",t.status),R(t),[])}catch(t){throw console.log("This is the searching multiple error",t),t}}))}(t,e),i=t[0].composition;const r=o;let c=r.compositionIds,a=r.internalConnections,s=r.linkers,l=r.reverse;return n=yield yn(c,a),yield po(s,n,i,l)}))}function po(t,e,n,o=[]){return yo(this,void 0,void 0,(function*(){let i={},r=yield ln(t);for(let t=0;t<r.length;t++){let n=!1;if(o.includes(r[t].id)&&(n=!0),1==n){if(e[r[t].ofTheConceptId]&&e[r[t].toTheConceptId]){let n=e[r[t].toTheConceptId],o=yield Ie(r[t].typeId),i=null==n?void 0:n.data,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(e[r[t].ofTheConceptId])}catch(t){console.log("this is error",t)}}}else if(e[r[t].ofTheConceptId]&&e[r[t].toTheConceptId]){let n=e[r[t].ofTheConceptId],o=yield Ie(r[t].typeId),i=null==n?void 0:n.data,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(e[r[t].toTheConceptId])}catch(t){console.log("this is error",t)}}}return i=e[n],i}))}function go(t){var e,n;const o=wt();return o.id=t.id,o.ghostId=t.ghostId,o.userId=t.userId,o.accessId=t.accessId,o.categoryId=t.categoryId,o.characterValue=t.characterValue,o.entryTimeStamp=t.entryTimeStamp,o.typeId=t.typeId,o.type=t.type,o.isTemp=!1,o.typeCharacter=null!==(n=null===(e=null==t?void 0:t.type)||void 0===e?void 0:e.characterValue)&&void 0!==n?n:"",o}function No(t){const e=v();return e.id=t.id,e.ghostId=t.ghostId,e.userId=t.userId,e.accessId=t.accessId,e.entryTimeStamp=t.entryTimeStamp,e.typeId=t.typeId,e.categoryId=t.categoryId,e.characterValue=t.characterValue,e}function mo(t){const e=new ne(0,0,0,0,0,0);return e.id=t.id,e.ghostId=t.ghostId,e.accessId=t.accessId,e.ofTheConceptId=t.ofTheConceptId,e.toTheConceptId=t.toTheConceptId,e.entryTimeStamp=t.entryTimeStamp,e.typeId=t.typeId,e.isTemp=!1,e}var Co=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function To(t){return Co(this,void 0,void 0,(function*(){const e=t.userId,n=t.sessionId;t.accessId;let o=[];const i=[];let r=wt(),c=wt();const a=[],s=t.compositionId,l=t.ofTheCompositionId;let d=[],u=yield q(s);for(let t=0;t<u.length;t++)o.push(mo(u[t]));const h=[],f=[];let y=[];for(let t=0;t<o.length;t++)kn(f,o[t].ofTheConceptId),kn(h,o[t].ofTheConceptId),kn(h,o[t].toTheConceptId),y.push(o[t].ofTheConceptId);for(let t=0;t<h.length;t++){const e=yield Ie(h[t]);s==h[t]&&(r=go(e)),l==h[t]&&(c=go(e)),i.push(go(e))}const v=t.patchObject;for(const t in v){let s=wt();const l=v[t];let u=r;c.id>0&&(u=c),Array.isArray(l)||"object"==typeof l?(s=yield de(t,"",!0,r.userId,0,999),yield he(v[t],s.id,s.userId,r.id,r.userId,4,999)):s=yield de(t,l,!1,e,0,n);const h=An(i,s);for(let t=0;t<h.length;t++)if(h[t].id>0){const e=Rn(o,h[t].id);d=d.concat(e),a.push(h[t])}yield oe(u.id,s.id,r.id,2),i.push(s)}for(let t=0;t<d.length;t++)we(d[t].id);Vt.SyncDataOnline()}))}var wo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},ko=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Io(t){var e;return ko(this,void 0,void 0,(function*(){let n=yield function(t){return wo(this,void 0,void 0,(function*(){let e=[];try{var n=I();const o=yield fetch(w.ViewInternalDataUrl(),{method:"POST",headers:n,body:JSON.stringify(t)});if(o.ok){let t=yield o.json(),n={};for(let o=0;o<t.length;o++){let i=t[o].concepts;e=t[o].connections;let r=t[o].id;V(i),n[r]=e}return n}return console.log("View Internal Data error",o.status),R(o),e}catch(t){throw t instanceof Error?console.log(" This is the view internal data error message: ",t.message):console.log(" This is the view internal data unexpected error: ",t),t}}))}(t),o=[];for(let i=0;i<t.length;i++){let r=t[i],c=n[r];if(r&&c){let t=[],e={};for(let e=0;e<c.length;e++)t.includes(c[e].ofTheConceptId)||t.push(c[e].ofTheConceptId);let n=yield rt(r,c,t);e.data=n,e.id=r,o.push(e)}else{let t={};t.id=r;let n=yield Ie(r),i={};n.type&&(i[null===(e=null==n?void 0:n.type)||void 0===e?void 0:e.characterValue]=n.characterValue,t.data=i,o.push(t))}}return o}))}var Ao=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},xo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Ro(t,e=""){return xo(this,void 0,void 0,(function*(){var n=yield function(t,e=""){return Ao(this,void 0,void 0,(function*(){var n=A("application/json",e);let o=w.SearchInternalWithAuthenticatedCcsUrl();o=o+"?composition="+t.composition+"&search="+t.search+"&internalComposition="+t.internalComposition+"&type="+t.type+"&inpage="+t.inpage+"&page="+t.page;try{const t=yield fetch(o,{method:"GET",headers:n});return t.ok?yield t.json():(console.log("This is the searching internal error",t.status),R(t),[])}catch(t){throw console.log("This is the searching internal error",t),t}}))}(t,e);return yield Io(n)}))}class So{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class Lo{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=""}}class Go{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0}}class _o{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1}}var Uo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};var Fo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))},Bo=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};class Po{}Po.isUpdated=!1,Po.isOnlineSync=!1;var Do=function(t,e,n,o){return new(n||(n=Promise))((function(i,r){function c(t){try{s(o.next(t))}catch(t){r(t)}}function a(t){try{s(o.throw(t))}catch(t){r(t)}}function s(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(c,a)}s((o=o.apply(t,e||[])).next())}))};function Oo(t=""){k.BearerAccessToken=t}function Eo(t="",e="",o=""){w.BASE_URL=t,w.AI_URL=e,console.log("This ist he base url",w.BASE_URL),k.BearerAccessToken=o,function(){return Do(this,void 0,void 0,(function*(){return yield new n(!0),yield function(){return Bo(this,void 0,void 0,(function*(){try{(new Date).getTime();var t=A("application/x-www-form-urlencoded");const n=yield fetch(w.GetAllAiData(),{method:"GET",headers:t});n.ok||(console.log("Ai Error Message: ","Cannot get response"),R(n));const o=yield n.json();for(var e=0;e<o.length;e++)m.AddConcept(o[e])}catch(t){throw t instanceof Error?console.log("Ai Error Message: ",t.message):console.log("Ai Error Message: ",t),t}}))}(),!0}))}().then((()=>{const t=(new Date).getTime();(function(){return C(this,void 0,void 0,(function*(){(new Date).getTime();var t=yield c();if(Array.isArray(t))for(var e=0;e<t.length;e++){let n=t[e];m.AddConceptToMemory(n)}(new Date).getTime()}))})().then((()=>{s.isDataLoaded=!0,s.isCharacterLoaded=!0,s.isTypeLoaded=!0;let e=(new Date).getTime()-t;console.log("The time taken to prepare concept data is ",e)})),function(){return Fo(this,void 0,void 0,(function*(){var t=yield a();if(Array.isArray(t))for(var e=0;e<t.length;e++){let n=t[e];It.AddConceptToMemory(n)}}))}().then((()=>{s.isLocalDataLoaded=!0,s.isLocalTypeLoaded=!0,s.isLocalCharacterLoaded=!0;let e=(new Date).getTime()-t;console.log("The time taken to prepare local concept ",e)})),function(){return Uo(this,void 0,void 0,(function*(){!function(){Uo(this,void 0,void 0,(function*(){var t=yield a();if(Array.isArray(t))for(var e=0;e<t.length;e++)xt.AddConnection(t[e])}))}()}))}().then((()=>{s.isLocalConnectionLoaded=!0})),function(){return Uo(this,void 0,void 0,(function*(){!function(){Uo(this,void 0,void 0,(function*(){var t=yield c();if(Array.isArray(t))for(var e=0;e<t.length;e++)O.AddConnectionToMemory(t[e])}))}()}))}().then((()=>{s.isConnectionLoaded=!0,s.isConnectionTypeLoaded=!0;let e=(new Date).getTime()-t;console.log("The time taken to prepare connections ",e)}))}))}var Vo=exports;for(var bo in e)Vo[bo]=e[bo];e.__esModule&&Object.defineProperty(Vo,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{AddGhostConcept:()=>ho,AddGhostConnection:()=>fo,BaseUrl:()=>w,BinaryTree:()=>f,Composition:()=>Dn,CompositionBinaryTree:()=>Fn,CompositionNode:()=>Gn,Concept:()=>y,ConceptsData:()=>C,Connection:()=>L,ConnectionData:()=>D,CreateComposition:()=>tt,CreateConnectionBetweenTwoConcepts:()=>xt,CreateConnectionBetweenTwoConceptsGeneral:()=>St,CreateDefaultConcept:()=>p,CreateDefaultLConcept:()=>we,CreateSession:()=>Zn,CreateSessionVisit:()=>to,CreateTheCompositionLocal:()=>ht,CreateTheCompositionWithCache:()=>On,CreateTheConnection:()=>be,CreateTheConnectionGeneral:()=>vt,CreateTheConnectionLocal:()=>ot,DeleteConceptById:()=>tn,DeleteConnectionById:()=>wt,FilterSearch:()=>Go,FormatFromConnections:()=>go,FreeSchemaResponse:()=>x,GetAllConnectionsOfComposition:()=>z,GetAllConnectionsOfCompositionBulk:()=>J,GetComposition:()=>Z,GetCompositionBulk:()=>un,GetCompositionBulkWithDataId:()=>hn,GetCompositionFromConnectionsWithDataId:()=>fn,GetCompositionFromConnectionsWithDataIdInObject:()=>pn,GetCompositionList:()=>he,GetCompositionListLocal:()=>Ve,GetCompositionListLocalWithId:()=>Pe,GetCompositionListWithId:()=>fe,GetCompositionLocal:()=>Se,GetCompositionLocalWithId:()=>_e,GetCompositionWithAllIds:()=>ee,GetCompositionWithCache:()=>Qn,GetCompositionWithDataIdBulk:()=>zn,GetCompositionWithDataIdWithCache:()=>qn,GetCompositionWithId:()=>ie,GetConceptBulk:()=>O,GetConceptByCharacter:()=>de,GetConnectionBulk:()=>ln,GetConnectionById:()=>Nt,GetConnectionOfTheConcept:()=>yt,GetLink:()=>Lt,GetLinkRaw:()=>Gt,GetLinkerConnectionFromConcepts:()=>Xt,GetLinkerConnectionToConcepts:()=>Yt,GetRelation:()=>oo,GetRelationRaw:()=>io,GetTheConcept:()=>kt,GetUserGhostConnectionId:()=>uo,GetUserGhostId:()=>lo,HandleHttpError:()=>R,LConcept:()=>Te,LConnection:()=>nt,LoginToBackend:()=>Cn,MakeTheInstanceConcept:()=>Ze,MakeTheInstanceConceptLocal:()=>dt,MakeTheTimestamp:()=>cn,MakeTheTypeConcept:()=>Mt,MakeTheTypeConceptApi:()=>Qt,PatcherStructure:()=>_o,RecursiveSearchApi:()=>gn,SchemaQueryListener:()=>ti,SearchAllConcepts:()=>Wn,SearchLinkInternal:()=>So,SearchLinkMultipleAll:()=>vo,SearchQuery:()=>an,SearchStructure:()=>Uo,SearchWithLinker:()=>$n,SessionData:()=>Lo,Signin:()=>In,Signup:()=>Tn,SplitStrings:()=>T,SyncData:()=>Oe,TrashTheConcept:()=>on,UpdateComposition:()=>Hn,UpdateCompositionLocal:()=>wo,UserBinaryTree:()=>ao,ViewInternalData:()=>Ao,convertFromLConceptToConcept:()=>Co,getFromDatabaseWithType:()=>r,getFromDatabaseWithTypeOld:()=>c,init:()=>oi,recursiveFetch:()=>re,recursiveFetchNew:()=>Pn,storeToDatabase:()=>i,updateAccessToken:()=>ni});class n{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}var o=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function i(e,t){}function r(e,t,n){return o(this,void 0,void 0,(function*(){}))}function c(e){return o(this,void 0,void 0,(function*(){}))}function a(e){return o(this,void 0,void 0,(function*(){}))}class s{}s.isTypeLoaded=!1,s.isCharacterLoaded=!1,s.isDataLoaded=!1,s.isLocalDataLoaded=!1,s.isLocalCharacterLoaded=!1,s.isLocalTypeLoaded=!1,s.isConnectionLoaded=!1,s.isConnectionTypeLoaded=!1,s.isLocalConnectionLoaded=!1;class l{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}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}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}}var d=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class u{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(s.isCharacterLoaded)return e("done");setTimeout(u.checkFlag,1e3,e)}static addNodeToTree(e){return d(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 d(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 l(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 d(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return d(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))}}u.characterRoot=null;var h=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class f{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 h(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isDataLoaded)return e("done");setTimeout(f.checkFlag,1e3,e)}static addConceptToTree(e){var t=new l(e.id,e,null,null),n=new l(e.characterValue,e,null,null);u.addNodeToTree(n),this.addNodeToTree(t)}static getNodeFromTree(e){return h(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return h(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}}f.root=null;class y{constructor(e,t,n,o,i,r,c,a,s,l,d,u,h,f,y,p=!1,v,g){this.isTemp=!1,this.id=e,this.userId=t,this.typeId=n,this.typeUserId=o,this.ghostId=e,this.categoryId=i,this.categoryUserId=r,this.referentId=c,this.referent=c,this.referentUserId=a,this.characterValue=`${s}`,this.securityId=l,this.securityUserId=d,this.accessId=u,this.accessUserId=h,this.sessionInformationId=f,this.sessionInformationUserId=y,this.x=0,this.y=0,this.type=null,this.isNew=p,this.entryTimeStamp=v,this.updatedTimeStamp=g}getType(){console.log(this.typeId)}}function p(){let e=new Date,t=new Date;return new y(0,0,0,0,0,0,0,0,"0",0,0,0,0,0,0,!1,e,t)}var v=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class g{static addNodeToTree(e){return v(this,void 0,void 0,(function*(){return null==this.typeRoot?(this.typeRoot=e,this.typeRoot):(this.typeRoot=this.typeRoot.addTypeNode(e,this.typeRoot,this.typeRoot.height),this.typeRoot)}))}static addConceptToTree(e){if(0!=e.typeId){var t=new l(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeTypeConcept(e,t){this.typeRoot&&(this.typeRoot=this.typeRoot.removeNodeWithVariants(this.typeRoot,e,t))}static getNodeFromTree(e){return this.typeRoot?this.typeRoot.getFromNode(e,this.typeRoot):this.typeRoot}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 v(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isTypeLoaded)return e("done");setTimeout(g.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return v(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(e);if(o){o.value.userId==t&&n.push(null==o?void 0:o.value);for(let e=0;e<o.variants.length;e++)if(o.variants[e].value.userId==t){var i=!1;for(let t=0;t<n.length;t++)n[t].id==o.variants[e].value.id&&(i=!0);i||n.push(o.variants[e].value)}}return n}))}static getTypeVariantsWithCharacterValue(e,t){return v(this,void 0,void 0,(function*(){let n=p();var o=this.getNodeFromTree(t);if(o){o.value.characterValue==e&&(n=o.value);for(let t=0;t<o.variants.length;t++)o.variants[t].value.characterValue==e&&(n=o.variants[t].value)}return n}))}static countNumberOfNodes(){return this.typeRoot?this.typeRoot.countNodeBelow(this.typeRoot):0}}g.typeRoot=null;var m=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class C{constructor(){this.name="conceptsArray"}static 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}static AddConcept(e){e.id>0&&(f.addConceptToTree(e),g.addConceptToTree(e),u.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(f.addConceptToTree(e),g.addConceptToTree(e),u.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);e.id}static GetConcept(e){return m(this,void 0,void 0,(function*(){var t=p(),n=yield f.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return m(this,void 0,void 0,(function*(){var t=p(),n=u.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterUpdated(e){return m(this,void 0,void 0,(function*(){var t=p(),n=u.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return m(this,void 0,void 0,(function*(){return p(),yield g.getTypeVariantsWithCharacterValue(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return m(this,void 0,void 0,(function*(){var n=p(),o=yield u.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 m(this,void 0,void 0,(function*(){let n=[];return n=yield g.getTypeVariantsFromTreeWithUserId(e,t),n}))}static GetBinaryCharacterTree(){return u.characterRoot}getName(){return this.name}}C.conceptsArray=[],C.NPC=[],C.conceptDictionary=[];var N=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function T(e){const t=e.lastIndexOf("_");let n=[];return n=t>0?[e.substring(0,t),e.substring(t+1,e.length)]:[e],n}class w{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 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 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 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 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"}}w.BASE_URL="https://localhost:7053/",w.AI_URL="https://ai.freeschema.com",w.MQTT_URL="192.168.1.249",w.NODE_URL="http://localhost:5001/";class I{}function k(e="application/json",t="application/json"){return{"Content-Type":e,Authorization:"Bearer "+I.BearerAccessToken,Accept:t}}function A(e="application/json",t="",n="application/json"){return""==t&&(t=I.BearerAccessToken),{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}}I.BearerAccessToken="";class x{constructor(e,t,n,o){this.url=w.BASE_URL,this.message=e,this.ok=t,this.status=n,this.data=o}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}}function R(e){if(401==e.status){let t=new x(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}var S=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function _(e,t){return S(this,void 0,void 0,(function*(){try{var n=new URLSearchParams;n.append("type",e),n.append("user_id",t.toString());var o=k("application/x-www-form-urlencoded");const r=yield fetch(w.GetAllConceptsByTypeUrl(),{method:"POST",headers:o,body:n});if(r.ok){const e=yield r.json();for(var i=0;i<e.length;i++)C.AddConcept(e[i])}console.log("GetAllConceptsByType error",r.status),R(r)}catch(e){throw e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),e}}))}class L{constructor(e=0,t,n,o,i,r,c,a,s,l,d,u,h,f,y,v){this.isTemp=!1,this.toUpdate=!1,this.type=p(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.OfTheConceptUserId=o,this.ToTheConceptUserId=i,this.userId=r,this.typeId=c,this.ghostId=e,this.typeUserId=a,this.orderId=s,this.orderUserId=l,this.securityId=d,this.securityUserId=u,this.accessId=h,this.accessUserId=f,this.sessionInformationId=y,this.sessionInformationUserId=v,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class G{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;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}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}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.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}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}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}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var U=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class F{static addNodeToTree(e){if(null==this.connectionroot)return this.connectionroot=e,this.connectionroot;this.connectionroot=this.connectionroot.addNode(e,this.connectionroot,this.connectionroot.height)}static addConnectionToTree(e){var t=new G(e.id,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return U(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isConnectionLoaded)return e("done");setTimeout(F.checkFlag,1e3,e)}static removeNodeFromTree(e){return U(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return U(this,void 0,void 0,(function*(){return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}))}}F.connectionroot=null;var V=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class P{static addNodeToTree(e){return V(this,void 0,void 0,(function*(){return null==this.connectionTypeRoot?(this.connectionTypeRoot=e,this.connectionTypeRoot):(this.connectionTypeRoot=this.connectionTypeRoot.addTypeNode(e,this.connectionTypeRoot,this.connectionTypeRoot.height),this.connectionTypeRoot)}))}static waitForDataToLoad(){return V(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isConnectionTypeLoaded)return e("done");setTimeout(P.checkFlag,1e3,e)}static addConnectionToTree(e){if(0!=e.typeId){var t=new G(e.typeId,e,null,null);this.addNodeToTree(t)}}static removeTypeConcept(e,t){this.connectionTypeRoot&&(this.connectionTypeRoot=this.connectionTypeRoot.removeNodeWithVariants(this.connectionTypeRoot,e,t))}static getNodeFromTree(e){return this.connectionTypeRoot?this.connectionTypeRoot.getFromNode(e,this.connectionTypeRoot):this.connectionTypeRoot}static getTypeVariantsFromTree(e){return V(this,void 0,void 0,(function*(){var t=[],n=this.getNodeFromTree(e);if(n){t.push(null==n?void 0:n.value);for(let e=0;e<n.variants.length;e++)t.push(n.variants[e].value);return t}}))}static getTypeVariantsFromTreeWithUserId(e,t){return V(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(e);if(o){o.value.userId==t&&n.push(null==o?void 0:o.value);for(let e=0;e<o.variants.length;e++)o.variants[e].value.userId==t&&n.push(o.variants[e].value)}return n}))}}P.connectionTypeRoot=null;var B=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class D{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 AddConnectionToStorage(e){}static AddConnection(e){e.isTemp||(F.addConnectionToTree(e),P.addConnectionToTree(e))}static AddConnectionToMemory(e){e.isTemp||(F.addConnectionToTree(e),P.addConnectionToTree(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&(e.id,F.removeNodeFromTree(e.id),P.removeTypeConcept(e.typeId,e.id))}static GetConnectionTree(){return F.connectionroot}static GetConnectionTypeTree(){return P.connectionTypeRoot}static GetConnection(e){return B(this,void 0,void 0,(function*(){var t=new L(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),n=yield F.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConnectionsOfCompositionLocal(e){return B(this,void 0,void 0,(function*(){var t=[],n=yield P.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;if(o){let e=o;t.push(e);for(let e=0;e<n.variants.length;e++)t.push(n.variants[e].value)}}return t}))}getName(){return this.name}}D.connectionArray=[],D.connectionDictionary=[];var E=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function O(e){return E(this,void 0,void 0,(function*(){let t=[];try{var n=[];for(let o=0;o<e.length;o++){let i=yield C.GetConcept(e[o]);0==i.id?n.push(e[o]):t.push(i)}if(0==n.length)return t;{var o=k();const e=yield fetch(w.GetConceptBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(n)});if(e.ok){let n=yield e.json();if(n.length>0)for(let e=0;e<n.length;e++){let o=n[e];t.push(o),C.AddConcept(o)}}else console.log("Get Concept Bulk error",e.status),R(e);return t}}catch(e){throw e instanceof Error?console.log("Get Concept Bulk error message: ",e.message):console.log("Get Concept Bulk unexpected error: ",e),e}}))}var b=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function H(e=[]){return b(this,void 0,void 0,(function*(){var 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);yield O(t)}}))}var M=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function W(e=[]){return M(this,void 0,void 0,(function*(){var t=[];for(let o=0;o<e.length;o++){var n=yield D.GetConnectionsOfCompositionLocal(e[o]);t.push(...n)}return t}))}function j(e=[],t=[]){for(let n=0;n<t.length;n++)Array.isArray(e)&&(e.find((e=>e.id===t[n].id))||D.RemoveConnection(t[n]))}var $=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function J(e=[]){return $(this,void 0,void 0,(function*(){var t=[];if(e.length<=0)return t;var n=yield W(e),o=yield function(e=[]){return $(this,void 0,void 0,(function*(){var t=[];try{var n=k();const i=yield fetch(w.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(i.ok){const e=yield i.json();for(var o=0;o<e.length;o++)D.AddConnection(e[o]),t.push(e[o])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),R(i);return t}catch(e){throw 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),e}}))}(e);return j(t=o,n),yield H(t),t}))}var Q=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function K(e){return Q(this,void 0,void 0,(function*(){let t=p();console.log("id",e);try{var n=yield C.GetConcept(e);let i=C.GetNpc(e);if(0!=n.id||i)return n;{var o=k("application/x-www-form-urlencoded");const n=yield fetch(w.GetConceptUrl(),{method:"POST",headers:o,body:`id=${e}`});return console.log("response",n),n.ok?(t=yield n.json(),t.id>0?C.AddConcept(t):C.AddNpc(e)):(console.log("Get the concept error",n.status),R(n)),t}}catch(e){throw e instanceof Error?console.log("Get the concept error message: ",e.message):console.log("Get the concept unexpected error: ",e),e}}))}var q=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function z(e){return q(this,void 0,void 0,(function*(){var t=[];if(0==(t=yield D.GetConnectionsOfCompositionLocal(e)).length)t=yield X(e);else{var n=yield X(e);j(n,t),t=n}return t}))}function X(e){return q(this,void 0,void 0,(function*(){var t=[];try{var n=k("application/x-www-form-urlencoded");const i=yield fetch(w.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:n,body:`composition_id=${e}`});if(!i.ok)throw R(i),new Error(`Error! status: ${i.status}`);const r=yield i.json();for(var o=0;o<r.length;o++)D.AddConnection(r[o]),t.push(r[o]);return t}catch(e){throw e instanceof Error?console.log("Get all connection of composition error : ",e.message):console.log("Get all connection of composition error : ",e),e}}))}var Y=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Z(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield z(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield re(e,o,r);return i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s,i}))}function ee(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield z(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield ce(e,o,r);return i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s,i}))}function te(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield D.GetConnectionsOfCompositionLocal(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield re(e,o,r);return i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s,i}))}function ne(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield D.GetConnectionsOfCompositionLocal(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield re(e,o,r);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s;var l={};return l.created_at=a.entryTimeStamp,l.data=i,l.id=e,l}))}function oe(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield D.GetConnectionsOfCompositionLocal(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield re(e,o,r);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s;var l={};return l.data=i,l.id=e,l.created_at=a.entryTimeStamp,l}))}function ie(e){var t,n;return Y(this,void 0,void 0,(function*(){var o,i={};o=yield z(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield C.GetConcept(e);0==a.id&&null!=e&&null!=e&&(a=yield K(e));var s=yield re(e,o,r);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=s;var l={};return l.data=i,l.id=e,l}))}function re(e,t,n,o=[]){var i,r,c;return Y(this,void 0,void 0,(function*(){var a={},s=[];if(0==e)return null;var l=yield C.GetConcept(e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield K(e)),0!=l.id&&null==l.type){var d=l.typeId,u=yield C.GetConcept(d);l.type=u,null==u&&null!=d&&null!=d&&(u=yield K(d),l.type=u)}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e);for(var h=0;h<t.length;h++)if(t[h].ofTheConceptId==e){var f=t[h].toTheConceptId,y=yield C.GetConcept(f);null!=y&&0!=y.id||null==f||null==f||(y=yield K(f)),y&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield C.GetConcept(d),y.type=u,null==u&&null!=d&&null!=d&&(u=yield K(d),y.type=u));var p=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(p))){if(p){const e=yield re(f,t,n,o);a[p]=e}}else{const e=yield re(f,t,n,o);s[p]=e,a=s}}return a}))}function ce(e,t,n,o=[]){var i,r,c;return Y(this,void 0,void 0,(function*(){var a={},s=[];if(0==e)return null;var l=yield C.GetConcept(e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield K(e)),0!=l.id&&null==l.type){var d=l.typeId,u=yield C.GetConcept(d);l.type=u,null==u&&null!=d&&null!=d&&(u=yield K(d),l.type=u)}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e),a.id=e;for(var h=0;h<t.length;h++)if(t[h].ofTheConceptId==e){var f=t[h].toTheConceptId,y=yield C.GetConcept(f);null!=y&&0!=y.id||null==f||null==f||(y=yield K(f)),y&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield C.GetConcept(d),y.type=u,null==u&&null!=d&&null!=d&&(u=yield K(d),y.type=u));var p=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(p))){if(p){const e=yield ce(f,t,n);a[p]=e}}else{const e=yield ce(f,t,n);s[p]=e,a=s}}return a}))}var ae=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function se(e){return ae(this,void 0,void 0,(function*(){let t=p();try{var n=k("application/x-www-form-urlencoded");const o=yield fetch(w.GetConceptByCharacterValueUrl(),{method:"POST",headers:n,body:`character_value=${e}`});return o.ok?(t=yield o.json(),t.id>0&&(console.log("This is adding the new concept",t),C.AddConcept(t))):(console.log("Error in Getting concept by character value Error",o.status),R(o)),t}catch(e){throw 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),e}}))}var le=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function de(e){return le(this,void 0,void 0,(function*(){var t=yield C.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield se(e),t=yield C.GetConceptByCharacter(e)),t}))}var ue=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function he(e,t,n=10,o=1){return ue(this,void 0,void 0,(function*(){var i=yield de(e),r=[];if(i){yield _(e,t);for(var c=yield C.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),s=[],l=a;l<a+n;l++)c[l]&&s.push(c[l].id);for(yield J(s),l=a;l<a+n;l++)if(c[l]){var d=yield te(c[l].id);r.push(d)}}return r}))}function fe(e,t,n=10,o=1){return ue(this,void 0,void 0,(function*(){var i=yield de(e),r=[];if(i){yield _(e,t);for(var c=yield C.GetConceptsByTypeIdAndUser(i.id,t),a=n*(o-1),s=[],l=a;l<a+n;l++)c[l]&&s.push(c[l].id);for(yield J(s),l=a;l<a+n;l++)if(c[l]){var d=yield ne(c[l].id);r.push(d)}}return r}))}class ye{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}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}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}}var pe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class ve{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 ye(e.id,e,null,null);new ye(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return pe(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isLocalDataLoaded)return e("done");setTimeout(ve.checkFlag,1e3,e)}static getNodeFromTree(e){return pe(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 removeNodeFromTree(e){return pe(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}ve.root=null;var ge=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class me{static waitForDataToLoad(){return ge(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isLocalCharacterLoaded)return e("done");setTimeout(me.checkFlag,1e3,e)}static addNodeToTree(e){return ge(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 ye(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 ge(this,void 0,void 0,(function*(){return this.LocalCharacterRoot?this.LocalCharacterRoot.getFromNodeWithCharacterAndType(e,t,this.LocalCharacterRoot):this.LocalCharacterRoot}))}static removeConceptType(e,t){this.LocalCharacterRoot&&(this.LocalCharacterRoot=this.LocalCharacterRoot.removeNodeWithVariants(this.LocalCharacterRoot,e,t))}}me.LocalCharacterRoot=null;var Ce=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Ne{static addNodeToTree(e){return Ce(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 ye(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 Ce(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isLocalTypeLoaded)return e("done");setTimeout(Ne.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return Ce(this,void 0,void 0,(function*(){var n=[],o=this.getNodeFromTree(e);if(o){o.value.userId==t&&n.push(null==o?void 0:o.value);for(let e=0;e<o.variants.length;e++)o.variants[e].value.userId==t&&n.push(o.variants[e].value)}return n}))}}Ne.LocalTypeRoot=null;class Te{constructor(e,t,n,o,i,r,c,a=!1,s,l,d,u=999){this.isComposition=!1,this.isTemp=!1,this.applicationId=999,this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=o,this.characterValue=r,this.accessId=i,this.type=null,this.isNew=a,this.typeCharacter=c,this.entryTimeStamp=s,this.updatedTimeStamp=l,this.referentId=d,this.applicationId=u}getType(){console.log(this.typeId)}}function we(){let e=new Date,t=new Date;return new Te(0,0,0,0,0,"0","0",!1,e,t,0)}var Ie=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class ke{constructor(){this.name="conceptsArray"}static AddConcept(e){e.id>0&&(ve.addConceptToTree(e),me.addConceptToTree(e),Ne.addConceptToTree(e),this.localconceptsArray.push(e))}static AddConceptToMemory(e){e.id>0&&(ve.addConceptToTree(e),me.addConceptToTree(e),Ne.addConceptToTree(e))}static GetConcept(e){return Ie(this,void 0,void 0,(function*(){var t=we(),n=yield ve.getNodeFromTree(e);if(null==n?void 0:n.value){var o=n.value;o&&(t=o)}return t}))}static GetConceptByCharacter(e){return Ie(this,void 0,void 0,(function*(){var t=we(),n=me.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return Ie(this,void 0,void 0,(function*(){var n=we(),o=yield me.getCharacterAndTypeFromTree(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 Ie(this,void 0,void 0,(function*(){let n=[];return n=yield Ne.getTypeVariantsFromTreeWithUserId(e,t),n}))}getName(){return this.name}}ke.localconceptsArray=[];var Ae=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class xe{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||e.isTemp,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 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 Ae(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isLocalConnectionLoaded)return e("done");setTimeout(xe.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return Ae(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}}))}getName(){return this.name}}xe.connectionArray=[],xe.connectionDictionary=[];var Re=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Se(e){var t,n;return Re(this,void 0,void 0,(function*(){var o,i={};o=yield xe.GetConnectionsOfCompositionLocal(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield ke.GetConcept(e),s=yield Le(e,o,r);return i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=s,i}))}function _e(e){var t,n;return Re(this,void 0,void 0,(function*(){var o,i={};o=yield xe.GetConnectionsOfCompositionLocal(e);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield ke.GetConcept(e);if(0!=a.id){var s=yield Le(e,o,r);i[null!==(n=null===(t=null==a?void 0:a.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=s;var l={}}return l.data=i,l.id=e,l}))}function Le(e,t,n,o=[]){var i,r,c;return Re(this,void 0,void 0,(function*(){var a={},s=[],l=yield ke.GetConcept(e);if(0!=l.id&&null==l.type){var d=l.typeId,u=yield ke.GetConcept(d);l.type=u}if(null===(i=null==l?void 0:l.type)||void 0===i||i.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e);for(var h=0;h<t.length;h++)if(t[h].ofTheConceptId==e){var f=t[h].toTheConceptId,y=yield ke.GetConcept(f);0!=y.id&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield ke.GetConcept(d),y.type=u);var p=(null!==(c=null===(r=null==y?void 0:y.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"top").replace("the_","");if(isNaN(Number(p))){if(p){const e=yield Le(f,t,n);a[p]=e}}else{const e=yield Le(f,t,n);s[p]=e,a=s}}return a}))}var Ge=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ue(e){return Ge(this,void 0,void 0,(function*(){return yield ke.GetConceptByCharacter(e)}))}var Fe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ve(e,t){return Fe(this,void 0,void 0,(function*(){var n=yield Ue(e),o=[];if(n)for(var i=yield ke.GetConceptsByTypeIdAndUser(n.id,t),r=0;r<i.length;r++){var c=yield Se(i[r].id);o.push(c)}return o}))}function Pe(e,t){return Fe(this,void 0,void 0,(function*(){var n=yield Ue(e),o=[];if(n)for(var i=yield ke.GetConceptsByTypeIdAndUser(n.id,t),r=0;r<i.length;r++){var c=yield _e(i[r].id);o.push(c)}return o}))}var Be=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function De(e){return Be(this,void 0,void 0,(function*(){let t=p();try{var n=k();const o=yield fetch(w.CreateTheConceptUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!o.ok)throw R(o),new Error(`Error! status: ${o.status}`);return t=yield o.json(),t}catch(e){throw e instanceof Error?console.log("Create the concept api error message: ",e):console.log("Create the concept api unexpected error: ",e),e}}))}var Ee=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Oe{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 Ee(this,void 0,void 0,(function*(){try{for(let e=0;e<this.conceptsSyncArray.length;e++)C.AddConcept(this.conceptsSyncArray[e]);for(let e=0;e<this.connectionSyncArray.length;e++)D.AddConnection(this.connectionSyncArray[e]);if(this.conceptsSyncArray.length>0){let e=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],De(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 L(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);try{var n=k(),o=JSON.stringify(e);const i=yield fetch(w.CreateTheConnectionUrl(),{method:"POST",headers:n,body:o});return i.ok?yield i.json():(console.log("Create the connection error message: ",i),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{s(i.next(e))}catch(e){r(e)}}function a(e){try{s(i.throw(e))}catch(e){r(e)}}function s(t){var n;t.done?e(t.value):(n=t.value,n instanceof o?n:new o((function(e){e(n)}))).then(c,a)}s((i=i.apply(t,n||[])).next())}));var t,n,o,i}(e)}return"done"}catch(e){throw e}}))}static syncDataLocalDb(){return Ee(this,void 0,void 0,(function*(){if(this.conceptsSyncArray.length>0){for(let e=0;e<this.conceptsSyncArray.length;e++)this.conceptsSyncArray[e];this.conceptsSyncArray=[]}if(this.connectionSyncArray.length>0){for(let e=0;e<this.connectionSyncArray.length;e++)this.connectionSyncArray[e];this.connectionSyncArray=[]}return"done"}))}}function be(e,t,n,o,i,r,c){var a=new L(0,e,n,t,o,t,i,t,1,t,0,t,4,t,r,c);return e==n?(a.ofTheConceptId=0,a.toTheConceptId=1,a):(a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),Oe.AddConnection(a),a)}Oe.conceptsSyncArray=[],Oe.connectionSyncArray=[];var He=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Me=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function We(e,t){return Me(this,void 0,void 0,(function*(){let n=yield C.GetConceptByCharacterAndTypeLocal(e,t);try{if(null==n||0==n.id){var o={character_value:`${e}`,type_id:t},i=JSON.stringify(o),r=k();const c=yield fetch(w.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:r,body:i});c.ok?(n=yield c.json(),C.AddConcept(n)):(console.log("This is the concept by type and character error",c.status),R(c))}return n}catch(e){throw 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),e}}))}var je=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class $e{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.userId=e,this.data=t,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.entryTimestamp=s,this.isNew=l}}var Je=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Qe{static getId(){return Je(this,void 0,void 0,(function*(){let e=(new Date).getTime();this.ids.length<10&&(yield function(){return e=this,t=void 0,o=function*(){try{var e=k("application/x-www-form-urlencoded");const n=yield fetch(w.GetReservedIdUrl(),{method:"GET",headers:e});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`);const o=yield n.json();for(var t=0;t<o.length;t++)Qe.AddId(o[t])}catch(e){throw e instanceof Error?console.log("get reserved ids error message: ",e.message):console.log("get reserved ids unexpected error: ",e),e}},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}());var t=this.ids[0];this.ids.shift();var n=(new Date).getTime()-e;return console.log("Execution time for concept: "+n),t}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}Qe.ids=[];class Ke{static getId(){return Je(this,void 0,void 0,(function*(){let e=(new Date).getTime();this.connectionIds.length<10&&(yield function(){return e=this,t=void 0,o=function*(){try{var e=k("application/x-www-form-urlencoded");const n=yield fetch(w.GetReservedConnectionIdUrl(),{method:"GET",headers:e});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`);const o=yield n.json();for(var t=0;t<o.length;t++)Ke.AddId(o[t])}catch(e){throw e instanceof Error?console.log("get reserved connection ids error message: ",e.message):console.log("get reserved connection ids unexpected error: ",e),e}},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}());var t=this.connectionIds[0];this.connectionIds.shift();var n=(new Date).getTime()-e;return console.log("Execution time for connection: "+n),t}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}Ke.connectionIds=[];var qe=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ze(e,t,n,o,i,r,c,a,s,l,d,u,h,f){return qe(this,void 0,void 0,(function*(){var p=yield Qe.getId();let v=new Date,g=new Date;var m=new y(p,t,i,r,n,o,c,a,e,s,l,d,u,h,f,!0,v,g);return m.isTemp=!1,Oe.AddConcept(m),m}))}function Xe(e,t,n,o,i,r,c,a,s,l,d,u,h,f){return qe(this,void 0,void 0,(function*(){var p=yield Qe.getId();let v=new Date,g=new Date;var m=new y(p,t,i,r,n,o,c,a,e,s,l,d,u,h,f,!1,v,g);return C.AddConcept(m),De([m]),m}))}var Ye=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ze(e,t,n=!1,o,i,r=999,c=0){return Ye(this,void 0,void 0,(function*(){let a,s=r,l=999,d=o,u=o,h=i,f=o,y="",v=t.length,g=p();y=e.startsWith("the_")?e:"the_"+e;let m=(new Date).getTime();if(n){g=yield Qt(e),a=yield ze(t,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u);let n=(new Date).getTime()-m;console.log("Execution time in type test for composition: "+n+"--------"+e)}else if(v>255){g=yield Qt(y),a=yield ze(t,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u),function(e){He(this,void 0,void 0,(function*(){try{var t=k();const n=yield fetch(w.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!n.ok)throw 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 $e(o,t,l,d,h,f,s,u,Date.now().toString(),!0));let n=(new Date).getTime()-m;console.log("Execution time in type test for text: "+n+"--------"+e)}else{g=yield Qt(y);let n=yield We(t,g.id);a=n,0==n.id&&0==n.userId&&(a=yield Xe(t,o,4,o,g.id,g.userId,12,12,l,d,h,f,s,u),function(e,t,n,o){je(this,void 0,void 0,(function*(){try{var i={newConceptId:e,referent:t,typeId:n,typeUserId:o},r=k(),c=JSON.stringify(i);const a=yield fetch(w.MakeTheNameInBackendUrl(),{method:"POST",headers:r,body:c});a.ok||R(a)}catch(e){throw e instanceof Error?console.log("make the name in backend error message: ",e.message):console.log("make the name in backend unexpected error: ",e),e}}))}(a.id,`${t}`,g.id,o));let i=(new Date).getTime()-m;console.log("Execution time in type test: "+i+"--------"+e)}return a.type=g,a}))}var et=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function tt(e,t=null,n=null,o=null,i=null,r=null,c=null){return et(this,void 0,void 0,(function*(){var a=null!=i?i:999,s=null!=r?r:4,l=null!=c?c:999,d=null!=o?o:0,u=p();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){var h=d;u=v=yield Ze(o,"",!0,a,s,l),h=v.id,d=v.id,yield tt(e[o],v.id,v.userId,h,i,r,c)}else{var f=null!=t?t:999,y=null!=n?n:999;h=d,u=v=yield Ze(o,"",!0,a,s,l),yield be(f,y,v.id,v.userId,h,l,v.userId),yield tt(e[o],v.id,v.userId,h,i,r,c)}else{f=null!=t?t:999,y=null!=n?n:10267,h=d;var v=yield Ze(o,e[o],!1,a,s,l);yield be(f,y,v.id,v.userId,h,l,v.userId)}return u}))}class nt{constructor(e=0,t,n,o,i,r,c=999){this.isTemp=!1,this.applicationId=999,this.type=we(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.typeId=o,this.ghostId=e,this.orderId=i,this.typeCharacter="",this.accessId=r,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.applicationId=c}}function ot(e,t,n,o=1){Math.floor(1e8*Math.random());let i=0,r=0,c=0;i=e,r=t,c=n;let a=new nt(0,0,0,0,0,0);return e!=t&&(a=new nt(0,e,t,n,o,4),a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),xe.AddConnection(a)),a}var it=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function rt(e,t,n,o,i,r,c=0){return it(this,void 0,void 0,(function*(){var a=Math.floor(1e8*Math.random());let s=new Date,l=new Date;var d=new Te(a,n,i,o,r,e,t,!0,s,l,c);return d.isTemp=!0,ke.AddConcept(d),d}))}var ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},at=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function st(e,t,n,o){return at(this,void 0,void 0,(function*(){var i=yield Ue(e);if(i&&(0==i.id||0==i.userId)){var r=T(e);if(r[0]==e){var c=yield function(e,t,n,o,i){return ct(this,void 0,void 0,(function*(){var t=yield ke.GetConceptByCharacterAndTypeLocal(e,51),o=t;return 0==o.id&&(o=t=yield rt(e,"the",n,4,51,4)),o}))}(e,0,o);i=c}else{var a=yield st(r[0],t,n,o),s=yield st(r[1],t,n,o);s&&(i=c=yield rt(e,r[1],o,a.id,s.id,4))}}return i}))}var lt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function dt(e,t,n=!1,o,i,r=999,c=0){return lt(this,void 0,void 0,(function*(){var i,r,a,s=o,l=t.length;if(a=e.startsWith("the_")?e:"the_"+e,n)i=yield st(e,999,o,o),r=yield rt(t,e,o,4,i.id,4,c);else if(l>255)i=yield st(a,999,s,o),r=yield rt(t,a,o,4,i.id,4);else{i=yield st(a,999,s,o);var d=yield ke.GetConceptByCharacterAndTypeLocal(t,i.id);r=d,0==d.id&&0==d.userId&&(r=yield rt(t,a,o,4,i.id,4))}return r.type=i,r}))}var ut=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ht(e,t=null,n=null,o=null,i=null,r=null,c=null){return ut(this,void 0,void 0,(function*(){var a=null!=i?i:999,s=null!=c?c:4,l=null!=o?o:0,d=we();for(const o in e)if("string"!=typeof e[o]&&"number"!=typeof e[o])if(null==t&&null==n){var u=l;d=f=yield dt(o,"",!0,a,0,s),u=f.id,l=f.id,yield ht(e[o],f.id,f.userId,u,i,r,c)}else{var h=null!=t?t:999,f=(u=l,yield dt(o,"",!0,a,0,s));yield ot(h,f.id,u),yield ht(e[o],f.id,f.userId,u,i,r,c)}else h=null!=t?t:999,u=l,f=yield dt(o,e[o],!1,a,0,s),yield ot(h,f.id,u);return d}))}var ft=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function yt(e,t,n,o=10,i=1){return ft(this,void 0,void 0,(function*(){let r=[];try{var c=new URLSearchParams;c.append("typeId",`${e}`),c.append("ofTheConceptId",`${t}`),c.append("userId",`${n}`),c.append("inpage",`${o}`),c.append("page",`${i}`);var a=k("application/x-www-form-urlencoded");const s=yield fetch(w.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:a,body:c});return s.ok?r=yield s.json():(console.log("Get connection of concept error",s.status),R(s)),r}catch(e){throw e instanceof Error?console.log("Get connection of concept error message: ",e.message):console.log("Get connection of concept unexpected error: ",e),e}}))}var pt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function vt(e,t,n,o,i,r,c,a=1,s=4){return pt(this,void 0,void 0,(function*(){var l=t,d=t,u=t,h=t,f=t,y=yield Ke.getId(),p=new L(y,e,n,t,o,u,i,d,a,l,0,h,s,f,r,c);return e==n?(p.ofTheConceptId=0,p.toTheConceptId=1,p):(p.toUpdate=!0,p.isTemp=!1,Oe.AddConnection(p),p)}))}var gt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},mt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ct=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Nt(e){return Ct(this,void 0,void 0,(function*(){var t=yield D.GetConnection(e);if((null==t||0==t.id)&&null!=e&&null!=e){var n=yield function(e){return mt(this,void 0,void 0,(function*(){var t=yield D.GetConnection(e);try{if(0!=t.id)return t;{var n=k("application/x-www-form-urlencoded");const o=yield fetch(w.GetConnectionUrl(),{method:"POST",headers:n,body:`id=${e}`});return o.ok?(t=yield o.json(),D.AddConnection(t)):(console.log("Get Connection Error",o.status),R(o)),t}}catch(e){throw e instanceof Error?console.log("Get Connection error message: ",e.message):console.log("Get Connection unexpected error: ",e),e}}))}(e);t=n}return t}))}var Tt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function wt(e){return Tt(this,void 0,void 0,(function*(){var t=yield Nt(e);!function(e){gt(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());const n=yield fetch(w.DeleteTheConnectionUrl(),{method:"POST",body:t,redirect:"follow"});n.ok||(console.log("Delete connection error status: ",n.status),R(n))}catch(e){throw e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),e}}))}(e),F.removeNodeFromTree(e),P.removeTypeConcept(t.typeId,e)}))}var It=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function kt(e,t=999){return It(this,void 0,void 0,(function*(){var n=p();if(e<0)return Co(yield lo(t,e));if(null!=(n=yield C.GetConcept(e))&&0!=n.id||null==e||null==e||(n=yield K(e)),0!=n.id&&null==n.type&&null==(yield C.GetConcept(n.typeId))&&null!=n.typeId&&null!=n.typeId){var o=yield K(n.typeId);n.type=o}return n}))}var At=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function xt(e,t,n,o=!1,i=!1){var r,c;return At(this,void 0,void 0,(function*(){var a=e.userId,s=a,l=a;if(o){let o=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s",c=n+"_by",u=o+"_"+c;i&&(yield Rt(c,t,a));var d=yield Ze("connection",u,!1,999,999,999);let h=new L(0,t.id,e.id,t.userId,e.userId,t.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Oe.AddConnection(h)}let u=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Rt(h,e,a));var y=yield Ze("connection",f,!1,999,999,999);let p=new L(0,e.id,t.id,e.userId,t.userId,e.userId,y.id,y.userId,1e3,a,999,s,4,l,999,999);return Oe.AddConnection(p),p}))}function Rt(e,t,n=null){var o;return At(this,void 0,void 0,(function*(){for(var i=t,r=null!=n?n:t.userId,c=r,a=r,s=999,l=e+"_count",d=(null===(o=t.type)||void 0===o?void 0:o.characterValue)+"_s_"+l,u=yield Ze("connection",d,!1,r,4,s),h=yield yt(u.id,t.id,r,10,1),f=[],y=p(),v=0;v<h.length;v++){let e=yield kt(h[v].toTheConceptId);f.push(e)}if(f.length<1)y=yield Ze("count","1",!1,r,4,s);else{var g=f[0];let e=0;try{e=Number(g.characterValue)}catch(t){e=0}e+=1,y=yield Ze("count",e.toString(),!1,r,4,s);for(let e=0;e<h.length;e++)wt(h[e].id)}let m=new L(0,i.id,y.id,i.userId,y.userId,i.userId,u.id,u.userId,1e3,r,999,c,4,a,s,999);yield Oe.AddConnection(m)}))}function St(e,t,n,o=!1,i=!1){var r,c;return At(this,void 0,void 0,(function*(){var a=e.userId,s=a,l=a;if(o){let o=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s",c=n+"_by",u=o+"_"+c;i&&(yield Rt(c,t,a));var d=yield Ze("connection",u,!1,999,999,999);let h=new L(0,t.id,e.id,t.userId,e.userId,t.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Oe.AddConnection(h)}let u=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Rt(h,e,a));var y=yield Ze("connection",f,!1,999,999,999);return yield vt(e.id,e.userId,t.id,t.userId,y.id,999,999,1e3,4)}))}var _t=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Lt(e,t,n=10,o=1){var i;return _t(this,void 0,void 0,(function*(){var r=[],c=yield kt(e),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,s=yield We(a,16);if(s.id>0){for(var l=yield yt(s.id,c.id,c.userId,n,o),d=[],u=0;u<l.length;u++)d.push(l[u].toTheConceptId);for(yield J(d),u=0;u<l.length;u++){let e=l[u].toTheConceptId,t=yield kt(e),n=yield oe(t.id);r.push(n)}}return r}))}function Gt(e,t,n=10,o=1){var i;return _t(this,void 0,void 0,(function*(){var r=[],c=yield kt(e),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+t,s=yield We(a,16);if(s.id>0){for(var l=yield yt(s.id,c.id,c.userId,n,o),d=[],u=0;u<l.length;u++)d.push(l[u].toTheConceptId);for(u=0;u<l.length;u++){let e=l[u].toTheConceptId,t=yield kt(e);r.push(t)}}return r}))}class Ut{constructor(e,t,n,o,i,r,c,a,s,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=n,this.securityUserId=o,this.accessId=i,this.accessUserId=r,this.sessionId=c,this.sessionUserId=a,this.isNew=l}}class Ft{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new Ut(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}}Ft.characterData=[];class Vt{constructor(e,t,n,o){this.id=e,this.userId=t,this.referentId=n,this.isNew=o}}var Pt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Dt(e,t,n,o,i){return Bt(this,void 0,void 0,(function*(){var r=new Ut(t,e,n,t,o,t,i,t,"",!1);return yield function(e){return Pt(this,void 0,void 0,(function*(){try{if(0==(e=Ft.GetCharacter(e.data)).id){var t=k();const o=yield fetch(w.CreateTheCharacterDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!o.ok)throw R(o),new Error(`Error! status: ${o.status}`);const i=yield o.json();var n=new Ut(i.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=i.id,Ft.AddCharacter(n),i}return new Vt(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}}))}(r)}))}var Et=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ot(e,t,n,o,i,r,c,a,s,l,d,u,h,f){return Et(this,void 0,void 0,(function*(){var y=yield We(e,i),p=y;return 0==p.id&&(p=y=yield ze(e,t,n,o,i,r,c,a,s,l,d,u,h,f)),p}))}var bt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ht=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Mt(e,t,n,o){return Ht(this,void 0,void 0,(function*(){var i=o,r=yield de(e);if(r&&(0==r.id||0==r.userId)){var c=T(e);if(c.length>0)if(console.log(c),c[0]==e){var a=yield function(e,t,n,o,i,r){return bt(this,void 0,void 0,(function*(){var c=t,a=t;i=t;var s,l=t,d=t,u=t;if(1==e.length){var h=e.charCodeAt(0);yield Dt(e,t,n,o,r),s=Ot(e,t,4,c,h,u,49,l,n,a,o,i,r,d)}else{var f=yield Dt(e,t,n,o,r);f.isNew,s=yield Ot(e,t,4,c,51,l,f.id,f.userId,n,a,o,i,r,d)}return s}))}(e,o,999,999,i,t);r=a}else{var s=yield Mt(c[0],t,n,o),l=yield Mt(c[1],t,n,o);l&&(r=yield Xe(e,o,s.id,o,l.id,o,999,o,999,o,999,o,t,o))}}return r}))}var Wt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},jt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function $t(e){return jt(this,void 0,void 0,(function*(){let t=p();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=e.length;console.log("this is the character length ",n);var o=T(e);if(o.length>1){let n=1,i=yield $t(o[0]);0!=i.id&&(n=i.id),t=yield function(e,t){return jt(this,void 0,void 0,(function*(){let n=yield C.GetConceptByCharacterAndCategoryLocal(e,t);return 0==n.id&&(n=yield function(e,t){return Wt(this,void 0,void 0,(function*(){let n=p();try{var o=k("application/x-www-form-urlencoded");const i=yield fetch(w.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:o,body:`character_value=${e}&category_id=${t}`});return i.ok?(n=yield i.json(),C.AddConcept(n)):(console.log("This is the concept by category and character error",i.status),R(i)),n}catch(e){throw 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),e}}))}(e,t)),n}))}(e,n)}else o[0]==e&&1==n?t=yield function(e){return jt(this,void 0,void 0,(function*(){console.log("inside the character length function",e);var t=yield C.GetConceptByCharacterAndTypeLocal(e,49);return console.log("inside the character length function after",t),0==t.id&&(t=yield se(e)),t}))}(e):o[0]==e&&(t=yield function(e){return jt(this,void 0,void 0,(function*(){var t=yield C.GetConceptByCharacterAndTypeLocal(e,51);return 0==t.id&&(t=yield se(e)),t}))}(e));return t}))}var Jt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Qt(e,t){return Jt(this,void 0,void 0,(function*(){let t=(new Date).getTime(),n=p();try{if(n=yield $t(e),0==n.id||4==n.typeId){console.log("this is the concept that needs to be found",e,n.typeId);var o=k("application/x-www-form-urlencoded");const t=yield fetch(w.MakeTheTypeConceptUrl(),{method:"POST",headers:o,body:`type=${e}`});if(!t.ok)throw R(t),new Error(`Error! status: ${t.status}`);n=yield t.json(),n.id>0&&C.AddConcept(n)}var i=(new Date).getTime()-t;return console.log("Execution time: "+i+"This is the type"+e+"----"+n.typeId),n}catch(e){throw e instanceof Error?console.log("Make The Type Concept Api error : ",e.message):console.log("Make The Type Concept Api error : ",e),e}}))}var Kt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},qt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Xt(e){return zt(this,void 0,void 0,(function*(){for(var t=yield function(e){return Kt(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=k("application/x-www-form-urlencoded");const r=yield fetch(w.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"),R(r);return t}catch(e){throw 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),e}}))}(e),n=0;n<t.length;n++){let e=t[n];var o=e.typeId;let i=yield kt(o);e.type=i}return t}))}function Yt(e){return zt(this,void 0,void 0,(function*(){for(var t=yield function(e){return qt(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=k("application/x-www-form-urlencoded");const r=yield fetch(w.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"),R(r);return t}catch(e){throw 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),e}}))}(e),n=0;n<t.length;n++){let e=t[n];var o=e.typeId;let i=yield kt(o);e.type=i}return t}))}var Zt=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},en=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function tn(e){return en(this,void 0,void 0,(function*(){var t=yield kt(e);yield f.removeNodeFromTree(e);var n=t.typeId,o=t.characterValue;yield g.removeTypeConcept(n,e),yield u.removeNodeByCharacter(o,e),function(e){Zt(this,void 0,void 0,(function*(){try{const t=new FormData;t.append("id",e.toString());const n=yield fetch(w.DeleteConceptUrl(),{method:"POST",body:t});if(!n.ok)throw R(n),new Error(`Error! status: ${n.status}`)}catch(e){throw e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),e}}))}(e)}))}var nn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function on(e,t){return nn(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(w.DeleteConceptUrl(),{method:"POST",body:o,headers:n});if(!i.ok)throw R(i),new Error(`Delete composition Error! status: ${i.status}`)}catch(e){throw e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),e}}))}var rn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function cn(e,t,n,o,i=999){return rn(this,void 0,void 0,(function*(){var o,i=n,r=n,c=n,a=e.startsWith("the_"),s=p();return o=a?e:"the_"+e,s=yield Qt(o),yield Ot(t,n,4,n,s.id,s.userId,0,999,999,i,4,c,999,r)}))}class an{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=[]}}var sn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ln(e=[]){return sn(this,void 0,void 0,(function*(){var t=[];try{var n=[];for(let o=0;o<e.length;o++){let i=yield D.GetConnection(e[o]);0==i.id?n.push(e[o]):t.push(i)}if(0==n.length)return t;{var o=k();const e=yield fetch(w.GetConnectionBulkUrl(),{method:"POST",headers:o,body:JSON.stringify(n)});if(e.ok){const n=yield e.json();if(n.length>0){for(let e=0;e<n.length;e++){let o=n[e];t.push(o),D.AddConnection(o)}yield H(t)}}else console.log("Get Connection Bulk error",e.status),R(e);return t}}catch(e){throw e instanceof Error?console.log("Get Connection Bulk error message: ",e.message):console.log("Get Connection Bulk unexpected error: ",e),e}}))}var dn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function un(e=[]){return dn(this,void 0,void 0,(function*(){yield J(e);var t=[];for(let o=0;o<e.length;o++){var n=yield te(e[o]);t.push(n)}return t}))}function hn(e=[]){return dn(this,void 0,void 0,(function*(){yield J(e);var t=[];for(let o=0;o<e.length;o++){var n=yield ne(e[o]);t.push(n)}return t}))}function fn(e=[],t=[]){return dn(this,void 0,void 0,(function*(){yield ln(t);var n=yield W(e);!function(e=[],t=[]){for(let n=0;n<t.length;n++)e.includes(t[n].id)||D.RemoveConnection(t[n])}(t,n);var o=[];for(let t=0;t<e.length;t++){var i=yield ne(e[t]);o.push(i)}return o}))}function yn(e){return dn(this,void 0,void 0,(function*(){let t=[],n=[],o={};for(let o=0;o<e.length;o++){let i=yield D.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 i=[],r=yield ln(t);n=[...n,...r];for(let e=0;e<n.length;e++)i.push(n[e].ofTheConceptId),i.push(n[e].toTheConceptId),i.push(n[e].typeId);return yield O(i),n}))}function pn(e=[],t=[]){return dn(this,void 0,void 0,(function*(){let n=[];for(let e=0;e<t.length;e++)0==(yield D.GetConnection(t[e])).id&&n.push(t[e]);yield ln(n);var o={};for(let t=0;t<e.length;t++){var i=yield ne(e[t]);o[e[t]]=i}return o}))}var vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function gn(e=0,t=[],n=""){return vn(this,void 0,void 0,(function*(){var o=[];try{var i=new an;i.composition=e,i.listLinkers=t,i.textSearch=n;var r=JSON.stringify(i),c=k();const l=yield fetch(w.RecursiveSearchUrl(),{method:"POST",headers:c,body:r});if(l.ok){const e=yield l.json();var a=e.compositionIds,s=e.internalConnections;e.externalConnections,o=yield fn(a,s)}else console.log("recursive search error ",l.status),R(l);return o}catch(e){throw e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),e}}))}var mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Cn(e,t){return mn(this,void 0,void 0,(function*(){try{var n={email:e,password:t},o=new Headers;o.append("Content-Type","application/json");var i=JSON.stringify(n);const r=yield fetch(w.LoginUrl(),{method:"POST",headers:o,body:i});if(r.ok){const e=yield r.json();return I.BearerAccessToken=e.data.token,e}console.log("Login tsccs error message: ",r.status),R(r)}catch(e){throw e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),e}}))}var Nn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Tn(e){return Nn(this,void 0,void 0,(function*(){return yield function(e="",t={}){return Nn(this,void 0,void 0,(function*(){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}:R(o),n}catch(e){throw console.log("Signup Error: ",e),e}}))}(w.SignupUrl(),e)}))}var wn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function In(e){return wn(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=w.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}:R(e),n}catch(e){throw console.log("Sign in api error",e),e}}))}function kn(e,t){return-1===e.indexOf(t)&&e.push(t),e}function An(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 xn(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 Rn(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 Sn(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 _n(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Ln(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class Gn{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&&(Fn.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 Un=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Fn{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 Gn(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Un(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Un(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}}Fn.root=null;var Vn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Pn(e,t,n,o,i=[]){var r,c;return Vn(this,void 0,void 0,(function*(){let a={};const s=[];if(0==e)return"";let l=Bn(n,e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield kt(e)),0!=l.id&&null==l.type){const e=l.typeId;let t=Bn(n,e);l.type=t,null==t&&null!=e&&null!=e&&(t=yield kt(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=Bn(n,d);if(null!=e&&0!=e.id||null==d||null==d||(e=yield kt(d)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield C.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield kt(t),e.type=n)}const l="the_",u=(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(u))){if(u){const e=yield Pn(d,t,n,o,i);a[u]=e}}else{const e=yield Pn(d,t,n,o,i);s[u]=e,a=s}}}return a}))}function Bn(e,t){let n=p();for(let o=0;o<e.length;o++)if(t==e[o].id)return n=e[o],n;return n}class Dn{constructor(){this.id=0,this.mainConcept=p(),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 Pn(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}));var e,t,n,o}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&("compositionUpdate",t=null===(e=this.id)||void 0===e?void 0:e.toString(),w.MQTT_CONNECTION&&w.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 En=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function On(e,t=null,n=null,o=null,i=null,r=null,c=null,a=null){return En(this,void 0,void 0,(function*(){const s=null!=i?i:999,l=null!=r?r:4,d=null!=c?c:999;let u=null!=o?o:0,h=p();null==a&&(a=new Dn);for(const o in e)if("object"==typeof e[o]||Array.isArray(e[o])){const f=yield Ze(o,"",!0,s,l,d);if(null==t&&null==n){let t=u;h=f,t=f.id,u=f.id,a.concepts.push(f),a.id=f.id,yield On(e[o],f.id,f.userId,t,i,r,c,a)}else{const s=null!=t?t:999,l=null!=n?n:999,y=u;h=f,a.concepts.push(f);const p=yield be(s,l,f.id,f.userId,y,d,f.userId);a.connections.push(p),yield On(e[o],f.id,f.userId,y,i,r,c,a)}null!=e[o]&&null!=e[o]&&a.subcompositions.push(f.id)}else{const i=null!=t?t:999,r=null!=n?n:999,c=u,h=yield Ze(o,e[o],!1,s,l,d);a.concepts.push(h);const f=yield be(i,r,h.id,h.userId,c,d,h.userId);a.connections.push(f)}return h}))}var bn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Hn(e){return bn(this,void 0,void 0,(function*(){const t=e.userId,n=e.sessionId,o=e.accessId;let i=[];const r=[];let c=p(),a=p();const s=[];let l=e.compositionId;const d=e.ofTheCompositionId;let u=[];if(l<0){let e=yield kt(l,t);if(!(e.id>0))return null;l=e.id}i=yield z(l);const h=[],f=new Dn,y=[];f.id=l,f.isUpdating();let v=[];for(let e=0;e<i.length;e++)kn(y,i[e].ofTheConceptId),kn(h,i[e].ofTheConceptId),kn(h,i[e].toTheConceptId),v.push(i[e].ofTheConceptId);f.subcompositions=y,f.connections=i;for(let e=0;e<h.length;e++){const t=yield kt(h[e]);l==h[e]&&(c=t),d==h[e]&&(a=t),r.push(t)}const g=e.patchObject;for(const e in g){let i=p();const l=g[e];let d=c;if(a.id>0&&(d=a),Array.isArray(l)||"object"==typeof l){i=yield Ze(e,"",!0,c.userId,4,999),f.subcompositions.push(i.id);const t=An(r,i);for(let e=0;e<t.length;e++)if(t[e].id>0){const n=Rn(f.connections,t[e].id);u=u.concat(n),s.push(t[e])}yield On(g[e],i.id,i.userId,c.id,c.userId,4,999,f)}else{i=yield Ze(e,l,!1,t,o,n);const c=An(r,i);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=Rn(f.connections,c[e].id);u=u.concat(t),s.push(c[e])}}const h=be(d.id,d.userId,i.id,i.userId,c.id,n,t);r.push(i),f.connections.push(h)}for(let e=0;e<u.length;e++)Ln(f.connections,u[e]),wt(u[e].id);for(let e=0;e<s.length;e++)_n(r,s[e]);return f.concepts=f.concepts.concat(r),f.mainConcept=c,f.id=c.id,yield f.updateCache(),Fn.addCompositionToTree(f),Oe.SyncDataOnline(),f.GetDataCache()}))}var Mn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Wn(e,t,n,o,i=10,r=1){return Mn(this,void 0,void 0,(function*(){var c=A("application/x-www-form-urlencoded",o),a=new URLSearchParams;a.append("type",e),a.append("search",t),a.append("composition",n),a.append("inpage",i.toString()),a.append("page",r.toString());const s=w.SearchCompositionsUrl()+"?"+a.toString();try{const e=yield fetch(s,{method:"GET",headers:c});return e.ok?yield e.json():(R(e),[])}catch(e){throw console.log("This is the searching error",e),e}}))}var jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function $n(e,t=""){return jn(this,void 0,void 0,(function*(){var n=A("application/json",t);const o=w.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),R(e),[])}catch(e){throw console.log("This is the searching error",e),e}}))}var Jn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Qn(e,t=[]){var n,o;return Jn(this,void 0,void 0,(function*(){let i=[];const r=[];let c={},a={};const s=yield Fn.getNodeFromTree(e),l=[];let d=yield C.GetConcept(e);if(0==d.id&&null!=e&&null!=e&&(d=yield K(e)),null==s){let s=[];s=t.length>0?Kn(e,t):yield z(e),i=s;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);Xn(d,i,r,l);let u=[];a=yield re(e,i,l,u),c[null!==(o=null===(n=null==d?void 0:d.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a}else a=s.value.GetDataCache(),c=a;return 0==d.id?"":c}))}function Kn(e,t){const n=[];for(let o=0;o<t.length;o++)t[o].typeId==e&&n.push(t[o]);return n}function qn(e,t=[]){var n,o;return Jn(this,void 0,void 0,(function*(){let i={},r=[];const c=[];let a;const s={},l=yield Fn.getNodeFromTree(e),d=[];let u=yield C.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield K(e)),null==l){let l=[];l=t.length>0?Kn(e,t):yield z(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);Xn(u,r,c,d),a=yield re(e,r,d),s[null!==(o=null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.characterValue)&&void 0!==o?o:""]=a,i.created_at=u.entryTimeStamp,i.data=s,i.id=e}else a=l.value.GetDataCache(),i=a;return 0==u.id?"":i}))}function zn(e,t){return Jn(this,void 0,void 0,(function*(){let n=[];const o=[];n=yield ln(t);for(let t=0;t<e.length;t++){const i=yield qn(e[t],n);i&&o.push(i)}return o}))}function Xn(e,t,n,o){return Jn(this,void 0,void 0,(function*(){const i=new Dn,r=yield function(e){return Jn(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 C.GetConcept(e[o]);0==i.id?n.push(e[o]):t.push(i)}return 0==(null==n?void 0:n.length)||(t=yield function(e){return E(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const n={"Content-Type":"application/json"};try{const o=yield fetch(w.GetConceptBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(o.ok){const e=yield o.json();if(e.length>0)for(let n=0;n<e.length;n++){const o=e[n];t.push(o),C.AddConcept(o)}}else R(o)}catch(e){throw e instanceof Error?console.log("bulk concept getter api error: ",e.message):console.log("bulk concept getter api error: ",e),e}}return t}))}(n)),t}))}(n);i.connections=t,i.concepts=r,i.id=e.id,i.subcompositions=o,i.mainConcept=e;const c=yield Pn(e.id,t,r,o,[]);i.cached=c,Fn.addCompositionToTree(i)}))}var Yn=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Zn(e){return Yn(this,void 0,void 0,(function*(){try{var t=k();const n=JSON.stringify(e),o=yield fetch(w.CreateSessionId(),{method:"POST",headers:t,body:n});return o.ok?o.json():(console.log("Creating session failed",yield o.json()),R(o),null)}catch(e){throw console.log("Creating session failed",e),e}}))}var eo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function to(e,t){return eo(this,void 0,void 0,(function*(){try{var n=k("application/x-www-form-urlencoded");const o=new URLSearchParams;o.append("sessionId",e.toString()),o.append("url",t);const i=yield fetch(w.CreateSessionVisitUrl(),{method:"POST",headers:n,body:o});return i.ok?i.json():(console.log("Creating session url failed",yield i.json()),R(i),null)}catch(e){throw console.log("Creating session url failed",e),e}}))}var no=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function oo(e,t,n=10,o=1){return no(this,void 0,void 0,(function*(){var i=[],r=yield kt(e),c=yield $t(t);if(c.id>0){for(var a=yield yt(c.id,r.id,r.userId,n,o),s=[],l=0;l<a.length;l++)s.push(a[l].toTheConceptId);for(yield J(s),l=0;l<a.length;l++){let e=a[l].toTheConceptId,t=yield kt(e),n=yield oe(t.id);i.push(n)}}return i}))}function io(e,t,n=10,o=1){return no(this,void 0,void 0,(function*(){var i=[],r=yield kt(e),c=yield $t(t);if(c.id>0){for(var a=yield yt(c.id,r.id,r.userId,n,o),s=[],l=0;l<a.length;l++)s.push(a[l].toTheConceptId);for(l=0;l<a.length;l++){let e=a[l].toTheConceptId,t=yield kt(e);i.push(t)}}return i}))}class ro{constructor(e,t,n,o,i){this.connectionValue=[],this.value=[],this.height=1,this.key=e,t.id>0&&this.value.push(t),n.id>0&&this.connectionValue.push(n),this.leftNode=o,this.rightNode=i}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.connectionValue.push(...e.connectionValue),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 co=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class ao{static compositeKey(e,t,n=999){return("0000"+e.toString(16).toUpperCase()).slice(-4)+("0000"+t.toString(16).toUpperCase()).slice(-4)+("0000"+n.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 co(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(s.isDataLoaded)return e("done");setTimeout(ao.checkFlag,1e3,e)}static addConceptToTree(e,t,n=999){let o=this.compositeKey(t,n,e.applicationId),i=new nt(0,0,0,0,0,0);var r=new ro(o,e,i,null,null);this.addNodeToTree(r)}static addConnectionToTree(e,t,n=999){let o=this.compositeKey(t,n,e.applicationId),i=we();var r=new ro(o,i,e,null,null);this.addNodeToTree(r)}static getNodeFromTree(e,t,n=999){return co(this,void 0,void 0,(function*(){let o=this.compositeKey(e,t,n);return this.root?this.root.getFromNode(o,this.root):null}))}static removeNodeFromTree(e,t=999,n=999){return co(this,void 0,void 0,(function*(){if(this.root){let o=this.compositeKey(e,t,n);this.root=this.root.removeNode(this.root,o)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}ao.root=null;var so=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function lo(e,t,n=999,o=999){return so(this,void 0,void 0,(function*(){let i=yield ao.getNodeFromTree(e,n,o),r=we();if(i)for(let e=0;e<i.value.length;e++){let n=i.value[e];n.ghostId==t&&(r=n)}return r}))}function uo(e,t,n=999,o=999){return so(this,void 0,void 0,(function*(){let i=yield ao.getNodeFromTree(e,n,o),r=new nt(0,0,0,0,0,0);if(i)for(let e=0;e<i.connectionValue.length;e++){let n=i.connectionValue[e];n.ghostId==t&&(r=n)}return r}))}function ho(e,t,n=999){return so(this,void 0,void 0,(function*(){ao.addConceptToTree(e,t,n)}))}function fo(e,t,n=999){return so(this,void 0,void 0,(function*(){ao.addConnectionToTree(e,t,n)}))}var yo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},po=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function vo(e,t=""){return po(this,void 0,void 0,(function*(){let n=[],o=yield function(e,t=""){return yo(this,void 0,void 0,(function*(){var n=A("application/json",t);const o=w.SearchLinkMultipleAllApiUrl(),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 multiple error",e.status),R(e),[])}catch(e){throw console.log("This is the searching multiple error",e),e}}))}(e,t),i=e[0].composition;const r=o;let c=r.compositionIds,a=r.internalConnections,s=r.linkers,l=r.reverse;return n=yield pn(c,a),yield go(s,n,i,l)}))}function go(e,t,n,o=[]){return po(this,void 0,void 0,(function*(){let i={},r=yield ln(e);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 kt(r[e].typeId),i=null==n?void 0:n.data,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 kt(r[e].typeId),i=null==n?void 0:n.data,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}))}function mo(e){var t,n;const o=we();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 Co(e){const t=p();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.characterValue=e.characterValue,t}function No(e){const t=new nt(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}var To=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function wo(e){return To(this,void 0,void 0,(function*(){const t=e.userId,n=e.sessionId;e.accessId;let o=[];const i=[];let r=we(),c=we();const a=[],s=e.compositionId,l=e.ofTheCompositionId;let d=[],u=yield z(s);for(let e=0;e<u.length;e++)o.push(No(u[e]));const h=[],f=[];let y=[];for(let e=0;e<o.length;e++)kn(f,o[e].ofTheConceptId),kn(h,o[e].ofTheConceptId),kn(h,o[e].toTheConceptId),y.push(o[e].ofTheConceptId);for(let e=0;e<h.length;e++){const t=yield kt(h[e]);s==h[e]&&(r=mo(t)),l==h[e]&&(c=mo(t)),i.push(mo(t))}const p=e.patchObject;for(const e in p){let s=we();const l=p[e];let u=r;c.id>0&&(u=c),Array.isArray(l)||"object"==typeof l?(s=yield dt(e,"",!0,r.userId,0,999),yield ht(p[e],s.id,s.userId,r.id,r.userId,4,999)):s=yield dt(e,l,!1,t,0,n);const h=xn(i,s);for(let e=0;e<h.length;e++)if(h[e].id>0){const t=Sn(o,h[e].id);d=d.concat(t),a.push(h[e])}yield ot(u.id,s.id,r.id,2),i.push(s)}for(let e=0;e<d.length;e++)wt(d[e].id);Oe.SyncDataOnline()}))}var Io=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},ko=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Ao(e){var t;return ko(this,void 0,void 0,(function*(){let n=yield function(e){return Io(this,void 0,void 0,(function*(){let t=[];try{var n=k();const o=yield fetch(w.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;O(i),n[r]=t}return n}return console.log("View Internal Data error",o.status),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}}))}(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 re(r,c,e);t.data=n,t.id=r,o.push(t)}else{let e={};e.id=r;let n=yield kt(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}))}var xo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ro=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function So(e,t=""){return Ro(this,void 0,void 0,(function*(){var n=yield function(e,t=""){return xo(this,void 0,void 0,(function*(){var n=A("application/json",t);let o=w.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),R(e),[])}catch(e){throw console.log("This is the searching internal error",e),e}}))}(e,t);return yield Ao(n)}))}class _o{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class Lo{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=""}}class Go{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0}}class Uo{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1}}var Fo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};var Vo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Po=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};class Bo{}Bo.isUpdated=!1,Bo.isOnlineSync=!1;var Do=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};var Eo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};const Oo=2,bo=3,Ho=6;class Mo{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var Wo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function jo(e){return Wo(this,void 0,void 0,(function*(){let t={};for(let n=0;n<e.length;n++){let o=yield K(e[n].connectionTypeId);e[n].connectionType=o.characterValue,t[e[n].conceptId]=e[n]}return t}))}function $o(e){const t=e.split("_");if(3===t.length){let e=new Mo;return e.conceptId=Number(t[0]),e.connectionTypeId=Number(t[1]),e.count=Number(t[2]),e}throw new Error("Input string must contain exactly three parts separated by underscores.")}function Jo(e){return e.startsWith("the_")?e.slice(4):e}var Qo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))},Ko=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function qo(e,t,n){var o,i,r,c,a,s,l,d;return Ko(this,void 0,void 0,(function*(){let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let h=!1;n.includes(e[u].id)&&(h=!0);let f=yield kt(e[u].ofTheConceptId),y=yield kt(e[u].toTheConceptId);if(1==h){if(0!=f.id&&0!=y.id){let n,a=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[u].toTheConceptId in t?n=t[e[u].toTheConceptId]:(n={},n[a]={},t[e[u].toTheConceptId]=n);let s=yield kt(e[u].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;s.characterValue,s.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let n,o=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";e[u].ofTheConceptId in t?n=t[e[u].ofTheConceptId]:(n={},n[o]={},t[e[u].ofTheConceptId]=n);let i=yield kt(e[u].typeId);try{let e=null!==(d=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=y.characterValue;i.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var zo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function Xo(e,t,n){if(e in t){let o=t[e];console.log("this is the count info",o),o&&(n[o.connectionType+"_count"]=o.count,console.log("this is the data updated",n))}}function Yo(e,t="DESC"){return console.log("this is the order",t),"ASC"==t?e.sort((function(e,t){return e.id-t.id})):e.sort((function(e,t){return t.id-e.id})),e}var Zo=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};var ei=function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function c(e){try{s(o.next(e))}catch(e){r(e)}}function a(e){try{s(o.throw(e))}catch(e){r(e)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,a)}s((o=o.apply(e,t||[])).next())}))};function ti(e,t){return ei(this,void 0,void 0,(function*(){e.outputFormat=Ho;let t,n=yield function(e,t=""){return Eo(this,void 0,void 0,(function*(){var n=A("application/json",t);const o=w.FreeschemaQueryUrl(),i=JSON.stringify(e);try{const e=yield fetch(o,{method:"POST",headers:n,body:i});return e.ok?yield e.json():(R(e),console.log("This is the freeschema query error",e.status),[])}catch(e){console.log("This is the freeschema query error others",e),function(e,t=""){if(e.status){let n=new x(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new x(e.message,!1,500,e.stack);throw n.setUrl(t),n}}(e,o)}}))}(e,""),o=(n.conceptIds,n.internalConnections,n.linkers),i=n.reverse,r=n.mainCompositionIds,c=n.countinfo,a=e.outputFormat,s=e.order,l=function(e=[]){let t=[];if(e.length>0)for(let n=0;n<e.length;n++){let o=$o(e[n]);t.push(o)}return t}(c);return t=a==Oo?yield function(e,t,n,o,i,r="DESC"){return Zo(this,void 0,void 0,(function*(){let t=yield yn(e);yield jo(i),t=Yo(t,r);let c=[];c=yield function(e,t,n=[]){var o,i,r,c,a,s,l,d;return Qo(this,void 0,void 0,(function*(){let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let h=!1,f=yield kt(e[u].ofTheConceptId),y=yield kt(e[u].toTheConceptId);if(n.includes(e[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield kt(e[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[u].toTheConceptId in t?n=t[e[u].toTheConceptId]:(n={},n[s]={},t[e[u].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;(a.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[y.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=y.id){let n,o=yield kt(e[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";e[u].ofTheConceptId in t?n=t[e[u].ofTheConceptId]:(n={},n[i]={},t[e[u].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",n=y.characterValue;o.characterValue.includes("_s_")&&(y.id in t||(t[y.id]={}),t[y.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}(t,c,o),c=yield function(e,t,n=[]){var o,i,r,c,a,s,l,d;return Qo(this,void 0,void 0,(function*(){let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let h=!1,f=yield kt(e[u].ofTheConceptId),y=yield kt(e[u].toTheConceptId);if(n.includes(e[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield kt(e[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[u].toTheConceptId in t?(n=t[e[u].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},t[e[u].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=a.characterValue;""==o&&(o=e,o=Jo(o));let i={id:f.id,data:{[e]:t}},l=o+"_reverse";l.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!=y.id){let n,o=yield kt(e[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";e[u].ofTheConceptId in t?(n=t[e[u].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[u].ofTheConceptId]=n);try{let e=null!==(d=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=y.characterValue,r=o.characterValue,c=!1;""==r&&(r=e,r=Jo(r),c=!0);let a={id:y.id,data:{[e]:t}};isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=a):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,c,o);let a=yield function(e,t,n,o,i=[],r){var c,a,s,l,d,u,h;return Qo(this,void 0,void 0,(function*(){(new Date).getTime();let n=[],r=[];for(let t=0;t<e.length;t++)r.push(e[t].toTheConceptId),r.push(e[t].ofTheConceptId),r.push(e[t].typeId);for(let n=0;n<e.length;n++){let o=!1,r=yield kt(e[n].ofTheConceptId),f=yield kt(e[n].toTheConceptId);if(i.includes(e[n].id)&&(o=!0),1==o){if(0!=r.id&&0!=f.id&&f.id in t){let o,i=yield kt(e[n].typeId),s=null!==(a=null===(c=f.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self",l=!1;e[n].toTheConceptId in t&&(l=!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 c={id:r.id,data:t[e[n].ofTheConceptId],created_on:e[n].entryTimeStamp},a=i.characterValue+"_reverse";Array.isArray(o[s][a])?o[s][a].push(c):a.includes("_s_")?(o[s][a]=[],o[s][a].push(c)):o[s][a]=c}}catch(e){console.log("this is error",e)}}}else if(0!=r.id&&0!=f.id&&r.id in t){let o,i=yield kt(e[n].typeId),c=null!==(l=null===(s=r.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},t[e[n].ofTheConceptId]=o);let y=!0,p=i.characterValue;""==p&&(p=f.characterValue,y=!0),""==p&&(p=null!==(u=null===(d=null==f?void 0:f.type)||void 0===d?void 0:d.characterValue)&&void 0!==u?u:"");try{null===(h=null==f?void 0:f.type)||void 0===h||h.characterValue;let r=t[e[n].toTheConceptId];if(r){let a={id:f.id,data:t[e[n].toTheConceptId],created_on:e[n].entryTimeStamp};Array.isArray(o[c])?o[c].push(r):Array.isArray(o[c][p])?o[c][i.characterValue].push(a):p.includes("_s_")?(o[c][p]=[],o[c][p].push(a)):o[c][p]=a}}catch(e){console.log("this is error",e)}}}for(let e=0;e<o.length;e++){let i={};i.id=o[e],i.data=t[o[e]],n.push(i)}return n}))}(t,c,0,n,o);return a}))}(o,0,r,i,l,s):a==bo?yield function(e,t,n,o,i,r="DESC"){return Zo(this,void 0,void 0,(function*(){let t=yield yn(e),c=yield jo(i);t=Yo(t,r);let a=[];a=yield qo(t,a,o),a=yield function(e,t,n=[]){var o,i,r,c,a,s,l,d;return zo(this,void 0,void 0,(function*(){let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);for(let u=0;u<e.length;u++){let h=!1,f=yield kt(e[u].ofTheConceptId),y=yield kt(e[u].toTheConceptId);if(n.includes(e[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield kt(e[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[u].toTheConceptId in t?(n=t[e[u].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},t[e[u].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=a.characterValue;""==o&&(o=e,o=Jo(o));let i={id:f.id,[e]:t},l=o+"_reverse";l.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!=y.id){let n,o=yield kt(e[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";e[u].ofTheConceptId in t?(n=t[e[u].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},t[e[u].ofTheConceptId]=n);try{let t=null!==(d=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",r=y.characterValue,c=o.characterValue,a=!1;""==c&&(c=t,c=Jo(c),a=!0);let s={};s[t]={id:y.id,data:r,created_on:e[u].entryTimeStamp},isNaN(Number(c))?c.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][c]=a?s[t]:s):n[i]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,a,o);let s=yield function(e,t,n,o=[],i){var r,c,a,s,l,d,u,h;return zo(this,void 0,void 0,(function*(){(new Date).getTime();let f=[],y=[];for(let t=0;t<e.length;t++)y.push(e[t].toTheConceptId),y.push(e[t].ofTheConceptId),y.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,y=yield kt(e[n].ofTheConceptId),p=yield kt(e[n].toTheConceptId);if(o.includes(e[n].id)&&(f=!0),1==f){if(0!=y.id&&0!=p.id&&p.id in t){let o,i=yield kt(e[n].typeId),a=null!==(c=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",s=!1;e[n].toTheConceptId in t&&(s=!0),e[n].toTheConceptId in t?(o=t[e[n].toTheConceptId],"string"==typeof o[a]&&(o[a]={})):(o={},o[a]={},t[e[n].toTheConceptId]=o);try{if(t[e[n].ofTheConceptId]){let r=t[e[n].ofTheConceptId];r&&(r.id=y.id,r.created_on=y.entryTimeStamp);let c=i.characterValue+"_reverse";Array.isArray(o[a][c])?o[a][c].push(r):c.includes("_s_")?(o[a][c]=[],o[a][c].push(r)):o[a][c]=r}}catch(e){console.log("this is error",e)}}}else if(0!=y.id&&0!=p.id&&y.id in t){let o,r=yield kt(e[n].typeId),c=null!==(s=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self",f=!1;e[n].toTheConceptId in t&&(f=!0),e[n].ofTheConceptId in t?(o=t[e[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},t[e[n].ofTheConceptId]=o),Xo(y.id,i,o);let v=!1,g=r.characterValue;""==g&&(g=p.characterValue,v=!0),""==g&&(g=null!==(d=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"");try{let r=null!==(h=null===(u=null==p?void 0:p.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"none",a=t[e[n].toTheConceptId];if(a){let t={};t[r]={data:a[r],id:p.id,created_on:e[n].entryTimeStamp},Array.isArray(o[c])?v?o[c].push(a[g]):o[c].push(a):Array.isArray(o[c][g])?o[c][g].push(t):g.includes("_s_")?(o[c][g]=[],v?o[c][g].push(t[r]):o[c][g].push(t)):o[c][g]=v?t[r]:t,Xo(p.id,i,t)}}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]),f.push(o)}return f}))}(t,a,n,o,c);return s}))}(o,0,r,i,l,s):yield function(e,t,n,o,i){return Zo(this,void 0,void 0,(function*(){let t=yield yn(e);t=Yo(t);let i=[];i=yield qo(t,i,o),i=yield function(e,t,n){var o,i,r,c,a,s,l,d;return Ko(this,void 0,void 0,(function*(){let u=[];for(let t=0;t<e.length;t++)u.push(e[t].toTheConceptId),u.push(e[t].ofTheConceptId),u.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let u=0;u<e.length;u++){let h=!1;n.includes(e[u].id)&&(h=!0);let f=yield kt(e[u].ofTheConceptId),y=yield kt(e[u].toTheConceptId);if(1==h){if(0!=f.id&&0!=y.id){let n,a=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";e[u].toTheConceptId in t?(n=t[e[u].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[u].toTheConceptId]=n);let s=yield kt(e[u].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=s.characterValue;""==o&&(o=e,o=Jo(o));let i={[e]:t},l=o+"_reverse";s.characterValue.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!=y.id){let n,o=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";e[u].ofTheConceptId in t?(n=t[e[u].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},t[e[u].ofTheConceptId]=n);let i=yield kt(e[u].typeId);try{let e=null!==(d=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"none",t=y.characterValue,r=i.characterValue,c=(i.characterValue,!1);""==r&&(r=e,r=Jo(r),c=!0);let a={[e]:t};isNaN(Number(r))?i.characterValue.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][r]=c?t:a):n[o]=[]}catch(e){console.log("this is error",e)}}}return t}))}(t,i,o);let r=yield function(e,t,n,o,i=[]){var r,c,a,s,l,d;return Ko(this,void 0,void 0,(function*(){let o=[],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;i.includes(e[n].id)&&(o=!0);let u=yield kt(e[n].ofTheConceptId),h=yield kt(e[n].toTheConceptId);if(1==o){if(0!=u.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 a=yield kt(e[n].typeId);try{let r=a.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(o[i][r])?o[i][r].push(c):a.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!=u.id&&0!=h.id&&u.id in t){let o,i=null!==(s=null===(a=u.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"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 kt(e[n].typeId)).characterValue;""==c&&(c=h.characterValue,r=!0),""==c&&(c=null!==(d=null===(l=null==h?void 0:h.type)||void 0===l?void 0:l.characterValue)&&void 0!==d?d:"");try{let a=t[e[n].toTheConceptId];a&&(Array.isArray(o[i])?r?o[i].push(a[c]):o[i].push(a):Array.isArray(o[i][c])?o[i][c].push(a):c.includes("_s_")?(o[i][c]=[],r?o[i][c].push(a[c]):o[i][c].push(a)):o[i][c]=r?a[c]:a)}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let i=t[n[e]];i&&(i.id=n[e],o.push(i))}return o}))}(t,i,n,0,o);return r}))}(o,0,r,i),t}))}function ni(e=""){I.BearerAccessToken=e}function oi(e="",t="",o=""){w.BASE_URL=e,w.AI_URL=t,console.log("This ist he base url",w.BASE_URL),I.BearerAccessToken=o,function(){return Do(this,void 0,void 0,(function*(){return yield new n(!0),yield function(){return Po(this,void 0,void 0,(function*(){try{(new Date).getTime();var e=A("application/x-www-form-urlencoded");const n=yield fetch(w.GetAllAiData(),{method:"GET",headers:e});n.ok||(console.log("Ai Error Message: ","Cannot get response"),R(n));const o=yield n.json();for(var t=0;t<o.length;t++)C.AddConcept(o[t])}catch(e){throw e instanceof Error?console.log("Ai Error Message: ",e.message):console.log("Ai Error Message: ",e),e}}))}(),!0}))}().then((()=>{const e=(new Date).getTime();(function(){return N(this,void 0,void 0,(function*(){(new Date).getTime();var e=yield c();if(Array.isArray(e))for(var t=0;t<e.length;t++){let n=e[t];C.AddConceptToMemory(n)}(new Date).getTime()}))})().then((()=>{s.isDataLoaded=!0,s.isCharacterLoaded=!0,s.isTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})),function(){return Vo(this,void 0,void 0,(function*(){var e=yield a();if(Array.isArray(e))for(var t=0;t<e.length;t++){let n=e[t];ke.AddConceptToMemory(n)}}))}().then((()=>{s.isLocalDataLoaded=!0,s.isLocalTypeLoaded=!0,s.isLocalCharacterLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})),function(){return Fo(this,void 0,void 0,(function*(){!function(){Fo(this,void 0,void 0,(function*(){var e=yield a();if(Array.isArray(e))for(var t=0;t<e.length;t++)xe.AddConnection(e[t])}))}()}))}().then((()=>{s.isLocalConnectionLoaded=!0})),function(){return Fo(this,void 0,void 0,(function*(){!function(){Fo(this,void 0,void 0,(function*(){var e=yield c();if(Array.isArray(e))for(var t=0;t<e.length;t++)D.AddConnectionToMemory(e[t])}))}()}))}().then((()=>{s.isConnectionLoaded=!0,s.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)}))}))}var ii=exports;for(var ri in t)ii[ri]=t[ri];t.__esModule&&Object.defineProperty(ii,"__esModule",{value:!0})})();
@@ -0,0 +1,2 @@
1
+ import { FreeschemaQuery } from "../../DataStructures/Search/FreeschemaQuery";
2
+ export declare function FreeschemaQueryApi(query: FreeschemaQuery, token?: string): Promise<any>;
@@ -0,0 +1,7 @@
1
+ export declare const NORMAL = 1;
2
+ export declare const DATAID = 2;
3
+ export declare const JUSTDATA = 3;
4
+ export declare const DATAIDDATE = 4;
5
+ export declare const RAW = 5;
6
+ export declare const ALLID = 6;
7
+ export declare const LISTNORMAL = 7;
@@ -45,4 +45,5 @@ export declare class BaseUrl {
45
45
  static CreateTheConnectionNewUrl(): string;
46
46
  static MakeTheTypeConceptUrl(): string;
47
47
  static DeleteTheConnectionUrl(): string;
48
+ static FreeschemaQueryUrl(): string;
48
49
  }
@@ -0,0 +1,6 @@
1
+ export declare class CountInfo {
2
+ conceptId: number;
3
+ connectionTypeId: number;
4
+ connectionType: string;
5
+ count: number;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { Concept } from "../Concept";
2
+ import { FilterSearch } from "../FilterSearch";
3
+ export declare class FreeschemaQuery {
4
+ type: string;
5
+ inpage: number;
6
+ page: number;
7
+ concepts: Concept[];
8
+ conceptIds: number[];
9
+ selectors: string[];
10
+ freeschemaQueries: FreeschemaQuery[];
11
+ filters: FilterSearch[];
12
+ filterLogic: string;
13
+ typeConnection: string;
14
+ order: string;
15
+ outputFormat: number;
16
+ name: string;
17
+ reverse: boolean;
18
+ limit: boolean;
19
+ includeInFilter: boolean;
20
+ isOldConnectionType: boolean;
21
+ }
@@ -0,0 +1,3 @@
1
+ import { CountInfo } from "../../DataStructures/Count/CountInfo";
2
+ export declare function DecodeCountInfo(countStrings?: string[]): CountInfo[];
3
+ export declare function GetConnectionTypeForCount(countInfos: CountInfo[]): Promise<any>;
@@ -1 +1,2 @@
1
1
  export declare function HandleHttpError(response: Response): void;
2
+ export declare function HandleInternalError(error: any, url?: string): void;
@@ -0,0 +1 @@
1
+ export declare function removeThePrefix(inputString: string): string;
@@ -1,4 +1,5 @@
1
1
  import { Concept } from "../../app";
2
2
  export declare function GetConceptByCharacterAndCategory(character: string): Promise<Concept>;
3
3
  export declare function GetConceptByCharacter(characterValue: string): Promise<Concept>;
4
+ export declare function GetConceptByCharacterSingle(characterValue: string): Promise<Concept>;
4
5
  export declare function GetConceptByCharacterAndCategoryFromMemory(character: string, category: number): Promise<Concept>;
@@ -1,4 +1,11 @@
1
+ import { Connection } from "../DataStructures/Connection";
1
2
  export declare function GetCompositionBulk(ids?: number[]): Promise<any[]>;
2
3
  export declare function GetCompositionBulkWithDataId(ids?: number[]): Promise<any[]>;
3
4
  export declare function GetCompositionFromConnectionsWithDataId(ids?: number[], connections?: number[]): Promise<any[]>;
5
+ /**
6
+ * Used to prefetch all the connections and their related concepts.
7
+ * @param connectionIds these are the connection ids that are used to fetch all the connections and also their related concepts.
8
+ * @returns all the connections that are passed as ids.
9
+ */
10
+ export declare function GetConnectionDataPrefetch(connectionIds: number[]): Promise<Connection[]>;
4
11
  export declare function GetCompositionFromConnectionsWithDataIdInObject(ids?: number[], connections?: number[]): Promise<any>;
@@ -0,0 +1,32 @@
1
+ import { Connection } from "../../app";
2
+ /**
3
+ * ## Format DATA-ID ##
4
+ * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
5
+ * This is then passed on further for stiching.
6
+ * @param connections
7
+ * @param compositionData
8
+ * @param reverse
9
+ * @returns
10
+ */
11
+ export declare function FormatFunctionDataForData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
12
+ /**
13
+ * ############ Format is data-id and is used for list. ############
14
+ * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
15
+ * The list format is helpful because you do not have to go over each individual query.
16
+ * @param connections the type connections that need (external connections) to be passed
17
+ * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
18
+ * @param mainComposition this is list of ids of the main composition that builds the tree
19
+ * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
20
+ * @returns
21
+ */
22
+ export declare function FormatFromConnectionsAlteredArrayExternal(connections: Connection[], compositionData: any[], newCompositionData: any, mainComposition: number[], reverse: number[] | undefined, CountDictionary: any[]): Promise<any[]>;
23
+ /**
24
+ * ## Format DATA-ID ##
25
+ * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
26
+ * This is then passed on further for stiching.
27
+ * @param connections
28
+ * @param compositionData
29
+ * @param reverse
30
+ * @returns
31
+ */
32
+ export declare function FormatFunctionData(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
@@ -0,0 +1,26 @@
1
+ import { Connection } from "../../app";
2
+ /**
3
+ *
4
+ * ## Format Normal ##
5
+ * This function takes in the connections and then converts the connections to the single level objects for further processing
6
+ * This function is the builder of the arrays/ objects from the connections.
7
+ */
8
+ export declare function formatFunction(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
9
+ /**
10
+ *
11
+ * ## Format Normal ##
12
+ * This function takes in the connections and then converts the connections to the single level objects for further processing
13
+ * This function is the builder of the arrays/ objects from the connections.
14
+ */
15
+ export declare function formatFunctionForData(connections: Connection[], compositionData: any, reverse: number[]): Promise<any>;
16
+ /**
17
+ * ######### Format is normal ######### used for listing. This only provides type connections.
18
+ * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
19
+ * The list format is helpful because you do not have to go over each individual query.
20
+ * @param connections the type connections that need (external connections) to be passed
21
+ * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
22
+ * @param mainComposition this is list of ids of the main composition that builds the tree
23
+ * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
24
+ * @returns
25
+ */
26
+ export declare function FormatConceptsAndConnectionsNormalList(connections: Connection[], compositionData: any[], mainComposition: number[], newCompositionData: any, reverse?: number[]): Promise<any[]>;
@@ -0,0 +1,23 @@
1
+ import { Connection } from "../../app";
2
+ /**
3
+ * ## Format Just-Id ##
4
+ * this function takes in connections and creates a single level objects so that all the data are added to its object/ array.
5
+ * This is then passed on further for stiching.
6
+ * @param connections
7
+ * @param compositionData
8
+ * @param reverse
9
+ * @returns
10
+ */
11
+ export declare function FormatFunctionDataForDataJustId(connections: Connection[], compositionData: any[], reverse?: number[]): Promise<any[]>;
12
+ /**
13
+ * ############ Format is Just Id and is used for list. ############
14
+ * This is helpful in building a format that has multiple mainCompositions i.e. in the context of the list
15
+ * The list format is helpful because you do not have to go over each individual query.
16
+ * @param connections the type connections that need (external connections) to be passed
17
+ * @param compositionData this is a dictionary type of format that has all the build compositions {id: { actual data}}
18
+ * @param mainComposition this is list of ids of the main composition that builds the tree
19
+ * @param reverse this is the list of connections ids that needs to go to the reverse direction (to---->from)
20
+ * @returns
21
+ */
22
+ export declare function FormatFromConnectionsAlteredArrayExternalJustId(connections: Connection[], compositionData: any[], mainComposition: number[], reverse: number[] | undefined, CountDictionary: any[]): Promise<any[]>;
23
+ export declare function AddCount(ofTheConceptId: number, CountDictionary: any, newData: any): void;
@@ -0,0 +1,34 @@
1
+ import { CountInfo } from "../../DataStructures/Count/CountInfo";
2
+ /**
3
+ * ## Format Normal ##
4
+ * This function fetches all the connections and then converts all the connections to the single level connections
5
+ * Then those single level objects are then stiched together to create a complex json/ array.
6
+ * @param linkers
7
+ * @param conceptIds
8
+ * @param mainCompositionIds
9
+ * @param reverse
10
+ * @returns
11
+ */
12
+ export declare function formatConnections(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[]): Promise<any>;
13
+ /**
14
+ * ## Format DATA-ID ##
15
+ * This function fetches all the connections and then converts all the connections to the single level connections
16
+ * Then those single level objects are then stiched together to create a complex json/ array.
17
+ * @param linkers
18
+ * @param conceptIds
19
+ * @param mainCompositionIds
20
+ * @param reverse
21
+ * @returns
22
+ */
23
+ export declare function formatConnectionsDataId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
24
+ /**
25
+ * ## Format JustId ##
26
+ * This function fetches all the connections and then converts all the connections to the single level connections
27
+ * Then those single level objects are then stiched together to create a complex json/ array.
28
+ * @param linkers
29
+ * @param conceptIds
30
+ * @param mainCompositionIds
31
+ * @param reverse
32
+ * @returns
33
+ */
34
+ export declare function formatConnectionsJustId(linkers: number[], conceptIds: number[], mainCompositionIds: number[], reverse: number[], countInfos: CountInfo[], order?: string): Promise<any>;
@@ -0,0 +1,2 @@
1
+ import { Connection } from "../../app";
2
+ export declare function orderTheConnections(connections: Connection[], order?: string): Connection[];
@@ -0,0 +1,24 @@
1
+ import { FreeschemaQuery } from "../DataStructures/Search/FreeschemaQuery";
2
+ export declare class SearchLinkMultipleAllObservable {
3
+ mainCompositionIds: number[];
4
+ query: FreeschemaQuery;
5
+ countInfoStrings: string[];
6
+ order: string;
7
+ format: number;
8
+ isDataLoaded: boolean;
9
+ conceptIds: number[];
10
+ internalConnections: number[];
11
+ linkers: number[];
12
+ reverse: number[];
13
+ data: any;
14
+ constructor(query: FreeschemaQuery, token: string);
15
+ }
16
+ /**
17
+ *
18
+ * @param id this is the id whose links need to be found
19
+ * @param linker this is the type connection that is connected to the mainConcept(id)
20
+ * @param inpage number of outputs that has to be displayed
21
+ * @param page the page which needs to be displayed as per the inpage parameter
22
+ * @param format the format in which the output should be displayed (NORMAL, DATAID,JUSTDATA,DATAIDDATE)
23
+ */
24
+ export declare function SchemaQueryListener(query: FreeschemaQuery, token: string): Promise<any>;
@@ -76,5 +76,6 @@ export { FilterSearch } from './DataStructures/FilterSearch';
76
76
  export { SearchStructure } from './DataStructures/Search/SearchStructure';
77
77
  export { FreeSchemaResponse } from './DataStructures/Responses/ErrorResponse';
78
78
  export { BaseUrl } from './DataStructures/BaseUrl';
79
+ export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
79
80
  declare function updateAccessToken(accessToken?: string): void;
80
81
  declare function init(url?: string, aiurl?: string, accessToken?: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-node",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/bundle.js",
@@ -1,2 +0,0 @@
1
- import { Concept } from "./../../DataStructures/Concept";
2
- export declare function GetConceptByCharacterAndCategory(characterValue: string): Promise<Concept>;