testaugnitosdk2 1.0.12

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.
Files changed (79) hide show
  1. package/README.md +442 -0
  2. package/dist/Augnito.d.ts +130 -0
  3. package/dist/AugnitoMobile.d.ts +13 -0
  4. package/dist/api/BaseAPI.d.ts +32 -0
  5. package/dist/api/FactoryAPI.d.ts +25 -0
  6. package/dist/api/Formatting/FormattingAPI.d.ts +15 -0
  7. package/dist/api/Formatting/FormattingModels.d.ts +29 -0
  8. package/dist/api/Macros/MacrosAPI.d.ts +28 -0
  9. package/dist/api/Macros/MacrosModels.d.ts +32 -0
  10. package/dist/api/MedicineOrdering/MedicineOrderderingData.d.ts +6 -0
  11. package/dist/api/MedicineOrdering/MedicineOrderingAPI.d.ts +15 -0
  12. package/dist/api/MedicineOrdering/MedicineOrderingModels.d.ts +26 -0
  13. package/dist/api/Vocabulary/VocabularyAPI.d.ts +31 -0
  14. package/dist/api/Vocabulary/VocabularyModels.d.ts +38 -0
  15. package/dist/api/index.d.ts +9 -0
  16. package/dist/augnitosdk.js +11067 -0
  17. package/dist/client/MobileClient.d.ts +17 -0
  18. package/dist/client/NotificationClient.d.ts +25 -0
  19. package/dist/client/PhilipsMicClient.d.ts +17 -0
  20. package/dist/client/WebClient.d.ts +59 -0
  21. package/dist/commands/AugnitoCommands.d.ts +93 -0
  22. package/dist/commands/AugnitoCommandsRegex.d.ts +9 -0
  23. package/dist/commands/AugnitoCommandsStatic.d.ts +6 -0
  24. package/dist/commands/AugnitoCustomCommands.d.ts +8 -0
  25. package/dist/commands/index.d.ts +1 -0
  26. package/dist/commands/utils/CustomCommandModel.d.ts +5 -0
  27. package/dist/commands/utils/TextToWordInteger.d.ts +5 -0
  28. package/dist/config/AugnitoConfig.d.ts +113 -0
  29. package/dist/config/AugnitoFormattingConfig.d.ts +10 -0
  30. package/dist/config/AugnitoMobileConfig.d.ts +7 -0
  31. package/dist/config/AugnitoVocabularyConfig.d.ts +10 -0
  32. package/dist/config/ConfigValidator.d.ts +15 -0
  33. package/dist/config/IConfiguration .d.ts +35 -0
  34. package/dist/config/PhilipsMicConfig.d.ts +8 -0
  35. package/dist/config/SDKConfig.d.ts +40 -0
  36. package/dist/config/SDKConfigMobile.d.ts +21 -0
  37. package/dist/config/index.d.ts +4 -0
  38. package/dist/index.d.ts +10 -0
  39. package/dist/index.js +188 -0
  40. package/dist/interop/core/CommonEditorUtils.d.ts +10 -0
  41. package/dist/interop/core/EditorHandler.d.ts +35 -0
  42. package/dist/interop/core/EditorType.d.ts +8 -0
  43. package/dist/interop/core/PhilipsMicMode.d.ts +6 -0
  44. package/dist/interop/core/ProcessorFactory.d.ts +9 -0
  45. package/dist/interop/core/ProcessorHandler.d.ts +35 -0
  46. package/dist/interop/core/RichEditClientCommand.d.ts +416 -0
  47. package/dist/interop/core/TargetEditor.d.ts +7 -0
  48. package/dist/interop/index.d.ts +3 -0
  49. package/dist/interop/processors/BaseInteropProcessor.d.ts +10 -0
  50. package/dist/interop/processors/CKEditor4InteropProcessor.d.ts +14 -0
  51. package/dist/interop/processors/CKEditor5InteropProcessor.d.ts +17 -0
  52. package/dist/interop/processors/CommonContentEditableProcessor.d.ts +63 -0
  53. package/dist/interop/processors/DevExpressRichEditProcessor.d.ts +14 -0
  54. package/dist/interop/processors/GenericInteropProcessor.d.ts +11 -0
  55. package/dist/interop/processors/HTMLInteropProcessor.d.ts +41 -0
  56. package/dist/interop/processors/InteropProcessor.d.ts +11 -0
  57. package/dist/interop/processors/InteropProcessorCommon.d.ts +21 -0
  58. package/dist/interop/types/AnchoredEditorData.d.ts +4 -0
  59. package/dist/interop/types/CKEditorExtensions.d.ts +8 -0
  60. package/dist/interop/types/CommonTypes.d.ts +27 -0
  61. package/dist/interop/types/DynamicBadge.d.ts +5 -0
  62. package/dist/interop/types/DynamicSelect.d.ts +14 -0
  63. package/dist/recipe/ActionRecipe.d.ts +19 -0
  64. package/dist/recipe/index.d.ts +1 -0
  65. package/dist/support/AugnitoMobileSocketResponse.d.ts +19 -0
  66. package/dist/support/AugnitoNotificationMessage.d.ts +9 -0
  67. package/dist/support/AugnitoSDKErrorMessage.d.ts +7 -0
  68. package/dist/support/AugnitoSDKErrors.d.ts +7 -0
  69. package/dist/support/AugnitoSDKEvent.d.ts +11 -0
  70. package/dist/support/AugnitoServerStatusCode.d.ts +7 -0
  71. package/dist/support/AugnitoSocketResponse.d.ts +17 -0
  72. package/dist/support/AugnitoSource.d.ts +17 -0
  73. package/dist/support/AugnitoStatus.d.ts +27 -0
  74. package/dist/utils/AugnitoDomainUtils.d.ts +8 -0
  75. package/dist/utils/AugnitoUtils.d.ts +11 -0
  76. package/dist/utils/Guard.d.ts +11 -0
  77. package/dist/utils/Logger.d.ts +6 -0
  78. package/dist/utils/RichEditAction.d.ts +11 -0
  79. package/package.json +79 -0
package/dist/index.js ADDED
@@ -0,0 +1,188 @@
1
+ var e,t,n,o,r;!function(e){e[e.ERR_NETWORK=1]="ERR_NETWORK",e[e.ERR_AUDIO=2]="ERR_AUDIO",e[e.ERR_SERVER=3]="ERR_SERVER",e[e.ERR_CLIENT=4]="ERR_CLIENT"}(e||(e={})),function(e){e[e.WS_CONNECTING=1]="WS_CONNECTING",e[e.MSG_MEDIA_STREAM_CREATED=2]="MSG_MEDIA_STREAM_CREATED",e[e.MSG_INIT_RECORDER=3]="MSG_INIT_RECORDER",e[e.MSG_RECORDING=4]="MSG_RECORDING",e[e.MSG_SEND_EMPTY=6]="MSG_SEND_EMPTY",e[e.MSG_WEB_SOCKET_OPEN=9]="MSG_WEB_SOCKET_OPEN",e[e.MSG_WEB_SOCKET_CLOSE=10]="MSG_WEB_SOCKET_CLOSE",e[e.MSG_STOP=11]="MSG_STOP"}(t||(t={})),function(e){e[e.WEB_APP=0]="WEB_APP",e[e.MOBILE_APP=1]="MOBILE_APP"}(n||(n={}));class a{static log(e,t){const n=null!=t?t:this.defaultTag;console.log(`${n}:`,e)}static error(e,t){const n=null!=t?t:this.defaultTag;console.error(`${n}:`,e)}}Object.defineProperty(a,"defaultTag",{enumerable:!0,configurable:!0,writable:!0,value:"AugnitoSDK"}),function(e){e.ON="On",e.OFF="Off",e.REQUEST_OFF="RequestOff",e.KEY="AugnitoConnectionStatus"}(o||(o={}));class s{constructor(e){Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"WebClient"}),Object.defineProperty(this,"_speechSocket",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_isConnecting",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._config=e}isConnecting(){return this._isConnecting}get connected(){return null!==this._speechSocket&&this._speechSocket.readyState===WebSocket.OPEN}getConfig(){return this._config}toggleListening(){this._isConnecting||(this._speechSocket?this.stopListening(!0):this.startListening(this._config.prepareSpeechURL(),n.WEB_APP))}startListening(n,i){if(!this._isConnecting)if(localStorage.getItem(o.KEY)!==o.ON)try{this._isConnecting=!0,this._config.source=i,this._speechSocket&&this.closeWebSocket(),this.onEvent(t.WS_CONNECTING,"Connecting ..."),this.createWebSocket(n)}catch(t){this.onError(e.ERR_AUDIO,"unable to start listening")}else this.onMicrophoneOnError()}stopListening(e){this._isConnecting||(this.clearAll(),e&&this.onEndOfSession(),this._isConnecting=!1)}dispose(){this.stopListening(!1)}createWebSocket(n){this._speechSocket=new WebSocket(n),this._speechSocket.onmessage=t=>{try{const n=JSON.parse(t.data);if(0!==n.Status&&this.onError(e.ERR_SERVER,`Server error: ${n.Status}`),"meta"===n.Type)return void this.onSessionEvent(n);n.Result.Final?this.onSocketFinalResult(n):this.onSocketPartialResult(n.Result)}catch(t){this.onError(e.ERR_SERVER,"invalid response")}},this._speechSocket.onopen=e=>{this.onReadyForSpeech(),this.onEvent(t.MSG_WEB_SOCKET_OPEN,e.toString()),this._isConnecting=!1},this._speechSocket.onclose=({code:e,reason:n,wasClean:i})=>{this.clearAll(),this.onEndOfSession(),this.onEvent(t.MSG_WEB_SOCKET_CLOSE,`${e}/${n}/${i}`),this._isConnecting=!1},this._speechSocket.onerror=t=>{this.clearAll(),this.onError(e.ERR_NETWORK,t.toString()),this.onEndOfSession(),this._isConnecting=!1}}clearAll(){this._speechSocket&&localStorage.setItem(o.KEY,o.OFF),this.closeWebSocket()}closeWebSocket(){if(this._speechSocket)try{this._speechSocket.close(),this._speechSocket=null}catch(t){this.onError(e.ERR_NETWORK,"unable to close socket")}}onPartialText(e){this._config.onSocketPartialResult&&this._config.onSocketPartialResult(e)}onEvent(e,t){this._config.enableLogs&&a.log({type:"AugnitoSDKEvent",data:t},this._logTag),this._config.onEvent&&this._config.onEvent(e,t)}onError(e,t){this._config.enableLogs&&a.error({type:"onError",error:e,data:t},this._logTag),this._config.onError&&this._config.onError(t)}onSocketPartialResult(e){this._config.enableLogs&&a.log({type:"onSocketPartialResult",data:e},this._logTag),this.onPartialText(e.Transcript)}onSocketFinalResult(e){this._config.enableLogs&&a.log({type:"onSocketFinalResult",data:e},this._logTag),this._config.onSocketFinalResult&&this._config.onSocketFinalResult(e)}onSessionEvent(e){this._config.enableLogs&&a.log({type:"onSessionEvent",data:e},this._logTag),this._config.onSessionEvent&&this._config.onSessionEvent(e)}onEndOfSession(){this._config.onEndOfSession&&this._config.onEndOfSession(!1)}onReadyForSpeech(){this._config.onReadyForSpeech&&this._config.onReadyForSpeech(!0)}onMicrophoneOnError(){this._config.onMicrophoneOnError&&this._config.onMicrophoneOnError(!0)}}class l{constructor(e,t){Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_notificationClient",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"MobileClient"}),Object.defineProperty(this,"onConnectionRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onMobileScan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._notificationClient.ensureNotificationClientConnected(),this._notificationClient.onMobileScan=this.onMobileScanCallback.bind(this),this._notificationClient.onConnectionRequest=this.onConnectionRequestCallback.bind(this)}dispose(){this._notificationClient.dispose()}onMobileScanCallback(){this.onMobileScan&&this.onMobileScan()}onConnectionRequestCallback(e){this.createWebSocketForMobileMic(e),this.onConnectionRequest&&this.onConnectionRequest()}createWebSocketForMobileMic(e){if(this._notificationClient)return localStorage.getItem(o.KEY)===o.ON?(this._notificationClient.Send(this._notificationClient.getReplyMessage(e,"DEVICE_ALREADY_IN_USE")),this._config.onMicrophoneOnError&&this._config.onMicrophoneOnError(!1),void a.error("Device already in use",this._logTag)):void(this._config.userTag===e.Data.UserTag?this._config.startListening(e):this._notificationClient.Send(this._notificationClient.getReplyMessage(e,"DIFFERENT_LOGIN_USER")));a.error("Unable to create socket for mobile mic: pushNotificationSocket not created",this._logTag)}stopMobileListening(){this._config.stopListening()}}!function(e){e.BOLD_IT="boldit",e.UN_BOLD_IT="unboldit",e.UNDERLINE_IT="underlineit",e.ITALICIZE_IT="italicizeit",e.UNITALICIZE_IT="unitalicizeit",e.COPY_IT="copyit",e.CUT_IT="cutit",e.PASTE_IT="pasteit",e.PRESS_DELETE="pressdelete",e.HEADER_IT="headerit",e.CAPITALIZED_IT="capitalizeit",e.UN_CAPITALIZED_IT="uncapitalizeit",e.UNDO_IT="undoit",e.REDO_IT="redoit",e.SELECT_PREVIOUS_WORD="selectpreviousword",e.SELECT_NEXT_WORD="selectnextword",e.SELECT_WORD="selectword",e.SELECT_ALL="selectall",e.SELECT="select",e.DESELECT_IT="deselectit",e.GO_TO_LINE_START="gotolinestart",e.GO_TO_LINE_END="gotolineend",e.SELECT_ACTIVE_LINE="selectactiveline",e.SELECT_ACTIVE_PARAGRAPH="selectactiveparagraph",e.SELECT_ACTIVE_WORD="selectactiveword",e.SELECT_ACTIVE_SENTENCE="selectactivesentence",e.SELECT_ACTIVE_CHAR="selectactivechar",e.BULLET_LIST_START="bulletliststart",e.NUMBER_LIST_START="numberliststart",e.BULLET_LIST_STOP="bulletliststop",e.NUMBER_LIST_STOP="numberliststop",e.LIST_STOP="stoplist",e.ALIGN_LEFT="alignleft",e.ALIGN_RIGHT="alignright",e.ALIGN_CENTER="aligncenter",e.ALIGN_JUSTIFY="alignjustify",e.STOP_MIC="stopmic",e.GO_UP="goup",e.GO_DOWN="godown",e.GO_RIGHT="goright",e.GO_LEFT="goleft",e.TAB_SPACE_ADD="tabspaceadd",e.SPACE_ADD="spaceadd",e.BACKSPACE="backspace",e.START_BOLD_TEXT="boldstart",e.STOP_BOLD_TEXT="boldstop",e.GO_TO_DOCUMENT_START="gotodocumentstart",e.GO_TO_DOCUMENT_END="gotodocumentend",e.GO_TO_NEXT_PAGE="gotonextpage",e.GO_TO_PREVIOUS_PAGE="gotopreviouspage",e.OK="ok",e.DOCUMENT_SAVE="documentsave",e.DOCUMENT_PRINT="documentprint",e.NEW_DOCUMENT="newdocument",e.SELECT_PARAGRAPH="paragraph",e.NEXT_LINE_TEXT="@newline@",e.SELECT_LINE="selectline",e.SELECT_CHAR="char",e.SELECT_SENTENCE="selectsentence",e.DELETE="delete",e.GOTO="goto",e.DELETE_PREVIOUS_WORD="deletepreviousword",e.UNDERLIE_PREVIOUS_WORD="underlinepreviousword",e.CAPITALIZE_PREVIOUS_WORD="capitalizepreviousword",e.ITALICIZE_PREVIOUS_WORD="italicizepreviousword",e.BOLD_PREVIOUS_WORD="boldpreviousword",e.BOLD_LAST_LINE="boldlastline",e.DELETE_NEXT_WORD="deletenextword",e.DELETE_PREVIOUS_LINE="deletepreviousline",e.SELECT_PREVIOUS_LINE="selectpreviousline",e.BOLD_PREVIOUS_LINE="boldpreviousline",e.UNDERLINE_PREVIOUS_LINE="underlinepreviousline",e.ITALICIZE_PREVIOUS_LINE="italicizepreviousline",e.CAPITALIZE_PREVIOUS_LINE="capitalizepreviousline",e.SELECT_NEXT_LINE="selectnextline",e.SELECT_PREVIOUS_PARAGRAPH="selectpreviousparagraph",e.SELECT_NEXT_PARAGRAPH="selectnextparagraph",e.SETFONTSIZEN="setfontsize",e.INSERT_BEFORE_TEXT="insertbefore",e.INSERT_AFTER_TEXT="insertafter",e.DELETE_PREVIOUS_SENTENCE="deleteprevioussentence",e.SELECT_PREVIOUS_SENTENCE="selectprevioussentence",e.SELECT_NEXT_SENTENCE="selectnextsentence",e.START_CAPITAL_TEXT="capitalizestart",e.STOP_CAPITAL_TEXT="capitalizestop",e.NEXT_FIELD="dynamicfieldnext",e.PREVIOUS_FIELD="dynamicfieldprevious",e.GET_ORDER="getorder",e.ADD_MEDICINE="addmedicine",e.NUMBER="number"}(r||(r={}));class c{constructor(){Object.defineProperty(this,"_wordToDigit",{enumerable:!0,configurable:!0,writable:!0,value:{zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,x:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,twentyone:21,twentytwo:22,twentythree:23,twentyfour:24,twentyfive:25,twentysix:26,twentyseven:27,twentyeight:28,twentynine:29,thirty:30,thirtyone:31,thirtytwo:32,thirtythree:33,thirtyfour:34,thirtyfive:35,thirtysix:36,thirtyseven:37,thirtyeight:38,thirtynine:39,forty:40,fortyone:41,fortytwo:42,fortythree:43,fortyfour:44,fortyfive:45,fortysix:46,fortyseven:47,fortyeight:48,fortynine:49,fifty:50,fiftyone:51,fiftytwo:52,fiftythree:53,fiftyfour:54,fiftyfive:55,fiftysix:56,fiftyseven:57,fiftyeight:58,fiftynine:59,sixty:60,sixtyone:61,sixtytwo:62,sixtythree:63,sixtyfour:64,sixtyfive:65,sixtysix:66,sixtyseven:67,sixtyeight:68,sixtynine:69,seventy:70,seventyone:71,seventytwo:72,seventythree:73,seventyfour:74,seventyfive:75,seventysix:76,seventyseven:77,seventyeight:78,seventynine:79,eighty:80,eightyone:81,eightytwo:82,eightythree:83,eightyfour:84,eightyfive:85,eightysix:86,eightyseven:87,eightyeight:88,eightynine:89,ninety:90,ninetyone:91,ninetytwo:92,ninetythree:93,ninetyfour:94,ninetyfive:95,ninetysix:96,ninetyseven:97,ninetyeight:98,ninetynine:99,onehundred:100}})}parse(e){let t=0;return e&&(e=e.replace(/ /gi,"").toLowerCase().trim())&&(t=parseInt(e),isNaN(t)&&e in this._wordToDigit&&(t=this._wordToDigit[e])),t}}const u="select|choose|copy text|copytext|cut text|cuttext|correct|bold|underline|delete|header|capitalize|unbold|debold|dbold|uncapitalize|remove|capitalise|dcapitalise|dcapitalize|decapitalize|decapitalise|uncapitalise|Uncap|d capitalise|d capitalize|d underline|dunderline|deunderline|ununderline|goto|moveto|move|italicize|italicise|unitalicise|unitalicize";class d{static prepareRecipe(e){let t=e.receivedText.replace(/\n/gi,r.NEXT_LINE_TEXT);return t=t.replace(/ /gi,"").toLowerCase().trim(),t=t.replace(new RegExp(r.NEXT_LINE_TEXT,"gi"),"\n"),e.name=t,e.receivedTextWithoutSpace=t,this.fillDynamicCommand(e,t)}static fillDynamicCommand(e,t){const n=new c,i={sessionCode:e.sessionCode,isCommand:e.isCommand,final:e.final,receivedText:e.receivedText,receivedTextWithoutSpace:t,action:e.action};if("goto\n"===t||"move\n"===t||"moveto\n"===t)return Object.assign(Object.assign({},i),{name:r.SELECT_LINE,nextPrevious:"next",chooseNumber:1,isCommand:!0,selectFor:"gotoend",action:r.SELECT});if("delete\n"===t)return Object.assign(Object.assign({},i),{name:r.SELECT_LINE,nextPrevious:"next",chooseNumber:1,isCommand:!0,selectFor:"delete",action:r.SELECT});if("goto\n\n"===t||"move\n\n"===t||"moveto\n\n"===t)return{name:r.SELECT_PARAGRAPH,nextPrevious:"next",chooseNumber:1,isCommand:!0,selectFor:"gotoend",action:r.SELECT};const o=new RegExp("^("+u+")(the)?(active|current)?(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$","gi").exec(t.trim());if(o&&o.length>4){let e=o[1];e=this.setActionCommandVariant(e);const t=o[4].toLowerCase();if(t&&e){var a=Object.assign(Object.assign({},i),{name:this.setActiveObjectType(t),searchText:t,isCommand:!0,selectFor:e===r.SELECT?"":e,action:r.SELECT});return null==a.nextPrevious&&null==o[2]&&(a.nextPrevious="next"),a}}const s=new RegExp("^(last|previous|next|down)(.*?)(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$","gi").exec(t.trim());if(s&&s.length>3){const e=s[1],t=s[3].toLowerCase();return Object.assign(Object.assign({},i),{name:this.setSelectObjectType(t),nextPrevious:e,chooseNumber:1,isCommand:!0,selectFor:"preivous"===e||"last"===e?"gotostart":"gotoend",action:r.SELECT})}const l=new RegExp("^("+u+")(the)?(last|previous|next)(.*?)(word[s]?|line[s]?|sentence[s]?|paragraph[s]?|para[s]?|char[s]?|character[s]?|space|\n\n|\n)$","gi").exec(t);if(l&&l.length>3){const t=this.setActionCommandVariant(l[1].toLowerCase()),i=l[3];let o=n.parse(l[4]);o=0===o?1:o;const a=l[5].toLowerCase();if(a&&t&&i)return e.name=this.setSelectObjectType(a),e.nextPrevious=i,e.chooseNumber=o,e.searchText=a,e.isCommand=!0,e.selectFor=r.SELECT===t?"":t,e.action=r.SELECT,e}if(t.trim().startsWith(r.SETFONTSIZEN)){const i=new RegExp("^setfontsize(to)?([0-9]+)(point[s]?)?$","gi").exec(t.trim());if(i&&i.length>2)return e.name=r.SETFONTSIZEN,e.fontSize=n.parse(i[2]),e.isCommand=!0,e}if(e.receivedText){const n=new RegExp("^("+u+")( )(the)?(.*?)$","gi").exec(e.receivedText.trim());if(n&&n.length>3){let t=n[1];t=this.setActionCommandVariant(t.toLowerCase());const i=n[4];if(i)return e.name=r.SELECT,e.searchText=i.trim(),e.isCommand=!0,e.selectFor=r.SELECT===t?"":t,e}if(t.trim().startsWith(r.INSERT_BEFORE_TEXT))return e.name=r.INSERT_BEFORE_TEXT,e.searchText=e.receivedText.trim(),e.searchText=e.searchText.trim().substr(6),e.searchText=e.searchText.trim().substr(6).trim(),e.isCommand=!0,e;if(t.trim().startsWith(r.INSERT_AFTER_TEXT))return e.name=r.INSERT_AFTER_TEXT,e.searchText=e.receivedText.trim(),e.searchText=e.searchText.trim().substr(6),e.searchText=e.searchText.trim().substr(5).trim(),e.isCommand=!0,e;if(e.name&&e.name.startsWith(r.GOTO))return e.name=r.GOTO,e.searchText=e.receivedText.trim().substr(2),e.searchText=e.searchText.trim().substr(2).trim(),e.isCommand=!0,e}return e}static setActionCommandVariant(e){return"d capitalise"===e||"d capitalize"===e||"decapitalize"===e||"decapitalise"===e||"dcapitalise"===e||"dcapitalize"===e||"uncapitalize"===e||"uncapitalise"===e||"uncap"===e?"uncapitalize":"d underline"===e||"dunderline"===e?"deunderline":"dunderline"===e?"dunderline":"ununderline"===e?"deunderline":"capitalise"===e?"capitalize":"remove"===e?"delete":"goto"===e||"move"===e?"gotostart":"debold"===e||"dbold"===e?"unbold":"cuttext"===e||"cut text"===e?"cut":"copytext"===e||"copy text"===e?"copy":"choose"===e?"select":"italicise"===e?"italicize":"unitalicise"===e?"unitalicize":"movto"===e?"gotostart":e}static setActiveObjectType(e){return"word"===e||"words"===e?r.SELECT_ACTIVE_WORD:"sentence"===e||"sentences"===e?r.SELECT_ACTIVE_SENTENCE:"line"===e||"lines"===e?r.SELECT_ACTIVE_LINE:"paragraph"===e||"paragraphs"===e||"para"===e||"paras"===e||"\n\n"===e?r.SELECT_ACTIVE_PARAGRAPH:"\n"===e?r.SELECT_LINE:"char"===e||"chars"===e||"space"===e||"character"===e||"characters"===e?r.SELECT_ACTIVE_CHAR:e}static setSelectObjectType(e){return"word"==e||"words"==e?r.SELECT_WORD:"sentence"==e||"sentences"==e?r.SELECT_SENTENCE:"line"==e||"lines"==e?r.SELECT_LINE:"paragraph"==e||"paragraphs"==e||"para"==e||"paras"==e||"\n\n"==e||"\n\ns"==e.toLowerCase()?r.SELECT_PARAGRAPH:"\n"==e||"\ns"==e.toLowerCase()?r.SELECT_LINE:"char"==e||"chars"==e||"space"==e||"character"==e||"characters"==e?r.SELECT_CHAR:e}}class h{static createGoToDocumentEndCommand(){return{action:"gotodocumentend",final:!0,isCommand:!0,name:"gotodocumentend",receivedText:" go to document end",receivedTextWithoutSpace:"gotodocumentend"}}static prepareRecipe(e){let t=e.receivedText.replace(/\n/gi,r.NEXT_LINE_TEXT);t=t.replace(/ /gi,"").toLowerCase().trim(),t=t.replace(new RegExp(r.NEXT_LINE_TEXT,"gi"),"\n");const n={action:e.action,sessionCode:e.sessionCode,isCommand:e.isCommand,final:e.final,receivedText:e.receivedText,receivedTextWithoutSpace:t};switch(e.action){case r.DELETE_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"previous",selectFor:"delete",action:r.SELECT});case r.DELETE_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"delete",action:r.SELECT});case r.BOLD_LAST_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"bold"});case r.SELECT_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",action:r.SELECT});case r.SELECT_PREVIOUS_PARAGRAPH:return Object.assign(Object.assign({},n),{name:r.SELECT_PARAGRAPH,chooseNumber:1,nextPrevious:"previous",action:r.SELECT});case r.SELECT_NEXT_PARAGRAPH:return Object.assign(Object.assign({},n),{name:r.SELECT_PARAGRAPH,chooseNumber:1,nextPrevious:"next",action:r.SELECT});case r.SELECT_NEXT_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"next",action:r.SELECT});case r.DELETE_PREVIOUS_SENTENCE:return Object.assign(Object.assign({},n),{name:r.SELECT_SENTENCE,chooseNumber:1,nextPrevious:"previous",selectFor:"delete",action:r.SELECT});case r.SELECT_NEXT_SENTENCE:return Object.assign(Object.assign({},n),{name:r.SELECT_SENTENCE,chooseNumber:1,nextPrevious:"next",action:r.SELECT});case r.SELECT_PREVIOUS_SENTENCE:return Object.assign(Object.assign({},n),{name:r.SELECT_SENTENCE,chooseNumber:1,nextPrevious:"previous",action:r.SELECT});case r.BOLD_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"last",selectFor:"bold",action:r.SELECT});case r.CAPITALIZE_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"last",selectFor:"capitalize"});case r.ITALICIZE_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"last",selectFor:"italicize"});case r.UNDERLIE_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"last",selectFor:"underline",action:r.SELECT});case r.SELECT_PREVIOUS_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"last",searchText:"previousword",selectFor:"select",action:r.SELECT});case r.SELECT_ALL:return Object.assign(Object.assign({},n),{name:r.SELECT,searchText:"all"});case r.SELECT_NEXT_WORD:return Object.assign(Object.assign({},n),{name:r.SELECT_WORD,chooseNumber:1,nextPrevious:"next",searchText:"nextword",action:r.SELECT});case r.BOLD_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"bold"});case r.ITALICIZE_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"italicize"});case r.CAPITALIZE_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"capitalize"});case r.UNDERLINE_PREVIOUS_LINE:return Object.assign(Object.assign({},n),{name:r.SELECT_LINE,chooseNumber:1,nextPrevious:"previous",selectFor:"underline"});default:return Object.assign(Object.assign({},n),{name:t})}}}class g{constructor(){}static get Against(){return g.instance||(g.instance=new g),g.instance}NullOrUndefined(e,t){if(null===e)throw new TypeError(`${t} is null`);if(void 0===e)throw new TypeError(`${t} is undefined`);return e}NullOrEmpty(e,t){if(!(e=g.Against.NullOrUndefined(e,t)))throw new TypeError(`${t} is empty`);return e}Enums(e,t,n){if(g.Against.NullOrUndefined(t,n),!this.isSomeEnum(e)(t))throw new TypeError(`${t} is not a valid value of ${n}`)}isSomeEnum(e){return t=>Object.values(e).includes(t)}}var f;!function(e){e[e.INDIA=0]="INDIA",e[e.UK=1]="UK",e[e.US=2]="US",e[e.KSA=3]="KSA"}(f||(f={}));const p=e=>{if("string"==typeof e)return e;let t="";switch(e){case f.INDIA:t="apis.augnito.ai";break;case f.US:t="us.apis.augnito.ai";break;case f.UK:t="uk.apis.augnito.ai";break;case f.KSA:t="sa-apis.augnito.ai";break;default:throw new TypeError(`Invalid domain ${e}`)}return t};class m{constructor(e){Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"qrCode",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"customSpeechURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contentType",{enumerable:!0,configurable:!0,writable:!0,value:"audio/x-raw,+layout=(string)interleaved,+rate=(int)16000,+format=(string)S16LE,+channels=(int)1"}),Object.defineProperty(this,"noiseCt",{enumerable:!0,configurable:!0,writable:!0,value:"1"}),Object.defineProperty(this,"interval",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(this,"domainURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"macroServiceURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"pushNotificationURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"speechMicURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"source",{enumerable:!0,configurable:!0,writable:!0,value:n.WEB_APP}),Object.defineProperty(this,"onSocketPartialResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onSocketFinalResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onEndOfSession",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onReadyForSpeech",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onSessionEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onMicrophoneOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0});const t=p(e.server);e.deviceId&&(this.qrCode=this.getQRCode(e,t)),e.noiseCt&&(this.noiseCt=e.noiseCt),this.domainURL=`wss://${t}/v2/speechapi${e.switchToRegularSpeechProfile?"":"/fast"}`,this.macroServiceURL=`https://${t}/manage/v2`,this.pushNotificationURL=`wss://${t}/speechapi/notification/`,this.speechMicURL=`wss://${t}/v2/speechapi/mobile/client/`}setLmId(e){g.Against.NullOrEmpty(e,"lmId"),this._config.lmId=e}setSpeechURL(e){g.Against.NullOrEmpty(e,"speechURL"),this.customSpeechURL=e}setDomainName(e){this.domainURL=`wss://${e}/v2/speechapi`,this.macroServiceURL=`https://${e}/manage/v2`,this.pushNotificationURL=`wss://${e}/speechapi/notification/`,this.speechMicURL=`wss://${e}/v2/speechapi/mobile/client/`}setAccountCode(e){g.Against.NullOrEmpty(e,"accountCode"),this._config.accountCode=e}setAccessKey(e){g.Against.NullOrEmpty(e,"accessKey"),this._config.accessKey=e}setEnableLogs(e){this._config.enableLogs=e}get clientConfig(){return this._config}get enableLogs(){return this._config.enableLogs}prepareSpeechURL(){if(this.customSpeechURL)return this.customSpeechURL;let e=this.domainURL;return e+=`?content-type=${this.contentType}`,e+=`&accountcode=${this._config.accountCode}`,e+=`&accesskey=${this._config.accessKey}`,e+=`&lmid=${this._config.lmId}`,e+=`&usertag=${this._config.userTag}`,e+=`&logintoken=${this._config.loginToken||""}`,e+=`&noisect=${this.noiseCt}`,e+=`&otherinfo=${this._config.otherInfo||""}`,e+=`&sourceapp=${this._config.sourceApp}`,e}getQRCode(e,t){return`${e.accountCode}|${e.accessKey}|${e.userTag}|${e.deviceId}|${e.lmId}|${e.sourceApp}|${t}|1`}}var v,b;!function(e){e[e.HTML=1]="HTML",e[e.CKEDITOR4=2]="CKEDITOR4",e[e.CKEDITOR5=3]="CKEDITOR5",e[e.DEVEXPRESS=4]="DEVEXPRESS",e[e.GENERIC=99]="GENERIC"}(v||(v={})),function(e){e[e.HandsFree=1]="HandsFree",e[e.PushToTalk=2]="PushToTalk",e[e.BOTH=3]="BOTH"}(b||(b={}));const E=()=>{let e=(new Date).getTime();const t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){const n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}));return t},S=()=>{const e=new Date;return e.getFullYear()+""+("0"+(e.getMonth()+1)).slice(-2)+("0"+e.getDate()).slice(-2)+""+(("0"+e.getHours()).slice(-2)+""+("0"+e.getMinutes()).slice(-2)+("0"+e.getSeconds()).slice(-2)+("000"+e.getMilliseconds()).slice(-4))},C=e=>{if(e.editor&&e.editor!==v.HTML&&(g.Against.Enums(v,e.editor,"EditorType"),e.editor===v.CKEDITOR4&&"undefined"==typeof CKEDITOR))throw new Error("CKEditor4 is set as the editor type, but CKEditor4 library was not found. Please add references to your project")};var T;!function(e){e[e.None=0]="None",e[e.filenew=1]="filenew",e[e.fileopen=2]="fileopen",e[e.filesave=3]="filesave",e[e.filesaveas=4]="filesaveas",e[e.fileprint=5]="fileprint",e[e.undoit=6]="undoit",e[e.redoit=7]="redoit",e[e.pasteselection=8]="pasteselection",e[e.copyselection=9]="copyselection",e[e.cutselection=10]="cutselection",e[e.changefontname=11]="changefontname",e[e.changestyle=12]="changestyle",e[e.changefontsize=13]="changefontsize",e[e.increasefontsize=14]="increasefontsize",e[e.decreasefontsize=15]="decreasefontsize",e[e.maketextuppercase=16]="maketextuppercase",e[e.maketextlowercase=17]="maketextlowercase",e[e.capitalizeeachwordtextcase=18]="capitalizeeachwordtextcase",e[e.toggletextcase=19]="toggletextcase",e[e.togglefontbold=20]="togglefontbold",e[e.togglefontitalic=21]="togglefontitalic",e[e.togglefontunderline=22]="togglefontunderline",e[e.togglefontdoubleunderline=23]="togglefontdoubleunderline",e[e.togglefontstrikeout=24]="togglefontstrikeout",e[e.togglefontsuperscript=26]="togglefontsuperscript",e[e.togglefontsubscript=27]="togglefontsubscript",e[e.changefontforecolor=28]="changefontforecolor",e[e.changefontbackcolor=29]="changefontbackcolor",e[e.clearformatting=30]="clearformatting",e[e.togglebulletedlistitem=31]="togglebulletedlistitem",e[e.togglenumberinglistitem=32]="togglenumberinglistitem",e[e.togglemultilevellistitem=33]="togglemultilevellistitem",e[e.decreaseindent=34]="decreaseindent",e[e.increaseindent=35]="increaseindent",e[e.toggleshowwhitespace=36]="toggleshowwhitespace",e[e.toggleparagraphalignmentleft=37]="toggleparagraphalignmentleft",e[e.toggleparagraphalignmentcenter=38]="toggleparagraphalignmentcenter",e[e.toggleparagraphalignmentright=39]="toggleparagraphalignmentright",e[e.toggleparagraphalignmentjustify=40]="toggleparagraphalignmentjustify",e[e.setsingleparagraphspacing=41]="setsingleparagraphspacing",e[e.setsesquialteralparagraphspacing=42]="setsesquialteralparagraphspacing",e[e.setdoubleparagraphspacing=43]="setdoubleparagraphspacing",e[e.addspacingbeforeparagraph=45]="addspacingbeforeparagraph",e[e.addspacingafterparagraph=46]="addspacingafterparagraph",e[e.removespacingbeforeparagraph=47]="removespacingbeforeparagraph",e[e.removespacingafterparagraph=48]="removespacingafterparagraph",e[e.changeparagraphbackcolor=49]="changeparagraphbackcolor",e[e.find=50]="find",e[e.replace=51]="replace",e[e.showfontform=52]="showfontform",e[e.showparagraphform=53]="showparagraphform",e[e.insertpagebreak=54]="insertpagebreak",e[e.showinserttableform=55]="showinserttableform",e[e.insertpicture=56]="insertpicture",e[e.showbookmarkform=58]="showbookmarkform",e[e.showhyperlinkform=59]="showhyperlinkform",e[e.showsymbolform=65]="showsymbolform",e[e.setnormalsectionpagemargins=66]="setnormalsectionpagemargins",e[e.setnarrowsectionpagemargins=67]="setnarrowsectionpagemargins",e[e.setmoderatesectionpagemargins=68]="setmoderatesectionpagemargins",e[e.setwidesectionpagemargins=69]="setwidesectionpagemargins",e[e.showpagemarginssetupform=70]="showpagemarginssetupform",e[e.setportraitpageorientation=71]="setportraitpageorientation",e[e.setlandscapepageorientation=72]="setlandscapepageorientation",e[e.showpagepapersetupform=73]="showpagepapersetupform",e[e.setsectiononecolumn=74]="setsectiononecolumn",e[e.setsectiontwocolumns=75]="setsectiontwocolumns",e[e.setsectionthreecolumns=76]="setsectionthreecolumns",e[e.showcolumnssetupform=77]="showcolumnssetupform",e[e.insertcolumnbreak=79]="insertcolumnbreak",e[e.insertsectionbreaknextpage=80]="insertsectionbreaknextpage",e[e.insertsectionbreakevenpage=81]="insertsectionbreakevenpage",e[e.insertsectionbreakoddpage=82]="insertsectionbreakoddpage",e[e.changepagecolor=90]="changepagecolor",e[e.toggleshowhorizontalruler=94]="toggleshowhorizontalruler",e[e.fullscreen=98]="fullscreen",e[e.setsectionlegalpaperkind=99]="setsectionlegalpaperkind",e[e.setsectionfoliopaperkind=100]="setsectionfoliopaperkind",e[e.setsectiona4paperkind=101]="setsectiona4paperkind",e[e.setsectiona5paperkind=102]="setsectiona5paperkind",e[e.setsectiona6paperkind=103]="setsectiona6paperkind",e[e.setsectionb5paperkind=104]="setsectionb5paperkind",e[e.setsectionexecutivepaperkind=105]="setsectionexecutivepaperkind",e[e.selectall=106]="selectall",e[e.showpagesetupform=107]="showpagesetupform",e[e.shownumberinglistform=108]="shownumberinglistform",e[e.extendlinedown=109]="extendlinedown",e[e.extendlineend=110]="extendlineend",e[e.extendlinestart=111]="extendlinestart",e[e.extendlineup=112]="extendlineup",e[e.extendnextcharacter=113]="extendnextcharacter",e[e.extendpreviouscharacter=114]="extendpreviouscharacter",e[e.extendselectline=115]="extendselectline",e[e.insertparagraph=116]="insertparagraph",e[e.inserttext=117]="inserttext",e[e.linedown=118]="linedown",e[e.gotolineend=119]="gotolineend",e[e.gotolinestart=120]="gotolinestart",e[e.lineup=121]="lineup",e[e.nextcharacter=122]="nextcharacter",e[e.previouscharacter=123]="previouscharacter",e[e.selectline=124]="selectline",e[e.togglebackspacekey=125]="togglebackspacekey",e[e.toggledeletekey=126]="toggledeletekey",e[e.insertlinebreak=127]="insertlinebreak",e[e.nextpage=128]="nextpage",e[e.extendnextpage=129]="extendnextpage",e[e.previouspage=130]="previouspage",e[e.extendpreviouspage=131]="extendpreviouspage",e[e.changeinlinepicturescale=132]="changeinlinepicturescale",e[e.incrementparagraphleftindent=133]="incrementparagraphleftindent",e[e.decrementparagraphleftindent=134]="decrementparagraphleftindent",e[e.dragmovecontent=135]="dragmovecontent",e[e.dragcopycontent=136]="dragcopycontent",e[e.insertspace=137]="insertspace",e[e.rulersectionmarginleft=138]="rulersectionmarginleft",e[e.rulersectionmarginright=139]="rulersectionmarginright",e[e.rulerparagraphrightindent=140]="rulerparagraphrightindent",e[e.rulersectioncolumnssettings=141]="rulersectioncolumnssettings",e[e.rulerparagraphleftindents=142]="rulerparagraphleftindents",e[e.inserttabmark=143]="inserttabmark",e[e.insertshifttabmark=144]="insertshifttabmark",e[e.gotodocumentstart=145]="gotodocumentstart",e[e.extenddocumentstart=146]="extenddocumentstart",e[e.gotodocumentend=147]="gotodocumentend",e[e.extenddocumentend=148]="extenddocumentend",e[e.gotonextword=149]="gotonextword",e[e.extendgotonextword=150]="extendgotonextword",e[e.gotoprevword=151]="gotoprevword",e[e.extendgotoprevword=152]="extendgotoprevword",e[e.gotostartparagraph=153]="gotostartparagraph",e[e.extendgotostartparagraph=154]="extendgotostartparagraph",e[e.gotoendparagraph=155]="gotoendparagraph",e[e.extendgotoendparagraph=156]="extendgotoendparagraph",e[e.reloaddocument=157]="reloaddocument",e[e.showerrormodelischangedmessagecommand=158]="showerrormodelischangedmessagecommand",e[e.showerrorsessionhasexpiredmessagecommand=159]="showerrorsessionhasexpiredmessagecommand",e[e.selectparagraph=160]="selectparagraph",e[e.showerroropeningandoverstoreimpossiblemessagecommand=161]="showerroropeningandoverstoreimpossiblemessagecommand",e[e.setsectionletterpaperkind=162]="setsectionletterpaperkind",e[e.showerrorclipboardaccessdeniedmessagecommand=163]="showerrorclipboardaccessdeniedmessagecommand",e[e.selectlinenoupdatecontrolstate=164]="selectlinenoupdatecontrolstate",e[e.extendselectlinenoupdatecontrolstate=165]="extendselectlinenoupdatecontrolstate",e[e.showtabsform=166]="showtabsform",e[e.showcustomnumberinglistform=167]="showcustomnumberinglistform",e[e.showservicefontform=168]="showservicefontform",e[e.showservicesymbolsform=169]="showservicesymbolsform",e[e.restartnumberinglist=170]="restartnumberinglist",e[e.deletetabruler=171]="deletetabruler",e[e.inserttabruler=172]="inserttabruler",e[e.movetabruler=173]="movetabruler",e[e.incrementnumberingindent=174]="incrementnumberingindent",e[e.decrementnumberingindent=175]="decrementnumberingindent",e[e.incrementparagraphindentfromfirstrow=176]="incrementparagraphindentfromfirstrow",e[e.decrementparagraphindentfromfirstrow=177]="decrementparagraphindentfromfirstrow",e[e.createfield=178]="createfield",e[e.updatefield=179]="updatefield",e[e.togglefieldcodes=180]="togglefieldcodes",e[e.showallfieldcodes=186]="showallfieldcodes",e[e.showallfieldresults=187]="showallfieldresults",e[e.toggleallfields=188]="toggleallfields",e[e.continuenumberinglist=189]="continuenumberinglist",e[e.insertnumerationtoparagraphs=190]="insertnumerationtoparagraphs",e[e.deletenumerationfromparagraphs=191]="deletenumerationfromparagraphs",e[e.showerrorinnerexceptionmessagecommand=192]="showerrorinnerexceptionmessagecommand",e[e.showerrorauthexceptionmessagecommand=193]="showerrorauthexceptionmessagecommand",e[e.showedithyperlinkform=194]="showedithyperlinkform",e[e.openhyperlink=195]="openhyperlink",e[e.removehyperlink=196]="removehyperlink",e[e.showerrorsavingmessagecommand=197]="showerrorsavingmessagecommand",e[e.showerroropeningmessagecommand=198]="showerroropeningmessagecommand",e[e.showerrordocvariableerrorcommand=199]="showerrordocvariableerrorcommand",e[e.updateallfields=200]="updateallfields",e[e.insertnonbreakingspace=201]="insertnonbreakingspace",e[e.removehyperlinks=202]="removehyperlinks",e[e.createdatefield=203]="createdatefield",e[e.createtimefield=204]="createtimefield",e[e.createpagefield=205]="createpagefield",e[e.showcreatehyperlinkform=206]="showcreatehyperlinkform",e[e.sentencecase=207]="sentencecase",e[e.switchtextcase=208]="switchtextcase",e[e.gotofirstdatarecord=209]="gotofirstdatarecord",e[e.gotopreviousdatarecord=210]="gotopreviousdatarecord",e[e.gotonextdatarecord=211]="gotonextdatarecord",e[e.gotolastdatarecord=212]="gotolastdatarecord",e[e.toggleviewmergeddata=213]="toggleviewmergeddata",e[e.showinsertmergefieldform=214]="showinsertmergefieldform",e[e.createmergefield=215]="createmergefield",e[e.showfinishandmergeform=216]="showfinishandmergeform",e[e.showsavemergeddocumentform=218]="showsavemergeddocumentform",e[e.addselectedlinecommandnoupdatecontrolstate=219]="addselectedlinecommandnoupdatecontrolstate",e[e.insertheader=220]="insertheader",e[e.insertfooter=221]="insertfooter",e[e.linkheaderfootertoprevious=222]="linkheaderfootertoprevious",e[e.createbookmark=225]="createbookmark",e[e.deletebookmarks=226]="deletebookmarks",e[e.gotopageheader=227]="gotopageheader",e[e.gotopagefooter=228]="gotopagefooter",e[e.gotonextpageheaderfooter=229]="gotonextpageheaderfooter",e[e.gotopreviouspageheaderfooter=230]="gotopreviouspageheaderfooter",e[e.toggledifferentfirstpage=231]="toggledifferentfirstpage",e[e.toggledifferentoddandevenpages=232]="toggledifferentoddandevenpages",e[e.closepageheaderfooter=233]="closepageheaderfooter",e[e.contextitem_headersfooters=234]="contextitem_headersfooters",e[e.insertpagenumberfield=235]="insertpagenumberfield",e[e.insertpagecountfield=236]="insertpagecountfield",e[e.gotobookmark=237]="gotobookmark",e[e.inserttablecore=238]="inserttablecore",e[e.contextitem_tables=239]="contextitem_tables",e[e.showtablepropertiesform=240]="showtablepropertiesform",e[e.showcelloptionsform=242]="showcelloptionsform",e[e.inserttablecolumntotheleft=243]="inserttablecolumntotheleft",e[e.inserttablecolumntotheright=244]="inserttablecolumntotheright",e[e.inserttablerowbelow=245]="inserttablerowbelow",e[e.inserttablerowabove=246]="inserttablerowabove",e[e.deletetablerows=247]="deletetablerows",e[e.deletetablecolumns=248]="deletetablecolumns",e[e.inserttablecellwithshifttotheleft=249]="inserttablecellwithshifttotheleft",e[e.deletetablecellswithshifttothehorizontally=250]="deletetablecellswithshifttothehorizontally",e[e.deletetable=251]="deletetable",e[e.showinserttablecellsform=252]="showinserttablecellsform",e[e.showdeletetablecellsform=253]="showdeletetablecellsform",e[e.mergetablecells=254]="mergetablecells",e[e.showsplittablecellsform=255]="showsplittablecellsform",e[e.splittablecellscommand=256]="splittablecellscommand",e[e.inserttablecellswithshifttothevertically=257]="inserttablecellswithshifttothevertically",e[e.deletetablecellswithshifttothevertically=258]="deletetablecellswithshifttothevertically",e[e.showbordershadingform=259]="showbordershadingform",e[e.tablecellaligntopleft=260]="tablecellaligntopleft",e[e.tablecellaligntopcenter=261]="tablecellaligntopcenter",e[e.tablecellaligntopright=262]="tablecellaligntopright",e[e.tablecellalignmiddleleft=263]="tablecellalignmiddleleft",e[e.tablecellalignmiddlecenter=264]="tablecellalignmiddlecenter",e[e.tablecellalignmiddleright=265]="tablecellalignmiddleright",e[e.tablecellalignbottomleft=266]="tablecellalignbottomleft",e[e.tablecellalignbottomcenter=267]="tablecellalignbottomcenter",e[e.tablecellalignbottomright=268]="tablecellalignbottomright",e[e.applytablestyle=269]="applytablestyle",e[e.toggletablecellstopborder=270]="toggletablecellstopborder",e[e.toggletablecellsrightborder=271]="toggletablecellsrightborder",e[e.toggletablecellsbottomborder=272]="toggletablecellsbottomborder",e[e.toggletablecellsleftborder=273]="toggletablecellsleftborder",e[e.toggletablecellnoborder=274]="toggletablecellnoborder",e[e.toggletablecellallborders=275]="toggletablecellallborders",e[e.toggletablecellinsideborders=276]="toggletablecellinsideborders",e[e.toggletablecellinsidehorizontalborders=277]="toggletablecellinsidehorizontalborders",e[e.toggletablecellinsideverticalborders=278]="toggletablecellinsideverticalborders",e[e.toggletablecelloutsideborders=279]="toggletablecelloutsideborders",e[e.togglefirstrow=280]="togglefirstrow",e[e.togglelastrow=281]="togglelastrow",e[e.togglefirstcolumn=282]="togglefirstcolumn",e[e.togglelastcolumn=283]="togglelastcolumn",e[e.togglebandedrows=284]="togglebandedrows",e[e.togglebandedcolumn=285]="togglebandedcolumn",e[e.selecttablecell=286]="selecttablecell",e[e.selecttablecolumn=287]="selecttablecolumn",e[e.selecttablerow=288]="selecttablerow",e[e.selecttable=289]="selecttable",e[e.changetablebordercolorrepositoryitem=290]="changetablebordercolorrepositoryitem",e[e.changetableborderwidthrepositoryitem=291]="changetableborderwidthrepositoryitem",e[e.changetableborderstylerepositoryitem=292]="changetableborderstylerepositoryitem",e[e.showerrorpathtoolongcommand=293]="showerrorpathtoolongcommand",e[e.changetablecellshading=294]="changetablecellshading",e[e.toggleshowtablegridlines=295]="toggleshowtablegridlines",e[e.extendselecttablecell=296]="extendselecttablecell",e[e.extendselecttablecolumn=297]="extendselecttablecolumn",e[e.extendselecttablerow=298]="extendselecttablerow",e[e.extendselecttable=299]="extendselecttable",e[e.selecttablecellsrange=300]="selecttablecellsrange",e[e.showservicebordershadingform=301]="showservicebordershadingform",e[e.rulertablecolumnseparators=302]="rulertablecolumnseparators",e[e.changeactivesubdocumenttomain=303]="changeactivesubdocumenttomain",e[e.changeactivesubdocumenttoheaderfooterbypageindex=304]="changeactivesubdocumenttoheaderfooterbypageindex",e[e.changeactivesubdocumenttoheaderfooterbysubdocument=305]="changeactivesubdocumenttoheaderfooterbysubdocument",e[e.showerrorinvaliddocumentformat=306]="showerrorinvaliddocumentformat",e[e.setsectionpagesize=307]="setsectionpagesize",e[e.setsectioncolumncount=308]="setsectioncolumncount",e[e.changetablerowheight=309]="changetablerowheight",e[e.changetablecellwidth=310]="changetablecellwidth",e[e.changetablecolumnwidth=311]="changetablecolumnwidth",e[e.changetablelook=312]="changetablelook",e[e.showspellcheckerform=313]="showspellcheckerform",e[e.ignorespellingerror=314]="ignorespellingerror",e[e.ignoreallspellingerrors=315]="ignoreallspellingerrors",e[e.deleterepeatedword=316]="deleterepeatedword",e[e.addwordtodictionary=317]="addwordtodictionary",e[e.changespellingerror=318]="changespellingerror",e[e.changeallspellingerrors=319]="changeallspellingerrors",e[e.showspellingcheckcompletedmessage=320]="showspellingcheckcompletedmessage",e[e.rulerchangetablecolumnwidth=321]="rulerchangetablecolumnwidth",e[e.rulerchangetablerowheight=322]="rulerchangetablerowheight",e[e.deletetablecellsbybackspace=323]="deletetablecellsbybackspace",e[e.gotodatarecord=324]="gotodatarecord",e[e.findall=325]="findall",e[e.replacenext=326]="replacenext",e[e.replaceall=327]="replaceall",e[e.hidefindresults=328]="hidefindresults",e[e.activateribbon=329]="activateribbon",e[e.changeheaderoffset=330]="changeheaderoffset",e[e.changefooteroffset=331]="changefooteroffset",e[e.download=332]="download",e[e.showerrorcantsavetoemptypathmessagecommand=333]="showerrorcantsavetoemptypathmessagecommand",e[e.removenextword=334]="removenextword",e[e.removeprevword=335]="removeprevword",e[e.gotostartnextpage=336]="gotostartnextpage",e[e.gotostartprevpage=337]="gotostartprevpage",e[e.extendgotostartnextpage=338]="extendgotostartnextpage",e[e.extendgotostartprevpage=339]="extendgotostartprevpage",e[e.setsectionpagemargins=340]="setsectionpagemargins",e[e.assignshortcut=341]="assignshortcut",e[e.showlayoutoptionsform=342]="showlayoutoptionsform",e[e.changefloatingobjectfillcolor=343]="changefloatingobjectfillcolor",e[e.changefloatingobjectoutlinecolor=344]="changefloatingobjectoutlinecolor",e[e.changefloatingobjectoutlinewidth=345]="changefloatingobjectoutlinewidth",e[e.setfloatingobjectsquaretextwraptype=346]="setfloatingobjectsquaretextwraptype",e[e.setfloatingobjecttighttextwraptype=347]="setfloatingobjecttighttextwraptype",e[e.setfloatingobjectthroughtextwraptype=348]="setfloatingobjectthroughtextwraptype",e[e.setfloatingobjecttopandbottomtextwraptype=349]="setfloatingobjecttopandbottomtextwraptype",e[e.setfloatingobjectbehindtextwraptype=350]="setfloatingobjectbehindtextwraptype",e[e.setfloatingobjectinfrontoftextwraptype=351]="setfloatingobjectinfrontoftextwraptype",e[e.setfloatingobjecttopleftalignment=352]="setfloatingobjecttopleftalignment",e[e.setfloatingobjecttopcenteralignment=353]="setfloatingobjecttopcenteralignment",e[e.setfloatingobjecttoprightalignment=354]="setfloatingobjecttoprightalignment",e[e.setfloatingobjectmiddleleftalignment=355]="setfloatingobjectmiddleleftalignment",e[e.setfloatingobjectmiddlecenteralignment=356]="setfloatingobjectmiddlecenteralignment",e[e.setfloatingobjectmiddlerightalignment=357]="setfloatingobjectmiddlerightalignment",e[e.setfloatingobjectbottomleftalignment=358]="setfloatingobjectbottomleftalignment",e[e.setfloatingobjectbottomcenteralignment=359]="setfloatingobjectbottomcenteralignment",e[e.setfloatingobjectbottomrightalignment=360]="setfloatingobjectbottomrightalignment",e[e.floatingobjectbringforward=361]="floatingobjectbringforward",e[e.floatingobjectbringtofront=362]="floatingobjectbringtofront",e[e.floatingobjectbringinfrontoftext=363]="floatingobjectbringinfrontoftext",e[e.floatingobjectsendbackward=364]="floatingobjectsendbackward",e[e.floatingobjectsendtoback=365]="floatingobjectsendtoback",e[e.floatingobjectsendbehindtext=366]="floatingobjectsendbehindtext",e[e.contextitem_floatingobjects=367]="contextitem_floatingobjects",e[e.insertanchoredtextbox=368]="insertanchoredtextbox",e[e.changeactivesubdocumenttotextbox=369]="changeactivesubdocumenttotextbox",e[e.changetextboxproperties=370]="changetextboxproperties",e[e.changefloatingobjectshape=371]="changefloatingobjectshape",e[e.createemptymergefield=372]="createemptymergefield",e[e.createemptydocvariablefield=373]="createemptydocvariablefield",e[e.setfloatingobjectinlinetextwraptype=374]="setfloatingobjectinlinetextwraptype",e[e.floatingobjectdragdropchangeposition=375]="floatingobjectdragdropchangeposition",e[e.inserthtml=376]="inserthtml",e[e.createtocfield=377]="createtocfield",e[e.createtableofequationsfield=378]="createtableofequationsfield",e[e.createtableoffiguresfield=379]="createtableoffiguresfield",e[e.createtableoftablesfield=380]="createtableoftablesfield",e[e.createequationcaptionfield=381]="createequationcaptionfield",e[e.createfigurecaptionfield=382]="createfigurecaptionfield",e[e.createtablecaptionfield=383]="createtablecaptionfield",e[e.updatetableofcontents=384]="updatetableofcontents",e[e.setparagraphbodytextlevel=385]="setparagraphbodytextlevel",e[e.setparagraphheading1level=386]="setparagraphheading1level",e[e.setparagraphheading2level=387]="setparagraphheading2level",e[e.setparagraphheading3level=388]="setparagraphheading3level",e[e.setparagraphheading4level=389]="setparagraphheading4level",e[e.setparagraphheading5level=390]="setparagraphheading5level",e[e.setparagraphheading6level=391]="setparagraphheading6level",e[e.setparagraphheading7level=392]="setparagraphheading7level",e[e.setparagraphheading8level=393]="setparagraphheading8level",e[e.setparagraphheading9level=394]="setparagraphheading9level",e[e.changeheadinglevel=395]="changeheadinglevel",e[e.setparagraphlevel=396]="setparagraphlevel",e[e.createfieldwithcode=397]="createfieldwithcode",e[e.changehyperlink=398]="changehyperlink",e[e.setautofitcontents=399]="setautofitcontents",e[e.setautofitwindow=400]="setautofitwindow",e[e.setfixedcolumnwidth=401]="setfixedcolumnwidth",e[e.insertrtf=402]="insertrtf",e[e.getrtf=403]="getrtf",e[e.forcesyncwithserver=404]="forcesyncwithserver",e[e.switchtosimpleview=405]="switchtosimpleview",e[e.switchtoprintlayoutview=406]="switchtoprintlayoutview",e[e.changeviewtype=407]="changeviewtype",e[e.insertcontentfromserver=408]="insertcontentfromserver",e[e.showinsertcontentfromservererrordialogcommand=409]="showinsertcontentfromservererrordialogcommand",e[e.opendocumentlocally=410]="opendocumentlocally",e[e.insertpicturelocally=411]="insertpicturelocally",e[e.createnewdocumentlocally=412]="createnewdocumentlocally",e[e.exportdocument=413]="exportdocument",e[e.downloaddocumentlocally=414]="downloaddocumentlocally",e[e.showerrorloadpicturemessage=415]="showerrorloadpicturemessage",e[e.printdocumentonclient=416]="printdocumentonclient",e[e.mailmergeonclient=417]="mailmergeonclient",e[e.downloaddocx=418]="downloaddocx",e[e.downloadrtf=419]="downloadrtf",e[e.downloadtxt=420]="downloadtxt",e[e.pdfexported=430]="pdfexported",e[e.changecasemenu=431]="changecasemenu",e[e.alignparagraphmenu=432]="alignparagraphmenu",e[e.linespacingmenu=433]="linespacingmenu",e[e.marginsmenu=434]="marginsmenu",e[e.orientationmenu=435]="orientationmenu",e[e.sizemenu=436]="sizemenu",e[e.columnsmenu=437]="columnsmenu",e[e.breaksmenu=438]="breaksmenu",e[e.addtextmenu=439]="addtextmenu",e[e.insertcaptionmenu=440]="insertcaptionmenu",e[e.inserttableoffiguresmenu=441]="inserttableoffiguresmenu",e[e.createfieldmenu=442]="createfieldmenu",e[e.tablestyleoptionsmenu=443]="tablestyleoptionsmenu",e[e.bordersmenu=444]="bordersmenu",e[e.selectmenu=445]="selectmenu",e[e.deletemenu=446]="deletemenu",e[e.insertmenu=447]="insertmenu",e[e.autofitmenu=448]="autofitmenu",e[e.alignmentmenu=449]="alignmentmenu",e[e.wraptextmenu=450]="wraptextmenu",e[e.positionmenu=451]="positionmenu",e[e.bringforwardmenu=452]="bringforwardmenu",e[e.sendbackwardmenu=453]="sendbackwardmenu"}(T||(T={}));const R=function(e,t){var n=t.selection.intervals[0],i=[],o=N(void 0,t,"[]");(i=i.concat(o)).length>0&&(e.action==r.NEXT_FIELD?i=(i=i.filter((e=>e.start>=n.end))).sort((function(e,t){return e.start-t.start})):e.action==r.PREVIOUS_FIELD&&(i=(i=i.filter((e=>e.start<n.start))).sort((function(e,t){return t.start-e.start})))),y(t),i.length>0&&t.selection.setSelection(i[0]),t.focus()},y=function(e){for(var t,n=null===(t=document.querySelector(".dxreControl"))||void 0===t?void 0:t.querySelectorAll(".dxrePageService")[0],i=n.querySelectorAll(".searchIndex"),o=0;o<i.length;o++)n.removeChild(i[o]);var r=T.hidefindresults;e.document.subDocuments._core.commandManager.getCommand(r).execute(!1,void 0)},N=function(e,t,n){var i,o=null!=e?null===(i=e.searchText)||void 0===i?void 0:i.trim():n;if(o&&o.length>0){if(null!=e){var r=T.findall,a=t.document.subDocuments._core.commandManager.getCommand(r);return a.control.searchManager.findAll(o,!1),a.control.searchManager.foundIntervals}for(var s,l=t.selection.activeSubDocument.getText(),c=[],u=/\[(.*?)\]/gi;null!=(s=u.exec(l));){var d=t.selection.intervals[0];d.start=s.index,d.length=s[0].length,c.push(d)}return c}},O=function(e,t){if(e[0].length>0){var n=e[0],i=n.start,o=n.start+n.length+1;n.start=i-1,n.length=1,t.selection.setSelection(n);var r=t.selection.intervals,a=t.selection.activeSubDocument.getText().substr(r[0].start,r[0].length);n.start=o-1,n.length=1,t.selection.setSelection(n);var s=t.selection.intervals,l=t.selection.activeSubDocument.getText().substr(s[0].start,s[0].length),c=i>0&&0==a.trim().length,u=o>t.selection.activeSubDocument.getText().length||0==l.trim().length||"."==l||":"==l;return e[0].start=i-(c&&u?1:0),e[0].length=o-i-1+(c&&u?1:0),e}},A=function(e,t){if("pasteit"==e.toLowerCase())return j("pasteselection",t),!0;var n=t.selection.intervals[0];0==n.length&&L(r.SELECT_WORD,1,t);let i=t.selection.intervals[0],o=t.selection.activeSubDocument.getText().substr(i.start,i.length),a=o[o.length-1];if("\n"!=a&&"\r"!=a&&"\r\n"!=a&&"\v"!=a||(i.length=i.length-1,t.selection.setSelection(i)),t.selection.intervals[0].length>0){var s=!1;if("bold"==e.toLowerCase()||"unbold"==e.toLowerCase()||"boldit"==e.toLowerCase()||"unboldit"==e.toLowerCase())j("togglefontbold",t),t.selection.setSelection(t.selection.intervals[0].end),j("togglefontbold",t),s=!0;else if("italicize"==e.toLowerCase()||"unitalicize"==e.toLowerCase()||"italicizeit"==e.toLowerCase()||"unitalicizeit"==e.toLowerCase())j("togglefontitalic",t),t.selection.setSelection(t.selection.intervals[0].end),j("togglefontitalic",t),s=!0;else if("deunderline"==e.toLowerCase()||"underline"==e.toLowerCase()||"deunderlineit"==e.toLowerCase()||"underlineit"==e.toLowerCase()||"ununderlineit"==e.toLowerCase())j("togglefontunderline",t),t.selection.setSelection(t.selection.intervals[0].end),j("togglefontunderline",t),s=!0;else if("uppercaseit"==e.toLowerCase())w("toUpper",t),s=!0;else if("uncapitalize"==e.toLowerCase()||"uncapitalizeit"==e.toLowerCase())w("toLower",t),s=!0;else if("capitalize"==e.toLowerCase()||"capitalizeit"==e.toLowerCase())w("toTitle",t),s=!0;else if("copyit"==e.toLowerCase())t.selection.intervals[0],j("copyselection",t),t.selection.setSelection(t.selection.intervals[0].end),s=!0;else if("delete"==e.toLowerCase()||"deleteit"==e.toLowerCase()||"pressdelete"==e.toLowerCase()){var l=t.selection.intervals[0];t.selection.activeSubDocument.deleteText(l),l.length=0,t.selection.setSelection(l),s=!0}return s||t.selection.setSelection(n),s}return!1},w=function(e,t){let n,i=t.selection.intervals[0],o=t.selection.activeSubDocument,r=o.getText(i);"toUpper"==e?n=r.toUpperCase():"toLower"==e?n=r.toLowerCase():"toTitle"==e&&(n=r.replace(/\b(?!_)\w+/g,((e,t,n)=>t>0&&"_"===n[t-1]?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()))),t.history.beginTransaction(),t.beginUpdate();for(let e=0;e<r.length;e++){let t={start:i.start+e,length:1},r=o.getCharacterProperties(t),a=o.getParagraphProperties(t);o.deleteText(t),o.insertText(t.start,n[e]),o.setCharacterProperties(t,r),o.setParagraphProperties(t,a)}t.endUpdate(),t.history.endTransaction(),t.selection.setSelection(i.end)},_=function(e,t,n){return r.SELECT_WORD==e?x(t,n):r.SELECT_SENTENCE==e?M(t,n):r.SELECT_LINE==e?k(t,n):r.SELECT_PARAGRAPH==e?F(t,n):void 0},L=function(e,t,n){return r.SELECT_WORD==e?I(t,n):r.SELECT_SENTENCE==e?P(t,n):r.SELECT_LINE==e?D(t,n):r.SELECT_PARAGRAPH==e?B(t,n):void 0},I=function(e,t){try{var n=t.selection.intervals[0].start,i=t.selection.intervals[0];if(0==n)return null;for(var o=null,r=0,a=!0,s=0,l=!1,c=n;c>0;c--){var u=c-1;i.start=u,i.length=1,t.selection.setSelection(i);var d=t.selection.intervals,h=t.selection.activeSubDocument.getText().substr(d[0].start,d[0].length);if(null==o&&0==h.trim().length&&(l=!0),o=d,s=d[0].start,(!a||0!=h.trim().length)&&(a=!1,0==h.trim().length)){for(;c>0;){u=c-1,i.start=u,i.length=1,t.selection.setSelection(i);i=t.selection.intervals;if(t.selection.activeSubDocument.getText().substr(i[0].start,i[0].length).trim().length>0){c++;break}c--}if(++r==e){s+=1;break}}}var g=null,f=t.selection.activeSubDocument.getText().length;for(c=n;c<=f;c++){i.start=c,i.length=1,t.selection.setSelection(i);d=t.selection.intervals,h=t.selection.activeSubDocument.getText().substr(d[0].start,d[0].length);if(g=d,"\n"==h||"\r"==h||"\r\n"==h||"\v"==h)break;if(l){if(h.trim().length>0)break}else 0==h.trim().length&&(l=!0)}return null==o?null:(i.start=s,i.length=g[0].start-s,t.selection.setSelection(i),t.selection.intervals)}catch(e){return console.error(e,e.stack),null}},x=function(e,t){try{var n=t.selection.intervals[0].start,i=t.selection.intervals[0];if(!t.selection.collapsed)n+=(i=t.selection.intervals)[0].length;var o=t.selection.activeSubDocument.getText().length;if(n==o)return null;for(var r=null,a=!0,s=0,l=!1,c=0,u=n,d=1,h=n;h<o;h++){i.start=h,i.length=1,t.selection.setSelection(i);var g=t.selection.intervals,f=t.selection.activeSubDocument.getText().substr(g[0].start,g[0].length);if(null!=r||0!=f.trim().length){if(r=g,c=g[0].start+g[0].length,(!a||0!=f.trim().length)&&(a=!1,0==f.trim().length)){if(s++,("\n"==f||"\r"==f||"\r\n"==f)&&s==e){c--;break}for(;h<o;){i.start=h,i.length=1,t.selection.setSelection(i);var p=t.selection.intervals,m=t.selection.activeSubDocument.getText().substr(p[0].start,p[0].length);if(("\n"==m||"\r"==m||"\r\n"==m)&&s==e)break;if(m.trim().length>0){h--;break}r=p,c=p[0].start+p[0].length,h++}if(s==e)break}}else l=!0,r=g}if(!l){for(h=n;h>-1;h--){i.start=h,i.length=1,t.selection.setSelection(i);g=t.selection.intervals,f=t.selection.activeSubDocument.getText().substr(g[0].start,g[0].length);if(u=g[0].start,0==f.trim().length)break}0==u&&(d=0)}return null==r?null:(i.start=u+d,i.length=c-(u+d),t.selection.setSelection(i),t.selection.intervals)}catch(e){return console.error(e,e.stack),null}},P=function(e,t){try{var n=t.selection.activeSubDocument.text.length,i=t.selection.intervals[0].start,o=t.selection.intervals[0];if(0==i)return null;for(var r=i,a=!0,s=!0,l=i;l>0;l--){var c=l-1;o.start=c,o.length=1,t.selection.setSelection(o);var u=t.selection.intervals,d=t.selection.activeSubDocument.getText().substr(u[0].start,u[0].length);if(!s||0!=d.trim().length)if(s&&"."==d.trim())s=!1,a=!1;else{if(s=!1,"."==d.trim()&&e--,0==e)break;d.trim().length>0&&(r=c)}}if(a)for(l=i;l<n;l++){o.start=l,o.length=1,t.selection.setSelection(o);var h=t.selection.intervals,g=t.selection.activeSubDocument.getText().substr(h[0].start,h[0].length);if(g=g.trim(),i++,"."==g){for(;l<n;){o.start=l,o.length=1,t.selection.setSelection(o);var f=t.selection.intervals,p=t.selection.activeSubDocument.getText().substr(f[0].start,f[0].length);if("."!=p.trim()&&" "!=p){l--,i--;break}l++,i++}break}}o.start=i-1,o.length=0,t.selection.setSelection(o);var m=i-r;return o.start=r,o.length=m,t.selection.setSelection(o),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},M=function(e,t){try{var n=t.selection.activeSubDocument.getText().length,i=t.selection.intervals[0],o=i.start;if(!t.selection.collapsed)o+=t.selection.intervals[0].length;if(n==o)return null;for(var r="",a=o;a>0;a--){var s=a-1;i.start=s,i.length=1,t.selection.setSelection(i);var l=t.selection.intervals,c=t.selection.activeSubDocument.getText().substr(l[0].start,l[0].length);if("."==c.trim()){0==r.length&&o++;break}r=c.trim(),o--}var u=o,d=!0;for(a=o;a<n;a++){i.start=a,i.length=1,t.selection.setSelection(i);var h=t.selection.intervals,g=t.selection.activeSubDocument.getText().substr(h[0].start,h[0].length);if(u=a,!d||0!=g.trim().length&&"."!=g.trim()){if(d=!1,"."==g.trim())for(e--;a<n;){i.start=a,i.length=1,t.selection.setSelection(i);var f=t.selection.intervals,p=t.selection.activeSubDocument.getText().substr(f[0].start,f[0].length);if(!("."==p.trim()||0==p.trim().length)||("\n"==p||"\r"==p||"\r\n"==p)){u=--a;break}u=++a}if(0==e)break}}o<=0&&(o=0),i.start=o,i.length=0,t.selection.setSelection(i);var m=u-o+1;return i.start=o,i.length=m,t.selection.setSelection(i),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},D=function(e,t){try{j("gotolineend",t);var n=t.selection.intervals[0].start;if(0==n)return null;for(var i=1;i<e;i++)j("lineup",t);j("gotolinestart",t);var o=t.selection.intervals[0].start,r=t.selection.intervals[0];return r.start=o,r.length=n-o,t.selection.setSelection(r),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},k=function(e,t){try{j("gotolinestart",t);for(var n=t.selection.intervals[0].start,i=1;i<e;i++)j("linedown",t);j("gotolineend",t);var o=t.selection.intervals[0].start,r=t.selection.intervals[0];return r.start=n,r.length=o-n,t.selection.setSelection(r),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},B=function(e,t){try{j("gotoendparagraph",t);var n=t.selection.intervals[0].start;if(0==n)return null;for(var i=1;i<=e;i++)j("gotostartparagraph",t);var o=t.selection.intervals[0].start,r=t.selection.intervals[0];return r.start=o,r.length=n-o,t.selection.setSelection(r),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},F=function(e,t){try{j("gotostartparagraph",t);for(var n=t.selection.intervals[0].start,i=1;i<=e;i++)j("gotoendparagraph",t);var o=t.selection.intervals[0].start,r=t.selection.intervals[0];return r.start=n,r.length=o-n,t.selection.setSelection(r),t.selection.intervals}catch(e){return console.error(e,e.stack),null}},j=function(e,t){try{var n=T[e.toLowerCase().trim()];if(null!=n&&null!=n)return void t.document.subDocuments._core.commandManager.getCommand(n).execute(!1,void 0)}catch(e){console.error(e)}};class U{static setAnchoredElement(e,t){let n={anchoredElement:e,elementName:t};U.anchoredEditor=n}static moveToPreviousField(e,t){const n=t.findIndex((t=>t.controlId===e.id));if(n>0){const e=t[n-1];if(e){document.querySelector(`#${e.controlId}`).focus()}}}static moveToNextField(e,t){const n=e.getAttribute("id"),i=t.findIndex((e=>e.controlId===n));if(i<t.length){const e=t[i+1];if(e){document.querySelector(`#${e.controlId}`).focus()}}}static getActiveEditorElement(){if(U.anchoredEditor&&U.anchoredEditor.anchoredElement)return U.anchoredEditor.anchoredElement;let e=document.activeElement;if(e instanceof HTMLIFrameElement){const t=e.contentWindow?e.contentWindow.document.activeElement:null;t&&e.contentWindow&&t!==e.contentWindow.document.body&&(e=t)}return e}}class G{get loggingEnabled(){return this._loggingEnabled}set loggingEnabled(e){this._loggingEnabled=e}constructor(e,t){Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"Interop"}),Object.defineProperty(this,"_loggingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this._loggingEnabled=e,this._logTag=t}log(e){this._loggingEnabled&&a.log(e,this._logTag)}error(e){this._loggingEnabled&&a.error(e,this._logTag)}}var W;class V{static capitalizeFirstLetter(e,t){const n=e.split("");if(n.length>0)for(let e=t;e<n.length;e++){if(""!==(n[e]+"").trim()){n[e]=n[e].toUpperCase();break}}return e=n.join("")}static beautify(e){const t=e.indexOf("#");return-1!==t&&t<e.length-1&&(e=this.capitalizeFirstLetter(e,t+1)),e}}
2
+ /*************************************************************************
3
+ * @package AugnitoDomParser
4
+ * @license Restricted
5
+ * Extension Name: Augnito
6
+ * Description: Voice powered medical reporting
7
+ * Version: 1.0.12
8
+ * Email: support@scribetech.in
9
+ *
10
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
11
+ *
12
+ * The contents / part of the Augnito shall not be copied and/or
13
+ * distributed without the express permission of
14
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
15
+ * License.
16
+ *
17
+ * AUGNITO CONFIDENTIAL
18
+ * __________________
19
+ *
20
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
21
+ * All Rights Reserved.
22
+ *
23
+ * NOTICE: All information contained herein is, and remains
24
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
25
+ * if any. The intellectual, technical concepts and contents contained
26
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
27
+ * and its suppliers in process, and are protected by trade secret or
28
+ * copyright law.
29
+ * Dissemination of this information or reproduction of this material
30
+ * is strictly forbidden unless prior written permission is obtained
31
+ * from ScribeTech India Healthcare Pvt ltd.
32
+ */
33
+ function H(){var e="object",t="undefined",n=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"],i=["setStart","setStartBefore","setStartAfter","setEnd","setEndBefore","setEndAfter","collapse","selectNode","selectNodeContents","compareBoundaryPoints","deleteContents","extractContents","cloneContents","insertNode","surroundContents","cloneRange","toString","detach"],o=["boundingHeight","boundingLeft","boundingTop","boundingWidth","htmlText","text"],r=["collapse","compareEndPoints","duplicate","moveToElementText","parentElement","select","setEndPoint","getBoundingClientRect"];function a(t,n){var i=typeof t[n];return"function"==i||!(i!=e||!t[n])||"unknown"==i}function s(t,n){return!(typeof t[n]!=e||!t[n])}function l(e,n){return typeof e[n]!=t}function c(e){return function(t,n){for(var i=n.length;i--;)if(!e(t,n[i]))return!1;return!0}}var u=c(a),d=c(s),h=c(l);function g(e){return e&&u(e,r)&&h(e,o)}function f(e){return s(e,"body")?e.body:e.getElementsByTagName("body")[0]}var p,m,v={},b=typeof window!=t&&typeof document!=t,E={isHostMethod:a,isHostObject:s,isHostProperty:l,areHostMethods:u,areHostObjects:d,areHostProperties:h,isTextRange:g,getBody:f,forEach:[].forEach?function(e,t){e.forEach(t)}:function(e,t){for(var n=0,i=e.length;n<i;++n)t(e[n],n)}},S={version:"1.1.0",initialized:!1,isBrowser:b,supported:!0,util:E,features:{},modules:v,config:{alertOnFail:!1,alertOnWarn:!1,preferTextRange:!1,autoInitialize:typeof augnitoRangeAutoInitialize==t||augnitoRangeAutoInitialize}};function C(e){typeof console!=t&&a(console,"log")&&console.log(e)}function T(e,t){b&&t?(alert(e),C(e)):C(e)}function R(e){S.initialized=!0,S.supported=!1,T("AugnitoRange is not supported in this environment. Reason: "+e,S.config.alertOnFail)}S.fail=R,S.warn=function(e){T("AugnitoRange warning: "+e,S.config.alertOnWarn)},{}.hasOwnProperty?(E.extend=p=function(e,t,n){var i,o;for(var r in t)t.hasOwnProperty(r)&&(i=e[r],o=t[r],n&&null!==i&&"object"==typeof i&&null!==o&&"object"==typeof o&&p(i,o,!0),e[r]=o);return t.hasOwnProperty("toString")&&(e.toString=t.toString),e},E.createOptions=function(e,t){var n={};return p(n,t),e&&p(n,e),n}):R("hasOwnProperty not supported"),b||R("AugnitoRange can only run in a browser"),function(){var e;if(b){var t=document.createElement("div");t.appendChild(document.createElement("span"));var n=[].slice;try{1==n.call(t.childNodes,0)[0].nodeType&&(e=function(e){return n.call(e,0)})}catch(e){}}e||(e=function(e){for(var t=[],n=0,i=e.length;n<i;++n)t[n]=e[n];return t}),E.toArray=e}(),b&&(a(document,"addEventListener")?m=function(e,t,n){e.addEventListener(t,n,!1)}:a(document,"attachEvent")?m=function(e,t,n){e.attachEvent("on"+t,n)}:R("Document does not have required addEventListener or attachEvent method"),E.addListener=m);var y=[];function N(e){return e.message||e.description||String(e)}function O(){if(b&&!S.initialized){var e,t=!1,o=!1;a(document,"createRange")&&(e=document.createRange(),u(e,i)&&h(e,n)&&(t=!0));var r=f(document);if(r&&"body"==r.nodeName.toLowerCase())if(r&&a(r,"createTextRange")&&g(e=r.createTextRange())&&(o=!0),t||o){var s;for(var l in S.initialized=!0,S.features={implementsDomRange:t,implementsTextRange:o},v)(s=v[l])instanceof L&&s.init(s,S);for(var c=0,d=y.length;c<d;++c)try{y[c](S)}catch(e){C("AugnitoRange init listener threw an exception. Continuing. Detail: "+N(e))}}else R("Neither Range nor TextRange are available");else R("No body element found")}}function A(e,t,n){n&&(e+=" in module "+n.name),S.warn("DEPRECATED: "+e+" is deprecated. Please use "+t+" instead.")}function w(e,t,n,i){e[t]=function(){return A(t,n,i),e[n].apply(e,E.toArray(arguments))}}E.deprecationNotice=A,E.createAliasForDeprecatedMethod=w,S.init=O,S.addInitListener=function(e){S.initialized?e(S):y.push(e)};var _=[];function L(e,t,n){this.name=e,this.dependencies=t,this.initialized=!1,this.supported=!1,this.initializer=n}function I(e,t,n){var i=new L(e,t,(function(t){if(!t.initialized){t.initialized=!0;try{n(S,t),t.supported=!0}catch(t){C("Module '"+e+"' failed to load: "+N(t)),t.stack&&C(t.stack)}}}));return v[e]=i,i}function x(){}S.addShimListener=function(e){_.push(e)},b&&(S.shim=S.createMissingNativeApi=function(e){e=e||window,O();for(var t=0,n=_.length;t<n;++t)_[t](e)},w(S,"createMissingNativeApi","shim")),L.prototype={init:function(){for(var e,t,n=this.dependencies||[],i=0,o=n.length;i<o;++i){if(t=n[i],!((e=v[t])&&e instanceof L))throw new Error("required module '"+t+"' not found");if(e.init(),!e.supported)throw new Error("required module '"+t+"' not supported")}this.initializer(this)},fail:function(e){throw this.initialized=!0,this.supported=!1,new Error(e)},warn:function(e){S.warn("Module "+this.name+": "+e)},deprecationNotice:function(e,t){S.warn("DEPRECATED: "+e+" in module "+this.name+" is deprecated. Please use "+t+" instead")},createError:function(e){return new Error("Error in AugnitoRange "+this.name+" module: "+e)}},S.createModule=function(e){var t,n;2==arguments.length?(t=arguments[1],n=[]):(t=arguments[2],n=arguments[1]);var i=I(e,n,t);S.initialized&&S.supported&&i.init()},S.createCoreModule=function(e,t,n){I(e,t,n)},S.RangePrototype=x,S.rangePrototype=new x,S.selectionPrototype=new function(){},S.createCoreModule("DomUtil",[],(function(e,t){var n="undefined",i=e.util,o=i.getBody;i.areHostMethods(document,["createDocumentFragment","createElement","createTextNode"])||t.fail("document missing a Node creation method"),i.isHostMethod(document,"getElementsByTagName")||t.fail("document missing getElementsByTagName method");var r=document.createElement("div");i.areHostMethods(r,["insertBefore","appendChild","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"]))||t.fail("Incomplete Element implementation"),i.isHostProperty(r,"innerHTML")||t.fail("Element is missing innerHTML property");var a=document.createTextNode("test");i.areHostMethods(a,["splitText","deleteData","insertData","appendData","cloneNode"]||!i.areHostObjects(r,["previousSibling","nextSibling","childNodes","parentNode"])||!i.areHostProperties(a,["data"]))||t.fail("Incomplete Text Node implementation");var s=function(e,t){for(var n=e.length;n--;)if(e[n]===t)return!0;return!1};function l(e){for(var t=0;e=e.previousSibling;)++t;return t}function c(e,t){var n,i=[];for(n=e;n;n=n.parentNode)i.push(n);for(n=t;n;n=n.parentNode)if(s(i,n))return n;return null}function u(e,t,n){for(var i=n?t:t.parentNode;i;){if(i===e)return!0;i=i.parentNode}return!1}function d(e,t,n){for(var i,o=n?e:e.parentNode;o;){if((i=o.parentNode)===t)return o;o=i}return null}function h(e){var t=e.nodeType;return 3==t||4==t||8==t}function g(e,t){var n=t.nextSibling,i=t.parentNode;return n?i.insertBefore(e,n):i.appendChild(e),e}function f(e){if(9==e.nodeType)return e;if(typeof e.ownerDocument!=n)return e.ownerDocument;if(typeof e.document!=n)return e.document;if(e.parentNode)return f(e.parentNode);throw t.createError("getDocument: no document found for node")}function p(e){var i=f(e);if(typeof i.defaultView!=n)return i.defaultView;if(typeof i.parentWindow!=n)return i.parentWindow;throw t.createError("Cannot get a window object for node")}function m(e){if(typeof e.contentDocument!=n)return e.contentDocument;if(typeof e.contentWindow!=n)return e.contentWindow.document;throw t.createError("getIframeDocument: No Document object found for iframe element")}function v(e){return e&&i.isHostMethod(e,"setTimeout")&&i.isHostObject(e,"document")}var b,E=!1;function S(e){try{return e.parentNode,!1}catch(e){return!0}}function C(e){if(!e)return"[No node]";if(E&&S(e))return"[Broken node]";if(h(e))return'"'+e.data+'"';if(1==e.nodeType){var t=e.id?' id="'+e.id+'"':"";return"<"+e.nodeName+t+">[index:"+l(e)+",length:"+e.childNodes.length+"]["+(e.innerHTML||"[innerHTML not supported]").slice(0,25)+"]"}return e.nodeName}function T(e){this.root=e,this._next=e}function R(e,t){this.node=e,this.offset=t}function y(e){this.code=this[e],this.codeName=e,this.message="DOMException: "+this.codeName}!function(){var t=document.createElement("b");t.innerHTML="1";var n=t.firstChild;t.innerHTML="<br />",E=S(n),e.features.crashyTextNodes=E}(),typeof window.getComputedStyle!=n?b=function(e,t){return p(e).getComputedStyle(e,null)[t]}:typeof document.documentElement.currentStyle!=n?b=function(e,t){return e.currentStyle?e.currentStyle[t]:""}:t.fail("No means of obtaining computed style properties found"),T.prototype={_current:null,hasNext:function(){return!!this._next},next:function(){var e,t,n=this._current=this._next;if(this._current)if(e=n.firstChild)this._next=e;else{for(t=null;n!==this.root&&!(t=n.nextSibling);)n=n.parentNode;this._next=t}return this._current},detach:function(){this._current=this._next=this.root=null}},R.prototype={equals:function(e){return!!e&&this.node===e.node&&this.offset==e.offset},inspect:function(){return"[DomPosition("+C(this.node)+":"+this.offset+")]"},toString:function(){return this.inspect()}},y.prototype={INDEX_SIZE_ERR:1,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INVALID_STATE_ERR:11,INVALID_NODE_TYPE_ERR:24},y.prototype.toString=function(){return this.message},e.dom={arrayContains:s,isHtmlNamespace:function(e){var t;return typeof e.namespaceURI==n||null===(t=e.namespaceURI)||"http://www.w3.org/1999/xhtml"==t},parentElement:function(e){var t=e.parentNode;return 1==t.nodeType?t:null},getNodeIndex:l,getNodeLength:function(e){switch(e.nodeType){case 7:case 10:return 0;case 3:case 8:return e.length;default:return e.childNodes.length}},getCommonAncestor:c,isAncestorOf:u,isOrIsAncestorOf:function(e,t){return u(e,t,!0)},getClosestAncestorIn:d,isCharacterDataNode:h,isTextOrCommentNode:function(e){if(!e)return!1;var t=e.nodeType;return 3==t||8==t},insertAfter:g,splitDataNode:function(e,t,n){var i=e.cloneNode(!1);if(i.deleteData(0,t),e.deleteData(t,e.length-t),g(i,e),n)for(var o,r=0;o=n[r++];)o.node==e&&o.offset>t?(o.node=i,o.offset-=t):o.node==e.parentNode&&o.offset>l(e)&&++o.offset;return i},getDocument:f,getWindow:p,getIframeWindow:function(e){if(typeof e.contentWindow!=n)return e.contentWindow;if(typeof e.contentDocument!=n)return e.contentDocument.defaultView;throw t.createError("getIframeWindow: No Window object found for iframe element")},getIframeDocument:m,getBody:o,isWindow:v,getContentDocument:function(e,t,n){var o;if(e?i.isHostProperty(e,"nodeType")?o=1==e.nodeType&&"iframe"==e.tagName.toLowerCase()?m(e):f(e):v(e)&&(o=e.document):o=document,!o)throw t.createError(n+"(): Parameter must be a Window object or DOM node");return o},getRootContainer:function(e){for(var t;t=e.parentNode;)e=t;return e},comparePoints:function(e,n,i,o){var r,a,s,u,h;if(e==i)return n===o?0:n<o?-1:1;if(r=d(i,e,!0))return n<=l(r)?-1:1;if(r=d(e,i,!0))return l(r)<o?-1:1;if(!(a=c(e,i)))throw new Error("comparePoints error: nodes have no common ancestor");if((s=e===a?a:d(e,a,!0))===(u=i===a?a:d(i,a,!0)))throw t.createError("comparePoints got to case 4 and childA and childB are the same!");for(h=a.firstChild;h;){if(h===s)return-1;if(h===u)return 1;h=h.nextSibling}},isBrokenNode:S,inspectNode:C,getComputedStyleProperty:b,createTestElement:function(e,t,n){var i=o(e),r=e.createElement("div");r.contentEditable=""+!!n,t&&(r.innerHTML=t);var a=i.firstChild;return a?i.insertBefore(r,a):i.appendChild(r),r},removeNode:function(e){return e.parentNode.removeChild(e)},fragmentFromNodeChildren:function(e){for(var t,n=f(e).createDocumentFragment();t=e.firstChild;)n.appendChild(t);return n},createIterator:function(e){return new T(e)},DomPosition:R},e.DOMException=y})),S.createCoreModule("DomRange",["DomUtil"],(function(e,t){var n=e.dom,i=e.util,o=n.DomPosition,r=e.DOMException,a=n.isCharacterDataNode,s=n.getNodeIndex,l=n.isOrIsAncestorOf,c=n.getDocument,u=n.comparePoints,d=n.splitDataNode,h=n.getClosestAncestorIn,g=n.getNodeLength,f=n.arrayContains,p=n.getRootContainer,m=e.features.crashyTextNodes,v=n.removeNode;function b(e,t){return 3!=e.nodeType&&(l(e,t.startContainer)||l(e,t.endContainer))}function E(e){return e.document||c(e.startContainer)}function S(e){return new o(e.parentNode,s(e))}function C(e){return new o(e.parentNode,s(e)+1)}function T(e,t,i){var o=11==e.nodeType?e.firstChild:e;return a(t)?i==t.length?n.insertAfter(e,t):t.parentNode.insertBefore(e,0==i?t:d(t,i)):i>=t.childNodes.length?t.appendChild(e):t.insertBefore(e,t.childNodes[i]),o}function R(e,t,n){if(K(e),K(t),E(t)!=E(e))throw new r("WRONG_DOCUMENT_ERR");var i=u(e.startContainer,e.startOffset,t.endContainer,t.endOffset),o=u(e.endContainer,e.endOffset,t.startContainer,t.startOffset);return n?i<=0&&o>=0:i<0&&o>0}function y(e){for(var t,n,i,o=E(e.range).createDocumentFragment();n=e.next();){if(t=e.isPartiallySelectedSubtree(),n=n.cloneNode(!t),t&&(i=e.getSubtreeIterator(),n.appendChild(y(i)),i.detach()),10==n.nodeType)throw new r("HIERARCHY_REQUEST_ERR");o.appendChild(n)}return o}function N(e,t,i){var o,r,a,s;for(i=i||{stop:!1};a=e.next();)if(e.isPartiallySelectedSubtree()){if(!1===t(a))return void(i.stop=!0);if(N(s=e.getSubtreeIterator(),t,i),s.detach(),i.stop)return}else for(o=n.createIterator(a);r=o.next();)if(!1===t(r))return void(i.stop=!0)}function O(e){for(var t;e.next();)e.isPartiallySelectedSubtree()?(O(t=e.getSubtreeIterator()),t.detach()):e.remove()}function A(e){for(var t,n,i=E(e.range).createDocumentFragment();t=e.next();){if(e.isPartiallySelectedSubtree()?(t=t.cloneNode(!1),n=e.getSubtreeIterator(),t.appendChild(A(n)),n.detach()):e.remove(),10==t.nodeType)throw new r("HIERARCHY_REQUEST_ERR");i.appendChild(t)}return i}function w(e){return"["+(void 0===e.getName?"Range":e.getName())+"("+n.inspectNode(e.startContainer)+":"+e.startOffset+", "+n.inspectNode(e.endContainer)+":"+e.endOffset+")]"}function _(e,t){if(this.range=e,this.clonePartiallySelectedTextNodes=t,!e.collapsed){this.sc=e.startContainer,this.so=e.startOffset,this.ec=e.endContainer,this.eo=e.endOffset;var n=e.commonAncestorContainer;this.sc===this.ec&&a(this.sc)?(this.isSingleCharacterDataNode=!0,this._first=this._last=this._next=this.sc):(this._first=this._next=this.sc!==n||a(this.sc)?h(this.sc,n,!0):this.sc.childNodes[this.so],this._last=this.ec!==n||a(this.ec)?h(this.ec,n,!0):this.ec.childNodes[this.eo-1])}}_.prototype={_current:null,_next:null,_first:null,_last:null,isSingleCharacterDataNode:!1,reset:function(){this._current=null,this._next=this._first},hasNext:function(){return!!this._next},next:function(){var e=this._current=this._next;return e&&(this._next=e!==this._last?e.nextSibling:null,a(e)&&this.clonePartiallySelectedTextNodes&&(e===this.ec&&(e=e.cloneNode(!0)).deleteData(this.eo,e.length-this.eo),this._current===this.sc&&(e=e.cloneNode(!0)).deleteData(0,this.so))),e},remove:function(){var e,t,n=this._current;!a(n)||n!==this.sc&&n!==this.ec?n.parentNode&&v(n):(e=n===this.sc?this.so:0)!=(t=n===this.ec?this.eo:n.length)&&n.deleteData(e,t-e)},isPartiallySelectedSubtree:function(){return b(this._current,this.range)},getSubtreeIterator:function(){var e;if(this.isSingleCharacterDataNode)(e=this.range.cloneRange()).collapse(!1);else{e=new re(E(this.range));var t=this._current,n=t,i=0,o=t,r=g(t);l(t,this.sc)&&(n=this.sc,i=this.so),l(t,this.ec)&&(o=this.ec,r=this.eo),oe(e,n,i,o,r)}return new _(e,this.clonePartiallySelectedTextNodes)},detach:function(){this.range=this._current=this._next=this._first=this._last=this.sc=this.so=this.ec=this.eo=null}};var L=[1,3,4,5,7,8,10],I=[2,9,11],x=[1,3,4,5,7,8,10,11],P=[1,3,4,5,7,8];function M(e){return function(t,n){for(var i,o=n?t:t.parentNode;o;){if(i=o.nodeType,f(e,i))return o;o=o.parentNode}return null}}var D=M([9,11]),k=M([5,6,10,12]),B=M([6,10,12]);function F(e,t){if(B(e,t))throw new r("INVALID_NODE_TYPE_ERR")}function j(e,t){if(!f(t,e.nodeType))throw new r("INVALID_NODE_TYPE_ERR")}function U(e,t){if(t<0||t>(a(e)?e.length:e.childNodes.length))throw new r("INDEX_SIZE_ERR")}function G(e,t){if(D(e,!0)!==D(t,!0))throw new r("WRONG_DOCUMENT_ERR")}function W(e){if(k(e,!0))throw new r("NO_MODIFICATION_ALLOWED_ERR")}function V(e,t){if(!e)throw new r(t)}function H(e,t){return t<=(a(e)?e.length:e.childNodes.length)}function z(e){return!!e.startContainer&&!!e.endContainer&&!(m&&(n.isBrokenNode(e.startContainer)||n.isBrokenNode(e.endContainer)))&&p(e.startContainer)==p(e.endContainer)&&H(e.startContainer,e.startOffset)&&H(e.endContainer,e.endOffset)}function K(e){if(!z(e))throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: ("+e.inspect()+")")}var X=document.createElement("style"),q=!1;try{X.innerHTML="<b>x</b>",q=3==X.firstChild.nodeType}catch(e){}e.features.htmlParsingConforms=q;var J=q?function(e){var t=this.startContainer,i=c(t);if(!t)throw new r("INVALID_STATE_ERR");var o=null;return 1==t.nodeType?o=t:a(t)&&(o=n.parentElement(t)),(o=null===o||"HTML"==o.nodeName&&n.isHtmlNamespace(c(o).documentElement)&&n.isHtmlNamespace(o)?i.createElement("body"):o.cloneNode(!1)).innerHTML=e,n.fragmentFromNodeChildren(o)}:function(e){var t=E(this).createElement("body");return t.innerHTML=e,n.fragmentFromNodeChildren(t)};function $(e,t){K(e);var n=e.startContainer,i=e.startOffset,o=e.endContainer,r=e.endOffset,l=n===o;a(o)&&r>0&&r<o.length&&d(o,r,t),a(n)&&i>0&&i<n.length&&(n=d(n,i,t),l?(r-=i,o=n):o==n.parentNode&&r>=s(n)&&r++,i=0),e.setStartAndEnd(n,i,o,r)}function Y(e){K(e);var t=e.commonAncestorContainer.parentNode.cloneNode(!1);return t.appendChild(e.cloneContents()),t.innerHTML}var Z=["startContainer","startOffset","endContainer","endOffset","collapsed","commonAncestorContainer"];function Q(e){e.START_TO_START=0,e.START_TO_END=1,e.END_TO_END=2,e.END_TO_START=3,e.NODE_BEFORE=0,e.NODE_AFTER=1,e.NODE_BEFORE_AND_AFTER=2,e.NODE_INSIDE=3}function ee(e){Q(e),Q(e.prototype)}function te(e,t){return function(){K(this);var n,i=this.startContainer,o=this.startOffset,r=this.commonAncestorContainer,a=new _(this,!0);i!==r&&(i=(n=C(h(i,r,!0))).node,o=n.offset),N(a,W),a.reset();var s=e(a);return a.detach(),t(this,i,o,i,o),s}}function ne(t,n){function o(e,t){return function(n){j(n,L),j(p(n),I);var i=(e?S:C)(n);(t?r:l)(this,i.node,i.offset)}}function r(e,t,i){var o=e.endContainer,r=e.endOffset;t===e.startContainer&&i===e.startOffset||(p(t)==p(o)&&1!=u(t,i,o,r)||(o=t,r=i),n(e,t,i,o,r))}function l(e,t,i){var o=e.startContainer,r=e.startOffset;t===e.endContainer&&i===e.endOffset||(p(t)==p(o)&&-1!=u(t,i,o,r)||(o=t,r=i),n(e,o,r,t,i))}var c=function(){};c.prototype=e.rangePrototype,t.prototype=new c,i.extend(t.prototype,{setStart:function(e,t){F(e,!0),U(e,t),r(this,e,t)},setEnd:function(e,t){F(e,!0),U(e,t),l(this,e,t)},setStartAndEnd:function(){var e=arguments,t=e[0],i=e[1],o=t,r=i;switch(e.length){case 3:r=e[2];break;case 4:o=e[2],r=e[3]}n(this,t,i,o,r)},setBoundary:function(e,t,n){this["set"+(n?"Start":"End")](e,t)},setStartBefore:o(!0,!0),setStartAfter:o(!1,!0),setEndBefore:o(!0,!1),setEndAfter:o(!1,!1),collapse:function(e){K(this),e?n(this,this.startContainer,this.startOffset,this.startContainer,this.startOffset):n(this,this.endContainer,this.endOffset,this.endContainer,this.endOffset)},selectNodeContents:function(e){F(e,!0),n(this,e,0,e,g(e))},selectNode:function(e){F(e,!1),j(e,L);var t=S(e),i=C(e);n(this,t.node,t.offset,i.node,i.offset)},extractContents:te(A,n),deleteContents:te(O,n),canSurroundContents:function(){K(this),W(this.startContainer),W(this.endContainer);var e=new _(this,!0),t=e._first&&b(e._first,this)||e._last&&b(e._last,this);return e.detach(),!t},splitBoundaries:function(){$(this)},splitBoundariesPreservingPositions:function(e){$(this,e)},normalizeBoundaries:function(){K(this);var e,t=this.startContainer,i=this.startOffset,o=this.endContainer,r=this.endOffset,l=function(e){var t=e.nextSibling;t&&t.nodeType==e.nodeType&&(o=e,r=e.length,e.appendData(t.data),v(t))},c=function(e){var n=e.previousSibling;if(n&&n.nodeType==e.nodeType){t=e;var a=e.length;if(i=n.length,e.insertData(0,n.data),v(n),t==o)r+=i,o=t;else if(o==e.parentNode){var l=s(e);r==l?(o=e,r=a):r>l&&r--}}},u=!0;if(a(o))r==o.length?l(o):0==r&&(e=o.previousSibling)&&e.nodeType==o.nodeType&&(r=e.length,t==o&&(u=!1),e.appendData(o.data),v(o),o=e);else{if(r>0){var d=o.childNodes[r-1];d&&a(d)&&l(d)}u=!this.collapsed}if(u){if(a(t))0==i?c(t):i==t.length&&(e=t.nextSibling)&&e.nodeType==t.nodeType&&(o==e&&(o=t,r+=t.length),t.appendData(e.data),v(e));else if(i<t.childNodes.length){var h=t.childNodes[i];h&&a(h)&&c(h)}}else t=o,i=r;n(this,t,i,o,r)},collapseToPoint:function(e,t){F(e,!0),U(e,t),this.setStartAndEnd(e,t)}}),ee(t)}function ie(e){e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset,e.commonAncestorContainer=e.collapsed?e.startContainer:n.getCommonAncestor(e.startContainer,e.endContainer)}function oe(e,t,i,o,r){e.startContainer=t,e.startOffset=i,e.endContainer=o,e.endOffset=r,e.document=n.getDocument(t),ie(e)}function re(e){this.startContainer=e,this.startOffset=0,this.endContainer=e,this.endOffset=0,this.document=e,ie(this)}i.extend(e.rangePrototype,{compareBoundaryPoints:function(e,t){var n,i,o,r;K(this),G(this.startContainer,t.startContainer);var a=3==e||0==e?"start":"end",s=1==e||0==e?"start":"end";return n=this[a+"Container"],i=this[a+"Offset"],o=t[s+"Container"],r=t[s+"Offset"],u(n,i,o,r)},insertNode:function(e){if(K(this),j(e,x),W(this.startContainer),l(e,this.startContainer))throw new r("HIERARCHY_REQUEST_ERR");var t=T(e,this.startContainer,this.startOffset);this.setStartBefore(t)},cloneContents:function(){var e,t;if(K(this),this.collapsed)return E(this).createDocumentFragment();if(this.startContainer===this.endContainer&&a(this.startContainer))return(e=this.startContainer.cloneNode(!0)).data=e.data.slice(this.startOffset,this.endOffset),(t=E(this).createDocumentFragment()).appendChild(e),t;var n=new _(this,!0);return e=y(n),n.detach(),e},canSurroundContents:function(){K(this),W(this.startContainer),W(this.endContainer);var e=new _(this,!0),t=e._first&&b(e._first,this)||e._last&&b(e._last,this);return e.detach(),!t},surroundContents:function(e){if(j(e,P),!this.canSurroundContents())throw new r("INVALID_STATE_ERR");var t=this.extractContents();if(e.hasChildNodes())for(;e.lastChild;)e.removeChild(e.lastChild);T(e,this.startContainer,this.startOffset),e.appendChild(t),this.selectNode(e)},cloneRange:function(){K(this);for(var e,t=new re(E(this)),n=Z.length;n--;)t[e=Z[n]]=this[e];return t},toString:function(){K(this);var e=this.startContainer;if(e===this.endContainer&&a(e))return 3==e.nodeType||4==e.nodeType?e.data.slice(this.startOffset,this.endOffset):"";var t=[],n=new _(this,!0);return N(n,(function(e){3!=e.nodeType&&4!=e.nodeType||t.push(e.data)})),n.detach(),t.join("")},compareNode:function(e){K(this);var t=e.parentNode,n=s(e);if(!t)throw new r("NOT_FOUND_ERR");var i=this.comparePoint(t,n),o=this.comparePoint(t,n+1);return i<0?o>0?2:0:o>0?1:3},comparePoint:function(e,t){return K(this),V(e,"HIERARCHY_REQUEST_ERR"),G(e,this.startContainer),u(e,t,this.startContainer,this.startOffset)<0?-1:u(e,t,this.endContainer,this.endOffset)>0?1:0},createContextualFragment:J,toHtml:function(){return Y(this)},intersectsNode:function(e,t){if(K(this),p(e)!=p(this.startContainer))return!1;var n=e.parentNode,i=s(e);if(!n)return!0;var o=u(n,i,this.endContainer,this.endOffset),r=u(n,i+1,this.startContainer,this.startOffset);return t?o<=0&&r>=0:o<0&&r>0},isPointInRange:function(e,t){return K(this),V(e,"HIERARCHY_REQUEST_ERR"),G(e,this.startContainer),u(e,t,this.startContainer,this.startOffset)>=0&&u(e,t,this.endContainer,this.endOffset)<=0},intersectsRange:function(e){return R(this,e,!1)},intersectsOrTouchesRange:function(e){return R(this,e,!0)},intersection:function(e){if(this.intersectsRange(e)){var t=u(this.startContainer,this.startOffset,e.startContainer,e.startOffset),n=u(this.endContainer,this.endOffset,e.endContainer,e.endOffset),i=this.cloneRange();return-1==t&&i.setStart(e.startContainer,e.startOffset),1==n&&i.setEnd(e.endContainer,e.endOffset),i}return null},union:function(e){if(this.intersectsOrTouchesRange(e)){var t=this.cloneRange();return-1==u(e.startContainer,e.startOffset,this.startContainer,this.startOffset)&&t.setStart(e.startContainer,e.startOffset),1==u(e.endContainer,e.endOffset,this.endContainer,this.endOffset)&&t.setEnd(e.endContainer,e.endOffset),t}throw new r("Ranges do not intersect")},containsNode:function(e,t){return t?this.intersectsNode(e,!1):3==this.compareNode(e)},containsNodeContents:function(e){return this.comparePoint(e,0)>=0&&this.comparePoint(e,g(e))<=0},containsRange:function(e){var t=this.intersection(e);return null!==t&&e.equals(t)},containsNodeText:function(e){var t=this.cloneRange();t.selectNode(e);var n=t.getNodes([3]);if(n.length>0){t.setStart(n[0],0);var i=n.pop();return t.setEnd(i,i.length),this.containsRange(t)}return this.containsNodeContents(e)},getNodes:function(e,t){return K(this),function(e,t,n){var i,o=!(!t||!t.length),r=!!n;o&&(i=new RegExp("^("+t.join("|")+")$"));var s=[];return N(new _(e,!1),(function(t){if((!o||i.test(t.nodeType))&&(!r||n(t))){var l=e.startContainer;if(t!=l||!a(l)||e.startOffset!=l.length){var c=e.endContainer;t==c&&a(c)&&0==e.endOffset||s.push(t)}}})),s}(this,e,t)},getDocument:function(){return E(this)},collapseBefore:function(e){this.setEndBefore(e),this.collapse(!1)},collapseAfter:function(e){this.setStartAfter(e),this.collapse(!0)},getBookmark:function(t){var i=E(this),o=e.createRange(i);t=t||n.getBody(i),o.selectNodeContents(t);var r=this.intersection(o),a=0,s=0;return r&&(o.setEnd(r.startContainer,r.startOffset),s=(a=o.toString().length)+r.toString().length),{start:a,end:s,containerNode:t}},moveToBookmark:function(e){var t=e.containerNode,n=0;this.setStart(t,0),this.collapse(!0);for(var i,o,r,a,s=[t],l=!1,c=!1;!c&&(i=s.pop());)if(3==i.nodeType)o=n+i.length,!l&&e.start>=n&&e.start<=o&&(this.setStart(i,e.start-n),l=!0),l&&e.end>=n&&e.end<=o&&(this.setEnd(i,e.end-n),c=!0),n=o;else for(r=(a=i.childNodes).length;r--;)s.push(a[r])},getName:function(){return"DomRange"},equals:function(e){return re.rangesEqual(this,e)},isValid:function(){return z(this)},inspect:function(){return w(this)},detach:function(){}}),ne(re,oe),i.extend(re,{rangeProperties:Z,RangeIterator:_,copyComparisonConstants:ee,createPrototypeRange:ne,inspect:w,toHtml:Y,getRangeDocument:E,rangesEqual:function(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}}),e.DomRange=re})),S.createCoreModule("WrappedRange",["DomRange"],(function(e,t){var n,i,o=e.dom,r=e.util,a=o.DomPosition,s=e.DomRange,l=o.getBody,c=o.getContentDocument,u=o.isCharacterDataNode;if(e.features.implementsDomRange&&function(){var i,a,u=s.rangeProperties;function d(e){for(var t,n=u.length;n--;)e[t=u[n]]=e.nativeRange[t];e.collapsed=e.startContainer===e.endContainer&&e.startOffset===e.endOffset}n=function(e){if(!e)throw t.createError("WrappedRange: Range must be specified");this.nativeRange=e,d(this)},s.createPrototypeRange(n,(function(e,t,n,i,o){var r=e.startContainer!==t||e.startOffset!=n,a=e.endContainer!==i||e.endOffset!=o,s=!e.equals(e.nativeRange);(r||a||s)&&(e.setEnd(i,o),e.setStart(t,n))})),(i=n.prototype).selectNode=function(e){this.nativeRange.selectNode(e),d(this)},i.cloneContents=function(){return this.nativeRange.cloneContents()},i.surroundContents=function(e){this.nativeRange.surroundContents(e),d(this)},i.collapse=function(e){this.nativeRange.collapse(e),d(this)},i.cloneRange=function(){return new n(this.nativeRange.cloneRange())},i.refresh=function(){d(this)},i.toString=function(){return this.nativeRange.toString()};var h=document.createTextNode("test");l(document).appendChild(h);var g=document.createRange();g.setStart(h,0),g.setEnd(h,0);try{g.setStart(h,1),i.setStart=function(e,t){this.nativeRange.setStart(e,t),d(this)},i.setEnd=function(e,t){this.nativeRange.setEnd(e,t),d(this)},a=function(e){return function(t){this.nativeRange[e](t),d(this)}}}catch(e){i.setStart=function(e,t){try{this.nativeRange.setStart(e,t)}catch(n){this.nativeRange.setEnd(e,t),this.nativeRange.setStart(e,t)}d(this)},i.setEnd=function(e,t){try{this.nativeRange.setEnd(e,t)}catch(n){this.nativeRange.setStart(e,t),this.nativeRange.setEnd(e,t)}d(this)},a=function(e,t){return function(n){try{this.nativeRange[e](n)}catch(i){this.nativeRange[t](n),this.nativeRange[e](n)}d(this)}}}i.setStartBefore=a("setStartBefore","setEndBefore"),i.setStartAfter=a("setStartAfter","setEndAfter"),i.setEndBefore=a("setEndBefore","setStartBefore"),i.setEndAfter=a("setEndAfter","setStartAfter"),i.selectNodeContents=function(e){this.setStartAndEnd(e,0,o.getNodeLength(e))},g.selectNodeContents(h),g.setEnd(h,3);var f=document.createRange();f.selectNodeContents(h),f.setEnd(h,4),f.setStart(h,2),-1==g.compareBoundaryPoints(g.START_TO_END,f)&&1==g.compareBoundaryPoints(g.END_TO_START,f)?i.compareBoundaryPoints=function(e,t){return e==(t=t.nativeRange||t).START_TO_END?e=t.END_TO_START:e==t.END_TO_START&&(e=t.START_TO_END),this.nativeRange.compareBoundaryPoints(e,t)}:i.compareBoundaryPoints=function(e,t){return this.nativeRange.compareBoundaryPoints(e,t.nativeRange||t)};var p=document.createElement("div");p.innerHTML="123";var m=p.firstChild,v=l(document);v.appendChild(p),g.setStart(m,1),g.setEnd(m,2),g.deleteContents(),"13"==m.data&&(i.deleteContents=function(){this.nativeRange.deleteContents(),d(this)},i.extractContents=function(){var e=this.nativeRange.extractContents();return d(this),e}),v.removeChild(p),v=null,r.isHostMethod(g,"createContextualFragment")&&(i.createContextualFragment=function(e){return this.nativeRange.createContextualFragment(e)}),l(document).removeChild(h),i.getName=function(){return"WrappedRange"},e.WrappedRange=n,e.createNativeRange=function(e){return(e=c(e,t,"createNativeRange")).createRange()}}(),e.features.implementsTextRange){var d=function(e,t,n,i,r){var s=e.duplicate();s.collapse(n);var l=s.parentElement();if(o.isOrIsAncestorOf(t,l)||(l=t),!l.canHaveHTML){var c=new a(l.parentNode,o.getNodeIndex(l));return{boundaryPosition:c,nodeInfo:{nodeIndex:c.offset,containerElement:c.node}}}var d=o.getDocument(l).createElement("span");d.parentNode&&o.removeNode(d);for(var h,g,f,p,m,v=n?"StartToStart":"StartToEnd",b=r&&r.containerElement==l?r.nodeIndex:0,E=l.childNodes.length,S=E,C=S;C==E?l.appendChild(d):l.insertBefore(d,l.childNodes[C]),s.moveToElementText(d),0!=(h=s.compareEndPoints(v,e))&&b!=S;){if(-1==h){if(S==b+1)break;b=C}else S=S==b+1?b:C;C=Math.floor((b+S)/2),l.removeChild(d)}if(m=d.nextSibling,-1==h&&m&&u(m)){var T;if(s.setEndPoint(n?"EndToStart":"EndToEnd",e),/[\r\n]/.test(m.data)){var R=s.duplicate(),y=R.text.replace(/\r\n/g,"\r").length;for(T=R.moveStart("character",y);-1==(h=R.compareEndPoints("StartToEnd",R));)T++,R.moveStart("character",1)}else T=s.text.length;p=new a(m,T)}else g=(i||!n)&&d.previousSibling,p=(f=(i||n)&&d.nextSibling)&&u(f)?new a(f,0):g&&u(g)?new a(g,g.data.length):new a(l,o.getNodeIndex(d));return o.removeNode(d),{boundaryPosition:p,nodeInfo:{nodeIndex:C,containerElement:l}}},h=function(e,t){var n,i,r,a,s=e.offset,c=o.getDocument(e.node),d=l(c).createTextRange(),h=u(e.node);return h?i=(n=e.node).parentNode:(n=s<(a=e.node.childNodes).length?a[s]:null,i=e.node),(r=c.createElement("span")).innerHTML="&#feff;",n?i.insertBefore(r,n):i.appendChild(r),d.moveToElementText(r),d.collapse(!t),i.removeChild(r),h&&d[t?"moveStart":"moveEnd"]("character",s),d};((i=function(e){this.textRange=e,this.refresh()}).prototype=new s(document)).refresh=function(){var e,t,n,i,r=function(e){var t=e.parentElement(),n=e.duplicate();n.collapse(!0);var i=n.parentElement();(n=e.duplicate()).collapse(!1);var r=n.parentElement(),a=i==r?i:o.getCommonAncestor(i,r);return a==t?a:o.getCommonAncestor(t,a)}(this.textRange);0==(i=this.textRange).compareEndPoints("StartToEnd",i)?t=e=d(this.textRange,r,!0,!0).boundaryPosition:(e=(n=d(this.textRange,r,!0,!1)).boundaryPosition,t=d(this.textRange,r,!1,!1,n.nodeInfo).boundaryPosition),this.setStart(e.node,e.offset),this.setEnd(t.node,t.offset)},i.prototype.getName=function(){return"WrappedTextRange"},s.copyComparisonConstants(i);var g=function(e){if(e.collapsed)return h(new a(e.startContainer,e.startOffset),!0);var t=h(new a(e.startContainer,e.startOffset),!0),n=h(new a(e.endContainer,e.endOffset),!1),i=l(s.getRangeDocument(e)).createTextRange();return i.setEndPoint("StartToStart",t),i.setEndPoint("EndToEnd",n),i};if(i.rangeToTextRange=g,i.prototype.toTextRange=function(){return g(this)},e.WrappedTextRange=i,!e.features.implementsDomRange||e.config.preferTextRange){var f=Function("return this;")();void 0===f.Range&&(f.Range=i),e.createNativeRange=function(e){return e=c(e,t,"createNativeRange"),l(e).createTextRange()},e.WrappedRange=i}}e.createRange=function(n){return n=c(n,t,"createRange"),new e.WrappedRange(e.createNativeRange(n))},e.createAugnitoRange=function(e){return e=c(e,t,"createAugnitoRange"),new s(e)},r.createAliasForDeprecatedMethod(e,"createIframeRange","createRange"),r.createAliasForDeprecatedMethod(e,"createIframeAugnitoRange","createAugnitoRange"),e.addShimListener((function(t){var n=t.document;void 0===n.createRange&&(n.createRange=function(){return e.createRange(n)}),n=t=null}))})),S.createCoreModule("WrappedSelection",["DomRange","WrappedRange"],(function(e,t){e.config.checkSelectionRanges=!0;var n,i,o="boolean",r="number",a=e.dom,s=e.util,l=s.isHostMethod,c=e.DomRange,u=e.WrappedRange,d=e.DOMException,h=a.DomPosition,g=e.features,f="Control",p=a.getDocument,m=a.getBody,v=c.rangesEqual;function b(e){return"string"==typeof e?/^backward(s)?$/i.test(e):!!e}function E(e,n){if(e){if(a.isWindow(e))return e;if(e instanceof z)return e.win;var i=a.getContentDocument(e,t,n);return a.getWindow(i)}return window}function S(e){return E(e,"getDocSelection").document.selection}function C(e){var t=!1;return e.anchorNode&&(t=1==a.comparePoints(e.anchorNode,e.anchorOffset,e.focusNode,e.focusOffset)),t}var T=l(window,"getSelection"),R=s.isHostObject(document,"selection");g.implementsWinGetSelection=T,g.implementsDocSelection=R;var y=R&&(!T||e.config.preferTextRange);if(y)n=S,e.isSelectionValid=function(e){var t=E(e,"isSelectionValid").document,n=t.selection;return"None"!=n.type||p(n.createRange().parentElement())==t};else{if(!T)return t.fail("Neither document.selection or window.getSelection() detected."),!1;n=function(e){return E(e,"getWinSelection").getSelection()},e.isSelectionValid=function(){return!0}}e.getNativeSelection=n;var N=n();if(!N)return t.fail("Native selection was null (possibly issue 138?)"),!1;var O=e.createNativeRange(document),A=m(document),w=s.areHostProperties(N,["anchorNode","focusNode","anchorOffset","focusOffset"]);g.selectionHasAnchorAndFocus=w;var _=l(N,"extend");g.selectionHasExtend=_;var L=typeof N.rangeCount==r;g.selectionHasRangeCount=L;var I=!1,x=!0,P=_?function(t,n){var i=c.getRangeDocument(n),o=e.createRange(i);o.collapseToPoint(n.endContainer,n.endOffset),t.addRange(j(o)),t.extend(n.startContainer,n.startOffset)}:null;s.areHostMethods(N,["addRange","getRangeAt","removeAllRanges"])&&typeof N.rangeCount==r&&g.implementsDomRange&&function(){var t=window.getSelection();if(t){for(var n=t.rangeCount,i=n>1,o=[],r=C(t),s=0;s<n;++s)o[s]=t.getRangeAt(s);var l=a.createTestElement(document,"",!1),c=l.appendChild(document.createTextNode("   ")),u=document.createRange();if(u.setStart(c,1),u.collapse(!0),t.removeAllRanges(),t.addRange(u),x=1==t.rangeCount,t.removeAllRanges(),!i){var d=window.navigator.appVersion.match(/Chrome\/(.*?) /);if(d&&parseInt(d[1])>=36)I=!1;else{var h=u.cloneRange();u.setStart(c,0),h.setEnd(c,3),h.setStart(c,2),t.addRange(u),t.addRange(h),I=2==t.rangeCount}}for(a.removeNode(l),t.removeAllRanges(),s=0;s<n;++s)0==s&&r?P?P(t,o[s]):(e.warn("AugnitoRange initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"),t.addRange(o[s])):t.addRange(o[s])}}(),g.selectionSupportsMultipleRanges=I,g.collapsedNonEditableSelectionsSupported=x;var M,D,k=!1;function B(e,t,n){var i=n?"end":"start",o=n?"start":"end";e.anchorNode=t[i+"Container"],e.anchorOffset=t[i+"Offset"],e.focusNode=t[o+"Container"],e.focusOffset=t[o+"Offset"]}function F(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function j(t){var n;return t instanceof c?((n=e.createNativeRange(t.getDocument())).setEnd(t.endContainer,t.endOffset),n.setStart(t.startContainer,t.startOffset)):t instanceof u?n=t.nativeRange:g.implementsDomRange&&t instanceof a.getWindow(t.startContainer).Range&&(n=t),n}function U(e){var n=e.getNodes();if(!function(e){if(!e.length||1!=e[0].nodeType)return!1;for(var t=1,n=e.length;t<n;++t)if(!a.isAncestorOf(e[0],e[t]))return!1;return!0}(n))throw t.createError("getSingleElementFromRange: range "+e.inspect()+" did not consist of a single element");return n[0]}function G(e){return!!e&&void 0!==e.text}function W(e,t){var n=new u(t);e._ranges=[n],B(e,n,!1),e.rangeCount=1,e.isCollapsed=n.collapsed}function V(t){if(t._ranges.length=0,"None"==t.docSelection.type)F(t);else{var n=t.docSelection.createRange();if(G(n))W(t,n);else{t.rangeCount=n.length;for(var i,o=p(n.item(0)),r=0;r<t.rangeCount;++r)(i=e.createRange(o)).selectNode(n.item(r)),t._ranges.push(i);t.isCollapsed=1==t.rangeCount&&t._ranges[0].collapsed,B(t,t._ranges[t.rangeCount-1],!1)}}}function H(e,n){for(var i=e.docSelection.createRange(),o=U(n),r=p(i.item(0)),a=m(r).createControlRange(),s=0,l=i.length;s<l;++s)a.add(i.item(s));try{a.add(o)}catch(e){throw t.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)")}a.select(),V(e)}function z(e,t,n){this.nativeSelection=e,this.docSelection=t,this._ranges=[],this.win=n,this.refresh()}function K(e){e.win=e.anchorNode=e.focusNode=e._ranges=null,e.rangeCount=e.anchorOffset=e.focusOffset=0,e.detached=!0}A&&l(A,"createControlRange")&&(M=A.createControlRange(),s.areHostProperties(M,["item","add"])&&(k=!0)),g.implementsControlRange=k,i=w?function(e){return e.anchorNode===e.focusNode&&e.anchorOffset===e.focusOffset}:function(e){return!!e.rangeCount&&e.getRangeAt(e.rangeCount-1).collapsed},l(N,"getRangeAt")?D=function(e,t){try{return e.getRangeAt(t)}catch(e){return null}}:w&&(D=function(t){var n=p(t.anchorNode),i=e.createRange(n);return i.setStartAndEnd(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),i.collapsed!==this.isCollapsed&&i.setStartAndEnd(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset),i}),z.prototype=e.selectionPrototype;var X=[];function q(e,t){for(var n,i,o=X.length;o--;)if(i=(n=X[o]).selection,"deleteAll"==t)K(i);else if(n.win==e)return"delete"==t?(X.splice(o,1),!0):i;return"deleteAll"==t&&(X.length=0),null}var J=function(e){if(e&&e instanceof z)return e.refresh(),e;var t=q(e=E(e,"getNativeSelection")),i=n(e),o=R?S(e):null;return t?(t.nativeSelection=i,t.docSelection=o,t.refresh()):(t=new z(i,o,e),X.push({win:e,selection:t})),t};e.getSelection=J,s.createAliasForDeprecatedMethod(e,"getIframeSelection","getSelection");var $,Y=z.prototype;function Z(e,n){for(var i,o=p(n[0].startContainer),r=m(o).createControlRange(),a=0,s=n.length;a<s;++a){i=U(n[a]);try{r.add(i)}catch(e){throw t.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)")}}r.select(),V(e)}if(!y&&w&&s.areHostMethods(N,["removeAllRanges","addRange"])){Y.removeAllRanges=function(){this.nativeSelection.removeAllRanges(),F(this)};var Q=function(e,t){P(e.nativeSelection,t),e.refresh()};Y.addRange=L?function(t,n){if(k&&R&&this.docSelection.type==f)H(this,t);else if(b(n)&&_)Q(this,t);else{var o;I?o=this.rangeCount:(this.removeAllRanges(),o=0);var r=j(t).cloneRange();try{this.nativeSelection.addRange(r)}catch(e){}if(this.rangeCount=this.nativeSelection.rangeCount,this.rangeCount==o+1){if(e.config.checkSelectionRanges){var a=D(this.nativeSelection,this.rangeCount-1);a&&!v(a,t)&&(t=new u(a))}this._ranges[this.rangeCount-1]=t,B(this,t,ee(this.nativeSelection)),this.isCollapsed=i(this)}else this.refresh()}}:function(e,t){b(t)&&_?Q(this,e):(this.nativeSelection.addRange(j(e)),this.refresh())},Y.setRanges=function(e){if(k&&R&&e.length>1)Z(this,e);else{this.removeAllRanges();for(var t=0,n=e.length;t<n;++t)this.addRange(e[t])}}}else{if(!(l(N,"empty")&&l(O,"select")&&k&&y))return t.fail("No means of selecting a Range or TextRange was found"),!1;Y.removeAllRanges=function(){try{if(this.docSelection.empty(),"None"!=this.docSelection.type){var e;if(this.anchorNode)e=p(this.anchorNode);else if(this.docSelection.type==f){var t=this.docSelection.createRange();t.length&&(e=p(t.item(0)))}e&&(m(e).createTextRange().select(),this.docSelection.empty())}}catch(e){}F(this)},Y.addRange=function(t){this.docSelection.type==f?H(this,t):(e.WrappedTextRange.rangeToTextRange(t).select(),this._ranges[0]=t,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,B(this,t,!1))},Y.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?Z(this,e):t&&this.addRange(e[0])}}if(Y.getRangeAt=function(e){if(e<0||e>=this.rangeCount)throw new d("INDEX_SIZE_ERR");return this._ranges[e].cloneRange()},y)$=function(t){var n;e.isSelectionValid(t.win)?n=t.docSelection.createRange():(n=m(t.win.document).createTextRange()).collapse(!0),t.docSelection.type==f?V(t):G(n)?W(t,n):F(t)};else if(l(N,"getRangeAt")&&typeof N.rangeCount==r)$=function(t){if(k&&R&&t.docSelection.type==f)V(t);else if(t._ranges.length=t.rangeCount=t.nativeSelection.rangeCount,t.rangeCount){for(var n=0,o=t.rangeCount;n<o;++n)t._ranges[n]=new e.WrappedRange(t.nativeSelection.getRangeAt(n));B(t,t._ranges[t.rangeCount-1],ee(t.nativeSelection)),t.isCollapsed=i(t)}else F(t)};else{if(!w||typeof N.isCollapsed!=o||typeof O.collapsed!=o||!g.implementsDomRange)return t.fail("No means of obtaining a Range or TextRange from the user's selection was found"),!1;$=function(e){var t,n=e.nativeSelection;n.anchorNode?(t=D(n,0),e._ranges=[t],e.rangeCount=1,function(e){var t=e.nativeSelection;e.anchorNode=t.anchorNode,e.anchorOffset=t.anchorOffset,e.focusNode=t.focusNode,e.focusOffset=t.focusOffset}(e),e.isCollapsed=i(e)):F(e)}}Y.refresh=function(e){var t=e?this._ranges.slice(0):null,n=this.anchorNode,i=this.anchorOffset;if($(this),e){var o=t.length;if(o!=this._ranges.length)return!0;if(this.anchorNode!=n||this.anchorOffset!=i)return!0;for(;o--;)if(!v(t[o],this._ranges[o]))return!0;return!1}};var ee,te=function(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var i=0,o=n.length;i<o;++i)v(t,n[i])||e.addRange(n[i]);e.rangeCount||F(e)};function ne(e,t){if(e.win.document!=p(t))throw new d("WRONG_DOCUMENT_ERR")}function ie(t){return function(n,i){var o;this.rangeCount?(o=this.getRangeAt(0))["set"+(t?"Start":"End")](n,i):(o=e.createRange(this.win.document)).setStartAndEnd(n,i),this.setSingleRange(o,this.isBackward())}}function oe(e){var t=[],n=new h(e.anchorNode,e.anchorOffset),i=new h(e.focusNode,e.focusOffset),o="function"==typeof e.getName?e.getName():"Selection";if(void 0!==e.rangeCount)for(var r=0,a=e.rangeCount;r<a;++r)t[r]=c.inspect(e.getRangeAt(r));return"["+o+"(Ranges: "+t.join(", ")+")(anchor: "+n.inspect()+", focus: "+i.inspect()+"]"}Y.removeRange=k&&R?function(e){if(this.docSelection.type==f){for(var t=this.docSelection.createRange(),n=U(e),i=p(t.item(0)),o=m(i).createControlRange(),r=!1,a=0,s=t.length;a<s;++a)t.item(a)!==n||r?o.add(t.item(a)):r=!0;o.select(),V(this)}else te(this,e)}:function(e){te(this,e)},!y&&w&&g.implementsDomRange?(ee=C,Y.isBackward=function(){return ee(this)}):ee=Y.isBackward=function(){return!1},Y.isBackwards=Y.isBackward,Y.toString=function(){for(var e=[],t=0,n=this.rangeCount;t<n;++t)e[t]=""+this._ranges[t];return e.join("")},Y.collapse=function(t,n){ne(this,t);var i=e.createRange(t);i.collapseToPoint(t,n),this.setSingleRange(i),this.isCollapsed=!0},Y.collapseToStart=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[0];this.collapse(e.startContainer,e.startOffset)},Y.collapseToEnd=function(){if(!this.rangeCount)throw new d("INVALID_STATE_ERR");var e=this._ranges[this.rangeCount-1];this.collapse(e.endContainer,e.endOffset)},Y.selectAllChildren=function(t){ne(this,t);var n=e.createRange(t);n.selectNodeContents(t),this.setSingleRange(n)},Y.deleteFromDocument=function(){if(k&&R&&this.docSelection.type==f){for(var e,t=this.docSelection.createRange();t.length;)e=t.item(0),t.remove(e),a.removeNode(e);this.refresh()}else if(this.rangeCount){var n=this.getAllRanges();if(n.length){this.removeAllRanges();for(var i=0,o=n.length;i<o;++i)n[i].deleteContents();this.addRange(n[o-1])}}},Y.eachRange=function(e,t){for(var n=0,i=this._ranges.length;n<i;++n)if(e(this.getRangeAt(n)))return t},Y.getAllRanges=function(){var e=[];return this.eachRange((function(t){e.push(t)})),e},Y.setSingleRange=function(e,t){this.removeAllRanges(),this.addRange(e,t)},Y.callMethodOnEachRange=function(e,t){var n=[];return this.eachRange((function(i){n.push(i[e].apply(i,t||[]))})),n},Y.setStart=ie(!0),Y.setEnd=ie(!1),e.rangePrototype.select=function(e){J(this.getDocument()).setSingleRange(this,e)},Y.changeEachRange=function(e){var t=[],n=this.isBackward();this.eachRange((function(n){e(n),t.push(n)})),this.removeAllRanges(),n&&1==t.length?this.addRange(t[0],"backward"):this.setRanges(t)},Y.containsNode=function(e,t){return this.eachRange((function(n){return n.containsNode(e,t)}),!0)||!1},Y.getBookmark=function(e){return{backward:this.isBackward(),rangeBookmarks:this.callMethodOnEachRange("getBookmark",[e])}},Y.moveToBookmark=function(t){for(var n,i,o=[],r=0;n=t.rangeBookmarks[r++];)(i=e.createRange(this.win)).moveToBookmark(n),o.push(i);t.backward?this.setSingleRange(o[0],"backward"):this.setRanges(o)},Y.saveRanges=function(){return{backward:this.isBackward(),ranges:this.callMethodOnEachRange("cloneRange")}},Y.restoreRanges=function(e){this.removeAllRanges();for(var t,n=0;t=e.ranges[n];++n)this.addRange(t,e.backward&&0==n)},Y.toHtml=function(){var e=[];return this.eachRange((function(t){e.push(c.toHtml(t))})),e.join("")},g.implementsTextRange&&(Y.getNativeTextRange=function(){var n;if(n=this.docSelection){var i=n.createRange();if(G(i))return i;throw t.createError("getNativeTextRange: selection is a control selection")}if(this.rangeCount>0)return e.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));throw t.createError("getNativeTextRange: selection contains no range")}),Y.getName=function(){return"WrappedSelection"},Y.inspect=function(){return oe(this)},Y.detach=function(){q(this.win,"delete"),K(this)},z.detachAll=function(){q(null,"deleteAll")},z.inspect=oe,z.isDirectionBackward=b,e.Selection=z,e.selectionPrototype=Y,e.addShimListener((function(e){void 0===e.getSelection&&(e.getSelection=function(){return J(e)}),e=null}))}));var P=!1,M=function(e){P||(P=!0,!S.initialized&&S.config.autoInitialize&&O())};return b&&("complete"==document.readyState?M():(a(document,"addEventListener")&&document.addEventListener("DOMContentLoaded",M,!1),m(window,"load",M))),S
34
+ /*************************************************************************
35
+ * @package AugnitoDomParser
36
+ * @license Restricted
37
+ * Extension Name: Augnito
38
+ * Description: Voice powered medical reporting
39
+ * Version: 1.0.12
40
+ * Email: support@scribetech.in
41
+ *
42
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
43
+ *
44
+ * The contents / part of the Augnito shall not be copied and/or
45
+ * distributed without the express permission of
46
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
47
+ * License.
48
+ *
49
+ * AUGNITO CONFIDENTIAL
50
+ * __________________
51
+ *
52
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
53
+ * All Rights Reserved.
54
+ *
55
+ * NOTICE: All information contained herein is, and remains
56
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
57
+ * if any. The intellectual, technical concepts and contents contained
58
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
59
+ * and its suppliers in process, and are protected by trade secret or
60
+ * copyright law.
61
+ * Dissemination of this information or reproduction of this material
62
+ * is strictly forbidden unless prior written permission is obtained
63
+ * from ScribeTech India Healthcare Pvt ltd.
64
+ */}function z(e){return e.createModule("ClassApplier",["WrappedSelection"],(function(e,t){var n=e.dom,o=n.DomPosition,r=n.arrayContains,a=e.util,s=a.forEach,l=a.isHostMethod(document,"createElementNS");function c(e,t){for(var n in e)if(e.hasOwnProperty(n)&&!1===t(n,e[n]))return!1;return!0}function u(e){return e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")}function d(e,t){return!!e&&new RegExp("(?:^|\\s)"+t+"(?:\\s|$)").test(e)}function h(e,t){return"object"==typeof e.classList?e.classList.contains(t):d("string"==typeof e.className?e.className:e.getAttribute("class"),t)}function g(e,t){if("object"==typeof e.classList)e.classList.add(t);else{var n="string"==typeof e.className,i=n?e.className:e.getAttribute("class");i?d(i,t)||(i+=" "+t):i=t,n?e.className=i:e.setAttribute("class",i)}}var f=function(){function e(e,t,n){return t&&n?" ":""}return function(t,n){if("object"==typeof t.classList)t.classList.remove(n);else{var i="string"==typeof t.className,o=i?t.className:t.getAttribute("class");o=o.replace(new RegExp("(^|\\s)"+n+"(\\s|$)"),e),i?t.className=o:t.setAttribute("class",o)}}}();function p(e){return"string"==typeof e.className?e.className:e.getAttribute("class")}function m(e){return e&&e.split(/\s+/).sort().join(" ")}function v(e){return m(p(e))}function b(e,t){return v(e)==v(t)}function E(e,t){for(var n=t.split(/\s+/),i=0,o=n.length;i<o;++i)if(!h(e,u(n[i])))return!1;return!0}function S(e,t,i,o){-1==i&&(i=t.childNodes.length);var r=e.parentNode,a=n.getNodeIndex(e);s(o,(function(e){!function(e,t,n,i,o){var r=e.node,a=e.offset,s=r,l=a;r==i&&a>o&&++l,r!=t||a!=n&&a!=n+1||(s=i,l+=o-n),r==t&&a>n+1&&--l,e.node=s,e.offset=l}(e,r,a,t,i)})),t.childNodes.length==i?t.appendChild(e):t.insertBefore(e,t.childNodes[i])}function C(e,t){var i=e.parentNode,o=n.getNodeIndex(e);s(t,(function(e){!function(e,t,n){e.node==t&&e.offset>n&&--e.offset}(e,i,o)})),n.removeNode(e)}function T(e,t){return function(e,t,n,i,o){for(var r,a=[];r=e.firstChild;)S(r,t,n++,o),a.push(r);return C(e,o),a}(e,e.parentNode,n.getNodeIndex(e),0,t)}function R(e,t){var n=e.cloneRange();n.selectNodeContents(t);var i=n.intersection(e);return""!=(i?i.toString():"")}function y(e){for(var t,n=e.getNodes([3]),i=0;(t=n[i])&&!R(e,t);)++i;for(var o=n.length-1;(t=n[o])&&!R(e,t);)--o;return n.slice(i,o+1)}function N(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,o,r=0,a=e.attributes.length;r<a;++r)if("class"!=(o=(n=e.attributes[r]).name)){if(null===n!=(null===(i=t.attributes.getNamedItem(o))))return!1;if(n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}function O(e,t){for(var n,i=0,o=e.attributes.length;i<o;++i)if(n=e.attributes[i].name,(!t||!r(t,n))&&e.attributes[i].specified&&"class"!=n)return!0;return!1}var A=n.getComputedStyleProperty,w="boolean"==typeof document.createElement("div").isContentEditable?function(e){return e&&1==e.nodeType&&e.isContentEditable}:function(e){return!(!e||1!=e.nodeType||"false"==e.contentEditable)&&("true"==e.contentEditable||w(e.parentNode))};function _(e){var t;return e&&1==e.nodeType&&((t=e.parentNode)&&9==t.nodeType&&"on"==t.designMode||w(e)&&!w(e.parentNode))}function L(e){return(w(e)||1!=e.nodeType&&w(e.parentNode))&&!_(e)}var I=/^inline(-block|-table)?$/i;function x(e){return e&&1==e.nodeType&&!I.test(A(e,"display"))}var P=/[^\r\n\t\f \u200B]/;function M(e){var t,n,i=[];for(t=0;n=e[t++];)i.push(new o(n.startContainer,n.startOffset),new o(n.endContainer,n.endOffset));return i}function D(e,t){for(var n,i,o,r=0,a=e.length;r<a;++r)n=e[r],i=t[2*r],o=t[2*r+1],n.setStartAndEnd(i.node,i.offset,o.node,o.offset)}function k(e,i,o,r){var a,s,l=0==o;if(n.isAncestorOf(i,e))return e;if(n.isCharacterDataNode(i)){var c=n.getNodeIndex(i);if(0==o)o=c;else{if(o!=i.length)throw t.createError("splitNodeAt() should not be called with offset in the middle of a data node ("+o+" in "+i.data);o=c+1}i=i.parentNode}if(function(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}(i,o)){a=i.cloneNode(!1),s=i.parentNode,a.id&&a.removeAttribute("id");for(var u,d=0;u=i.childNodes[o];)S(u,a,d++,r);return S(a,s,n.getNodeIndex(i)+1,r),i==e?a:k(e,s,n.getNodeIndex(a),r)}if(e!=i){a=i.parentNode;var h=n.getNodeIndex(i);return l||h++,k(e,a,h,r)}return e}function B(e){var t=e?"nextSibling":"previousSibling";return function(n,i){var o,r,a=n.parentNode,s=n[t];if(s){if(s&&3==s.nodeType)return s}else if(i&&(s=a[t])&&1==s.nodeType&&(r=s,(o=a).namespaceURI==r.namespaceURI&&o.tagName.toLowerCase()==r.tagName.toLowerCase()&&b(o,r)&&N(o,r)&&"inline"==A(o,"display")&&"inline"==A(r,"display"))){var l=s[e?"firstChild":"lastChild"];if(l&&3==l.nodeType)return l}return null}}var F=B(!1),j=B(!0);function U(e){this.isElementMerge=1==e.nodeType,this.textNodes=[];var t=this.isElementMerge?e.lastChild:e;t&&(this.textNodes[0]=t)}U.prototype={doMerge:function(e){var t=this.textNodes,i=t[0];if(t.length>1){var o,r=n.getNodeIndex(i),a=[],l=0;s(t,(function(t,c){o=t.parentNode,c>0&&(o.removeChild(t),o.hasChildNodes()||n.removeNode(o),e&&s(e,(function(e){e.node==t&&(e.node=i,e.offset+=l),e.node==o&&e.offset>r&&(--e.offset,e.offset==r+1&&c<len-1&&(e.node=i,e.offset=l))}))),a[c]=t.data,l+=t.data.length})),i.data=a.join("")}return i.data},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){var e=[];return s(this.textNodes,(function(t,n){e[n]="'"+t.data+"'"})),"[Merge("+e.join(",")+")]"}};var G=["elementTagName","ignoreWhiteSpace","applyToEditableOnly","useExistingElements","removeEmptyElements","onElementCreate"],W={};function V(e,t,n){var i,o,r,a,s=this;s.cssClass=s.className=e;var l=null,d={};if("object"==typeof t&&null!==t){for(void 0!==t.elementTagName&&(t.elementTagName=t.elementTagName.toLowerCase()),n=t.tagNames,l=t.elementProperties,d=t.elementAttributes,o=0;a=G[o++];)t.hasOwnProperty(a)&&(s[a]=t[a]);i=t.normalize}else i=t;s.normalize=void 0===i||i,s.attrExceptions=[];var h=document.createElement(s.elementTagName);s.elementProperties=s.copyPropertiesToElement(l,h,!0),c(d,(function(e,t){s.attrExceptions.push(e),d[e]=""+t})),s.elementAttributes=d,s.elementSortedClassName=s.elementProperties.hasOwnProperty("className")?m(s.elementProperties.className+" "+e):e,s.applyToAnyTagName=!1;var g=typeof n;if("string"==g)"*"==n?s.applyToAnyTagName=!0:s.tagNames=u(n.toLowerCase()).split(/\s*,\s*/);else if("object"==g&&"number"==typeof n.length)for(s.tagNames=[],o=0,r=n.length;o<r;++o)"*"==n[o]?s.applyToAnyTagName=!0:s.tagNames.push(n[o].toLowerCase());else s.tagNames=[s.elementTagName]}V.prototype={elementTagName:"span",elementProperties:{},elementAttributes:{},ignoreWhiteSpace:!0,applyToEditableOnly:!1,useExistingElements:!0,removeEmptyElements:!0,onElementCreate:null,copyPropertiesToElement:function(e,t,n){var i,o,r,a,s,l,c={};for(var u in e)if(e.hasOwnProperty(u))if(a=e[u],s=t[u],"className"==u)g(t,a),g(t,this.className),t[u]=m(t[u]),n&&(c[u]=a);else if("style"==u){for(i in o=s,n&&(c[u]=r={}),e[u])e[u].hasOwnProperty(i)&&(o[i]=a[i],n&&(r[i]=o[i]));this.attrExceptions.push(u)}else t[u]=a,n&&(c[u]=t[u],l=W.hasOwnProperty(u)?W[u]:u,this.attrExceptions.push(l));return n?c:""},copyAttributesToElement:function(e,t){for(var n in e)e.hasOwnProperty(n)&&!/^class(?:Name)?$/i.test(n)&&t.setAttribute(n,e[n])},appliesToElement:function(e){return r(this.tagNames,e.tagName.toLowerCase())},getEmptyElements:function(e){var t=this;return e.getNodes([1],(function(e){return t.appliesToElement(e)&&!e.hasChildNodes()}))},hasClass:function(e){return 1==e.nodeType&&(this.applyToAnyTagName||this.appliesToElement(e))&&h(e,this.className)},getSelfOrAncestorWithClass:function(e){for(;e;){if(this.hasClass(e))return e;e=e.parentNode}return null},isModifiable:function(e){return!this.applyToEditableOnly||L(e)},isIgnorableWhiteSpaceNode:function(e){return this.ignoreWhiteSpace&&e&&3==e.nodeType&&function(e){if(0==e.data.length)return!0;if(P.test(e.data))return!1;switch(A(e.parentNode,"whiteSpace")){case"pre":case"pre-wrap":case"-moz-pre-wrap":return!1;case"pre-line":if(/[\r\n]/.test(e.data))return!1}return x(e.previousSibling)||x(e.nextSibling)}(e)},postApply:function(e,t,n,o){var r,a,l=e[0],c=e[e.length-1],u=[],d=l,h=c,g=0,f=c.length;s(e,(function(e){(a=F(e,!o))?(r||(r=new U(a),u.push(r)),r.textNodes.push(e),e===l&&(d=r.textNodes[0],g=d.length),e===c&&(h=r.textNodes[0],f=r.getLength())):r=null}));var p=j(c,!o);if(p&&(r||(r=new U(c),u.push(r)),r.textNodes.push(p)),u.length){for(i=0,len=u.length;i<len;++i)u[i].doMerge(n);t.setStartAndEnd(d,g,h,f)}},createContainer:function(e){var t=n.getDocument(e),i=l&&!n.isHtmlNamespace(e)&&e.namespaceURI?t.createElementNS(e.namespaceURI,this.elementTagName):t.createElement(this.elementTagName);return this.copyPropertiesToElement(this.elementProperties,i,!1),this.copyAttributesToElement(this.elementAttributes,i),g(i,this.className),this.onElementCreate&&this.onElementCreate(i,this),i},elementHasProperties:function(e,t){var n=this;return c(t,(function(t,i){if("className"==t)return E(e,i);if("object"==typeof i){if(!n.elementHasProperties(e[t],i))return!1}else if(e[t]!==i)return!1}))},elementHasAttributes:function(e,t){return c(t,(function(t,n){if(e.getAttribute(t)!==n)return!1}))},applyToTextNode:function(e,t){if(function(e){var t=e.parentNode;return t&&1==t.nodeType&&!/^(textarea|style|script|select|iframe)$/i.test(t.nodeName)}(e)){var n=e.parentNode;if(1==n.childNodes.length&&this.useExistingElements&&this.appliesToElement(n)&&this.elementHasProperties(n,this.elementProperties)&&this.elementHasAttributes(n,this.elementAttributes))g(n,this.className);else{var i=e.parentNode,o=this.createContainer(i);i.insertBefore(o,e),o.appendChild(e)}}},isRemovable:function(e){return e.tagName.toLowerCase()==this.elementTagName&&v(e)==this.elementSortedClassName&&this.elementHasProperties(e,this.elementProperties)&&!O(e,this.attrExceptions)&&this.elementHasAttributes(e,this.elementAttributes)&&this.isModifiable(e)},isEmptyContainer:function(e){var t=e.childNodes.length;return 1==e.nodeType&&this.isRemovable(e)&&(0==t||1==t&&this.isEmptyContainer(e.firstChild))},removeEmptyContainers:function(e){var t=this,n=e.getNodes([1],(function(e){return t.isEmptyContainer(e)})),i=[e],o=M(i);s(n,(function(e){C(e,o)})),D(i,o)},undoToTextNode:function(e,t,n,i){if(!t.containsNode(n)){var o=t.cloneRange();o.selectNode(n),o.isPointInRange(t.endContainer,t.endOffset)&&(k(n,t.endContainer,t.endOffset,i),t.setEndAfter(n)),o.isPointInRange(t.startContainer,t.startOffset)&&(n=k(n,t.startContainer,t.startOffset,i))}this.isRemovable(n)?T(n,i):f(n,this.className)},splitAncestorWithClass:function(e,t,n){var i=this.getSelfOrAncestorWithClass(e);i&&k(i,e,t,n)},undoToAncestor:function(e,t){this.isRemovable(e)?T(e,t):f(e,this.className)},applyToRange:function(e,t){var n=this,i=M((t=t||[])||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e);var o=y(e);if(o.length){s(o,(function(e){n.isIgnorableWhiteSpaceNode(e)||n.getSelfOrAncestorWithClass(e)||!n.isModifiable(e)||n.applyToTextNode(e,i)}));var r=o[o.length-1];e.setStartAndEnd(o[0],0,r,r.length),n.normalize&&n.postApply(o,e,i,!1),D(t,i)}var a=n.getEmptyElements(e);s(a,(function(e){g(e,n.className)}))},applyToRanges:function(e){for(var t=e.length;t--;)this.applyToRange(e[t],e);return e},applyToSelection:function(t){var n=e.getSelection(t);n.setRanges(this.applyToRanges(n.getAllRanges()))},undoToRange:function(e,t){var n=this,i=M(t=t||[]);e.splitBoundariesPreservingPositions(i),n.removeEmptyElements&&n.removeEmptyContainers(e,i);var o,r,a=y(e),l=a[a.length-1];if(a.length){n.splitAncestorWithClass(e.endContainer,e.endOffset,i),n.splitAncestorWithClass(e.startContainer,e.startOffset,i);for(var c=0,u=a.length;c<u;++c)o=a[c],(r=n.getSelfOrAncestorWithClass(o))&&n.isModifiable(o)&&n.undoToAncestor(r,i);e.setStartAndEnd(a[0],0,l,l.length),n.normalize&&n.postApply(a,e,i,!0),D(t,i)}var d=n.getEmptyElements(e);s(d,(function(e){f(e,n.className)}))},undoToRanges:function(e){for(var t=e.length;t--;)this.undoToRange(e[t],e);return e},undoToSelection:function(t){var n=e.getSelection(t),i=e.getSelection(t).getAllRanges();this.undoToRanges(i),n.setRanges(i)},isAppliedToRange:function(e){if(e.collapsed||""==e.toString())return!!this.getSelfOrAncestorWithClass(e.commonAncestorContainer);var t=e.getNodes([3]);if(t.length)for(var n,i=0;n=t[i++];)if(!this.isIgnorableWhiteSpaceNode(n)&&R(e,n)&&this.isModifiable(n)&&!this.getSelfOrAncestorWithClass(n))return!1;return!0},isAppliedToRanges:function(e){var t=e.length;if(0==t)return!1;for(;t--;)if(!this.isAppliedToRange(e[t]))return!1;return!0},isAppliedToSelection:function(t){var n=e.getSelection(t);return this.isAppliedToRanges(n.getAllRanges())},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},getElementsWithClassIntersectingRange:function(e){var t=[],n=this;return e.getNodes([3],(function(e){var i=n.getSelfOrAncestorWithClass(e);i&&!r(t,i)&&t.push(i)})),t},detach:function(){}},V.util={hasClass:h,addClass:g,removeClass:f,getClass:p,hasSameClasses:b,hasAllClasses:E,replaceWithOwnChildren:T,elementsHaveSameNonClassAttributes:N,elementHasNonClassAttributes:O,splitNodeAt:k,isEditableElement:w,isEditingHost:_,isEditable:L},e.CssClassApplier=e.ClassApplier=V,e.createClassApplier=function(e,t,n){return new V(e,t,n)},a.createAliasForDeprecatedMethod(e,"createCssClassApplier","createClassApplier",t)})),e
65
+ /*************************************************************************
66
+ * @package AugnitoDomParser
67
+ * @license Restricted
68
+ * Extension Name: Augnito
69
+ * Description: Voice powered medical reporting
70
+ * Version: 1.0.12
71
+ * Email: support@scribetech.in
72
+ *
73
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
74
+ *
75
+ * The contents / part of the Augnito shall not be copied and/or
76
+ * distributed without the express permission of
77
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
78
+ * License.
79
+ *
80
+ * AUGNITO CONFIDENTIAL
81
+ * __________________
82
+ *
83
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
84
+ * All Rights Reserved.
85
+ *
86
+ * NOTICE: All information contained herein is, and remains
87
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
88
+ * if any. The intellectual, technical concepts and contents contained
89
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
90
+ * and its suppliers in process, and are protected by trade secret or
91
+ * copyright law.
92
+ * Dissemination of this information or reproduction of this material
93
+ * is strictly forbidden unless prior written permission is obtained
94
+ * from ScribeTech India Healthcare Pvt ltd.
95
+ */}function K(e){return e.createModule("Highlighter",["ClassApplier"],(function(e,t){var n=e.dom,i=n.arrayContains,o=n.getBody,r=e.util.createOptions,a=e.util.forEach,s=1;function l(e,t){return e.characterRange.start-t.characterRange.start}function c(e,t){return t?e.getElementById(t):o(e)}var u={};function d(e,t){this.type=e,this.converterCreator=t}function h(e,t){u[e]=new d(e,t)}function g(e){var t=u[e];if(t instanceof d)return t.create();throw new Error("Highlighter type '"+e+"' is not valid")}function f(e,t){this.start=e,this.end=t}d.prototype.create=function(){var e=this.converterCreator();return e.type=this.type,e},e.registerHighlighterType=h,f.prototype={intersects:function(e){return this.start<e.end&&this.end>e.start},isContiguousWith:function(e){return this.start==e.end||this.end==e.start},union:function(e){return new f(Math.min(this.start,e.start),Math.max(this.end,e.end))},intersection:function(e){return new f(Math.max(this.start,e.start),Math.min(this.end,e.end))},getComplements:function(e){var t=[];if(this.start>=e.start){if(this.end<=e.end)return[];t.push(new f(e.end,this.end))}else t.push(new f(this.start,Math.min(this.end,e.start))),this.end>e.end&&t.push(new f(e.end,this.end));return t},toString:function(){return"[CharacterRange("+this.start+", "+this.end+")]"}},f.fromCharacterRange=function(e){return new f(e.start,e.end)};var p,m={rangeToCharacterRange:function(e,t){var n=e.getBookmark(t);return new f(n.start,n.end)},characterRangeToRange:function(t,n,i){var o=e.createRange(t);return o.moveToBookmark({start:n.start,end:n.end,containerNode:i}),o},serializeSelection:function(e,t){for(var n=e.getAllRanges(),i=[],o=1==n.length&&e.isBackward(),r=0,a=n.length;r<a;++r)i[r]={characterRange:this.rangeToCharacterRange(n[r],t),backward:o};return i},restoreSelection:function(e,t,n){e.removeAllRanges();for(var i,o,r=e.win.document,a=0,s=t.length;a<s;++a)o=t[a],i=this.characterRangeToRange(r,o.characterRange,n),e.addRange(i,o.backward)}};function v(e,t,n,i,o,r){o?(this.id=o,s=Math.max(s,o+1)):this.id=s++,this.characterRange=t,this.doc=e,this.classApplier=n,this.converter=i,this.containerElementId=r||null,this.applied=!1}function b(e,t){t=t||"textContent",this.doc=e||document,this.classAppliers={},this.highlights=[],this.converter=g(t)}h("textContent",(function(){return m})),h("TextRange",(function(){if(!p){var t=e.modules.TextRange;if(!t)throw new Error("TextRange module is missing.");if(!t.supported)throw new Error("TextRange module is present but not supported.");p={rangeToCharacterRange:function(e,t){return f.fromCharacterRange(e.toCharacterRange(t))},characterRangeToRange:function(t,n,i){var o=e.createRange(t);return o.selectCharacters(i,n.start,n.end),o},serializeSelection:function(e,t){return e.saveCharacterRanges(t)},restoreSelection:function(e,t,n){e.restoreCharacterRanges(n,t)}}}return p})),v.prototype={getContainerElement:function(){return c(this.doc,this.containerElementId)},getRange:function(){return this.converter.characterRangeToRange(this.doc,this.characterRange,this.getContainerElement())},fromRange:function(e){this.characterRange=this.converter.rangeToCharacterRange(e,this.getContainerElement())},getText:function(){return this.getRange().toString()},containsElement:function(e){return this.getRange().containsNodeContents(e.firstChild)},unapply:function(){this.classApplier.undoToRange(this.getRange()),this.applied=!1},apply:function(){this.classApplier.applyToRange(this.getRange()),this.applied=!0},getHighlightElements:function(){return this.classApplier.getElementsWithClassIntersectingRange(this.getRange())},toString:function(){return"[Highlight(ID: "+this.id+", class: "+this.classApplier.className+", character range: "+this.characterRange.start+" - "+this.characterRange.end+")]"}},b.prototype={addClassApplier:function(e){this.classAppliers[e.className]=e},getHighlightForElement:function(e){for(var t=this.highlights,n=0,i=t.length;n<i;++n)if(t[n].containsElement(e))return t[n];return null},removeHighlights:function(e){for(var t,n=0,o=this.highlights.length;n<o;++n)t=this.highlights[n],i(e,t)&&(t.unapply(),this.highlights.splice(n--,1))},removeAllHighlights:function(){this.removeHighlights(this.highlights)},getIntersectingHighlights:function(e){var t=[],n=this.highlights;return a(e,(function(e){a(n,(function(n){e.intersectsRange(n.getRange())&&!i(t,n)&&t.push(n)}))})),t},highlightCharacterRanges:function(t,n,i){var o,s,l,c,u,d,h,g,p,m,b,E,S=this.highlights,C=this.converter,T=this.doc,R=[],y=t?this.classAppliers[t]:null,N=(i=r(i,{containerElementId:null,exclusive:!0})).containerElementId,O=i.exclusive;for(N&&(c=this.doc.getElementById(N))&&((u=e.createRange(this.doc)).selectNodeContents(c),d=new f(0,u.toString().length)),o=0,s=n.length;o<s;++o)if(h=n[o],b=[],d&&(h=h.intersection(d)),h.start!=h.end){for(l=0;l<S.length;++l)p=!1,N==S[l].containerElementId&&(g=S[l].characterRange,E=!(m=y==S[l].classApplier)&&O,(g.intersects(h)||g.isContiguousWith(h))&&(m||E)&&(E&&a(g.getComplements(h),(function(e){b.push(new v(T,e,S[l].classApplier,C,null,N))})),p=!0,m&&(h=g.union(h)))),p?(R.push(S[l]),S[l]=new v(T,g.union(h),y,C,null,N)):b.push(S[l]);y&&b.push(new v(T,h,y,C,null,N)),this.highlights=S=b}a(R,(function(e){e.unapply()}));var A=[];return a(S,(function(e){e.applied||(e.apply(),A.push(e))})),A},highlightRanges:function(t,n,i){var s,l=[],c=this.converter,u=(i=r(i,{containerElement:null,exclusive:!0})).containerElement,d=u?u.id:null;return u&&(s=e.createRange(u)).selectNodeContents(u),a(n,(function(e){var t=u?s.intersection(e):e;l.push(c.rangeToCharacterRange(t,u||o(e.getDocument())))})),this.highlightCharacterRanges(t,l,{containerElementId:d,exclusive:i.exclusive})},highlightSelection:function(t,n){var i=this.converter,o=!!t&&this.classAppliers[t],s=(n=r(n,{containerElementId:null,exclusive:!0})).containerElementId,l=n.exclusive,u=n.selection||e.getSelection(this.doc),d=c(u.win.document,s);if(!o&&!1!==t)throw new Error("No class applier found for class '"+t+"'");var h=i.serializeSelection(u,d),g=[];a(h,(function(e){g.push(f.fromCharacterRange(e.characterRange))}));var p=this.highlightCharacterRanges(t,g,{containerElementId:s,exclusive:l});return i.restoreSelection(u,h,d),p},unhighlightSelection:function(t){t=t||e.getSelection(this.doc);var n=this.getIntersectingHighlights(t.getAllRanges());return this.removeHighlights(n),t.removeAllRanges(),n},getHighlightsInSelection:function(t){return t=t||e.getSelection(this.doc),this.getIntersectingHighlights(t.getAllRanges())},selectionOverlapsHighlight:function(e){return this.getHighlightsInSelection(e).length>0},serialize:function(e){var t,n,i,o,s=this,c=s.highlights;return c.sort(l),t=(e=r(e,{serializeHighlightText:!1,type:s.converter.type})).type,(i=t!=s.converter.type)&&(o=g(t)),n=["type:"+t],a(c,(function(t){var r,a=t.characterRange;i&&(r=t.getContainerElement(),a=o.rangeToCharacterRange(s.converter.characterRangeToRange(s.doc,a,r),r));var l=[a.start,a.end,t.id,t.classApplier.className,t.containerElementId];e.serializeHighlightText&&l.push(t.getText()),n.push(l.join("$"))})),n.join("|")},deserialize:function(e){var t,n,i,o,r,a,s,l,u=e.split("|"),d=[],h=u[0],p=!1;if(!h||!(t=/^type:(\w+)$/.exec(h)))throw new Error("Serialized highlights are invalid.");(n=t[1])!=this.converter.type&&(i=g(n),p=!0),u.shift();for(var m,b=u.length;b-- >0;){if(a=new f(+(m=u[b].split("$"))[0],+m[1]),s=m[4]||null,p&&(l=c(this.doc,s),a=this.converter.rangeToCharacterRange(i.characterRangeToRange(this.doc,a,l),l)),!(o=this.classAppliers[m[3]]))throw new Error("No class applier found for class '"+m[3]+"'");(r=new v(this.doc,a,o,this.converter,parseInt(m[2]),s)).apply(),d.push(r)}this.highlights=d}},e.Highlighter=b,e.createHighlighter=function(e,t){return new b(e,t)}})),e
96
+ /*************************************************************************
97
+ * @package AugnitoDomParser
98
+ * @license Restricted
99
+ * Extension Name: Augnito
100
+ * Description: Voice powered medical reporting
101
+ * Version: 1.0.12
102
+ * Email: support@scribetech.in
103
+ *
104
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
105
+ *
106
+ * The contents / part of the Augnito shall not be copied and/or
107
+ * distributed without the express permission of
108
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
109
+ * License.
110
+ *
111
+ * AUGNITO CONFIDENTIAL
112
+ * __________________
113
+ *
114
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
115
+ * All Rights Reserved.
116
+ *
117
+ * NOTICE: All information contained herein is, and remains
118
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
119
+ * if any. The intellectual, technical concepts and contents contained
120
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
121
+ * and its suppliers in process, and are protected by trade secret or
122
+ * copyright law.
123
+ * Dissemination of this information or reproduction of this material
124
+ * is strictly forbidden unless prior written permission is obtained
125
+ * from ScribeTech India Healthcare Pvt ltd.
126
+ */}function X(e){e.createModule("TextCommands",["WrappedSelection"],(function(e,t){var n=e.dom,i="span",o="boolean",r="undefined";function a(e){return e.className.split(/\s+/).sort().join(" ")}function s(e,t){return n.isCharacterDataNode(e)?0==t?!!e.previousSibling:t!=e.length||!!e.nextSibling:t>0&&t<e.childNodes.length}function l(e,t,i){var o;if(window.EnableLog&&console.debug("splitNodeAt",n.inspectNode(e),n.inspectNode(t),i),n.isCharacterDataNode(t)&&(0==i?(i=n.getNodeIndex(t),t=t.parentNode):i==t.length?(i=n.getNodeIndex(t)+1,t=t.parentNode):o=n.splitDataNode(t,i)),!o){var r;for((o=t.cloneNode(!1)).id&&o.removeAttribute("id");r=t.childNodes[i];)window.EnableLog&&console.debug("Moving node "+n.inspectNode(r)+" into "+n.inspectNode(o)),o.appendChild(r);n.insertAfter(o,t)}return t==e?o:l(e,o.parentNode,n.getNodeIndex(o))}function c(e,t){var n,i=3==e.nodeType,o=i?e.parentNode:e,r=t?"nextSibling":"previousSibling";if(i){if((n=e[r])&&3==n.nodeType)return n}else if((n=o[r])&&function(e,t){return e.tagName==t.tagName&&function(e,t){return a(e)==a(t)}(e,t)&&function(e,t){if(e.attributes.length!=t.attributes.length)return!1;for(var n,i,o,r=0,a=e.attributes.length;r<a;++r)if("class"!=(o=(n=e.attributes[r]).name)){if(i=t.attributes.getNamedItem(o),n.specified!=i.specified)return!1;if(n.specified&&n.nodeValue!==i.nodeValue)return!1}return!0}(e,t)}(e,n))return n[t?"firstChild":"lastChild"];return null}function u(e){this.isElementMerge=1==e.nodeType,this.firstTextNode=this.isElementMerge?e.lastChild:e,this.isElementMerge&&(this.sortedClasses=a(e)),this.textNodes=[this.firstTextNode]}function d(e,t){if(this.name=e,"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this[n]=t[n])}u.prototype={doMerge:function(){for(var e,t,n,i=[],o=0,r=this.textNodes.length;o<r;++o)t=(e=this.textNodes[o]).parentNode,i[o]=e.data,o&&(t.removeChild(e),t.hasChildNodes()||t.parentNode.removeChild(t));return this.firstTextNode.data=n=i.join(""),n},getLength:function(){for(var e=this.textNodes.length,t=0;e--;)t+=this.textNodes[e].length;return t},toString:function(){for(var e=[],t=0,n=this.textNodes.length;t<n;++t)e[t]="'"+this.textNodes[t].data+"'";return"[Merge("+e.join(",")+")]"}},d.prototype={type:o,normalize:!0,applyToAnyTagName:!0,tagNames:["span"],postApply:function(e,t){window.EnableLog&&console.group("postApply");for(var n,i,o,r=e[0],a=e[e.length-1],s=[],l=r,d=a,h=0,g=a.length,f=0,p=e.length;f<p;++f)o=c(i=e[f],!1),window.EnableLog&&console.debug("Checking for merge. text node: "+i.data+", preceding: "+(o?o.data:null)),o?(n||(n=new u(o),s.push(n)),n.textNodes.push(i),i===r&&(h=(l=n.firstTextNode).length),i===a&&(d=n.firstTextNode,g=n.getLength())):n=null;var m=c(a,!0);if(m&&(n||(n=new u(a),s.push(n)),n.textNodes.push(m)),s.length){for(window.EnableLog&&console.info("Merging. Merges:",s),f=0,p=s.length;f<p;++f)s[f].doMerge();window.EnableLog&&console.info(l.nodeValue,h,d.nodeValue,g),t.setStart(l,h),t.setEnd(d,g)}window.EnableLog&&console.groupEnd()},getAppliedAncestor:function(e){for(var t=e.parentNode;t;){if(1==t.nodeType&&n.arrayContains(this.tagNames,t.tagName.toLowerCase())&&this.isAppliedToElement(t))return t;t=t.parentNode}return!1},applyToElement:function(e){},unapplyToElement:function(e){},createContainer:function(e){var t=e.createElement("break"==this.name?"p":i);return this.applyToElement(t),t},applyToTextNode:function(e){var t=e.parentNode;if(1==t.childNodes.length&&n.arrayContains(this.tagNames,t.tagName.toLowerCase()))this.applyToElement(t);else{var i=this.createContainer(n.getDocument(e));i&&(e.parentNode.insertBefore(i,e),i.appendChild(e))}},isRemovable:function(e){return e.tagName.toLowerCase()==i&&e.className.replace(/^\s\s*/,"").replace(/\s\s*$/,"")==this.className&&!function(e){for(var t=0,n=e.attributes.length;t<n;++t)if(e.attributes[t].specified&&"class"!=e.attributes[t].name)return!0;return!1}(e)},undoToTextNode:function(e,t,i){if(window.EnableLog&&console.info("undoToTextNode",n.inspectNode(e),t.inspect(),n.inspectNode(i),t.containsNode(i)),!t.containsNode(i)){var o=t.cloneRange();o.selectNode(i),window.EnableLog&&console.info("range end in ancestor "+o.isPointInRange(t.endContainer,t.endOffset)+", isSplitPoint "+s(t.endContainer,t.endOffset)),o.isPointInRange(t.endContainer,t.endOffset)&&s(t.endContainer,t.endOffset)&&(l(i,t.endContainer,t.endOffset),t.setEndAfter(i)),o.isPointInRange(t.startContainer,t.startOffset)&&s(t.startContainer,t.startOffset)&&(i=l(i,t.startContainer,t.startOffset))}window.EnableLog&&console.info("isRemovable",this.isRemovable(i),n.inspectNode(i),i.innerHTML,i.parentNode.innerHTML),this.isRemovable(i)?function(e){for(var t=e.parentNode;e.hasChildNodes();)t.insertBefore(e.firstChild,e);t.removeChild(e)}(i):this.unapplyToElement(i)},applyToRange:function(e){e.splitBoundaries(),window.EnableLog&&console.info("applyToRange split boundaries ");var t=e.getNodes([3]);if(window.EnableLog&&console.info("applyToRange got text nodes "+t),0==t.length&&"break"==this.name){var i=n.getDocument(e.commonAncestorContainer).createTextNode("");e.insertNode(i),t=[i]}if(t.length){for(var o=0,r=t.length;o<r;++o)i=t[o],this.getAppliedAncestor(i)||this.applyToTextNode(i);e.setStart(t[0],0),i=t[t.length-1],e.setEnd(i,i.length),window.EnableLog&&console.info("Apply set range to '"+t[0].data+"', '"+i.data+"'"),this.normalize&&this.postApply(t,e)}},applyToSelection:function(t){window.EnableLog&&console.group("applyToSelection"),t=t||window;var n=e.getSelection(t);window.EnableLog&&console.info("applyToSelection "+n.inspect());var i,o=n.getAllRanges();n.removeAllRanges();for(var r=o.length;r--;)i=o[r],this.applyToRange(i),n.addRange(i);window.EnableLog&&console.groupEnd()},undoToRange:function(e){window.EnableLog&&console.info("undoToRange "+e.inspect()),e.splitBoundaries();var t,n,i=e.getNodes([3]);if(i.length){for(var o=0,r=i.length;o<r;++o)t=i[o],(n=this.getAppliedAncestor(t))&&this.undoToTextNode(t,e,n);e.setStart(i[0],0),t=i[i.length-1],e.setEnd(t,t.length),window.EnableLog&&console.info("Undo set range to '"+i[0].data+"', '"+t.data+"'"),this.normalize&&this.postApply(i,e)}},undoToSelection:function(t){t=t||window;var n,i=e.getSelection(t),o=i.getAllRanges();i.removeAllRanges();for(var r=0,a=o.length;r<a;++r)n=o[r],this.undoToRange(n),i.addRange(n)},getTextSelectedByRange:function(e,t){var n=t.cloneRange();n.selectNodeContents(e);var i=n.intersection(t);return i?i.toString():""},isAppliedToElement:function(e){return!1},isAppliedToRange:function(e){for(var t,n=e.getNodes([3]),i=0,o=n.length;i<o;++i)if(t=this.getTextSelectedByRange(n[i],e),window.EnableLog&&console.debug("text node: '"+n[i].data+"', selectedText: '"+t+"'",this.isAppliedToElement(n[i].parentNode)),""!=t&&!this.isAppliedToElement(n[i].parentNode))return!1;return!0},isAppliedToSelection:function(t){if(t=t||window,"break"==this.name)return!1;for(var n=e.getSelection(t).getAllRanges(),i=n.length;i--;)if(!this.isAppliedToRange(n[i]))return!1;return window.EnableLog&&console.groupEnd(),!0},toggleRange:function(e){this.isAppliedToRange(e)?this.undoToRange(e):this.applyToRange(e)},toggleSelection:function(e){this.isAppliedToSelection(e)?this.undoToSelection(e):this.applyToSelection(e)},execSelection:function(e,t,n){this.type==o&&this.toggleSelection(e)},querySelectionValue:function(e){if(this.type==o)return this.isAppliedToSelection(e)}};var h,g={};e.registerTextCommand=function(e,t){var n=new d(e,t);return g[e.toLowerCase()]=n,n},e.execSelectionCommand=function(e,t,n,i){var o=g[e.toLowerCase()];o&&o instanceof d&&o.execSelection(t,n,i)},e.querySelectionCommandValue=function(e,t){var n=g[e.toLowerCase()];if(n&&n instanceof d)return n.querySelectionValue(t)},typeof window.getComputedStyle!=r?h=function(e,t){return n.getWindow(e).getComputedStyle(e,null)[t]}:typeof n.getBody(document).currentStyle!=r?h=function(e,t){return e.currentStyle[t]}:t.fail("No means of obtaining computed style properties found"),e.registerTextCommand("bold",{type:o,tagNames:["b","span","strong"],isAppliedToElement:function(e){var t=h(e,"fontWeight"),n=!1;if("bold"==t||"bolder"==t)n=!0;else if("normal"==t||"lighter"==t)n=!1;else{var i=parseInt(""+t);isNaN(i)||(n=i>400)}return n},applyToElement:function(e){e.style.fontWeight="bold"},unapplyToElement:function(e){e.style.fontWeight="normal"}}),e.registerTextCommand("italic",{type:o,tagNames:["i","span","em"],isAppliedToElement:function(e){var t=h(e,"fontStyle");return"italic"==t||"oblique"==t},applyToElement:function(e){e.style.fontStyle="italic"},unapplyToElement:function(e){e.style.fontStyle="normal"}}),e.registerTextCommand("underline",{type:o,tagNames:["u","span"],isAppliedToElement:function(e){return h(e,"textDecoration").indexOf("underline")>=0},applyToElement:function(e){e.style.textDecoration="underline"},unapplyToElement:function(e){e.style.textDecoration="none"}}),e.registerTextCommand("uppercase",{type:o,tagNames:["span"],isAppliedToElement:function(e){return"uppercase"==h(e,"textTransform")},applyToElement:function(e){e.style.textTransform="uppercase"},unapplyToElement:function(e){e.style.textTransform="none"}}),e.registerTextCommand("lowercase",{type:o,tagNames:["span"],isAppliedToElement:function(e){return"lowercase"==h(e,"textTransform")},applyToElement:function(e){e.style.textTransform="lowercase"},unapplyToElement:function(e){e.style.textTransform="none"}}),e.registerTextCommand("break",{type:o,tagNames:["p"],isAppliedToElement:function(e){return!1},applyToElement:function(e){},unapplyToElement:function(e){}})}))}
127
+ /*************************************************************************
128
+ * @package AugnitoDomParser
129
+ * @license Restricted
130
+ * Extension Name: Augnito
131
+ * Description: Voice powered medical reporting
132
+ * Version: 1.0.12
133
+ * Email: support@scribetech.in
134
+ *
135
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
136
+ *
137
+ * The contents / part of the Augnito shall not be copied and/or
138
+ * distributed without the express permission of
139
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
140
+ * License.
141
+ *
142
+ * AUGNITO CONFIDENTIAL
143
+ * __________________
144
+ *
145
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
146
+ * All Rights Reserved.
147
+ *
148
+ * NOTICE: All information contained herein is, and remains
149
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
150
+ * if any. The intellectual, technical concepts and contents contained
151
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
152
+ * and its suppliers in process, and are protected by trade secret or
153
+ * copyright law.
154
+ * Dissemination of this information or reproduction of this material
155
+ * is strictly forbidden unless prior written permission is obtained
156
+ * from ScribeTech India Healthcare Pvt ltd.
157
+ */function q(e){return e.createModule("TextRange",["WrappedSelection"],(function(e,t){var n,i,o,r,a,s="character",l="word",c=e.dom,u=e.util,d=u.extend,h=u.createOptions,g=c.getBody,f=/^[ \t\f\r\n]+$/,p=/^[ \t\f\r]+$/,m=/^[\t-\r \u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/,v=/^[\t \u00A0\u1680\u180E\u2000-\u200B\u202F\u205F\u3000]+$/,b=e.Selection.isDirectionBackward;function E(e,t){for(var n=e.slice(t.start,t.end),i={isWord:t.isWord,chars:n,toString:function(){return n.join("")}},o=0,r=n.length;o<r;++o)n[o].token=i;return i}function S(e,t,n){for(var i,o=n(e,t),r=[],a=0;i=o[a++];)r.push(E(e,i));return r}i=(n=c.createTestElement(document,"<p>1 </p><p></p>",!0)).firstChild,(o=e.getSelection()).collapse(i.lastChild,2),o.setStart(i.firstChild,0),n.innerHTML="1 <br />",o.collapse(n,2),o.setStart(n.firstChild,0),r=1==(""+o).length,n.innerHTML="1 <p>1</p>",o.collapse(n,2),o.setStart(n.firstChild,0),a=1==(""+o).length,c.removeNode(n),o.removeAllRanges();var C={includeBlockContentTrailingSpace:!0,includeSpaceBeforeBr:!0,includeSpaceBeforeBlock:!0,includePreLineTrailingSpace:!0,ignoreCharacters:""},T={includeBlockContentTrailingSpace:!1,includeSpaceBeforeBr:!r,includeSpaceBeforeBlock:!a,includePreLineTrailingSpace:!0},R={en:{wordRegex:/[a-z0-9]+('[a-z0-9]+)*/gi,includeTrailingSpace:!1,tokenizer:function(e,t){var n,i=e.join(""),o=[];function r(e,t,n){o.push({start:e,end:t,isWord:n})}for(var a,s,l=0;n=t.wordRegex.exec(i);){if(s=(a=n.index)+n[0].length,a>l&&r(l,a,!1),t.includeTrailingSpace)for(;v.test(e[s]);)++s;r(a,s,!0),l=s}return l<e.length&&r(l,e.length,!1),o}}},y={caseSensitive:!1,withinRange:null,wholeWordsOnly:!1,wrap:!1,direction:"forward",wordOptions:null,characterOptions:null},N={wordOptions:null,characterOptions:null},O={wordOptions:null,characterOptions:null,trim:!1,trimStart:!0,trimEnd:!0},A={wordOptions:null,characterOptions:null,direction:"forward"};function w(e,t){var n=h(e,t);return t.hasOwnProperty("wordOptions")&&(n.wordOptions=function(e){var t,n;return e?(t=e.language||"en",d(n={},R[t]||R.en),d(n,e),n):R.en}(n.wordOptions)),t.hasOwnProperty("characterOptions")&&(n.characterOptions=h(n.characterOptions,C)),n}var _,L,I,x=c.getComputedStyleProperty;L=document.createElement("table"),(I=g(document)).appendChild(L),_="block"==x(L,"display"),I.removeChild(L);var P={table:"table",caption:"table-caption",colgroup:"table-column-group",col:"table-column",thead:"table-header-group",tbody:"table-row-group",tfoot:"table-footer-group",tr:"table-row",td:"table-cell",th:"table-cell"};function M(e,t){var n=x(e,"display",t),i=e.tagName.toLowerCase();return"block"==n&&_&&P.hasOwnProperty(i)?P[i]:n}function D(e){for(var t=function(e){return function(e){for(var t=[];e.parentNode;)t.unshift(e.parentNode),e=e.parentNode;return t}(e).concat([e])}(e),n=0,i=t.length;n<i;++n)if(1==t[n].nodeType&&"none"==M(t[n]))return!0;return!1}function k(e,t){return!t&&e.hasChildNodes()?e.firstChild:function(e){for(;e&&!e.nextSibling;)e=e.parentNode;return e?e.nextSibling:null}(e)}function B(e){var t=e.previousSibling;if(t){for(e=t;e.hasChildNodes();)e=e.lastChild;return e}var n=e.parentNode;return n&&1==n.nodeType?n:null}function F(e){if(!e||3!=e.nodeType)return!1;var t=e.data;if(""===t)return!0;var n=e.parentNode;if(!n||1!=n.nodeType)return!1;var i=x(e.parentNode,"whiteSpace");return/^[\t\n\r ]+$/.test(t)&&/^(normal|nowrap)$/.test(i)||/^[\t\r ]+$/.test(t)&&"pre-line"==i}function j(e){return""===e.data||!!F(e)&&(!e.parentNode||!!D(e))}function U(e){var t=e.nodeType;return 7==t||8==t||D(e)||/^(script|style)$/i.test(e.nodeName)||function(e){var t;return 3==e.nodeType&&(t=e.parentNode)&&"hidden"==x(t,"visibility")}(e)||j(e)}function G(e,t){var n=e.nodeType;return 7==n||8==n||1==n&&"none"==M(e,t)}function W(){this.store={}}function V(e,t,n){return function(i){var o=this.cache;if(o.hasOwnProperty(e))return o[e];var r=t.call(this,n?this[n]:this,i);return o[e]=r,r}}function H(e,t){this.node=e,this.session=t,this.cache=new W,this.positions=new W}W.prototype={get:function(e){return this.store.hasOwnProperty(e)?this.store[e]:null},set:function(e,t){return this.store[e]=t}};var z={getPosition:function(e){var t=this.positions;return t.get(e)||t.set(e,new te(this,e))},toString:function(){return"[NodeWrapper("+c.inspectNode(this.node)+")]"}};H.prototype=z;var K="EMPTY",X="NON_SPACE",q="UNCOLLAPSIBLE_SPACE",J="COLLAPSIBLE_SPACE",$="TRAILING_SPACE_BEFORE_BLOCK",Y="TRAILING_SPACE_IN_BLOCK",Z="TRAILING_SPACE_BEFORE_BR",Q="PRE_LINE_TRAILING_SPACE_BEFORE_LINE_BREAK",ee="INCLUDED_TRAILING_LINE_BREAK_AFTER_BR";function te(e,t){this.offset=t,this.nodeWrapper=e,this.node=e.node,this.session=e.session,this.cache=new W}d(z,{isCharacterDataNode:V("isCharacterDataNode",c.isCharacterDataNode,"node"),getNodeIndex:V("nodeIndex",c.getNodeIndex,"node"),getLength:V("nodeLength",c.getNodeLength,"node"),containsPositions:V("containsPositions",(function(e){return c.isCharacterDataNode(e)||!/^(area|base|basefont|br|col|frame|hr|img|input|isindex|link|meta|param)$/i.test(e.nodeName)}),"node"),isWhitespace:V("isWhitespace",F,"node"),isCollapsedWhitespace:V("isCollapsedWhitespace",j,"node"),getComputedDisplay:V("computedDisplay",M,"node"),isCollapsed:V("collapsed",U,"node"),isIgnored:V("ignored",G,"node"),next:V("nextPos",k,"node"),previous:V("previous",B,"node"),getTextNodeInfo:V("textNodeInfo",(function(e){var t=null,n=!1,i=x(e.parentNode,"whiteSpace"),o="pre-line"==i;return o?(t=p,n=!0):"normal"!=i&&"nowrap"!=i||(t=f,n=!0),{node:e,text:e.data,spaceRegex:t,collapseSpaces:n,preLine:o}}),"node"),hasInnerText:V("hasInnerText",(function(e,t){for(var n=this.session,i=n.getPosition(e.parentNode,this.getNodeIndex()+1),o=n.getPosition(e,0),r=t?i:o,a=t?o:i;r!==a;){if(r.prepopulateChar(),r.isDefinitelyNonEmpty())return!0;r=t?r.previousVisible():r.nextVisible()}return!1}),"node"),isRenderedBlock:V("isRenderedBlock",(function(e){for(var t=e.getElementsByTagName("br"),n=0,i=t.length;n<i;++n)if(!U(t[n]))return!0;return this.hasInnerText()}),"node"),getTrailingSpace:V("trailingSpace",(function(e){if("br"==e.tagName.toLowerCase())return"";switch(this.getComputedDisplay()){case"inline":for(var t=e.lastChild;t;){if(!G(t))return 1==t.nodeType?this.session.getNodeWrapper(t).getTrailingSpace():"";t=t.previousSibling}break;case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":break;case"table-cell":return"\t";default:return this.isRenderedBlock(!0)?"\n":""}return""}),"node"),getLeadingSpace:V("leadingSpace",(function(e){switch(this.getComputedDisplay()){case"inline":case"inline-block":case"inline-table":case"none":case"table-column":case"table-column-group":case"table-cell":break;default:return this.isRenderedBlock(!1)?"\n":""}return""}),"node")});var ne={character:"",characterType:K,isBr:!1,prepopulateChar:function(){var e=this;if(!e.prepopulatedChar){var t=e.node,n=e.offset,i="",o=K,r=!1;if(n>0)if(3==t.nodeType){var a=t.data,s=a.charAt(n-1),l=e.nodeWrapper.getTextNodeInfo(),c=l.spaceRegex;l.collapseSpaces?c.test(s)?n>1&&c.test(a.charAt(n-2))||(l.preLine&&"\n"===a.charAt(n)?(i=" ",o=Q):(i=" ",o=J)):(i=s,o=X,r=!0):(i=s,o=q,r=!0)}else{var u=t.childNodes[n-1];if(u&&1==u.nodeType&&!U(u)&&("br"==u.tagName.toLowerCase()?(i="\n",e.isBr=!0,o=J,r=!1):e.checkForTrailingSpace=!0),!i){var d=t.childNodes[n];d&&1==d.nodeType&&!U(d)&&(e.checkForLeadingSpace=!0)}}e.prepopulatedChar=!0,e.character=i,e.characterType=o,e.isCharInvariant=r}},isDefinitelyNonEmpty:function(){var e=this.characterType;return e==X||e==q},resolveLeadingAndTrailingSpaces:function(){if(this.prepopulatedChar||this.prepopulateChar(),this.checkForTrailingSpace){var e=this.session.getNodeWrapper(this.node.childNodes[this.offset-1]).getTrailingSpace();e&&(this.isTrailingSpace=!0,this.character=e,this.characterType=J),this.checkForTrailingSpace=!1}if(this.checkForLeadingSpace){var t=this.session.getNodeWrapper(this.node.childNodes[this.offset]).getLeadingSpace();t&&(this.isLeadingSpace=!0,this.character=t,this.characterType=J),this.checkForLeadingSpace=!1}},getPrecedingUncollapsedPosition:function(e){for(var t=this;t=t.previousVisible();)if(""!==t.getCharacter(e))return t;return null},getCharacter:function(e){this.resolveLeadingAndTrailingSpaces();var t=this.character,n=function(e){var t=e||"",n="string"==typeof t?t.split(""):t;return n.sort((function(e,t){return e.charCodeAt(0)-t.charCodeAt(0)})),n.join("").replace(/(.)\1+/g,"$1")}(e.ignoreCharacters),i=""!==t&&n.indexOf(t)>-1;if(this.isCharInvariant)return i?"":t;var o=["character",e.includeSpaceBeforeBr,e.includeBlockContentTrailingSpace,e.includePreLineTrailingSpace,n].join("_"),r=this.cache.get(o);if(null!==r)return r;var a,s,l="",c=this.characterType==J,u=!1,d=this;function h(){return u||(s=d.getPrecedingUncollapsedPosition(e),u=!0),s}return c&&(this.type==ee?l="\n":" "==t&&(!h()||s.isTrailingSpace||"\n"==s.character||" "==s.character&&s.characterType==J)||("\n"==t&&this.isLeadingSpace?h()&&"\n"!=s.character&&(l="\n"):(a=this.nextUncollapsed())&&(a.isBr?this.type=Z:a.isTrailingSpace&&"\n"==a.character?this.type=Y:a.isLeadingSpace&&"\n"==a.character&&(this.type=$),"\n"==a.character?(this.type!=Z||e.includeSpaceBeforeBr)&&(this.type!=$||e.includeSpaceBeforeBlock)&&(this.type==Y&&a.isTrailingSpace&&!e.includeBlockContentTrailingSpace||(this.type!=Q||a.type!=X||e.includePreLineTrailingSpace)&&("\n"==t?a.isTrailingSpace?this.isTrailingSpace||this.isBr&&(a.type="TRAILING_LINE_BREAK_AFTER_BR",h()&&s.isLeadingSpace&&!s.isTrailingSpace&&"\n"==s.character?a.character="":a.type=ee):l="\n":" "==t&&(l=" "))):l=t))),n.indexOf(l)>-1&&(l=""),this.cache.set(o,l),l},equals:function(e){return!!e&&this.node===e.node&&this.offset===e.offset},inspect:function(){return"[Position("+c.inspectNode(this.node)+":"+this.offset+")]"},toString:function(){return this.character}};te.prototype=ne,d(ne,{next:V("nextPos",(function(e){var t,n,i,o=e.nodeWrapper,r=e.node,a=e.offset,s=o.session;return r?(a==o.getLength()?n=(t=r.parentNode)?o.getNodeIndex()+1:0:o.isCharacterDataNode()?(t=r,n=a+1):(i=r.childNodes[a],s.getNodeWrapper(i).containsPositions()?(t=i,n=0):(t=r,n=a+1)),t?s.getPosition(t,n):null):null})),previous:V("previous",(function(e){var t,n,i,o=e.nodeWrapper,r=e.node,a=e.offset,s=o.session;return 0==a?n=(t=r.parentNode)?o.getNodeIndex():0:o.isCharacterDataNode()?(t=r,n=a-1):(i=r.childNodes[a-1],s.getNodeWrapper(i).containsPositions()?(t=i,n=c.getNodeLength(i)):(t=r,n=a-1)),t?s.getPosition(t,n):null})),nextVisible:V("nextVisible",(function(e){var t=e.next();if(!t)return null;var n=t.nodeWrapper,i=t.node,o=t;return n.isCollapsed()&&(o=n.session.getPosition(i.parentNode,n.getNodeIndex()+1)),o})),nextUncollapsed:V("nextUncollapsed",(function(e){for(var t=e;t=t.nextVisible();)if(t.resolveLeadingAndTrailingSpaces(),""!==t.character)return t;return null})),previousVisible:V("previousVisible",(function(e){var t=e.previous();if(!t)return null;var n=t.nodeWrapper,i=t.node,o=t;return n.isCollapsed()&&(o=n.session.getPosition(i.parentNode,n.getNodeIndex())),o}))});var ie=null,oe=function(){function e(e){var t=new W;return{get:function(n){var i=t.get(n[e]);if(i)for(var o,r=0;o=i[r++];)if(o.node===n)return o;return null},set:function(n){var i=n.node[e];(t.get(i)||t.set(i,[])).push(n)}}}var t=u.isHostProperty(document.documentElement,"uniqueID");function n(){this.initCaches()}return n.prototype={initCaches:function(){var n;this.elementCache=t?(n=new W,{get:function(e){return n.get(e.uniqueID)},set:function(e){n.set(e.node.uniqueID,e)}}):e("tagName"),this.textNodeCache=e("data"),this.otherNodeCache=e("nodeName")},getNodeWrapper:function(e){var t;switch(e.nodeType){case 1:t=this.elementCache;break;case 3:t=this.textNodeCache;break;default:t=this.otherNodeCache}var n=t.get(e);return n||(n=new H(e,this),t.set(n)),n},getPosition:function(e,t){return this.getNodeWrapper(e).getPosition(t)},getRangeBoundaryPosition:function(e,t){var n=t?"start":"end";return this.getPosition(e[n+"Container"],e[n+"Offset"])},detach:function(){this.elementCache=this.textNodeCache=this.otherNodeCache=null}},n}();function re(){return ie||(ae(),ie=new oe)}function ae(){ie&&ie.detach(),ie=null}function se(e,n,i,o){i&&(n?U(i.node)&&(i=e.previousVisible()):U(i.node)&&(i=i.nextVisible()));var r=e,a=!1;function s(){var e=null;return n?(e=r,a||(r=r.previousVisible(),!(a=!r||i&&r.equals(i))&&r&&r.node&&r.node.firstChild&&r.node.firstChild.attributes&&r.node.firstChild.attributes.contenteditable&&"true"===r.node.firstChild.attributes.contenteditable.value&&(a=r.node.firstChild.isContentEditable))):a||(e=r=r.nextVisible(),a=!r||i&&r.equals(i)),a&&(r=null),e}var l,c=!1;return{next:function(){if(c)return c=!1,l;for(var e;e=s();)if(e.getCharacter(o))return l=e,e;return null},rewind:function(){if(!l)throw t.createError("createCharacterIterator: cannot rewind. Only one position can be rewound.");c=!0},dispose:function(){e=i=null}}}d(c,{nextNode:k,previousNode:B});var le=Array.prototype.indexOf?function(e,t){return e.indexOf(t)}:function(e,t){for(var n=0,i=e.length;n<i;++n)if(e[n]===t)return n;return-1};function ce(e,t,n){var i=se(e,!1,null,t),o=se(e,!0,null,t),r=n.tokenizer;function a(e){for(var t,n,r=[],a=e?i:o,s=!1,l=!1;t=a.next();){if(n=t.character,m.test(n))l&&(l=!1,s=!0);else{if(s){a.rewind();break}l=!0}r.push(t)}return r}var s=a(!0),l=a(!1).reverse(),c=S(l.concat(s),n,r),u=s.length?c.slice(le(c,s[0].token)):[],d=l.length?c.slice(0,le(c,l.pop().token)+1):[];return{nextEndToken:function(){for(var e,t;1==u.length&&!(e=u[0]).isWord&&(t=a(!0)).length>0;)u=S(e.chars.concat(t),n,r);return u.shift()},previousStartToken:function(){for(var e,t;1==d.length&&!(e=d[0]).isWord&&(t=a(!1)).length>0;)d=S(t.reverse().concat(e.chars),n,r);return d.pop()},dispose:function(){i.dispose(),o.dispose(),u=d=null}}}function ue(e,t,n,i){var o=e.getRangeBoundaryPosition(t,!0),r=e.getRangeBoundaryPosition(t,!1);return se(i?r:o,!!i,i?o:r,n)}function de(t,n,i,o,r){var a,s,l,c,u,d,h=b(r.direction),g=se(t,h,t.session.getRangeBoundaryPosition(o,h),r.characterOptions),f="",p=[],m=null;function v(t,n){var i=p[t].previousVisible(),o=p[n-1],a=!r.wholeWordsOnly||function(t,n,i){var o=e.createRange(t.node);return o.setStartAndEnd(t.node,t.offset,n.node,n.offset),!o.expand("word",{wordOptions:i})}(i,o,r.wordOptions);return{startPos:i,endPos:o,valid:a}}for(;a=g.next();)if(s=a.character,i||r.caseSensitive||(s=s.toLowerCase()),h?(p.unshift(a),f=s+f):(p.push(a),f+=s),i){if(u=n.exec(f))if(c=(l=u.index)+u[0].length,d){if(!h&&c<f.length||h&&l>0){m=v(l,c);break}}else d=!0}else if(-1!=(l=f.indexOf(n))){m=v(l,l+n.length);break}return d&&(m=v(l,c)),g.dispose(),m}function he(e){return function(){var t=!!ie,n=[re()].concat(u.toArray(arguments)),i=e.apply(this,n);return t||ae(),i}}function ge(e,t){return he((function(n,i,o,r){void 0===o&&(o=i,i=s),r=w(r,N);var a=e;t&&(a=o>=0,this.collapse(!a));var c=function(e,t,n,i,o){var r,a,c,u,d=0,h=e,g=Math.abs(n);if(0!==n){var f=n<0;switch(t){case s:for(a=se(e,f,null,i);(r=a.next())&&d<g;)++d,h=r;c=r,a.dispose();break;case l:for(var p=ce(e,i,o),m=f?p.previousStartToken:p.nextEndToken;(u=m())&&d<g;)u.isWord&&(++d,h=f?u.chars[0]:u.chars[u.chars.length-1]);break;default:throw new Error("movePositionBy: unit '"+t+"' not implemented")}f?(h=h.previousVisible(),d=-d):h&&h.isLeadingSpace&&!h.isTrailingSpace&&(t==l&&(c=(a=se(e,!1,null,i)).next(),a.dispose()),c&&(h=c.previousVisible()))}return{position:h,unitsMoved:d}}(n.getRangeBoundaryPosition(this,a),i,o,r.characterOptions,r.wordOptions),u=c.position;return this[a?"setStart":"setEnd"](u.node,u.offset),c.unitsMoved}))}function fe(e){return he((function(t,n){for(var i,o=ue(t,this,n=h(n,C),!e),r=0;(i=o.next())&&m.test(i.character);)++r;o.dispose();var a=r>0;return a&&this[e?"moveStart":"moveEnd"]("character",e?r:-r,{characterOptions:n}),a}))}function pe(e){return he((function(t,n){var i=!1;return this.changeEachRange((function(t){i=t[e](n)||i})),i}))}d(e.rangePrototype,{moveStart:ge(!0,!1),moveEnd:ge(!1,!1),move:ge(!0,!0),trimStart:fe(!0),trimEnd:fe(!1),trim:he((function(e,t){var n=this.trimStart(t),i=this.trimEnd(t);return n||i})),expand:he((function(e,t,n){var i=!1,o=(n=w(n,O)).characterOptions;if(t||(t=s),t==l){var r,a,c=n.wordOptions,u=e.getRangeBoundaryPosition(this,!0),d=e.getRangeBoundaryPosition(this,!1),h=ce(u,o,c).nextEndToken(),g=h.chars[0].previousVisible();return a=(r=this.collapsed?h:ce(d,o,c).previousStartToken()).chars[r.chars.length-1],g.equals(u)||(this.setStart(g.node,g.offset),i=!0),a&&!a.equals(d)&&(this.setEnd(a.node,a.offset),i=!0),n.trim&&(n.trimStart&&(i=this.trimStart(o)||i),n.trimEnd&&(i=this.trimEnd(o)||i)),i}return this.moveEnd(s,1,n)})),text:he((function(e,t){return this.collapsed?"":function(e,t,n){for(var i,o=[],r=ue(e,t,n);i=r.next();)o.push(i);return r.dispose(),o}(e,this,h(t,C)).join("")})),selectCharacters:he((function(e,t,n,i,o){var r={characterOptions:o};t||(t=g(this.getDocument())),this.selectNodeContents(t),this.collapse(!0),this.moveStart("character",n,r),this.collapse(!0),this.moveEnd("character",i-n,r)})),toCharacterRange:he((function(e,t,n){t||(t=g(this.getDocument()));var i,o=t.parentNode,r=c.getNodeIndex(t),a=-1==c.comparePoints(this.startContainer,this.endContainer,o,r),s=this.cloneRange();return a?(s.setStartAndEnd(this.startContainer,this.startOffset,o,r),i=-s.text(n).length):(s.setStartAndEnd(o,r,this.startContainer,this.startOffset),i=s.text(n).length),{start:i,end:i+this.text(n).length}})),findText:he((function(t,n,i){(i=w(i,y)).wholeWordsOnly&&(i.wordOptions.includeTrailingSpace=!1);var o=b(i.direction),r=i.withinRange;r||(r=e.createRange()).selectNodeContents(this.getDocument());var a=n,s=!1;"string"==typeof a?i.caseSensitive||(a=a.toLowerCase()):s=!0;var l=t.getRangeBoundaryPosition(this,!o),c=r.comparePoint(l.node,l.offset);-1===c?l=t.getRangeBoundaryPosition(r,!0):1===c&&(l=t.getRangeBoundaryPosition(r,!1));for(var u,d=l,h=!1;;)if(u=de(d,a,s,r,i)){if(u.valid)return this.setStartAndEnd(u.startPos.node,u.startPos.offset,u.endPos.node,u.endPos.offset),!0;d=o?u.startPos:u.endPos}else{if(!i.wrap||h)return!1;r=r.cloneRange(),d=t.getRangeBoundaryPosition(r,!o),r.setBoundary(l.node,l.offset,o),h=!0}})),pasteHtml:function(e){if(this.deleteContents(),e){var t=this.createContextualFragment(e),n=t.lastChild;this.insertNode(t),this.collapseAfter(n)}}}),d(e.selectionPrototype,{expand:he((function(e,t,n){this.changeEachRange((function(e){e.expand(t,n)}))})),move:he((function(e,t,n,i){var o=0;if(this.focusNode){this.collapse(this.focusNode,this.focusOffset);var r=this.getRangeAt(0);i||(i={}),i.characterOptions=h(i.characterOptions,T),o=r.move(t,n,i),this.setSingleRange(r)}return o})),trimStart:pe("trimStart"),trimEnd:pe("trimEnd"),trim:pe("trim"),selectCharacters:he((function(t,n,i,o,r,a){var s=e.createRange(n);s.selectCharacters(n,i,o,a),this.setSingleRange(s,r)})),saveCharacterRanges:he((function(e,t,n){for(var i=this.getAllRanges(),o=[],r=1==i.length&&this.isBackward(),a=0,s=i.length;a<s;++a)o[a]={characterRange:i[a].toCharacterRange(t,n),backward:r,characterOptions:n};return o})),restoreCharacterRanges:he((function(t,n,i){this.removeAllRanges();for(var o,r,a,s=0,l=i.length;s<l;++s)a=(r=i[s]).characterRange,(o=e.createRange(n)).selectCharacters(n,a.start,a.end,r.characterOptions),this.addRange(o,r.backward)})),text:he((function(e,t){for(var n=[],i=0,o=this.rangeCount;i<o;++i)n[i]=this.getRangeAt(i).text(t);return n.join("")}))}),e.innerText=function(t,n){var i=e.createRange(t);return i.selectNodeContents(t),i.text(n)},e.createWordIterator=function(e,t,n){var i=re();n=w(n,A);var o=ce(i.getPosition(e,t),n.characterOptions,n.wordOptions),r=b(n.direction);return{next:function(){return r?o.previousStartToken():o.nextEndToken()},dispose:function(){o.dispose(),this.next=function(){}}}},e.noMutation=function(e){e(re()),ae()},e.noMutation.createEntryPointFunction=he,e.textRange={isBlockNode:function(e){return e&&(1==e.nodeType&&!/^(inline(-block|-table)?|none)$/.test(M(e))||9==e.nodeType||11==e.nodeType)},isCollapsedWhitespaceNode:j,createPosition:he((function(e,t,n){return e.getPosition(t,n)}))}})),e
158
+ /*************************************************************************
159
+ * @package AugnitoDomParser
160
+ * @license Restricted
161
+ * Extension Name: Augnito
162
+ * Description: Voice powered medical reporting
163
+ * Version: 1.0.12
164
+ * Email: support@scribetech.in
165
+ *
166
+ * (C) Copyright 2020 – 2025 | ScribeTech India Healthcare Pvt ltd
167
+ *
168
+ * The contents / part of the Augnito shall not be copied and/or
169
+ * distributed without the express permission of
170
+ * ScribeTech India Healthcare Pvt ltd except in compliance with the
171
+ * License.
172
+ *
173
+ * AUGNITO CONFIDENTIAL
174
+ * __________________
175
+ *
176
+ * [2020] - [2025] ScribeTech India Healthcare Pvt ltd
177
+ * All Rights Reserved.
178
+ *
179
+ * NOTICE: All information contained herein is, and remains
180
+ * the property of ScribeTech India Healthcare Pvt ltd and its suppliers,
181
+ * if any. The intellectual, technical concepts and contents contained
182
+ * herein are proprietary to ScribeTech India Healthcare Pvt ltd
183
+ * and its suppliers in process, and are protected by trade secret or
184
+ * copyright law.
185
+ * Dissemination of this information or reproduction of this material
186
+ * is strictly forbidden unless prior written permission is obtained
187
+ * from ScribeTech India Healthcare Pvt ltd.
188
+ */}function J(e){e.createModule("Util",["WrappedSelection"],(function(e,t){var n=e.rangePrototype,i=e.selectionPrototype;i.pasteText=function(e){this.deleteFromDocument();var t=this.getRangeAt(0),n=t.getDocument().createTextNode(e);t.insertNode(n),this.setSingleRange(t)},n.pasteText=function(e){this.deleteContents();var t=this.getDocument().createTextNode(e);this.insertNode(t)},i.pasteHtml=function(e){this.deleteFromDocument();var t=this.getRangeAt(0),n=this.createContextualFragment(e),i=n.lastChild;t.insertNode(n),i&&t.setStartAfter(i),this.setSingleRange(t)},n.pasteHtml=function(e){this.deleteContents();var t=this.createContextualFragment(e);this.insertNode(t)},i.selectNodeContents=function(t){var n=e.createRange(this.win);n.selectNodeContents(t),this.setSingleRange(n)},e.createRangeFromNode=function(t){var n=e.createRange(t);return n.selectNode(t),n},e.createRangeFromNodeContents=function(t){var n=e.createRange(t);return n.selectNodeContents(t),n},e.selectNodeContents=function(t){e.getSelection().selectNodeContents(t)},n.selectSelectedTextElements=function(){function t(t){return 1==t.nodeType&&"inline"==e.dom.getComputedStyleProperty(t,"display")}function n(e,n){var i=null,o=e.cloneRange();if(o.selectNode(n),""!==o.toString())for(;(n=n.parentNode)&&t(n)&&e.containsNodeText(n);)i=n;return i}return function(){var e=n(this,this.startContainer);e&&this.setStartBefore(e);var t=n(this,this.endContainer);t&&this.setEndAfter(t)}}()}))}W=V,Object.defineProperty(V,"processText",{enumerable:!0,configurable:!0,writable:!0,value:(e,t,n,i,o,r)=>{" ,"!==e&&" ."!==e||(e=e.trim())," \n"!==e&&" \n\n"!==e&&"\n"!==e&&"\n\n"!==e||(e=W.trimWithoutNewLine(e)),0!==i&&o||(e=W.capitalizeFirstLetter(e,0),e=W.trimWithoutNewLine(e)),(t||n)&&(e=W.capitalizeFirstLetter(e,0),t||(e=W.trimWithoutNewLine(e)));var a=e.trim();return a.length>0&&("."===a[0]||":"===a[0])&&(e=W.trimWithoutNewLine(e)),r&&(e=W.trimWithoutNewLine(e)),e}}),Object.defineProperty(V,"ProcessText",{enumerable:!0,configurable:!0,writable:!0,value:(e,t,n,i)=>{new RegExp("^ ([.|:|,])(.*?)$","gis").exec(e)&&(e=W.lTrim(e))," ,"!=e&&" ."!=e||(e=e.trim())," \n"!=e&&" \n\n"!=e||(e=W.trimWithoutNewLine(e)),0==n&&(e=W.capitalizeFirstLetter(e,0),e=W.trimWithoutNewLine(e));var o=!1,r=!1,a=0;0==i.start&&(r=!0);for(var s=t,l=s.length-1;l>-1;l--){var c=s[l];if(null!=c){if("."==c||":"==c){o=!0;break}if("\r\n"==c||"\n"==c||"\r"==c||"\v"==c){r=!0;break}if(null!=c.trim()&&""!=c.trim())break;a++}}if(o){var u=W.capitalizeFirstLetter(e,0);u=W.trimWithoutNewLine(u),e=a>0||0==u.trim().length?u:" "+u}if(r){u=W.capitalizeFirstLetter(e,0);e=u=W.trimWithoutNewLine(u)}return a>0&&(e=W.trimWithoutNewLine(e)),{ReceivedText:e=W.replaceSpaceAfterNewline(e),EndLine:o||r}}}),Object.defineProperty(V,"trimWithoutNewLine",{enumerable:!0,configurable:!0,writable:!0,value:e=>{if(!e)return e;return e=(e=(e=e.replace(/\n/gi,"@newline@")).trim()).replace(new RegExp("@newline@","gi"),"\n")}}),Object.defineProperty(V,"lTrim",{enumerable:!0,configurable:!0,writable:!0,value:e=>e?e.replace(/^\s+/,""):e}),Object.defineProperty(V,"replaceSpaceAfterNewline",{enumerable:!0,configurable:!0,writable:!0,value:e=>e.replace(/\n +/g,"\n")}),window.EnableLog=!1;var Y,Z=function(){};Z.prototype.build=function(){const e=new H;return new z(e),new K(e),new X(e),new q(e),new J(e),e};class Q{}Object.defineProperty(Q,"NODE_ELEMENT",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(Q,"NODE_TEXT",{enumerable:!0,configurable:!0,writable:!0,value:3});class ee{}Y=ee,Object.defineProperty(ee,"linkBreakElement",{enumerable:!0,configurable:!0,writable:!0,value:"br"}),Object.defineProperty(ee,"divLinkBreakElement",{enumerable:!0,configurable:!0,writable:!0,value:"div"}),Object.defineProperty(ee,"paragraphLinkBreakElement",{enumerable:!0,configurable:!0,writable:!0,value:"p"}),Object.defineProperty(ee,"listLinkBreakElement",{enumerable:!0,configurable:!0,writable:!0,value:"li"}),Object.defineProperty(ee,"lineBreakElements",{enumerable:!0,configurable:!0,writable:!0,value:[Y.linkBreakElement,Y.divLinkBreakElement,Y.paragraphLinkBreakElement,Y.listLinkBreakElement]});class te extends G{constructor(e){super(e,"CommonContentEditableProcessor"),Object.defineProperty(this,"_augnitoRange",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_editorDocument",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_dynamicSelect",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"findLineBreakAtCursor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;if(null!=e)if(null!=e.previousSibling&&e.previousSibling.nodeType===Q.NODE_ELEMENT){if(ee.lineBreakElements.includes(e.localName))return!0}else{if(null!=e.previousSibling&&e.previousSibling.nodeType===Q.NODE_TEXT&&e.previousSibling.nodeValue&&e.previousSibling.nodeValue.length>0)return!1;if(e.previousElementSibling&&(null===(t=e.previousElementSibling)||void 0===t?void 0:t.nodeType)===Q.NODE_ELEMENT){const t=e.previousElementSibling;if(t&&ee.lineBreakElements.includes(t.localName))return!0}else if(null==e.previousSibling&&null==e.previousElementSibling&&(null!=e.parentElement||null!=e.parentNode)){const t=e.parentElement?e.parentElement:e.parentNode,n=t&&t.nodeType==Q.NODE_ELEMENT?t.localName:"";if(t&&ee.lineBreakElements.includes(n))return!0;if(t&&null!=t.previousSibling){if(t.previousSibling.nodeType===Q.NODE_TEXT&&t.previousSibling.nodeValue&&t.previousSibling.nodeValue.length>0)return!1;if(t.previousSibling.nodeType===Q.NODE_ELEMENT&&ee.lineBreakElements.includes(t.previousSibling.localName))return!0}const i=t&&t.nodeType==Q.NODE_ELEMENT?t.previousElementSibling:null;if(i&&ee.lineBreakElements.includes(i.localName))return!0;if(null!=i)return!1;if(null!=t)return this.findLineBreakAtCursor(t)}}return!1}}),Object.defineProperty(this,"findLineBreakAtNextCursor",{enumerable:!0,configurable:!0,writable:!0,value:e=>{var t;if(null!=e)if(null!=e.nextSibling&&e.nextSibling.nodeType===Q.NODE_ELEMENT){if(ee.lineBreakElements.includes(e.nextSibling.localName))return!0}else{if(null!=e.nextSibling&&e.nextSibling.nodeType===Q.NODE_TEXT&&e.nextSibling.nodeValue&&e.nextSibling.nodeValue.length>0)return!1;if(null!=e.nextElementSibling&&(null===(t=e.nextElementSibling)||void 0===t?void 0:t.nodeType)===Q.NODE_ELEMENT){const t=e.nextElementSibling;if(t&&ee.lineBreakElements.includes(t.localName))return!0}else if(null==e.nextSibling&&null==e.nextElementSibling&&(null!=e.parentElement||null!=e.parentNode)){const t=e.parentElement?e.parentElement:e.parentNode,n=t&&t.nodeType==Q.NODE_ELEMENT?t.localName:"";if(n&&ee.lineBreakElements.includes(n))return!0;if(t&&null!=t.nextSibling){if(t.nextSibling.nodeType===Q.NODE_TEXT&&t.nextSibling.nodeValue&&t.nextSibling.nodeValue.length>0)return!1;if(t.nextSibling.nodeType===Q.NODE_ELEMENT&&ee.lineBreakElements.includes(t.nextSibling.localName))return!0}const i=t&&t.nodeType==Q.NODE_ELEMENT?t.nextElementSibling:null;if(i&&ee.lineBreakElements.includes(i.localName))return!0;if(null!=i)return!1;if(null!=t)return this.findLineBreakAtNextCursor(t)}}return!1}}),this._augnitoRange=(new Z).build(),this.validateDependencies()}processFinalResult(e,t){if(!this.validateEditorDocument(t)||!this._editorDocument)return;if(this.onBeforeProcess(e))return;let n=e.receivedText||"";n=n.replace(/\n/gi,"@newline@");let i=!1,o=!1,r=!1,a=!1;this.deleteSelection(null);const s=this._augnitoRange.getSelection(this._editorDocument);if(!s||0===s.rangeCount)return;const l=s.getRangeAt(0),c=l.cloneRange(),u=l.startOffset;n=n.replace(new RegExp("@newline@","gi"),"\n");const d=this.findLastChar(this._editorDocument);a=d.cursorInSameLine,o=""==d.lastImmediateChar.trim(),i=d.isLastFullStop,r=d.isLastNewLine,s.removeAllRanges(),s.addRange(c),n=V.processText(n,i,r,u,a,o),this.insertTextAtCursor(this._editorDocument,n)}processCommand(e,t){if(this.validateEditorDocument(t)&&this._editorDocument&&!(this.onBeforeProcess(e)||e.action&&this.customCommandProcessor&&this.customCommandProcessor(e.action)))if(e.action===r.SPACE_ADD)this.insertTextCallback(this._editorDocument," ",!0);else if(e.action===r.SELECT_ALL)if(this.customActionProcessor)this.customActionProcessor(e.action);else{const e=this._augnitoRange.getSelection(this._editorDocument).getRangeAt(0),t=this._editorDocument.activeElement&&this._editorDocument.activeElement.firstElementChild?this._editorDocument.activeElement.firstElementChild.firstChild:null;t&&e.setStart(t,0);const n=this._editorDocument.activeElement&&this._editorDocument.activeElement.lastElementChild?this._editorDocument.activeElement.lastElementChild.lastChild:null;n&&e.setEnd(n,n.textContent?n.textContent.length:0),this._augnitoRange.getSelection(this._editorDocument).removeAllRanges(),this._augnitoRange.getSelection(this._editorDocument).addRange(e)}else if(!e.action&&e.name===r.SELECT&&this.customSelectProcessor&&this.customSelectProcessor({searchText:e.searchText||"",selectFor:e.selectFor||""}));else if(e.action&&0===e.action.indexOf(r.SELECT)||0===e.name.indexOf(r.SELECT)){this.deSelectSelection(this._editorDocument,!1,!0),e.name=e.name.replace(r.SELECT,""),e.chooseNumber=e.chooseNumber?e.chooseNumber:0;const t={name:e.name,chooseNumber:e.chooseNumber||0};this.processSelect(Object.assign(Object.assign({},e),t),this._editorDocument),e.selectFor&&e.selectFor!==r.SELECT&&this.deSelectSelection(this._editorDocument)}else if(e.action&&r.NEXT_FIELD===e.action.toLowerCase()){const e={caseSensitive:!1,wholeWordsOnly:!1,direction:"forward"};this.deSelectSelection(this._editorDocument,!1,!0),this.searchDynamicFiled(e);const t=this._augnitoRange.getSelection(this._editorDocument);this.scrollElementToView(t)}else if(e.action&&r.PREVIOUS_FIELD===e.action.toLowerCase()){const e={caseSensitive:!1,wholeWordsOnly:!1,direction:"backward"};this.deSelectSelection(this._editorDocument,!0,!0),this.searchDynamicFiled(e);const t=this._augnitoRange.getSelection(this._editorDocument);this.scrollElementToView(t)}else if(e.action&&r.DESELECT_IT===e.action.toLowerCase())this.deSelectSelection(this._editorDocument,!1,!0);else if(e.action&&this.processSelectForAction(e.action,this._editorDocument));else if(e.action===r.GO_TO_LINE_START){const e=this.traverseTextNodes("character",-1,["\n"],!1,this._editorDocument,!0);e.rangeAfterProcess&&this.setSelectionRange(this._editorDocument,e.rangeAfterProcess)}else if(e.action===r.GO_TO_LINE_END){const e=this.traverseTextNodes("character",1,["\n"],!1,this._editorDocument,!0);e.rangeAfterProcess&&(null!=e.rangeAfterProcess.endContainer.nodeValue&&e.rangeAfterProcess.endContainer.nodeValue.length!==e.rangeAfterProcess.endOffset&&e.rangeAfterProcess.setStartAndEnd(e.rangeAfterProcess.endContainer,e.rangeAfterProcess.endContainer.nodeValue.length),this.setSelectionRange(this._editorDocument,e.rangeAfterProcess))}else if(e.name===r.GOTO){const t=this._augnitoRange.createRange(this._editorDocument);if(t.selectNodeContents(this._editorDocument.body),""!==e.searchText){const n=e.searchText+":",i={caseSensitive:!1,wholeWordsOnly:!1};t.findText(n,i)&&(t.collapse(!1),t.setStartAndEnd(t.endContainer,t.endOffset),this.setSelectionRange(this._editorDocument,t))}}}insertTextAtCursor(e,t){const n=t.split("\n");if(n.length>0)for(let t=0;t<n.length;t++){""!==n[t]&&this.insertTextCallback(e,n[t],!1);n.length>1&&!(t===n.length-2&&""===n[n.length-1]||t===n.length-1&&""!==n[t])&&this.insertTextCallback(e,"\n",!1)}}findLastChar(e){const t=this.traverseTextNodes("character",-1,[" ","\n"],!0,e);this._augnitoRange.getSelection(e).removeAllRanges(),this._augnitoRange.getSelection(e).addRange(t.rangeBeforeProcess);const n={lastChar:t.lastChar,cursorInSameLine:t.isCursorInSameLine,isLastFullStop:!1,isLastNewLine:!1,lastImmediateChar:t.lastImmediateChar};return""!==t.lastChar&&("."===t.lastChar||":"===t.lastChar?n.isLastFullStop=!0:"\r\n"!==t.lastChar&&"\n"!==t.lastChar&&"\r"!==t.lastChar||(n.isLastNewLine=!0)),n}processSelect(e,t){e.searchText||(e.searchText="");const n=e.searchText.replace(/ /gi,"").toLowerCase().trim(),i=e.nextPrevious,o=e.chooseNumber&&e.chooseNumber>0?e.chooseNumber:1;if(!e.name)return this.log("warning. attempt to process select but recipe has no name"),!1;if("nextword"===n||"next"===i){return this.getNextInterval(e.name,o,t)&&e.selectFor&&this.processSelectForAction(e.selectFor,t,!0),!0}if("previousword"===n||"it"===n||"that"===n||"previous"===i||"last"===i){return this.getPrevInterval(e.name,o,t)&&e.selectFor&&this.processSelectForAction(e.selectFor,t,!0),!0}return!1}processSelectForAction(e,t,n){const i=this._augnitoRange.getSelection(t).getRangeAt(0),o=i.cloneRange();if(i.startOffset===i.endOffset&&i.endContainer===i.startContainer&&this.getPrevInterval("word",1,t),this.customActionProcessor)return setTimeout((function(e,t,n,i){if(e&&e.customActionProcessor){var o=e.customActionProcessor(t);i&&t!==r.SELECT?e.deSelectSelection(n,!1,!0):o||t===r.SELECT||e.deSelectSelection(n,!1,!0)}}),100,this,e,t,n),!0;let a=!1;return"bold"===e.toLowerCase()||r.BOLD_IT===e.toLowerCase()?(this._augnitoRange.execSelectionCommand("Bold",t),a=!0):"italicize"===e.toLowerCase()||r.ITALICIZE_IT===e.toLowerCase()?(this._augnitoRange.execSelectionCommand("Italic",t),a=!0):"underline"===e.toLowerCase()||r.UNDERLINE_IT===e.toLowerCase()?(this._augnitoRange.execSelectionCommand("Underline",t),a=!0):"capitalize"===e.toLowerCase()||r.CAPITALIZED_IT===e.toLowerCase()?(this._augnitoRange.execSelectionCommand("Uppercase",t),a=!0):r.DELETE!==e.toLowerCase()&&"deleteit"!==e.toLowerCase()&&r.PRESS_DELETE!==e.toLowerCase()||(this.deleteSelection(t),a=!0),a||this.setSelectionRange(t,o),a}onBeforeProcess(e){if(null==this._editorDocument||!e.receivedTextWithoutSpace)return!1;if(!this._dynamicSelect)return!1;const t=parseInt(e.receivedTextWithoutSpace,10),n=t-1;if(isNaN(t)||n>this._dynamicSelect.length)return this.removeDynamicSelect(),!1;const i=this._dynamicSelect.getBadge(n).range;this.setSelectionRange(this._editorDocument,i),this._dynamicSelect.selectFor&&(this.processSelectForAction(this._dynamicSelect.selectFor,this._editorDocument,!0),this.deSelectSelection(this._editorDocument)),this.removeDynamicSelect();const o=this._augnitoRange.getSelection(this._editorDocument);return this.scrollElementToView(o),!0}removeDynamicSelect(){this._dynamicSelect&&(this._dynamicSelect.removeBadges(),this._dynamicSelect=null)}getLastLines(e,t){if(null==this._editorDocument)return this.error("missing editor document. Make sure to provide a non null Document type"),null;const n=this._augnitoRange.getSelection(this._editorDocument).getRangeAt(0);var i=$(n.nativeRange.startContainer).closest("p")[0];if(i||(i=$(n.nativeRange.startContainer).closest("li")[0]),null==i)return null;const o=this._augnitoRange.createRange(this._editorDocument);if(1===e)if(0===n.startOffset){const t=this.getLastLinesRecursive(0,e,i);o.setStart(t,0);const n=i.previousSibling?i.previousSibling:i,r=i.previousSibling?i.previousSibling.childNodes.length:0;o.setEnd(n,r)}else o.selectNodeContents(i);else{const t=0===n.startOffset?0:1,r=this.getLastLinesRecursive(t,e,i);if(o.setStart(r,0),0===n.startOffset){const e=i.previousSibling?i.previousSibling:i,t=i.previousSibling?i.previousSibling.childNodes.length:0;o.setEnd(e,t)}else o.setEnd(i,i.childNodes.length)}return this._augnitoRange.getSelection(t).removeAllRanges(),this._augnitoRange.getSelection(t).addRange(o),o}getLastLinesRecursive(e,t,n){if(e===t)return n;if(n.previousSibling){const i=this.isListElement(n.previousSibling)&&n.previousSibling.lastChild?n.previousSibling.lastChild:n.previousSibling;return this.getLastLinesRecursive(e+1,t,i)}if(n.parentElement&&this.isListElement(n.parentElement)){const i=n.parentElement.previousSibling;if(!i||!i.lastChild)return n.parentElement;const o=this.isListElement(i)?i.lastChild:i;return this.getLastLinesRecursive(e+1,t,o)}return n}isListElement(e){if(e.nodeType==Q.NODE_ELEMENT){const t=e.tagName;return"UL"===t||"OL"===t}return!1}getNextInterval(e,t,n){return"word"===e?this.getNextWordInterval(t,n):null}getPrevInterval(e,t,n){return"word"===e?this.getPrevWordInterval(t,n):"line"===e?this.getLastLines(t,n):null}getNextWordInterval(e,t){let n;""!==this.traverseTextNodes("character",1,1,!0,t).lastChar.trim()&&(n=this.traverseTextNodes("character",-1,[" ","\n",",",":",";","."],!1,t,!1),n.rangeAfterProcess&&this.setSelectionRange(t,n.rangeAfterProcess)),n=this.traverseTextNodes("word",1,e,!1,t,!1);const i=this._augnitoRange.createRange(t);return n.rangeAfterProcess&&(i.setEnd(n.rangeAfterProcess.endContainer,n.rangeAfterProcess.endOffset),i.setStart(n.rangeBeforeProcess.startContainer,n.rangeBeforeProcess.startOffset)),this.setSelectionRange(t,i),i}getPrevWordInterval(e,t){let n;""!==this.traverseTextNodes("character",-1,1,!0,t).lastChar.trim()&&(n=this.traverseTextNodes("character",1,[" ","\n",",",":",";","."],!1,t,!1),n.rangeAfterProcess&&this.setSelectionRange(t,n.rangeAfterProcess)),n=this.traverseTextNodes("word",-1,e,!1,t,!1);const i=this._augnitoRange.createRange(t);return n.rangeAfterProcess&&(i.setEnd(n.rangeBeforeProcess.endContainer,n.rangeBeforeProcess.endOffset),i.setStart(n.rangeAfterProcess.startContainer,n.rangeAfterProcess.startOffset)),this.setSelectionRange(t,i),i}deSelectSelection(e,t,n){if(null==this._editorDocument)return void this.error("missing editor document. Make sure to provide a non null Document type");if(this.customActionProcessor&&!n)return;const i=this._augnitoRange.getSelection(e).getRangeAt(0);t?i.setEnd(i.startContainer,i.startOffset):i.setStart(i.endContainer,i.endOffset),this._augnitoRange.getSelection(e).removeAllRanges(),this._augnitoRange.getSelection(e).addRange(i)}searchDynamicFiled(e){if(null==this._editorDocument)return void this.error("missing editor document. Make sure to provide a non null Document type");const t=this._augnitoRange.createRange(this._editorDocument);t.selectNodeContents(this._editorDocument.body);const n=this._augnitoRange.getSelection(this._editorDocument).getRangeAt(0);e.withinRange=n;t.findText(/\[(.*?)\]/gi,e)&&(t.setStart(t.startContainer,t.startOffset),t.setEnd(t.endContainer,t.endOffset),this.setSelectionRange(this._editorDocument,t))}deleteSelection(e){null!=this._editorDocument?null==e?this._augnitoRange.getSelection(this._editorDocument).deleteFromDocument():e.execCommand("delete"):this.error("missing editor document. Make sure to provide a non null Document type")}setSelectionRange(e,t){this._augnitoRange.getSelection(e).removeAllRanges(),this._augnitoRange.getSelection(e).addRange(t)}insertTextCallback(e,t,n){const i=this._augnitoRange.getSelection(e);if(!i||0===i.rangeCount)return;let o=i.getRangeAt(0);if(o){if("\n"===t)if(this.customLineBreakFunction)this.customLineBreakFunction();else if(e!==document.getRootNode()){const t=e.createElement(ee.linkBreakElement),n=e.createElement(ee.linkBreakElement),i=e.createTextNode("");null!=o.endContainer.nextElementSibling&&o.endContainer.nextElementSibling.localName===ee.linkBreakElement||o.insertNode(n),o.insertNode(i),o.insertNode(t),o.setStartAndEnd(i,0),this._augnitoRange.getSelection(e).setSingleRange(o)}else{const t=o.cloneRange(),n=new KeyboardEvent("keydown",{bubbles:!0,cancelable:!0,keyCode:13});if(e.activeElement&&e.activeElement.dispatchEvent(n),o=this._augnitoRange.getSelection(e).getRangeAt(0),o.endContainer===t.endContainer&&o.endOffset===t.endOffset){const t=e.createElement(ee.divLinkBreakElement),n=e.createElement(ee.divLinkBreakElement),i=e.createTextNode("");null!=o.endContainer.nextElementSibling&&o.endContainer.nextElementSibling.localName===ee.divLinkBreakElement||o.insertNode(n),o.insertNode(i),o.insertNode(t),o.setStartAndEnd(i,0),this._augnitoRange.getSelection(e).setSingleRange(o)}}else if(this.customTextWriteFunction&&!n)this.customTextWriteFunction(t);else{const n=e.createTextNode(t);o.insertNode(n);const i=n.nodeValue?n.nodeValue.length:0;o.setStartAndEnd(n,i),this._augnitoRange.getSelection(e).setSingleRange(o)}this.scrollElementToView(i)}}scrollElementToView(e){try{var t=e.getRangeAt(0).endContainer;t instanceof HTMLElement?t.scrollIntoView(!0):t instanceof Text&&t.parentElement&&t.parentElement.scrollIntoView(!0)}catch(e){console.log(e)}}traverseTextNodes(e,t,n,i,o,r){const a=this._augnitoRange.getSelection(o).getRangeAt(0),s=a.cloneRange();let l,c=!0,u="",d="",h=-1;for(;0!==h;){let s=!1,g=a;const f=g.cloneRange();if(0===g.endOffset&&t<0?(s=this.findLineBreakAtCursor(g.endContainer),s&&(s=!0,c=!1)):t>0&&g.endContainer.nodeType===Q.NODE_TEXT&&g.endOffset===g.endContainer.length&&(s=this.findLineBreakAtNextCursor(g.endContainer),s&&(s=!0,c=!1)),"object"==typeof n&&s&&n.includes("\n")){l=g;break}if(h=g.move(e,t),g=a,l=f.cloneRange(),g.endOffset===f.endOffset&&g.endContainer===f.endContainer)break;const p=this._augnitoRange.createRange(o);if(t<0)p.setEnd(f.endContainer,f.endOffset),p.setStart(g.endContainer,g.endOffset);else{if(!(t>0))break;p.setEnd(g.endContainer,g.endOffset),p.setStart(f.endContainer,f.endOffset)}this._augnitoRange.getSelection(o).removeAllRanges(),this._augnitoRange.getSelection(o).addRange(p);const m=this._augnitoRange.getSelection(o);if(0===m.rangeCount)continue;const v=m.getRangeAt(0);if(u=v.toString(),""==d&&(d=u),0===v.endOffset&&t<0?(s=this.findLineBreakAtCursor(v.endContainer),s&&(s=!0,c=!1)):t>0&&v.endContainer.nodeType===Q.NODE_TEXT&&v.endOffset===v.endContainer.length&&(s=this.findLineBreakAtNextCursor(v.endContainer),s&&(s=!0,c=!1)),r?t>0?l.setStartAndEnd(f.endContainer,f.endOffset):t<0&&l.setStartAndEnd(f.startContainer,f.startOffset):t>0?l.setStartAndEnd(v.endContainer,v.endOffset):t<0&&l.setStartAndEnd(v.startContainer,v.startOffset),"number"==typeof n){let e;if(e=i?u.split(" "):u.split(" ").filter((function(e){return""!==e&&":"!==e&&";"!==e&&"."!==e})),(n-=e.length)<=0)break}else{if("object"!=typeof n)break;if(!/^[\u0085\u00A0\u1680\u180E\u2000-\u200B\u2028\u2029\u202F\u205F\u3000]+$/.test(u)&&""!==u){if(!i&&n.includes(u))break;if(i&&!n.includes(u))break}if(s&&n.includes("\n"))break}this._augnitoRange.getSelection(o).removeAllRanges(),this._augnitoRange.getSelection(o).addRange(l),0===h&&(c=!1)}this._augnitoRange.getSelection(o).removeAllRanges(),this._augnitoRange.getSelection(o).addRange(s);return{rangeBeforeProcess:s,rangeAfterProcess:l,isCursorInSameLine:c,lastChar:u,lastImmediateChar:d}}static findActiveEditor(e){if(e instanceof HTMLIFrameElement||"iframe"===e.localName||"frame"===e.localName){let t;const n=e.contentWindow,i=n?n.document.activeElement:null;return t=i&&(i instanceof HTMLIFrameElement||"iframe"===i.localName||"frame"===i.localName)?this.findActiveEditor(i):i,t||e}return e}validateEditorDocument(e){return null==e?(this.error("Unable to add content. Must provide an editor of type Element or Document"),!1):(this._editorDocument=e.ownerDocument,null!=this._editorDocument||(this.error("invalid editor: unable to determine the owner document. An Child of Document element is required."),!1))}}class ne{constructor(e,t,n){Object.defineProperty(this,"_ranges",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_selectFor",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"badges",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.badges=[],this.createBadgesFromRanges(e)}removeBadges(){for(let e=0;e<this.badges.length;e++){const t=this.badges[e].badge;t.parentNode&&t.parentNode.removeChild(t)}}getBadge(e){return this.badges[e]}get selectFor(){return this._selectFor}get length(){return this.badges.length}createBadgesFromRanges(e){var t;for(let n=0;n<this._ranges.length;n++){const i=this._ranges[n],o=i.nativeRange.getClientRects();if(o&&1===o.length){const r=this.createBadge(n,o[0],(null===(t=e.scrollingElement)||void 0===t?void 0:t.scrollTop)||0);e.body.append(r),this.badges.push({badge:r,range:i})}}}createBadge(e,t,n){const i=document.createElement("div");return i.innerHTML=(e+1).toString(),i.contentEditable="false",i.style.position="absolute",i.style.top=t.top-18+n+"px",i.style.left=t.left-9+"px",i.style.width="24px",i.style.lineHeight="1.4",i.style.textAlign="center",i.style.backgroundColor="#313e48",i.style.color="#ffffff",i}}class ie extends te{validateDependencies(){if("undefined"==typeof CKEDITOR)throw"CKEditor Lib not found. Please add references to your project"}get editorType(){return v.CKEDITOR4}customLineBreakFunction(){const e=this.findInstance();e&&e.execCommand("enter")}customSelectProcessor(e){if(null==this._editorDocument)return this.error("missing editor document. Make sure to provide a non null Document type"),!1;const t=this._augnitoRange.createRange(this._editorDocument);if(t.selectNodeContents(this._editorDocument.body),""!==e.searchText){const n=e.searchText||"",i={caseSensitive:!1,wholeWordsOnly:!1},o=[];for(;t.findText(n,i);)o.push(t.cloneRange()),t.collapse(!1);return o.length>1?this._dynamicSelect=new ne(this._editorDocument,o,e.selectFor):1===o.length&&(this.setSelectionRange(this._editorDocument,o[0]),e.selectFor&&(this.processSelectForAction(e.selectFor,this._editorDocument),this.deSelectSelection(this._editorDocument))),!0}return!1}customCommandProcessor(e){let t=!1;const n=this.getEditor();return n&&("bulletliststart"!=e||this.CKEditorPanelButtonEnable("bulletedlist")?"numberliststart"!=e||this.CKEditorPanelButtonEnable("numberedlist")?"bulletliststop"==e&&this.CKEditorPanelButtonEnable("bulletedlist")?(n.commands.bulletedlist.exec(),t=!0):"numberliststop"==e&&this.CKEditorPanelButtonEnable("numberedlist")&&(n.commands.numberedlist.exec(),t=!0):(n.commands.numberedlist.exec(),t=!0):(n.commands.bulletedlist.exec(),t=!0)),t}getEditor(){return this.findInstance()}findInstance(){var e;const t=CKEDITOR;let n=null;if(t)for(const i in t.instances)if(Object.prototype.hasOwnProperty.call(t.instances,i)){const o=t.instances[i];((null===(e=U.anchoredEditor)||void 0===e?void 0:e.anchoredElement)&&o.name===U.anchoredEditor.elementName||o.focusManager.hasFocus)&&(n=o)}return n}CKEditorPanelButtonEnable(e){const t="cke_button__"+e;let n=!1;const i=document.querySelector("."+t);if(i)for(let e=0;e<(null==i?void 0:i.classList.length);e++)"cke_button_on"===i.classList[e]&&(n=!0);return n}}class oe extends te{validateDependencies(){}get editorType(){return v.CKEDITOR5}customLineBreakFunction(){const e=this.findInstance();if(e){var t=e.commands.get("enter");null==t||t.execute()}}customTextWriteFunction(e){const t=this.findInstance();if(t){0==e.indexOf(" ")&&(e=e.replace(" ","&nbsp;"));var n=t.data.processor.toView(e),i=t.data.toModel(n);t.model.insertContent(i,t.model.document.selection)}}customSelectProcessor(e){if(null==this._editorDocument)return this.error("missing editor document. Make sure to provide a non null Document type"),!1;const t=this._augnitoRange.createRange(this._editorDocument);if(t.selectNodeContents(this._editorDocument.body),""!==e.searchText){const n=e.searchText||"",i={caseSensitive:!1,wholeWordsOnly:!1},o=[];for(;t.findText(n,i);)o.push(t.cloneRange()),t.collapse(!1);if(o.length>1)this._dynamicSelect=new ne(this._editorDocument,o,e.selectFor);else if(1===o.length){this.setSelectionRange(this._editorDocument,o[0]),e.selectFor&&(this.processSelectForAction(e.selectFor,this._editorDocument),this.deSelectSelection(this._editorDocument));const t=this._augnitoRange.getSelection(this._editorDocument);this.scrollElementToView(t)}return!0}return!1}customCommandProcessor(e){let t=!1;const n=this.getEditor();if(n)if("bulletliststart"!=e||this.CKEditorPanelButtonEnable("Bulleted List"))if("numberliststart"!=e||this.CKEditorPanelButtonEnable("Numbered List")){if("bulletliststop"==e&&this.CKEditorPanelButtonEnable("Bulleted List")){var i;null==(i=n.commands.get("bulletedList"))||i.execute(),t=!0}else if("numberliststop"==e&&this.CKEditorPanelButtonEnable("Numbered List")){null==(o=n.commands.get("numberedList"))||o.execute(),t=!0}}else{var o;null==(o=n.commands.get("numberedList"))||o.execute(),t=!0}else null==(i=n.commands.get("bulletedList"))||i.execute(),t=!0;return t}customActionProcessor(e){let t=!1;const n=this.getEditor();if(n)if("bold"===(null==e?void 0:e.toLowerCase())||r.BOLD_IT===(null==e?void 0:e.toLowerCase()))null==(o=n.commands.get("bold"))||o.execute(),t=!0;else if("italicize"===(null==e?void 0:e.toLowerCase())||r.ITALICIZE_IT===(null==e?void 0:e.toLowerCase())){null==(o=n.commands.get("italic"))||o.execute(),t=!0}else if("underline"===(null==e?void 0:e.toLowerCase())||r.UNDERLINE_IT===(null==e?void 0:e.toLowerCase())){null==(o=n.commands.get("underline"))||o.execute(),t=!0}else if("capitalize"===(null==e?void 0:e.toLowerCase())||r.CAPITALIZED_IT===(null==e?void 0:e.toLowerCase()));else if(r.DELETE===(null==e?void 0:e.toLowerCase())||"deleteit"===(null==e?void 0:e.toLowerCase())||r.PRESS_DELETE===(null==e?void 0:e.toLowerCase())){var i=n.commands.get("delete");null==i||i.execute(),t=!0}else if(r.SELECT_ALL===(null==e?void 0:e.toLowerCase())){var o;null==(o=n.commands.get("selectAll"))||o.execute(),t=!0}return t}getEditor(){return this.findInstance()}getActiveEditorElement(){let e=U.getActiveEditorElement();if(e){const t=te.findActiveEditor(e);t&&(e=t)}return e}findInstance(){let e=null;var t=this.getActiveEditorElement();t&&t.classList.contains("ck-editor__editable")&&(e=Object.getOwnPropertyDescriptors(t).ckeditorInstance.value);return e}CKEditorPanelButtonEnable(e){const t='[data-cke-tooltip-text="'+e+'"]';let n=!1;const i=document.querySelector(t);if(i)for(let e=0;e<(null==i?void 0:i.classList.length);e++)"ck-on"===i.classList[e]&&(n=!0);return n}}class re extends G{constructor(e){super(e,"DevExpressRichEditProcessor"),Object.defineProperty(this,"searchWordList",{enumerable:!0,configurable:!0,writable:!0,value:[]})}get editorType(){return v.DEVEXPRESS}processFinalResult(e,t){var n,i=t;i.beginUpdate(),i.history.beginTransaction(),this.searchWordList=[],y(i);var o=i.selection.activeSubDocument,r=i.selection.intervals[0],a=this.GetLastCharacter(i),s=V.ProcessText(e.receivedText,a,o.length,r);e.receivedText=s.ReceivedText,r.length>0&&(i._native.core.commandManager.getCommand(125).execute(!1),r.length=0,i.selection.setSelection(r));var l=null===(n=e.receivedText)||void 0===n?void 0:n.split("\n");if(l&&l.length>0)for(var c=0;c<l.length;c++){""!=l[c]&&("."==l[c].trim()||":"==l[c].trim()?i._native.core.commandManager.getCommand(117).execute(!1,l[c].trim()):i._native.core.commandManager.getCommand(117).execute(!1,l[c])),l.length>1&&!(c==l.length-2&&""==l[l.length-1]||c==l.length-1&&""!=l[c])&&i._native.core.commandManager.getCommand(116).execute(!1)}this.ApplyPostBeautification(e,s.EndLine,i),i.history.endTransaction(),i.endUpdate()}processCommand(e,t){var n,i,o,a,s,l,c,u,d,h=t.selection.anchor,g=t.selection.intervals,f=t.document.subDocuments._core.commandManager,p=g[0],m=NaN,v=this.searchWordList;if(this.searchWordList=[],null!=e.searchText&&(m=parseInt(e.searchText.trim())),y(t),e.action===r.SPACE_ADD)t._native.core.commandManager.getCommand(117).execute(!1," "),p.start=h+1,p.length=0,t.selection.setSelection(p);else if(r.SELECT==(null===(n=e.name)||void 0===n?void 0:n.toLowerCase())&&"all"==(null===(i=e.searchText)||void 0===i?void 0:i.toLowerCase())&&"delete"==(null===(o=e.selectFor)||void 0===o?void 0:o.toLowerCase()))t._native.core.commandManager.getCommand(106).execute(!1,void 0),t._native.core.commandManager.getCommand(126).execute(!1);else if(r.SELECT==(null===(a=e.name)||void 0===a?void 0:a.toLowerCase())&&""==e.action||!isNaN(m))if(!isNaN(m)&&null!=v&&v.length>0){var b=v.filter((t=>{var n;return t.HighlightButton.innerHTML==(null===(n=e.searchText)||void 0===n?void 0:n.trim())}));b.length>0&&t.selection.setSelection(b[0].WordInterval)}else this.searchWordList=function(e,t){var n,i=N(e,t,"");if(1==i.length)return y(t),void t.selection.setSelection(i[0]);i=i.sort((function(e,t){return e.start-t.start}));var o=document.querySelectorAll(".dxreSelSearch"),r=[];if(o.length>0)for(var a=0;a<o.length;a++){var s=o[a],l=document.createElement("button");l.innerHTML=a+1,l.style.position="absolute",l.style.zIndex=9e3,l.style.left=(s.offsetLeft+s.offsetWidth/2-12.5).toString()+"px",l.style.top=(s.offsetTop-21).toString()+"px",l.style.width=25..toString()+"px",l.style.height=21..toString()+"px",l.style.backgroundColor="teal",l.style.color="white",l.className="searchIndex",l.disabled=!0,null===(n=document.querySelector(".dxreControl"))||void 0===n||n.querySelectorAll(".dxrePageService")[0].appendChild(l),r.push({HighlightButton:l,WordInterval:i[a]})}return r}(e,t);else if(e.action==r.SELECT)!function(e,t){var n;e.searchText||(e.searchText="");var i=e.searchText.replace(/ /gi,"").toLowerCase().trim(),o=e.nextPrevious,r=e.chooseNumber&&e.chooseNumber>0?e.chooseNumber:1;if("nextword"==i||"next"==o)return _(e.name,r,t)&&e.selectFor&&A(e.selectFor,t),!0;if("previousword"==i||"it"==i||"that"==i||"previous"==o||"last"==o){var a=L(null!==(n=e.name)&&void 0!==n?n:"",r,t);return a&&e.selectFor&&("delete"==e.selectFor.toLowerCase()&&a[0].start>0&&(a=O(a,t),t.selection.setSelection(a[0])),A(e.selectFor,t)),!0}}(e,t),e.selectFor&&((p=t.selection.intervals[0]).start=p.start+p.length,p.length=0,t.selection.setSelection(p));else if(e.action&&e.action.toLowerCase().indexOf("dynamic")>=0)R(e,t);else if("bulletliststart"==(null===(s=e.action)||void 0===s?void 0:s.toLowerCase())||"bulletliststop"==(null===(l=e.action)||void 0===l?void 0:l.toLowerCase()))j("togglebulletedlistitem",t);else if("deselectit"==(null===(c=e.action)||void 0===c?void 0:c.toLowerCase())){(p=t.selection.intervals[0]).start=p.start+p.length,"\r"==t.selection.activeSubDocument.getText().substr(p.start-1,1)&&(p.start=p.start-1),p.length=0,t.selection.setSelection(p)}else{if(A(null!==(u=e.action)&&void 0!==u?u:"",t))return;if(e.action){var E=T[null===(d=e.action)||void 0===d?void 0:d.toLowerCase().trim()];if(null!=E&&null!=E)f.getCommand(E).execute(!1,void 0)}}}GetLastCharacter(e){for(var t=[],n=0,i=e.selection,o=i.intervals[0].start,r=o-4,a=o,s=i.activeSubDocument.getText().length,l=r;l<a;l++)t[n]=l<0||l>=s?null:i.activeSubDocument.getText().substr(l,1),n++;return t}ApplyPostBeautification(e,t,n){var i,o,r,a,s=n.selection,l=n.selection.intervals,c=s.activeSubDocument.getText().length,u=l[0].start;if(!(u>=c)){var d,h,g=(null===(i=e.name)||void 0===i?void 0:i.endsWith("."))||(null===(o=e.receivedText)||void 0===o?void 0:o.endsWith(".")),f=(null===(r=e.name)||void 0===r?void 0:r.endsWith("\n"))||(null===(a=e.receivedText)||void 0===a?void 0:a.endsWith("\n")),p=g||f,m=l[0];if(u<c){var v=m.start;if(m.start=u,m.length=1,n.selection.setSelection(m),d=l){var b=n.selection.activeSubDocument.getText(),E=b.substr(d[0].start,d[0].length),S="";if(d[0].start+1<c&&(S=n.selection.activeSubDocument.getText(d[0])),E&&E.trim().length>0||"\r"==S||"\v"==S){t&&(E=E.toLowerCase()),p&&(E=E.toUpperCase()),"\r"!=S&&"\v"!=S||(m.start=m.start+1,E=(E=b.substr(d[0].start,d[0].length)).toUpperCase(),n.selection.setSelection(m)),"\r"!=E&&n._native.core.commandManager.getCommand(125).execute(!1);var C=(f||"\r"==S||"\v"==S||[",",".",":"].includes(S)?"":" ")+E,T=s.anchor;n.selection.setSelection(T),n._native.core.commandManager.getCommand(117).execute(!1,C),m.start=T+C.length+1,m.length=1;var R=n.document.getCharacterProperties(m);return m.start=T,m.length=C.length,n.document.setCharacterProperties(m,R),"\r"!=S&&"\v"!=S||(m.start=m.start-1,m.length=0,n.selection.setSelection(m)),m.start=v,m.length=0,void n.selection.setSelection(m)}m.start=d[0].start,m.length=0,n.selection.setSelection(m)}}if(u+1<c&&(m.start=u+1,m.length=1,n.selection.setSelection(m),h=l)){var y=n.selection.activeSubDocument.getText().substr(h[0].start,h[0].length);if(y&&y.trim().length>0){if(y.length>1)return;t&&(y=y.toLowerCase());S=n.selection.activeSubDocument.getText(h[0]);(p||"\v"==S)&&(y=y.toUpperCase()),n._native.core.commandManager.getCommand(125).execute(!1);T=s.anchor;n.selection.setSelection(T),n._native.core.commandManager.getCommand(117).execute(!1,y),m.start=T+y.length+1,m.length=1;R=n.document.getCharacterProperties(m);if(m.start=T,m.length=y.length,n.document.setCharacterProperties(m,R),m.start=h[0].start-1,m.length=0,s.setSelection(m),f&&u<c&&(m.start=u,m.length=1,n.selection.setSelection(m),d=l)){var N=s.activeSubDocument.getText().substr(d[0].start,d[0].length);N&&0==N.trim().length&&"\r"!=N&&n._native.core.commandManager.getCommand(125).execute(!1)}return m.start=h[0].start,m.length=0,void n.selection.setSelection(m)}m.start=h[0].start-1,m.length=0,n.selection.setSelection(m)}}}}class ae extends te{constructor(){super(...arguments),Object.defineProperty(this,"insertTextAtCursorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}validateDependencies(){}get editorType(){return v.GENERIC}customSelectProcessor(e){if(null==this._editorDocument)return this.error("missing editor document. Make sure to provide a non null Document type"),!1;const t=this._augnitoRange.createRange(this._editorDocument);if(t.selectNodeContents(this._editorDocument.body),""!==e.searchText){const n=e.searchText||"",i={caseSensitive:!1,wholeWordsOnly:!1},o=[];for(;t.findText(n,i);)o.push(t.cloneRange()),t.collapse(!1);return o.length>1?this._dynamicSelect=new ne(this._editorDocument,o,e.selectFor):1===o.length&&(this.setSelectionRange(this._editorDocument,o[0]),e.selectFor&&(this.processSelectForAction(e.selectFor,this._editorDocument),this.deSelectSelection(this._editorDocument))),!0}return!1}customCommandProcessor(e){return!1}}class se extends G{constructor(e){super(e,"HTMLInteropProcessor"),Object.defineProperty(this,"_buffer",{enumerable:!0,configurable:!0,writable:!0,value:""}),Object.defineProperty(this,"stringWriteAtCaret",{enumerable:!0,configurable:!0,writable:!0,value:(e,t,n,i)=>{const o=e.substring(0,n);let r=e.substring(n);r.length>0&&t[0]===t[0].toUpperCase()&&!t.endsWith(". ")&&!t.endsWith(".")&&r[0]===r[0].toUpperCase()&&(r=r[0].toLowerCase()+r.substring(1)),e=o+t+r,i.value=e;const a=o.length+t.length;this.setCaretPosition(a,i),this.fireEvents(i)}})}get buffer(){return this._buffer}get editorType(){return v.HTML}processFinalResult(e,t){t.focus();const n=V.beautify(e.receivedText||"");this.isTextSelected(t)&&this.deleteSelected(t);const i=this.getCaretPosition(t),o=this.beautify(n,i,t.value);this.stringWriteAtCaret(t.value,o,i,t)}processCommand(e,t){t.focus();const n=this.getCaretPosition(t),i=t.value;let o=!1;if(e.action===r.PRESS_DELETE)this.isTextSelected(t)||(e.name=r.SELECT_WORD,this.selectWordLineSentence(e,i,n,t)),this.deleteSelected(t),o=!0;else if(e.name===r.SELECT_WORD)this.selectWordLineSentence(e,i,n,t),e.selectFor===r.DELETE&&this.deleteSelected(t),o=!0;else if(e.name===r.SELECT_LINE)this.selectWordLineSentence(e,i,n,t),e.selectFor===r.DELETE&&this.deleteSelected(t),o=!0;else if(e.action===r.SELECT_ALL)t.setSelectionRange(0,t.value.length),o=!0;else if(e.name===r.SELECT_SENTENCE)this.selectWordLineSentence(e,i,n,t),e.selectFor===r.DELETE&&this.deleteSelected(t),o=!0;else if(e.action===r.GO_TO_LINE_START)this.setCaretPosition(this.getStartOfLine(i,n),t),o=!0;else if(e.action===r.GO_TO_DOCUMENT_START)this.setCaretPosition(0,t),o=!0;else if(e.action===r.GO_TO_DOCUMENT_END)this.setCaretPosition(i.length,t),o=!0;else if(e.action===r.GO_TO_LINE_END){const e=this.getEndOfLine(i,n);this.setCaretPosition(e,t),o=!0}else e.action===r.COPY_IT?(this.copySelected(t),o=!0):e.action===r.UNDO_IT?(this.undo(),this.setCaretPosition(t.selectionEnd||t.value.length,t),o=!0):e.action===r.REDO_IT?(this.redo(),o=!0):e.action===r.DOCUMENT_PRINT?(this.print(),o=!0):e.action===r.SPACE_ADD?(this.stringWriteAtCaret(i," ",n,t),o=!0):e.action===r.NEXT_FIELD?this.searchDynamicFiled("forward",i,t):e.action===r.PREVIOUS_FIELD?this.searchDynamicFiled("backward",i,t):this.log("Command NOT Processed");return o}selectWordLineSentence(e,t,n,i){let o=i.value.length,a=e.nextPrevious;a||(a="previous");let s=e.chooseNumber&&e.chooseNumber>0?e.chooseNumber:1;const l=t.length===n;if("next"===a)n=Math.max(n,i.selectionEnd||i.value.length);else if("previous"===a||"last"===a){const e=this.getCaretPosition(i);n=Math.min(n,e-1)}let c=n;const u=this.getDelimiterArray(e);if("next"===a){const e=!0;for(;e;){if(n>t.length){n=t.length;break}if(t[n]===u[0])n++;else{if(!(u.length>1&&t[n]===u[1]))break;n++}}c=n,o=n;let i=!1;for(let e=n;e-1>=0&&!1===i;e--)for(const n of u)if(t[e-1]===n){c=e,i=!0;break}i||(c=0);for(let e=n;e<t.length&&s>0;e++,o++)for(const n of u)t[e]===n&&s--;s>0&&(o=t.length)}else if("previous"===a||"last"===a){const i=!0;for(;i;){if(n<0){n=0;break}if(t[n]===u[0])n--;else{if(!(u.length>1&&t[n]===u[1]))break;n--}}c=n,o=n;let a=!1;for(let e=n;e<t.length&&!1===a;e++)for(const n of u)if(t[e]===n){o=e+1,a=!0;break}a||(o=t.length);for(let e=n;e>=0&&s>0;e--,c--){for(const n of u)t[e]===n&&s--;if(0===s){c=e+1;break}}s>0&&(c=0),c>0&&"delete"===e.selectFor&&d.setSelectObjectType(e.searchText||"")===r.SELECT_WORD&&l&&c--}i.setSelectionRange(c,o)}getDelimiterArray(e){let t=[];return e.name===r.SELECT_WORD||e.name===r.SELECT_ACTIVE_WORD?t=[" ","\n"]:e.name===r.SELECT_LINE||e.name===r.SELECT_ACTIVE_LINE?t=["\n"]:e.name!==r.SELECT_SENTENCE&&e.name!==r.SELECT_ACTIVE_SENTENCE||(t=["."]),t}isTextSelected(e){return e.selectionStart!==e.selectionEnd}deleteSelected(e){const t=this.getCaretPosition(e);document.execCommand("delete",!1,void 0),this.setCaretPosition(t,e)}getSelectedText(e){const t=e.value,n=e.selectionStart,i=e.selectionEnd;return n&&i?t.substring(n,i):""}copySelected(e){this._buffer=this.getSelectedText(e),document.execCommand("copy")}undo(){document.execCommand("undo")}redo(){document.execCommand("redo")}print(){window.print()}getStartOfLine(e,t){for(let n=t;n>=0;n--)if(n===t&&"\n"===e[n]&&n--,"\n"===e[n])return n+1;return 0}getEndOfLine(e,t){for(let n=t;n<e.length;n++)if("\n"===e[n])return n;return e.length}beautify(e,t,n){let i=e;if(""===n&&(i=this.trimLeft(i),i=i[0].toUpperCase()+i.substring(1))," \n"!==i&&" \n\n"!==i||(i=this.trimLeft(i)),n.length>1&&(" "===n[t-1]&&"."===n[t-2]||0===t)&&(i=this.trimLeft(i),i=i[0].toUpperCase()+i.substring(1)),n.length>0&&" "===n[t-1]&&(i=this.trimLeft(i)),n.length>0&&"\n"===n[t-1]&&(i=this.trimLeft(i),i=i[0].toUpperCase()+i.substring(1)),n.length>0&&("."===n[t-1]||":"===n[t-1]||"#"===n[t-1])){const e=this.trimLeft(i);e.length>0&&(i=" "+e[0].toUpperCase()),e.length>1&&(i+=e.substring(1))}"."!==i.trim()&&":"!==i.trim()||(i=this.trimLeft(i));var o=i.trim();return o.length>0&&("."===o[0]||":"===o[0])&&(i=this.trimLeft(i)),i}trimLeft(e){return e=(e=(e=e.replace(/\n/gi,"@newline@")).trimStart()).replace(new RegExp("@newline@","gi"),"\n")}setCaretPosition(e,t){t.setSelectionRange(e,e)}fireEvents(e){const t=new KeyboardEvent("keyup",{bubbles:!0,cancelable:!0,keyCode:13});e.dispatchEvent(t);const n=new Event("input",{bubbles:!0,cancelable:!0});e.dispatchEvent(n)}getCaretPosition(e){return null===e.selectionStart?e.value?e.value.length:0:e.selectionStart}searchDynamicFiled(e,t,n){if(null!==n.selectionStart&&null!==n.selectionEnd)switch(e){case"forward":this.searchDynamicFieldForward(n.selectionEnd,t,n);break;case"backward":this.searchDynamicFieldBackward(n.selectionStart,t,n)}}searchDynamicFieldForward(e,t,n){const i=/\[(.*?)\]/gi;let o;const r=t.substring(e);null!==(o=i.exec(r))&&n.setSelectionRange(o.index+e,i.lastIndex+e)}searchDynamicFieldBackward(e,t,n){const i=/\[(.*?)\]/gi;let o;const r=t.substring(0,e);let a=-1,s=-1;for(;null!==(o=i.exec(r));)a=o.index,s=i.lastIndex;-1!==a&&-1!==s&&n.setSelectionRange(a,s)}}class le{static createProcessor(e,t){switch(e){case v.HTML:return new se(t);case v.CKEDITOR4:return new ie(t);case v.CKEDITOR5:return new oe(t);case v.DEVEXPRESS:return new re(t);case v.GENERIC:return new ae(t);default:throw new TypeError(`Processor for editor ${e} not implemented`)}}}class ce{constructor(e,t,n){Object.defineProperty(this,"_listOfControls",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enableLogs",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_editorType",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_interopProcessors",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"ProcessorHandler"}),n&&this.getProcessor(n)}getProcessorForEditor(e){if(this._editorType==v.DEVEXPRESS)return this.getProcessor(this._editorType);if(e.id){const t=this._listOfControls.find((t=>t.controlId==e.id));if(this._listOfControls.length>0&&t&&t.type)return this.getProcessor(t.type)}if(this.isHtmlEditor(e))return this.getProcessor(v.HTML);if(this.isContentEditable(e)&&this._editorType)return this.getProcessor(this._editorType);throw new Error("Editor not implemented: Unknown contentEditable")}getValidEditor(){const e=this.getActiveEditorElement();return e?this._editorType===v.DEVEXPRESS||this.isValidEditor(e)?e:(a.log("unable to validate the provided editor. Has focus ? Is it on the list of control ? has and id set ?",this._logTag),null):(a.log("unable to find a focused editor",this._logTag),null)}getActiveEditorElement(){if(this._listOfControls&&this._listOfControls.length>0&&this._listOfControls[0].editorInstance)return this._listOfControls[0].editorInstance;let e=U.getActiveEditorElement();if(e){const t=te.findActiveEditor(e);t&&(e=t)}return e}isValidEditor(e){if(this._listOfControls.length>0&&e.id){const t=e.id;return void 0!==this._listOfControls.find((e=>e.controlId===t))}return!!this.isHtmlEditor(e)||!(!this.isContentEditable(e)||!this._editorType)}getProcessor(e){let t=this._interopProcessors.find((t=>t.editorType===e));return t||(t=le.createProcessor(e,this._enableLogs),this._interopProcessors.push(t),t)}isHtmlEditor(e){return"TEXTAREA"===e.nodeName||"INPUT"===e.nodeName}isContentEditable(e){return e.isContentEditable}}class ue{constructor(e,t,n){Object.defineProperty(this,"_listOfControls",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_editor",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"processorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.processorHandler=new ce(e,t,n)}onFinalResult(e){const t=this.processorHandler.getValidEditor();if(t){this.processorHandler.getProcessorForEditor(t).processFinalResult(e,t)}}onCommandResult(e){const t=this.processorHandler.getValidEditor();if(t){if(this.interfaceSharedCommand(e,t))return;this.processorHandler.getProcessorForEditor(t).processCommand(e,t)}}onSetAnchoredEditor(e,t){U.setAnchoredElement(e,t)}handleDynamicFieldNavigation(e){if(this._editor==v.DEVEXPRESS){const t=this.processorHandler.getValidEditor();R(e,t)}}handleGotoDocumentEnd(){const e=this.processorHandler.getValidEditor();var t;j("gotodocumentend",t=e),t.focus()}getCursorPosition(){return this.processorHandler.getValidEditor().selection.intervals[0].start}setCursorAtPosition(e){const t=this.processorHandler.getValidEditor();t.selection.setSelection(e),t.focus()}interfaceSharedCommand(e,t){if(e.name!==r.GOTO)return!1;if(e.searchText){const n=e.searchText.replace(/\s+/g,"");if("nextfield"===n||"nextfields"===n)U.moveToNextField(t,this._listOfControls);else if("previousfield"===n||"previousfields"===n)U.moveToPreviousField(t,this._listOfControls);else{const e=e=>e.controlName===n,t=this._listOfControls.findIndex(e);if(t>-1){const e=this._listOfControls[t];e&&document.querySelector("#"+e.controlId).focus()}}}return!0}}class de{constructor(e,t){Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_webClient",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"onMicrophoneOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}get clientConfig(){return this._config}get enableLogs(){return this._config.enableLogs}setEnableLogs(e){this._config.enableLogs=e}get deviceId(){return this._webClient.getConfig().clientConfig.deviceId}get userTag(){return this._webClient.getConfig().clientConfig.userTag}startListening(e){this._webClient.startListening(this.prepareSpeechMicURL(e),n.MOBILE_APP)}stopListening(){this._webClient&&this._webClient.stopListening(!1)}prepareNotificationURL(){const e=this._webClient.getConfig();let t=e.pushNotificationURL;return t+=`?devicecode=${e.clientConfig.deviceId}`,t+=`&currentTabId=${E()}`,t+=`&accountcode=${e.clientConfig.accountCode}`,t+=`&accesskey=${e.clientConfig.accessKey}`,t=t.replace(new RegExp("amp;","gi"),""),t}prepareSpeechMicURL(e){const t=this._webClient.getConfig();let n=this._webClient.getConfig().speechMicURL;return n+=`?accountcode=${t.clientConfig.accountCode}`,n+=`&usertag=${t.clientConfig.userTag}`,n+=`&seqid=${e.SeqId}`,n+=`&mobiledevicecode=${e.FromDeviceId}`,n+=`&clientdevicecode=${t.clientConfig.deviceId}`,n=n.replace(new RegExp("amp;","gi"),""),n}}class he{constructor(e){Object.defineProperty(this,"_mobileClient",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"onConnectionRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onMobileScan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),e.onConnectionRequest=this.onConnectionRequestCallback.bind(this),e.onMobileScan=this.onMobileScanCallback.bind(this)}dispose(){this._mobileClient.dispose()}stopMobileMicConnection(){this._mobileClient.stopMobileListening()}onConnectionRequestCallback(){this.onConnectionRequest&&this.onConnectionRequest()}onMobileScanCallback(){this.onMobileScan&&this.onMobileScan()}}function ge(e,t,n,i){return new(n||(n=Promise))((function(o,r){function a(e){try{l(i.next(e))}catch(e){r(e)}}function s(e){try{l(i.throw(e))}catch(e){r(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;class fe{makePostRequest(e,t){return ge(this,void 0,void 0,(function*(){try{const n=yield fetch(t,{method:"POST",headers:{accept:"*/*","Content-Type":"application/json"},body:JSON.stringify(e)}),i=yield n.json();return[200,0].includes(i.Status)?i:i.ErrorMessage}catch(e){return e instanceof Error?e.message:"Unknown Error"}}))}}class pe extends fe{constructor(e,t,n){super(),Object.defineProperty(this,"_accountCode",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_accessKey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),g.Against.NullOrEmpty(e,"AccountCode"),g.Against.NullOrEmpty(t,"AccessKey"),g.Against.NullOrEmpty(n,"Server"),this._baseUrl=`https://${n}/manage/v2/macro`}getMacros(e){return ge(this,void 0,void 0,(function*(){return yield this.makePostRequest(Object.assign(Object.assign({},e),this.getAccountModel()),this.getURL("/fetchall"))}))}upsertMacro(e){return ge(this,void 0,void 0,(function*(){return this.makePostRequest(Object.assign(Object.assign({},e),this.getAccountModel()),this.getURL("/modify"))}))}deleteMacro(e){return ge(this,void 0,void 0,(function*(){return this.makePostRequest(Object.assign(Object.assign({},e),this.getAccountModel()),this.getURL("/delete"))}))}getURL(e){return`${this._baseUrl}${e}`}getAccountModel(){return{AccountCode:this._accountCode,AccessKey:this._accessKey}}}function me(){me=function(){return t};var e,t={},n=Object.prototype,i=n.hasOwnProperty,o=Object.defineProperty||function(e,t,n){e[t]=n.value},r="function"==typeof Symbol?Symbol:{},a=r.iterator||"@@iterator",s=r.asyncIterator||"@@asyncIterator",l=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof v?t:v,a=Object.create(r.prototype),s=new L(i||[]);return o(a,"_invoke",{value:O(e,n,s)}),a}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=u;var h="suspendedStart",g="suspendedYield",f="executing",p="completed",m={};function v(){}function b(){}function E(){}var S={};c(S,a,(function(){return this}));var C=Object.getPrototypeOf,T=C&&C(C(I([])));T&&T!==n&&i.call(T,a)&&(S=T);var R=E.prototype=v.prototype=Object.create(S);function y(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(o,r,a,s){var l=d(e[o],e,r);if("throw"!==l.type){var c=l.arg,u=c.value;return u&&"object"==typeof u&&i.call(u,"__await")?t.resolve(u.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(u).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(l.arg)}var r;o(this,"_invoke",{value:function(e,i){function o(){return new t((function(t,o){n(e,i,t,o)}))}return r=r?r.then(o,o):o()}})}function O(t,n,i){var o=h;return function(r,a){if(o===f)throw Error("Generator is already running");if(o===p){if("throw"===r)throw a;return{value:e,done:!0}}for(i.method=r,i.arg=a;;){var s=i.delegate;if(s){var l=A(s,i);if(l){if(l===m)continue;return l}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if(o===h)throw o=p,i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);o=f;var c=d(t,n,i);if("normal"===c.type){if(o=i.done?p:g,c.arg===m)continue;return{value:c.arg,done:i.done}}"throw"===c.type&&(o=p,i.method="throw",i.arg=c.arg)}}}function A(t,n){var i=n.method,o=t.iterator[i];if(o===e)return n.delegate=null,"throw"===i&&t.iterator.return&&(n.method="return",n.arg=e,A(t,n),"throw"===n.method)||"return"!==i&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+i+"' method")),m;var r=d(o,t.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,m;var a=r.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function _(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function I(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,r=function n(){for(;++o<t.length;)if(i.call(t,o))return n.value=t[o],n.done=!1,n;return n.value=e,n.done=!0,n};return r.next=r}}throw new TypeError(typeof t+" is not iterable")}return b.prototype=E,o(R,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:b,configurable:!0}),b.displayName=c(E,l,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===b||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,c(e,l,"GeneratorFunction")),e.prototype=Object.create(R),e},t.awrap=function(e){return{__await:e}},y(N.prototype),c(N.prototype,s,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,i,o,r){void 0===r&&(r=Promise);var a=new N(u(e,n,i,o),r);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},y(R),c(R,l,"Generator"),c(R,a,(function(){return this})),c(R,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var i in t)n.push(i);return n.reverse(),function e(){for(;n.length;){var i=n.pop();if(i in t)return e.value=i,e.done=!1,e}return e.done=!0,e}},t.values=I,L.prototype={constructor:L,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(_),!t)for(var n in this)"t"===n.charAt(0)&&i.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function o(i,o){return s.type="throw",s.arg=t,n.next=i,o&&(n.method="next",n.arg=e),!!o}for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&i.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var r=o;break}}r&&("break"===e||"continue"===e)&&r.tryLoc<=t&&t<=r.finallyLoc&&(r=null);var a=r?r.completion:{};return a.type=e,a.arg=t,r?(this.method="next",this.next=r.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),_(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var o=i.arg;_(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,n,i){return this.delegate={iterator:I(t),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=e),m}},t}function ve(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function be(e,t,n,i,o,r,a){try{var s=e[r](a),l=s.value}catch(e){return void n(e)}s.done?t(l):Promise.resolve(l).then(i,o)}function Ee(e){return function(){var t=this,n=arguments;return new Promise((function(i,o){var r=e.apply(t,n);function a(e){be(r,i,o,a,s,"next",e)}function s(e){be(r,i,o,a,s,"throw",e)}a(void 0)}))}}function Se(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ce(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,ve(i.key),i)}}function Te(e,t,n){return t&&Ce(e.prototype,t),n&&Ce(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}var Re="DONE",ye="PAUSESOCKET",Ne="RESUMESOCKET",Oe="CLOSE",Ae=12e4,we=Te((function e(t,n,i,o,r,a,s,l,c,u,d,h){Se(this,e),this.worker,this.onFinalResultCallback=r,this.onErrorCallback=s,this.onPartialResultCallback=a,this.onSessionEventCallback=l,this.onOtherResultsCallback=c,this.onSpeechResponseCallback=u,this.packetSeqId=0,this.audioDuration=0,this.shouldSendAudioDataSequence=o,this.heavyOp,this.idleLoop,this.lastSent,this.enableLogs=t,this.eosMessage=n||"EOS",this.socketTimeoutInterval=i||1e4,this.bufferSizeInterval=d,this.switchToRegularSpeech=h}),[{key:"Start",value:function(e,t){var n=this;this.audioDuration=e;var i="\n (() => {\n (".concat(_e.toString(),")(").concat(JSON.stringify(Re),", ").concat(JSON.stringify(this.eosMessage),", ").concat(JSON.stringify(Oe),", ").concat(JSON.stringify(1e4),", ").concat(JSON.stringify(this.socketTimeoutInterval),", ").concat(JSON.stringify(1e3),", ").concat(JSON.stringify(100),", ").concat(JSON.stringify(t),", ").concat(JSON.stringify(this.enableLogs),", ").concat(JSON.stringify(this.shouldSendAudioDataSequence),",").concat(JSON.stringify(ye),", ").concat(JSON.stringify(Ne),", ").concat(JSON.stringify(this.switchToRegularSpeech),", ").concat(JSON.stringify(this.heavyOp),");\n })();\n");this.worker=new Worker(URL.createObjectURL(new Blob([i],{type:"application/javascript"}))),this.worker.onmessage=function(e){n.enableLogs&&console.log("Augnito [MAIN]: "+JSON.stringify(e.data));var t=e.data;"final"==t.type?n.onFinalResultCallback(t.data):"partial"==t.type?n.onPartialResultCallback(t.data):"meta"==t.type?n.onSessionEventCallback(t.data):"error"==t.type?n.onErrorCallback(t.data):"other"==t.type?n.onOtherResultsCallback(t.data):"speechResponse"==t.type&&n.onSpeechResponseCallback(t.data)},this.idleLoop=setInterval((function(){var e=+new Date;n.lastSent&&e-n.lastSent>Ae&&(n.Send(n.eosMessage),n.enableLogs&&console.warn("No data sent since more than ".concat(120," secs, closing time...")))}),1e4)}},{key:"createAudioPacketHeader",value:function(e){this.audioDuration>0&&(this.packetSeqId=Math.ceil(this.audioDuration/this.bufferSizeInterval)+2,this.audioDuration=0),this.packetSeqId++;for(var t=new ArrayBuffer(16),n=new DataView(t),i=0;i<4;i++)n.setUint8(i,"@BSR".charCodeAt(i));return n.setBigInt64(4,BigInt(this.packetSeqId),!1),n.setUint8(12,e?1:0),t}},{key:"appendAudioData",value:function(e,t){var n=e.byteLength+t.byteLength,i=new ArrayBuffer(n),o=new Uint8Array(i);return o.set(new Uint8Array(e),0),o.set(new Uint8Array(t),e.byteLength),i}},{key:"Send",value:function(e){var t;if(this.lastSent=+new Date,e===Oe)null===(t=this.worker)||void 0===t||t.postMessage(Oe),clearInterval(this.idleLoop);else if(e===Re){if(this.shouldSendAudioDataSequence){var n,i=this.createAudioPacketHeader(!0);null===(n=this.worker)||void 0===n||n.postMessage(i)}else{var o;null===(o=this.worker)||void 0===o||o.postMessage(Re)}clearInterval(this.idleLoop)}else if(e==ye){var r;null===(r=this.worker)||void 0===r||r.postMessage(ye)}else if(e==Ne){var a;null===(a=this.worker)||void 0===a||a.postMessage(Ne)}else if(e===this.eosMessage){var s;this.shouldSendAudioDataSequence||null===(s=this.worker)||void 0===s||s.postMessage(e)}else{var l,c=[];this.shouldSendAudioDataSequence?(i=this.createAudioPacketHeader(!1),c=this.appendAudioData(i,e)):c=e,void 0!==c&&(null===(l=this.worker)||void 0===l||l.postMessage(c,[c]))}}},{key:"HeavyOp",set:function(e){this.heavyOp=e}}]);function _e(e,t,n,i,o,r,a,s,l,c,u,d,h,g){var f,p,m,v,b,E,S,C,T=[],R=[],y=!1,N=!1,O=!1,A="",w=!1;function _(){f=+new Date,(E=""!=A?new WebSocket(s+"&jobid="+A):new WebSocket(s)).onopen=function(e){l&&console.log("Augnito: WebSocket connection established - "+JSON.stringify(e)),R.length>0&&(N=!0)},E.onmessage=function(e){l&&console.log("Augnito: Message from server - "+JSON.stringify(e.data)),m=+new Date,function(e){try{if("PING"===e.data)v=+new Date,self.postMessage({type:"ping",data:e.data});else{var t=JSON.parse(e.data);if(l&&console.log("Augnito [WORKER]: "+JSON.stringify(t)),"meta"==t.Type){t.JobID&&(A=t.JobID,console.log("Augnito JobID:",A)),self.postMessage({type:"meta",data:e.data});var n=JSON.parse(e.data);O=!(!n.Event||"INVALID_AUTH_CREDENTIALS"!==n.Event.Type)}else if(t.Result&&t.Result.Final){var i=JSON.stringify(t.Result);g&&(i=g(JSON.stringify(t.Result)),console.log(i)),self.postMessage({type:"final",data:i})}else t.Result&&!t.Result.Final?self.postMessage({type:"partial",data:t.Result.Transcript}):"ACK"==t.Type?(R=R.filter((function(e){return e.packetNumber>t.Index})),self.postMessage({type:"other",data:e.data})):"ERROR"==t.Type?("Timeout exceeded"==t.Data&&(y=!0,x()),self.postMessage({type:"error",data:e.data})):self.postMessage({type:"speechResponse",data:e.data})}}catch(e){self.postMessage({type:"error",data:"invalid response"})}}(e)},E.onerror=function(e){console.error("WebSocket error: ",e),self.postMessage({type:"error",data:JSON.stringify(e)})},E.onclose=function(e){l&&console.log("Augnito: WebSocket connection closed - "+JSON.stringify(e)),x()},p=+new Date,m=p,v=+new Date}function L(e){if(E&&E.readyState===WebSocket.OPEN){E.send(e);var n=+new Date;return p<=m&&(m=n-1),p=n,!0}return e===t?(l&&console.warn("Gulping ".concat(t," as socket seems already closed...")),x(),!0):(+new Date-f>i&&!O&&_(),!1)}function I(e){T.push(e)}function x(){y&&(clearInterval(S),clearInterval(C),T=[],R=[],self.close())}_(),S=setInterval((function(){if(N){for(var e=0;e<R.length;e++){if(!L(R[e].packetData))break}N=!1}else for(;T.length>0;){var t=T.shift();if(!L(t)){T.unshift(t);break}if(c){var n=new DataView(t),i={packetNumber:Number(n.getBigInt64(4)),packetData:t};R.push(i)}}}),a),C=setInterval((function(){if(E&&E.readyState===WebSocket.OPEN){var e=+new Date;(h?p>m&&e-m>o:e-v>o)&&(l&&console.error("No data received since more than ".concat(o/1e3," secs, closing time...")),E.close())}}),r),self.onmessage=function(i){i.data===n?(A="",y=!0,O=!0,E.close()):i.data===e?(I(t),A="",l&&console.log("Augnito: Worker received DONE, time to terminate..."),y=!0):i.data===u?w=!0:i.data===d?(I(b),w=!1,b=[]):w?b=i.data:I(i.data)}}var Le,Ie,xe,Pe,Me,De,ke,Be,Fe,je=Te((function e(t,n,i,o,r,a,s,l,c,u,d,h,g,f,p,m,v,b,E){Se(this,e),this.audioContext,this.audioStream,this.executor=new we(t,r,a,s,h,g,f,m,v,b,i,u),this.executor.HeavyOp=d,this.source,this.processorNode,this.isPaused=!1,this.isStreaming=!1,this.audioData=[],this.isDebug=n,this.enableLogs=t,this.onStateChanged=p,this.onIntensity=E,this.onError=f,this.bufferSizeInterval=i,this.pausedBufferInterval=null!=o?o:1,this.shouldReadIntensity=c,this.closeSocketWithoutEOS=!1,this.shouldPreIntialiseRecorder=null!=l&&l,this.shouldPreIntialiseRecorder&&this.EarlyInitialiseMediaStream()}),[{key:"EarlyInitialiseMediaStream",value:(Fe=Ee(me().mark((function e(){return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.createMediaStreamSourceNode();case 2:return e.next=4,this.createProcessorNode();case 4:this.source.connect(this.processorNode).connect(this.audioContext.destination);case 5:case"end":return e.stop()}}),e,this)}))),function(){return Fe.apply(this,arguments)})},{key:"StartStream",value:(Be=Ee(me().mark((function e(t,n){return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.log("New stream started..."),this.shouldPreIntialiseRecorder&&this.source){e.next=16;break}return e.next=4,this.createMediaStreamSourceNode();case 4:if(this.source){e.next=7;break}return console.error("Error: unable to create source node"),e.abrupt("return",!1);case 7:return e.next=9,this.createProcessorNode();case 9:if(this.processorNode){e.next=12;break}return console.error("Error: unable to create processor node"),e.abrupt("return",!1);case 12:this.source.connect(this.processorNode).connect(this.audioContext.destination),this.log("AudioContext Sample Rate: "+this.audioContext.sampleRate),e.next=19;break;case 16:if("suspended"!=this.audioContext.state){e.next=19;break}return e.next=19,this.audioContext.resume();case 19:if(!this.IsMicrophoneMuted){e.next=25;break}if(!this.audioContext||"running"!=this.audioContext.state){e.next=23;break}return e.next=23,this.audioContext.suspend();case 23:return this.onError(JSON.stringify({Type:"ERROR",Data:"Microphone is muted."})),e.abrupt("return",!1);case 25:return""!==n&&this.executor.Start(t,n),this.onStateChanged(!0),this.isStreaming=!0,e.abrupt("return",!0);case 29:case"end":return e.stop()}}),e,this)}))),function(e,t){return Be.apply(this,arguments)})},{key:"createBufferedSourceNode",value:(ke=Ee(me().mark((function e(){var t;return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.loadAudio();case 2:if(t=e.sent){e.next=6;break}return console.error("Error: unable to create audio buffer"),e.abrupt("return");case 6:this.source=this.audioContext.createBufferSource(),this.source.buffer=t,this.source.loop=!0,this.source.start();case 10:case"end":return e.stop()}}),e,this)}))),function(){return ke.apply(this,arguments)})},{key:"createMediaStreamSourceNode",value:(De=Ee(me().mark((function e(){var t,n=this;return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,navigator.mediaDevices.getUserMedia({audio:{channelCount:1,noiseSuppression:!1}});case 3:this.audioStream=e.sent,this.audioContext=new AudioContext,this.source=this.audioContext.createMediaStreamSource(this.audioStream),this.audioStream.getAudioTracks()[0].addEventListener("ended",(function(){n.onError(JSON.stringify({Type:"ERROR",Data:"Audio track ended. Possibly the mic was unplugged."}))})),e.next=14;break;case 9:e.prev=9,e.t0=e.catch(0),t="","NotAllowedError"==e.t0.name?t="Mic permission denied":"NotFoundError"===e.t0.name&&(t="No suitable media device found"),this.onError(JSON.stringify({Type:"ERROR",Data:t}));case 14:case"end":return e.stop()}}),e,this,[[0,9]])}))),function(){return De.apply(this,arguments)})},{key:"loadAudio",value:(Me=Ee(me().mark((function e(){var t,n,i;return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("./radiology_speed_test.wav");case 3:return t=e.sent,e.next=6,t.arrayBuffer();case 6:return n=e.sent,e.next=9,this.audioContext.decodeAudioData(n);case 9:return i=e.sent,e.abrupt("return",i);case 13:return e.prev=13,e.t0=e.catch(0),console.error("Unable to fetch the audio file. Error: ".concat(e.t0.message)),e.abrupt("return",null);case 17:case"end":return e.stop()}}),e,this,[[0,13]])}))),function(){return Me.apply(this,arguments)})},{key:"createProcessorNode",value:(Pe=Ee(me().mark((function e(){var t,n=this;return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.audioContext.audioWorklet.addModule("data:application/javascript,".concat(encodeURIComponent('class MyAudioWorkletProcessor extends AudioWorkletProcessor {\n constructor() {\n super();\n this.accumulator = [];\n this.pauseSocketStreaming = false;\n this.sampleVal = 0;\n this.sampleSize = 0;\n this.intensityFrameCount = 0;\n this.reset();\n this.isProcessing = true;\n // message received from main-thread\n this.port.onmessage = (e) => {\n console.log("Augnito: Worklet received event - ", e.data);\n if (this.sampleSize > 0) {\n this.accumulator.push(this.sampleVal / this.sampleSize);\n }\n \n if (e.data == "PAUSE" || e.data == "STOP" || e.data == "PAUSESOCKET") {\n // append silence to get last word ASR.\n const silenceSize = 16000 * 2;\n for (let i = 0; i < silenceSize; i++) {\n this.accumulator.push(0);\n }\n }\n this.send();\n this.reset();\n if (e.data == "STOP") {\n // message sent to main-thread\n this.port.postMessage({type:"DONE", value:"DONE"});\n this.isProcessing = false;\n \n }\n if(e.data == "PAUSESOCKET"){\n this.pauseSocketStreaming = true;\n this.port.postMessage("PAUSESOCKET");\n } else if(e.data == "RESUMESOCKET"){\n this.pauseSocketStreaming = false;\n } \n };\n }\n\n static get parameterDescriptors() {\n return [\n {\n name: "sampleRate",\n defaultValue: 16000,\n minValue: 16000,\n maxValue: 6 * 16000,\n },\n {\n name: "bufferSizeInterval",\n defaultValue: 1,\n minValue: 1,\n maxValue: 100,\n },\n {\n name: "pausedBufferInterval",\n defaultValue: 1,\n minValue: 0,\n maxValue: 100,\n },\n {\n name: "shouldReadIntensity",\n defaultValue: false,\n minValue: 0,\n maxValue: 1,\n },\n ];\n }\n\n // 128 frames\n process(inputList, outputList, params) {\n const input = inputList[0];\n if (input && input.length && input[0].length) {\n const channelData = input[0];\n const output = outputList[0];\n const inputSampleRate = params.sampleRate[0];\n const sampleRatio = inputSampleRate / 16000\n const bufferSizeInterval = params["bufferSizeInterval"][0];\n const pausedBufferInterval = params["pausedBufferInterval"][0];\n const shouldReadIntensity = params["shouldReadIntensity"][0];\n\n let sumSquares = 0; // For intensity\n let sampleCount = 0;\n\n // console.log("BufferSizeInterval", bufferSizeInterval);\n // Jackpot\n input[0].forEach((float32Element, index) => {\n const int16Element = Math.min(1, Math.max(-1, float32Element)) * 0x7fff;\n this.sampleVal += int16Element;\n this.sampleSize += 1;\n // Accumulate for intensity (RMS)\n sumSquares += float32Element * float32Element;\n sampleCount++;\n \n\n if (this.sampleSize >= sampleRatio) {\n const fraction = this.sampleSize - sampleRatio \n this.sampleVal -= fraction * int16Element;\n\n this.accumulator.push(this.sampleVal / sampleRatio);\n \n this.sampleVal = fraction * int16Element;\n this.sampleSize = fraction;\n }\n\n // Comment this when streaming microphone audio\n // output[0][index] = float32Element;\n });\n if(this.pauseSocketStreaming){\n if (this.accumulator.length >= 125 * 128 * pausedBufferInterval) {\n this.send();\n }\n } else{\n if (this.accumulator.length >= 125 * 128 * bufferSizeInterval) {\n this.send();\n }\n }\n if(shouldReadIntensity){\n \n // Throttled intensity post\n this.intensityFrameCount = (this.intensityFrameCount || 0) + 1;\n if (this.intensityFrameCount >= 15 && sampleCount > 0) {\n const rms = Math.sqrt(sumSquares / sampleCount);\n const normalized = Math.min(1, rms); // [0–1] scale\n this.port.postMessage({ type: \'intensity\', value: normalized });\n this.intensityFrameCount = 0;\n }\n }\n }\n return this.isProcessing;\n }\n\n send() {\n if (this.accumulator.length == 0) return;\n const audioData = new Int16Array(this.accumulator);\n // message sent to main-thread - transferrable\n this.port.postMessage({ type: \'audioData\', value: audioData.buffer }, [audioData.buffer]);\n this.accumulator = [];\n }\n\n reset() {\n this.sampleVal = 0;\n this.sampleSize = 0;\n }\n}\n\nregisterProcessor("worklet-processor", MyAudioWorkletProcessor);')));case 3:this.processorNode=new AudioWorkletNode(this.audioContext,"worklet-processor"),this.processorNode.parameters.get("sampleRate").setValueAtTime(this.audioContext.sampleRate,this.audioContext.currentTime),this.processorNode.parameters.get("bufferSizeInterval").setValueAtTime(this.bufferSizeInterval,this.audioContext.currentTime),this.processorNode.parameters.get("pausedBufferInterval").setValueAtTime(this.pausedBufferInterval,this.audioContext.currentTime),this.processorNode.parameters.get("shouldReadIntensity").setValueAtTime(null!==(t=this.shouldReadIntensity)&&void 0!==t&&t,this.audioContext.currentTime),this.processorNode.port.onmessage=function(e){var t=e.data,i=t.type,o=t.value;if(i==Re)n.log("Worklet processing done, clearing resources..."),n.isDebug&&n.saveAudio(),n.cleanup();else if(e.data==ye)n.executor.Send(ye);else{var r;"intensity"===i?null===(r=n.onIntensity)||void 0===r||r.call(n,o):"audioData"===i&&n.isDebug&&new Int16Array(o).forEach((function(e){n.audioData.length<=288e5&&n.audioData.push(e)}))}n.executor&&(n.closeSocketWithoutEOS?(n.executor.Send(Oe),n.closeSocketWithoutEOS=!1):"intensity"!==i&&n.executor.Send(o))},e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.error("Error: Unable to create worklet node: ",e.t0);case 18:case"end":return e.stop()}}),e,this,[[0,15]])}))),function(){return Pe.apply(this,arguments)})},{key:"PauseStream",value:(xe=Ee(me().mark((function e(){return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("running"!=this.audioContext.state){e.next=9;break}if(this.shouldPreIntialiseRecorder){e.next=8;break}return e.next=4,this.audioContext.suspend();case 4:this.log("Stream paused..."),this.processorNode.port.postMessage("PAUSE"),e.next=9;break;case 8:this.processorNode.port.postMessage(ye);case 9:this.onStateChanged(!1),this.isPaused=!0,this.isStreaming=!1;case 12:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"ResumeStream",value:(Ie=Ee(me().mark((function e(){return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.shouldPreIntialiseRecorder||"suspended"!=this.audioContext.state){e.next=9;break}if(!this.IsMicrophoneMuted){e.next=4;break}return this.onError(JSON.stringify({Type:"ERROR",Data:"Microphone is muted."})),e.abrupt("return");case 4:return e.next=6,this.audioContext.resume();case 6:this.log("Stream resumed..."),e.next=11;break;case 9:this.processorNode.port.postMessage(Ne),this.executor.Send(Ne);case 11:this.onStateChanged(!0),this.isPaused=!1,this.isStreaming=!0;case 14:case"end":return e.stop()}}),e,this)}))),function(){return Ie.apply(this,arguments)})},{key:"IsPaused",get:function(){return this.isPaused}},{key:"IsStreaming",get:function(){return this.isStreaming}},{key:"IsMicrophoneMuted",get:function(){return this.audioStream.getAudioTracks()[0].muted}},{key:"StopStream",value:(Le=Ee(me().mark((function e(t){var n,i,o,r;return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("suspended"===(null===(n=this.audioContext)||void 0===n?void 0:n.state)){e.next=4;break}return e.next=3,null===(r=this.audioContext)||void 0===r?void 0:r.suspend();case 3:this.onStateChanged(!1);case 4:this.log("Stream stopped..."),this.isStreaming=!1,this.closeSocketWithoutEOS=!t,null===(i=this.processorNode)||void 0===i||null===(i=i.port)||void 0===i||i.postMessage("STOP"),null===(o=this.audioStream)||void 0===o||o.getAudioTracks()[0].removeEventListener("ended",(function(){}));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Le.apply(this,arguments)})},{key:"cleanup",value:function(){this.source.mediaStream.getAudioTracks()[0].stop(),this.source.disconnect(),this.processorNode.disconnect(),this.processorNode.port.close(),this.audioContext.close(),this.audioData=[]}},{key:"saveAudio",value:function(){var e=this.encodeWAV(),t=URL.createObjectURL(new Blob([e],{type:"audio/wav"}));this.log("Download Recording: ".concat(t))}},{key:"getBlob",value:function(){var e=this.encodeWAV();console.log(e);var t=new Blob([e],{type:"audio/wav"});return console.log(t),t}},{key:"encodeWAV",value:function(){var e=new DataView(new ArrayBuffer(2*this.audioData.length));this.audioData.forEach((function(t,n){e.setInt16(2*n,t,!0)}));var t=e.buffer.byteLength,n=44+t,i=new DataView(new ArrayBuffer(n));i.setUint32(0,1380533830,!1),i.setUint32(4,n-8,!0),i.setUint32(8,1463899717,!1),i.setUint32(12,1718449184,!1),i.setUint32(16,16,!0),i.setUint16(20,1,!0),i.setUint16(22,1,!0),i.setUint32(24,16e3,!0),i.setUint32(28,32e3,!0),i.setUint16(32,2,!0),i.setUint16(34,16,!0),i.setUint32(36,1684108385,!1),i.setUint32(40,t,!0);for(var o=0;o<t;o++)i.setInt8(44+o,e.getInt8(o));return i}},{key:"log",value:function(e){if(this.enableLogs){var t="".concat((new Date).toLocaleTimeString()," Augnito: ").concat(e);console.log(t+"\n")}}}]),Ue=function(){function e(){var t,n,i,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{serverURL:"",enableLogs:!1,isDebug:!1,bufferInterval:1,pausedBufferInterval:1,EOS_Message:void 0,socketTimeoutInterval:void 0,shouldSendAudioDataSequence:!1,shouldPreIntialiseRecorder:!1,shouldReadIntensity:!1,debounceDelay:300,switchToRegularSpeechProfile:!1},r=arguments.length>1?arguments[1]:void 0;if(Se(this,e),e.instance)return e.instance;this.WebsocketURL=null!==(t=o.serverURL)&&void 0!==t?t:"",this.enableLogs=o.enableLogs,this.isDebug=o.isDebug,this.streamer=null,this.streamerNotStarted=!1,this.isStreamerStarting=!1,this.heavyOp=r,this.bufferInterval=o.bufferInterval,this.pausedBufferInterval=o.pausedBufferInterval,this.eosMessage=o.EOS_Message,this.socketTimeoutInterval=o.socketTimeoutInterval,this.shouldSendAudioDataSequence=o.shouldSendAudioDataSequence,this.shouldPreIntialiseRecorder=o.shouldPreIntialiseRecorder,this.switchToRegularSpeechProfile=null!==(n=o.switchToRegularSpeechProfile)&&void 0!==n&&n,this.shouldPreIntialiseRecorder&&(this.initialiseStreamer(),this.streamerNotStarted=!0),this.shouldReadIntensity=o.shouldReadIntensity,this.delay=null!==(i=o.debounceDelay)&&void 0!==i?i:300,this.toggleStartStopAudioStream=Ge(this.toggleStartStopAudioStream.bind(this),this.delay),this.togglePauseResumeAudioStream=Ge(this.togglePauseResumeAudioStream.bind(this),this.delay),e.instance=this}return Te(e,[{key:"initialiseStreamer",value:function(){this.streamer=new je(this.enableLogs,this.isDebug,this.bufferInterval,this.pausedBufferInterval,this.eosMessage,this.socketTimeoutInterval,this.shouldSendAudioDataSequence,this.shouldPreIntialiseRecorder,this.shouldReadIntensity,this.switchToRegularSpeechProfile,this.heavyOp,this.onFinalResultCallback.bind(this),this.onPartialResultCallback.bind(this),this.onErrorCallback.bind(this),this.onStateChangedCallback.bind(this),this.onSessionEventCallback.bind(this),this.onOtherResultCallback.bind(this),this.onSpeechResponseCallback.bind(this),this.onIntensityCallback.bind(this))}},{key:"togglePauseResumeAudioStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;!this.streamer||this.streamerNotStarted?(t&&(this.WebsocketURL=t),this.startAudio(e)):this.streamer.IsPaused?this.resumeAudio():this.pauseAudio()}},{key:"toggleStartStopAudioStream",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;!this.streamer||this.streamerNotStarted?(t&&(this.WebsocketURL=t),this.startAudio(e)):this.stopAudio()}},{key:"startAudio",value:(t=Ee(me().mark((function e(t){return me().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isStreamerStarting){e.next=2;break}return e.abrupt("return");case 2:return this.isStreamerStarting=!0,this.shouldPreIntialiseRecorder&&this.streamer||this.initialiseStreamer(),e.prev=4,e.next=7,this.streamer.StartStream(t,this.WebsocketURL);case 7:e.sent?(this.streamerNotStarted=!1,this.log("Stream Started...")):this.streamer=null;case 9:return e.prev=9,this.isStreamerStarting=!1,e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),function(e){return t.apply(this,arguments)})},{key:"pauseAudio",value:function(){this.streamer.PauseStream(),this.log("Stream Paused...")}},{key:"resumeAudio",value:function(){this.streamer.ResumeStream(),this.enableLogs&&this.log("Stream Resumed...")}},{key:"stopAudio",value:function(){var e,t,n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(null!==(e=this.streamer)&&void 0!==e&&e.IsStreaming||i)&&(null===(t=this.streamer)||void 0===t||t.StopStream(n),this.streamer=null,this.log("Stream Stopped..."),this.shouldPreIntialiseRecorder&&(this.initialiseStreamer(),this.streamerNotStarted=!0))}},{key:"getBlob",value:function(){var e=this.streamer.getBlob();return this.log("Blob Sent..."),e}},{key:"log",value:function(e){if(this.enableLogs){var t="".concat((new Date).toLocaleTimeString()," Augnito: ").concat(e);this.showLogCallback(t+"\n")}}},{key:"dispose",value:function(){e.instance=null}},{key:"onSessionEventCallback",value:function(e){this.onSessionEvent&&this.onSessionEvent(e)}},{key:"onStateChangedCallback",value:function(e){this.onStateChanged&&this.onStateChanged(e)}},{key:"onIntensityCallback",value:function(e){this.onIntensity&&this.onIntensity(e)}},{key:"onErrorCallback",value:function(e){this.onError&&this.onError(e)}},{key:"onPartialResultCallback",value:function(e){this.onPartialResult&&this.onPartialResult(e)}},{key:"onFinalResultCallback",value:function(e){this.onFinalResult&&this.onFinalResult(e)}},{key:"onOtherResultCallback",value:function(e){this.onOtherResults&&this.onOtherResults(e)}},{key:"onSpeechResponseCallback",value:function(e){this.onSpeechResponse&&this.onSpeechResponse(e)}},{key:"showLogCallback",value:function(e){this.showLog&&this.showLog(e)}}]);var t}();function Ge(e,t){var n;return function(){for(var i=this,o=arguments.length,r=new Array(o),a=0;a<o;a++)r[a]=arguments[a];n&&clearTimeout(n),n=setTimeout((function(){return e.apply(i,r)}),t)}}class We extends fe{constructor(e,t,n){super(),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_notificationClient",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_notifSubscribedInOtherWindow",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"VocabularyAPI"}),Object.defineProperty(this,"_baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_recorder",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_preventOverrun",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_overrunRecording",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_recordingStart",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_isRecording",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_stream",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onVocabularyAdded",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),g.Against.NullOrEmpty(e.SubscriptionCode,"SubscriptionCode"),g.Against.NullOrEmpty(e.AccessKey,"AccessKey"),g.Against.NullOrEmpty(e.Server,"Server"),g.Against.NullOrEmpty(e.UserCode,"UserCode"),g.Against.NullOrEmpty(e.DeviceCode,"DeviceCode"),g.Against.NullOrEmpty(e.SourceApp,"SourceApp"),g.Against.NullOrEmpty(e.SmId,"SmId"),this._baseUrl=`https://${e.Server}/db/speechapi`,this._notifSubscribedInOtherWindow||(this._notificationClient.ensureNotificationClientConnected(),this._notificationClient.onVocabularyAdded=this.onVocabularyAddedCallback.bind(this))}getVocabulary(e){return ge(this,void 0,void 0,(function*(){return this.log("Getting vocabulary for user"),yield this.makePostRequest({Request:Object.assign(Object.assign({},e),this.getGetCommonModel())},this.getURL("/get_user_prs_word"))}))}removeVocabulary(e){return ge(this,void 0,void 0,(function*(){return this.log("Removing vocabulary for user"),yield this.makePostRequest({Request:Object.assign(Object.assign({},this.getGetCommonModel()),e)},this.getURL("/remove_personal_word"))}))}upsertVocabulary(e){return ge(this,void 0,void 0,(function*(){return this.log("Upserting vocabulary for user"),this.makePostFormRequest(Object.assign(Object.assign({},e),this.getUpsertCommonModel()),this.getURL("/add_personal_word"))}))}startRecording(){return this.log("Starting recording for vocabulary"),new Promise(((e,t)=>{this._isRecording?(this.log("Already recording"),t("Already recording")):(this._isRecording=!0,this._recorder=new Ue({serverURL:"",enableLogs:!0,isDebug:!0,bufferInterval:1,EOS_Message:"EOS",socketTimeoutInterval:1e4}),this._recorder.startAudio(),this._recordingStart=(new Date).getTime(),this._preventOverrun=setTimeout((()=>{var e,t;this._overrunRecording=null===(e=this._recorder)||void 0===e?void 0:e.getBlob(),this.log("Recording overrun"),null===(t=this._recorder)||void 0===t||t.stopAudio()}),9e3),e())}))}stopRecording(){return this.log("stopping recording for vocabulary"),this._preventOverrun&&clearTimeout(this._preventOverrun),new Promise(((e,t)=>{if(this._recorder){this._isRecording=!1;let t=(new Date).getTime()-this._recordingStart;setTimeout((()=>{var n,i;if(t=(new Date).getTime()-this._recordingStart,this._overrunRecording){const t=this._overrunRecording;this._overrunRecording=void 0,this._recorder=void 0,null===(n=this._stream)||void 0===n||n.getAudioTracks()[0].stop(),e(t)}else{const t=this._recorder.getBlob();null===(i=this._recorder)||void 0===i||i.stopAudio(),this._recorder=void 0,e(t)}}),Math.max(0,1200-t))}else t("Recorder not started")}))}getURL(e){return`${this._baseUrl}${e}`}getGetCommonModel(){return{SubscriptionCode:this._config.SubscriptionCode,AccessKey:this._config.AccessKey,SmId:this._config.SmId,UserCode:this._config.UserCode}}getUpsertCommonModel(){return Object.assign(Object.assign({},this.getGetCommonModel()),{DeviceCode:this._config.DeviceCode,SourceApp:this._config.SourceApp})}onVocabularyAddedCallback(e){this.onVocabularyAdded&&this.onVocabularyAdded(e)}log(e){this._config.enableLogs&&a.log(e,this._logTag)}makePostFormRequest(e,t){return ge(this,void 0,void 0,(function*(){try{const n=new FormData;for(const[t,i]of Object.entries(e))n.append(t,i);const i=yield fetch(t,{method:"POST",headers:{accept:"*/*"},body:n}),o=yield i.json();return[200,0].includes(o.Status)?o:o.ErrorMessage}catch(e){return e instanceof Error?e.message:"Unknown Error"}}))}}class Ve extends fe{constructor(e){super(),Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"FormattingAPI"}),Object.defineProperty(this,"_baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),g.Against.NullOrEmpty(e.SubscriptionCode,"SubscriptionCode"),g.Against.NullOrEmpty(e.AccessKey,"AccessKey"),g.Against.NullOrEmpty(e.Server,"Server"),g.Against.NullOrEmpty(e.UserCode,"UserCode"),g.Against.NullOrEmpty(e.DeviceCode,"DeviceCode"),g.Against.NullOrEmpty(e.SourceApp,"SourceApp"),g.Against.NullOrEmpty(e.SmId,"SmId"),this._baseUrl=`https://${e.Server}/db/speechapi/fp`}getURL(e){return`${this._baseUrl}${e}`}getFormatting(e){return ge(this,void 0,void 0,(function*(){return this.log("Getting formatting for user"),yield this.makePostRequest(Object.assign(Object.assign({},e),this.getGetCommonModel()),this.getURL("/get"))}))}upsertFormatting(e){return ge(this,void 0,void 0,(function*(){return this.log("Upserting formatting for user"),yield this.makePostRequest(Object.assign(Object.assign({},e),this.getGetCommonModel()),this.getURL("/modify"))}))}removeFormatting(e){return ge(this,void 0,void 0,(function*(){return this.log("Removing formatting for user"),yield this.makePostRequest(Object.assign(Object.assign({},e),this.getGetCommonModel()),this.getURL("/delete"))}))}log(e){this._config.enableLogs&&a.log(e,this._logTag)}getGetCommonModel(){return{SubscriptionCode:this._config.SubscriptionCode,AccessKey:this._config.AccessKey,SmId:this._config.SmId,UserTag:this._config.UserCode}}}class He extends fe{constructor(e,t,n,i,o){super(),Object.defineProperty(this,"_accountCode",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_accessKey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_userTag",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_enableLogs",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"MedicineOrderingAPI"}),Object.defineProperty(this,"_baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),g.Against.NullOrEmpty(e,"AccountCode"),g.Against.NullOrEmpty(t,"AccessKey"),g.Against.NullOrEmpty(o,"Server"),this._baseUrl=`https://${o}/augnote/nlp`}getMedicineOrderData(e){return ge(this,void 0,void 0,(function*(){return this.log("Getting Medicine Order for user"),yield this.makePostRequest(Object.assign(Object.assign({},e),this.getCommonModel()),this.getURL("/ordermedicine"))}))}getCommonModel(){return{SubscriptionCode:this._accountCode,AccessKey:this._accessKey,UserTag:this._userTag}}getURL(e){return`${this._baseUrl}${e}`}log(e){this._enableLogs&&a.log(e,this._logTag)}}class ze{constructor(e,t,n,i,o,r,a,s,l){Object.defineProperty(this,"_accountCode",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_accessKey",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_server",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"_userTag",{enumerable:!0,configurable:!0,writable:!0,value:i}),Object.defineProperty(this,"_lmid",{enumerable:!0,configurable:!0,writable:!0,value:o}),Object.defineProperty(this,"_deviceId",{enumerable:!0,configurable:!0,writable:!0,value:r}),Object.defineProperty(this,"_sourceApp",{enumerable:!0,configurable:!0,writable:!0,value:a}),Object.defineProperty(this,"_enableLogs",{enumerable:!0,configurable:!0,writable:!0,value:s}),Object.defineProperty(this,"_notificationClient",{enumerable:!0,configurable:!0,writable:!0,value:l})}getMacrosAPI(){return new pe(this._accountCode,this._accessKey,this._server)}getMedicineOrderingAPI(){return new He(this._accountCode,this._accessKey,this._userTag,this._enableLogs,this._server)}getFormattingAPI(){return new Ve({SubscriptionCode:this._accountCode,AccessKey:this._accessKey,Server:this._server,SmId:this._lmid,DeviceCode:this._deviceId,SourceApp:this._sourceApp,UserCode:this._userTag,enableLogs:this._enableLogs})}getVocabularyAPI(e=!1){return new We({SubscriptionCode:this._accountCode,AccessKey:this._accessKey,Server:this._server,SmId:this._lmid,DeviceCode:this._deviceId,SourceApp:this._sourceApp,UserCode:this._userTag,enableLogs:this._enableLogs},this._notificationClient,e)}}class Ke{get notificationSocket(){return this._pushNotificationSocket}constructor(e){Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"NotificationClient"}),Object.defineProperty(this,"onConnectionRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onMobileScan",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onVocabularyAdded",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pushNotificationSocket",{enumerable:!0,configurable:!0,writable:!0,value:null})}Send(e){var t;null===(t=this._pushNotificationSocket)||void 0===t||t.send(e)}ensureNotificationClientConnected(){null!=this.notificationSocket&&[WebSocket.OPEN,WebSocket.CONNECTING].includes(this.notificationSocket.readyState)||this.createNotificationClient()}createNotificationClient(){this.closeMobileWebSocket()||null!==this.notificationSocket&&this.notificationSocket.readyState===WebSocket.OPEN||(this._config.enableLogs&&a.log("NOTIFICATION CLIENT: Connecting",this._logTag),this.createNotificationSocket(this._config.prepareNotificationURL()))}createNotificationSocket(e){this._pushNotificationSocket=new WebSocket(e),this._pushNotificationSocket.onmessage=e=>{var t,n;if(this._config.enableLogs&&a.log({message:"NOTIFICATION CLIENT: Message received",data:e},this._logTag),e.data){const i=JSON.parse(e.data);if(this._config.deviceId&&this._config.deviceId!==i.ToDeviceId)return void(this._pushNotificationSocket?this._pushNotificationSocket.send(this.getReplyMessage(i,"WRONG_DESTINATION")):a.error("push notification socket not created",this._logTag));"Type"in i&&("MOBILE_SCAN_SUCCESSFUL"===i.Type?this.onMobileScanCallback():"MIC_CONNECTION_REQUEST"===i.Type?this.onConnectionRequestCallback(i):"GENERAL_NOTIFICATION"===i.Type&&"Vocabulary"==(null===(n=null===(t=i.Data)||void 0===t?void 0:t.AppNotification)||void 0===n?void 0:n.SubType)&&this.onVocabularyAddedCallback(i.Data.AppNotification))}},this._pushNotificationSocket.onopen=()=>{this._config.enableLogs&&a.log("NOTIFICATION CLIENT: Socket Opened.",this._logTag)},this._pushNotificationSocket.onclose=()=>{this._config.enableLogs&&a.log("NOTIFICATION CLIENT: Socket Closed.",this._logTag),this._pushNotificationSocket=null},this._pushNotificationSocket.onerror=e=>{this._config.enableLogs&&a.log({message:"NOTIFICATION CLIENT: Socket Error: ",data:e},this._logTag),this._pushNotificationSocket=null}}closeMobileWebSocket(){return null!=this._pushNotificationSocket?(this._pushNotificationSocket.close(),this._pushNotificationSocket=null,!0):(this._config.stopListening(),!1)}dispose(){this.closeMobileWebSocket(),this._pushNotificationSocket=null}onMobileScanCallback(){this._config.enableLogs&&a.log("NOTIFICATION CLIENT: MOBILE_SCAN_SUCCESSFUL",this._logTag),this.onMobileScan&&this.onMobileScan()}onVocabularyAddedCallback(e){this._config.enableLogs&&a.log("NOTIFICATION CLIENT: Vocabulary Added",this._logTag),this.onVocabularyAdded&&this.onVocabularyAdded(e)}onConnectionRequestCallback(e){this._config.enableLogs&&a.log("NOTIFICATION CLIENT: MIC_CONNECTION_REQUEST",this._logTag),this.onConnectionRequest&&this.onConnectionRequest(e)}getReplyMessage(e,t){const n={FromDeviceId:this._config.deviceId||"",ToDeviceId:e.FromDeviceId,SeqId:E(),AckOf:e.SeqId,Type:t,TimeStamp:S()};return JSON.stringify(n)}}class Xe{constructor(e,t){Object.defineProperty(this,"_config",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_enableLogs",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"PhilipsMicClient"}),Object.defineProperty(this,"intervalInMillis",{enumerable:!0,configurable:!0,writable:!0,value:100}),Object.defineProperty(this,"isRecodingIsPressed",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"counter",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"WasMicStartedByPressToSpeak",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"onPhilipsMicPressed",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"getConnectedPhilipsDeviceName",{enumerable:!0,configurable:!0,writable:!0,value:e=>-1!==e.toLowerCase().indexOf("911")&&-1!==e.indexOf("fa0")?"SpeechMike":-1!==e.toLowerCase().indexOf("911")&&-1!==e.indexOf("c1e")?(this._enableLogs&&a.log("SpeechOne detected",this._logTag),"SpeechOne"):-1===e.toLowerCase().indexOf("911")||-1===e.indexOf("1844")&&-1===e.indexOf("91a")?"":(this._enableLogs&&a.log("Footswitch detected",this._logTag),"Footswitch")}),Object.defineProperty(this,"gamepadCallBack",{enumerable:!0,configurable:!0,writable:!0,value:()=>{for(var e=navigator.getGamepads(),t=0;t<e.length;t++){var n=e[t];if(n){if(""===this.getConnectedPhilipsDeviceName(n.id))continue;n.buttons[5].pressed?this._config.philipsMicMode===b.HandsFree?this.isRecodingIsPressed=!0:(this._config.philipsMicMode===b.PushToTalk||(this.isRecodingIsPressed=!0),this.HandlePushToTalk()):this.isRecodingIsPressed&&!this.WasMicStartedByPressToSpeak?(this.isRecodingIsPressed=!1,this.counter=0,this.onPhilipsMicPressedCallback(void 0)):this.WasMicStartedByPressToSpeak&&(this.isRecodingIsPressed=!1,this.WasMicStartedByPressToSpeak=!1,this.counter=0,this.onPhilipsMicPressedCallback(!1))}}}}),setInterval(this.gamepadCallBack,this.intervalInMillis)}HandlePushToTalk(){5===this.counter?this.CheckForRECPressed():this.counter++}CheckForRECPressed(){this.WasMicStartedByPressToSpeak||(this.isRecodingIsPressed=!1,this.WasMicStartedByPressToSpeak=!0,this.counter=0,this.onPhilipsMicPressedCallback(!0))}onPhilipsMicPressedCallback(e){this._enableLogs&&a.log("PHILIPS_MIC_CONNECTION_REQUEST",this._logTag),this.onPhilipsMicPressed&&this.onPhilipsMicPressed(e)}}class qe{static addCommand(e,t,n){var i;let o={CommandName:e,CustomCallback:n,CustomCallbackParameter:t};null===(i=qe.dynamicList)||void 0===i||i.push(o)}static prepareCustomCommandRecipe(e){var t;let n=e.receivedText.replace(/\n/gi,r.NEXT_LINE_TEXT);n=n.replace(/ /gi,"").toLowerCase().trim(),n=n.replace(new RegExp(r.NEXT_LINE_TEXT,"gi"),"\n");const i={sessionCode:e.sessionCode,isCommand:e.isCommand,final:e.final,receivedText:e.receivedText,receivedTextWithoutSpace:n,action:e.action,name:n},o=null===(t=qe.dynamicList)||void 0===t?void 0:t.find((e=>e.CommandName.replace(/ /gi,"").toLowerCase().trim()===n));return o?o.CustomCallback?(o.CustomCallback(o.CustomCallbackParameter),null):Object.assign(Object.assign({},i),{isCustomCommand:!0}):i}}Object.defineProperty(qe,"dynamicList",{enumerable:!0,configurable:!0,writable:!0,value:[]});class Je{constructor(e){var t,n,i,o,r;Object.defineProperty(this,"_logTag",{enumerable:!0,configurable:!0,writable:!0,value:"Augnito"}),Object.defineProperty(this,"_webClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_sdkMobileConfig",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_augnitoMobile",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_worker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"enableLogs",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"isConnected",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"switchToRegularSpeechProfile",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"shouldPreInitialiseMic",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"forceStopAudio",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"config",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_factoryAPI",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_editorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"recorderIns",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"_notificationClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onPartialResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFinalResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onCommandResult",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onStateChanged",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onSessionEvent",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onIdleMic",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onMicrophoneOnError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onError",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enableLogs=null!==(t=e.enableLogs)&&void 0!==t&&t,this.shouldPreInitialiseMic=e.earlyInitialiseRecorder,this.switchToRegularSpeechProfile=null!==(n=e.switchToRegularSpeechProfile)&&void 0!==n&&n,this.config=this.createSDKConfig((e=>(g.Against.NullOrUndefined(e,"Config"),g.Against.NullOrEmpty(e.userTag,"UserTag"),g.Against.NullOrEmpty(e.lmId,"LmId"),g.Against.NullOrEmpty(e.accountCode,"AccountCode"),g.Against.NullOrEmpty(e.accessKey,"AccessKey"),g.Against.NullOrEmpty(e.sourceApp,"SourceApp"),g.Against.NullOrEmpty(p(e.server),"AugnitoAPIServer"),C(e),e.enableLogs=e.enableLogs||!1,e.deviceId=e.deviceId||E(),e))(e)),this._webClient=new s(this.config),this._sdkMobileConfig=new de(((e,t)=>(g.Against.NullOrUndefined(e,"WebClient"),g.Against.NullOrEmpty(e.getConfig().clientConfig.deviceId,"deviceId"),t.enableLogs=t.enableLogs||!1,t))(this._webClient,e||{}),this._webClient),this._notificationClient=new Ke(this._sdkMobileConfig),this._worker=this.createWorker(),this._editorHandler=new ue(e.listOfControls||[],this.enableLogs,e.editor),this._factoryAPI=new ze(e.accountCode,e.accessKey,p(e.server),e.userTag,e.lmId,e.deviceId,e.sourceApp,null!==(i=e.enableLogs)&&void 0!==i&&i,this._notificationClient),this.recorderIns=new Ue({serverURL:this.config.prepareSpeechURL(),enableLogs:null!==(o=e.enableLogs)&&void 0!==o&&o,isDebug:null!==(r=e.enableLogs)&&void 0!==r&&r,bufferInterval:1,pausedBufferInterval:e.pauseStateBufferInterval,EOS_Message:"EOS",socketTimeoutInterval:2e4,shouldSendAudioDataSequence:!1,shouldPreIntialiseRecorder:this.shouldPreInitialiseMic,debounceDelay:e.debounceDelay,switchToRegularSpeechProfile:e.switchToRegularSpeechProfile}),this.recorderIns.onError=this.onErrorCallback.bind(this),this.recorderIns.onPartialResult=this.onPartialResultsCallback.bind(this),this.recorderIns.onFinalResult=this.onSocketFinalResult.bind(this),this.recorderIns.onStateChanged=this.onStateChangeCallback.bind(this),this.recorderIns.onSessionEvent=this.onSessionEventCallback.bind(this),window.addEventListener("storage",this.handleStorageChangeEvent.bind(this)),window.addEventListener("beforeunload",this.handleBeforeUnloadEvent.bind(this))}toggleListening(e=!1){var t,n;a.log("toggleListening clicked",this._logTag),this.forceStopAudio=!1,this.isConnected||localStorage.getItem(o.KEY)!==o.ON?this._webClient&&this._webClient.connected?this._webClient.stopListening(!0):e||this.shouldPreInitialiseMic?null===(t=this.recorderIns)||void 0===t||t.togglePauseResumeAudioStream():null===(n=this.recorderIns)||void 0===n||n.toggleStartStopAudioStream():this.onMicrophoneOnErrorCallback(!0)}getQRCode(){var e;return null===(e=this.config)||void 0===e?void 0:e.qrCode}navigateToNextField(){var e={name:"",action:r.NEXT_FIELD,sessionCode:"",final:!1,isCommand:!1,receivedText:"",receivedTextWithoutSpace:"",chooseNumber:0,fontSize:0,nextPrevious:"",searchText:"",selectFor:"",isCustomCommand:!1};this._editorHandler.handleDynamicFieldNavigation(e)}navigateToPreviousField(){var e={name:"",action:r.PREVIOUS_FIELD,sessionCode:"",final:!1,isCommand:!1,receivedText:"",receivedTextWithoutSpace:"",chooseNumber:0,fontSize:0,nextPrevious:"",searchText:"",selectFor:"",isCustomCommand:!1};this._editorHandler.handleDynamicFieldNavigation(e)}getCursorPosition(){return this._editorHandler.getCursorPosition()}setCursorAtPosition(e){this._editorHandler.setCursorAtPosition(e)}setCursorAtDocumentEnd(){this._editorHandler.handleGotoDocumentEnd()}dispose(){this._augnitoMobile&&(this._augnitoMobile.dispose(),this._augnitoMobile=null),this._worker&&(this._worker.terminate(),this._worker=null),this.recorderIns&&(this.recorderIns.dispose(),this.recorderIns=null)}initMobileClient(e){var t;if(!this._webClient)throw new Error("augnito client not set");if(this._augnitoMobile)throw new Error("augnito mobile client has already been initialized");return this._sdkMobileConfig.setEnableLogs(null!==(t=null==e?void 0:e.enableLogs)&&void 0!==t&&t),this._sdkMobileConfig.onMicrophoneOnError=this.onMicrophoneOnErrorCallback.bind(this),this._augnitoMobile=new he(new l(this._sdkMobileConfig,this._notificationClient)),this._augnitoMobile}initPhilipMicClient(e){return new Xe(e,this.enableLogs)}requestMicOff(){var e;localStorage.getItem(o.KEY)===o.ON&&localStorage.setItem(o.KEY,o.REQUEST_OFF),this.stopAudio(),null===(e=this.recorderIns)||void 0===e||e.dispose()}addCustomCommand(e,t,n){qe.addCommand(e,t,n)}setAnchoredEditor(e,t){this._editorHandler.onSetAnchoredEditor(e,t)}get apisFactory(){return this._factoryAPI}get configuration(){return this.config?this.config:null}stopAudio(){var e;this._augnitoMobile&&this._augnitoMobile.stopMobileMicConnection();try{null===(e=this.recorderIns)||void 0===e||e.stopAudio(!0,!0)}catch(e){}}onPartialResultsCallback(e){this.enableLogs&&a.log({type:"onPartialResults",data:e},this._logTag),this.onPartialResult&&this.onPartialResult(e)}onFinalResultsCallback(e){this.enableLogs&&a.log({type:"FinalText",recipe:e},this._logTag),this.onFinalResult&&this.onFinalResult(e)||this._editorHandler.onFinalResult(e)}onCommandResultsCallback(e){this.enableLogs&&a.log({type:"Command",command:e},this._logTag),this.onCommandResult&&this.onCommandResult(e)||this.interfaceCommand(e)||this._editorHandler.onCommandResult(e)}interfaceCommand(e){return r.STOP_MIC===e.name&&(this.stopAudio(),!0)}onErrorCallback(t){this.enableLogs&&a.error({type:"onError",error:e.ERR_SERVER,data:t},this._logTag),(t.includes("Audio track ended. Possibly the mic was unplugged")||t.includes("Microphone is muted"))&&this.requestMicOff(),this.onError&&this.onError({Type:e.ERR_SERVER,Message:t,IsWebClient:!0}),this.isConnected=!1,localStorage.setItem(o.KEY,o.OFF)}onIdleMicCallback(){this.onIdleMic&&this.onIdleMic()}onStateChangeCallback(e){if(this.forceStopAudio)return this.stopAudio(),void(this.forceStopAudio=!1);this.isConnected=e,e?(localStorage.setItem(o.KEY,o.ON),this.onPartialResultsCallback("")):localStorage.setItem(o.KEY,o.OFF),this.enableLogs&&a.log(`AUGNITO STATUS CHANGED. Connected: ${e}`,this._logTag),this.onStateChanged&&this.onStateChanged(e)}onSocketFinalResult(e){let t;if(t="string"==typeof e?JSON.parse(e):e.Result,this.enableLogs&&a.log({type:"onSocketFinalResult",data:e},this._logTag),this.switchToRegularSpeechProfile&&this.onPartialResultsCallback(""),this._worker){const e=t.Transcript,n=t.Action,i={name:t.Transcript,sessionCode:"",final:t.Final,isCommand:t.IsCommand,receivedText:e,action:t.IsCommand?n.replace(/\s+/g,""):""};this._worker.postMessage(i)}}onSessionEventCallback(e){var t=void 0;if(t="string"==typeof e?JSON.parse(e):e,this.enableLogs&&a.log({type:"onSessionEvent",data:e},this._logTag),this.onSessionEvent&&this.onSessionEvent(t),"string"==typeof t.Event&&"None"===t.Event)return;const n=t.Event.Type,i=t.Event.Value;if("SESSION_CREATED"===n){if(this.isConnected=!0,this.enableLogs){const e=i;a.log("session Token "+e,this._logTag)}}else"SERVICE_DOWN"===n?(a.error(n,this._logTag),this.isConnected?this.stopAudio():this.forceStopAudio=!0,this.onErrorCallback(i)):"NO_DICTATION_STOP_MIC"===n?(this.enableLogs&&a.log("NO_DICTATION_STOP_MIC",this._logTag),this.onIdleMicCallback()):"INVALID_AUTH_CREDENTIALS"===n?(a.error("INVALID_AUTH_CREDENTIALS",this._logTag),a.log("Invalid authentication, Please check your Account Status, Lm Id and Access Key."),this.isConnected?this.stopAudio():this.forceStopAudio=!0,this.onErrorCallback(i)):"LOW_BANDWIDTH"===n&&(this.enableLogs&&a.log("LOW_BANDWIDTH: Check internet connection",this._logTag),this.onErrorCallback(i))}onMicrophoneOnErrorCallback(t){this.enableLogs&&a.log(`AUGNITO Error. Microphone is already On. Is Web Client? ${t}`,this._logTag),this.onMicrophoneOnError?this.onMicrophoneOnError(t):this.onError&&this.onError({Type:e.ERR_CLIENT,Message:"Microphone is already On",IsWebClient:t})}createSDKConfig(e){const t=new m(e);return t.onError=this.onErrorCallback.bind(this),t.onSocketPartialResult=this.onPartialResultsCallback.bind(this),t.onSocketFinalResult=this.onSocketFinalResult.bind(this),t.onReadyForSpeech=this.onStateChangeCallback.bind(this),t.onEndOfSession=this.onStateChangeCallback.bind(this),t.onSessionEvent=this.onSessionEventCallback.bind(this),t.onMicrophoneOnError=this.onMicrophoneOnErrorCallback.bind(this),t}createWorker(){const e=URL.createObjectURL(new Blob(["this.onmessage = function (eee) {self.postMessage(eee.data);}"],{type:"application/javascript"})),t=new Worker(e);return t.onmessage=e=>{const t=e.data,n=qe.prepareCustomCommandRecipe(t);if(null==n)this.enableLogs&&a.log({type:"AugnitoCustomCommands",command:n},this._logTag);else if(n.isCustomCommand)this.enableLogs&&a.log({type:"AugnitoCustomCommands",command:n},this._logTag),this.onCommandResultsCallback(n);else if(t.isCommand){const e=h.prepareRecipe(t);this.enableLogs&&a.log({type:"AugnitoCommandsStatic",command:e},this._logTag),this.onCommandResultsCallback(e)}else{const e=d.prepareRecipe(t);e.isCommand?(this.enableLogs&&a.log({type:"AugnitoCommandsRegex",command:e},this._logTag),this.onCommandResultsCallback(e)):this.onFinalResultsCallback(e)}},t}handleBeforeUnloadEvent(e){this.enableLogs&&a.log({type:"handleBeforeUnloadEvent",event:e},this._logTag),this.isConnected&&this.requestMicOff()}handleStorageChangeEvent(e){e.key===o.KEY&&(this.enableLogs&&a.log({type:"handleStorageChangeEvent",event:e},this._logTag),localStorage.getItem(o.KEY)===o.REQUEST_OFF&&this.isConnected&&this.toggleListening())}}const $e=["--select--","BD - Afternoon & Night","BD - Morning & Afternoon","BD - Morning & Evening","BD - Morning & Night","Continuous infusion","EIGHT times a day","Every 10 days","Every 2 hours","Every Alternate day","Every hour","Every two weeks","FIVE times a day","FIVE times a week","FOUR times a week","HS - At bedtime","OD - Afternoon","OD - Evening","OD - Morning","OD - Night","Once - One time only","Once a month","Once a week","Once a year","Q12H - Every 12 hours","Q4H - Every 4 hours","Q6H - Every 6 hours","Q8H - Every 8 hours","QID - Morning, Afternoon, Evening & Night","Refer instructions for dosage","SIX times a day","SOS - Whenever needed","STAT ( Immediately)","TDS - Afternoon, Evening & Night","TDS - Morning, Afternoon & Evening","TDS - Morning, Afternoon & Night","TDS - Morning, Evening & Night","THREE times a week","TWO times a week"],Ye=["--select--","After Breakfast","After dinner","After lunch","After meal","At Bed Time","Before Breakfast","Before dinner","Before lunch","Before meal","Empty Stomach","Local Application","Not Applicable to Meals","With Food"],Ze=["--select--","Day(s)","Month(s)","Till Next Review","Week(s)"],Qe=["--select--","Vial(s)","Ampoule","Bag","Bar","Bottle(s)","Box","Capsule(s)","Carton","Cartridge(s)","Cream","Dressing","Drops","Gel","gm","I.U.","Inhaler","Jar","Kit","Lozenge","mg","Micro drops","Microgram (mcg)","ml","Ounce (30 ml)","Pad","Patch(s)","Pen","Pessary","Piece","Pre Filled Syringe","puff(s)","Respule(s)","Sachet(s)","Scoop(s)","Spray","Strip(s)","Suppository","Tablespoon (15 ml)","Tablet(s)","Tampon","Teaspoon (5 ml)","Tube","Unit(s)"],et=["--select--","Gastronomy Tube","Mouth And Throat","Nasogastric","Nasotrachial Tube","Oral","Rectal","Sublingual","Translingual","Dental","Epidural","Gargle","Inhalation","Intra-Arterial","Intrabursal","Intracardiac","Intrahepatic Artery","Intramuscular","Intraperitoneal","Intrathecal","Intratracheal","Intrauterine","Intravenous","Irrigation","Local Application","N/A","Nasal","Nebulization","Perfusion","Urethral","Ventimask","Apply Externally","Buccal","Immerse(Soak) Body Part","Implant","Intracervical (Uterus)","Intradermal","Intranasal","Intraocular","Mucous Membrane","Other/Miscellaneous","Otic","Subcutaneous","Topical","Transdermal","Vaginal"],tt=["--select--","SOMAZINA PLUS TAB","KEZONE S FORTE 1.5GM INJ","NEOROF 1% 10ML INJ","INOGLA 20MG TAB 10'S","GRAFEEL 1ML 300MCG INJ","GABAPIN 100MG TAB 15'S","SYNCAPONE 150MG TAB","OXA-50MG/25ML INJ","PRIN PLUS SOFTGEL CAP 10&apos;S","DOLONEURON PG-75MG CAP","DOLO 1000MG TAB","DOLO 100ML IV","DOLO 15ML DROPS","DOLO 250MG SYP","DOLO 650MG TAB 15'S","DOLO INFUSION 100ML","DOLO IVG 1%INFUSION 1000MG/100ML","DOLO SUSP - 60ML","DOLO-500MG TAB","ZEROSCAB 120ML LOTION","DHYAN-NTP TAB 10'S","FUZOLID 200MG/100ML INFUSION","SUNBAN ULTRA SPF 31 GEL","PENTASURE VANILA 400GM TIN","BRONCOREX  EXP 100ML","AMPILOX 500MG CAP","GABAPIN 100MG TAB 10'S","ND-PAIN TAB","PANTODAC 40MG IV INJ","LIFEPILL 3MG CAP","CLOPILET A 150MG TAB","DOMSTAL DT 10MG TAB","REJUNURON CAPS 30'S","CARDIOPLEGIA INJ - 20ML (DBL)","CINOD-N 10/5MG TAB","KETOART TAB","DOBESIL H 30GRM OINT","DYRECT TAB","ZIMBA 1% WW 10GM CREAM","PLASBUMIN-12.5GM/250ML","SOFZID NS SYP 180 ML","OFLOCHEM 200MG TAB","FAROTAB 200MG TAB 6'S","C WIN 1%W/W CREAM 30GM","SEMI GLYNASE 2.500 MG TAB","OXONEG ORANGE FLAV EFFERVESCENT TAB 15'S","KEPHAZON-S FORTE 3.0 GM INJ","METROGYL-P 2% OINT 20GM","MAXMALA 50MG TAB","OXIFUL - FORTE CAP 10S","TREMIDON 50MG TAB","CREMAFFIN PLUS - 110ML [BOOTS CO.]","PARI CR FORTE TAB","CEFOLAC DT 50MG TAB","TRIOPTAL 450MG TAB","BRYXTA 300MG/12ML INJ","CARDIMAX SR 60MG TAB","CYBLEX 80MG TAB 15S","DOMSTAL BABY 5 ML DROPS","INSUGEN-30/70 REFIL 3ML INJ","CALCIRIN-FORTE CAP","ROMILAST 10 MG TAB","EPSOLIN ER 300MG TAB","MOTIVYST 300MG TAB","NIMEK PARA TAB","CREMA ANO 20GM CREAM","NOSTRA CR 15MG TAB","MACPEE 25MG TAB","NUROZENOL CAP","MYCOPHEN 500MG TAB","REPACE-A TAB","FULVIRA 250MG/5ML INJ","PHYSIOGEL HYPOALERGENIC LOTION","DEXTOMID 50MG 0.5ML INJ","METROGYL DG GEL 10 GRM","FEBRINIL 2ML INJ","TUSQ X 100ML SYP","ZIVAST 10 MG TAB","MOMEFLO NASAL SPRAY","HISTAC 300MG TAB","RENO-PRO HIGH PROTEIN VANILLA FLAV 200GM POWDER","VENUSIA 75GM CREAM","TAMDART TAB","BRAIN UP PINEAPPLE FLAV SUSP 150ML","AMLOSUN 5MG TAB","C QNEXT CAP","HEPLOCK 10ML","6IPZOCIN 30MG/1ML INJ","NUROKIND FAST STRIP 1'S","TORQ-SR 4MG CAP 30'S","RABEZ - D CAPS","TAZLOC 80MG TAB","LIFOGEM 200MG INJ","TRICIUM MAX TAB 15S","TASIGNA 150MG CAP","GAVISCON PEP LIQ 150ML","MELACARE 20GRM CREAM","KEYCEPT S 360MG TAB","DOXYMIZ SL CAP","TAPAL 100MG TAB","DIABEND - 40MG TAB","NUBLEXA 40 MG TAB 28'S","TAXOTERE 80 MG 2 ML INJ","FLUPETRA TAB","BISPEC 5MG TAB 15'S","DICLOPEP TAB","KABIPRO 400GM CREAMY VENILLA","XERINA 100 ML","CYPHOS 1GM INJ","BRIVIACT 75MG TAB 14'S","DOXOFLY 400MG TAB","GABAWIN 50MG TAB","ACITROM 2MG TAB 20'S","V&M 20MG TAB 15'S","WEPOX 5000 INJECTION 0.5ML","MOMATE - S 5GRM OINT","CALPOL (PEDIA )DROPS - 15ML","HEPLIST-400MG TAB","PREGEB FORTE 75MG CAP","DENTOGEL 15GM","STARPRESS - H 50MG XL TAB","ENSURE FOS(VANILA) 400G (ABBOTT)","MIMCIPAR 30MG TAB","MECONEURON OD 1500MCG TAB 15'S","UNIZID-TZ 1.125MG INJ","RESPIDON 2 MG TAB","COQ SUPPORT TAB","NURIVITA-OD SOFTGEL CAP 10'S","KERA XL HAIR GROWTH SERUM(60ML)","AMINO MIX 1000ML (P) (FRU)","BRYXTA 400MG/16ML INJ","CALCIUM FOLINATE 7.5MG INJ 15MG/2ML","ATARAX SYP - 100ML","MAXUM TAB 10'S","KET-AMINOS TAB","URSETOR 300 MG TAB","CQRA CAP","DISTACLOR CD 750MG TAB","ZEN RETARD 400 MG TAB","ERYKINE 40000 IU 1ML INJ *","STONE IB6 200ML SYP","GLIPI MET 500/50MG TAB.","TAZOTUM 1.125G INJ","AMBILIP 50MG INJ","TEAR 10 ML DROP","COMBINIB 250MG TAB","ROZAVEL - 10MG TAB","NEBISTAR 5MG TAB 15'S","COGNOXYN 200ML SYP","BIPACEF-500 TAB 10S","NOVO WHITE 50GM CREAM","CMXX 500MG TAB 10'S","HEAM UP - GEM 30'S CAP","TRAMACIP CAPS 10'S","DELCON PLUS 60 ML SYP","FONDAKEM 2.5MG/0.5ML INJ","GEN COLL 15GM COLLAGEN BASE","NEOSPORIN 5 GRM OINT","NITREST 10MG TAB","XIDORIN 2.5MG TAB 20S","INTAGESIC MR TAB","ENFIERA 100MG/10ML INJ","LIPIROSE F 10 TAB","MAHAMONT-L TAB","JALRA M 50/500MG TAB 10'S","ENOXION 20MG INJ","AZULIX 4MG TAB","ROSEDAY 40MG TAB","RASIN-DSR CAP 10'S","VOMIKIND-FAST STRIP PATCH","EPITHRA 50MG INJ","ACIPANT 40 INJ","BIFILAC LOZENGES 10'S","RESHAPE NATURAL TAB 10'S","TRILOSAR 12.5MG TAB","BETAGAN - 0.5% DROP","CROCIN SUSPENSION 60 ML","AZTRIC-80MG TAB","CLINDATEC 300MG CAPS.","OXIPLAT 100MG IV INJ","SUFRATE LA 30GM CREAM","DOXINATE TABLET","REFLORA 1GM SACHETS","HUMAN ALBUMIN 20% 50ML","DYCIPAR 30GM GEL","SEVLAREN-800MG TAB 10'S","CIFRAN I.V - 100ML INJ","ATEN H 25MG TAB","EUSOL 400ML SOLUTION (CENTRAL DRUGS)","SYSTAFLAM MR TAB","FOLITRAX 20MG/1ML INJ","BUFATAS 60 MG/10ML","MACORATE CR 200MG TAB","BISPEC 5MG TAB 15'S","NOVAPIME 1G INJ","BILAZO 20MG TAB 10'S","ADENOJECT INJ - 2ML**","EMCITABEN 1GM INJ","TELPRES CT 40/12.5MG TAB 15'S","OCUPOL DX 5ML DROPS","OXYTOCIN ING 2ML","REMMAG TAB","BETAFERON 0.25MG INJ","CLOCIP 15GRM CREAM","ALFAREN 200MG TAB","HEALON GV 1.4% 0.55ML","OROFER CAPS","ASTHALIN 100ML SYP","DOLONAT TAB","LOPEZ MD 1 10'S TAB","MELACYN GEL 50GM","HALOVATE F 10GM CREAM","LACOSAM 50 MG TABLET","FOLTOP-M CAP 10'S","GRANICIP 1MG TAB","DOTAMIN 5ML INJ","THYRONORM 12.5MCG CAPS","DILTIACT GEL 2% 30GM","PLACENTREX 100GM GEL","EYEVITAL CAPS","NS 0.9%W/V SODIUM CHLORIDE 3000ML (FRESENIUS)","CEFADROX 500MG TAB","GLYCOMET SR 850MG TAB","HDYSHIL 500MG CAP 10S","MAXIGARD 500MG INJ","BUDAMATE 200 INHALER","MEXATE 7.5MG TAB","GENTACOL EYE DROP","RINIFOL 60ML DRY SYP","CASIRIVIMAB / IMDEVIMAB COMBO PACK 2400MG (REGN-COV2)INJ","KUZET 3MIU INJ","PANTHE 5% GEL 5GM","HEALON GV 1.4% 0.55ML","DERMANEX CREAM 30GM","ALFAPIME TZ 2.25GM INJ","EFAVIR 200MG 30'S CAPS","INHALEX RESPULES 2ML","DEXALAB 2ML INJ","RX-PLUS CAP","TIMOLET GFS 0.5% 3ML EYE DRO","KABIMMUNE SACHETS - 15GM","JANUMET XR CP KIT 7's","BETALOC 5ML INJ","INSUPEN PRO+INSUGEN 30/70 REFIL INITIATION KIT","ENGERIX - B ADULTS INJ","ELOVERA IMF 50ML LOTION","CARTIKOOL XP TAB 10&apos;S","MINO QILIB 5 LOTION 60ML","METHYL PREDNISOLONE 1000MG INJ","MYOKRAMP TAB","TOPNERVE 500MCG/ML INJ","REMYLIN D 1000 IU TAB","ABITATE U 250MG TAB 120S","L-HIST TAB","ISOTROY 100ML LIQUID FOR INHALATION","FDSON MP TAB","THEOASTHALIN SR 4 MG TAB","TIGEPLUG 50MG INJ","SUFRATE LA 30GM CREAM","ETOPOGEN 100 MG INJ","MACRALFATE-O 200ML SUSP","CORTIMAX 30MG TAB","METOCARD XL 50MG TAB","PRESMOVAC 2MG TAB 10'S","SISONEXT 10GM CREAM","PHENOBARBITONE SODIUM 200MG/1ML INJ (VULCAN)","GUTPRO 2BILLION/5ML SYP 30ML","GTX 600MG INJ","ADDBACTAM 1GM INJ","MECONUS TAB 10`S","HYLCOBA 500MG INJ","CYCLOREG 5MGTAB","BACLOF 25MG TAB","PARAPIC-500 TAB","TRIOMUNE 30MG TAB","NANOPACLI 100 MG INJ","ALTAXEL - 100MG 16.7ML INJ","AMARYL M2 FORTE 2+1000 MG TAB","URLPLUS CAP","ATRAPURE 25MG/2.5ML INJ","PARACETAMOL 1 GM IV","PARACETAMOL 1000MG TAB","PARACETAMOL 100ML I.V","PARACETAMOL 2ML INJ","PARACETAMOL 30ML INJ","PARACETAMOL 500MG TAB","PARACETAMOL 500MG TAB (CADILA)"];export{Je as Augnito,f as AugnitoAPIServer,r as AugnitoCommands,he as AugnitoMobile,e as AugnitoSDKError,tt as Drug,Ze as DurationType,v as EditorType,ze as FactoryAPI,Ve as FormattingAPI,$e as Frequency,pe as MacrosAPI,Ye as MealsRelation,b as PhilipsMicMode,Qe as QuantityUnit,et as Route,We as VocabularyAPI};