mftsccs-node 0.0.39 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundle.js CHANGED
@@ -1 +1,2 @@
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,{ALLID:()=>ti,AddGhostConcept:()=>wo,AddGhostConnection:()=>Io,BaseUrl:()=>w,BinaryTree:()=>f,Composition:()=>Qn,CompositionBinaryTree:()=>jn,CompositionNode:()=>Hn,Concept:()=>y,ConceptsData:()=>m,Connection:()=>L,ConnectionData:()=>D,CreateComposition:()=>se,CreateConnectionBetweenTwoConcepts:()=>Fe,CreateConnectionBetweenTwoConceptsGeneral:()=>Pe,CreateDefaultConcept:()=>p,CreateDefaultLConcept:()=>It,CreateSession:()=>lo,CreateSessionVisit:()=>ho,CreateTheCompositionLocal:()=>me,CreateTheCompositionWithCache:()=>qn,CreateTheConnection:()=>Ot,CreateTheConnectionGeneral:()=>Ie,CreateTheConnectionLocal:()=>de,DATAID:()=>zo,DATAIDDATE:()=>Yo,DeleteConceptById:()=>hn,DeleteConnectionById:()=>_e,FilterSearch:()=>Ho,FormatFromConnections:()=>Ro,FreeSchemaResponse:()=>x,FreeschemaQuery:()=>vi,GetAllConnectionsOfComposition:()=>X,GetAllConnectionsOfCompositionBulk:()=>J,GetComposition:()=>tt,GetCompositionBulk:()=>Tn,GetCompositionBulkWithDataId:()=>wn,GetCompositionFromConnectionsWithDataId:()=>In,GetCompositionFromConnectionsWithDataIdInObject:()=>An,GetCompositionList:()=>ft,GetCompositionListLocal:()=>Pt,GetCompositionListLocalWithId:()=>Bt,GetCompositionListWithId:()=>yt,GetCompositionLocal:()=>_t,GetCompositionLocalWithId:()=>Lt,GetCompositionWithAllIds:()=>et,GetCompositionWithCache:()=>oo,GetCompositionWithDataIdBulk:()=>co,GetCompositionWithDataIdWithCache:()=>ro,GetCompositionWithId:()=>rt,GetConceptBulk:()=>O,GetConceptByCharacter:()=>ut,GetConceptByCharacterAndCategoryDirectApi:()=>Ye,GetConceptByCharacterAndType:()=>jt,GetConnectionBulk:()=>mn,GetConnectionById:()=>Re,GetConnectionOfTheConcept:()=>Te,GetLink:()=>De,GetLinkRaw:()=>Ee,GetLinkerConnectionFromConcepts:()=>sn,GetLinkerConnectionToConcepts:()=>ln,GetRelation:()=>yo,GetRelationRaw:()=>po,GetTheConcept:()=>Ge,GetUserGhostConnectionId:()=>To,GetUserGhostId:()=>No,HandleHttpError:()=>R,JUSTDATA:()=>Xo,LConcept:()=>wt,LConnection:()=>le,LISTNORMAL:()=>ei,LoginToBackend:()=>_n,MakeTheInstanceConcept:()=>ce,MakeTheInstanceConceptLocal:()=>ge,MakeTheTimestamp:()=>vn,MakeTheTypeConcept:()=>qe,MakeTheTypeConceptApi:()=>on,NORMAL:()=>qo,PatcherStructure:()=>Oo,RAW:()=>Zo,RecursiveSearchApi:()=>Rn,SchemaQueryListener:()=>pi,SearchAllConcepts:()=>Zn,SearchLinkInternal:()=>Eo,SearchLinkMultipleAll:()=>xo,SearchQuery:()=>gn,SearchStructure:()=>Mo,SearchWithLinker:()=>eo,SessionData:()=>bo,Signin:()=>Fn,Signup:()=>Gn,SplitStrings:()=>T,SyncData:()=>Et,TrashTheConcept:()=>yn,UpdateComposition:()=>Xn,UpdateCompositionLocal:()=>Uo,UserBinaryTree:()=>Co,ViewInternalData:()=>Po,convertFromLConceptToConcept:()=>_o,getFromDatabaseWithType:()=>r,getFromDatabaseWithTypeOld:()=>c,init:()=>Ci,recursiveFetch:()=>ct,recursiveFetchNew:()=>$n,storeToDatabase:()=>i,updateAccessToken:()=>gi});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,p=!1,v,g){this.referent=null,this.updateRecursion=!1,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.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 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 v=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 v(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 v(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 v(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 v(this,void 0,void 0,(function*(){let n=p();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 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())}))};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);f.removeNodeFromTree(t.id),t.id}static GetConcept(t){return C(this,void 0,void 0,(function*(){var e=p(),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 C(this,void 0,void 0,(function*(){var e=p(),n=u.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterUpdated(t){return C(this,void 0,void 0,(function*(){var e=p(),n=u.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterAndTypeLocal(t,e){return C(this,void 0,void 0,(function*(){return p(),yield g.getTypeVariantsWithCharacterValue(t,e)}))}static GetConceptByCharacterAndCategoryLocal(t,e){return C(this,void 0,void 0,(function*(){var n=p(),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 C(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 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 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"}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(t="application/json",e="application/json"){return{"Content-Type":t,Authorization:"Bearer "+I.BearerAccessToken,Accept:e}}function A(t="application/json",e="",n="application/json"){return""==e&&(e=I.BearerAccessToken),{"Content-Type":t,Authorization:"Bearer "+e,Accept:n}}I.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 _(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=k("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 L{constructor(t=0,e,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=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=v,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class G{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 G(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 V=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 V(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 V(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 G(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 V(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 V(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 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 D{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 B(this,void 0,void 0,(function*(){var e=new L(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 B(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}}D.connectionArray=[],D.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 O(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=k();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 O(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 j(t=[]){return M(this,void 0,void 0,(function*(){var e=[];for(let o=0;o<t.length;o++){var n=yield D.GetConnectionsOfCompositionLocal(t[o]);e.push(...n)}return e}))}function W(t=[],e=[]){for(let n=0;n<e.length;n++)Array.isArray(t)&&(t.find((t=>t.id===e[n].id))||D.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 j(t),o=yield function(t=[]){return $(this,void 0,void 0,(function*(){var e=[];try{var n=k();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++)D.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 W(e=o,n),yield H(e),e}))}var Q=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())}))};const K=new Map;function q(t){return Q(this,void 0,void 0,(function*(){let e=p();if(K.has(t))return K.get(t)||e;const n=(()=>Q(this,void 0,void 0,(function*(){try{var n=yield m.GetConcept(t);let i=m.GetNpc(t);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=${t}`});return 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}finally{K.delete(t)}})))();return K.set(t,n),n}))}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 X(t){return z(this,void 0,void 0,(function*(){var e=[];if(0==(e=yield D.GetConnectionsOfCompositionLocal(t)).length)e=yield Y(t);else{var n=yield Y(t);W(n,e),e=n}return e}))}function Y(t){return z(this,void 0,void 0,(function*(){var e=[];try{var n=k("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++)D.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 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 tt(t){var e,n;return Z(this,void 0,void 0,(function*(){var o,i={};o=yield X(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 Z(this,void 0,void 0,(function*(){var o,i={};o=yield X(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 at(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 Z(this,void 0,void 0,(function*(){var o,i={};o=yield D.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 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 ot(t){var e,n;return Z(this,void 0,void 0,(function*(){var o,i={};o=yield D.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 ct(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 it(t){var e,n;return Z(this,void 0,void 0,(function*(){var o,i={};o=yield D.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 ct(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 rt(t){var e,n;return Z(this,void 0,void 0,(function*(){var o,i={};o=yield X(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);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 ct(t,e,n,o=[]){var i,r,c;return Z(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 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 t=yield ct(f,e,n,o);a[p]=t}}else{const t=yield ct(f,e,n,o);s[p]=t,a=s}}return a}))}function at(t,e,n,o=[]){var i,r,c;return Z(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 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 t=yield at(f,e,n);a[p]=t}}else{const t=yield at(f,e,n);s[p]=t,a=s}}return a}))}var st=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 lt(t){return st(this,void 0,void 0,(function*(){let e=p();try{var n=k("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&&(console.log("This is adding the new concept",e),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 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 ut(t){return dt(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 lt(t),e=yield m.GetConceptByCharacter(t)),e}))}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())}))};function ft(t,e,n=10,o=1){return ht(this,void 0,void 0,(function*(){var i=yield ut(t),r=[];if(i){yield _(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}))}function yt(t,e,n=10,o=1){return ht(this,void 0,void 0,(function*(){var i=yield ut(t),r=[];if(i){yield _(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 ot(c[l].id);r.push(d)}}return r}))}class pt{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 gt{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 pt(t.id,t,null,null);new pt(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(gt.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))}))}}gt.root=null;var Ct=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 mt{static waitForDataToLoad(){return Ct(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(mt.checkFlag,1e3,t)}static addNodeToTree(t){return Ct(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 pt(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 Ct(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))}}mt.LocalCharacterRoot=null;var Nt=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 Tt{static addNodeToTree(t){return Nt(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 pt(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 Nt(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(Tt.checkFlag,1e3,t)}static getTypeVariantsFromTreeWithUserId(t,e){return Nt(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}))}}Tt.LocalTypeRoot=null;class wt{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 It(){let t=new Date,e=new Date;return new wt(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 At{constructor(){this.name="conceptsArray"}static AddConcept(t){t.id>0&&(gt.addConceptToTree(t),mt.addConceptToTree(t),Tt.addConceptToTree(t),this.localconceptsArray.push(t))}static AddConceptToMemory(t){t.id>0&&(gt.addConceptToTree(t),mt.addConceptToTree(t),Tt.addConceptToTree(t))}static GetConcept(t){return kt(this,void 0,void 0,(function*(){var e=It(),n=yield gt.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=It(),n=mt.getNodeFromTree(t);return n&&(e=n.value),e}))}static GetConceptByCharacterAndTypeLocal(t,e){return kt(this,void 0,void 0,(function*(){var n=It(),o=yield mt.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 Tt.getTypeVariantsFromTreeWithUserId(t,e),n}))}getName(){return this.name}}At.localconceptsArray=[];var xt=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 Rt{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 xt(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(Rt.checkFlag,1e3,t)}static GetConnectionsOfCompositionLocal(t){return xt(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}}Rt.connectionArray=[],Rt.connectionDictionary=[];var St=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){var e,n;return St(this,void 0,void 0,(function*(){var o,i={};o=yield Rt.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield At.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 St(this,void 0,void 0,(function*(){var o,i={};o=yield Rt.GetConnectionsOfCompositionLocal(t);for(var r=[],c=0;c<o.length;c++)r.includes(o[c].ofTheConceptId)||r.push(o[c].ofTheConceptId);var a=yield At.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 St(this,void 0,void 0,(function*(){var a={},s=[],l=yield At.GetConcept(t);if(0!=l.id&&null==l.type){var d=l.typeId,u=yield At.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 At.GetConcept(f);0!=y.id&&null==(null==y?void 0:y.type)&&(d=y.typeId,u=yield At.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 t=yield Gt(f,e,n);a[p]=t}}else{const t=yield Gt(f,e,n);s[p]=t,a=s}}return a}))}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 Ft(t){return Ut(this,void 0,void 0,(function*(){return yield At.GetConceptByCharacter(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())}))};function Pt(t,e){return Vt(this,void 0,void 0,(function*(){var n=yield Ft(t),o=[];if(n)for(var i=yield At.GetConceptsByTypeIdAndUser(n.id,e),r=0;r<i.length;r++){var c=yield _t(i[r].id);o.push(c)}return o}))}function Bt(t,e){return Vt(this,void 0,void 0,(function*(){var n=yield Ft(t),o=[];if(n)for(var i=yield At.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())}))};class Et{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 Dt(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++)D.AddConnection(this.connectionSyncArray[t]);if(this.conceptsSyncArray.length>0){let t=this.conceptsSyncArray.slice();this.conceptsSyncArray=[],function(t){var e,n,o,i;e=this,n=void 0,i=function*(){let e=p();try{var n=k();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}},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())}))}(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 L(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);try{var n=k(),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 Dt(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 Ot(t,e,n,o,i,r,c){var a=new L(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()),Et.AddConnection(a),a)}Et.conceptsSyncArray=[],Et.connectionSyncArray=[];var bt=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())}))},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())}))};const Mt=new Map;function jt(t,e){return Ht(this,void 0,void 0,(function*(){let n=yield m.GetConceptByCharacterAndTypeLocal(t,e),o=t+e;if(Mt.has(o))return Mt.get(o)||n;const i=(()=>Ht(this,void 0,void 0,(function*(){try{if(null==n||0==n.id){var i={character_value:`${t}`,type_id:e},r=JSON.stringify(i),c=k();const o=yield fetch(w.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:c,body:r});if(o.ok){let t=yield o.json();n=t,m.AddConcept(n)}else console.log("This is the concept by type and character error",o.status),R(o)}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}finally{Mt.delete(o)}})))();return Mt.set(o,i),i}))}class Wt{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 $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())}))};let Jt=!1,Qt=[];const Kt=()=>{Qt.length>0&&!Jt&&Qt.shift()()};var qt=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())}))};let zt=!1,Xt=[];const Yt=()=>{Xt.length>0&&!zt&&Xt.shift()()};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())}))};class te{static getId(){return Zt(this,void 0,void 0,(function*(){this.ids.length<10&&(yield function(){return qt(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{console.log("trying to fetch more concepts"),Xt.push((()=>qt(this,void 0,void 0,(function*(){try{if(zt)return;if(zt=!0,te.ids.length>10)return console.log("Enough IDs available, skipping fetch."),zt=!1,Yt(),t();var n=k("application/x-www-form-urlencoded");const e=yield fetch(w.GetReservedIdUrl(),{method:"GET",headers:n});if(!e.ok)throw R(e),new Error(`Error! status: ${e.status}`);const i=yield e.json();for(var o=0;o<i.length;o++)te.AddId(i[o]);console.log("Ids Fetch Success"),t()}catch(t){t instanceof Error?console.log("get reserved ids error message: ",t.message,w.GetReservedConnectionIdUrl()):console.log("get reserved ids unexpected error: ",t),e(t)}finally{zt=!1,Yt()}})))),Yt()}))}))}());var t=this.ids[0];return this.ids.shift(),t}))}static AddId(t){this.ids.includes(t)||this.ids.push(t)}}te.ids=[];class ee{static getId(){return Zt(this,void 0,void 0,(function*(){this.connectionIds.length<10&&(yield function(){return $t(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{Qt.push((()=>$t(this,void 0,void 0,(function*(){try{if(Jt)return;if(Jt=!0,ee.connectionIds.length>10)return Jt=!1,Kt(),t();var n=k("application/x-www-form-urlencoded");const e=yield fetch(w.GetReservedConnectionIdUrl(),{method:"GET",headers:n});if(!e.ok)throw R(e),new Error(`Error! status: ${e.status}`);const i=yield e.json();for(var o=0;o<i.length;o++)ee.AddId(i[o]);t()}catch(t){t instanceof Error?console.log("get reserved connection ids error message: ",t.message):console.log("get reserved connection ids unexpected error: ",t),e(t)}finally{Jt=!1,Kt()}})))),Kt()}))}))}());var t=this.connectionIds[0];return this.connectionIds.shift(),t}))}static AddId(t){this.connectionIds.includes(t)||this.connectionIds.push(t)}}ee.connectionIds=[];var 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())}))};function oe(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return ne(this,void 0,void 0,(function*(){var p=yield te.getId();let v=new Date,g=new Date;var C=new y(p,e,i,r,n,o,c,a,t,s,l,d,u,h,f,!0,v,g);return C.isTemp=!1,Et.AddConcept(C),C}))}function ie(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return ne(this,void 0,void 0,(function*(){var p=yield te.getId();let v=new Date,g=new Date;var C=new y(p,e,i,r,n,o,c,a,t,s,l,d,u,h,f,!1,v,g);return m.AddConcept(C),C.updateRecursion=!0,Et.AddConcept(C),C}))}var re=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,e,n=!1,o,i,r=999,c=0){return re(this,void 0,void 0,(function*(){let a,s=r,l=999,d=o,u=o,h=i,f=o,y="",v=e.length,g=p();y=t.startsWith("the_")?t:"the_"+t;(new Date).getTime();if(n)g=yield on(t),a=yield oe(e,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u),(new Date).getTime();else if(v>255)g=yield on(y),a=yield oe(e,o,4,o,g.id,g.userId,c,999,l,d,h,f,s,u),function(t){bt(this,void 0,void 0,(function*(){try{var e=k();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 Wt(o,e,l,d,h,f,s,u,Date.now().toString(),!0)),(new Date).getTime();else{g=yield on(y);let t=yield jt(e,g.id);a=t,0==t.id&&0==t.userId&&(a=yield ie(e,o,4,o,g.id,g.userId,12,12,l,d,h,f,s,u)),(new Date).getTime()}return a.type=g,a}))}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 se(t,e=null,n=null,o=null,i=null,r=null,c=null){return ae(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 t)if("string"!=typeof t[o]&&"number"!=typeof t[o])if(null==e&&null==n){var h=d;u=v=yield ce(o,"",!0,a,s,l),h=v.id,d=v.id,yield se(t[o],v.id,v.userId,h,i,r,c)}else{var f=null!=e?e:999,y=null!=n?n:999;h=d,u=v=yield ce(o,"",!0,a,s,l),yield Ot(f,y,v.id,v.userId,h,l,v.userId),yield se(t[o],v.id,v.userId,h,i,r,c)}else{f=null!=e?e:999,y=null!=n?n:10267,h=d;var v=yield ce(o,t[o],!1,a,s,l);yield Ot(f,y,v.id,v.userId,h,l,v.userId)}return u}))}class le{constructor(t=0,e,n,o,i,r,c=999){this.isTemp=!1,this.applicationId=999,this.type=It(),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 de(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 le(0,0,0,0,0,0);return t!=e&&(a=new le(0,t,e,n,o,4),a.isTemp=!0,a.id=Math.floor(1e8*Math.random()),Rt.AddConnection(a)),a}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,n,o,i,r,c=0){return ue(this,void 0,void 0,(function*(){var a=Math.floor(1e8*Math.random());let s=new Date,l=new Date;var d=new wt(a,n,i,o,r,t,e,!0,s,l,c);return d.isTemp=!0,At.AddConcept(d),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())}))},ye=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){return ye(this,void 0,void 0,(function*(){var i=yield Ft(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 fe(this,void 0,void 0,(function*(){var e=yield At.GetConceptByCharacterAndTypeLocal(t,51),o=e;return 0==o.id&&(o=e=yield he(t,"the",n,4,51,4)),o}))}(t,0,o);i=c}else{var a=yield pe(r[0],e,n,o),s=yield pe(r[1],e,n,o);s&&(i=c=yield he(t,r[1],o,a.id,s.id,4))}}return i}))}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 ge(t,e,n=!1,o,i,r=999,c=0){return ve(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 pe(t,999,o,o),r=yield he(e,t,o,4,i.id,4,c);else if(l>255)i=yield pe(a,999,s,o),r=yield he(e,a,o,4,i.id,4);else{i=yield pe(a,999,s,o);var d=yield At.GetConceptByCharacterAndTypeLocal(e,i.id);r=d,0==d.id&&0==d.userId&&(r=yield he(e,a,o,4,i.id,4))}return r.type=i,r}))}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())}))};function me(t,e=null,n=null,o=null,i=null,r=null,c=null){return Ce(this,void 0,void 0,(function*(){var a=null!=i?i:999,s=null!=c?c:4,l=null!=o?o:0,d=It();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 ge(o,"",!0,a,0,s),u=f.id,l=f.id,yield me(t[o],f.id,f.userId,u,i,r,c)}else{var h=null!=e?e:999,f=(u=l,yield ge(o,"",!0,a,0,s));yield de(h,f.id,u),yield me(t[o],f.id,f.userId,u,i,r,c)}else h=null!=e?e:999,u=l,f=yield ge(o,t[o],!1,a,0,s),yield de(h,f.id,u);return d}))}var 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())}))};function Te(t,e,n,o=10,i=1){return Ne(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=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(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 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())}))};function Ie(t,e,n,o,i,r,c,a=1,s=4,l=999){return we(this,void 0,void 0,(function*(){let d=e,u=e,h=e;999!=l&&(h=l);let f=e,y=e,p=yield ee.getId(),v=new L(p,t,n,e,o,h,i,u,a,d,0,f,s,y,r,c);return t==n?(v.ofTheConceptId=0,v.toTheConceptId=1,v):(v.toUpdate=!0,v.isTemp=!1,Et.AddConnection(v),v)}))}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())}))},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())}))},xe=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){return xe(this,void 0,void 0,(function*(){var e=yield D.GetConnection(t);if((null==e||0==e.id)&&null!=t&&null!=t){var n=yield function(t){return Ae(this,void 0,void 0,(function*(){var e=yield D.GetConnection(t);try{if(0!=e.id)return e;{var n=k("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(),D.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 Se=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,e=""){return Se(this,void 0,void 0,(function*(){let n=!1;var o=yield Re(t);return n=yield function(t,e=""){return ke(this,void 0,void 0,(function*(){let n=!1;try{const o=new FormData;let i=k("application/x-www-form-urlencoded");""!=e&&(i=A("application/x-www-form-urlencoded",e)),o.append("id",t.toString());const r=yield fetch(w.DeleteTheConnectionUrl(),{method:"POST",body:o,redirect:"follow"});r.ok?n=(yield r.json()).success:(console.log("Delete connection error status: ",r.status),R(r))}catch(t){throw t instanceof Error?console.log("Delete connection error message: ",t.message):console.log("Delete connection unexpected error: ",t),t}return n}))}(t,e),F.removeNodeFromTree(t),P.removeTypeConcept(o.typeId,t),n}))}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=999){return Le(this,void 0,void 0,(function*(){var n=p();if(t<0)return _o(yield No(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 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 Fe(t,e,n,o=!1,i=!1){var r,c;return Ue(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 Ve(c,e,a));var d=yield ce("connection",u,!1,999,999,999);let h=new L(0,e.id,t.id,e.userId,t.userId,e.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Et.AddConnection(h)}let u=(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Ve(h,t,a));var y=yield ce("connection",f,!1,999,999,999);let p=new L(0,t.id,e.id,t.userId,e.userId,t.userId,y.id,y.userId,1e3,a,999,s,4,l,999,999);return Et.AddConnection(p),p}))}function Ve(t,e,n=null){var o;return Ue(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 ce("connection",d,!1,r,4,s),h=yield Te(u.id,e.id,r,10,1),f=[],y=p(),v=0;v<h.length;v++){let t=yield Ge(h[v].toTheConceptId);f.push(t)}if(f.length<1)y=yield ce("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 ce("count",t.toString(),!1,r,4,s);for(let t=0;t<h.length;t++)_e(h[t].id)}let C=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 Et.AddConnection(C)}))}function Pe(t,e,n,o=!1,i=!1){var r,c;return Ue(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 Ve(c,e,a));var d=yield ce("connection",u,!1,999,999,999);let h=new L(0,e.id,t.id,e.userId,t.userId,e.userId,d.id,d.userId,1e3,a,999,s,4,l,999,999);Et.AddConnection(h)}let u=(null===(c=t.type)||void 0===c?void 0:c.characterValue)+"_s",h=n+"_s",f=u+"_"+h;i&&(yield Ve(h,t,a));var y=yield ce("connection",f,!1,999,999,999);return yield Ie(t.id,t.userId,e.id,e.userId,y.id,999,999,1e3,4)}))}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())}))};function De(t,e,n=10,o=1){var i;return Be(this,void 0,void 0,(function*(){var r=[],c=yield Ge(t),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+e,s=yield jt(a,16);if(s.id>0){for(var l=yield Te(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 Ge(t),n=yield it(e.id);r.push(n)}}return r}))}function Ee(t,e,n=10,o=1){var i;return Be(this,void 0,void 0,(function*(){var r=[],c=yield Ge(t),a=(null===(i=c.type)||void 0===i?void 0:i.characterValue)+"_s_"+e,s=yield jt(a,16);if(s.id>0){for(var l=yield Te(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 Ge(t);r.push(e)}}return r}))}class Oe{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 be{constructor(){this.name="character Repository"}static AddCharacter(t){this.characterData[t.id]=t}static GetCharacter(t){for(var e=new Oe(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}}be.characterData=[];class He{constructor(t,e,n,o){this.id=t,this.userId=e,this.referentId=n,this.isNew=o}}var 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())}))},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 We(t,e,n,o,i){return je(this,void 0,void 0,(function*(){var r=new Oe(e,t,n,e,o,e,i,e,"",!1);return yield function(t){return Me(this,void 0,void 0,(function*(){try{if(0==(t=be.GetCharacter(t.data)).id){var e=k();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 Oe(i.userId,t.data,0,0,4,4,999,999,"",!1);return n.id=i.id,be.AddCharacter(n),i}return new He(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 $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 Je(t,e,n,o,i,r,c,a,s,l,d,u,h,f){return $e(this,void 0,void 0,(function*(){var y=yield jt(t,i),p=y;return 0==p.id&&(p=y=yield oe(t,e,n,o,i,r,c,a,s,l,d,u,h,f)),p}))}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())}))},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 qe(t,e,n,o){return Ke(this,void 0,void 0,(function*(){var i=o,r=yield ut(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 Qe(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 We(t,e,n,o,r),s=Je(t,e,4,c,h,u,49,l,n,a,o,i,r,d)}else{var f=yield We(t,e,n,o,r);f.isNew,s=yield Je(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 qe(c[0],e,n,o),l=yield qe(c[1],e,n,o);l&&(r=yield ie(t,o,s.id,o,l.id,o,999,o,999,o,999,o,e,o))}}return r}))}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())}))};const Xe=new Map;function Ye(t,e){return ze(this,void 0,void 0,(function*(){let n=p();if(Xe.has(t+e))return Xe.get(t+e)||n;const o=(()=>ze(this,void 0,void 0,(function*(){try{var o=k("application/x-www-form-urlencoded");const i=yield fetch(w.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:o,body:`character_value=${t}&category_id=${e}`});if(i.ok){let t=yield i.json();n=t,m.AddConcept(n)}else console.log("This is the concept by category and character direct api error",i.status),R(i);return n}catch(n){throw n instanceof Error?console.log(" This is the concept by category and character direct api error message: ",n.message,t,e,w.GetConceptByCharacterAndCategoryDirectUrl()):console.log(" This is the concept by category and character unexpected direct api error: ",n,t,e,w.GetConceptByCharacterAndCategoryDirectUrl()),n}finally{Xe.delete(t+e)}})))();return Xe.set(t+e,o),o}))}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())}))};function tn(t){return Ze(this,void 0,void 0,(function*(){let e=p();if("the"==t)return e.id=1,e.typeId=5,e.characterValue="the",e;let n=t.length;var o=T(t);if(o.length>1){let n=1,i=yield tn(o[0]);0!=i.id&&(n=i.id),e=yield function(t,e){return Ze(this,void 0,void 0,(function*(){let n=yield m.GetConceptByCharacterAndCategoryLocal(t,e);return 0==n.id&&(n=yield Ye(t,e)),n}))}(t,n)}else o[0]==t&&1==n?e=yield function(t){return Ze(this,void 0,void 0,(function*(){console.log("inside the character length function",t);var e=yield m.GetConceptByCharacterAndTypeLocal(t,49);return console.log("inside the character length function after",e),0==e.id&&(e=yield lt(t)),e}))}(t):o[0]==t&&(e=yield function(t){return Ze(this,void 0,void 0,(function*(){var e=yield m.GetConceptByCharacterAndTypeLocal(t,51);return 0==e.id&&(e=yield lt(t)),e}))}(t));return e}))}var en=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())}))};const nn=new Map;function on(t,e){return en(this,void 0,void 0,(function*(){let e=p();if(nn.has(t))return nn.get(t)||e;const n=(()=>en(this,void 0,void 0,(function*(){try{if(e=yield tn(t),0==e.id||4==e.typeId){var n=k("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}`);let i=yield o.json();e=i,e.id>0&&m.AddConcept(e)}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}finally{nn.delete(t)}})))();return nn.set(t,n),n}))}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())}))},cn=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())}))},an=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 sn(t){return an(this,void 0,void 0,(function*(){for(var e=yield function(t){return rn(this,void 0,void 0,(function*(){var e=[];try{(new Date).getTime();var n=k("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 Ge(o);t.type=i}return e}))}function ln(t){return an(this,void 0,void 0,(function*(){for(var e=yield function(t){return cn(this,void 0,void 0,(function*(){var e=[];try{(new Date).getTime();var n=k("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 Ge(o);t.type=i}return e}))}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())}))},un=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 hn(t,e=""){return un(this,void 0,void 0,(function*(){var n=yield Ge(t);yield f.removeNodeFromTree(t);var o=n.typeId,i=n.characterValue;yield g.removeTypeConcept(o,t),yield u.removeNodeByCharacter(i,t),function(t,e=""){dn(this,void 0,void 0,(function*(){let n=!1;try{let o=k("application/x-www-form-urlencoded");""!=e&&(o=A("application/x-www-form-urlencoded",e));const i=new FormData;i.append("id",t.toString());const r=yield fetch(w.DeleteConceptUrl(),{method:"POST",body:i});if(!r.ok)throw R(r),new Error(`Error! status: ${r.status}`);n=(yield r.json()).success}catch(t){throw t instanceof Error?console.log("Delete concept error message: ",t.message):console.log("Delete concept unexpected error: ",t),t}return n}))}(t,e)}))}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 yn(t,e){return fn(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 pn=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 vn(t,e,n,o,i=999){return pn(this,void 0,void 0,(function*(){var o,i=n,r=n,c=n,a=t.startsWith("the_"),s=p();return o=a?t:"the_"+t,s=yield on(o),yield Je(e,n,4,n,s.id,s.userId,0,999,999,i,4,c,999,r)}))}class gn{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 Cn=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=[]){return Cn(this,void 0,void 0,(function*(){var e=[];try{var n=[];for(let o=0;o<t.length;o++){let i=yield D.GetConnection(t[o]);0==i.id?n.push(t[o]):e.push(i)}if(0==n.length)return e;{var o=k();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),D.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 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 Tn(t=[]){return Nn(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 wn(t=[]){return Nn(this,void 0,void 0,(function*(){yield J(t);var e=[];for(let o=0;o<t.length;o++){var n=yield ot(t[o]);e.push(n)}return e}))}function In(t=[],e=[]){return Nn(this,void 0,void 0,(function*(){yield mn(e);var n=yield j(t);!function(t=[],e=[]){for(let n=0;n<e.length;n++)t.includes(e[n].id)||D.RemoveConnection(e[n])}(e,n);var o=[];for(let e=0;e<t.length;e++){var i=yield ot(t[e]);o.push(i)}return o}))}function kn(t=[]){return Nn(this,void 0,void 0,(function*(){let e=[],n=[],o={};for(let o=0;o<(null==t?void 0:t.length);o++){let i=yield D.GetConnection(t[o]);0==i.id?e.push(t[o]):n.push(i)}for(let n=0;n<e.length;n++)o[t[n]]=!1;let i=[],r=yield mn(e);n=[...n,...r];for(let t=0;t<n.length;t++)i.push(n[t].ofTheConceptId),i.push(n[t].toTheConceptId),i.push(n[t].typeId);return yield O(i),n}))}function An(t=[],e=[]){return Nn(this,void 0,void 0,(function*(){let n=[];for(let t=0;t<e.length;t++)0==(yield D.GetConnection(e[t])).id&&n.push(e[t]);yield mn(n);var o={};for(let e=0;e<t.length;e++){var i=yield ot(t[e]);o[t[e]]=i}return o}))}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 Rn(t=0,e=[],n=""){return xn(this,void 0,void 0,(function*(){var o=[];try{var i=new gn;i.composition=t,i.listLinkers=e,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 t=yield l.json();var a=t.compositionIds,s=t.internalConnections;t.externalConnections,o=yield In(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 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 _n(t,e){return Sn(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 I.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 Ln=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 Gn(t){return Ln(this,void 0,void 0,(function*(){return yield function(t="",e={}){return Ln(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 Un=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 Fn(t){return Un(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 Vn(t,e){return-1===t.indexOf(e)&&t.push(e),t}function Pn(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 Bn(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 Dn(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 En(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 On(t=[],e){Array.isArray(t)&&t.splice(t.findIndex((function(t){return t.id===e.id})),1)}function bn(t=[],e){Array.isArray(t)&&t.splice(t.findIndex((function(t){return t.id===e.id})),1)}class Hn{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&&(jn.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 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())}))};class jn{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 Hn(t.id,t,null,null);this.addNodeToTree(e)}static getNodeFromTree(t){return Mn(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(t,this.root):null}))}static removeNodeFromTree(t){return Mn(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}}jn.root=null;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 $n(t,e,n,o,i=[]){var r,c;return Wn(this,void 0,void 0,(function*(){let a={};const s=[];if(0==t)return"";let l=Jn(n,t);if(null!=l&&0!=l.id||null==t||null==t||(l=yield Ge(t)),0!=l.id&&null==l.type){const t=l.typeId;let e=Jn(n,t);l.type=e,null==e&&null!=t&&null!=t&&(e=yield Ge(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=Jn(n,d);if(null!=t&&0!=t.id||null==d||null==d||(t=yield Ge(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 Ge(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 $n(d,e,n,o,i);a[u]=t}}else{const t=yield $n(d,e,n,o,i);s[u]=t,a=s}}}return a}))}function Jn(t,e){let n=p();for(let o=0;o<t.length;o++)if(e==t[o].id)return n=t[o],n;return n}class Qn{constructor(){this.id=0,this.mainConcept=p(),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 $n(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 Kn=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 qn(t,e=null,n=null,o=null,i=null,r=null,c=null,a=null){return Kn(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 Qn);for(const o in t)if("object"==typeof t[o]||Array.isArray(t[o])){const f=yield ce(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 qn(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 p=yield Ot(s,l,f.id,f.userId,y,d,f.userId);a.connections.push(p),yield qn(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 ce(o,t[o],!1,s,l,d);a.concepts.push(h);const f=yield Ot(i,r,h.id,h.userId,c,d,h.userId);a.connections.push(f)}return h}))}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 Xn(t){return zn(this,void 0,void 0,(function*(){const e=t.userId,n=t.sessionId,o=t.accessId;let i=[];const r=[];let c=p(),a=p();const s=[];let l=t.compositionId;const d=t.ofTheCompositionId;let u=[];if(l<0){let t=yield Ge(l,e);if(!(t.id>0))return null;l=t.id}i=yield X(l);const h=[],f=new Qn,y=[];f.id=l,f.isUpdating();let v=[];for(let t=0;t<i.length;t++)Vn(y,i[t].ofTheConceptId),Vn(h,i[t].ofTheConceptId),Vn(h,i[t].toTheConceptId),v.push(i[t].ofTheConceptId);f.subcompositions=y,f.connections=i;for(let t=0;t<h.length;t++){const e=yield Ge(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=p();const l=g[t];let d=c;if(a.id>0&&(d=a),Array.isArray(l)||"object"==typeof l){i=yield ce(t,"",!0,c.userId,4,999),f.subcompositions.push(i.id);const e=Pn(r,i);for(let t=0;t<e.length;t++)if(e[t].id>0){const n=Dn(f.connections,e[t].id);u=u.concat(n),s.push(e[t])}yield qn(g[t],i.id,i.userId,c.id,c.userId,4,999,f)}else{i=yield ce(t,l,!1,e,o,n);const c=Pn(r,i);for(let t=0;t<c.length;t++)if(c[t].id>0){const e=Dn(f.connections,c[t].id);u=u.concat(e),s.push(c[t])}}const h=Ot(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++)bn(f.connections,u[t]),_e(u[t].id);for(let t=0;t<s.length;t++)On(r,s[t]);return f.concepts=f.concepts.concat(r),f.mainConcept=c,f.id=c.id,yield f.updateCache(),jn.addCompositionToTree(f),Et.SyncDataOnline(),f.GetDataCache()}))}var Yn=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 Zn(t,e,n,o,i=10,r=1){return Yn(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 to=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 eo(t,e=""){return to(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 no=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,e=[]){var n,o;return no(this,void 0,void 0,(function*(){let i=[];const r=[];let c={},a={};const s=yield jn.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?io(t,e):yield X(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);ao(d,i,r,l);let u=[];a=yield ct(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 io(t,e){const n=[];for(let o=0;o<e.length;o++)e[o].typeId==t&&n.push(e[o]);return n}function ro(t,e=[]){var n,o;return no(this,void 0,void 0,(function*(){let i={},r=[];const c=[];let a;const s={},l=yield jn.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?io(t,e):yield X(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);ao(u,r,c,d),a=yield ct(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 co(t,e){return no(this,void 0,void 0,(function*(){let n=[];const o=[];n=yield mn(e);for(let e=0;e<t.length;e++){const i=yield ro(t[e],n);i&&o.push(i)}return o}))}function ao(t,e,n,o){return no(this,void 0,void 0,(function*(){const i=new Qn,r=yield function(t){return no(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 $n(t.id,e,r,o,[]);i.cached=c,jn.addCompositionToTree(i)}))}var so=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 lo(t){return so(this,void 0,void 0,(function*(){try{var e=k();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 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())}))};function ho(t,e){return uo(this,void 0,void 0,(function*(){try{var n=k("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 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())}))};function yo(t,e,n=10,o=1){return fo(this,void 0,void 0,(function*(){var i=[],r=yield Ge(t),c=yield tn(e);if(c.id>0){for(var a=yield Te(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 Ge(t),n=yield it(e.id);i.push(n)}}return i}))}function po(t,e,n=10,o=1){return fo(this,void 0,void 0,(function*(){var i=[],r=yield Ge(t),c=yield tn(e);if(c.id>0){for(var a=yield Te(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 Ge(t);i.push(e)}}return i}))}class vo{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 go=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 go(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 le(0,0,0,0,0,0);var r=new vo(o,t,i,null,null);this.addNodeToTree(r)}static addConnectionToTree(t,e,n=999){let o=this.compositeKey(e,n,t.applicationId),i=It();var r=new vo(o,i,t,null,null);this.addNodeToTree(r)}static getNodeFromTree(t,e,n=999){return go(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 go(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 mo=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=999,o=999){return mo(this,void 0,void 0,(function*(){let i=yield Co.getNodeFromTree(t,n,o),r=It();if(i)for(let t=0;t<i.value.length;t++){let n=i.value[t];n.ghostId==e&&(r=n)}return r}))}function To(t,e,n=999,o=999){return mo(this,void 0,void 0,(function*(){let i=yield Co.getNodeFromTree(t,n,o),r=new le(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 wo(t,e,n=999){return mo(this,void 0,void 0,(function*(){Co.addConceptToTree(t,e,n)}))}function Io(t,e,n=999){return mo(this,void 0,void 0,(function*(){Co.addConnectionToTree(t,e,n)}))}var 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())}))},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 xo(t,e=""){return Ao(this,void 0,void 0,(function*(){let n=[],o=yield function(t,e=""){return ko(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 An(c,a),yield Ro(s,n,i,l)}))}function Ro(t,e,n,o=[]){return Ao(this,void 0,void 0,(function*(){let i={},r=yield mn(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 Ge(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 Ge(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 So(t){var e,n;const o=It();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 _o(t){const e=p();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 Lo(t){const e=new le(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 Go=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 Uo(t){return Go(this,void 0,void 0,(function*(){const e=t.userId,n=t.sessionId;t.accessId;let o=[];const i=[];let r=It(),c=It();const a=[],s=t.compositionId,l=t.ofTheCompositionId;let d=[],u=yield X(s);for(let t=0;t<u.length;t++)o.push(Lo(u[t]));const h=[],f=[];let y=[];for(let t=0;t<o.length;t++)Vn(f,o[t].ofTheConceptId),Vn(h,o[t].ofTheConceptId),Vn(h,o[t].toTheConceptId),y.push(o[t].ofTheConceptId);for(let t=0;t<h.length;t++){const e=yield Ge(h[t]);s==h[t]&&(r=So(e)),l==h[t]&&(c=So(e)),i.push(So(e))}const p=t.patchObject;for(const t in p){let s=It();const l=p[t];let u=r;c.id>0&&(u=c),Array.isArray(l)||"object"==typeof l?(s=yield ge(t,"",!0,r.userId,0,999),yield me(p[t],s.id,s.userId,r.id,r.userId,4,999)):s=yield ge(t,l,!1,e,0,n);const h=Bn(i,s);for(let t=0;t<h.length;t++)if(h[t].id>0){const e=En(o,h[t].id);d=d.concat(e),a.push(h[t])}yield de(u.id,s.id,r.id,2),i.push(s)}for(let t=0;t<d.length;t++)_e(d[t].id);Et.SyncDataOnline()}))}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())}))},Vo=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 Po(t){var e;return Vo(this,void 0,void 0,(function*(){let n=yield function(t){return Fo(this,void 0,void 0,(function*(){let e=[];try{var n=k();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;O(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 ct(r,c,t);e.data=n,e.id=r,o.push(e)}else{let t={};t.id=r;let n=yield Ge(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 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())}))},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 Eo(t,e=""){return Do(this,void 0,void 0,(function*(){var n=yield function(t,e=""){return Bo(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 Po(n)}))}class Oo{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class bo{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 Ho{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class Mo{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1}}var jo=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 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())}))},$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())}))};class Jo{}Jo.isUpdated=!1,Jo.isOnlineSync=!1;var Qo=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 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())}))};const qo=1,zo=2,Xo=3,Yo=4,Zo=5,ti=6,ei=7;class ni{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var oi=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 ii(t){return oi(this,void 0,void 0,(function*(){let e={};for(let n=0;n<t.length;n++){let o=yield q(t[n].connectionTypeId);t[n].connectionType=o.characterValue,e[t[n].conceptId]=t[n]}return e}))}function ri(t){const e=t.split("_");if(3===e.length){let t=new ni;return t.conceptId=Number(e[0]),t.connectionTypeId=Number(e[1]),t.count=Number(e[2]),t}throw new Error("Input string must contain exactly three parts separated by underscores.")}function ci(t){return t.startsWith("the_")?t.slice(4):t}var ai=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())}))},si=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 li(t,e,n){var o,i,r,c,a,s,l,d;return si(this,void 0,void 0,(function*(){let u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);for(let u=0;u<t.length;u++){let h=!1;n.includes(t[u].id)&&(h=!0);let f=yield Ge(t[u].ofTheConceptId),y=yield Ge(t[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";t[u].toTheConceptId in e?n=e[t[u].toTheConceptId]:(n={},n[a]={},e[t[u].toTheConceptId]=n);let s=yield Ge(t[u].typeId);try{let t=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 e||(e[f.id]={}),e[f.id][t]=n),e[y.id]={}}catch(t){console.log("this is error",t)}}}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";t[u].ofTheConceptId in e?n=e[t[u].ofTheConceptId]:(n={},n[o]={},e[t[u].ofTheConceptId]=n);let i=yield Ge(t[u].typeId);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",n=y.characterValue;i.characterValue.includes("_s_")&&(y.id in e||(e[y.id]={}),e[y.id][t]=n),e[f.id]={}}catch(t){console.log("this is error",t)}}}return e}))}var di=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 ui(t,e,n){if(t in e){let o=e[t];console.log("this is the count info",o),o&&(n[o.connectionType+"_count"]=o.count,console.log("this is the data updated",n))}}function hi(t,e="DESC"){return console.log("this is the order",e),"ASC"==e?t.sort((function(t,e){return t.id-e.id})):t.sort((function(t,e){return e.id-t.id})),t}var fi=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 yi=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 pi(t,e){return yi(this,void 0,void 0,(function*(){let e=t.outputFormat;t.outputFormat=ti;let n,o=yield function(t,e=""){return Ko(this,void 0,void 0,(function*(){var n=A("application/json",e);const o=w.FreeschemaQueryUrl(),i=JSON.stringify(t);try{const t=yield fetch(o,{method:"POST",headers:n,body:i});return t.ok?yield t.json():(R(t),console.log("This is the freeschema query error",t.status),[])}catch(t){console.log("This is the freeschema query error others",t),function(t,e=""){if(t.status){let n=new x(t.message,!1,t.status,t.stack);throw n.setUrl(e),n}{let n=new x(t.message,!1,500,t.stack);throw n.setUrl(e),n}}(t,o)}}))}(t,""),i=(o.conceptIds,o.internalConnections,o.linkers),r=o.reverse,c=o.mainCompositionIds,a=o.countinfo,s=t.order,l=function(t=[]){let e=[];if(t.length>0)for(let n=0;n<(null==t?void 0:t.length);n++){let o=ri(t[n]);e.push(o)}return e}(a);return n=e==zo?yield function(t,e,n,o,i,r="DESC"){return fi(this,void 0,void 0,(function*(){let e=yield kn(t);yield ii(i),e=hi(e,r);let c=[];c=yield function(t,e,n=[]){var o,i,r,c,a,s,l,d;return ai(this,void 0,void 0,(function*(){let u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);for(let u=0;u<t.length;u++){let h=!1,f=yield Ge(t[u].ofTheConceptId),y=yield Ge(t[u].toTheConceptId);if(n.includes(t[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield Ge(t[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";t[u].toTheConceptId in e?n=e[t[u].toTheConceptId]:(n={},n[s]={},e[t[u].toTheConceptId]=n);try{let t=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 e||(e[f.id]={}),e[f.id][t]=n),e[y.id]={}}catch(t){console.log("this is error",t)}}}else if(0!=f.id&&0!=y.id){let n,o=yield Ge(t[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";t[u].ofTheConceptId in e?n=e[t[u].ofTheConceptId]:(n={},n[i]={},e[t[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",n=y.characterValue;o.characterValue.includes("_s_")&&(y.id in e||(e[y.id]={}),e[y.id][t]=n),e[f.id]={}}catch(t){console.log("this is error",t)}}}return e}))}(e,c,o),c=yield function(t,e,n=[]){var o,i,r,c,a,s,l,d;return ai(this,void 0,void 0,(function*(){let u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);for(let u=0;u<t.length;u++){let h=!1,f=yield Ge(t[u].ofTheConceptId),y=yield Ge(t[u].toTheConceptId);if(n.includes(t[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield Ge(t[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";t[u].toTheConceptId in e?(n=e[t[u].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},e[t[u].toTheConceptId]=n);try{let t=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",e=f.characterValue,o=a.characterValue;""==o&&(o=t,o=ci(o));let i={id:f.id,data:{[t]:e}},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[s]&&(n[s]={}),n[s][l]=i)}catch(t){console.log("this is error",t)}}}else if(0!=f.id&&0!=y.id){let n,o=yield Ge(t[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";t[u].ofTheConceptId in e?(n=e[t[u].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},e[t[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",e=y.characterValue,r=o.characterValue,c=!1;""==r&&(r=t,r=ci(r),c=!0);let a={id:y.id,data:{[t]:e}};isNaN(Number(r))?r.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][r]=a):(Array.isArray(n[i])||(n[i]=[]),n[i].push(a))}catch(t){console.log("this is error",t)}}}return e}))}(e,c,o);let a=yield function(t,e,n,o,i=[],r){var c,a,s,l,d,u,h;return ai(this,void 0,void 0,(function*(){(new Date).getTime();let n=[],r=[];for(let e=0;e<t.length;e++)r.push(t[e].toTheConceptId),r.push(t[e].ofTheConceptId),r.push(t[e].typeId);for(let n=0;n<t.length;n++){let o=!1,r=yield Ge(t[n].ofTheConceptId),f=yield Ge(t[n].toTheConceptId);if(i.includes(t[n].id)&&(o=!0),1==o){if(0!=r.id&&0!=f.id&&f.id in e){let o,i=yield Ge(t[n].typeId),s=null!==(a=null===(c=f.type)||void 0===c?void 0:c.characterValue)&&void 0!==a?a:"self",l=!1;t[n].toTheConceptId in e&&(l=!0),t[n].toTheConceptId in e?(o=e[t[n].toTheConceptId],"string"==typeof o[s]&&(o[s]={})):(o={},o[s]={},e[t[n].toTheConceptId]=o);try{if(e[t[n].ofTheConceptId]){let c={id:r.id,data:e[t[n].ofTheConceptId],created_on:t[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(t){console.log("this is error",t)}}}else if(0!=r.id&&0!=f.id&&r.id in e){let o,i=yield Ge(t[n].typeId),c=null!==(l=null===(s=r.type)||void 0===s?void 0:s.characterValue)&&void 0!==l?l:"self",a=!1;t[n].toTheConceptId in e&&(a=!0),t[n].ofTheConceptId in e?(o=e[t[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},e[t[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=e[t[n].toTheConceptId];if(r){let a={id:f.id,data:e[t[n].toTheConceptId],created_on:t[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(t){console.log("this is error",t)}}}for(let t=0;t<o.length;t++){let i={};i.id=o[t],i.data=e[o[t]],n.push(i)}return n}))}(e,c,0,n,o);return a}))}(i,0,c,r,l,s):e==Xo?yield function(t,e,n,o,i,r="DESC"){return fi(this,void 0,void 0,(function*(){let e=yield kn(t),c=yield ii(i);e=hi(e,r);let a=[];a=yield li(e,a,o),a=yield function(t,e,n=[]){var o,i,r,c,a,s,l,d;return di(this,void 0,void 0,(function*(){let u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);for(let u=0;u<t.length;u++){let h=!1,f=yield Ge(t[u].ofTheConceptId),y=yield Ge(t[u].toTheConceptId);if(n.includes(t[u].id)&&(h=!0),1==h){if(0!=f.id&&0!=y.id){let n,a=yield Ge(t[u].typeId),s=null!==(i=null===(o=y.type)||void 0===o?void 0:o.characterValue)&&void 0!==i?i:"self";t[u].toTheConceptId in e?(n=e[t[u].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},e[t[u].toTheConceptId]=n);try{let t=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",e=f.characterValue,o=a.characterValue;""==o&&(o=t,o=ci(o));let i={id:f.id,[t]:e},l=o+"_reverse";l.includes("_s_")||("string"==typeof n[s]&&(n[s]={}),n[s][l]=i)}catch(t){console.log("this is error",t)}}}else if(0!=f.id&&0!=y.id){let n,o=yield Ge(t[u].typeId),i=null!==(s=null===(a=f.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";t[u].ofTheConceptId in e?(n=e[t[u].ofTheConceptId],i in n||(n[i]={})):(n={},n[i]={},e[t[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",r=y.characterValue,c=o.characterValue,a=!1;""==c&&(c=e,c=ci(c),a=!0);let s={};s[e]={id:y.id,data:r,created_on:t[u].entryTimeStamp},isNaN(Number(c))?c.includes("_s_")||("string"==typeof n[i]&&(n[i]={}),n[i][c]=a?s[e]:s):(Array.isArray(n[i])||(n[i]=[]),n[i].push(s[e]))}catch(t){console.log("this is error",t)}}}return e}))}(e,a,o);let s=yield function(t,e,n,o=[],i){var r,c,a,s,l,d,u,h;return di(this,void 0,void 0,(function*(){(new Date).getTime();let f=[],y=[];for(let e=0;e<t.length;e++)y.push(t[e].toTheConceptId),y.push(t[e].ofTheConceptId),y.push(t[e].typeId);for(let n=0;n<t.length;n++){let f=!1,y=yield Ge(t[n].ofTheConceptId),p=yield Ge(t[n].toTheConceptId);if(o.includes(t[n].id)&&(f=!0),1==f){if(0!=y.id&&0!=p.id&&p.id in e){let o,i=yield Ge(t[n].typeId),a=null!==(c=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self",s=!1;t[n].toTheConceptId in e&&(s=!0),t[n].toTheConceptId in e?(o=e[t[n].toTheConceptId],"string"==typeof o[a]&&(o[a]={})):(o={},o[a]={},e[t[n].toTheConceptId]=o);try{if(e[t[n].ofTheConceptId]){let r=e[t[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(t){console.log("this is error",t)}}}else if(0!=y.id&&0!=p.id&&y.id in e){let o,r=yield Ge(t[n].typeId),c=null!==(s=null===(a=y.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self",f=!1;t[n].toTheConceptId in e&&(f=!0),t[n].ofTheConceptId in e?(o=e[t[n].ofTheConceptId],"string"==typeof o[c]&&(o[c]={})):(o={},o[c]={},e[t[n].ofTheConceptId]=o),ui(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=e[t[n].toTheConceptId];if(a){let e={};e[r]={data:a[r],id:p.id,created_on:t[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(e):g.includes("_s_")?(o[c][g]=[],v?o[c][g].push(e[r]):o[c][g].push(e)):o[c][g]=v?e[r]:e,ui(p.id,i,e)}}catch(t){console.log("this is error",t)}}}console.log("this is the main compositions",n);for(let t=0;t<n.length;t++){let o={};console.log("this is the main compositions DATA",e[n[t]]),o=e[n[t]],o&&(o.id=n[t]),f.push(o)}return f}))}(e,a,n,o,c);return s}))}(i,0,c,r,l,s):yield function(t,e,n,o,i){return fi(this,void 0,void 0,(function*(){let e=yield kn(t);e=hi(e);let i=[];i=yield li(e,i,o),i=yield function(t,e,n){var o,i,r,c,a,s,l,d;return si(this,void 0,void 0,(function*(){let u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);t.sort((function(t,e){return e.id-t.id}));for(let u=0;u<t.length;u++){let h=!1;n.includes(t[u].id)&&(h=!0);let f=yield Ge(t[u].ofTheConceptId),y=yield Ge(t[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";t[u].toTheConceptId in e?(n=e[t[u].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},e[t[u].toTheConceptId]=n);let s=yield Ge(t[u].typeId);try{let t=null!==(c=null===(r=null==f?void 0:f.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"none",e=f.characterValue,o=s.characterValue;""==o&&(o=t,o=ci(o));let i={[t]:e},l=o+"_reverse";s.characterValue.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=i)}catch(t){console.log("this is error",t)}}}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";t[u].ofTheConceptId in e?(n=e[t[u].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},e[t[u].ofTheConceptId]=n);let i=yield Ge(t[u].typeId);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",e=y.characterValue,r=i.characterValue,c=(i.characterValue,!1);""==r&&(r=t,r=ci(r),c=!0);let a={[t]:e};isNaN(Number(r))?i.characterValue.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][r]=c?e:a):(Array.isArray(n[o])||(n[o]=[]),n[o].push(e))}catch(t){console.log("this is error",t)}}}return e}))}(e,i,o);let r=yield function(t=[],e=[],n=[],o,i=[]){var r,c,a,s,l,d;return si(this,void 0,void 0,(function*(){let o=[],u=[];for(let e=0;e<t.length;e++)u.push(t[e].toTheConceptId),u.push(t[e].ofTheConceptId),u.push(t[e].typeId);t.sort((function(t,e){return e.id-t.id}));for(let n=0;n<t.length;n++){let o=!1;i.includes(t[n].id)&&(o=!0);let u=yield Ge(t[n].ofTheConceptId),h=yield Ge(t[n].toTheConceptId);if(1==o){if(0!=u.id&&0!=h.id&&h.id in e){let o,i=null!==(c=null===(r=h.type)||void 0===r?void 0:r.characterValue)&&void 0!==c?c:"self";t[n].toTheConceptId in e?o=e[t[n].toTheConceptId]:(o={},o[i]={},e[t[n].toTheConceptId]=o);let a=yield Ge(t[n].typeId);try{let r=a.characterValue+"_reverse",c=e[t[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(t){console.log("this is error",t)}}}else if(0!=u.id&&0!=h.id&&u.id in e){let o,i=null!==(s=null===(a=u.type)||void 0===a?void 0:a.characterValue)&&void 0!==s?s:"self";t[n].ofTheConceptId in e?(o=e[t[n].ofTheConceptId],"string"==typeof o[i]&&(o[i]={})):(o={},o[i]={},e[t[n].ofTheConceptId]=o);let r=!1,c=(yield Ge(t[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=e[t[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(t){console.log("this is error",t)}}}for(let t=0;t<n.length;t++){let i=e[n[t]];i&&(i.id=n[t],o.push(i))}return o}))}(e,i,n,0,o);return r}))}(i,0,c,r),n}))}class vi{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=qo,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}function gi(t=""){I.BearerAccessToken=t}function Ci(t="",e="",o=""){w.BASE_URL=t,w.AI_URL=e,console.log("This ist he base url",w.BASE_URL),I.BearerAccessToken=o,function(){return Qo(this,void 0,void 0,(function*(){return yield new n(!0),yield function(){return $o(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 N(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 Wo(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];At.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 jo(this,void 0,void 0,(function*(){!function(){jo(this,void 0,void 0,(function*(){var t=yield a();if(Array.isArray(t))for(var e=0;e<t.length;e++)Rt.AddConnection(t[e])}))}()}))}().then((()=>{s.isLocalConnectionLoaded=!0})),function(){return jo(this,void 0,void 0,(function*(){!function(){jo(this,void 0,void 0,(function*(){var t=yield c();if(Array.isArray(t))for(var e=0;e<t.length;e++)D.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 mi=exports;for(var Ni in e)mi[Ni]=e[Ni];e.__esModule&&Object.defineProperty(mi,"__esModule",{value:!0})})();
1
+ /*! For license information please see bundle.js.LICENSE.txt */
2
+ (()=>{var e={144:(e,t,n)=>{const r=n(3908);e.exports=(e,t,n=!1)=>{if(e instanceof r)return e;try{return new r(e,t)}catch(e){if(!n)return null;throw e}}},181:e=>{"use strict";e.exports=require("buffer")},270:(e,t,n)=>{const r=n(3908),o=n(8311);e.exports=(e,t,n)=>{let i=null,c=null,s=null;try{s=new o(t,n)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&1!==c.compare(e)||(i=e,c=new r(i,n)))})),i}},560:(e,t,n)=>{const r=n(3908);e.exports=(e,t,n)=>new r(e,n).compare(new r(t,n))},855:(e,t,n)=>{var r=n(6585);e.exports=function(e,t){var n=t||Math.floor(Date.now()/1e3);if("string"==typeof e){var o=r(e);if(void 0===o)return;return Math.floor(n+o/1e3)}return"number"==typeof e?n+e:void 0}},909:(e,t,n)=>{const r=n(3908);e.exports=(e,t,n)=>{const o=new r(e,n),i=new r(t,n);return o.compare(i)||o.compareBuild(i)}},1045:(e,t,n)=>{"use strict";var r=n(181).Buffer,o=n(181).SlowBuffer;function i(e,t){if(!r.isBuffer(e)||!r.isBuffer(t))return!1;if(e.length!==t.length)return!1;for(var n=0,o=0;o<e.length;o++)n|=e[o]^t[o];return 0===n}e.exports=i,i.install=function(){r.prototype.equal=o.prototype.equal=function(e){return i(this,e)}};var c=r.prototype.equal,s=o.prototype.equal;i.restore=function(){r.prototype.equal=c,o.prototype.equal=s}},1123:e=>{const t=/^[0-9]+$/,n=(e,n)=>{const r=t.test(e),o=t.test(n);return r&&o&&(e=+e,n=+n),e===n?0:r&&!o?-1:o&&!r?1:e<n?-1:1};e.exports={compareIdentifiers:n,rcompareIdentifiers:(e,t)=>n(t,e)}},1261:(e,t,n)=>{const r=n(3908),o=n(8311),i=n(5580);e.exports=(e,t)=>{e=new o(e,t);let n=new r("0.0.0");if(e.test(n))return n;if(n=new r("0.0.0-0"),e.test(n))return n;n=null;for(let t=0;t<e.set.length;++t){const o=e.set[t];let c=null;o.forEach((e=>{const t=new r(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":c&&!i(t,c)||(c=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!c||n&&!i(n,c)||(n=c)}return n&&e.test(n)?n:null}},1691:(e,t,n)=>{const r=n(1741),o=n(3726),i=n(8980),c=n(7260),s=n(855),a=n(7019),l=n(4977),u=n(5747),{KeyObject:h,createSecretKey:d,createPublicKey:f}=n(6982),p=["RS256","RS384","RS512"],y=["ES256","ES384","ES512"],v=["RS256","RS384","RS512"],g=["HS256","HS384","HS512"];l&&(p.splice(p.length,0,"PS256","PS384","PS512"),v.splice(v.length,0,"PS256","PS384","PS512")),e.exports=function(e,t,n,l){let m;if("function"!=typeof n||l||(l=n,n={}),n||(n={}),n=Object.assign({},n),m=l||function(e,t){if(e)throw e;return t},n.clockTimestamp&&"number"!=typeof n.clockTimestamp)return m(new r("clockTimestamp must be a number"));if(void 0!==n.nonce&&("string"!=typeof n.nonce||""===n.nonce.trim()))return m(new r("nonce must be a non-empty string"));if(void 0!==n.allowInvalidAsymmetricKeyTypes&&"boolean"!=typeof n.allowInvalidAsymmetricKeyTypes)return m(new r("allowInvalidAsymmetricKeyTypes must be a boolean"));const N=n.clockTimestamp||Math.floor(Date.now()/1e3);if(!e)return m(new r("jwt must be provided"));if("string"!=typeof e)return m(new r("jwt must be a string"));const w=e.split(".");if(3!==w.length)return m(new r("jwt malformed"));let T;try{T=c(e,{complete:!0})}catch(e){return m(e)}if(!T)return m(new r("invalid token"));const C=T.header;let I;if("function"==typeof t){if(!l)return m(new r("verify must be called asynchronous if secret or public key is provided as a callback"));I=t}else I=function(e,n){return n(null,t)};return I(C,(function(t,c){if(t)return m(new r("error in secret or public key callback: "+t.message));const l=""!==w[2].trim();if(!l&&c)return m(new r("jwt signature is required"));if(l&&!c)return m(new r("secret or public key must be provided"));if(!l&&!n.algorithms)return m(new r('please specify "none" in "algorithms" to verify unsigned tokens'));if(null!=c&&!(c instanceof h))try{c=f(c)}catch(e){try{c=d("string"==typeof c?Buffer.from(c):c)}catch(e){return m(new r("secretOrPublicKey is not valid key material"))}}if(n.algorithms||("secret"===c.type?n.algorithms=g:["rsa","rsa-pss"].includes(c.asymmetricKeyType)?n.algorithms=v:"ec"===c.asymmetricKeyType?n.algorithms=y:n.algorithms=p),-1===n.algorithms.indexOf(T.header.alg))return m(new r("invalid algorithm"));if(C.alg.startsWith("HS")&&"secret"!==c.type)return m(new r(`secretOrPublicKey must be a symmetric key when using ${C.alg}`));if(/^(?:RS|PS|ES)/.test(C.alg)&&"public"!==c.type)return m(new r(`secretOrPublicKey must be an asymmetric key when using ${C.alg}`));if(!n.allowInvalidAsymmetricKeyTypes)try{a(C.alg,c)}catch(e){return m(e)}let I;try{I=u.verify(e,T.header.alg,c)}catch(e){return m(e)}if(!I)return m(new r("invalid signature"));const E=T.payload;if(void 0!==E.nbf&&!n.ignoreNotBefore){if("number"!=typeof E.nbf)return m(new r("invalid nbf value"));if(E.nbf>N+(n.clockTolerance||0))return m(new o("jwt not active",new Date(1e3*E.nbf)))}if(void 0!==E.exp&&!n.ignoreExpiration){if("number"!=typeof E.exp)return m(new r("invalid exp value"));if(N>=E.exp+(n.clockTolerance||0))return m(new i("jwt expired",new Date(1e3*E.exp)))}if(n.audience){const e=Array.isArray(n.audience)?n.audience:[n.audience];if(!(Array.isArray(E.aud)?E.aud:[E.aud]).some((function(t){return e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))})))return m(new r("jwt audience invalid. expected: "+e.join(" or ")))}if(n.issuer&&("string"==typeof n.issuer&&E.iss!==n.issuer||Array.isArray(n.issuer)&&-1===n.issuer.indexOf(E.iss)))return m(new r("jwt issuer invalid. expected: "+n.issuer));if(n.subject&&E.sub!==n.subject)return m(new r("jwt subject invalid. expected: "+n.subject));if(n.jwtid&&E.jti!==n.jwtid)return m(new r("jwt jwtid invalid. expected: "+n.jwtid));if(n.nonce&&E.nonce!==n.nonce)return m(new r("jwt nonce invalid. expected: "+n.nonce));if(n.maxAge){if("number"!=typeof E.iat)return m(new r("iat required when maxAge is specified"));const e=s(n.maxAge,E.iat);if(void 0===e)return m(new r('"maxAge" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'));if(N>=e+(n.clockTolerance||0))return m(new i("maxAge exceeded",new Date(1e3*e)))}if(!0===n.complete){const e=T.signature;return m(null,{header:C,payload:E,signature:e})}return m(null,E)}))}},1729:(e,t,n)=>{const r=n(144);e.exports=(e,t)=>{const n=r(e,t);return n&&n.prerelease.length?n.prerelease:null}},1741:e=>{var t=function(e,t){Error.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name="JsonWebTokenError",this.message=e,t&&(this.inner=t)};(t.prototype=Object.create(Error.prototype)).constructor=t,e.exports=t},1763:(e,t,n)=>{const r=n(560);e.exports=(e,t)=>r(e,t,!0)},1832:(e,t,n)=>{const r=n(144);e.exports=(e,t)=>{const n=r(e,null,!0),o=r(t,null,!0),i=n.compare(o);if(0===i)return null;const c=i>0,s=c?n:o,a=c?o:n,l=!!s.prerelease.length;if(a.prerelease.length&&!l){if(!a.patch&&!a.minor)return"major";if(0===a.compareMain(s))return a.minor&&!a.patch?"minor":"patch"}const u=l?"pre":"";return n.major!==o.major?u+"major":n.minor!==o.minor?u+"minor":n.patch!==o.patch?u+"patch":"prerelease"}},1977:(e,t,n)=>{const r=n(9589);e.exports=r.satisfies(process.version,">=15.7.0")},2010:(e,t,n)=>{"use strict";var r=n(2861).Buffer,o=n(3527);function i(e){if(r.isBuffer(e))return e;if("string"==typeof e)return r.from(e,"base64");throw new TypeError("ECDSA signature must be a Base64 string or a Buffer")}function c(e,t,n){for(var r=0;t+r<n&&0===e[t+r];)++r;return e[t+r]>=128&&--r,r}e.exports={derToJose:function(e,t){e=i(e);var n=o(t),c=n+1,s=e.length,a=0;if(48!==e[a++])throw new Error('Could not find expected "seq"');var l=e[a++];if(129===l&&(l=e[a++]),s-a<l)throw new Error('"seq" specified length of "'+l+'", only "'+(s-a)+'" remaining');if(2!==e[a++])throw new Error('Could not find expected "int" for "r"');var u=e[a++];if(s-a-2<u)throw new Error('"r" specified length of "'+u+'", only "'+(s-a-2)+'" available');if(c<u)throw new Error('"r" specified length of "'+u+'", max of "'+c+'" is acceptable');var h=a;if(a+=u,2!==e[a++])throw new Error('Could not find expected "int" for "s"');var d=e[a++];if(s-a!==d)throw new Error('"s" specified length of "'+d+'", expected "'+(s-a)+'"');if(c<d)throw new Error('"s" specified length of "'+d+'", max of "'+c+'" is acceptable');var f=a;if((a+=d)!==s)throw new Error('Expected to consume entire buffer, but "'+(s-a)+'" bytes remain');var p=n-u,y=n-d,v=r.allocUnsafe(p+u+y+d);for(a=0;a<p;++a)v[a]=0;e.copy(v,a,h+Math.max(-p,0),h+u);for(var g=a=n;a<g+y;++a)v[a]=0;return e.copy(v,a,f+Math.max(-y,0),f+d),(v=v.toString("base64")).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},joseToDer:function(e,t){e=i(e);var n=o(t),s=e.length;if(s!==2*n)throw new TypeError('"'+t+'" signatures must be "'+2*n+'" bytes, saw "'+s+'"');var a=c(e,0,n),l=c(e,n,e.length),u=n-a,h=n-l,d=2+u+1+1+h,f=d<128,p=r.allocUnsafe((f?2:3)+d),y=0;return p[y++]=48,f?p[y++]=d:(p[y++]=129,p[y++]=255&d),p[y++]=2,p[y++]=u,a<0?(p[y++]=0,y+=e.copy(p,y,0,n)):y+=e.copy(p,y,a,n),p[y++]=2,p[y++]=h,l<0?(p[y++]=0,e.copy(p,y,n)):e.copy(p,y,n+l),p}}},2111:(e,t,n)=>{const r=n(4641),o=n(3999),i=n(5580),c=n(4089),s=n(7059),a=n(5200);e.exports=(e,t,n,l)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e===n;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof n&&(n=n.version),e!==n;case"":case"=":case"==":return r(e,n,l);case"!=":return o(e,n,l);case">":return i(e,n,l);case">=":return c(e,n,l);case"<":return s(e,n,l);case"<=":return a(e,n,l);default:throw new TypeError(`Invalid operator: ${t}`)}}},2203:e=>{"use strict";e.exports=require("stream")},2525:(e,t,n)=>{const r=n(7638),o=n(560);e.exports=(e,t,n)=>{const i=[];let c=null,s=null;const a=e.sort(((e,t)=>o(e,t,n)));for(const e of a)r(e,t,n)?(s=e,c||(c=e)):(s&&i.push([c,s]),s=null,c=null);c&&i.push([c,null]);const l=[];for(const[e,t]of i)e===t?l.push(e):t||e!==a[0]?t?e===a[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`):l.push("*");const u=l.join(" || "),h="string"==typeof t.raw?t.raw:String(t);return u.length<h.length?u:t}},2851:(e,t,n)=>{var r=n(181).Buffer;e.exports=function(e){return"string"==typeof e?e:"number"==typeof e||r.isBuffer(e)?e.toString():JSON.stringify(e)}},2861:(e,t,n)=>{var r=n(181),o=r.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function c(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=c),c.prototype=Object.create(o.prototype),i(o,c),c.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},c.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var r=o(e);return void 0!==t?"string"==typeof n?r.fill(t,n):r.fill(t):r.fill(0),r},c.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},c.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r.SlowBuffer(e)}},2938:(e,t,n)=>{const r=n(3908);e.exports=(e,t)=>new r(e,t).major},3007:(e,t,n)=>{const r=n(3908);e.exports=(e,t,n,o,i)=>{"string"==typeof n&&(i=o,o=n,n=void 0);try{return new r(e instanceof r?e.version:e,n).inc(t,o,i).version}catch(e){return null}}},3387:(e,t,n)=>{var r=n(2861).Buffer,o=n(8948),i=n(8789),c=n(2203),s=n(2851),a=n(9023);function l(e,t){return r.from(e,t).toString("base64").replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function u(e){var t=e.header,n=e.payload,r=e.secret||e.privateKey,o=e.encoding,c=i(t.alg),u=function(e,t,n){n=n||"utf8";var r=l(s(e),"binary"),o=l(s(t),n);return a.format("%s.%s",r,o)}(t,n,o),h=c.sign(u,r);return a.format("%s.%s",u,h)}function h(e){var t=e.secret||e.privateKey||e.key,n=new o(t);this.readable=!0,this.header=e.header,this.encoding=e.encoding,this.secret=this.privateKey=this.key=n,this.payload=new o(e.payload),this.secret.once("close",function(){!this.payload.writable&&this.readable&&this.sign()}.bind(this)),this.payload.once("close",function(){!this.secret.writable&&this.readable&&this.sign()}.bind(this))}a.inherits(h,c),h.prototype.sign=function(){try{var e=u({header:this.header,payload:this.payload.buffer,secret:this.secret.buffer,encoding:this.encoding});return this.emit("done",e),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},h.sign=u,e.exports=h},3527:e=>{"use strict";function t(e){return(e/8|0)+(e%8==0?0:1)}var n={ES256:t(256),ES384:t(384),ES512:t(521)};e.exports=function(e){var t=n[e];if(t)return t;throw new Error('Unknown algorithm "'+e+'"')}},3639:e=>{var t=Object.prototype.toString;e.exports=function(e){return"number"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Number]"==t.call(e)}},3726:(e,t,n)=>{var r=n(1741),o=function(e,t){r.call(this,e),this.name="NotBeforeError",this.date=t};(o.prototype=Object.create(r.prototype)).constructor=o,e.exports=o},3874:(e,t,n)=>{const r=n(8311);e.exports=(e,t)=>{try{return new r(e,t).range||"*"}catch(e){return null}}},3904:(e,t,n)=>{const r=Symbol("SemVer ANY");class o{static get ANY(){return r}constructor(e,t){if(t=i(t),e instanceof o){if(e.loose===!!t.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),l("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===r?this.value="":this.value=this.operator+this.semver.version,l("comp",this)}parse(e){const t=this.options.loose?c[s.COMPARATORLOOSE]:c[s.COMPARATOR],n=e.match(t);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==n[1]?n[1]:"","="===this.operator&&(this.operator=""),n[2]?this.semver=new u(n[2],this.options.loose):this.semver=r}toString(){return this.value}test(e){if(l("Comparator.test",e,this.options.loose),this.semver===r||e===r)return!0;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}return a(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new h(e.value,t).test(this.value):""===e.operator?""===e.value||new h(this.value,t).test(e.semver):!((t=i(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))||(!this.operator.startsWith(">")||!e.operator.startsWith(">"))&&(!this.operator.startsWith("<")||!e.operator.startsWith("<"))&&(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))&&!(a(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))&&!(a(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}}e.exports=o;const i=n(8587),{safeRe:c,t:s}=n(9718),a=n(2111),l=n(7272),u=n(3908),h=n(8311)},3908:(e,t,n)=>{const r=n(7272),{MAX_LENGTH:o,MAX_SAFE_INTEGER:i}=n(6874),{safeRe:c,safeSrc:s,t:a}=n(9718),l=n(8587),{compareIdentifiers:u}=n(1123);class h{constructor(e,t){if(t=l(t),e instanceof h){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>o)throw new TypeError(`version is longer than ${o} characters`);r("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const n=e.trim().match(t.loose?c[a.LOOSE]:c[a.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>i||this.major<0)throw new TypeError("Invalid major version");if(this.minor>i||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>i||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<i)return t}return e})):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(r("SemVer.compare",this.version,this.options,e),!(e instanceof h)){if("string"==typeof e&&e===this.version)return 0;e=new h(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof h||(e=new h(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof h||(e=new h(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const n=this.prerelease[t],o=e.prerelease[t];if(r("prerelease compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return u(n,o)}while(++t)}compareBuild(e){e instanceof h||(e=new h(e,this.options));let t=0;do{const n=this.build[t],o=e.build[t];if(r("build compare",t,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return u(n,o)}while(++t)}inc(e,t,n){if(e.startsWith("pre")){if(!t&&!1===n)throw new Error("invalid increment argument: identifier is empty");if(t){const e=new RegExp(`^${this.options.loose?s[a.PRERELEASELOOSE]:s[a.PRERELEASE]}$`),n=`-${t}`.match(e);if(!n||n[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,n),this.inc("pre",t,n);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,n),this.inc("pre",t,n);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(n)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)"number"==typeof this.prerelease[r]&&(this.prerelease[r]++,r=-2);if(-1===r){if(t===this.prerelease.join(".")&&!1===n)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let r=[t,e];!1===n&&(r=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}e.exports=h},3927:(e,t,n)=>{const r=n(909);e.exports=(e,t)=>e.sort(((e,n)=>r(e,n,t)))},3999:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>0!==r(e,t,n)},4040:(e,t,n)=>{e.exports={decode:n(7260),verify:n(1691),sign:n(7651),JsonWebTokenError:n(1741),NotBeforeError:n(3726),TokenExpiredError:n(8980)}},4089:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>r(e,t,n)>=0},4277:(e,t,n)=>{const r=n(909);e.exports=(e,t)=>e.sort(((e,n)=>r(n,e,t)))},4493:(e,t,n)=>{const r=n(3908);e.exports=(e,t)=>new r(e,t).patch},4623:(e,t,n)=>{const r=n(9589);e.exports=r.satisfies(process.version,">=16.9.0")},4641:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>0===r(e,t,n)},4977:(e,t,n)=>{var r=n(9589);e.exports=r.satisfies(process.version,"^6.12.0 || >=8.0.0")},5032:(e,t,n)=>{const r=n(8311),o=n(3904),{ANY:i}=o,c=n(7638),s=n(560),a=[new o(">=0.0.0-0")],l=[new o(">=0.0.0")],u=(e,t,n)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===i){if(1===t.length&&t[0].semver===i)return!0;e=n.includePrerelease?a:l}if(1===t.length&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}const r=new Set;let o,u,f,p,y,v,g;for(const t of e)">"===t.operator||">="===t.operator?o=h(o,t,n):"<"===t.operator||"<="===t.operator?u=d(u,t,n):r.add(t.semver);if(r.size>1)return null;if(o&&u){if(f=s(o.semver,u.semver,n),f>0)return null;if(0===f&&(">="!==o.operator||"<="!==u.operator))return null}for(const e of r){if(o&&!c(e,String(o),n))return null;if(u&&!c(e,String(u),n))return null;for(const r of t)if(!c(e,String(r),n))return!1;return!0}let m=!(!u||n.includePrerelease||!u.semver.prerelease.length)&&u.semver,N=!(!o||n.includePrerelease||!o.semver.prerelease.length)&&o.semver;m&&1===m.prerelease.length&&"<"===u.operator&&0===m.prerelease[0]&&(m=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,v=v||"<"===e.operator||"<="===e.operator,o)if(N&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===N.major&&e.semver.minor===N.minor&&e.semver.patch===N.patch&&(N=!1),">"===e.operator||">="===e.operator){if(p=h(o,e,n),p===e&&p!==o)return!1}else if(">="===o.operator&&!c(o.semver,String(e),n))return!1;if(u)if(m&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===m.major&&e.semver.minor===m.minor&&e.semver.patch===m.patch&&(m=!1),"<"===e.operator||"<="===e.operator){if(y=d(u,e,n),y===e&&y!==u)return!1}else if("<="===u.operator&&!c(u.semver,String(e),n))return!1;if(!e.operator&&(u||o)&&0!==f)return!1}return!(o&&v&&!u&&0!==f||u&&g&&!o&&0!==f||N||m)},h=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r>0?e:r<0||">"===t.operator&&">="===e.operator?t:e},d=(e,t,n)=>{if(!e)return t;const r=s(e.semver,t.semver,n);return r<0?e:r>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,n={})=>{if(e===t)return!0;e=new r(e,n),t=new r(t,n);let o=!1;e:for(const r of e.set){for(const e of t.set){const t=u(r,e,n);if(o=o||null!==t,t)continue e}if(o)return!1}return!0}},5200:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>r(e,t,n)<=0},5342:(e,t,n)=>{const r=n(7075);e.exports=(e,t,n)=>r(e,t,"<",n)},5571:(e,t,n)=>{const r=n(7075);e.exports=(e,t,n)=>r(e,t,">",n)},5580:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>r(e,t,n)>0},5747:(e,t,n)=>{var r=n(3387),o=n(7599);t.ALGORITHMS=["HS256","HS384","HS512","RS256","RS384","RS512","PS256","PS384","PS512","ES256","ES384","ES512"],t.sign=r.sign,t.verify=o.verify,t.decode=o.decode,t.isValid=o.isValid,t.createSign=function(e){return new r(e)},t.createVerify=function(e){return new o(e)}},5931:e=>{var t=Object.prototype.toString,n=Array.isArray;e.exports=function(e){return"string"==typeof e||!n(e)&&function(e){return!!e&&"object"==typeof e}(e)&&"[object String]"==t.call(e)}},6111:e=>{var t=1/0,n=9007199254740991,r=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,c=/^0o[0-7]+$/i,s=/^(?:0|[1-9]\d*)$/,a=parseInt;function l(e){return e!=e}var u,h,d=Object.prototype,f=d.hasOwnProperty,p=d.toString,y=d.propertyIsEnumerable,v=(u=Object.keys,h=Object,function(e){return u(h(e))}),g=Math.max;function m(e,t){return!!(t=null==t?n:t)&&("number"==typeof e||s.test(e))&&e>-1&&e%1==0&&e<t}var N=Array.isArray;function w(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=n}(e.length)&&!function(e){var t=T(e)?p.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}(e)}function T(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){return!!e&&"object"==typeof e}e.exports=function(e,n,s,u){var h;e=w(e)?e:(h=e)?function(e,t){return function(t){for(var n=-1,r=t?t.length:0,o=Array(r);++n<r;)o[n]=(i=t[n],e[i]);var i;return o}(t)}(h,function(e){return w(e)?function(e,t){var n=N(e)||function(e){return function(e){return C(e)&&w(e)}(e)&&f.call(e,"callee")&&(!y.call(e,"callee")||"[object Arguments]"==p.call(e))}(e)?function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}(e.length,String):[],r=n.length,o=!!r;for(var i in e)!t&&!f.call(e,i)||o&&("length"==i||m(i,r))||n.push(i);return n}(e):function(e){if(n=(t=e)&&t.constructor,t!==("function"==typeof n&&n.prototype||d))return v(e);var t,n,r=[];for(var o in Object(e))f.call(e,o)&&"constructor"!=o&&r.push(o);return r}(e)}(h)):[],s=s&&!u?function(e){var n=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||C(e)&&"[object Symbol]"==p.call(e)}(e))return NaN;if(T(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=T(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(r,"");var n=i.test(e);return n||c.test(e)?a(e.slice(2),n?2:8):o.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),s=n%1;return n==n?s?n-s:n:0}(s):0;var I=e.length;return s<0&&(s=g(I+s,0)),function(e){return"string"==typeof e||!N(e)&&C(e)&&"[object String]"==p.call(e)}(e)?s<=I&&e.indexOf(n,s)>-1:!!I&&function(e,t,n){if(t!=t)return function(e,t,n){for(var r=e.length,o=n+-1;++o<r;)if(t(e[o],o,e))return o;return-1}(e,l,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}(e,n,s)>-1}},6170:(e,t,n)=>{const r=n(3908),o=n(144),{safeRe:i,t:c}=n(9718);e.exports=(e,t)=>{if(e instanceof r)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let n=null;if((t=t||{}).rtl){const r=t.includePrerelease?i[c.COERCERTLFULL]:i[c.COERCERTL];let o;for(;(o=r.exec(e))&&(!n||n.index+n[0].length!==e.length);)n&&o.index+o[0].length===n.index+n[0].length||(n=o),r.lastIndex=o.index+o[1].length+o[2].length;r.lastIndex=-1}else n=e.match(t.includePrerelease?i[c.COERCEFULL]:i[c.COERCE]);if(null===n)return null;const s=n[2],a=n[3]||"0",l=n[4]||"0",u=t.includePrerelease&&n[5]?`-${n[5]}`:"",h=t.includePrerelease&&n[6]?`+${n[6]}`:"";return o(`${s}.${a}.${l}${u}${h}`,t)}},6254:(e,t,n)=>{const r=n(3908);e.exports=(e,t)=>new r(e,t).minor},6585:e=>{var t=1e3,n=60*t,r=60*n,o=24*r,i=7*o;function c(e,t,n,r){var o=t>=1.5*n;return Math.round(e/n)+" "+r+(o?"s":"")}e.exports=function(e,s){s=s||{};var a,l,u=typeof e;if("string"===u&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(c){var s=parseFloat(c[1]);switch((c[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return s*i;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*r;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}}}(e);if("number"===u&&isFinite(e))return s.long?(a=e,(l=Math.abs(a))>=o?c(a,l,o,"day"):l>=r?c(a,l,r,"hour"):l>=n?c(a,l,n,"minute"):l>=t?c(a,l,t,"second"):a+" ms"):function(e){var i=Math.abs(e);return i>=o?Math.round(e/o)+"d":i>=r?Math.round(e/r)+"h":i>=n?Math.round(e/n)+"m":i>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},6780:(e,t,n)=>{const r=n(8311);e.exports=(e,t,n)=>(e=new r(e,n),t=new r(t,n),e.intersects(t,n))},6874:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:t,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},6953:(e,t,n)=>{const r=n(144);e.exports=(e,t)=>{const n=r(e,t);return n?n.version:null}},6982:e=>{"use strict";e.exports=require("crypto")},7019:(e,t,n)=>{const r=n(1977),o=n(4623),i={ec:["ES256","ES384","ES512"],rsa:["RS256","PS256","RS384","PS384","RS512","PS512"],"rsa-pss":["PS256","PS384","PS512"]},c={ES256:"prime256v1",ES384:"secp384r1",ES512:"secp521r1"};e.exports=function(e,t){if(!e||!t)return;const n=t.asymmetricKeyType;if(!n)return;const s=i[n];if(!s)throw new Error(`Unknown key type "${n}".`);if(!s.includes(e))throw new Error(`"alg" parameter for "${n}" key type must be one of: ${s.join(", ")}.`);if(r)switch(n){case"ec":const n=t.asymmetricKeyDetails.namedCurve,r=c[e];if(n!==r)throw new Error(`"alg" parameter "${e}" requires curve "${r}".`);break;case"rsa-pss":if(o){const n=parseInt(e.slice(-3),10),{hashAlgorithm:r,mgf1HashAlgorithm:o,saltLength:i}=t.asymmetricKeyDetails;if(r!==`sha${n}`||o!==r)throw new Error(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}.`);if(void 0!==i&&i>n>>3)throw new Error(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}.`)}}}},7059:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>r(e,t,n)<0},7075:(e,t,n)=>{const r=n(3908),o=n(3904),{ANY:i}=o,c=n(8311),s=n(7638),a=n(5580),l=n(7059),u=n(5200),h=n(4089);e.exports=(e,t,n,d)=>{let f,p,y,v,g;switch(e=new r(e,d),t=new c(t,d),n){case">":f=a,p=u,y=l,v=">",g=">=";break;case"<":f=l,p=h,y=a,v="<",g="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(s(e,t,d))return!1;for(let n=0;n<t.set.length;++n){const r=t.set[n];let c=null,s=null;if(r.forEach((e=>{e.semver===i&&(e=new o(">=0.0.0")),c=c||e,s=s||e,f(e.semver,c.semver,d)?c=e:y(e.semver,s.semver,d)&&(s=e)})),c.operator===v||c.operator===g)return!1;if((!s.operator||s.operator===v)&&p(e,s.semver))return!1;if(s.operator===g&&y(e,s.semver))return!1}return!0}},7083:e=>{var t=1/0,n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt,s=Object.prototype.toString;function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return function(e,l){var u;if("function"!=typeof l)throw new TypeError("Expected a function");return e=function(e){var l=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==s.call(e)}(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var l=o.test(e);return l||i.test(e)?c(e.slice(2),l?2:8):r.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),u=l%1;return l==l?u?l-u:l:0}(e),function(){return--e>0&&(u=l.apply(this,arguments)),e<=1&&(l=void 0),u}}(2,e)}},7260:(e,t,n)=>{var r=n(5747);e.exports=function(e,t){t=t||{};var n=r.decode(e,t);if(!n)return null;var o=n.payload;if("string"==typeof o)try{var i=JSON.parse(o);null!==i&&"object"==typeof i&&(o=i)}catch(e){}return!0===t.complete?{header:n.header,payload:o,signature:n.signature}:o}},7272:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},7414:(e,t,n)=>{const r=n(144);e.exports=(e,t)=>{const n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}},7599:(e,t,n)=>{var r=n(2861).Buffer,o=n(8948),i=n(8789),c=n(2203),s=n(2851),a=n(9023),l=/^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/;function u(e){var t=e.split(".",1)[0];return function(e){if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(e))return e;try{return JSON.parse(e)}catch(e){return}}(r.from(t,"base64").toString("binary"))}function h(e){return e.split(".")[2]}function d(e){return l.test(e)&&!!u(e)}function f(e,t,n){if(!t){var r=new Error("Missing algorithm parameter for jws.verify");throw r.code="MISSING_ALGORITHM",r}var o=h(e=s(e)),c=function(e){return e.split(".",2).join(".")}(e);return i(t).verify(c,o,n)}function p(e,t){if(t=t||{},!d(e=s(e)))return null;var n=u(e);if(!n)return null;var o=function(e,t){t=t||"utf8";var n=e.split(".")[1];return r.from(n,"base64").toString(t)}(e);return("JWT"===n.typ||t.json)&&(o=JSON.parse(o,t.encoding)),{header:n,payload:o,signature:h(e)}}function y(e){var t=(e=e||{}).secret||e.publicKey||e.key,n=new o(t);this.readable=!0,this.algorithm=e.algorithm,this.encoding=e.encoding,this.secret=this.publicKey=this.key=n,this.signature=new o(e.signature),this.secret.once("close",function(){!this.signature.writable&&this.readable&&this.verify()}.bind(this)),this.signature.once("close",function(){!this.secret.writable&&this.readable&&this.verify()}.bind(this))}a.inherits(y,c),y.prototype.verify=function(){try{var e=f(this.signature.buffer,this.algorithm,this.key.buffer),t=p(this.signature.buffer,this.encoding);return this.emit("done",e,t),this.emit("data",e),this.emit("end"),this.readable=!1,e}catch(e){this.readable=!1,this.emit("error",e),this.emit("close")}},y.decode=p,y.isValid=d,y.verify=f,e.exports=y},7631:(e,t,n)=>{const r=n(8311);e.exports=(e,t)=>new r(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},7638:(e,t,n)=>{const r=n(8311);e.exports=(e,t,n)=>{try{t=new r(t,n)}catch(e){return!1}return t.test(e)}},7651:(e,t,n)=>{const r=n(855),o=n(4977),i=n(7019),c=n(5747),s=n(6111),a=n(7914),l=n(8928),u=n(3639),h=n(9001),d=n(5931),f=n(7083),{KeyObject:p,createSecretKey:y,createPrivateKey:v}=n(6982),g=["RS256","RS384","RS512","ES256","ES384","ES512","HS256","HS384","HS512","none"];o&&g.splice(3,0,"PS256","PS384","PS512");const m={expiresIn:{isValid:function(e){return l(e)||d(e)&&e},message:'"expiresIn" should be a number of seconds or string representing a timespan'},notBefore:{isValid:function(e){return l(e)||d(e)&&e},message:'"notBefore" should be a number of seconds or string representing a timespan'},audience:{isValid:function(e){return d(e)||Array.isArray(e)},message:'"audience" must be a string or array'},algorithm:{isValid:s.bind(null,g),message:'"algorithm" must be a valid string enum value'},header:{isValid:h,message:'"header" must be an object'},encoding:{isValid:d,message:'"encoding" must be a string'},issuer:{isValid:d,message:'"issuer" must be a string'},subject:{isValid:d,message:'"subject" must be a string'},jwtid:{isValid:d,message:'"jwtid" must be a string'},noTimestamp:{isValid:a,message:'"noTimestamp" must be a boolean'},keyid:{isValid:d,message:'"keyid" must be a string'},mutatePayload:{isValid:a,message:'"mutatePayload" must be a boolean'},allowInsecureKeySizes:{isValid:a,message:'"allowInsecureKeySizes" must be a boolean'},allowInvalidAsymmetricKeyTypes:{isValid:a,message:'"allowInvalidAsymmetricKeyTypes" must be a boolean'}},N={iat:{isValid:u,message:'"iat" should be a number of seconds'},exp:{isValid:u,message:'"exp" should be a number of seconds'},nbf:{isValid:u,message:'"nbf" should be a number of seconds'}};function w(e,t,n,r){if(!h(n))throw new Error('Expected "'+r+'" to be a plain object.');Object.keys(n).forEach((function(o){const i=e[o];if(i){if(!i.isValid(n[o]))throw new Error(i.message)}else if(!t)throw new Error('"'+o+'" is not allowed in "'+r+'"')}))}const T={audience:"aud",issuer:"iss",subject:"sub",jwtid:"jti"},C=["expiresIn","notBefore","noTimestamp","audience","issuer","subject","jwtid"];e.exports=function(e,t,n,o){"function"==typeof n?(o=n,n={}):n=n||{};const s="object"==typeof e&&!Buffer.isBuffer(e),a=Object.assign({alg:n.algorithm||"HS256",typ:s?"JWT":void 0,kid:n.keyid},n.header);function l(e){if(o)return o(e);throw e}if(!t&&"none"!==n.algorithm)return l(new Error("secretOrPrivateKey must have a value"));if(null!=t&&!(t instanceof p))try{t=v(t)}catch(e){try{t=y("string"==typeof t?Buffer.from(t):t)}catch(e){return l(new Error("secretOrPrivateKey is not valid key material"))}}if(a.alg.startsWith("HS")&&"secret"!==t.type)return l(new Error(`secretOrPrivateKey must be a symmetric key when using ${a.alg}`));if(/^(?:RS|PS|ES)/.test(a.alg)){if("private"!==t.type)return l(new Error(`secretOrPrivateKey must be an asymmetric key when using ${a.alg}`));if(!n.allowInsecureKeySizes&&!a.alg.startsWith("ES")&&void 0!==t.asymmetricKeyDetails&&t.asymmetricKeyDetails.modulusLength<2048)return l(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${a.alg}`))}if(void 0===e)return l(new Error("payload is required"));if(s){try{!function(e){w(N,!0,e,"payload")}(e)}catch(e){return l(e)}n.mutatePayload||(e=Object.assign({},e))}else{const t=C.filter((function(e){return void 0!==n[e]}));if(t.length>0)return l(new Error("invalid "+t.join(",")+" option for "+typeof e+" payload"))}if(void 0!==e.exp&&void 0!==n.expiresIn)return l(new Error('Bad "options.expiresIn" option the payload already has an "exp" property.'));if(void 0!==e.nbf&&void 0!==n.notBefore)return l(new Error('Bad "options.notBefore" option the payload already has an "nbf" property.'));try{!function(e){w(m,!1,e,"options")}(n)}catch(e){return l(e)}if(!n.allowInvalidAsymmetricKeyTypes)try{i(a.alg,t)}catch(e){return l(e)}const u=e.iat||Math.floor(Date.now()/1e3);if(n.noTimestamp?delete e.iat:s&&(e.iat=u),void 0!==n.notBefore){try{e.nbf=r(n.notBefore,u)}catch(e){return l(e)}if(void 0===e.nbf)return l(new Error('"notBefore" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}if(void 0!==n.expiresIn&&"object"==typeof e){try{e.exp=r(n.expiresIn,u)}catch(e){return l(e)}if(void 0===e.exp)return l(new Error('"expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60'))}Object.keys(T).forEach((function(t){const r=T[t];if(void 0!==n[t]){if(void 0!==e[r])return l(new Error('Bad "options.'+t+'" option. The payload already has an "'+r+'" property.'));e[r]=n[t]}}));const h=n.encoding||"utf8";if("function"!=typeof o){let r=c.sign({header:a,payload:e,secret:t,encoding:h});if(!n.allowInsecureKeySizes&&/^(?:RS|PS)/.test(a.alg)&&r.length<256)throw new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${a.alg}`);return r}o=o&&f(o),c.createSign({header:a,privateKey:t,payload:e,encoding:h}).once("error",o).once("done",(function(e){if(!n.allowInsecureKeySizes&&/^(?:RS|PS)/.test(a.alg)&&e.length<256)return o(new Error(`secretOrPrivateKey has a minimum key size of 2048 bits for ${a.alg}`));o(null,e)}))}},7914:e=>{var t=Object.prototype.toString;e.exports=function(e){return!0===e||!1===e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Boolean]"==t.call(e)}},8311:(e,t,n)=>{const r=/\s+/g;class o{constructor(e,t){if(t=c(t),e instanceof o)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new o(e.raw,t);if(e instanceof s)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(r," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!g(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&m(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&y)|(this.options.loose&&v))+":"+e,n=i.get(t);if(n)return n;const r=this.options.loose,o=r?u[h.HYPHENRANGELOOSE]:u[h.HYPHENRANGE];e=e.replace(o,b(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(u[h.COMPARATORTRIM],d),a("comparator trim",e),e=e.replace(u[h.TILDETRIM],f),a("tilde trim",e),e=e.replace(u[h.CARETTRIM],p),a("caret trim",e);let c=e.split(" ").map((e=>w(e,this.options))).join(" ").split(/\s+/).map((e=>k(e,this.options)));r&&(c=c.filter((e=>(a("loose invalid filter",e,this.options),!!e.match(u[h.COMPARATORLOOSE]))))),a("range list",c);const l=new Map,m=c.map((e=>new s(e,this.options)));for(const e of m){if(g(e))return[e];l.set(e.value,e)}l.size>1&&l.has("")&&l.delete("");const N=[...l.values()];return i.set(t,N),N}intersects(e,t){if(!(e instanceof o))throw new TypeError("a Range is required");return this.set.some((n=>N(n,t)&&e.set.some((e=>N(e,t)&&n.every((n=>e.every((e=>n.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(L(this.set[t],e,this.options))return!0;return!1}}e.exports=o;const i=new(n(8794)),c=n(8587),s=n(3904),a=n(7272),l=n(3908),{safeRe:u,t:h,comparatorTrimReplace:d,tildeTrimReplace:f,caretTrimReplace:p}=n(9718),{FLAG_INCLUDE_PRERELEASE:y,FLAG_LOOSE:v}=n(6874),g=e=>"<0.0.0-0"===e.value,m=e=>""===e.value,N=(e,t)=>{let n=!0;const r=e.slice();let o=r.pop();for(;n&&r.length;)n=r.every((e=>o.intersects(e,t))),o=r.pop();return n},w=(e,t)=>(a("comp",e,t),e=E(e,t),a("caret",e),e=C(e,t),a("tildes",e),e=S(e,t),a("xrange",e),e=x(e,t),a("stars",e),e),T=e=>!e||"x"===e.toLowerCase()||"*"===e,C=(e,t)=>e.trim().split(/\s+/).map((e=>I(e,t))).join(" "),I=(e,t)=>{const n=t.loose?u[h.TILDELOOSE]:u[h.TILDE];return e.replace(n,((t,n,r,o,i)=>{let c;return a("tilde",e,t,n,r,o,i),T(n)?c="":T(r)?c=`>=${n}.0.0 <${+n+1}.0.0-0`:T(o)?c=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:i?(a("replaceTilde pr",i),c=`>=${n}.${r}.${o}-${i} <${n}.${+r+1}.0-0`):c=`>=${n}.${r}.${o} <${n}.${+r+1}.0-0`,a("tilde return",c),c}))},E=(e,t)=>e.trim().split(/\s+/).map((e=>A(e,t))).join(" "),A=(e,t)=>{a("caret",e,t);const n=t.loose?u[h.CARETLOOSE]:u[h.CARET],r=t.includePrerelease?"-0":"";return e.replace(n,((t,n,o,i,c)=>{let s;return a("caret",e,t,n,o,i,c),T(n)?s="":T(o)?s=`>=${n}.0.0${r} <${+n+1}.0.0-0`:T(i)?s="0"===n?`>=${n}.${o}.0${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.0${r} <${+n+1}.0.0-0`:c?(a("replaceCaret pr",c),s="0"===n?"0"===o?`>=${n}.${o}.${i}-${c} <${n}.${o}.${+i+1}-0`:`>=${n}.${o}.${i}-${c} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${i}-${c} <${+n+1}.0.0-0`):(a("no pr"),s="0"===n?"0"===o?`>=${n}.${o}.${i}${r} <${n}.${o}.${+i+1}-0`:`>=${n}.${o}.${i}${r} <${n}.${+o+1}.0-0`:`>=${n}.${o}.${i} <${+n+1}.0.0-0`),a("caret return",s),s}))},S=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>R(e,t))).join(" ")),R=(e,t)=>{e=e.trim();const n=t.loose?u[h.XRANGELOOSE]:u[h.XRANGE];return e.replace(n,((n,r,o,i,c,s)=>{a("xRange",e,n,r,o,i,c,s);const l=T(o),u=l||T(i),h=u||T(c),d=h;return"="===r&&d&&(r=""),s=t.includePrerelease?"-0":"",l?n=">"===r||"<"===r?"<0.0.0-0":"*":r&&d?(u&&(i=0),c=0,">"===r?(r=">=",u?(o=+o+1,i=0,c=0):(i=+i+1,c=0)):"<="===r&&(r="<",u?o=+o+1:i=+i+1),"<"===r&&(s="-0"),n=`${r+o}.${i}.${c}${s}`):u?n=`>=${o}.0.0${s} <${+o+1}.0.0-0`:h&&(n=`>=${o}.${i}.0${s} <${o}.${+i+1}.0-0`),a("xRange return",n),n}))},x=(e,t)=>(a("replaceStars",e,t),e.trim().replace(u[h.STAR],"")),k=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?h.GTE0PRE:h.GTE0],"")),b=e=>(t,n,r,o,i,c,s,a,l,u,h,d)=>`${n=T(r)?"":T(o)?`>=${r}.0.0${e?"-0":""}`:T(i)?`>=${r}.${o}.0${e?"-0":""}`:c?`>=${n}`:`>=${n}${e?"-0":""}`} ${a=T(l)?"":T(u)?`<${+l+1}.0.0-0`:T(h)?`<${l}.${+u+1}.0-0`:d?`<=${l}.${u}.${h}-${d}`:e?`<${l}.${u}.${+h+1}-0`:`<=${a}`}`.trim(),L=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(a(e[n].semver),e[n].semver!==s.ANY&&e[n].semver.prerelease.length>0){const r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}},8587:e=>{const t=Object.freeze({loose:!0}),n=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:n},8789:(e,t,n)=>{var r=n(1045),o=n(2861).Buffer,i=n(6982),c=n(2010),s=n(9023),a="secret must be a string or buffer",l="key must be a string or a buffer",u="function"==typeof i.createPublicKey;function h(e){if(!o.isBuffer(e)&&"string"!=typeof e){if(!u)throw y(l);if("object"!=typeof e)throw y(l);if("string"!=typeof e.type)throw y(l);if("string"!=typeof e.asymmetricKeyType)throw y(l);if("function"!=typeof e.export)throw y(l)}}function d(e){if(!o.isBuffer(e)&&"string"!=typeof e&&"object"!=typeof e)throw y("key must be a string, a buffer or an object")}function f(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function p(e){var t=4-(e=e.toString()).length%4;if(4!==t)for(var n=0;n<t;++n)e+="=";return e.replace(/\-/g,"+").replace(/_/g,"/")}function y(e){var t=[].slice.call(arguments,1),n=s.format.bind(s,e).apply(null,t);return new TypeError(n)}function v(e){var t;return t=e,o.isBuffer(t)||"string"==typeof t||(e=JSON.stringify(e)),e}function g(e){return function(t,n){!function(e){if(!o.isBuffer(e)){if("string"==typeof e)return e;if(!u)throw y(a);if("object"!=typeof e)throw y(a);if("secret"!==e.type)throw y(a);if("function"!=typeof e.export)throw y(a)}}(n),t=v(t);var r=i.createHmac("sha"+e,n);return f((r.update(t),r.digest("base64")))}}function m(e){return function(t,n,i){var c=g(e)(t,i);return r(o.from(n),o.from(c))}}function N(e){return function(t,n){d(n),t=v(t);var r=i.createSign("RSA-SHA"+e);return f((r.update(t),r.sign(n,"base64")))}}function w(e){return function(t,n,r){h(r),t=v(t),n=p(n);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify(r,n,"base64")}}function T(e){return function(t,n){d(n),t=v(t);var r=i.createSign("RSA-SHA"+e);return f((r.update(t),r.sign({key:n,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},"base64")))}}function C(e){return function(t,n,r){h(r),t=v(t),n=p(n);var o=i.createVerify("RSA-SHA"+e);return o.update(t),o.verify({key:r,padding:i.constants.RSA_PKCS1_PSS_PADDING,saltLength:i.constants.RSA_PSS_SALTLEN_DIGEST},n,"base64")}}function I(e){var t=N(e);return function(){var n=t.apply(null,arguments);return c.derToJose(n,"ES"+e)}}function E(e){var t=w(e);return function(n,r,o){return r=c.joseToDer(r,"ES"+e).toString("base64"),t(n,r,o)}}function A(){return function(){return""}}function S(){return function(e,t){return""===t}}u&&(l+=" or a KeyObject",a+="or a KeyObject"),e.exports=function(e){var t={hs:g,rs:N,ps:T,es:I,none:A},n={hs:m,rs:w,ps:C,es:E,none:S},r=e.match(/^(RS|PS|ES|HS)(256|384|512)$|^(none)$/i);if(!r)throw y('"%s" is not a valid algorithm.\n Supported algorithms are:\n "HS256", "HS384", "HS512", "RS256", "RS384", "RS512", "PS256", "PS384", "PS512", "ES256", "ES384", "ES512" and "none".',e);var o=(r[1]||r[3]).toLowerCase(),i=r[2];return{sign:t[o](i),verify:n[o](i)}}},8794:e=>{e.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}},8928:e=>{var t=1/0,n=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt,s=Object.prototype.toString;function a(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=function(e){return"number"==typeof e&&e==function(e){var l=function(e){return e?(e=function(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==s.call(e)}(e))return NaN;if(a(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=a(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var l=o.test(e);return l||i.test(e)?c(e.slice(2),l?2:8):r.test(e)?NaN:+e}(e))===t||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}(e),u=l%1;return l==l?u?l-u:l:0}(e)}},8948:(e,t,n)=>{var r=n(2861).Buffer,o=n(2203);function i(e){if(this.buffer=null,this.writable=!0,this.readable=!0,!e)return this.buffer=r.alloc(0),this;if("function"==typeof e.pipe)return this.buffer=r.alloc(0),e.pipe(this),this;if(e.length||"object"==typeof e)return this.buffer=e,this.writable=!1,process.nextTick(function(){this.emit("end",e),this.readable=!1,this.emit("close")}.bind(this)),this;throw new TypeError("Unexpected data type ("+typeof e+")")}n(9023).inherits(i,o),i.prototype.write=function(e){this.buffer=r.concat([this.buffer,r.from(e)]),this.emit("data",e)},i.prototype.end=function(e){e&&this.write(e),this.emit("end",e),this.emit("close"),this.writable=!1,this.readable=!1},e.exports=i},8980:(e,t,n)=>{var r=n(1741),o=function(e,t){r.call(this,e),this.name="TokenExpiredError",this.expiredAt=t};(o.prototype=Object.create(r.prototype)).constructor=o,e.exports=o},9001:e=>{var t,n,r=Function.prototype,o=Object.prototype,i=r.toString,c=o.hasOwnProperty,s=i.call(Object),a=o.toString,l=(t=Object.getPrototypeOf,n=Object,function(e){return t(n(e))});e.exports=function(e){if(!function(e){return!!e&&"object"==typeof e}(e)||"[object Object]"!=a.call(e)||function(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(e){}return t}(e))return!1;var t=l(e);if(null===t)return!0;var n=c.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&i.call(n)==s}},9023:e=>{"use strict";e.exports=require("util")},9589:(e,t,n)=>{const r=n(9718),o=n(6874),i=n(3908),c=n(1123),s=n(144),a=n(6953),l=n(7414),u=n(3007),h=n(1832),d=n(2938),f=n(6254),p=n(4493),y=n(1729),v=n(560),g=n(9970),m=n(1763),N=n(909),w=n(3927),T=n(4277),C=n(5580),I=n(7059),E=n(4641),A=n(3999),S=n(4089),R=n(5200),x=n(2111),k=n(6170),b=n(3904),L=n(8311),O=n(7638),P=n(7631),_=n(9628),$=n(270),G=n(1261),F=n(3874),U=n(7075),B=n(5571),D=n(5342),V=n(6780),j=n(2525),M=n(5032);e.exports={parse:s,valid:a,clean:l,inc:u,diff:h,major:d,minor:f,patch:p,prerelease:y,compare:v,rcompare:g,compareLoose:m,compareBuild:N,sort:w,rsort:T,gt:C,lt:I,eq:E,neq:A,gte:S,lte:R,cmp:x,coerce:k,Comparator:b,Range:L,satisfies:O,toComparators:P,maxSatisfying:_,minSatisfying:$,minVersion:G,validRange:F,outside:U,gtr:B,ltr:D,intersects:V,simplifyRange:j,subset:M,SemVer:i,re:r.re,src:r.src,tokens:r.t,SEMVER_SPEC_VERSION:o.SEMVER_SPEC_VERSION,RELEASE_TYPES:o.RELEASE_TYPES,compareIdentifiers:c.compareIdentifiers,rcompareIdentifiers:c.rcompareIdentifiers}},9628:(e,t,n)=>{const r=n(3908),o=n(8311);e.exports=(e,t,n)=>{let i=null,c=null,s=null;try{s=new o(t,n)}catch(e){return null}return e.forEach((e=>{s.test(e)&&(i&&-1!==c.compare(e)||(i=e,c=new r(i,n)))})),i}},9718:(e,t,n)=>{const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:o,MAX_LENGTH:i}=n(6874),c=n(7272),s=(t=e.exports={}).re=[],a=t.safeRe=[],l=t.src=[],u=t.safeSrc=[],h=t.t={};let d=0;const f="[a-zA-Z0-9-]",p=[["\\s",1],["\\d",i],[f,o]],y=(e,t,n)=>{const r=(e=>{for(const[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e})(t),o=d++;c(e,o,t),h[e]=o,l[o]=t,u[o]=r,s[o]=new RegExp(t,n?"g":void 0),a[o]=new RegExp(r,n?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${f}*`),y("MAINVERSION",`(${l[h.NUMERICIDENTIFIER]})\\.(${l[h.NUMERICIDENTIFIER]})\\.(${l[h.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${l[h.NUMERICIDENTIFIERLOOSE]})\\.(${l[h.NUMERICIDENTIFIERLOOSE]})\\.(${l[h.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${l[h.NUMERICIDENTIFIER]}|${l[h.NONNUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${l[h.NUMERICIDENTIFIERLOOSE]}|${l[h.NONNUMERICIDENTIFIER]})`),y("PRERELEASE",`(?:-(${l[h.PRERELEASEIDENTIFIER]}(?:\\.${l[h.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${l[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[h.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${f}+`),y("BUILD",`(?:\\+(${l[h.BUILDIDENTIFIER]}(?:\\.${l[h.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${l[h.MAINVERSION]}${l[h.PRERELEASE]}?${l[h.BUILD]}?`),y("FULL",`^${l[h.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${l[h.MAINVERSIONLOOSE]}${l[h.PRERELEASELOOSE]}?${l[h.BUILD]}?`),y("LOOSE",`^${l[h.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${l[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${l[h.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${l[h.XRANGEIDENTIFIER]})(?:\\.(${l[h.XRANGEIDENTIFIER]})(?:\\.(${l[h.XRANGEIDENTIFIER]})(?:${l[h.PRERELEASE]})?${l[h.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${l[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[h.XRANGEIDENTIFIERLOOSE]})(?:${l[h.PRERELEASELOOSE]})?${l[h.BUILD]}?)?)?`),y("XRANGE",`^${l[h.GTLT]}\\s*${l[h.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${l[h.GTLT]}\\s*${l[h.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),y("COERCE",`${l[h.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",l[h.COERCEPLAIN]+`(?:${l[h.PRERELEASE]})?`+`(?:${l[h.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",l[h.COERCE],!0),y("COERCERTLFULL",l[h.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${l[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",y("TILDE",`^${l[h.LONETILDE]}${l[h.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${l[h.LONETILDE]}${l[h.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${l[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",y("CARET",`^${l[h.LONECARET]}${l[h.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${l[h.LONECARET]}${l[h.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${l[h.GTLT]}\\s*(${l[h.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${l[h.GTLT]}\\s*(${l[h.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${l[h.GTLT]}\\s*(${l[h.LOOSEPLAIN]}|${l[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${l[h.XRANGEPLAIN]})\\s+-\\s+(${l[h.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${l[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[h.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},9970:(e,t,n)=>{const r=n(560);e.exports=(e,t,n)=>r(t,e,n)}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};(()=>{"use strict";n.r(r),n.d(r,{ALLID:()=>no,AddGhostConcept:()=>Er,AddGhostConnection:()=>Ar,BaseUrl:()=>C,BinaryTree:()=>f,CheckAccessOfConcept:()=>Ao,CheckAccessOfConceptList:()=>So,Composition:()=>zn,CompositionBinaryTree:()=>Kn,CompositionNode:()=>Hn,Concept:()=>p,ConceptsData:()=>N,Connection:()=>P,ConnectionData:()=>D,CreateComposition:()=>ht,CreateConnectionBetweenTwoConcepts:()=>Gt,CreateConnectionBetweenTwoConceptsGeneral:()=>Ut,CreateDefaultConcept:()=>y,CreateDefaultLConcept:()=>Se,CreateSession:()=>dr,CreateSessionVisit:()=>pr,CreateTheCompositionLocal:()=>Ct,CreateTheCompositionWithCache:()=>Qn,CreateTheConnection:()=>je,CreateTheConnectionGeneral:()=>St,CreateTheConnectionLocal:()=>ft,DATAID:()=>Qr,DATAIDDATE:()=>eo,DeleteConceptById:()=>yn,DeleteConnectionById:()=>Ot,FilterConceptListByAccess:()=>Ro,FilterSearch:()=>Mr,FormatFromConnections:()=>kr,FreeSchemaResponse:()=>k,FreeschemaQuery:()=>wo,GetAllConnectionsOfComposition:()=>ee,GetAllConnectionsOfCompositionBulk:()=>q,GetComposition:()=>re,GetCompositionBulk:()=>En,GetCompositionBulkWithDataId:()=>An,GetCompositionFromConnectionsWithDataId:()=>Sn,GetCompositionFromConnectionsWithDataIdInObject:()=>xn,GetCompositionList:()=>ve,GetCompositionListLocal:()=>Ue,GetCompositionListLocalWithId:()=>Be,GetCompositionListWithId:()=>ge,GetCompositionLocal:()=>Oe,GetCompositionLocalWithId:()=>Pe,GetCompositionWithAllIds:()=>oe,GetCompositionWithCache:()=>cr,GetCompositionWithDataIdBulk:()=>lr,GetCompositionWithDataIdWithCache:()=>ar,GetCompositionWithId:()=>ae,GetConceptBulk:()=>j,GetConceptByCharacter:()=>pe,GetConceptByCharacterAndCategoryDirectApi:()=>tn,GetConceptByCharacterAndType:()=>Ke,GetConnectionBulk:()=>Cn,GetConnectionById:()=>bt,GetConnectionOfTheConcept:()=>Et,GetLink:()=>Dt,GetLinkRaw:()=>Vt,GetLinkerConnectionFromConcepts:()=>hn,GetLinkerConnectionToConcepts:()=>dn,GetRelation:()=>vr,GetRelationRaw:()=>gr,GetTheConcept:()=>_t,GetUserGhostConnectionId:()=>Ir,GetUserGhostId:()=>Cr,HandleHttpError:()=>b,JUSTDATA:()=>Zr,LConcept:()=>Ae,LConnection:()=>dt,LISTNORMAL:()=>ro,LoginToBackend:()=>On,MakeTheInstanceConcept:()=>lt,MakeTheInstanceConceptLocal:()=>wt,MakeTheTimestamp:()=>Nn,MakeTheTypeConcept:()=>Qt,MakeTheTypeConceptApi:()=>sn,NORMAL:()=>Yr,PatcherStructure:()=>Vr,PermissionSet:()=>go,RAW:()=>to,RecursiveSearchApi:()=>bn,SchemaQueryListener:()=>No,SearchAllConcepts:()=>nr,SearchLinkInternal:()=>Dr,SearchLinkMultipleAll:()=>xr,SearchQuery:()=>wn,SearchStructure:()=>Hr,SearchWithLinker:()=>or,SessionData:()=>jr,Signin:()=>Gn,Signup:()=>_n,SplitStrings:()=>T,SyncData:()=>Ve,TrashTheConcept:()=>gn,UpdateComposition:()=>er,UpdateCompositionLocal:()=>_r,UserBinaryTree:()=>wr,ViewInternalData:()=>Fr,convertFromLConceptToConcept:()=>Lr,getFromDatabaseWithType:()=>i,getFromDatabaseWithTypeOld:()=>c,init:()=>ko,recursiveFetch:()=>le,recursiveFetchNew:()=>Jn,storeToDatabase:()=>o,updateAccessToken:()=>xo});class e{constructor(e){this.id=1,this.isOnlineSync=!1,this.isOnlineSync=e}}var t=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function o(e,t){}function i(e,n,r){return t(this,void 0,void 0,(function*(){}))}function c(e){return t(this,void 0,void 0,(function*(){}))}function s(e){return t(this,void 0,void 0,(function*(){}))}class a{}a.isTypeLoaded=!1,a.isCharacterLoaded=!1,a.isDataLoaded=!1,a.isLocalDataLoaded=!1,a.isLocalCharacterLoaded=!1,a.isLocalTypeLoaded=!1,a.isConnectionLoaded=!1,a.isConnectionTypeLoaded=!1,a.isLocalConnectionLoaded=!1;class l{constructor(e,t,n,r){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=r,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 r=0;r<t.variants.length;r++)t.variants[r].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;var r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,r,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,r,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,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,r,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,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=e.variants[0];if(r)return e.value=r.value,e.key=r.key,e.currentNode=r.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 o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.variants=o.variants,e.currentNode=o.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,o.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 u=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class h{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(a.isCharacterLoaded)return e("done");setTimeout(h.checkFlag,1e3,e)}static addNodeToTree(e){return u(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 u(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 u(this,void 0,void 0,(function*(){return this.characterRoot?this.characterRoot.getFromNodeWithCharacterAndType(e,t,this.characterRoot):this.characterRoot}))}static getCharacterAndCategoryFromTree(e,t){return u(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))}}h.characterRoot=null;var d=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.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 d(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.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);h.addNodeToTree(n),this.addNodeToTree(t)}static getNodeFromTree(e){return d(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return d(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 p{constructor(e,t,n,r,o,i,c,s,a,l,u,h,d,f,p,y=!1,v,g){this.referent=null,this.updateRecursion=!1,this.isTemp=!1,this.id=e,this.userId=t,this.typeId=n,this.typeUserId=r,this.ghostId=e,this.categoryId=o,this.categoryUserId=i,this.referentId=c,this.referentUserId=s,this.characterValue=`${a}`,this.securityId=l,this.securityUserId=u,this.accessId=h,this.accessUserId=d,this.sessionInformationId=f,this.sessionInformationUserId=p,this.x=0,this.y=0,this.type=null,this.isNew=y,this.entryTimeStamp=v,this.updatedTimeStamp=g}getType(){console.log(this.typeId)}}function y(){let e=new Date,t=new Date;return new p(0,0,0,0,0,0,0,0,"0",0,0,0,0,0,0,!1,e,t)}var v=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.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(a.isTypeLoaded)return e("done");setTimeout(g.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return v(this,void 0,void 0,(function*(){var n=[],r=this.getNodeFromTree(e);if(r){r.value.userId==t&&n.push(null==r?void 0:r.value);for(let e=0;e<r.variants.length;e++)if(r.variants[e].value.userId==t){var o=!1;for(let t=0;t<n.length;t++)n[t].id==r.variants[e].value.id&&(o=!0);o||n.push(r.variants[e].value)}}return n}))}static getTypeVariantsWithCharacterValue(e,t){return v(this,void 0,void 0,(function*(){let n=y();var r=this.getNodeFromTree(t);if(r){r.value.characterValue==e&&(n=r.value);for(let t=0;t<r.variants.length;t++)r.variants[t].value.characterValue==e&&(n=r.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,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class N{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),h.addConceptToTree(e))}static AddConceptToMemory(e){e.id>0&&(f.addConceptToTree(e),g.addConceptToTree(e),h.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);f.removeNodeFromTree(e.id),e.id}static GetConcept(e){return m(this,void 0,void 0,(function*(){var t=y(),n=yield f.getNodeFromTree(e);if(null==n?void 0:n.value){var r=n.value;r&&(t=r)}return t}))}static GetConceptByCharacter(e){return m(this,void 0,void 0,(function*(){var t=y(),n=h.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterUpdated(e){return m(this,void 0,void 0,(function*(){var t=y(),n=h.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return m(this,void 0,void 0,(function*(){return y(),yield g.getTypeVariantsWithCharacterValue(e,t)}))}static GetConceptByCharacterAndCategoryLocal(e,t){return m(this,void 0,void 0,(function*(){var n=y(),r=yield h.getCharacterAndCategoryFromTree(e,t);return r&&(n=r.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 h.characterRoot}getName(){return this.name}}N.conceptsArray=[],N.NPC=[],N.conceptDictionary=[];var w=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.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 C{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"}}C.BASE_URL="https://localhost:7053/",C.AI_URL="https://ai.freeschema.com",C.MQTT_URL="192.168.1.249",C.NODE_URL="http://localhost:5001/";class I{}I.BearerAccessToken="",I.JwtSecret="";var E=n(4040),A=n.n(E);const S=()=>{const e={server:!0,timestamp:Date.now(),unique_name:"999",email:"info@boomconsole.com",upn:"100144987",primarysid:"102321705",sub:"node-server"};return A().sign(e,I.JwtSecret,{algorithm:"HS256",expiresIn:"1h"})};function R(e="application/json",t="application/json"){let n=I.BearerAccessToken||S();return console.log("GetRequestHeader token: ",n),{"Content-Type":e,Authorization:"Bearer "+n,Accept:t}}function x(e="application/json",t="",n="application/json"){return""==t&&(t=I.BearerAccessToken||S()),{"Content-Type":e,Authorization:"Bearer "+t,Accept:n}}class k{constructor(e,t,n,r){this.url=C.BASE_URL,this.message=e,this.ok=t,this.status=n,this.data=r}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 b(e){if(e.status>=400){let t=new k(e.statusText,!1,e.status,"");throw t.setUrl(e.url),t}}var L=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function O(e,t){return L(this,void 0,void 0,(function*(){try{var n=new URLSearchParams;n.append("type",e),n.append("user_id",t.toString());var r=R("application/x-www-form-urlencoded");const i=yield fetch(C.GetAllConceptsByTypeUrl(),{method:"POST",headers:r,body:n});if(i.ok){const e=yield i.json();for(var o=0;o<e.length;o++)N.AddConcept(e[o])}console.log("GetAllConceptsByType error",i.status),b(i)}catch(e){throw e instanceof Error?console.log("GetAllConceptsByType error message: ",e.message):console.log("GetAllConceptsByType unexpected error: ",e),e}}))}class P{constructor(e=0,t,n,r,o,i,c,s,a,l,u,h,d,f,p,v){this.isTemp=!1,this.toUpdate=!1,this.type=y(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.ofTheConceptUserId=r,this.toTheConceptUserId=o,this.userId=i,this.typeId=c,this.ghostId=e,this.typeUserId=s,this.orderId=a,this.orderUserId=l,this.securityId=u,this.securityUserId=h,this.accessId=d,this.accessUserId=f,this.sessionInformationId=p,this.sessionInformationUserId=v,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date}}class _{constructor(e,t,n,r){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=r,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 r=0;r<t.variants.length;r++)t.variants[r].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;var r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,r,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,r,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,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=e.variants[0];if(r)return e.value=r.value,e.key=r.key,e.currentNode=r.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 o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.variants=o.variants,e.currentNode=o.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,o.key,n),e}inOrderSuccessor(e){for(;null!=e.leftNode;)e=e.leftNode;return e}}var $=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class G{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 _(e.id,e,null,null);this.addNodeToTree(t)}static waitForDataToLoad(){return $(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isConnectionLoaded)return e("done");setTimeout(G.checkFlag,1e3,e)}static removeNodeFromTree(e){return $(this,void 0,void 0,(function*(){this.connectionroot&&(this.connectionroot=this.connectionroot.removeNode(this.connectionroot,e))}))}static getNodeFromTree(e){return $(this,void 0,void 0,(function*(){return this.connectionroot?this.connectionroot.getFromNode(e,this.connectionroot):this.connectionroot}))}}G.connectionroot=null;var F=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class U{static addNodeToTree(e){return F(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 F(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isConnectionTypeLoaded)return e("done");setTimeout(U.checkFlag,1e3,e)}static addConnectionToTree(e){if(0!=e.typeId){var t=new _(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 F(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 F(this,void 0,void 0,(function*(){var n=[],r=this.getNodeFromTree(e);if(r){r.value.userId==t&&n.push(null==r?void 0:r.value);for(let e=0;e<r.variants.length;e++)r.variants[e].value.userId==t&&n.push(r.variants[e].value)}return n}))}}U.connectionTypeRoot=null;var B=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.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||(G.addConnectionToTree(e),U.addConnectionToTree(e))}static AddConnectionToMemory(e){e.isTemp||(G.addConnectionToTree(e),U.addConnectionToTree(e))}static AddToDictionary(e){this.connectionDictionary[e.id]=e}static RemoveConnection(e){0!=e.id&&(e.id,G.removeNodeFromTree(e.id),U.removeTypeConcept(e.typeId,e.id))}static GetConnectionTree(){return G.connectionroot}static GetConnectionTypeTree(){return U.connectionTypeRoot}static GetConnection(e){return B(this,void 0,void 0,(function*(){var t=new P(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),n=yield G.getNodeFromTree(e);if(null==n?void 0:n.value){var r=n.value;r&&(t=r)}return t}))}static GetConnectionsOfCompositionLocal(e){return B(this,void 0,void 0,(function*(){var t=[],n=yield U.getNodeFromTree(e);if(null==n?void 0:n.value){var r=n.value;if(r){let e=r;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 V=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function j(e){return V(this,void 0,void 0,(function*(){let t=[];try{var n=[];for(let r=0;r<e.length;r++){let o=yield N.GetConcept(e[r]);0==o.id?n.push(e[r]):t.push(o)}if(0==n.length)return t;{var r=R();const e=yield fetch(C.GetConceptBulkUrl(),{method:"POST",headers:r,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 r=n[e];t.push(r),N.AddConcept(r)}}else console.log("Get Concept Bulk error",e.status),b(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 M=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function H(){return M(this,arguments,void 0,(function*(e=[]){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 j(t)}}))}var W=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function K(){return W(this,arguments,void 0,(function*(e=[]){var t=[];for(let r=0;r<e.length;r++){var n=yield D.GetConnectionsOfCompositionLocal(e[r]);t.push(...n)}return t}))}function X(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 J=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function q(){return J(this,arguments,void 0,(function*(e=[]){var t=[];if(e.length<=0)return t;var n=yield K(e),r=yield function(){return J(this,arguments,void 0,(function*(e=[]){var t=[];try{var n=R();const o=yield fetch(C.GetAllConnectionsOfCompositionBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(o.ok){const e=yield o.json();for(var r=0;r<e.length;r++)D.AddConnection(e[r]),t.push(e[r])}else console.log("Get all connections of composition bulk error message: ","Cannot get response"),b(o);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 X(t=r,n),yield H(t),t}))}var z=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const Y=new Map;function Q(e){return z(this,void 0,void 0,(function*(){let t=y();if(Y.has(e))return Y.get(e)||t;const n=(()=>z(this,void 0,void 0,(function*(){try{var n=yield N.GetConcept(e);let o=N.GetNpc(e);if(0!=n.id||o)return n;{var r=R("application/x-www-form-urlencoded");const n=yield fetch(C.GetConceptUrl(),{method:"POST",headers:r,body:`id=${e}`});return n.ok?(t=yield n.json(),t.id>0?N.AddConcept(t):N.AddNpc(e)):(console.log("Get the concept error",n.status),b(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}finally{Y.delete(e)}})))();return Y.set(e,n),n}))}var Z=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function ee(e){return Z(this,void 0,void 0,(function*(){var t=[];if(0==(t=yield D.GetConnectionsOfCompositionLocal(e)).length)t=yield te(e);else{var n=yield te(e);X(n,t),t=n}return t}))}function te(e){return Z(this,void 0,void 0,(function*(){var t=[];try{var n=R("application/x-www-form-urlencoded");const o=yield fetch(C.GetAllConnectionsOfCompositionUrl(),{method:"POST",headers:n,body:`composition_id=${e}`});if(!o.ok)throw b(o),new Error(`Error! status: ${o.status}`);const i=yield o.json();for(var r=0;r<i.length;r++)D.AddConnection(i[r]),t.push(i[r]);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 ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function re(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield ee(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield le(e,r,i);return o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a,o}))}function oe(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield ee(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield ue(e,r,i);return o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a,o}))}function ie(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield D.GetConnectionsOfCompositionLocal(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield le(e,r,i);return o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a,o}))}function ce(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield D.GetConnectionsOfCompositionLocal(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield le(e,r,i);o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a;var l={};return l.created_at=s.entryTimeStamp,l.data=o,l.id=e,l}))}function se(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield D.GetConnectionsOfCompositionLocal(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield le(e,r,i);o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a;var l={};return l.data=o,l.id=e,l.created_at=s.entryTimeStamp,l}))}function ae(e){return ne(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield ee(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield N.GetConcept(e);0==s.id&&null!=e&&null!=e&&(s=yield Q(e));var a=yield le(e,r,i);o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:""]=a;var l={};return l.data=o,l.id=e,l}))}function le(e,t,n){return ne(this,arguments,void 0,(function*(e,t,n,r=[]){var o,i,c,s={},a=[];if(0==e)return null;var l=yield N.GetConcept(e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield Q(e)),0!=l.id&&null==l.type){var u=l.typeId,h=yield N.GetConcept(u);l.type=h,null==h&&null!=u&&null!=u&&(h=yield Q(u),l.type=h)}if(null===(o=null==l?void 0:l.type)||void 0===o?void 0:o.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(r.includes(e))return"";r.push(e);for(var d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){var f=t[d].toTheConceptId,p=yield N.GetConcept(f);null!=p&&0!=p.id||null==f||null==f||(p=yield Q(f)),p&&null==(null==p?void 0:p.type)&&(u=p.typeId,h=yield N.GetConcept(u),p.type=h,null==h&&null!=u&&null!=u&&(h=yield Q(u),p.type=h));var y=(null!==(c=null===(i=null==p?void 0:p.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(y))){if(y){const e=yield le(f,t,n,r);s[y]=e}}else{const e=yield le(f,t,n,r);a[y]=e,s=a}}return s}))}function ue(e,t,n){return ne(this,arguments,void 0,(function*(e,t,n,r=[]){var o,i,c,s={},a=[];if(0==e)return null;var l=yield N.GetConcept(e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield Q(e)),0!=l.id&&null==l.type){var u=l.typeId,h=yield N.GetConcept(u);l.type=h,null==h&&null!=u&&null!=u&&(h=yield Q(u),l.type=h)}if(null===(o=null==l?void 0:l.type)||void 0===o?void 0:o.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(r.includes(e))return"";r.push(e),s.id=e;for(var d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){var f=t[d].toTheConceptId,p=yield N.GetConcept(f);null!=p&&0!=p.id||null==f||null==f||(p=yield Q(f)),p&&null==(null==p?void 0:p.type)&&(u=p.typeId,h=yield N.GetConcept(u),p.type=h,null==h&&null!=u&&null!=u&&(h=yield Q(u),p.type=h));var y=(null!==(c=null===(i=null==p?void 0:p.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"").replace("the_","");if(isNaN(Number(y))){if(y){const e=yield ue(f,t,n);s[y]=e}}else{const e=yield ue(f,t,n);a[y]=e,s=a}}return s}))}var he=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function de(e){return he(this,void 0,void 0,(function*(){let t=y();try{var n=R("application/x-www-form-urlencoded");const r=yield fetch(C.GetConceptByCharacterValueUrl(),{method:"POST",headers:n,body:`character_value=${e}`});return r.ok?(t=yield r.json(),t.id>0&&(console.log("This is adding the new concept",t),N.AddConcept(t))):(console.log("Error in Getting concept by character value Error",r.status),b(r)),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 fe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function pe(e){return fe(this,void 0,void 0,(function*(){var t=yield N.GetConceptByCharacter(e),n=`${e}`;return null!=t&&0!=(null==t?void 0:t.id)||!n||(yield de(e),t=yield N.GetConceptByCharacter(e)),t}))}var ye=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function ve(e,t){return ye(this,arguments,void 0,(function*(e,t,n=10,r=1){var o=yield pe(e),i=[];if(o){yield O(e,t);for(var c=yield N.GetConceptsByTypeIdAndUser(o.id,t),s=n*(r-1),a=[],l=s;l<s+n;l++)c[l]&&a.push(c[l].id);for(yield q(a),l=s;l<s+n;l++)if(c[l]){var u=yield ie(c[l].id);i.push(u)}}return i}))}function ge(e,t){return ye(this,arguments,void 0,(function*(e,t,n=10,r=1){var o=yield pe(e),i=[];if(o){yield O(e,t);for(var c=yield N.GetConceptsByTypeIdAndUser(o.id,t),s=n*(r-1),a=[],l=s;l<s+n;l++)c[l]&&a.push(c[l].id);for(yield q(a),l=s;l<s+n;l++)if(c[l]){var u=yield ce(c[l].id);i.push(u)}}return i}))}class me{constructor(e,t,n,r){this.variants=[],this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=r,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 r=0;r<t.variants.length;r++)t.variants[r].value.id==e.value.id&&(n=!0);return n||t.variants.push(e),t}addNode(e,t,n){if(null==t)return e;var r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,r,n);else{if(!(t.key<e.key))return t;t.rightNode=this.addNode(e,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addCharacterNode(e,r,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,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addTypeNode(e,r,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,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 r=e.variants[0];if(r)return e.value=r.value,e.key=r.key,e.currentNode=r.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 o=this.inOrderSuccessor(e.rightNode);return e.value=o.value,e.key=o.key,e.variants=o.variants,e.currentNode=o.currentNode,e.rightNode=this.removeNodeWithVariants(e.rightNode,o.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 Ne=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class we{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 me(e.id,e,null,null);new me(e.characterValue,e,null,null),this.addNodeToTree(t)}static waitForDataToLoad(){return Ne(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isLocalDataLoaded)return e("done");setTimeout(we.checkFlag,1e3,e)}static getNodeFromTree(e){return Ne(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 Ne(this,void 0,void 0,(function*(){this.root&&(this.root=this.root.removeNode(this.root,e))}))}}we.root=null;var Te=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class Ce{static waitForDataToLoad(){return Te(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isLocalCharacterLoaded)return e("done");setTimeout(Ce.checkFlag,1e3,e)}static addNodeToTree(e){return Te(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 me(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 Te(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))}}Ce.LocalCharacterRoot=null;var Ie=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class Ee{static addNodeToTree(e){return Ie(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 me(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 Ie(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isLocalTypeLoaded)return e("done");setTimeout(Ee.checkFlag,1e3,e)}static getTypeVariantsFromTreeWithUserId(e,t){return Ie(this,void 0,void 0,(function*(){var n=[],r=this.getNodeFromTree(e);if(r){r.value.userId==t&&n.push(null==r?void 0:r.value);for(let e=0;e<r.variants.length;e++)r.variants[e].value.userId==t&&n.push(r.variants[e].value)}return n}))}}Ee.LocalTypeRoot=null;class Ae{constructor(e,t,n,r,o,i,c,s=!1,a,l,u,h=999){this.isComposition=!1,this.isTemp=!1,this.applicationId=999,this.id=e,this.userId=t,this.typeId=n,this.ghostId=e,this.categoryId=r,this.characterValue=i,this.accessId=o,this.type=null,this.isNew=s,this.typeCharacter=c,this.entryTimeStamp=a,this.updatedTimeStamp=l,this.referentId=u,this.applicationId=h}getType(){console.log(this.typeId)}}function Se(){let e=new Date,t=new Date;return new Ae(0,0,0,0,0,"0","0",!1,e,t,0)}var Re=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class xe{constructor(){this.name="conceptsArray"}static AddConcept(e){e.id>0&&(we.addConceptToTree(e),Ce.addConceptToTree(e),Ee.addConceptToTree(e),this.localconceptsArray.push(e))}static AddConceptToMemory(e){e.id>0&&(we.addConceptToTree(e),Ce.addConceptToTree(e),Ee.addConceptToTree(e))}static GetConcept(e){return Re(this,void 0,void 0,(function*(){var t=Se(),n=yield we.getNodeFromTree(e);if(null==n?void 0:n.value){var r=n.value;r&&(t=r)}return t}))}static GetConceptByCharacter(e){return Re(this,void 0,void 0,(function*(){var t=Se(),n=Ce.getNodeFromTree(e);return n&&(t=n.value),t}))}static GetConceptByCharacterAndTypeLocal(e,t){return Re(this,void 0,void 0,(function*(){var n=Se(),r=yield Ce.getCharacterAndTypeFromTree(e,t);return r&&(n=r.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 Re(this,void 0,void 0,(function*(){let n=[];return n=yield Ee.getTypeVariantsFromTreeWithUserId(e,t),n}))}getName(){return this.name}}xe.localconceptsArray=[];var ke=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class be{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 ke(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isLocalConnectionLoaded)return e("done");setTimeout(be.checkFlag,1e3,e)}static GetConnectionsOfCompositionLocal(e){return ke(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}}be.connectionArray=[],be.connectionDictionary=[];var Le=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Oe(e){return Le(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield be.GetConnectionsOfCompositionLocal(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield xe.GetConcept(e),a=yield _e(e,r,i);return o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=a,o}))}function Pe(e){return Le(this,void 0,void 0,(function*(){var t,n,r,o={};r=yield be.GetConnectionsOfCompositionLocal(e);for(var i=[],c=0;c<r.length;c++)i.includes(r[c].ofTheConceptId)||i.push(r[c].ofTheConceptId);var s=yield xe.GetConcept(e);if(0!=s.id){var a=yield _e(e,r,i);o[null!==(n=null===(t=null==s?void 0:s.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"top"]=a;var l={}}return l.data=o,l.id=e,l}))}function _e(e,t,n){return Le(this,arguments,void 0,(function*(e,t,n,r=[]){var o,i,c,s={},a=[],l=yield xe.GetConcept(e);if(0!=l.id&&null==l.type){var u=l.typeId,h=yield xe.GetConcept(u);l.type=h}if(null===(o=null==l?void 0:l.type)||void 0===o?void 0:o.characterValue,!n.includes(e))return null==l?void 0:l.characterValue;if(r.includes(e))return"";r.push(e);for(var d=0;d<t.length;d++)if(t[d].ofTheConceptId==e){var f=t[d].toTheConceptId,p=yield xe.GetConcept(f);0!=p.id&&null==(null==p?void 0:p.type)&&(u=p.typeId,h=yield xe.GetConcept(u),p.type=h);var y=(null!==(c=null===(i=null==p?void 0:p.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"top").replace("the_","");if(isNaN(Number(y))){if(y){const e=yield _e(f,t,n);s[y]=e}}else{const e=yield _e(f,t,n);a[y]=e,s=a}}return s}))}var $e=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Ge(e){return $e(this,void 0,void 0,(function*(){return yield xe.GetConceptByCharacter(e)}))}var Fe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Ue(e,t){return Fe(this,void 0,void 0,(function*(){var n=yield Ge(e),r=[];if(n)for(var o=yield xe.GetConceptsByTypeIdAndUser(n.id,t),i=0;i<o.length;i++){var c=yield Oe(o[i].id);r.push(c)}return r}))}function Be(e,t){return Fe(this,void 0,void 0,(function*(){var n=yield Ge(e),r=[];if(n)for(var o=yield xe.GetConceptsByTypeIdAndUser(n.id,t),i=0;i<o.length;i++){var c=yield Pe(o[i].id);r.push(c)}return r}))}var De=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class Ve{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 De(this,void 0,void 0,(function*(){try{for(let e=0;e<this.conceptsSyncArray.length;e++)N.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=[],function(e){var t,n,r,o;t=this,n=void 0,o=function*(){let t=y();try{var n=R();const r=yield fetch(C.CreateTheConceptUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(!r.ok)throw b(r),new Error(`Error! status: ${r.status}`);return t=yield r.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}},new((r=void 0)||(r=Promise))((function(e,i){function c(e){try{a(o.next(e))}catch(e){i(e)}}function s(e){try{a(o.throw(e))}catch(e){i(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(c,s)}a((o=o.apply(t,n||[])).next())}))}(e)}if(this.connectionSyncArray.length>0){let e=this.connectionSyncArray.slice();this.connectionSyncArray=[],yield function(e){return t=this,n=void 0,o=function*(){let t=new P(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);try{var n=R(),r=JSON.stringify(e);const o=yield fetch(C.CreateTheConnectionUrl(),{method:"POST",headers:n,body:r});return o.ok?yield o.json():(console.log("Create the connection error message: ",o),b(o)),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((r=void 0)||(r=Promise))((function(e,i){function c(e){try{a(o.next(e))}catch(e){i(e)}}function s(e){try{a(o.throw(e))}catch(e){i(e)}}function a(t){var n;t.done?e(t.value):(n=t.value,n instanceof r?n:new r((function(e){e(n)}))).then(c,s)}a((o=o.apply(t,n||[])).next())}));var t,n,r,o}(e)}return"done"}catch(e){throw e}}))}static syncDataLocalDb(){return De(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 je(e,t,n,r,o,i,c){var s=new P(0,e,n,t,r,t,o,t,1,t,0,t,4,t,i,c);return e==n?(s.ofTheConceptId=0,s.toTheConceptId=1,s):(s.isTemp=!0,s.id=Math.floor(1e8*Math.random()),Ve.AddConnection(s),s)}Ve.conceptsSyncArray=[],Ve.connectionSyncArray=[];var Me=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},He=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const We=new Map;function Ke(e,t){return He(this,void 0,void 0,(function*(){let n=yield N.GetConceptByCharacterAndTypeLocal(e,t),r=e+t;if(We.has(r))return We.get(r)||n;const o=(()=>He(this,void 0,void 0,(function*(){try{if(null==n||0==n.id){var o={character_value:`${e}`,type_id:t},i=JSON.stringify(o),c=R();const r=yield fetch(C.GetConceptByCharacterAndTypeUrl(),{method:"POST",headers:c,body:i});if(r.ok){let e=yield r.json();n=e,N.AddConcept(n)}else console.log("This is the concept by type and character error",r.status),b(r)}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}finally{We.delete(r)}})))();return We.set(r,o),o}))}class Xe{constructor(e,t,n,r,o,i,c,s,a,l){this.id=0,this.userId=e,this.data=t,this.securityId=n,this.securityUserId=r,this.accessId=o,this.accessUserId=i,this.sessionId=c,this.sessionUserId=s,this.entryTimestamp=a,this.isNew=l}}var Je=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};let qe=!1,ze=[];const Ye=()=>{ze.length>0&&!qe&&ze.shift()()};var Qe=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};let Ze=!1,et=[];const tt=()=>{et.length>0&&!Ze&&et.shift()()};var nt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class rt{static getId(){return nt(this,void 0,void 0,(function*(){this.ids.length<10&&(yield function(){return Qe(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{console.log("trying to fetch more concepts"),et.push((()=>Qe(this,void 0,void 0,(function*(){try{if(Ze)return;if(Ze=!0,rt.ids.length>10)return console.log("Enough IDs available, skipping fetch."),Ze=!1,tt(),e();var n=R("application/x-www-form-urlencoded");const t=yield fetch(C.GetReservedIdUrl(),{method:"GET",headers:n});if(!t.ok)throw b(t),new Error(`Error! status: ${t.status}`);const o=yield t.json();for(var r=0;r<o.length;r++)rt.AddId(o[r]);console.log("Ids Fetch Success"),e()}catch(e){e instanceof Error?console.log("get reserved ids error message: ",e.message,C.GetReservedConnectionIdUrl()):console.log("get reserved ids unexpected error: ",e),t(e)}finally{Ze=!1,tt()}})))),tt()}))}))}());var e=this.ids[0];return this.ids.shift(),e}))}static AddId(e){this.ids.includes(e)||this.ids.push(e)}}rt.ids=[];class ot{static getId(){return nt(this,void 0,void 0,(function*(){this.connectionIds.length<10&&(yield function(){return Je(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{ze.push((()=>Je(this,void 0,void 0,(function*(){try{if(qe)return;if(qe=!0,ot.connectionIds.length>10)return qe=!1,Ye(),e();var n=R("application/x-www-form-urlencoded");const t=yield fetch(C.GetReservedConnectionIdUrl(),{method:"GET",headers:n});if(!t.ok)throw b(t),new Error(`Error! status: ${t.status}`);const o=yield t.json();for(var r=0;r<o.length;r++)ot.AddId(o[r]);e()}catch(e){e instanceof Error?console.log("get reserved connection ids error message: ",e.message):console.log("get reserved connection ids unexpected error: ",e),t(e)}finally{qe=!1,Ye()}})))),Ye()}))}))}());var e=this.connectionIds[0];return this.connectionIds.shift(),e}))}static AddId(e){this.connectionIds.includes(e)||this.connectionIds.push(e)}}ot.connectionIds=[];var it=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function ct(e,t,n,r,o,i,c,s,a,l,u,h,d,f){return it(this,void 0,void 0,(function*(){var y=yield rt.getId();let v=new Date,g=new Date;var m=new p(y,t,o,i,n,r,c,s,e,a,l,u,h,d,f,!0,v,g);return m.isTemp=!1,Ve.AddConcept(m),m}))}function st(e,t,n,r,o,i,c,s,a,l,u,h,d,f){return it(this,void 0,void 0,(function*(){var y=yield rt.getId();let v=new Date,g=new Date;var m=new p(y,t,o,i,n,r,c,s,e,a,l,u,h,d,f,!1,v,g);return N.AddConcept(m),m.updateRecursion=!0,Ve.AddConcept(m),m}))}var at=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function lt(e,t){return at(this,arguments,void 0,(function*(e,t,n=!1,r,o,i=999,c=0){let s,a=i,l=999,u=r,h=r,d=o,f=r,p="",v=t.length,g=y();p=e.startsWith("the_")?e:"the_"+e;(new Date).getTime();if(n)g=yield sn(e),s=yield ct(t,r,4,r,g.id,g.userId,c,999,l,u,d,f,a,h),(new Date).getTime();else if(v>255)g=yield sn(p),s=yield ct(t,r,4,r,g.id,g.userId,c,999,l,u,d,f,a,h),function(e){Me(this,void 0,void 0,(function*(){try{var t=R();const n=yield fetch(C.CreateTheTextDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!n.ok)throw b(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 Xe(r,t,l,u,d,f,a,h,Date.now().toString(),!0)),(new Date).getTime();else{g=yield sn(p);let e=yield Ke(t,g.id);s=e,0==e.id&&0==e.userId&&(s=yield st(t,r,4,r,g.id,g.userId,12,12,l,u,d,f,a,h)),(new Date).getTime()}return s.type=g,s}))}var ut=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function ht(e){return ut(this,arguments,void 0,(function*(e,t=null,n=null,r=null,o=null,i=null,c=null){var s=null!=o?o:999,a=null!=i?i:4,l=null!=c?c:999,u=null!=r?r:0,h=y();for(const r in e)if("string"!=typeof e[r]&&"number"!=typeof e[r])if(null==t&&null==n){var d=u;h=v=yield lt(r,"",!0,s,a,l),d=v.id,u=v.id,yield ht(e[r],v.id,v.userId,d,o,i,c)}else{var f=null!=t?t:999,p=null!=n?n:999;d=u,h=v=yield lt(r,"",!0,s,a,l),yield je(f,p,v.id,v.userId,d,l,v.userId),yield ht(e[r],v.id,v.userId,d,o,i,c)}else{f=null!=t?t:999,p=null!=n?n:10267,d=u;var v=yield lt(r,String(e[r]),!1,s,a,l);yield je(f,p,v.id,v.userId,d,l,v.userId)}return h}))}class dt{constructor(e=0,t,n,r,o,i,c=999){this.isTemp=!1,this.applicationId=999,this.type=Se(),this.id=e,this.ofTheConceptId=t,this.toTheConceptId=n,this.typeId=r,this.ghostId=e,this.orderId=o,this.typeCharacter="",this.accessId=i,this.entryTimeStamp=new Date,this.terminationDateTime=new Date,this.localSyncTime=new Date,this.applicationId=c}}function ft(e,t,n,r=1){Math.floor(1e8*Math.random());let o=0,i=0,c=0;o=e,i=t,c=n;let s=new dt(0,0,0,0,0,0);return e!=t&&(s=new dt(0,e,t,n,r,4),s.isTemp=!0,s.id=Math.floor(1e8*Math.random()),be.AddConnection(s)),s}var pt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function yt(e,t,n,r,o,i){return pt(this,arguments,void 0,(function*(e,t,n,r,o,i,c=0){var s=Math.floor(1e8*Math.random());let a=new Date,l=new Date;var u=new Ae(s,n,o,r,i,e,t,!0,a,l,c);return u.isTemp=!0,xe.AddConcept(u),u}))}var vt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},gt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function mt(e,t,n,r){return gt(this,void 0,void 0,(function*(){var o=yield Ge(e);if(o&&(0==o.id||0==o.userId)){var i=T(e);if(i[0]==e){var c=yield function(e,t,n){return vt(this,void 0,void 0,(function*(){var t=yield xe.GetConceptByCharacterAndTypeLocal(e,51),r=t;return 0==r.id&&(r=t=yield yt(e,"the",n,4,51,4)),r}))}(e,0,r);o=c}else{var s=yield mt(i[0],t,n,r),a=yield mt(i[1],t,n,r);a&&(o=c=yield yt(e,i[1],r,s.id,a.id,4))}}return o}))}var Nt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function wt(e,t){return Nt(this,arguments,void 0,(function*(e,t,n=!1,r,o,i=999,c=0){var s,a,l,u=r=n?r:999,h=t.length;if(l=e.startsWith("the_")?e:"the_"+e,n)s=yield mt(e,999,r,r),a=yield yt(t,e,r,4,s.id,4,c);else if(h>255)s=yield mt(l,999,u,r),a=yield yt(t,l,r,4,s.id,4);else{s=yield mt(l,999,u,r);var d=yield xe.GetConceptByCharacterAndTypeLocal(t,s.id);a=d,0==d.id&&0==d.userId&&(a=yield yt(t,l,r,4,s.id,4))}return a.type=s,a}))}var Tt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Ct(e){return Tt(this,arguments,void 0,(function*(e,t=null,n=null,r=null,o=null,i=null,c=null){var s=null!=o?o:999,a=null!=i?i:999,l=null!=c?c:4,u=null!=r?r:0,h=Se();for(const r in e)if("string"!=typeof e[r]&&"number"!=typeof e[r])if(null==t&&null==n){var d=u;h=p=yield wt(r,"",!0,s,a,l),d=p.id,u=p.id,yield Ct(e[r],p.id,p.userId,d,o,i,c)}else{var f=null!=t?t:999,p=(d=u,yield wt(r,"",!0,s,a,l));yield ft(f,p.id,d),yield Ct(e[r],p.id,p.userId,d,o,i,c)}else f=null!=t?t:999,d=u,p=yield wt(r,String(e[r]),!1,s,a,l),yield ft(f,p.id,d);return h}))}var It=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Et(e,t,n){return It(this,arguments,void 0,(function*(e,t,n,r=10,o=1){let i=[];try{var c=new URLSearchParams;c.append("typeId",`${e}`),c.append("ofTheConceptId",`${t}`),c.append("userId",`${n}`),c.append("inpage",`${r}`),c.append("page",`${o}`);var s=R("application/x-www-form-urlencoded");const a=yield fetch(C.GetAllConnectionsOfConceptUrl(),{method:"POST",headers:s,body:c});return a.ok?i=yield a.json():(console.log("Get connection of concept error",a.status),b(a)),i}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 At=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function St(e,t,n,r,o,i,c){return At(this,arguments,void 0,(function*(e,t,n,r,o,i,c,s=1,a=4,l=999){let u=t,h=t,d=t;999!=l&&(d=l);let f=t,p=t,y=yield ot.getId(),v=new P(y,e,n,t,r,d,o,h,s,u,0,f,a,p,i,c);return e==n?(v.ofTheConceptId=0,v.toTheConceptId=1,v):(v.toUpdate=!0,v.isTemp=!1,Ve.AddConnection(v),v)}))}var Rt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},xt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},kt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function bt(e){return kt(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 xt(this,void 0,void 0,(function*(){var t=yield D.GetConnection(e);try{if(0!=t.id)return t;{var n=R("application/x-www-form-urlencoded");const r=yield fetch(C.GetConnectionUrl(),{method:"POST",headers:n,body:`id=${e}`});return r.ok?(t=yield r.json(),D.AddConnection(t)):(console.log("Get Connection Error",r.status),b(r)),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 Lt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Ot(e){return Lt(this,arguments,void 0,(function*(e,t=""){let n=!1;var r=yield bt(e);return n=yield function(e){return Rt(this,arguments,void 0,(function*(e,t=""){let n=!1;try{const r=new FormData;let o=R("application/x-www-form-urlencoded");""!=t&&(o=x("application/x-www-form-urlencoded",t)),r.append("id",e.toString());const i=yield fetch(C.DeleteTheConnectionUrl(),{method:"POST",body:r,redirect:"follow"});if(i.ok){const e=yield i.json();console.log("This is the result",e),n=e.success}else console.log("Delete connection error status: ",i.status),b(i)}catch(e){throw e instanceof Error?console.log("Delete connection error message: ",e.message):console.log("Delete connection unexpected error: ",e),e}return n}))}(e,t),G.removeNodeFromTree(e),U.removeTypeConcept(r.typeId,e),n}))}var Pt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function _t(e){return Pt(this,arguments,void 0,(function*(e,t=999){var n=y();if(e<0)return Lr(yield Cr(t,e));if(null!=(n=yield N.GetConcept(e))&&0!=n.id||null==e||null==e||(n=yield Q(e)),0!=n.id&&null==n.type&&null==(yield N.GetConcept(n.typeId))&&null!=n.typeId&&null!=n.typeId){var r=yield Q(n.typeId);n.type=r}return n}))}var $t=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Gt(e,t,n){return $t(this,arguments,void 0,(function*(e,t,n,r=!1,o=!1){var i,c,s=e.userId,a=s,l=s;if(r){let r=n+"_by",c=(null===(i=t.type)||void 0===i?void 0:i.characterValue)+"_s_"+r;o&&(yield Ft(r,t,s));var u=yield lt("connection",c,!1,999,999,999);let h=new P(0,t.id,e.id,t.userId,e.userId,t.userId,u.id,u.userId,1e3,s,999,a,4,l,999,999);Ve.AddConnection(h)}let h=n+"_s",d=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+h;o&&(yield Ft(h,e,s));var f=yield lt("connection",d,!1,999,999,999);let p=new P(0,e.id,t.id,e.userId,t.userId,e.userId,f.id,f.userId,1e3,s,999,a,4,l,999,999);return Ve.AddConnection(p),p}))}function Ft(e,t){return $t(this,arguments,void 0,(function*(e,t,n=null){for(var r,o=t,i=null!=n?n:t.userId,c=i,s=i,a=999,l=e+"_count",u=(null===(r=t.type)||void 0===r?void 0:r.characterValue)+"_s_"+l,h=yield lt("connection",u,!1,i,4,a),d=yield Et(h.id,t.id,i,10,1),f=[],p=y(),v=0;v<d.length;v++){let e=yield _t(d[v].toTheConceptId);f.push(e)}if(f.length<1)p=yield lt("count","1",!1,i,4,a);else{var g=f[0];let e=0;try{e=Number(g.characterValue)}catch(t){e=0}e+=1,p=yield lt("count",e.toString(),!1,i,4,a);for(let e=0;e<d.length;e++)Ot(d[e].id)}let m=new P(0,o.id,p.id,o.userId,p.userId,o.userId,h.id,h.userId,1e3,i,999,c,4,s,a,999);yield Ve.AddConnection(m)}))}function Ut(e,t,n){return $t(this,arguments,void 0,(function*(e,t,n,r=!1,o=!1){var i,c,s=e.userId,a=s,l=s;if(r){let r=n+"_by",c=(null===(i=t.type)||void 0===i?void 0:i.characterValue)+"_s_"+r;o&&(yield Ft(r,t,s));var u=yield lt("connection",c,!1,999,999,999);let h=new P(0,t.id,e.id,t.userId,e.userId,t.userId,u.id,u.userId,1e3,s,999,a,4,l,999,999);Ve.AddConnection(h)}let h=n+"_s",d=(null===(c=e.type)||void 0===c?void 0:c.characterValue)+"_s_"+h;o&&(yield Ft(h,e,s));var f=yield lt("connection",d,!1,999,999,999);return yield St(e.id,e.userId,t.id,t.userId,f.id,999,999,1e3,4)}))}var Bt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Dt(e,t){return Bt(this,arguments,void 0,(function*(e,t,n=10,r=1){var o,i=[],c=yield _t(e),s=(null===(o=c.type)||void 0===o?void 0:o.characterValue)+"_s_"+t,a=yield Ke(s,16);if(a.id>0){for(var l=yield Et(a.id,c.id,c.userId,n,r),u=[],h=0;h<l.length;h++)u.push(l[h].toTheConceptId);for(yield q(u),h=0;h<l.length;h++){let e=l[h].toTheConceptId,t=yield _t(e),n=yield se(t.id);i.push(n)}}return i}))}function Vt(e,t){return Bt(this,arguments,void 0,(function*(e,t,n=10,r=1){var o,i=[],c=yield _t(e),s=(null===(o=c.type)||void 0===o?void 0:o.characterValue)+"_s_"+t,a=yield Ke(s,16);if(a.id>0){for(var l=yield Et(a.id,c.id,c.userId,n,r),u=[],h=0;h<l.length;h++)u.push(l[h].toTheConceptId);for(h=0;h<l.length;h++){let e=l[h].toTheConceptId,t=yield _t(e);i.push(t)}}return i}))}class jt{constructor(e,t,n,r,o,i,c,s,a,l){this.id=0,this.isNew=!1,this.userId=e,this.data=`${t}`,this.securityId=n,this.securityUserId=r,this.accessId=o,this.accessUserId=i,this.sessionId=c,this.sessionUserId=s,this.isNew=l}}class Mt{constructor(){this.name="character Repository"}static AddCharacter(e){this.characterData[e.id]=e}static GetCharacter(e){for(var t=new jt(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}}Mt.characterData=[];class Ht{constructor(e,t,n,r){this.id=e,this.userId=t,this.referentId=n,this.isNew=r}}var Wt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Kt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Xt(e,t,n,r,o){return Kt(this,void 0,void 0,(function*(){return new jt(t,e,n,t,r,t,o,t,"",!1),yield function(){return Wt(this,void 0,void 0,(function*(){var e;try{if(0==(e=Mt.GetCharacter(e.data)).id){var t=R();const r=yield fetch(C.CreateTheCharacterDataUrl(),{method:"POST",headers:t,body:JSON.stringify(e)});if(!r.ok)throw b(r),new Error(`Error! status: ${r.status}`);const o=yield r.json();var n=new jt(o.userId,e.data,0,0,4,4,999,999,"",!1);return n.id=o.id,Mt.AddCharacter(n),o}return new Ht(e.id,e.userId,0,!1)}catch(e){throw e instanceof Error?console.log("create the character error message: ",e.message):console.log("create the character unexpected error: ",e),e}}))}()}))}var Jt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function qt(e,t,n,r,o,i,c,s,a,l,u,h,d,f){return Jt(this,void 0,void 0,(function*(){var p=yield Ke(e,o),y=p;return 0==y.id&&(y=p=yield ct(e,t,n,r,o,i,c,s,a,l,u,h,d,f)),y}))}var zt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Yt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Qt(e,t,n,r){return Yt(this,void 0,void 0,(function*(){var o=yield pe(e);if(o&&(0==o.id||0==o.userId)){var i=T(e);if(i.length>0)if(console.log(i),i[0]==e){var c=yield function(e,t,n,r,o,i){return zt(this,void 0,void 0,(function*(){var o,c=t,s=t;o=t;var a,l=t,u=t,h=t;if(1==e.length){var d=e.charCodeAt(0);yield Xt(e,t,n,r,i),a=qt(e,t,4,c,d,h,49,l,n,s,r,o,i,u)}else{var f=yield Xt(e,t,n,r,i);f.isNew,a=yield qt(e,t,4,c,51,l,f.id,f.userId,n,s,r,o,i,u)}return a}))}(e,r,999,999,0,t);o=c}else{var s=yield Qt(i[0],t,n,r),a=yield Qt(i[1],t,n,r);a&&(o=yield st(e,r,s.id,r,a.id,r,999,r,999,r,999,r,t,r))}}return o}))}var Zt=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const en=new Map;function tn(e,t){return Zt(this,void 0,void 0,(function*(){let n=y();if(en.has(e+t))return en.get(e+t)||n;const r=(()=>Zt(this,void 0,void 0,(function*(){try{var r=R("application/x-www-form-urlencoded");const o=yield fetch(C.GetConceptByCharacterAndCategoryDirectUrl(),{method:"POST",headers:r,body:`character_value=${e}&category_id=${t}`});if(o.ok){let e=yield o.json();n=e,N.AddConcept(n)}else console.log("This is the concept by category and character direct api error",o.status),b(o);return n}catch(n){throw n instanceof Error?console.log(" This is the concept by category and character direct api error message: ",n.message,e,t,C.GetConceptByCharacterAndCategoryDirectUrl()):console.log(" This is the concept by category and character unexpected direct api error: ",n,e,t,C.GetConceptByCharacterAndCategoryDirectUrl()),n}finally{en.delete(e+t)}})))();return en.set(e+t,r),r}))}var nn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function rn(e){return nn(this,void 0,void 0,(function*(){let t=y();if("the"==e)return t.id=1,t.typeId=5,t.characterValue="the",t;let n=e.length;var r=T(e);if(r.length>1){let n=1,o=yield rn(r[0]);0!=o.id&&(n=o.id),t=yield function(e,t){return nn(this,void 0,void 0,(function*(){let n=yield N.GetConceptByCharacterAndCategoryLocal(e,t);return 0==n.id&&(n=yield tn(e,t)),n}))}(e,n)}else r[0]==e&&1==n?t=yield function(e){return nn(this,void 0,void 0,(function*(){console.log("inside the character length function",e);var t=yield N.GetConceptByCharacterAndTypeLocal(e,49);return console.log("inside the character length function after",t),0==t.id&&(t=yield de(e)),t}))}(e):r[0]==e&&(t=yield function(e){return nn(this,void 0,void 0,(function*(){var t=yield N.GetConceptByCharacterAndTypeLocal(e,51);return 0==t.id&&(t=yield de(e)),t}))}(e));return t}))}var on=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const cn=new Map;function sn(e,t){return on(this,void 0,void 0,(function*(){let t=y();if(cn.has(e))return cn.get(e)||t;const n=(()=>on(this,void 0,void 0,(function*(){try{if(t=yield rn(e),0==t.id||4==t.typeId){var n=R("application/x-www-form-urlencoded");const r=yield fetch(C.MakeTheTypeConceptUrl(),{method:"POST",headers:n,body:`type=${e}`});if(!r.ok)throw b(r),new Error(`Error! status: ${r.status}`);let o=yield r.json();t=o,t.id>0&&N.AddConcept(t)}return t}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}finally{cn.delete(e)}})))();return cn.set(e,n),n}))}var an=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},ln=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},un=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function hn(e){return un(this,void 0,void 0,(function*(){for(var t=yield function(e){return an(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=R("application/x-www-form-urlencoded");const i=yield fetch(C.GetAllLinkerConnectionOfConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(i.ok){const e=yield i.json();for(var r=0;r<e.length;r++){var o=e[r];t.push(o)}}else console.log("Get all linker connection from the concepts error","cannot get respone"),b(i);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 r=e.typeId;let o=yield _t(r);e.type=o}return t}))}function dn(e){return un(this,void 0,void 0,(function*(){for(var t=yield function(e){return ln(this,void 0,void 0,(function*(){var t=[];try{(new Date).getTime();var n=R("application/x-www-form-urlencoded");const i=yield fetch(C.GetAllLinkerConnectionToConceptUrl()+`?conceptId=${e}`,{method:"GET",headers:n});if(i.ok){const e=yield i.json();for(var r=0;r<e.length;r++){var o=e[r];t.push(o)}}else console.log("Get all linker connection To the concepts error","cannot get respone"),b(i);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 r=e.typeId;let o=yield _t(r);e.type=o}return t}))}var fn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},pn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function yn(e){return pn(this,arguments,void 0,(function*(e,t=""){var n=yield _t(e);yield f.removeNodeFromTree(e);var r=n.typeId,o=n.characterValue;yield g.removeTypeConcept(r,e),yield h.removeNodeByCharacter(o,e),function(e){fn(this,arguments,void 0,(function*(e,t=""){let n=!1;try{let r=R("application/x-www-form-urlencoded");""!=t&&(r=x("application/x-www-form-urlencoded",t));const o=new FormData;o.append("id",e.toString());const i=yield fetch(C.DeleteConceptUrl(),{method:"POST",body:o});if(!i.ok)throw b(i),new Error(`Error! status: ${i.status}`);n=(yield i.json()).success}catch(e){throw e instanceof Error?console.log("Delete concept error message: ",e.message):console.log("Delete concept unexpected error: ",e),e}return n}))}(e,t)}))}var vn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function gn(e,t){return vn(this,void 0,void 0,(function*(){try{const n=new Headers;n.append("Authorization","Bearer "+t);const r=new FormData;r.append("id",e.toString());const o=yield fetch(C.DeleteConceptUrl(),{method:"POST",body:r,headers:n});if(!o.ok)throw b(o),new Error(`Delete composition Error! status: ${o.status}`)}catch(e){throw e instanceof Error?console.log("Delete composition error message: ",e.message):console.log("Delete composition unexpected error: ",e),e}}))}var mn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Nn(e,t,n,r){return mn(this,arguments,void 0,(function*(e,t,n,r,o=999){var i,c=n,s=n,a=n,l=e.startsWith("the_"),u=y();return i=l?e:"the_"+e,u=yield sn(i),yield qt(t,n,4,n,u.id,u.userId,0,999,999,c,4,a,999,s)}))}class wn{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 Tn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Cn(){return Tn(this,arguments,void 0,(function*(e=[]){var t=[];try{var n=[];for(let r=0;r<e.length;r++){let o=yield D.GetConnection(e[r]);0==o.id?n.push(e[r]):t.push(o)}if(0==n.length)return t;{var r=R();const e=yield fetch(C.GetConnectionBulkUrl(),{method:"POST",headers:r,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 r=n[e];t.push(r),D.AddConnection(r)}yield H(t)}}else console.log("Get Connection Bulk error",e.status),b(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 In=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function En(){return In(this,arguments,void 0,(function*(e=[]){yield q(e);var t=[];for(let r=0;r<e.length;r++){var n=yield ie(e[r]);t.push(n)}return t}))}function An(){return In(this,arguments,void 0,(function*(e=[]){yield q(e);var t=[];for(let r=0;r<e.length;r++){var n=yield ce(e[r]);t.push(n)}return t}))}function Sn(){return In(this,arguments,void 0,(function*(e=[],t=[]){yield Cn(t),function(e=[],t=[]){for(let n=0;n<t.length;n++)e.includes(t[n].id)||D.RemoveConnection(t[n])}(t,yield K(e));var n=[];for(let t=0;t<e.length;t++){var r=yield ce(e[t]);n.push(r)}return n}))}function Rn(){return In(this,arguments,void 0,(function*(e=[]){let t=[],n=[],r={};for(let r=0;r<(null==e?void 0:e.length);r++){let o=yield D.GetConnection(e[r]);0==o.id?t.push(e[r]):n.push(o)}for(let n=0;n<t.length;n++)r[e[n]]=!1;let o=[],i=yield Cn(t);n=[...n,...i];for(let e=0;e<n.length;e++)o.push(n[e].ofTheConceptId),o.push(n[e].toTheConceptId),o.push(n[e].typeId);return yield j(o),n}))}function xn(){return In(this,arguments,void 0,(function*(e=[],t=[]){let n=[];for(let e=0;e<t.length;e++)0==(yield D.GetConnection(t[e])).id&&n.push(t[e]);yield Cn(n);var r={};for(let t=0;t<e.length;t++){var o=yield ce(e[t]);r[e[t]]=o}return r}))}var kn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function bn(){return kn(this,arguments,void 0,(function*(e=0,t=[],n=""){var r=[];try{var o=new wn;o.composition=e,o.listLinkers=t,o.textSearch=n;var i=JSON.stringify(o),c=R();const l=yield fetch(C.RecursiveSearchUrl(),{method:"POST",headers:c,body:i});if(l.ok){const e=yield l.json();var s=e.compositionIds,a=e.internalConnections;e.externalConnections,r=yield Sn(s,a)}else console.log("recursive search error ",l.status),b(l);return r}catch(e){throw e instanceof Error?console.log("recursive search error message: ",e.message):console.log("recursive search unexpected error: ",e),e}}))}var Ln=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function On(e,t){return Ln(this,void 0,void 0,(function*(){try{var n={email:e,password:t},r=new Headers;r.append("Content-Type","application/json");var o=JSON.stringify(n);const i=yield fetch(C.LoginUrl(),{method:"POST",headers:r,body:o});if(i.ok){const e=yield i.json();return I.BearerAccessToken=e.data.token,e}console.log("Login tsccs error message: ",i.status),b(i)}catch(e){throw e instanceof Error?console.log("Login tsccs error message: ",e.message):console.log(" Login tsccs unexpected error: ",e),e}}))}var Pn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function _n(e){return Pn(this,void 0,void 0,(function*(){const t=yield function(){return Pn(this,arguments,void 0,(function*(e="",t={}){let n={message:"success",status:!1,statusCode:200,data:""};try{const r=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)}),o=yield r.json();return r.ok?n={message:"success",status:!0,statusCode:200,data:o}:b(r),n}catch(e){throw console.log("Signup Error: ",e),e}}))}(C.SignupUrl(),e);return t}))}var $n=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Gn(e){return $n(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 r=new Headers;r.append("Content-Type","application/json");const o=C.LoginUrl();try{const e=yield fetch(o,{method:"POST",headers:r,body:t,redirect:"follow"}),i=yield e.json();return e.ok?n={message:"success",status:!0,statusCode:200,data:null==i?void 0:i.data}:b(e),n}catch(e){throw console.log("Sign in api error",e),e}}))}function Fn(e,t){return-1===e.indexOf(t)&&e.push(t),e}function Un(e=[],t){var n,r;let o=[],i=null===(n=t.type)||void 0===n?void 0:n.characterValue;if((null==i?void 0:i.startsWith("the_"))||(i="the_"+i),Array.isArray(e))for(let n=0;n<e.length;n++){let c=null===(r=e[n].type)||void 0===r?void 0:r.characterValue;(null==c?void 0:c.startsWith("the_"))||(c="the_"+c),t.typeId!=e[n].typeId&&i!=c||o.push(e[n])}return o}function Bn(e=[],t){let n=[],r=t.typeCharacter;if((null==r?void 0:r.startsWith("the_"))||(r="the_"+r),Array.isArray(e))for(let o=0;o<e.length;o++){let i=e[o].typeCharacter;(null==i?void 0:i.startsWith("the_"))||(i="the_"+i),t.typeId!=e[o].typeId&&r!=i||n.push(e[o])}return n}function Dn(e=[],t){let n=[];if(Array.isArray(e)){const r=e.find((e=>e.toTheConceptId==t));r&&n.push(r);const o=e.find((e=>e.ofTheConceptId==t));o&&n.push(o)}return n}function Vn(e=[],t){let n=[];if(Array.isArray(e)){const r=e.find((e=>e.toTheConceptId==t));r&&n.push(r);const o=e.find((e=>e.ofTheConceptId==t));o&&n.push(o)}return n}function jn(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}function Mn(e=[],t){Array.isArray(e)&&e.splice(e.findIndex((function(e){return e.id===t.id})),1)}class Hn{constructor(e,t,n,r){this.expiryTime=new Date(Date.now()+6e5),this.height=1,this.key=e,this.value=t,this.leftNode=n,this.rightNode=r}isValid(){const e=new Date(Date.now());return!(this.expiryTime<e&&(Kn.removeNodeFromTree(this.key),1))}saveToCache(e){this.value.cached=e}addNode(e,t,n){if(null==t)return e;const r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,r,n);else{if(!(t.key<e.key))return this.isValid(),e;t.rightNode=this.addNode(e,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));const i=this.getBalanceFactor(t);if(i>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(i<-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 Wn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class Kn{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 Hn(e.id,e,null,null);this.addNodeToTree(t)}static getNodeFromTree(e){return Wn(this,void 0,void 0,(function*(){return this.root?this.root.getFromNode(e,this.root):null}))}static removeNodeFromTree(e){return Wn(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}}Kn.root=null;var Xn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Jn(e,t,n,r){return Xn(this,arguments,void 0,(function*(e,t,n,r,o=[]){var i,c;let s={};const a=[];if(0==e)return"";let l=qn(n,e);if(null!=l&&0!=l.id||null==e||null==e||(l=yield _t(e)),0!=l.id&&null==l.type){const e=l.typeId;let t=qn(n,e);l.type=t,null==t&&null!=e&&null!=e&&(t=yield _t(e),l.type=t)}if(!r.includes(e))return null==l?void 0:l.characterValue;if(o.includes(e))return"";o.push(e);for(let l=0;l<t.length;l++)if(t[l].ofTheConceptId==e){const u=t[l].toTheConceptId;if(r.includes(e)){let e=qn(n,u);if(null!=e&&0!=e.id||null==u||null==u||(e=yield _t(u)),0!=e.id&&null==(null==e?void 0:e.type)){const t=e.typeId;let n=yield N.GetConcept(t);e.type=n,null==n&&null!=t&&null!=t&&(n=yield _t(t),e.type=n)}const l="the_",h=(null!==(c=null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"").replace(l,"");if(isNaN(Number(h))){if(h){const e=yield Jn(u,t,n,r,o);s[h]=e}}else{const e=yield Jn(u,t,n,r,o);a[h]=e,s=a}}}return s}))}function qn(e,t){let n=y();for(let r=0;r<e.length;r++)if(t==e[r].id)return n=e[r],n;return n}class zn{constructor(){this.id=0,this.mainConcept=y(),this.connections=[],this.concepts=[],this.subcompositions=[],this.cached={}}updateCache(){return e=this,t=void 0,r=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 Jn(this.id,this.connections,this.concepts,this.subcompositions,[])},new((n=void 0)||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}));var e,t,n,r}UpdateAcrossDistributedSystem(){var e,t;try{0!=this.id&&(t=null===(e=this.id)||void 0===e?void 0:e.toString(),C.MQTT_CONNECTION&&C.MQTT_CONNECTION.publish("compositionUpdate",t))}catch(e){console.log("Error while publishing message",e)}}isUpdating(){this.UpdateAcrossDistributedSystem()}GetDataCache(){var e,t,n;const r={};r[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 o={};return o.data=r,o.id=this.id,o}}var Yn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Qn(e){return Yn(this,arguments,void 0,(function*(e,t=null,n=null,r=null,o=null,i=null,c=null,s=null){const a=null!=o?o:999,l=null!=i?i:4,u=null!=c?c:999;let h=null!=r?r:0,d=y();null==s&&(s=new zn);for(const r in e)if("object"==typeof e[r]||Array.isArray(e[r])){const f=yield lt(r,"",!0,a,l,u);if(null==t&&null==n){let t=h;d=f,t=f.id,h=f.id,s.concepts.push(f),s.id=f.id,yield Qn(e[r],f.id,f.userId,t,o,i,c,s)}else{const a=null!=t?t:999,l=null!=n?n:999,p=h;d=f,s.concepts.push(f);const y=yield je(a,l,f.id,f.userId,p,u,f.userId);s.connections.push(y),yield Qn(e[r],f.id,f.userId,p,o,i,c,s)}null!=e[r]&&null!=e[r]&&s.subcompositions.push(f.id)}else{const o=null!=t?t:999,i=null!=n?n:999,c=h,d=yield lt(r,e[r],!1,a,l,u);s.concepts.push(d);const f=yield je(o,i,d.id,d.userId,c,u,d.userId);s.connections.push(f)}return d}))}var Zn=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function er(e){return Zn(this,void 0,void 0,(function*(){const t=e.userId,n=e.sessionId,r=e.accessId;let o=[];const i=[];let c=y(),s=y();const a=[];let l=e.compositionId;const u=e.ofTheCompositionId;let h=[];if(l<0){let e=yield _t(l,t);if(!(e.id>0))return null;l=e.id}o=yield ee(l);const d=[],f=new zn,p=[];f.id=l,f.isUpdating();let v=[];for(let e=0;e<o.length;e++)Fn(p,o[e].ofTheConceptId),Fn(d,o[e].ofTheConceptId),Fn(d,o[e].toTheConceptId),v.push(o[e].ofTheConceptId);f.subcompositions=p,f.connections=o;for(let e=0;e<d.length;e++){const t=yield _t(d[e]);l==d[e]&&(c=t),u==d[e]&&(s=t),i.push(t)}const g=e.patchObject;for(const e in g){let o=y();const l=g[e];let u=c;if(s.id>0&&(u=s),Array.isArray(l)||"object"==typeof l){o=yield lt(e,"",!0,c.userId,4,999),f.subcompositions.push(o.id);const t=Un(i,o);for(let e=0;e<t.length;e++)if(t[e].id>0){const n=Dn(f.connections,t[e].id);h=h.concat(n),a.push(t[e])}yield Qn(g[e],o.id,o.userId,c.id,c.userId,4,999,f)}else{o=yield lt(e,l,!1,t,r,n);const c=Un(i,o);for(let e=0;e<c.length;e++)if(c[e].id>0){const t=Dn(f.connections,c[e].id);h=h.concat(t),a.push(c[e])}}const d=je(u.id,u.userId,o.id,o.userId,c.id,n,t);i.push(o),f.connections.push(d)}for(let e=0;e<h.length;e++)Mn(f.connections,h[e]),Ot(h[e].id);for(let e=0;e<a.length;e++)jn(i,a[e]);return f.concepts=f.concepts.concat(i),f.mainConcept=c,f.id=c.id,yield f.updateCache(),Kn.addCompositionToTree(f),Ve.SyncDataOnline(),f.GetDataCache()}))}var tr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function nr(e,t,n,r){return tr(this,arguments,void 0,(function*(e,t,n,r,o=10,i=1){var c=x("application/x-www-form-urlencoded",r),s=new URLSearchParams;s.append("type",e),s.append("search",t),s.append("composition",n),s.append("inpage",o.toString()),s.append("page",i.toString());const a=C.SearchCompositionsUrl()+"?"+s.toString();try{const e=yield fetch(a,{method:"GET",headers:c});return e.ok?yield e.json():(b(e),[])}catch(e){throw console.log("This is the searching error",e),e}}))}var rr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function or(e){return rr(this,arguments,void 0,(function*(e,t=""){var n=x("application/json",t);const r=C.SearchLinkMultipleAll(),o=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:n,body:o});return e.ok?yield e.json():(console.log("This is the searching error",e.status),b(e),[])}catch(e){throw console.log("This is the searching error",e),e}}))}var ir=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function cr(e){return ir(this,arguments,void 0,(function*(e,t=[]){var n,r;let o=[];const i=[];let c={},s={};const a=yield Kn.getNodeFromTree(e),l=[];let u=yield N.GetConcept(e);if(0==u.id&&null!=e&&null!=e&&(u=yield Q(e)),null==a){let a=[];a=t.length>0?sr(e,t):yield ee(e),o=a;for(let e=0;e<o.length;e++)l.includes(o[e].ofTheConceptId)||(l.push(o[e].ofTheConceptId),i.push(o[e].ofTheConceptId)),i.includes(o[e].toTheConceptId)||i.push(o[e].toTheConceptId);ur(u,o,i,l);let h=[];s=yield le(e,o,l,h),c[null!==(r=null===(n=null==u?void 0:u.type)||void 0===n?void 0:n.characterValue)&&void 0!==r?r:""]=s}else s=a.value.GetDataCache(),c=s;return 0==u.id?"":c}))}function sr(e,t){const n=[];for(let r=0;r<t.length;r++)t[r].typeId==e&&n.push(t[r]);return n}function ar(e){return ir(this,arguments,void 0,(function*(e,t=[]){var n,r;let o={},i=[];const c=[];let s;const a={},l=yield Kn.getNodeFromTree(e),u=[];let h=yield N.GetConcept(e);if(0==h.id&&null!=e&&null!=e&&(h=yield Q(e)),null==l){let l=[];l=t.length>0?sr(e,t):yield ee(e),i=l;for(let e=0;e<i.length;e++)u.includes(i[e].ofTheConceptId)||(u.push(i[e].ofTheConceptId),c.push(i[e].ofTheConceptId)),c.includes(i[e].toTheConceptId)||c.push(i[e].toTheConceptId);ur(h,i,c,u),s=yield le(e,i,u),a[null!==(r=null===(n=null==h?void 0:h.type)||void 0===n?void 0:n.characterValue)&&void 0!==r?r:""]=s,o.created_at=h.entryTimeStamp,o.data=a,o.id=e}else s=l.value.GetDataCache(),o=s;return 0==h.id?"":o}))}function lr(e,t){return ir(this,void 0,void 0,(function*(){let n=[];const r=[];n=yield Cn(t);for(let t=0;t<e.length;t++){const o=yield ar(e[t],n);o&&r.push(o)}return r}))}function ur(e,t,n,r){return ir(this,void 0,void 0,(function*(){const o=new zn,i=yield function(e){return ir(this,void 0,void 0,(function*(){let t=[];const n=[];for(let r=0;r<(null==e?void 0:e.length);r++){const o=yield N.GetConcept(e[r]);0==o.id?n.push(e[r]):t.push(o)}return 0==(null==n?void 0:n.length)||(t=yield function(e){return V(this,void 0,void 0,(function*(){const t=[];if(e.length>0){const n=R();try{const r=yield fetch(C.GetConceptBulkUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok){const e=yield r.json();if(e.length>0)for(let n=0;n<e.length;n++){const r=e[n];t.push(r),N.AddConcept(r)}}else b(r)}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);o.connections=t,o.concepts=i,o.id=e.id,o.subcompositions=r,o.mainConcept=e;const c=yield Jn(e.id,t,i,r,[]);o.cached=c,Kn.addCompositionToTree(o)}))}var hr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function dr(e){return hr(this,void 0,void 0,(function*(){try{var t=R();const n=JSON.stringify(e),r=yield fetch(C.CreateSessionId(),{method:"POST",headers:t,body:n});return r.ok?r.json():(console.log("Creating session failed",yield r.json()),b(r),null)}catch(e){throw console.log("Creating session failed",e),e}}))}var fr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function pr(e,t){return fr(this,void 0,void 0,(function*(){try{var n=R("application/x-www-form-urlencoded");const r=new URLSearchParams;r.append("sessionId",e.toString()),r.append("url",t);const o=yield fetch(C.CreateSessionVisitUrl(),{method:"POST",headers:n,body:r});return o.ok?o.json():(console.log("Creating session url failed",yield o.json()),b(o),null)}catch(e){throw console.log("Creating session url failed",e),e}}))}var yr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function vr(e,t){return yr(this,arguments,void 0,(function*(e,t,n=10,r=1){var o=[],i=yield _t(e),c=yield rn(t);if(c.id>0){for(var s=yield Et(c.id,i.id,i.userId,n,r),a=[],l=0;l<s.length;l++)a.push(s[l].toTheConceptId);for(yield q(a),l=0;l<s.length;l++){let e=s[l].toTheConceptId,t=yield _t(e),n=yield se(t.id);o.push(n)}}return o}))}function gr(e,t){return yr(this,arguments,void 0,(function*(e,t,n=10,r=1){var o=[],i=yield _t(e),c=yield rn(t);if(c.id>0){for(var s=yield Et(c.id,i.id,i.userId,n,r),a=[],l=0;l<s.length;l++)a.push(s[l].toTheConceptId);for(l=0;l<s.length;l++){let e=s[l].toTheConceptId,t=yield _t(e);o.push(t)}}return o}))}class mr{constructor(e,t,n,r,o){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=r,this.rightNode=o}addNode(e,t,n){if(null==t)return e;var r=t.leftNode,o=t.rightNode;if(t.key>e.key)t.leftNode=this.addNode(e,r,n);else{if(!(t.key<e.key))return t.value.push(...e.value),t.connectionValue.push(...e.connectionValue),t;t.rightNode=this.addNode(e,o,n)}t.height=1+Math.max(this.getHeight(t.leftNode),this.getHeight(t.rightNode));let i=this.getBalanceFactor(t);if(i>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(i<-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 Nr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class wr{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 Nr(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{this.checkFlag(e),setTimeout((()=>{t("not")}),25e3)}))}))}static checkFlag(e){if(a.isDataLoaded)return e("done");setTimeout(wr.checkFlag,1e3,e)}static addConceptToTree(e,t,n=999){let r=this.compositeKey(t,n,e.applicationId),o=new dt(0,0,0,0,0,0);var i=new mr(r,e,o,null,null);this.addNodeToTree(i)}static addConnectionToTree(e,t,n=999){let r=this.compositeKey(t,n,e.applicationId),o=Se();var i=new mr(r,o,e,null,null);this.addNodeToTree(i)}static getNodeFromTree(e,t){return Nr(this,arguments,void 0,(function*(e,t,n=999){let r=this.compositeKey(e,t,n);return this.root?this.root.getFromNode(r,this.root):null}))}static removeNodeFromTree(e){return Nr(this,arguments,void 0,(function*(e,t=999,n=999){if(this.root){let r=this.compositeKey(e,t,n);this.root=this.root.removeNode(this.root,r)}}))}static countNumberOfNodes(){return this.root?this.root.countNodeBelow(this.root):0}}wr.root=null;var Tr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Cr(e,t){return Tr(this,arguments,void 0,(function*(e,t,n=999,r=999){let o=yield wr.getNodeFromTree(e,n,r),i=Se();if(o)for(let e=0;e<o.value.length;e++){let n=o.value[e];n.ghostId==t&&(i=n)}return i}))}function Ir(e,t){return Tr(this,arguments,void 0,(function*(e,t,n=999,r=999){let o=yield wr.getNodeFromTree(e,n,r),i=new dt(0,0,0,0,0,0);if(o)for(let e=0;e<o.connectionValue.length;e++){let n=o.connectionValue[e];n.ghostId==t&&(i=n)}return i}))}function Er(e,t){return Tr(this,arguments,void 0,(function*(e,t,n=999){wr.addConceptToTree(e,t,n)}))}function Ar(e,t){return Tr(this,arguments,void 0,(function*(e,t,n=999){wr.addConnectionToTree(e,t,n)}))}var Sr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Rr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function xr(e){return Rr(this,arguments,void 0,(function*(e,t=""){let n=[],r=yield function(e){return Sr(this,arguments,void 0,(function*(e,t=""){var n=x("application/json",t);const r=C.SearchLinkMultipleAllApiUrl(),o=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:n,body:o});return e.ok?yield e.json():(console.log("This is the searching multiple error",e.status),b(e),[])}catch(e){throw console.log("This is the searching multiple error",e),e}}))}(e,t),o=e[0].composition;const i=r;let c=i.compositionIds,s=i.internalConnections,a=i.linkers,l=i.reverse;return n=yield xn(c,s),yield kr(a,n,o,l)}))}function kr(e,t,n){return Rr(this,arguments,void 0,(function*(e,t,n,r=[]){let o={},i=yield Cn(e);for(let e=0;e<i.length;e++){let n=!1;if(r.includes(i[e].id)&&(n=!0),1==n){if(t[i[e].ofTheConceptId]&&t[i[e].toTheConceptId]){let n=t[i[e].toTheConceptId],r=yield _t(i[e].typeId),o=null==n?void 0:n.data,c=Object.keys(o)[0];try{let n=r.characterValue+"_reverse";"string"==typeof o&&(o={}),Array.isArray(o[c][n])||("string"==typeof o[c]&&(o[c]={}),o[c][n]=[]),o[c][n].push(t[i[e].ofTheConceptId])}catch(e){console.log("this is error",e)}}}else if(t[i[e].ofTheConceptId]&&t[i[e].toTheConceptId]){let n=t[i[e].ofTheConceptId],r=yield _t(i[e].typeId),o=null==n?void 0:n.data,c=Object.keys(o)[0];try{"string"==typeof o&&(o={}),Array.isArray(o[c][r.characterValue])||("string"==typeof o[c]&&(o[c]={}),o[c][r.characterValue]=[]),o[c][r.characterValue].push(t[i[e].toTheConceptId])}catch(e){console.log("this is error",e)}}}return o=t[n],o}))}function br(e){var t,n;const r=Se();return r.id=e.id,r.ghostId=e.ghostId,r.userId=e.userId,r.accessId=e.accessId,r.categoryId=e.categoryId,r.characterValue=e.characterValue,r.entryTimeStamp=e.entryTimeStamp,r.typeId=e.typeId,r.type=e.type,r.isTemp=!1,r.typeCharacter=null!==(n=null===(t=null==e?void 0:e.type)||void 0===t?void 0:t.characterValue)&&void 0!==n?n:"",r}function Lr(e){const t=y();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 Or(e){const t=new dt(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 Pr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function _r(e){return Pr(this,void 0,void 0,(function*(){const t=e.userId,n=e.sessionId,r=e.accessId;let o=[];const i=[];let c=Se(),s=Se();const a=[],l=e.compositionId,u=e.ofTheCompositionId;let h=[],d=yield ee(l);for(let e=0;e<d.length;e++)o.push(Or(d[e]));const f=[],p=[];let y=[];for(let e=0;e<o.length;e++)Fn(p,o[e].ofTheConceptId),Fn(f,o[e].ofTheConceptId),Fn(f,o[e].toTheConceptId),y.push(o[e].ofTheConceptId);for(let e=0;e<f.length;e++){const t=yield _t(f[e]);l==f[e]&&(c=br(t)),u==f[e]&&(s=br(t)),i.push(br(t))}const v=e.patchObject;for(const e in v){let l=Se();const u=v[e];let d=c;s.id>0&&(d=s),Array.isArray(u)||"object"==typeof u?(l=yield wt(e,"",!0,c.userId,4,999),yield Ct(v[e],l.id,l.userId,c.id,c.userId,4,999)):l=yield wt(e,u,!1,t,r,n);const f=Bn(i,l);for(let e=0;e<f.length;e++)if(f[e].id>0){const t=Vn(o,f[e].id);h=h.concat(t),a.push(f[e])}yield ft(d.id,l.id,c.id,2),i.push(l)}for(let e=0;e<h.length;e++)Ot(h[e].id);Ve.SyncDataOnline()}))}var $r=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Gr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Fr(e){return Gr(this,void 0,void 0,(function*(){var t;let n=yield function(e){return $r(this,void 0,void 0,(function*(){let t=[];try{var n=R();const r=yield fetch(C.ViewInternalDataUrl(),{method:"POST",headers:n,body:JSON.stringify(e)});if(r.ok){let e=yield r.json(),n={};for(let r=0;r<e.length;r++){let o=e[r].concepts;t=e[r].connections;let i=e[r].id;j(o),n[i]=t}return n}return console.log("View Internal Data error",r.status),b(r),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),r=[];for(let o=0;o<e.length;o++){let i=e[o],c=n[i];if(i&&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 le(i,c,e);t.data=n,t.id=i,r.push(t)}else{let e={};e.id=i;let n=yield _t(i),o={};n.type&&(o[null===(t=null==n?void 0:n.type)||void 0===t?void 0:t.characterValue]=n.characterValue,e.data=o,r.push(e))}}return r}))}var Ur=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Br=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function Dr(e){return Br(this,arguments,void 0,(function*(e,t=""){var n=yield function(e){return Ur(this,arguments,void 0,(function*(e,t=""){var n=x("application/json",t);let r=C.SearchInternalWithAuthenticatedCcsUrl();r=r+"?composition="+e.composition+"&search="+e.search+"&internalComposition="+e.internalComposition+"&type="+e.type+"&inpage="+e.inpage+"&page="+e.page;try{const e=yield fetch(r,{method:"GET",headers:n});return e.ok?yield e.json():(console.log("This is the searching internal error",e.status),b(e),[])}catch(e){throw console.log("This is the searching internal error",e),e}}))}(e,t);return yield Fr(n)}))}class Vr{constructor(){this.compositionId=0,this.userId=999,this.sessionId=999,this.accessId=4,this.ofTheCompositionId=0,this.patchObject={}}}class jr{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 Mr{constructor(){this.type="",this.search="",this.logicoperator="=",this.index=0,this.composition=!0,this.name="",this.operateon=""}}class Hr{constructor(){this.type="",this.search="",this.composition="",this.internalComposition="",this.userId=999,this.inpage=10,this.page=1}}var Wr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};var Kr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Xr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};class Jr{}Jr.isUpdated=!1,Jr.isOnlineSync=!1;var qr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};var zr=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const Yr=1,Qr=2,Zr=3,eo=4,to=5,no=6,ro=7;class oo{constructor(){this.conceptId=0,this.connectionTypeId=0,this.connectionType="",this.count=0}}var io=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function co(e){return io(this,void 0,void 0,(function*(){let t={};for(let n=0;n<e.length;n++){let r=yield Q(e[n].connectionTypeId);e[n].connectionType=r.characterValue,t[e[n].conceptId]=e[n]}return t}))}function so(e){const t=e.split("_");if(3===t.length){let e=new oo;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 ao(e){return e.startsWith("the_")?e.slice(4):e}var lo=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},uo=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function ho(e,t,n){return uo(this,void 0,void 0,(function*(){var r,o,i,c,s,a,l,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let d=!1;n.includes(e[h].id)&&(d=!0);let f=yield _t(e[h].ofTheConceptId),p=yield _t(e[h].toTheConceptId);if(1==d){if(0!=f.id&&0!=p.id){let n,s=null!==(o=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==o?o:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield _t(e[h].typeId);try{let e=null!==(c=null===(i=null==f?void 0:f.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"none",n=f.characterValue;a.characterValue,a.characterValue.includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,r=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[r]={},t[e[h].ofTheConceptId]=n);let o=yield _t(e[h].typeId);try{let e=null!==(u=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"none",n=p.characterValue;o.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}var fo=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function po(e,t,n){if(e in t){let r=t[e];console.log("this is the count info",r),r&&(n[r.connectionType+"_count"]=r.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 vo=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};var go,mo=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};function No(e,t){return mo(this,void 0,void 0,(function*(){let t=e.outputFormat;e.outputFormat=no;let n,r=yield function(e){return zr(this,arguments,void 0,(function*(e,t=""){var n=x("application/json",t);const r=C.FreeschemaQueryUrl(),o=JSON.stringify(e);try{const e=yield fetch(r,{method:"POST",headers:n,body:o});return e.ok?yield e.json():(b(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 k(e.message,!1,e.status,e.stack);throw n.setUrl(t),n}{let n=new k(e.message,!1,500,e.stack);throw n.setUrl(t),n}}(e,r)}}))}(e,""),o=r.conceptIds,i=(r.internalConnections,r.linkers),c=r.reverse,s=r.mainCompositionIds,a=r.countinfo,l=e.order,u=function(e=[]){let t=[];if(e.length>0)for(let n=0;n<(null==e?void 0:e.length);n++){let r=so(e[n]);t.push(r)}return t}(a);return n=t==Qr?yield function(e,t,n,r,o){return vo(this,arguments,void 0,(function*(e,t,n,r,o,i="DESC"){let c=yield Rn(e),s=yield co(o);c=yo(c,i);let a=[];a=yield function(e,t){return lo(this,arguments,void 0,(function*(e,t,n=[]){var r,o,i,c,s,a,l,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let d=!1,f=yield _t(e[h].ofTheConceptId),p=yield _t(e[h].toTheConceptId);if(n.includes(e[h].id)&&(d=!0),1==d){if(0!=f.id&&0!=p.id){let n,s=yield _t(e[h].typeId),a=null!==(o=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==o?o:"self";e[h].toTheConceptId in t?n=t[e[h].toTheConceptId]:(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(i=null==f?void 0:f.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"none",n=f.characterValue;(s.characterValue+"_reverse").includes("_s_")&&(f.id in t||(t[f.id]={}),t[f.id][e]=n),t[p.id]={}}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,r=yield _t(e[h].typeId),o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?n=t[e[h].ofTheConceptId]:(n={},n[o]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(u=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"none",n=p.characterValue;r.characterValue.includes("_s_")&&(p.id in t||(t[p.id]={}),t[p.id][e]=n),t[f.id]={}}catch(e){console.log("this is error",e)}}}return t}))}(c,a,r),a=yield function(e,t){return lo(this,arguments,void 0,(function*(e,t,n=[]){var r,o,i,c,s,a,l,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let d=!1,f=yield _t(e[h].ofTheConceptId),p=yield _t(e[h].toTheConceptId);if(n.includes(e[h].id)&&(d=!0),1==d){if(0!=f.id&&0!=p.id){let n,s=yield _t(e[h].typeId),a=null!==(o=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==o?o:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(i=null==f?void 0:f.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"none",t=f.characterValue,r=s.characterValue;""==r&&(r=e,r=ao(r));let o={id:f.id,data:{[e]:t}},l=r+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=o)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,r=yield _t(e[h].typeId),o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},t[e[h].ofTheConceptId]=n);try{let e=null!==(u=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"none",t=p.characterValue,i=r.characterValue,c=!1;""==i&&(i=e,i=ao(i),c=!0);let s={id:p.id,data:{[e]:t}};isNaN(Number(i))?i.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][i]=s):(Array.isArray(n[o])||(n[o]=[]),n[o].push(s))}catch(e){console.log("this is error",e)}}}return t}))}(c,a,r);let l=yield function(e,t,n,r){return lo(this,arguments,void 0,(function*(e,t,n,r,o=[],i){var c,s,a,l,u,h,d;(new Date).getTime();let f=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let n=0;n<e.length;n++){let r=!1,i=yield _t(e[n].ofTheConceptId),f=yield _t(e[n].toTheConceptId);if(o.includes(e[n].id)&&(r=!0),1==r){if(0!=i.id&&0!=f.id&&f.id in t){let r,o=yield _t(e[n].typeId),a=null!==(s=null===(c=f.type)||void 0===c?void 0:c.characterValue)&&void 0!==s?s:"self",l=!1;e[n].toTheConceptId in t&&(l=!0),e[n].toTheConceptId in t?(r=t[e[n].toTheConceptId],"string"==typeof r[a]&&(r[a]={})):(r={},r[a]={},t[e[n].toTheConceptId]=r);try{if(t[e[n].ofTheConceptId]){let c={id:i.id,data:t[e[n].ofTheConceptId],created_on:e[n].entryTimeStamp},s=o.characterValue+"_reverse";Array.isArray(r[a][s])?r[a][s].push(c):s.includes("_s_")?(r[a][s]=[],r[a][s].push(c)):r[a][s]=c}}catch(e){console.log("this is error",e)}}}else if(0!=i.id&&0!=f.id&&i.id in t){let r,o=yield _t(e[n].typeId),c=null!==(l=null===(a=i.type)||void 0===a?void 0:a.characterValue)&&void 0!==l?l:"self",s=!1;e[n].toTheConceptId in t&&(s=!0),e[n].ofTheConceptId in t?(r=t[e[n].ofTheConceptId],"string"==typeof r[c]&&(r[c]={})):(r={},r[c]={},t[e[n].ofTheConceptId]=r);let p=!0,y=o.characterValue;""==y&&(y=f.characterValue,p=!0),""==y&&(y=null!==(h=null===(u=null==f?void 0:f.type)||void 0===u?void 0:u.characterValue)&&void 0!==h?h:"");try{null===(d=null==f?void 0:f.type)||void 0===d||d.characterValue;let i=t[e[n].toTheConceptId];if(i){let s={id:f.id,data:t[e[n].toTheConceptId],created_on:e[n].entryTimeStamp};Array.isArray(r[c])?r[c].push(i):Array.isArray(r[c][y])?r[c][o.characterValue].push(s):y.includes("_s_")?(r[c][y]=[],r[c][y].push(s)):r[c][y]=s}}catch(e){console.log("this is error",e)}}}for(let e=0;e<r.length;e++){let n={};n.id=r[e],n.data=t[r[e]],f.push(n)}return f}))}(c,a,[],n,r,s);return l}))}(i,o,s,c,u,l):t==Zr?yield function(e,t,n,r,o){return vo(this,arguments,void 0,(function*(e,t,n,r,o,i="DESC"){let c=yield Rn(e),s=yield co(o);c=yo(c,i);let a=[];a=yield ho(c,a,r),a=yield function(e,t){return fo(this,arguments,void 0,(function*(e,t,n=[]){var r,o,i,c,s,a,l,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);for(let h=0;h<e.length;h++){let d=!1,f=yield _t(e[h].ofTheConceptId),p=yield _t(e[h].toTheConceptId);if(n.includes(e[h].id)&&(d=!0),1==d){if(0!=f.id&&0!=p.id){let n,s=yield _t(e[h].typeId),a=null!==(o=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==o?o:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],a in n||(n[a]={})):(n={},n[a]={},t[e[h].toTheConceptId]=n);try{let e=null!==(c=null===(i=null==f?void 0:f.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"none",t=f.characterValue,r=s.characterValue;""==r&&(r=e,r=ao(r));let o={id:f.id,[e]:t},l=r+"_reverse";l.includes("_s_")||("string"==typeof n[a]&&(n[a]={}),n[a][l]=o)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,r=yield _t(e[h].typeId),o=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],o in n||(n[o]={})):(n={},n[o]={},t[e[h].ofTheConceptId]=n);try{let t=null!==(u=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"none",i=p.characterValue,c=r.characterValue,s=!1;""==c&&(c=t,c=ao(c),s=!0);let a={};a[t]={id:p.id,data:i,created_on:e[h].entryTimeStamp},isNaN(Number(c))?c.includes("_s_")||("string"==typeof n[o]&&(n[o]={}),n[o][c]=s?a[t]:a):(Array.isArray(n[o])||(n[o]=[]),n[o].push(a[t]))}catch(e){console.log("this is error",e)}}}return t}))}(c,a,r);let l=yield function(e,t,n){return fo(this,arguments,void 0,(function*(e,t,n,r=[],o){var i,c,s,a,l,u,h,d;(new Date).getTime();let f=[],p=[];for(let t=0;t<e.length;t++)p.push(e[t].toTheConceptId),p.push(e[t].ofTheConceptId),p.push(e[t].typeId);for(let n=0;n<e.length;n++){let f=!1,p=yield _t(e[n].ofTheConceptId),y=yield _t(e[n].toTheConceptId);if(r.includes(e[n].id)&&(f=!0),1==f){if(0!=p.id&&0!=y.id&&y.id in t){let r,o=yield _t(e[n].typeId),s=null!==(c=null===(i=y.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self",a=!1;e[n].toTheConceptId in t&&(a=!0),e[n].toTheConceptId in t?(r=t[e[n].toTheConceptId],"string"==typeof r[s]&&(r[s]={})):(r={},r[s]={},t[e[n].toTheConceptId]=r);try{if(t[e[n].ofTheConceptId]){let i=t[e[n].ofTheConceptId];i&&(i.id=p.id,i.created_on=p.entryTimeStamp);let c=o.characterValue+"_reverse";Array.isArray(r[s][c])?r[s][c].push(i):c.includes("_s_")?(r[s][c]=[],r[s][c].push(i)):r[s][c]=i}}catch(e){console.log("this is error",e)}}}else if(0!=p.id&&0!=y.id&&p.id in t){let r,i=yield _t(e[n].typeId),c=null!==(a=null===(s=p.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self",f=!1;e[n].toTheConceptId in t&&(f=!0),e[n].ofTheConceptId in t?(r=t[e[n].ofTheConceptId],"string"==typeof r[c]&&(r[c]={})):(r={},r[c]={},t[e[n].ofTheConceptId]=r),po(p.id,o,r);let v=!1,g=i.characterValue;""==g&&(g=y.characterValue,v=!0),""==g&&(g=null!==(u=null===(l=null==y?void 0:y.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"");try{let i=null!==(d=null===(h=null==y?void 0:y.type)||void 0===h?void 0:h.characterValue)&&void 0!==d?d:"none",s=t[e[n].toTheConceptId];if(s){let t={};t[i]={data:s[i],id:y.id,created_on:e[n].entryTimeStamp},Array.isArray(r[c])?v?r[c].push(s[g]):r[c].push(s):Array.isArray(r[c][g])?r[c][g].push(t):g.includes("_s_")?(r[c][g]=[],v?r[c][g].push(t[i]):r[c][g].push(t)):r[c][g]=v?t[i]:t,po(y.id,o,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 r={};console.log("this is the main compositions DATA",t[n[e]]),r=t[n[e]],r&&(r.id=n[e]),f.push(r)}return f}))}(c,a,n,r,s);return l}))}(i,o,s,c,u,l):yield function(e,t,n,r){return vo(this,void 0,void 0,(function*(){let t=yield Rn(e);t=yo(t);let o=[];o=yield ho(t,o,r),o=yield function(e,t,n){return uo(this,void 0,void 0,(function*(){var r,o,i,c,s,a,l,u;let h=[];for(let t=0;t<e.length;t++)h.push(e[t].toTheConceptId),h.push(e[t].ofTheConceptId),h.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let h=0;h<e.length;h++){let d=!1;n.includes(e[h].id)&&(d=!0);let f=yield _t(e[h].ofTheConceptId),p=yield _t(e[h].toTheConceptId);if(1==d){if(0!=f.id&&0!=p.id){let n,s=null!==(o=null===(r=p.type)||void 0===r?void 0:r.characterValue)&&void 0!==o?o:"self";e[h].toTheConceptId in t?(n=t[e[h].toTheConceptId],s in n||(n[s]={})):(n={},n[s]={},t[e[h].toTheConceptId]=n);let a=yield _t(e[h].typeId);try{let e=null!==(c=null===(i=null==f?void 0:f.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"none",t=f.characterValue,r=a.characterValue;""==r&&(r=e,r=ao(r));let o={[e]:t},l=r+"_reverse";a.characterValue.includes("_s_")||("string"==typeof n[s]&&(n[s]={}),n[s][l]=o)}catch(e){console.log("this is error",e)}}}else if(0!=f.id&&0!=p.id){let n,r=null!==(a=null===(s=f.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[h].ofTheConceptId in t?(n=t[e[h].ofTheConceptId],r in n||(n[r]={})):(n={},n[r]={},t[e[h].ofTheConceptId]=n);let o=yield _t(e[h].typeId);try{let e=null!==(u=null===(l=null==p?void 0:p.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"none",t=p.characterValue,i=o.characterValue,c=(o.characterValue,!1);""==i&&(i=e,i=ao(i),c=!0);let s={[e]:t};isNaN(Number(i))?o.characterValue.includes("_s_")||("string"==typeof n[r]&&(n[r]={}),n[r][i]=c?t:s):(Array.isArray(n[r])||(n[r]=[]),n[r].push(t))}catch(e){console.log("this is error",e)}}}return t}))}(t,o,r);let i=yield function(){return uo(this,arguments,void 0,(function*(e=[],t=[],n=[],r,o=[]){var i,c,s,a,l,u;let h=[],d=[];for(let t=0;t<e.length;t++)d.push(e[t].toTheConceptId),d.push(e[t].ofTheConceptId),d.push(e[t].typeId);e.sort((function(e,t){return t.id-e.id}));for(let n=0;n<e.length;n++){let r=!1;o.includes(e[n].id)&&(r=!0);let h=yield _t(e[n].ofTheConceptId),d=yield _t(e[n].toTheConceptId);if(1==r){if(0!=h.id&&0!=d.id&&d.id in t){let r,o=null!==(c=null===(i=d.type)||void 0===i?void 0:i.characterValue)&&void 0!==c?c:"self";e[n].toTheConceptId in t?r=t[e[n].toTheConceptId]:(r={},r[o]={},t[e[n].toTheConceptId]=r);let s=yield _t(e[n].typeId);try{let i=s.characterValue+"_reverse",c=t[e[n].ofTheConceptId];c&&(Array.isArray(r[o][i])?r[o][i].push(c):s.characterValue.includes("_s_")?(r[o][i]=[],r[o][i].push(c)):r[o][i]=c)}catch(e){console.log("this is error",e)}}}else if(0!=h.id&&0!=d.id&&h.id in t){let r,o=null!==(a=null===(s=h.type)||void 0===s?void 0:s.characterValue)&&void 0!==a?a:"self";e[n].ofTheConceptId in t?(r=t[e[n].ofTheConceptId],"string"==typeof r[o]&&(r[o]={})):(r={},r[o]={},t[e[n].ofTheConceptId]=r);let i=!1,c=(yield _t(e[n].typeId)).characterValue;""==c&&(c=d.characterValue,i=!0),""==c&&(c=null!==(u=null===(l=null==d?void 0:d.type)||void 0===l?void 0:l.characterValue)&&void 0!==u?u:"");try{let s=t[e[n].toTheConceptId];s&&(Array.isArray(r[o])?i?r[o].push(s[c]):r[o].push(s):Array.isArray(r[o][c])?r[o][c].push(s):c.includes("_s_")?(r[o][c]=[],i?r[o][c].push(s[c]):r[o][c].push(s)):r[o][c]=i?s[c]:s)}catch(e){console.log("this is error",e)}}}for(let e=0;e<n.length;e++){let r=t[n[e]];r&&(r.id=n[e],h.push(r))}return h}))}(t,o,n,[],r);return i}))}(i,0,s,c),n}))}class wo{constructor(){this.type="",this.inpage=10,this.page=1,this.concepts=[],this.conceptIds=[],this.selectors=[],this.freeschemaQueries=[],this.filters=[],this.filterLogic="",this.typeConnection="",this.order="DESC",this.outputFormat=Yr,this.name="",this.reverse=!1,this.limit=!1,this.includeInFilter=!1,this.isOldConnectionType=!1}}function To(e){let t=go.None;for(const n of e)switch(n){case"read":t|=go.Read;break;case"write":t|=go.Write;break;case"execute":t|=go.Execute;break;case"delete":t|=go.Delete}return t}!function(e){e[e.None=0]="None",e[e.Read=1]="Read",e[e.Write=2]="Write",e[e.Execute=4]="Execute",e[e.Delete=8]="Delete"}(go||(go={}));var Co=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))},Io=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function c(e){try{a(r.next(e))}catch(e){i(e)}}function s(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(c,s)}a((r=r.apply(e,t||[])).next())}))};const Eo=new class{constructor(){this.userAccessCache=new Map,this.publicAccessCache=new Map,process.env.ACCESS_CONTROL_BASE_URL}loadCacheFromApi(e){return Co(this,void 0,void 0,(function*(){let t="get-access-group-by-entity";void 0!==e&&(t+=`?userId=${e}`);const n=yield fetch(t);if(!n.ok)throw new Error(`Failed to fetch data: ${n.statusText}`);const r=yield n.json();this.loadCacheFromJson(r)}))}loadCacheFromJson(e){const t=null==e?void 0:e.data;if(!t||"object"!=typeof t)return;const n=t;for(const[e,t]of Object.entries(n)){const n=parseInt(e);this.userAccessCache.has(n)||this.userAccessCache.set(n,new Map);for(const[e,r]of Object.entries(t)){const t=parseInt(e),o=To(r);this.userAccessCache.get(n).set(t,o)}}}hasAccess(e,t,n){if(this.hasPublicAccess(t,n))return!0;this.userAccessCache.has(e)||this.loadCacheFromApi(e);const r=this.userAccessCache.get(e),o=null==r?void 0:r.get(t);return void 0!==o&&(o&n)===n}getAccessibleConcepts(e,t,n){const r=[],o=[];for(const e of t)this.hasPublicAccess(e,n)?r.push(e):o.push(e);o.length>0&&!this.userAccessCache.has(e)&&this.loadCacheFromApi(e);const i=this.userAccessCache.get(e);for(const e of o)(null==i?void 0:i.get(e))&&(i.get(e)&n)===n&&r.push(e);return r}getAccessByUser(e){var t;return this.userAccessCache.has(e)||this.loadCacheFromApi(e),new Map(null!==(t=this.userAccessCache.get(e))&&void 0!==t?t:[])}getAccessByConcept(e){const t=new Map;for(const[n,r]of this.userAccessCache){const o=r.get(e);void 0!==o&&t.set(n,o)}return t}deleteRecordByUserId(e){this.userAccessCache.delete(e)}clearCache(){this.userAccessCache.clear(),this.publicAccessCache.clear()}getConceptsByPublicAccess(e){return Co(this,void 0,void 0,(function*(){var t;const n=yield fetch("get-concepts-by-public-access",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!n.ok)throw new Error(`Failed to fetch data: ${n.statusText}`);const r=null===(t=yield n.json())||void 0===t?void 0:t.data;if(r)for(const[e,t]of Object.entries(r)){const n=parseInt(e),r=To(t);this.publicAccessCache.set(n,r)}}))}hasPublicAccess(e,t){void 0===this.publicAccessCache.get(e)&&this.getConceptsByPublicAccess([e]);const n=this.publicAccessCache.get(e);return void 0!==n&&(n&t)===t}getConceptsWithPublicAccess(e,t){return Co(this,void 0,void 0,(function*(){const n=[],r=[];for(const o of e){const e=this.publicAccessCache.get(o);void 0!==e?(e&t)===t&&n.push(o):r.push(o)}if(r.length>0){yield this.getConceptsByPublicAccess(r);for(const e of r){const r=this.publicAccessCache.get(e);void 0!==r&&(r&t)===t&&n.push(e)}}return n}))}};function Ao(e,t,n){return Io(this,void 0,void 0,(function*(){var r;const o=yield _t(n);if(999===o.userId||o.userId===e)return!0;const i=null!==(r=o.accessId)&&void 0!==r?r:0,c=e;return yield Eo.hasAccess(c,i,t)}))}function So(e,t,n){return Io(this,void 0,void 0,(function*(){const r=yield j(n),o=Array.from(r.values()).filter((t=>t.userId!==e&&999!==t.userId)).map((e=>{var t;return null!==(t=e.accessId)&&void 0!==t?t:0})).filter(((e,t,n)=>n.indexOf(e)===t)),i=e;return(yield Eo.getAccessibleConcepts(i,o,t)).length===n.length}))}function Ro(e,t,n){return Io(this,void 0,void 0,(function*(){var r;const o=yield j(n),i=Array.from(o.values()).filter((t=>t.userId!==e&&999!==t.userId)).map((e=>{var t;return null!==(t=e.accessId)&&void 0!==t?t:0})).filter(((e,t,n)=>n.indexOf(e)===t)),c=e,s=new Set(yield Eo.getAccessibleConcepts(c,i,t)),a=[];for(const t of o.values())(t.userId===e||999===t.userId||s.has(null!==(r=t.accessId)&&void 0!==r?r:0))&&a.push(t.id);return a}))}function xo(e=""){I.BearerAccessToken=e}function ko(t="",n="",r="",o=""){C.BASE_URL=t,C.AI_URL=n,console.log("This ist he base url",C.BASE_URL),I.BearerAccessToken=r,I.JwtSecret=o,function(){return qr(this,void 0,void 0,(function*(){return yield new e(!0),yield function(){return Xr(this,void 0,void 0,(function*(){try{(new Date).getTime();var e=x("application/x-www-form-urlencoded");const n=yield fetch(C.GetAllAiData(),{method:"GET",headers:e});n.ok||(console.log("Ai Error Message: ","Cannot get response"),b(n));const r=yield n.json();for(var t=0;t<r.length;t++)N.AddConcept(r[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 w(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];N.AddConceptToMemory(n)}(new Date).getTime()}))})().then((()=>{a.isDataLoaded=!0,a.isCharacterLoaded=!0,a.isTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare concept data is ",t)})),function(){return Kr(this,void 0,void 0,(function*(){var e=yield s();if(Array.isArray(e))for(var t=0;t<e.length;t++){let n=e[t];xe.AddConceptToMemory(n)}}))}().then((()=>{a.isLocalDataLoaded=!0,a.isLocalTypeLoaded=!0,a.isLocalCharacterLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare local concept ",t)})),function(){return Wr(this,void 0,void 0,(function*(){!function(){Wr(this,void 0,void 0,(function*(){var e=yield s();if(Array.isArray(e))for(var t=0;t<e.length;t++)be.AddConnection(e[t])}))}()}))}().then((()=>{a.isLocalConnectionLoaded=!0})),function(){return Wr(this,void 0,void 0,(function*(){!function(){Wr(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((()=>{a.isConnectionLoaded=!0,a.isConnectionTypeLoaded=!0;let t=(new Date).getTime()-e;console.log("The time taken to prepare connections ",t)}))}))}})();var o=exports;for(var i in r)o[i]=r[i];r.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})();
@@ -0,0 +1 @@
1
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
@@ -1,3 +1,4 @@
1
1
  export declare class TokenStorage {
2
2
  static BearerAccessToken: string;
3
+ static JwtSecret: string;
3
4
  }
@@ -0,0 +1,17 @@
1
+ import { PermissionSet } from './PermissionSet';
2
+ export declare class AccessControlCacheService {
3
+ private readonly userAccessCache;
4
+ private readonly publicAccessCache;
5
+ constructor();
6
+ loadCacheFromApi(entityId?: number): Promise<void>;
7
+ loadCacheFromJson(jsonData: any): void;
8
+ hasAccess(entityId: number, conceptId: number, required: PermissionSet): boolean;
9
+ getAccessibleConcepts(entityId: number, conceptIds: number[], required: PermissionSet): number[];
10
+ getAccessByUser(entityId: number): Map<number, PermissionSet>;
11
+ getAccessByConcept(conceptId: number): Map<number, PermissionSet>;
12
+ deleteRecordByUserId(entityId: number): void;
13
+ clearCache(): void;
14
+ getConceptsByPublicAccess(conceptIds: number[]): Promise<void>;
15
+ hasPublicAccess(conceptId: number, required: PermissionSet): boolean;
16
+ getConceptsWithPublicAccess(conceptIds: number[], required: PermissionSet): Promise<number[]>;
17
+ }
@@ -0,0 +1,4 @@
1
+ import { PermissionSet } from './PermissionSet';
2
+ export declare function CheckAccessOfConcept(userId: number, access: PermissionSet, conceptId: number): Promise<boolean>;
3
+ export declare function CheckAccessOfConceptList(userId: number, access: PermissionSet, conceptIdList: number[]): Promise<boolean>;
4
+ export declare function FilterConceptListByAccess(userId: number, access: PermissionSet, conceptIdList: number[]): Promise<number[]>;
@@ -0,0 +1,8 @@
1
+ export declare enum PermissionSet {
2
+ None = 0,
3
+ Read = 1,
4
+ Write = 2,
5
+ Execute = 4,
6
+ Delete = 8
7
+ }
8
+ export declare function getPermissionSetFromStrings(permissions: string[]): PermissionSet;
@@ -0,0 +1 @@
1
+ export declare const getServerJwtToken: () => string;
@@ -81,5 +81,7 @@ export { BaseUrl } from './DataStructures/BaseUrl';
81
81
  export { SchemaQueryListener } from './WrapperFunctions/SchemaQueryObservable';
82
82
  export { FreeschemaQuery } from './DataStructures/Search/FreeschemaQuery';
83
83
  export { DATAID, NORMAL, JUSTDATA, ALLID, DATAIDDATE, RAW, LISTNORMAL } from './Constants/FormatConstants';
84
+ export { CheckAccessOfConcept, CheckAccessOfConceptList, FilterConceptListByAccess } from './Services/AccessControl/AccessControlService';
85
+ export { PermissionSet } from './Services/AccessControl/PermissionSet';
84
86
  declare function updateAccessToken(accessToken?: string): void;
85
- declare function init(url?: string, aiurl?: string, accessToken?: string): void;
87
+ declare function init(url?: string, aiurl?: string, accessToken?: string, jwtSecret?: string): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mftsccs-node",
3
- "version": "0.0.39",
3
+ "version": "1.0.0",
4
4
  "environment": "production",
5
5
  "description": "Full Pack of concept and connection system",
6
6
  "main": "dist/bundle.js",
@@ -17,6 +17,8 @@
17
17
  "build": "webpack --config webpack.config.js"
18
18
  },
19
19
  "devDependencies": {
20
+ "@types/bcrypt": "^5.0.2",
21
+ "@types/jsonwebtoken": "^9.0.9",
20
22
  "dotenv-webpack": "^8.0.1",
21
23
  "mqtt": "^5.5.2",
22
24
  "ts-loader": "^9.5.1",
@@ -25,136 +27,141 @@
25
27
  "webpack-cli": "^5.1.4"
26
28
  },
27
29
  "dependencies": {
28
- "acorn-import-assertions": "^1.9.0",
29
- "acorn": "^8.11.2",
30
- "ansi-styles": "^4.3.0",
31
30
  "abort-controller": "^3.0.0",
31
+ "acorn": "^8.11.2",
32
+ "acorn-import-assertions": "^1.9.0",
32
33
  "ajv": "^6.12.6",
34
+ "ajv-keywords": "^3.5.2",
35
+ "ansi-styles": "^4.3.0",
36
+ "base64-js": "^1.5.1",
37
+ "bcrypt": "^5.1.1",
33
38
  "bl": "^6.0.12",
34
39
  "braces": "^3.0.2",
35
- "buffer": "^6.0.3",
36
- "ajv-keywords": "^3.5.2",
37
40
  "browserslist": "^4.22.1",
41
+ "buffer": "^6.0.3",
42
+ "buffer-from": "^1.1.2",
38
43
  "caniuse-lite": "^1.0.30001565",
39
44
  "chalk": "^4.1.2",
40
- "buffer-from": "^1.1.2",
41
- "base64-js": "^1.5.1",
42
- "color-convert": "^2.0.1",
43
- "colorette": "^2.0.20",
44
45
  "chrome-trace-event": "^1.0.3",
45
- "color-name": "^1.1.4",
46
- "dotenv": "^8.6.0",
47
46
  "clone-deep": "^4.0.1",
47
+ "color-convert": "^2.0.1",
48
+ "color-name": "^1.1.4",
49
+ "colorette": "^2.0.20",
48
50
  "commander": "^2.20.3",
49
51
  "commist": "^3.2.0",
50
- "electron-to-chromium": "^1.4.594",
51
- "dotenv-defaults": "^2.0.2",
52
52
  "concat-stream": "^2.0.0",
53
- "enhanced-resolve": "^5.15.0",
54
53
  "cross-spawn": "^7.0.3",
55
- "es-module-lexer": "^1.4.1",
54
+ "crypto-browserify": "^3.12.1",
56
55
  "debug": "^4.3.4",
57
- "eslint-scope": "^5.1.1",
58
- "escalade": "^3.1.1",
59
- "fast-deep-equal": "^3.1.3",
56
+ "dotenv": "^8.6.0",
57
+ "dotenv-defaults": "^2.0.2",
58
+ "electron-to-chromium": "^1.4.594",
59
+ "enhanced-resolve": "^5.15.0",
60
60
  "envinfo": "^7.11.0",
61
- "estraverse": "^4.3.0",
61
+ "es-module-lexer": "^1.4.1",
62
+ "escalade": "^3.1.1",
63
+ "eslint-scope": "^5.1.1",
62
64
  "esrecurse": "^4.3.0",
65
+ "estraverse": "^4.3.0",
63
66
  "event-target-shim": "^5.0.1",
64
- "fill-range": "^7.0.1",
65
- "glob-to-regexp": "^0.4.1",
66
- "function-bind": "^1.1.2",
67
- "find-up": "^4.1.0",
67
+ "events": "^3.3.0",
68
+ "fast-deep-equal": "^3.1.3",
68
69
  "fast-json-stable-stringify": "^2.1.0",
69
- "fastest-levenshtein": "^1.0.16",
70
70
  "fast-unique-numbers": "^8.0.13",
71
+ "fastest-levenshtein": "^1.0.16",
72
+ "fill-range": "^7.0.1",
73
+ "find-up": "^4.1.0",
74
+ "flat": "^5.0.2",
75
+ "function-bind": "^1.1.2",
76
+ "glob-to-regexp": "^0.4.1",
71
77
  "graceful-fs": "^4.2.11",
72
78
  "has-flag": "^4.0.0",
73
79
  "hasown": "^2.0.0",
74
- "import-local": "^3.1.0",
75
- "ieee754": "^1.2.1",
76
- "events": "^3.3.0",
77
- "flat": "^5.0.2",
78
- "is-number": "^7.0.0",
79
80
  "help-me": "^5.0.0",
80
- "interpret": "^3.1.1",
81
+ "ieee754": "^1.2.1",
82
+ "import-local": "^3.1.0",
81
83
  "inherits": "^2.0.4",
82
- "isobject": "^3.0.1",
84
+ "interpret": "^3.1.1",
83
85
  "is-core-module": "^2.13.1",
84
- "jest-worker": "^27.5.1",
85
- "isexe": "^2.0.0",
86
+ "is-number": "^7.0.0",
86
87
  "is-plain-object": "^2.0.4",
87
- "locate-path": "^5.0.0",
88
+ "isexe": "^2.0.0",
89
+ "isobject": "^3.0.1",
90
+ "jest-worker": "^27.5.1",
91
+ "js-sdsl": "^4.3.0",
92
+ "json-parse-even-better-errors": "^2.3.1",
93
+ "json-schema-traverse": "^0.4.1",
94
+ "jsonwebtoken": "^9.0.2",
95
+ "kind-of": "^6.0.3",
88
96
  "loader-runner": "^4.3.0",
97
+ "locate-path": "^5.0.0",
89
98
  "lru-cache": "^6.0.0",
90
- "json-parse-even-better-errors": "^2.3.1",
91
- "js-sdsl": "^4.3.0",
92
99
  "merge-stream": "^2.0.0",
93
- "mime-types": "^2.1.35",
94
100
  "micromatch": "^4.0.5",
95
- "node-releases": "^2.0.13",
96
- "json-schema-traverse": "^0.4.1",
97
- "mqtt-packet": "^9.0.0",
98
- "ms": "^2.1.2",
99
- "kind-of": "^6.0.3",
100
101
  "mime-db": "^1.52.0",
102
+ "mime-types": "^2.1.35",
101
103
  "minimist": "^1.2.8",
104
+ "mqtt-packet": "^9.0.0",
105
+ "ms": "^2.1.2",
102
106
  "neo-async": "^2.6.2",
107
+ "node-releases": "^2.0.13",
108
+ "number-allocator": "^1.0.14",
103
109
  "p-limit": "^2.3.0",
104
- "path-exists": "^4.0.0",
105
110
  "p-locate": "^4.1.0",
106
- "number-allocator": "^1.0.14",
107
111
  "p-try": "^2.2.0",
112
+ "path-exists": "^4.0.0",
113
+ "path-key": "^3.1.1",
108
114
  "path-parse": "^1.0.7",
109
115
  "picocolors": "^1.0.0",
110
- "path-key": "^3.1.1",
111
- "process-nextick-args": "^2.0.1",
116
+ "picomatch": "^2.3.1",
112
117
  "pkg-dir": "^4.2.0",
113
118
  "process": "^0.11.10",
114
- "randombytes": "^2.1.0",
115
- "picomatch": "^2.3.1",
119
+ "process-nextick-args": "^2.0.1",
116
120
  "punycode": "^2.3.1",
121
+ "randombytes": "^2.1.0",
117
122
  "readable-stream": "^4.5.2",
118
123
  "rechoir": "^0.8.0",
119
- "resolve-from": "^5.0.0",
120
- "resolve-cwd": "^3.0.0",
121
- "resolve": "^1.22.8",
124
+ "regenerator-runtime": "^0.14.1",
122
125
  "reinterval": "^1.1.0",
126
+ "resolve": "^1.22.8",
127
+ "resolve-cwd": "^3.0.0",
128
+ "resolve-from": "^5.0.0",
123
129
  "rfdc": "^1.3.1",
124
- "regenerator-runtime": "^0.14.1",
125
- "schema-utils": "^3.3.0",
126
130
  "safe-buffer": "^5.2.1",
127
- "serialize-javascript": "^6.0.1",
131
+ "schema-utils": "^3.3.0",
128
132
  "semver": "^7.5.4",
129
- "source-map": "^0.7.4",
133
+ "serialize-javascript": "^6.0.1",
130
134
  "shallow-clone": "^3.0.1",
131
135
  "shebang-command": "^2.0.0",
132
136
  "shebang-regex": "^3.0.0",
137
+ "source-map": "^0.7.4",
133
138
  "source-map-support": "^0.5.21",
139
+ "split2": "^4.2.0",
140
+ "stream-browserify": "^3.0.0",
134
141
  "string_decoder": "^1.3.0",
135
- "tapable": "^2.2.1",
136
- "to-regex-range": "^5.0.1",
142
+ "supports-color": "^7.2.0",
137
143
  "supports-preserve-symlinks-flag": "^1.0.0",
138
- "split2": "^4.2.0",
139
- "terser-webpack-plugin": "^5.3.9",
144
+ "tapable": "^2.2.1",
140
145
  "terser": "^5.24.0",
141
- "undici-types": "^5.26.5",
142
- "typedarray": "^0.0.6",
146
+ "terser-webpack-plugin": "^5.3.9",
147
+ "to-regex-range": "^5.0.1",
143
148
  "tslib": "^2.6.2",
144
- "supports-color": "^7.2.0",
149
+ "typedarray": "^0.0.6",
150
+ "undici-types": "^5.26.5",
145
151
  "update-browserslist-db": "^1.0.13",
146
- "wildcard": "^2.0.1",
152
+ "uri-js": "^4.4.1",
153
+ "util": "^0.12.5",
147
154
  "util-deprecate": "^1.0.2",
148
- "which": "^2.0.2",
155
+ "watchpack": "^2.4.0",
156
+ "webpack-merge": "^5.10.0",
149
157
  "webpack-sources": "^3.2.3",
158
+ "which": "^2.0.2",
159
+ "wildcard": "^2.0.1",
150
160
  "worker-timers": "^7.1.7",
151
- "webpack-merge": "^5.10.0",
152
- "uri-js": "^4.4.1",
153
- "watchpack": "^2.4.0",
154
- "yallist": "^4.0.0",
155
161
  "worker-timers-broker": "^6.1.7",
162
+ "worker-timers-worker": "^7.0.70",
156
163
  "ws": "^8.16.0",
157
- "worker-timers-worker": "^7.0.70"
164
+ "yallist": "^4.0.0"
158
165
  },
159
166
  "repository": {
160
167
  "type": "git",