@crystaldesign/diva-web-planner-react 26.12.0-rc.1 → 26.12.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see 2568.diva-web-planner-react.umd.min.js.LICENSE.txt */
2
- "use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[2568],{22568:(e,n,i)=>{i.r(n),i.d(n,{default:()=>D});var t=i(84658),r=i(13125),o=i(43860),s=i(80248),a=i(50747),c=i.n(a),d=i(27058),l=i(22739),u=i(58949),g=i(58382),v=i(1055),h=i(65713),R=i(7770),S=i(65656),f=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),D=function(){return(0,o.Z)((function Host3DSignalR(e,n){var i=this;(0,r.Z)(this,Host3DSignalR),(0,s.Z)(this,"renderSettings",void 0),(0,s.Z)(this,"signalRConnection",void 0),(0,s.Z)(this,"connectionStarted",void 0),(0,s.Z)(this,"successfullyLoggedIn",void 0),(0,s.Z)(this,"connectionErrorCount",void 0),(0,s.Z)(this,"doIgnoreOnClosed",void 0),(0,s.Z)(this,"sessionID",void 0),(0,s.Z)(this,"divaMediaServiceSocketIO",void 0),(0,s.Z)(this,"lastJoinDivaNr",void 0),(0,s.Z)(this,"reconnectAfterError",void 0),(0,s.Z)(this,"successfullyJoinedDivaNr",void 0),(0,s.Z)(this,"plannerHandler3D",void 0),(0,s.Z)(this,"reconnectingErrorCount",void 0),(0,s.Z)(this,"openSocketToMediaService",(function(e){i.divaMediaServiceSocketIO&&(i.divaMediaServiceSocketIO.disconnect(),i.divaMediaServiceSocketIO=void 0);var n=new URL(i.renderSettings.DivaMediaServiceUrl+"/"),t=n.origin+"?divaNrs="+e;i.divaMediaServiceSocketIO=(0,g.ZP)(t,{forceNew:!0,path:n.pathname+"socket.io",rejectUnauthorized:!1});var r=i;i.divaMediaServiceSocketIO.on("connect",(function(n){f.debug("Successfully connected to DivaMediaService with divaNr: "+e)})),i.divaMediaServiceSocketIO.on("disconnect",(function(n){f.debug("Disconnect from DivaMediaService with divaNr: "+e+" and mediaServiceUrl: "+i.renderSettings.DivaMediaServiceUrl)})),i.divaMediaServiceSocketIO.on("connect_error",(function(e){f.debug("Socket CONNECT_ERROR:",e)})),i.divaMediaServiceSocketIO.on("reconnect",(function(e){f.debug("Socket RECONNECTED, attempt:",e)})),i.divaMediaServiceSocketIO.on("DIVA3D",(function(e){if(e.hash&&""!=e.hash){new Date;r.plannerHandler3D.handleReceiveRendering({divaNr:e.divaNr,hash:e.hash,buffer:e.buffer,url:e.url,saveMode:e.saveMode})}}))})),(0,s.Z)(this,"noRenderClientFound",(function(e,n,t){f.debug("No rendering client has loaded the planning - send new request and force reload!"),d.ZP.endSpanOfApm("PlannerHandler3D requestRenderingFromSignalR "+e),d.ZP.endSpanOfApm("PlannerHandler3D requestRenderingDescriptionFromSignalR "+e),i.plannerHandler3D.onErrorRequestingRendering(e,n,t)})),(0,s.Z)(this,"returnVPInfo",(function(e){})),(0,s.Z)(this,"newRendering",(function(e,n,t){f.debug("Receive UI Polygon: "+t),i.plannerHandler3D.onReceivedAdditionalRenderInfo(n,t)})),(0,s.Z)(this,"newHQRenderScript",(function(e,n,t){f.debug("Receive HQRenderScript: "+t),(0,S.JB)("signalr: server HQS received",{chars:t?t.length:0}),i.plannerHandler3D.onReceiveHQRenderScript(n,t)})),this.renderSettings=e,this.connectionStarted=!1,this.successfullyLoggedIn=!1,this.successfullyJoinedDivaNr=!1,this.connectionErrorCount=0,this.reconnectAfterError=!1,this.lastJoinDivaNr="",this.doIgnoreOnClosed=!1,this.plannerHandler3D=n,this.sessionID="",this.reconnectingErrorCount=0}),[{key:"initializeConnection",value:(p=(0,t.Z)(c().mark((function _callee2(e){var n,i=this;return c().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(d.ZP.startSpanOfApm("Host3DSingalR initializeConnection"),(0,S.JB)("signalr: connect start",{retry:this.reconnectingErrorCount}),!(this.reconnectingErrorCount>0)){e.next=5;break}return e.next=5,this.delay(100);case 5:f.debug("Create SignalR connection with host: "+this.renderSettings.Diva3DServerURL+"; RenderGroup: "+this.renderSettings.RenderGroup),n=this,this.signalRConnection&&(this.doIgnoreOnClosed=!0,this.signalRConnection._completeClose(),this.signalRConnection=null),0==("undefined"==typeof window||window).DIVA_LOGGER?this.signalRConnection=(new l.s).withUrl(this.renderSettings.Diva3DServerURL).withHubProtocol(new v.e).build():this.signalRConnection=(new l.s).withUrl(this.renderSettings.Diva3DServerURL).withHubProtocol(new v.e).configureLogging(u.i.None).build(),this.signalRConnection.on("UnvalidSessionID",this.unvalidSessionID),this.signalRConnection.on("noRenderClientFound",this.noRenderClientFound),this.signalRConnection.on("newRendering",this.newRendering),this.signalRConnection.on("newHQRenderScript",this.newHQRenderScript),this.signalRConnection.start().then((function(){d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),(0,S.JB)("signalr: connected"),n.connectionStarted=!0,n.doIgnoreOnClosed=!1,n.reconnectAfterError?f.debug("SignalR Connection to 3DHost: "+i.renderSettings.Diva3DServerURL+" sucessfully reconnected","initSignalRConnection"):f.debug("SignalR Connection to 3DHost: "+n.renderSettings.Diva3DServerURL+" sucessfully started","initSignalRConnection"),n.reconnectingErrorCount=0,n.login()})).catch((function(e){d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),f.error(new d.GE("Connection error. Message: "+e.toString(),{code:"WC_0014"})),n.connectionStarted=!1,n.successfullyLoggedIn&&n.successfullyJoinedDivaNr||(n.reconnectingErrorCount++,n.reconnectingErrorCount<5&&n.initializeConnection())})),this.signalRConnection.onclose((0,t.Z)(c().mark((function _callee(){return c().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),f.warn("Connection with 3D Host gets lost. Try to reconnect.","WC_0014"),n.connectionStarted=!1,i.successfullyLoggedIn=!1,i.successfullyJoinedDivaNr=!1,!i.doIgnoreOnClosed){e.next=7;break}return e.abrupt("return");case 7:i.reconnectAfterError=!0,n.initializeConnection();case 9:case"end":return e.stop()}}),_callee)}))));case 15:case"end":return e.stop()}}),_callee2,this)}))),function initializeConnection(e){return p.apply(this,arguments)})},{key:"delay",value:function delay(e){return new Promise((function(n){return setTimeout(n,e)}))}},{key:"joinDivaNr",value:(D=(0,t.Z)(c().mark((function _callee3(e){return c().wrap((function _callee3$(n){for(;;)switch(n.prev=n.next){case 0:if(!this.reconnectAfterError&&this.lastJoinDivaNr==e){n.next=4;break}return n.next=3,this.join(e);case 3:this.reconnectAfterError=!1;case 4:case"end":return n.stop()}}),_callee3,this)}))),function joinDivaNr(e){return D.apply(this,arguments)})},{key:"getSuccessfullyJoinedToDivaNr",value:function getSuccessfullyJoinedToDivaNr(){return this.successfullyJoinedDivaNr}},{key:"getViewPointInfo",value:(a=(0,t.Z)(c().mark((function _callee4(e,n){var i;return c().wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.signalRConnection.invoke("GetVPInfo",this.sessionID,n,e);case 3:return i=t.sent,t.abrupt("return",i);case 7:t.prev=7,t.t0=t.catch(0),f.error(new d.GE("DoUpdate 3D Host",{code:"WC_0014"}));case 10:case"end":return t.stop()}}),_callee4,this,[[0,7]])}))),function getViewPointInfo(e,n){return a.apply(this,arguments)})},{key:"getConnectionReady",value:function getConnectionReady(){return this.connectionIsReady()}},{key:"getStaticRoomListInfo",value:(i=(0,t.Z)(c().mark((function _callee5(e){var n;return c().wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:return this.connectionIsReady()||(n=this,setTimeout((function(){return n.getStaticRoomListInfo(e)}),400)),f.debug("DIVA3D-HOST.SignaR POST GetFrontendRoomList - sessionID:"+this.sessionID),i.next=4,this.signalRConnection.invoke("GetFrontendRoomlist",this.sessionID,e);case 4:return i.abrupt("return",i.sent);case 5:case"end":return i.stop()}}),_callee5,this)}))),function getStaticRoomListInfo(e){return i.apply(this,arguments)})},{key:"request3D",value:function request3D(e){var n=this;if(this.connectionIsReady()&&this.successfullyJoinedDivaNr){var i,t,r,o,s,a,c,d,l,u,g,v,S,D=void 0,p=void 0;if(null!=e&&e.doRequestRendering)(D=new h.Z(e.planningHash,e.renderHash,null===(t=e.requestRenderingParams)||void 0===t?void 0:t.viewPointName,null===(r=e.requestRenderingParams)||void 0===r?void 0:r.width,null===(o=e.requestRenderingParams)||void 0===o?void 0:o.height,null===(s=e.requestRenderingParams)||void 0===s?void 0:s.isFullscreenRendering,null===(a=e.requestRenderingParams)||void 0===a?void 0:a.hasDimensionLines,null===(c=e.requestRenderingParams)||void 0===c?void 0:c.plannerMeasureDigits,!(null===(d=e.requestRenderingParams)||void 0===d||!d.viewPointInfo)&&e.requestRenderingParams.viewPointInfo.isStatic,null===(l=e.requestRenderingParams)||void 0===l?void 0:l.mediaServiceSaveMode,null===(u=e.requestRenderingParams)||void 0===u?void 0:u.alternateRenderingsExist,null===(g=e.requestRenderingParams)||void 0===g?void 0:g.alternateRenderInfo)).CatalogCodex=null===(v=e.requestRenderingParams)||void 0===v?void 0:v.catalogData.catalogCodex,D.CatalogGUID=null===(S=e.requestRenderingParams)||void 0===S?void 0:S.catalogData.catalogGUID;e.doRequestHqRenderScript&&(p=new R.Z(e.planningHash));var C=this.create3DHostRequestOption(e);return f.debug("request 3D (mediaType "+(null===(i=e.requestRenderingParams)||void 0===i?void 0:i.mediaServiceSaveMode)+") from 3D Host"+JSON.stringify(e)),e.doReloadWholePlanning?(f.debug("Host3DSignalR SaveProjectWithOptions"),this.signalRConnection.invoke("SaveProjectWithOptions",this.sessionID,e.divaNr,JSON.stringify(e.planningData),this.renderSettings.RenderGroup,JSON.stringify(C))):this.signalRConnection.invoke("RequestRenderingWithOptions",this.sessionID,e.divaNr,C.VPName,C.VPSize,e.renderHash,JSON.stringify(C)),{rendering:D,hqRenderScript:p}}return e.doReloadWholePlanning=!0,setTimeout((function(){return n.request3D(e)}),300),{rendering:void 0,hqRenderScript:void 0}}},{key:"create3DHostRequestOption",value:function create3DHostRequestOption(e){var n,i,t,r,o,s,a,c,l,u,g,v,h,R,S,f,D=e.requestRenderingParams?e.requestRenderingParams.width+":"+e.requestRenderingParams.height:"",p=null!=e&&e.doRequestRendering?"STREAM"==(null===(n=e.requestRenderingParams)||void 0===n?void 0:n.mediaServiceSaveMode)?0:"PERMANENT"==(null===(i=e.requestRenderingParams)||void 0===i?void 0:i.mediaServiceSaveMode)?1:-1:-1,C="";e.requestRenderingParams&&e.requestRenderingParams.functionType&&(C=e.requestRenderingParams.functionType);if(null!=e&&e.doRequestRendering&&null!==(t=e.requestRenderingParams)&&void 0!==t&&t.articleCodices){"[";for(var P=0;P<e.requestRenderingParams.articleCodices.length;P++)'"'+e.requestRenderingParams.articleCodices[P]+'"'+(P<e.requestRenderingParams.articleCodices.length-1?",":"");"]"}return{rendering:null==e?void 0:e.doRequestRendering,hqrenderscript:e.doRequestHqRenderScript,VPName:null!==(r=null===(o=e.requestRenderingParams)||void 0===o?void 0:o.viewPointName)&&void 0!==r?r:"",VPSize:D,VPFilename:e.renderHash,PlanningHash:e.planningHash,RenderHash:e.renderHash,plannerMeasureDigits:null!==(s=null===(a=e.requestRenderingParams)||void 0===a?void 0:a.plannerMeasureDigits)&&void 0!==s?s:0,Format:"JPG",BG:"",MSSM:p,OrgId:this.renderSettings.OrganizationId,FunctionType:C,CatalogCodex:null!==(c=null===(l=e.requestRenderingParams)||void 0===l?void 0:l.catalogData.catalogCodex)&&void 0!==c?c:"",CatalogGuid:null!==(u=null===(g=e.requestRenderingParams)||void 0===g?void 0:g.catalogData.catalogGUID)&&void 0!==u?u:"",ArticleCodices:null!==(v=null===(h=e.requestRenderingParams)||void 0===h?void 0:h.articleCodices)&&void 0!==v?v:[],UserSessionId:d.ZP.SessionId,v:null!==(R=null===(S=e.requestRenderingParams)||void 0===S?void 0:S.catalogData.catalogGUID)&&void 0!==R?R:"",hybrid3DInfo:null===(f=e.requestRenderingParams)||void 0===f?void 0:f.hybrid3DInfo}}},{key:"closeConnection",value:function closeConnection(){this.signalRConnection&&(this.doIgnoreOnClosed=!0,this.signalRConnection.invoke("LeaveWebClient").catch((function(){})),f.debug("SignalRConnection: Close Connection and say byby to Diva3DHost."),this.signalRConnection.stop().catch((function(){}))),this.divaMediaServiceSocketIO&&(f.debug("Closing DivaMediaService socket connection"),this.divaMediaServiceSocketIO.disconnect(),this.divaMediaServiceSocketIO=void 0)}},{key:"login",value:(n=(0,t.Z)(c().mark((function _callee6(){var e,n;return c().wrap((function _callee6$(i){for(;;)switch(i.prev=i.next){case 0:return f.debug("DIVA3D-HOST.SignaR POST Login - userID:"+this.renderSettings.UserID+", deviceID:"+this.renderSettings.DeviceID+", divaSessionID:"+this.renderSettings.DivaSessionID+", _Application:"+this.renderSettings.ApplicationName),d.ZP.startSpanOfApm("PlannerHandler3D login"),(0,S.JB)("signalr: LoginWebPlanner sent"),i.prev=3,i.next=6,this.signalRConnection.invoke("LoginWebPlanner",this.renderSettings.UserID,this.renderSettings.DeviceID,this.renderSettings.DivaSessionID,this.renderSettings.ApplicationName);case 6:e=i.sent,(0,S.JB)("signalr: LoginWebPlanner acked",{ok:""!=e?1:0}),this.connectionErrorCount=0,""!=e?(this.successfullyLoggedIn=!0,f.debug("DIVA3D-HOST.SignaR Response ReturnLogin - sessionID: "+e),this.sessionID=e,this.plannerHandler3D.onConnectionInitialized({status:"SUCCESSFULL"})):this.plannerHandler3D.onConnectionInitialized({status:"ERROR"}),i.next=17;break;case 12:i.prev=12,i.t0=i.catch(3),d.ZP.endSpanOfApm("PlannerHandler3D login"),n=this,this.handleConnectionError(i.t0,(function(){n.login()}));case 17:case"end":return i.stop()}}),_callee6,this,[[3,12]])}))),function login(){return n.apply(this,arguments)})},{key:"join",value:(e=(0,t.Z)(c().mark((function _callee7(e){var n,i;return c().wrap((function _callee7$(t){for(;;)switch(t.prev=t.next){case 0:if(""!=e){t.next=2;break}return t.abrupt("return");case 2:if(this.lastJoinDivaNr!=e&&this.openSocketToMediaService(e),n=this,this.connectionIsReady()){t.next=8;break}setTimeout((function(){n.join(e)}),200),t.next=25;break;case 8:return this.lastJoinDivaNr=e,d.ZP.startSpanOfApm("PlannerHandler3D join"),f.debug("PlannerHandler3D SignalR - Join DivaNr to connected host: "+e),(0,S.JB)("signalr: JoinWebPlanner sent"),t.prev=12,t.next=15,this.signalRConnection.invoke("JoinWebPlanner",this.sessionID,e);case 15:i=t.sent,d.ZP.endSpanOfApm("PlannerHandler3D join"),(0,S.JB)("signalr: JoinWebPlanner acked",{ok:i?1:0}),i?(this.successfullyJoinedDivaNr=!0,this.plannerHandler3D.onConnectedToDivaNr("SUCCESSFULL"),f.debug("Return Join - Join successfull.")):this.join(e),this.connectionErrorCount=0,t.next=25;break;case 22:t.prev=22,t.t0=t.catch(12),this.handleConnectionError(t.t0,(function(){n.join(e)}));case 25:case"end":return t.stop()}}),_callee7,this,[[12,22]])}))),function join(n){return e.apply(this,arguments)})},{key:"handleConnectionError",value:function handleConnectionError(e,n){this.connectionErrorCount++,4==this.connectionErrorCount?f.debug("SignalR Error. not possible to establish SignalR connection."):f.debug("SignalR Error. Message: "+e.message)}},{key:"connectionIsReady",value:function connectionIsReady(){return this.connectionStarted&&this.successfullyLoggedIn}},{key:"unvalidSessionID",value:function unvalidSessionID(e,n){f.debug("DIVA3D-HOST.SignaR Response Unvalid SessionID"),this.successfullyLoggedIn=!1}}]);var e,n,i,a,D,p}()}}]);
2
+ "use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[2568],{22568:(e,n,i)=>{i.r(n),i.d(n,{default:()=>D});var t=i(84658),r=i(13125),o=i(43860),s=i(80248),a=i(50747),c=i.n(a),d=i(27058),l=i(22739),u=i(58949),g=i(58382),v=i(1055),h=i(65713),R=i(7770),S=i(65656),f=d.ZP.initLog("Planner","WEB-PLANNER-LOGIC"),D=function(){return(0,o.Z)((function Host3DSignalR(e,n){var i=this;(0,r.Z)(this,Host3DSignalR),(0,s.Z)(this,"renderSettings",void 0),(0,s.Z)(this,"signalRConnection",void 0),(0,s.Z)(this,"connectionStarted",void 0),(0,s.Z)(this,"successfullyLoggedIn",void 0),(0,s.Z)(this,"connectionErrorCount",void 0),(0,s.Z)(this,"doIgnoreOnClosed",void 0),(0,s.Z)(this,"isClosed",!1),(0,s.Z)(this,"sessionID",void 0),(0,s.Z)(this,"divaMediaServiceSocketIO",void 0),(0,s.Z)(this,"lastJoinDivaNr",void 0),(0,s.Z)(this,"reconnectAfterError",void 0),(0,s.Z)(this,"successfullyJoinedDivaNr",void 0),(0,s.Z)(this,"plannerHandler3D",void 0),(0,s.Z)(this,"reconnectingErrorCount",void 0),(0,s.Z)(this,"openSocketToMediaService",(function(e){i.divaMediaServiceSocketIO&&(i.divaMediaServiceSocketIO.disconnect(),i.divaMediaServiceSocketIO=void 0);var n=new URL(i.renderSettings.DivaMediaServiceUrl+"/"),t=n.origin+"?divaNrs="+e;i.divaMediaServiceSocketIO=(0,g.ZP)(t,{forceNew:!0,path:n.pathname+"socket.io",rejectUnauthorized:!1});var r=i;i.divaMediaServiceSocketIO.on("connect",(function(n){f.debug("Successfully connected to DivaMediaService with divaNr: "+e)})),i.divaMediaServiceSocketIO.on("disconnect",(function(n){f.debug("Disconnect from DivaMediaService with divaNr: "+e+" and mediaServiceUrl: "+i.renderSettings.DivaMediaServiceUrl)})),i.divaMediaServiceSocketIO.on("connect_error",(function(e){f.debug("Socket CONNECT_ERROR:",e)})),i.divaMediaServiceSocketIO.on("reconnect",(function(e){f.debug("Socket RECONNECTED, attempt:",e)})),i.divaMediaServiceSocketIO.on("DIVA3D",(function(e){if(e.hash&&""!=e.hash){new Date;r.plannerHandler3D.handleReceiveRendering({divaNr:e.divaNr,hash:e.hash,buffer:e.buffer,url:e.url,saveMode:e.saveMode})}}))})),(0,s.Z)(this,"noRenderClientFound",(function(e,n,t){f.debug("No rendering client has loaded the planning - send new request and force reload!"),d.ZP.endSpanOfApm("PlannerHandler3D requestRenderingFromSignalR "+e),d.ZP.endSpanOfApm("PlannerHandler3D requestRenderingDescriptionFromSignalR "+e),i.plannerHandler3D.onErrorRequestingRendering(e,n,t)})),(0,s.Z)(this,"returnVPInfo",(function(e){})),(0,s.Z)(this,"newRendering",(function(e,n,t){f.debug("Receive UI Polygon: "+t),i.plannerHandler3D.onReceivedAdditionalRenderInfo(n,t)})),(0,s.Z)(this,"newHQRenderScript",(function(e,n,t){f.debug("Receive HQRenderScript: "+t),(0,S.JB)("signalr: server HQS received",{chars:t?t.length:0}),i.plannerHandler3D.onReceiveHQRenderScript(n,t)})),this.renderSettings=e,this.connectionStarted=!1,this.successfullyLoggedIn=!1,this.successfullyJoinedDivaNr=!1,this.connectionErrorCount=0,this.reconnectAfterError=!1,this.lastJoinDivaNr="",this.doIgnoreOnClosed=!1,this.plannerHandler3D=n,this.sessionID="",this.reconnectingErrorCount=0}),[{key:"initializeConnection",value:(p=(0,t.Z)(c().mark((function _callee2(e){var n,i,r=this;return c().wrap((function _callee2$(e){for(;;)switch(e.prev=e.next){case 0:if(d.ZP.startSpanOfApm("Host3DSingalR initializeConnection"),(0,S.JB)("signalr: connect start",{retry:this.reconnectingErrorCount}),!(this.reconnectingErrorCount>0)){e.next=5;break}return e.next=5,this.delay(100);case 5:if(!this.isClosed){e.next=7;break}return e.abrupt("return");case 7:f.debug("Create SignalR connection with host: "+this.renderSettings.Diva3DServerURL+"; RenderGroup: "+this.renderSettings.RenderGroup),n=this,this.signalRConnection&&(this.doIgnoreOnClosed=!0,this.connectionStarted=!1,this.successfullyLoggedIn=!1,this.successfullyJoinedDivaNr=!1,this.signalRConnection.stop().catch((function(){})),this.signalRConnection=null),0==("undefined"==typeof window||window).DIVA_LOGGER?this.signalRConnection=(new l.s).withUrl(this.renderSettings.Diva3DServerURL).withHubProtocol(new v.e).build():this.signalRConnection=(new l.s).withUrl(this.renderSettings.Diva3DServerURL).withHubProtocol(new v.e).configureLogging(u.i.None).build(),i=this.signalRConnection,this.signalRConnection.on("UnvalidSessionID",this.unvalidSessionID),this.signalRConnection.on("noRenderClientFound",this.noRenderClientFound),this.signalRConnection.on("newRendering",this.newRendering),this.signalRConnection.on("newHQRenderScript",this.newHQRenderScript),this.signalRConnection.start().then((function(){i===n.signalRConnection&&(d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),(0,S.JB)("signalr: connected"),n.connectionStarted=!0,n.doIgnoreOnClosed=!1,n.reconnectAfterError?f.debug("SignalR Connection to 3DHost: "+r.renderSettings.Diva3DServerURL+" sucessfully reconnected","initSignalRConnection"):f.debug("SignalR Connection to 3DHost: "+n.renderSettings.Diva3DServerURL+" sucessfully started","initSignalRConnection"),n.reconnectingErrorCount=0,n.login())})).catch((function(e){i===n.signalRConnection&&(d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),f.error(new d.GE("Connection error. Message: "+e.toString(),{code:"WC_0014"})),n.connectionStarted=!1,n.successfullyLoggedIn&&n.successfullyJoinedDivaNr||(n.reconnectingErrorCount++,n.reconnectingErrorCount<5&&n.initializeConnection()))})),this.signalRConnection.onclose((0,t.Z)(c().mark((function _callee(){return c().wrap((function _callee$(e){for(;;)switch(e.prev=e.next){case 0:if(i===r.signalRConnection){e.next=2;break}return e.abrupt("return");case 2:if(d.ZP.endSpanOfApm("PlannerHandler3D initSignalRConnection"),f.warn("Connection with 3D Host gets lost. Try to reconnect.","WC_0014"),n.connectionStarted=!1,r.successfullyLoggedIn=!1,r.successfullyJoinedDivaNr=!1,!r.doIgnoreOnClosed){e.next=9;break}return e.abrupt("return");case 9:r.reconnectAfterError=!0,n.initializeConnection();case 11:case"end":return e.stop()}}),_callee)}))));case 18:case"end":return e.stop()}}),_callee2,this)}))),function initializeConnection(e){return p.apply(this,arguments)})},{key:"delay",value:function delay(e){return new Promise((function(n){return setTimeout(n,e)}))}},{key:"joinDivaNr",value:(D=(0,t.Z)(c().mark((function _callee3(e){return c().wrap((function _callee3$(n){for(;;)switch(n.prev=n.next){case 0:if(!this.reconnectAfterError&&this.lastJoinDivaNr==e){n.next=4;break}return n.next=3,this.join(e);case 3:this.reconnectAfterError=!1;case 4:case"end":return n.stop()}}),_callee3,this)}))),function joinDivaNr(e){return D.apply(this,arguments)})},{key:"getSuccessfullyJoinedToDivaNr",value:function getSuccessfullyJoinedToDivaNr(){return this.successfullyJoinedDivaNr}},{key:"getViewPointInfo",value:(a=(0,t.Z)(c().mark((function _callee4(e,n){var i;return c().wrap((function _callee4$(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.signalRConnection.invoke("GetVPInfo",this.sessionID,n,e);case 3:return i=t.sent,t.abrupt("return",i);case 7:t.prev=7,t.t0=t.catch(0),f.error(new d.GE("DoUpdate 3D Host",{code:"WC_0014"}));case 10:case"end":return t.stop()}}),_callee4,this,[[0,7]])}))),function getViewPointInfo(e,n){return a.apply(this,arguments)})},{key:"getConnectionReady",value:function getConnectionReady(){return this.connectionIsReady()}},{key:"getStaticRoomListInfo",value:(i=(0,t.Z)(c().mark((function _callee5(e){var n;return c().wrap((function _callee5$(i){for(;;)switch(i.prev=i.next){case 0:return this.connectionIsReady()||(n=this,setTimeout((function(){return n.getStaticRoomListInfo(e)}),400)),f.debug("DIVA3D-HOST.SignaR POST GetFrontendRoomList - sessionID:"+this.sessionID),i.next=4,this.signalRConnection.invoke("GetFrontendRoomlist",this.sessionID,e);case 4:return i.abrupt("return",i.sent);case 5:case"end":return i.stop()}}),_callee5,this)}))),function getStaticRoomListInfo(e){return i.apply(this,arguments)})},{key:"request3D",value:function request3D(e){var n=this;if(this.connectionIsReady()&&this.successfullyJoinedDivaNr){var i,t,r,o,s,a,c,d,l,u,g,v,S,D=void 0,p=void 0;if(null!=e&&e.doRequestRendering)(D=new h.Z(e.planningHash,e.renderHash,null===(t=e.requestRenderingParams)||void 0===t?void 0:t.viewPointName,null===(r=e.requestRenderingParams)||void 0===r?void 0:r.width,null===(o=e.requestRenderingParams)||void 0===o?void 0:o.height,null===(s=e.requestRenderingParams)||void 0===s?void 0:s.isFullscreenRendering,null===(a=e.requestRenderingParams)||void 0===a?void 0:a.hasDimensionLines,null===(c=e.requestRenderingParams)||void 0===c?void 0:c.plannerMeasureDigits,!(null===(d=e.requestRenderingParams)||void 0===d||!d.viewPointInfo)&&e.requestRenderingParams.viewPointInfo.isStatic,null===(l=e.requestRenderingParams)||void 0===l?void 0:l.mediaServiceSaveMode,null===(u=e.requestRenderingParams)||void 0===u?void 0:u.alternateRenderingsExist,null===(g=e.requestRenderingParams)||void 0===g?void 0:g.alternateRenderInfo)).CatalogCodex=null===(v=e.requestRenderingParams)||void 0===v?void 0:v.catalogData.catalogCodex,D.CatalogGUID=null===(S=e.requestRenderingParams)||void 0===S?void 0:S.catalogData.catalogGUID;e.doRequestHqRenderScript&&(p=new R.Z(e.planningHash));var C=this.create3DHostRequestOption(e);return f.debug("request 3D (mediaType "+(null===(i=e.requestRenderingParams)||void 0===i?void 0:i.mediaServiceSaveMode)+") from 3D Host"+JSON.stringify(e)),e.doReloadWholePlanning?(f.debug("Host3DSignalR SaveProjectWithOptions"),this.signalRConnection.invoke("SaveProjectWithOptions",this.sessionID,e.divaNr,JSON.stringify(e.planningData),this.renderSettings.RenderGroup,JSON.stringify(C))):this.signalRConnection.invoke("RequestRenderingWithOptions",this.sessionID,e.divaNr,C.VPName,C.VPSize,e.renderHash,JSON.stringify(C)),{rendering:D,hqRenderScript:p}}return e.doReloadWholePlanning=!0,setTimeout((function(){return n.request3D(e)}),300),{rendering:void 0,hqRenderScript:void 0}}},{key:"create3DHostRequestOption",value:function create3DHostRequestOption(e){var n,i,t,r,o,s,a,c,l,u,g,v,h,R,S,f,D=e.requestRenderingParams?e.requestRenderingParams.width+":"+e.requestRenderingParams.height:"",p=null!=e&&e.doRequestRendering?"STREAM"==(null===(n=e.requestRenderingParams)||void 0===n?void 0:n.mediaServiceSaveMode)?0:"PERMANENT"==(null===(i=e.requestRenderingParams)||void 0===i?void 0:i.mediaServiceSaveMode)?1:-1:-1,C="";e.requestRenderingParams&&e.requestRenderingParams.functionType&&(C=e.requestRenderingParams.functionType);if(null!=e&&e.doRequestRendering&&null!==(t=e.requestRenderingParams)&&void 0!==t&&t.articleCodices){"[";for(var P=0;P<e.requestRenderingParams.articleCodices.length;P++)'"'+e.requestRenderingParams.articleCodices[P]+'"'+(P<e.requestRenderingParams.articleCodices.length-1?",":"");"]"}return{rendering:null==e?void 0:e.doRequestRendering,hqrenderscript:e.doRequestHqRenderScript,VPName:null!==(r=null===(o=e.requestRenderingParams)||void 0===o?void 0:o.viewPointName)&&void 0!==r?r:"",VPSize:D,VPFilename:e.renderHash,PlanningHash:e.planningHash,RenderHash:e.renderHash,plannerMeasureDigits:null!==(s=null===(a=e.requestRenderingParams)||void 0===a?void 0:a.plannerMeasureDigits)&&void 0!==s?s:0,Format:"JPG",BG:"",MSSM:p,OrgId:this.renderSettings.OrganizationId,FunctionType:C,CatalogCodex:null!==(c=null===(l=e.requestRenderingParams)||void 0===l?void 0:l.catalogData.catalogCodex)&&void 0!==c?c:"",CatalogGuid:null!==(u=null===(g=e.requestRenderingParams)||void 0===g?void 0:g.catalogData.catalogGUID)&&void 0!==u?u:"",ArticleCodices:null!==(v=null===(h=e.requestRenderingParams)||void 0===h?void 0:h.articleCodices)&&void 0!==v?v:[],UserSessionId:d.ZP.SessionId,v:null!==(R=null===(S=e.requestRenderingParams)||void 0===S?void 0:S.catalogData.catalogGUID)&&void 0!==R?R:"",hybrid3DInfo:null===(f=e.requestRenderingParams)||void 0===f?void 0:f.hybrid3DInfo}}},{key:"closeConnection",value:function closeConnection(){this.isClosed=!0,this.signalRConnection&&(this.doIgnoreOnClosed=!0,this.signalRConnection.invoke("LeaveWebClient").catch((function(){})),f.debug("SignalRConnection: Close Connection and say byby to Diva3DHost."),this.signalRConnection.stop().catch((function(){})),this.signalRConnection=null),this.divaMediaServiceSocketIO&&(f.debug("Closing DivaMediaService socket connection"),this.divaMediaServiceSocketIO.disconnect(),this.divaMediaServiceSocketIO=void 0)}},{key:"login",value:(n=(0,t.Z)(c().mark((function _callee6(){var e,n,i;return c().wrap((function _callee6$(t){for(;;)switch(t.prev=t.next){case 0:return f.debug("DIVA3D-HOST.SignaR POST Login - userID:"+this.renderSettings.UserID+", deviceID:"+this.renderSettings.DeviceID+", divaSessionID:"+this.renderSettings.DivaSessionID+", _Application:"+this.renderSettings.ApplicationName),d.ZP.startSpanOfApm("PlannerHandler3D login"),(0,S.JB)("signalr: LoginWebPlanner sent"),e=this.signalRConnection,t.prev=4,t.next=7,e.invoke("LoginWebPlanner",this.renderSettings.UserID,this.renderSettings.DeviceID,this.renderSettings.DivaSessionID,this.renderSettings.ApplicationName);case 7:if(n=t.sent,e===this.signalRConnection){t.next=10;break}return t.abrupt("return");case 10:(0,S.JB)("signalr: LoginWebPlanner acked",{ok:""!=n?1:0}),this.connectionErrorCount=0,""!=n?(this.successfullyLoggedIn=!0,f.debug("DIVA3D-HOST.SignaR Response ReturnLogin - sessionID: "+n),this.sessionID=n,this.plannerHandler3D.onConnectionInitialized({status:"SUCCESSFULL"})):this.plannerHandler3D.onConnectionInitialized({status:"ERROR"}),t.next=22;break;case 15:if(t.prev=15,t.t0=t.catch(4),e===this.signalRConnection){t.next=19;break}return t.abrupt("return");case 19:d.ZP.endSpanOfApm("PlannerHandler3D login"),i=this,this.handleConnectionError(t.t0,(function(){i.login()}));case 22:case"end":return t.stop()}}),_callee6,this,[[4,15]])}))),function login(){return n.apply(this,arguments)})},{key:"join",value:(e=(0,t.Z)(c().mark((function _callee7(e){var n,i;return c().wrap((function _callee7$(t){for(;;)switch(t.prev=t.next){case 0:if(""!=e){t.next=2;break}return t.abrupt("return");case 2:if(this.lastJoinDivaNr!=e&&this.openSocketToMediaService(e),n=this,this.connectionIsReady()){t.next=8;break}setTimeout((function(){n.join(e)}),200),t.next=25;break;case 8:return this.lastJoinDivaNr=e,d.ZP.startSpanOfApm("PlannerHandler3D join"),f.debug("PlannerHandler3D SignalR - Join DivaNr to connected host: "+e),(0,S.JB)("signalr: JoinWebPlanner sent"),t.prev=12,t.next=15,this.signalRConnection.invoke("JoinWebPlanner",this.sessionID,e);case 15:i=t.sent,d.ZP.endSpanOfApm("PlannerHandler3D join"),(0,S.JB)("signalr: JoinWebPlanner acked",{ok:i?1:0}),i?(this.successfullyJoinedDivaNr=!0,this.plannerHandler3D.onConnectedToDivaNr("SUCCESSFULL"),f.debug("Return Join - Join successfull.")):this.join(e),this.connectionErrorCount=0,t.next=25;break;case 22:t.prev=22,t.t0=t.catch(12),this.handleConnectionError(t.t0,(function(){n.join(e)}));case 25:case"end":return t.stop()}}),_callee7,this,[[12,22]])}))),function join(n){return e.apply(this,arguments)})},{key:"handleConnectionError",value:function handleConnectionError(e,n){this.connectionErrorCount++,4==this.connectionErrorCount?f.debug("SignalR Error. not possible to establish SignalR connection."):f.debug("SignalR Error. Message: "+e.message)}},{key:"connectionIsReady",value:function connectionIsReady(){return this.connectionStarted&&this.successfullyLoggedIn}},{key:"unvalidSessionID",value:function unvalidSessionID(e,n){f.debug("DIVA3D-HOST.SignaR Response Unvalid SessionID"),this.successfullyLoggedIn=!1}}]);var e,n,i,a,D,p}()}}]);