{"version":3,"sources":["../js/AiVision.js"],"names":["g_oAiVision","AiVision","this","g_ePackCopyProcessStatus","Initial","Processing","Success","Failure","g_bAiVisionAnimating","g_bPackCopyProcessing","g_iStatusPollTimeMilliseconds","g_iAnnotationLoadTimeMilliseconds","prototype","processPackCopy","g_oViewer","g_oCompareMode","eCompareMode","NoCompare","iApprovalId","comboControl_GetApprovalIdByControlId","iSnapdragonTagSetId","parseInt","$","val","szAiModel","isNaN","g_oGreenlightMessages","displayErrorBubble","trim","length","oJSON","GreenlightApprovalId","SnapdragonTagSetId","AiModel","startPackCopyProcessing","post","url","data","JSON","stringify","contentType","dataType","cache","success","oResponse","Contents","Result","PackCopyProcessId","pollPackCopyProcessing","endPackCopyProcessing","failure","error","toggleAiVisionMenu","g_oProgressBar","addProgressBar","iPackCopyProcessId","setTimeout","Approval","DocChangeEvent","refreshSnapdragonData","g_oAnnotations","redrawAnnotations","g_oArtworkViewer","g_oAnnotationViewer","message","removeProgressBar","displaySuccessBubble","DocumentId","g_oDoc","documentId","g_oAnnotationTextClassification","g_oSnapdragonData","showTextClassificationAnnotationType","downloadGS1XML","ApprovalId","GS1XMLUrl","window","open","css","width","show","animate","right","hide","document","on","event","target","parents","id"],"mappings":"AAaA,IAAIA,YAAc,IAEjB,WACA,aAKA,SAASC,WAGRC,KAAKC,yBAA2B,CAC/BC,QAAS,EACTC,WAAY,EACZC,QAAS,EACTC,QAAS,GAIVL,KAAKM,sBAAuB,EAG5BN,KAAKO,uBAAwB,EAG7BP,KAAKQ,8BAAgC,IAGrCR,KAAKS,kCAAoC,IAM1CV,SAASW,UAAUC,gBAAkB,WAGpC,GAAIC,UAAUC,gBAAkBC,aAAaC,UAA7C,CAMA,IAAIC,YAAcC,sCAAsC,4BACpDC,oBAAsBC,SAASC,EAAE,0CAA0CC,OAC3EC,UAAYF,EAAE,+BAA+BC,MAGjD,GAAmB,GAAfL,YAMJ,GAAIO,MAAML,sBAAwBA,qBAAuB,EACxDM,sBAAsBC,mBAAmB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AGlBS,eAAeY,oBAGXrB,UAAUtC,SAAWsC,UAAUC,SAAS8B,WAAmD,EAAtC/B,UAAUC,SAAS8B,UAAU9C,OACrF+C,OAAOC,KAAKjC,UAAUC,SAAS8B,UAAW,UAG1CjD,sBAAsBC,mBAAmB,yCAG3CuB,QAAS,WACRxB,sBAAsBC,mBAAmB,wCACzC0B,eAAeY,qBAEhBd,MAAO,WACNzB,sBAAsBC,mBAAmB,wCACzC0B,eAAeY,4BAvChBvC,sBAAsBC,mBAAmB,6FANzCD,sBAAsBC,mBAAmB,mEAqD3C1B,SAASW,UAAUwC,mBAAqB,WAGlCpD,YAAYQ,uBAGhBR,YAAYQ,sBAAuB,EAGK,QAApCc,EAAE,gBAAgBwD,IAAI,YAGzBxD,EAAE,gBAAgBwD,IAAI,QAAS,EAAMxD,EAAE,gBAAgByD,SAGvDzD,EAAE,gBAAgB0D,OAGlB1D,EAAE,gBAAgB2D,QAAQ,CACzBC,MAAO,GACL,QAAS,WAGXlF,YAAYQ,sBAAuB,KAOpCc,EAAE,gBAAgB2D,QAAQ,CACzBC,MAAO,EAAM5D,EAAE,gBAAgByD,SAC7B,QAAS,WAGXzD,EAAE,gBAAgB6D,OAGlBnF,YAAYQ,sBAAuB,MASvCc,EAAE8D,UAAUC,GAAG,QAAS,SAAUC,OAG5BtF,YAAYQ,sBAA4D,QAApCc,EAAE,gBAAgBwD,IAAI,YAGR,GAAlDxD,EAAEgE,MAAMC,QAAQC,QAAQ,gBAAgB3D,QAAkC,eAAnByD,MAAMC,OAAOE,IAGvEzF,YAAYoD,uBAQfwB,OAAO3E,SAAWA,SAnXnB","file":"AiVision-48024f34bc.js","sourcesContent":["/*\r\n* Copyright (c) 2024 SGS Europe. All rights reserved.\r\n*\r\n* This program is the CONFIDENTIAL and PROPRIETARY property of SGS Europe.\r\n* Any unauthorised use, reproduction, or transfer of this program is strictly\r\n* prohibited.\r\n*\r\n* File Name: AiVision.js\r\n*\r\n* Description: JavaScript code for AiVision module.\r\n*\r\n*/\r\n\r\nvar g_oAiVision = {};\r\n\r\n(function () {\r\n\t\"use strict\";\r\n\r\n\t/**\r\n\t * Create the AiVision object.\r\n\t */\r\n\tfunction AiVision() {\r\n\r\n\t\t// The Checklist Item State enum.\r\n\t\tthis.g_ePackCopyProcessStatus = {\r\n\t\t\tInitial: 0,\r\n\t\t\tProcessing: 1,\r\n\t\t\tSuccess: 2,\r\n\t\t\tFailure: 3\r\n\t\t};\r\n\r\n\t\t// If the ai vision menu is in animation.\r\n\t\tthis.g_bAiVisionAnimating = false;\r\n\r\n\t\t// If the pack copy call is currently processing.\r\n\t\tthis.g_bPackCopyProcessing = false;\r\n\r\n\t\t// The status poll time in milliseconds.\r\n\t\tthis.g_iStatusPollTimeMilliseconds = 1000;\r\n\r\n\t\t// The annotation load time in milliseconds.\r\n\t\tthis.g_iAnnotationLoadTimeMilliseconds = 3000;\r\n\t}\r\n\r\n\t/**\r\n\t * Processes a pack copy.\r\n\t */\r\n\tAiVision.prototype.processPackCopy = function () {\r\n\r\n\t\t// Ensure we are not in a compare mode.\r\n\t\tif (g_oViewer.g_oCompareMode != eCompareMode.NoCompare) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Please exit compare mode before processing a pack copy.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Extract the approval id, snapdragon tag set id and ai model to be used.\r\n\t\tvar iApprovalId = comboControl_GetApprovalIdByControlId(\"approvalNameComboControl\");\r\n\t\tvar iSnapdragonTagSetId = parseInt($(\"#txtProcessPackCopy_SnapdragonTagSetId\").val());\r\n\t\tvar szAiModel = $(\"#txtProcessPackCopy_AiModel\").val();\r\n\r\n\t\t// Ensure we have a valid approval.\r\n\t\tif (iApprovalId == 0) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Please provide a document with an active approval.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Ensure we have provided a valid snapdragon tag set id.\r\n\t\tif (isNaN(iSnapdragonTagSetId) || iSnapdragonTagSetId <= 0) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Please provide a valid Snapdragon Tag Set Id.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Ensure we have provided a valid ai model.\r\n\t\tif (szAiModel.trim().length == 0) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Please provide a valid AI Model.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Build up the ai vision request to be sent.\r\n\t\tvar oJSON = {\r\n\t\t\tGreenlightApprovalId: iApprovalId,\r\n\t\t\tSnapdragonTagSetId: iSnapdragonTagSetId,\r\n\t\t\tAiModel: szAiModel\r\n\t\t};\r\n\r\n\t\t// Start the pack copy processing.\r\n\t\tg_oAiVision.startPackCopyProcessing();\r\n\r\n\t\t// Call to check for approval annotations.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightAiVision/ProcessPackCopyRequest\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse) {\r\n\r\n\t\t\t\t// Determine the success of the call.\r\n\t\t\t\tif (oResponse.Success && oResponse.Contents.Result && parseInt(oResponse.Contents.PackCopyProcessId) > 0) {\r\n\t\t\t\t\tg_oAiVision.pollPackCopyProcessing(parseInt(oResponse.Contents.PackCopyProcessId));\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to process document with AI Vision.\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfailure: function () {\r\n\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to process document with AI Vision.\");\r\n\t\t\t},\r\n\t\t\terror: function () {\r\n\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to process document with AI Vision.\");\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Starts the pack copy processing interface.\r\n\t */\r\n\tAiVision.prototype.startPackCopyProcessing = function () {\r\n\r\n\t\t// Close the menu.\r\n\t\tg_oAiVision.toggleAiVisionMenu();\r\n\r\n\t\t// Set that the pack copy is processing.\r\n\t\tg_oAiVision.g_bPackCopyProcessing = true;\r\n\r\n\t\t// Lock the screen.\r\n\t\tg_oProgressBar.addProgressBar(\"Processing Pack Copy\", false);\r\n\t};\r\n\r\n\t/**\r\n\t * Polls the pack copy processing interface.\r\n\t */\r\n\tAiVision.prototype.pollPackCopyProcessing = function (iPackCopyProcessId) {\r\n\r\n\t\t// Ensure we are still procesing.\r\n\t\tif (!g_oAiVision.g_bPackCopyProcessing) {\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Build up the status request to be sent.\r\n\t\tvar oJSON = {\r\n\t\t\tPackCopyProcessId: iPackCopyProcessId\r\n\t\t};\r\n\r\n\t\t// Call to check for approval annotations.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightAiVision/GetPackCopyProcessStatus\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse) {\r\n\r\n\t\t\t\t// Determine the success of the call.\r\n\t\t\t\tif (oResponse.Success && parseInt(oResponse.Contents) > 0) {\r\n\r\n\t\t\t\t\t// Determine the status of the pack copy process.\r\n\t\t\t\t\tswitch (parseInt(oResponse.Contents)) {\r\n\r\n\t\t\t\t\t\t// Processing, poll again.\r\n\t\t\t\t\t\tcase g_oAiVision.g_ePackCopyProcessStatus.Processing:\r\n\t\t\t\t\t\t\tsetTimeout(function () { g_oAiVision.pollPackCopyProcessing(iPackCopyProcessId); }, g_oAiVision.g_iStatusPollTimeMilliseconds);\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t// Success, end the pack copy processing.\r\n\t\t\t\t\t\tcase g_oAiVision.g_ePackCopyProcessStatus.Success:\r\n\r\n\t\t\t\t\t\t\t// Load any new annotations made by the pack copy process.\r\n\t\t\t\t\t\t\tApproval.DocChangeEvent();\r\n\r\n\t\t\t\t\t\t\t// Refresh the Snapdragon data.\r\n\t\t\t\t\t\t\tg_oAiVision.refreshSnapdragonData();\r\n\r\n\t\t\t\t\t\t\t// End the pack copy processing.\r\n\t\t\t\t\t\t\tsetTimeout(function () {\r\n\t\t\t\t\t\t\t\tg_oAnnotations.redrawAnnotations(g_oViewer.g_oArtworkViewer, g_oViewer.g_oAnnotationViewer);\r\n\t\t\t\t\t\t\t\tg_oAiVision.endPackCopyProcessing(true, \"Document processed as pack copy.\");\r\n\t\t\t\t\t\t\t}, g_oAiVision.g_iAnnotationLoadTimeMilliseconds);\r\n\t\t\t\t\t\t\tbreak;\r\n\r\n\t\t\t\t\t\t// Initial or Failure, end the pack copy processing.\r\n\t\t\t\t\t\tcase g_oAiVision.g_ePackCopyProcessStatus.Initial:\r\n\t\t\t\t\t\tcase g_oAiVision.g_ePackCopyProcessStatus.Failure:\r\n\t\t\t\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to process the document as a pack copy.\");\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to get the status of the pack copy process.\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfailure: function () {\r\n\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to get the status of the pack copy process.\");\r\n\t\t\t},\r\n\t\t\terror: function () {\r\n\t\t\t\tg_oAiVision.endPackCopyProcessing(false, \"Failed to get the status of the pack copy process.\");\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Ends the pack copy processing interface.\r\n\t */\r\n\tAiVision.prototype.endPackCopyProcessing = function (success, message) {\r\n\r\n\t\t// Unlock the screen.\r\n\t\tg_oProgressBar.removeProgressBar();\r\n\r\n\t\t// Set that the pack copy is no longer processing.\r\n\t\tg_oAiVision.g_bPackCopyProcessing = false;\r\n\r\n\t\t// Display any messages.\r\n\t\tif (success && message.length > 0) {\r\n\t\t\tg_oGreenlightMessages.displaySuccessBubble(message);\r\n\t\t}\r\n\t\telse if (!success && message.length > 0) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(message);\r\n\t\t}\r\n\t};\r\n\r\n\t/**\r\n\t * Refreshes the snapdragon data.\r\n\t */\r\n\tAiVision.prototype.refreshSnapdragonData = function () {\r\n\r\n\t\t// Build up the request to be sent.\r\n\t\tvar oJSON = {\r\n\t\t\tDocumentId: g_oViewer.g_oArtworkViewer.g_oDoc.documentId\r\n\t\t};\r\n\r\n\t\t// Call to update the snapdragon data.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightAiVision/GetPackCopySnapdragonData\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse) {\r\n\t\t\t\tif (oResponse.Success) {\r\n\r\n\t\t\t\t\t// Update the contents of the snapdragon data.\r\n\t\t\t\t\tg_oAnnotationTextClassification.g_oSnapdragonData = oResponse.Contents;\r\n\r\n\t\t\t\t\t// Show the text classification annotation type.\r\n\t\t\t\t\tg_oAnnotationTextClassification.showTextClassificationAnnotationType();\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to refresh the snapdragon data.\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfailure: function () {\r\n\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to refresh the snapdragon data.\");\r\n\t\t\t},\r\n\t\t\terror: function () {\r\n\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to refresh the snapdragon data.\");\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Downloads the GS1 XML for the pack copy.\r\n\t */\r\n\tAiVision.prototype.downloadGS1XML = function () {\r\n\r\n\t\t// Extract the approval id.\r\n\t\tvar iApprovalId = comboControl_GetApprovalIdByControlId(\"approvalNameComboControl\");\r\n\r\n\t\t// Ensure we have a valid approval.\r\n\t\tif (iApprovalId == 0) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to get the pack copy GS1 XML. Document has no approval.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Ensure we have snapdragon data to download.\r\n\t\tif (g_oAnnotationTextClassification.g_oSnapdragonData == null) {\r\n\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to get the pack copy GS1 XML. Document has not been processed as a pack copy.\");\r\n\t\t\treturn;\r\n\t\t}\r\n\r\n\t\t// Build up the ai vision request to be sent.\r\n\t\tvar oJSON = {\r\n\t\t\tApprovalId: iApprovalId\r\n\t\t};\r\n\r\n\t\t// Lock the pack screen.\r\n\t\tg_oAiVision.toggleAiVisionMenu();\r\n\t\tg_oProgressBar.addProgressBar(\"Downloading Pack Copy XML\", false);\r\n\r\n\t\t// Call to check for approval annotations.\r\n\t\t$.post({\r\n\t\t\turl: \"GreenlightAiVision/GetPackCopyGS1XML\",\r\n\t\t\tdata: JSON.stringify(oJSON),\r\n\t\t\tcontentType: \"application/json; charset=utf-8\",\r\n\t\t\tdataType: \"json\",\r\n\t\t\tcache: false,\r\n\t\t\tsuccess: function (oResponse) {\r\n\r\n\t\t\t\t// Unlock the screen.\r\n\t\t\t\tg_oProgressBar.removeProgressBar();\r\n\r\n\t\t\t\t// Determine the success of the call, opening the xml when successful.\r\n\t\t\t\tif (oResponse.Success && oResponse.Contents.GS1XMLUrl && oResponse.Contents.GS1XMLUrl.length > 0) {\r\n\t\t\t\t\twindow.open(oResponse.Contents.GS1XMLUrl, \"_blank\");\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to get the pack copy GS1 XML.\");\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tfailure: function () {\r\n\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to get the pack copy GS1 XML.\");\r\n\t\t\t\tg_oProgressBar.removeProgressBar();\r\n\t\t\t},\r\n\t\t\terror: function () {\r\n\t\t\t\tg_oGreenlightMessages.displayErrorBubble(\"Failed to get the pack copy GS1 XML.\");\r\n\t\t\t\tg_oProgressBar.removeProgressBar();\r\n\t\t\t}\r\n\t\t});\r\n\t};\r\n\r\n\t/**\r\n\t * Toggles the ai vision menu.\r\n\t */\r\n\tAiVision.prototype.toggleAiVisionMenu = function () {\r\n\r\n\t\t// If we are not already animating the ai vision menu.\r\n\t\tif (!g_oAiVision.g_bAiVisionAnimating) {\r\n\r\n\t\t\t// Set that the menu is currently animating.\r\n\t\t\tg_oAiVision.g_bAiVisionAnimating = true;\r\n\r\n\t\t\t// If the ai vision menu is currently shown.\r\n\t\t\tif ($(\"#divAiVision\").css(\"display\") == \"none\") {\r\n\r\n\t\t\t\t// Ensure the menu is just off screen.\r\n\t\t\t\t$(\"#divAiVision\").css(\"right\", 1 - + $(\"#divAiVision\").width());\r\n\r\n\t\t\t\t// Show the menu.\r\n\t\t\t\t$(\"#divAiVision\").show();\r\n\r\n\t\t\t\t// Slide the menu in from the right.\r\n\t\t\t\t$(\"#divAiVision\").animate({\r\n\t\t\t\t\tright: 7\r\n\t\t\t\t}, 'swing', function () {\r\n\r\n\t\t\t\t\t// Set that we are no longer animating.\r\n\t\t\t\t\tg_oAiVision.g_bAiVisionAnimating = false;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t// If the ai vision menu is currently not shown.\r\n\t\t\telse {\r\n\r\n\t\t\t\t// Slide the menu out to the right.\r\n\t\t\t\t$(\"#divAiVision\").animate({\r\n\t\t\t\t\tright: 1 - + $(\"#divAiVision\").width()\r\n\t\t\t\t}, 'swing', function () {\r\n\r\n\t\t\t\t\t// Hide the menu once the animation has finished.\r\n\t\t\t\t\t$(\"#divAiVision\").hide();\r\n\r\n\t\t\t\t\t// Set that we are no longer animating.\r\n\t\t\t\t\tg_oAiVision.g_bAiVisionAnimating = false;\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t};\r\n\r\n\t/*\r\n\t * Ai Vision Menu Auto Closing.\r\n\t */\r\n\t$(document).on('click', function (event) {\r\n\r\n\t\t// If we are not already animating the ai vision menu, the ai vision menu is curreny open, and we want to close the menu.\r\n\t\tif (!g_oAiVision.g_bAiVisionAnimating && $(\"#divAiVision\").css(\"display\") != \"none\") {\r\n\r\n\t\t\t// If the click is outside of ai vision menu.\r\n\t\t\tif ($(event.target).parents(\"#divAiVision\").length == 0 && event.target.id != \"divAiVision\") {\r\n\r\n\t\t\t\t// Close the menu.\r\n\t\t\t\tg_oAiVision.toggleAiVisionMenu();\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t/**\r\n\t * Add the AiVision object to the window.\r\n\t */\r\n\twindow.AiVision = AiVision;\r\n\r\n}());"]}