From bae13a0a0e4dd3d5212e7c9991005759e4005ac4 Mon Sep 17 00:00:00 2001 From: "steven.roulleau" Date: Mon, 13 Dec 2021 15:13:56 +0100 Subject: [PATCH] chore: bump to 1.5.0 + changelog --- CHANGELOG.md | 18 +++ dist/iink.esm.js | 8 +- dist/iink.esm.js.map | 2 +- dist/iink.min.js | 8 +- dist/iink.min.js.map | 2 +- docs/Editor.html | 110 +++++++-------- docs/Editor.js.html | 60 +++++---- docs/EditorFacade.js.html | 7 +- docs/configuration_Constants.js.html | 5 +- docs/configuration_DefaultBehaviors.js.html | 2 +- ...configuration_DefaultConfiguration.js.html | 32 ++--- docs/configuration_DefaultPenStyle.js.html | 2 +- docs/configuration_DefaultTheme.js.html | 2 +- docs/configuration_LoggerConfig.js.html | 2 +- docs/eastereggs_InkImporter.js.html | 2 +- docs/event_Event.js.html | 2 +- docs/global.html | 52 ++++++-- docs/grabber_PointerEventGrabber.js.html | 8 +- docs/index.html | 2 +- docs/model_InkModel.js.html | 2 +- docs/model_RecognizerContext.js.html | 2 +- docs/model_StrokeComponent.js.html | 4 +- docs/model_Symbol.js.html | 2 +- docs/model_UndoRedoContext.js.html | 2 +- docs/model_UndoRedoManager.js.html | 2 +- docs/recognizer_CryptoHelper.js.html | 2 +- docs/recognizer_DefaultRecognizer.js.html | 2 +- docs/recognizer_RecognizerService.js.html | 4 +- ...recognizer_rest_iinkRestRecognizer.js.html | 2 +- docs/recognizer_rest_networkInterface.js.html | 2 +- docs/recognizer_websocket_WsBuilder.js.html | 12 +- ...ognizer_websocket_WsRecognizerUtil.js.html | 2 +- ...ognizer_websocket_iinkWsRecognizer.js.html | 2 +- ...nizer_websocket_networkWSInterface.js.html | 2 +- docs/renderer_QuadraticUtils.js.html | 2 +- docs/renderer_canvas_CanvasRenderer.js.html | 2 +- docs/renderer_canvas_ImageRenderer.js.html | 2 +- ...vas_stroker_QuadraticCanvasStroker.js.html | 2 +- ...s_symbols_MathSymbolCanvasRenderer.js.html | 2 +- ..._symbols_ShapeSymbolCanvasRenderer.js.html | 2 +- ...symbols_StrokeSymbolCanvasRenderer.js.html | 4 +- ...s_symbols_TextSymbolCanvasRenderer.js.html | 2 +- docs/renderer_svg_SVGRenderer.js.html | 2 +- ...er_svg_stroker_QuadraticSVGStroker.js.html | 2 +- ...vg_symbols_StrokeSymbolSVGRenderer.js.html | 2 +- docs/smartguide_SmartGuide.js.html | 125 +++++++++--------- docs/util_PromiseHelper.js.html | 2 +- package-lock.json | 70 +++++++++- package.json | 2 +- 49 files changed, 364 insertions(+), 229 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77403c87..b7ba6b64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,21 @@ +# [v1.5.1](https://github.com/MyScript/iinkJS/tree/v1.5.1) + +## Bug fix +@Editor +- fix change configuration restart websocket connection +- fix lost connection due to inactivity is now displayed +- fix style is wrapped by global class and can be customized + +@examples +- fix bad position of the searching highlight in searching text example +- new examples with eraser + +## Features +- erase mode is now an option in websocket text + +## Chore +- refactor of examples + # [v1.4.5](https://github.com/MyScript/iinkJS/tree/v1.4.5) ## Bug fix diff --git a/dist/iink.esm.js b/dist/iink.esm.js index cab76041..07de46ac 100644 --- a/dist/iink.esm.js +++ b/dist/iink.esm.js @@ -1,8 +1,8 @@ -var n,i;(n=window.document).getElementById("livereloadscript")||((i=n.createElement("script")).async=1,i.src="//"+(window.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",i.id="livereloadscript",n.getElementsByTagName("head")[0].appendChild(i));var a={EventType:{IDLE:"idle",CHANGED:"changed",IMPORTED:"imported",EXPORTED:"exported",CONVERTED:"converted",RENDERED:"rendered",LOADED:"loaded",UNDO:"undo",REDO:"redo",CLEAR:"clear",IMPORT:"import",SUPPORTED_IMPORT_MIMETYPES:"supportedImportMimeTypes",EXPORT:"export",CONVERT:"convert",ERROR:"error"},RecognitionType:{TEXT:"TEXT",MATH:"MATH",DIAGRAM:"DIAGRAM",RAWCONTENT:"Raw Content"},Protocol:{WEBSOCKET:"WEBSOCKET",REST:"REST"},ModelState:{INITIALIZING:"INITIALIZING",INITIALIZED:"INITIALIZED",EXPORTING:"EXPORTING",EXPORTED:"EXPORTED",PENDING:"PENDING",MODIFIED:"MODIFIED",ERROR:"ERROR"},Trigger:{QUIET_PERIOD:"QUIET_PERIOD",POINTER_UP:"POINTER_UP",DEMAND:"DEMAND"},Logger:{EDITOR:"editor",MODEL:"model",GRABBER:"grabber",RENDERER:"renderer",RECOGNIZER:"recognizer",EVENT:"event",UTIL:"util",SMARTGUIDE:"smartguide"},LogLevel:{TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},Languages:{zh_CN:"Noto Sans CJK tc",zh_HK:"Noto Sans CJK tc",zh_TW:"Noto Sans CJK tc",ko_KR:"Noto Sans CJK kr",ja_JP:"Noto Sans CJK jp",default:"Open Sans"},Error:{NOT_REACHABLE:"MyScript recognition server is not reachable. Please reload once you are connected.",WRONG_CREDENTIALS:"Application credentials are invalid. Please check or regenerate your application key and hmackey.",TOO_OLD:"Session is too old. Max Session Duration Reached.",NO_ACTIVITY:"Session closed due to no activity."},Exports:{JIIX:"application/vnd.myscript.jiix"}},s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function createCommonjsModule(n,i){return n(i={exports:{}},i.exports),i.exports}var c=createCommonjsModule((function(n){!function(i,a){n.exports?n.exports=a():i.log=a()}(s,(function(){var noop=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function bindMethod(n,i){var a=n[i];if("function"==typeof a.bind)return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch(i){return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function traceForIE(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function realMethod(a){return"debug"===a&&(a="log"),typeof console!==n&&("trace"===a&&i?traceForIE:void 0!==console[a]?bindMethod(console,a):void 0!==console.log?bindMethod(console,"log"):noop)}function replaceLoggingMethods(n,i){for(var s=0;s=0&&s<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+s;if(l=s,!1!==c&&function persistLevelIfPossible(i){var s=(a[i]||"silent").toUpperCase();if(typeof window!==n&&d){try{return void(window.localStorage[d]=s)}catch(n){}try{window.document.cookie=encodeURIComponent(d)+"="+s+";"}catch(n){}}}(s),replaceLoggingMethods.call(u,s,i),typeof console===n&&s-1},ListCache.prototype.set=function listCacheSet(n,i){var a=this.__data__,s=assocIndexOf(a,n);return s<0?(++this.size,a.push([n,i])):a[s][1]=i,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(J||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(n){var i=getMapData(this,n).delete(n);return this.size-=i?1:0,i},MapCache.prototype.get=function mapCacheGet(n){return getMapData(this,n).get(n)},MapCache.prototype.has=function mapCacheHas(n){return getMapData(this,n).has(n)},MapCache.prototype.set=function mapCacheSet(n,i){var a=getMapData(this,n),s=a.size;return a.set(n,i),this.size+=a.size==s?0:1,this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(n){var i=this.__data__,a=i.delete(n);return this.size=i.size,a},Stack.prototype.get=function stackGet(n){return this.__data__.get(n)},Stack.prototype.has=function stackHas(n){return this.__data__.has(n)},Stack.prototype.set=function stackSet(n,i){var a=this.__data__;if(a instanceof ListCache){var s=a.__data__;if(!J||s.length<199)return s.push([n,i]),this.size=++a.size,this;a=this.__data__=new MapCache(s)}return a.set(n,i),this.size=a.size,this};var Q=function createBaseFor(n){return function(i,a,s){for(var c=-1,l=Object(i),u=s(i),d=u.length;d--;){var p=u[n?d:++c];if(!1===a(l[p],p,l))break}return i}}();function baseGetTag(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":G&&G in Object(n)?function getRawTag(n){var i=R.call(n,G),a=n[G];try{n[G]=void 0;var s=!0}catch(n){}var c=A.call(n);s&&(i?n[G]=a:delete n[G]);return c}(n):function objectToString(n){return A.call(n)}(n)}function baseIsArguments(n){return isObjectLike(n)&&baseGetTag(n)==l}function baseIsNative(n){return!(!isObject(n)||function isMasked(n){return!!L&&L in n}(n))&&(isFunction(n)?j:p).test(function toSource(n){if(null!=n){try{return M.call(n)}catch(n){}try{return n+""}catch(n){}}return""}(n))}function baseKeysIn(n){if(!isObject(n))return function nativeKeysIn(n){var i=[];if(null!=n)for(var a in Object(n))i.push(a);return i}(n);var i=isPrototype(n),a=[];for(var s in n)("constructor"!=s||!i&&R.call(n,s))&&a.push(s);return a}function baseMerge(n,i,a,s,c){n!==i&&Q(i,(function(l,u){if(c||(c=new Stack),isObject(l))!function baseMergeDeep(n,i,a,s,c,l,u){var p=safeGet(n,a),h=safeGet(i,a),f=u.get(h);if(f)return void assignMergeValue(n,a,f);var g=l?l(p,h,a+"",n,i,u):void 0,m=void 0===g;if(m){var v=ne(h),y=!v&&re(h),b=!v&&!y&&oe(h);g=h,v||y||b?ne(p)?g=p:!function isArrayLikeObject(n){return isObjectLike(n)&&isArrayLike(n)}(p)?y?(m=!1,g=function cloneBuffer(n,i){if(i)return n.slice();var a=n.length,s=N?N(a):new n.constructor(a);return n.copy(s),s}(h,!0)):b?(m=!1,g=function cloneTypedArray(n,i){var a=i?function cloneArrayBuffer(n){var i=new n.constructor(n.byteLength);return new z(i).set(new z(n)),i}(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}(h,!0)):g=[]:g=function copyArray(n,i){var a=-1,s=n.length;i||(i=Array(s));for(;++a-1&&n%1==0&&n0){if(++i>=800)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Y?function(n,i){return Y(n,"toString",{configurable:!0,enumerable:!1,value:(a=i,function(){return a}),writable:!0});var a}:identity);function eq(n,i){return n===i||n!=n&&i!=i}var te=baseIsArguments(function(){return arguments}())?baseIsArguments:function(n){return isObjectLike(n)&&R.call(n,"callee")&&!H.call(n,"callee")},ne=Array.isArray;function isArrayLike(n){return null!=n&&isLength(n.length)&&!isFunction(n)}var re=$||function stubFalse(){return!1};function isFunction(n){if(!isObject(n))return!1;var i=baseGetTag(n);return i==u||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i}function isLength(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=c}function isObject(n){var i=typeof n;return null!=n&&("object"==i||"function"==i)}function isObjectLike(n){return null!=n&&"object"==typeof n}var oe=S?function baseUnary(n){return function(i){return n(i)}}(S):function baseIsTypedArray(n){return isObjectLike(n)&&isLength(n.length)&&!!f[baseGetTag(n)]};function keysIn(n){return isArrayLike(n)?arrayLikeKeys(n,!0):baseKeysIn(n)}var ie=function createAssigner(n){return baseRest((function(i,a){var s=-1,c=a.length,l=c>1?a[c-1]:void 0,u=c>2?a[2]:void 0;for(l=n.length>3&&"function"==typeof l?(c--,l):void 0,u&&function isIterateeCall(n,i,a){if(!isObject(a))return!1;var s=typeof i;if("number"==s?isArrayLike(a)&&isIndex(i,a.length):"string"==s&&i in a)return eq(a[i],n);return!1}(a[0],a[1],u)&&(l=c<3?void 0:l,c=1),i=Object(i);++s10?C[10]:C[i],Math.round(n*a)/a):n}function extractPoint(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=n;l.changedTouches&&(l=l.changedTouches[0]);var u=i.getBoundingClientRect();return{x:roundFloat(l.clientX-u.left-i.clientLeft-c,a.xyFloatPrecision),y:roundFloat(l.clientY-u.top-i.clientTop-s,a.xyFloatPrecision),t:roundFloat(Date.now(),a.timestampFloatPrecision)}}var k=function prevent(n){return n.preventDefault()};var P=Object.freeze({__proto__:null,attach:function attach$2(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=0;function unfocus(){"None"!==window.getSelection().type&&window.getSelection().removeAllRanges()}function hideMenu(n){var i=document.querySelector(".more-menu");return!(n.target.classList.contains("ellipsis")||n.target.classList.contains("more-menu")||n.target.classList.contains("options-label-button")||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function hideCandidates(n){var i=document.querySelector(".candidates");return!(n.target.classList.contains("candidates")||"SPAN"===n.target.tagName||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function pointerDownHandler(c){var l=c.target.id===i.domElement.id||c.target.classList.contains("ms-canvas");if(void 0!==this.activePointerId)this.activePointerId===c.pointerId&&p.trace("".concat(c.type," event with the same id without any pointer up"),c.pointerId);else if(2!==c.button&&2!==c.buttons&&l){if(!hideMenu(c)&&!hideCandidates(c)){this.activePointerId=c.pointerId;var u=c.pointerId>2147483647?-1:c.pointerId;unfocus(),c.stopPropagation();var d=c.pointerType;i.isErasing&&(d="ERASER"),i.pointerDown(extractPoint(c,n,i.configuration,a,s),d,u)}}else c.target.classList.contains("ellipsis")||c.target.classList.contains("tag-icon")?(hideMenu(c),hideCandidates(c)):(hideMenu(c),hideCandidates(c),this.smartGuidePointerDown=!0,this.downSmartGuidePoint=extractPoint(c,n,i.configuration))}function pointerMoveHandler(l){if(void 0!==this.activePointerId&&this.activePointerId===l.pointerId)unfocus(),i.pointerMove(extractPoint(l,n,i.configuration,a,s));else if(this.smartGuidePointerDown){var u=extractPoint(l,n,i.configuration,a,s),d=Math.abs(this.downSmartGuidePoint.x-u.x),h=Math.abs(this.downSmartGuidePoint.y-u.y);if(c=Math.max(d,c),d<5&&h>5&&c<15||d>5&&h>5&&c<15){this.activePointerId=l.pointerId;var f=l.pointerId>2147483647?-1:l.pointerId;unfocus(),i.pointerDown(this.downSmartGuidePoint,l.pointerType,f)}}else p.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}function pointerUpHandler(l){c=0,this.smartGuidePointerDown=!1;var u=["smartguide","prompter-text-container","prompter-text","tag-icon","ellipsis"],d=["ps__rail-x","ps__thumb-x"],h=l.relatedTarget&&(u.includes(l.relatedTarget.className)||d.includes(l.relatedTarget.className)),f=l.relatedTarget&&l.target&&(u.includes(l.target.className)||d.includes(l.target.className)),g=l.relatedTarget&&l.target&&("SPAN"===l.target.tagName||"SPAN"===l.relatedTarget.tagName);h||f||g?l.stopPropagation():void 0!==this.activePointerId&&this.activePointerId===l.pointerId?(this.activePointerId=void 0,l.stopPropagation(),i.pointerUp(extractPoint(l,n,i.configuration,a,s))):p.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}var l={options:i.configuration.listenerOptions,listeners:[{types:["pointerdown"],listener:pointerDownHandler},{types:["pointermove"],listener:pointerMoveHandler},{types:["pointerup","pointerout","pointerleave","pointercancel"],listener:pointerUpHandler}]};return p.debug("attaching listeners",l),l.listeners.forEach((function(i){i.types.forEach((function(a){return n.addEventListener(a,i.listener,l.options)}))})),n.addEventListener("touchmove",k),document.documentElement.addEventListener("pointerdown",(function(){})),l},detach:function detach$2(n,i){p.debug("detaching listeners",i),i.listeners.forEach((function(a){a.types.forEach((function(s){return n.removeEventListener(s,a.listener,i.options)}))})),n.removeEventListener("touchmove",k),document.documentElement.removeEventListener("pointerdown",(function(){}))}}),I=createCommonjsModule((function(n){n.exports=function _arrayLikeToArray(n,i){(null==i||i>n.length)&&(i=n.length);for(var a=0,s=new Array(i);a=l||Math.abs(s[s.length-1]-i)>=l)&&(u=!0),u}(i.x,i.y,a.x,a.y,a.width)?d.trace("ignore filtered point",i):(a.x.push(i.x),a.y.push(i.y),a.t.push(i.t),a.p.push(function computePressure(n,i,a,s,c,l){var u=1,d=computeDistance(n,i,a,s,l),p=computeLength(n,i,a,s,c,l);0===p?u=.5:d===p?u=1:d<10?u=.2+Math.pow(.1*d,.4):d>p-10&&(u=.2+Math.pow(.1*(p-d),.4));var h=u*Math.max(.1,1-.1*Math.sqrt(d));return isNaN(parseFloat(h))?.5:h}(i.x,i.y,a.x,a.y,a.l,a.x.length-1)),a.l.push(computeLength(i.x,i.y,a.x,a.y,a.l,a.x.length-1))),a}function slice(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.x.length,s=createStrokeComponent({color:n.color,width:n.width}),c=i;c=0&&i1&&void 0!==arguments[1]?arguments[1]:{minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE},a=i;return a=n.filter((function(n){return"stroke"===n.type})).map(getStrokeBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"clef"===n.type})).map(getClefBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"line"===n.type})).map(getLineBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"ellipse"===n.type})).map(getEllipseBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"textLine"===n.type})).map(getTextLineBounds).reduce(mergeBounds,a)}function createModel(n){return{currentStroke:void 0,rawStrokes:[],strokeGroups:[],lastPositions:{lastSentPosition:-1,lastReceivedPosition:-1,lastRenderedPosition:-1},defaultSymbols:[],recognizedSymbols:void 0,exports:void 0,rawResults:{convert:void 0,exports:void 0},creationTime:(new Date).getTime(),modificationTime:void 0}}function clearModel(n){var i=n;return i.currentStroke=void 0,i.rawStrokes=[],i.strokeGroups=[],i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i.lastPositions.lastRenderedPosition=-1,i.recognizedSymbols=void 0,i.exports=void 0,i.rawResults.convert=void 0,i.rawResults.exports=void 0,i}function needRedraw(n){return!!n.recognizedSymbols&&n.rawStrokes.length!==n.recognizedSymbols.filter((function(n){return"stroke"===n.type})).length}function addStroke(n,i){var a=n;return d.debug("addStroke",i),a.rawStrokes.push(i),a}function addStrokeToGroup(n,i,a){var s=n;d.debug("addStroke",i);var c=s.strokeGroups.length-1;if(s.strokeGroups[c]&&s.strokeGroups[c].penStyle===a)s.strokeGroups[c].strokes.push(i);else{var l={penStyle:a,strokes:[]},u={};Object.assign(u,i),l.strokes.push(u),s.strokeGroups.push(l)}return s}function extractPendingStrokes(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastReceivedPosition+1;return n.rawStrokes.slice(i)}function initPendingStroke(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:96;if(a&&a["-myscript-pen-width"]){var c=a["-myscript-pen-width"]*s/25.4;Object.assign(a,{width:c/2})}var l=n;return d.trace("initPendingStroke",i),l.currentStroke=createStrokeComponent(a),l.currentStroke=addPoint(l.currentStroke,i),l}function appendToPendingStroke(n,i){var a=n;return a.currentStroke&&(d.trace("appendToPendingStroke",i),a.currentStroke=addPoint(a.currentStroke,i)),a}function endPendingStroke(n,i,a){var s=n;if(s.currentStroke){d.trace("endPendingStroke",i);var c=addPoint(s.currentStroke,i);addStroke(s,c),addStrokeToGroup(s,c,a),delete s.currentStroke}return s}function getBorderCoordinates(n){var i={minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE};return n.defaultSymbols&&n.defaultSymbols.length>0&&(i=getSymbolsBounds(n.defaultSymbols,i)),n.recognizedSymbols&&n.recognizedSymbols.length>0?(i=getSymbolsBounds(n.recognizedSymbols,i),i=getSymbolsBounds(extractPendingStrokes(n),i)):i=getSymbolsBounds(n.rawStrokes,i),i}function updateModelSentPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.rawStrokes.length-1,a=n;return a.lastPositions.lastSentPosition=i,a}function updateModelReceivedPosition(n){var i=n;return i.lastPositions.lastReceivedPosition=i.lastPositions.lastSentPosition,i}function resetModelPositions(n){var i=n;return i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i}function updateModelRenderedPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.recognizedSymbols?n.recognizedSymbols.length-1:-1,a=n;return a.lastPositions.lastRenderedPosition=i,a}function extractPendingRecognizedSymbols(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastRenderedPosition+1;return n.recognizedSymbols?n.recognizedSymbols.slice(i):[]}function cloneModel(n){var i=Object.assign({},n);return i.defaultSymbols=A(n.defaultSymbols),i.currentStroke=n.currentStroke?Object.assign({},n.currentStroke):void 0,i.rawStrokes=A(n.rawStrokes),i.strokeGroups=JSON.parse(JSON.stringify(n.strokeGroups)),i.lastPositions=Object.assign({},n.lastPositions),i.exports=n.exports?Object.assign({},n.exports):void 0,i.rawResults=Object.assign({},n.rawResults),i.recognizedSymbols=n.recognizedSymbols?A(n.recognizedSymbols):void 0,i}function mergeModels(){for(var n=arguments.length,i=new Array(n),a=0;a1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;h.debug("attach renderer",n);var s=detectPixelRatio(),c=createCanvas$1(n,"ms-rendering-canvas"),l=createCanvas$1(n,"ms-capture-canvas"),u={pixelRatio:s,minHeight:i,minWidth:a,renderingCanvas:c,renderingCanvasContext:c.getContext("2d"),capturingCanvas:l,capturingCanvasContext:l.getContext("2d")};return resizeContent(u)},detach:function detach$1(n,i){h.debug("detach renderer",n),n.removeChild(i.renderingCanvas),n.removeChild(i.capturingCanvas)},resize:function resize$4(n,i,a){return this.drawModel(resizeContent(n),i,a)},drawCurrentStroke:function drawCurrentStroke$1(n,i,a){return n.capturingCanvasContext.clearRect(0,0,n.capturingCanvas.width,n.capturingCanvas.height),h.trace("drawing current stroke ",i.currentStroke),drawStroke$3(n.capturingCanvasContext,i.currentStroke,a),i},drawModel:drawModel$1});function computeLinksPoints(n,i,a){var s=n.p*a;return[{x:n.x-Math.sin(i)*s,y:n.y+Math.cos(i)*s},{x:n.x+Math.sin(i)*s,y:n.y-Math.cos(i)*s}]}function computeMiddlePoint(n,i){return{x:(i.x+n.x)/2,y:(i.y+n.y)/2,p:(i.p+n.p)/2}}function computeAxeAngle(n,i){return Math.atan2(i.y-n.y,i.x-n.x)}function renderArc$1(n,i,a){n.arc(i.x,i.y,a,0,2*Math.PI,!0)}function renderLine$1(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);n.moveTo(c[0].x,c[0].y),n.lineTo(l[0].x,l[0].y),n.lineTo(l[1].x,l[1].y),n.lineTo(c[1].x,c[1].y)}function renderQuadratic$1(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);n.moveTo(l[0].x,l[0].y),n.quadraticCurveTo(d[0].x,d[0].y,u[0].x,u[0].y),n.lineTo(u[1].x,u[1].y),n.quadraticCurveTo(d[1].x,d[1].y,l[1].x,l[1].y)}var z=Object.freeze({__proto__:null,getInfo:function getInfo$4(){return{type:"canvas",name:"quadratic"}},drawStroke:function drawStroke$2(n,i){var a=n,s=i.x.length,c=i.width>0?i.width:a.lineWidth,l=i.color?i.color:a.strokeStyle,u=getPointByIndex(i,0),d=s-2;a.save();try{if(a.beginPath(),s<3)renderArc$1(a,u,.6*c);else{renderArc$1(a,u,c*u.p),renderLine$1(a,u,computeMiddlePoint(u,getPointByIndex(i,1)),c);for(var p=0;p=0&&"xmlns"!==(i=n.slice(0,a))&&(n=n.slice(a+1)),W.hasOwnProperty(i)?{space:W[i],local:n}:n}function creatorInherit(n){return function(){var i=this.ownerDocument,a=this.namespaceURI;return a===N&&i.documentElement.namespaceURI===N?i.createElement(n):i.createElementNS(a,n)}}function creatorFixed(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function creator(n){var i=namespace(n);return(i.local?creatorFixed:creatorInherit)(i)}function none(){}function selector(n){return null==n?none:function(){return this.querySelector(n)}}function empty(){return[]}function sparse(n){return new Array(n.length)}function EnterNode(n,i){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=i}EnterNode.prototype={constructor:EnterNode,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,i){return this._parent.insertBefore(n,i)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function bindIndex(n,i,a,s,c,l){for(var u,d=0,p=i.length,h=l.length;di?1:n>=i?0:NaN}function attrRemove(n){return function(){this.removeAttribute(n)}}function attrRemoveNS(n){return function(){this.removeAttributeNS(n.space,n.local)}}function attrConstant(n,i){return function(){this.setAttribute(n,i)}}function attrConstantNS(n,i){return function(){this.setAttributeNS(n.space,n.local,i)}}function attrFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttribute(n):this.setAttribute(n,a)}}function attrFunctionNS(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,a)}}function defaultView(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function styleRemove(n){return function(){this.style.removeProperty(n)}}function styleConstant(n,i,a){return function(){this.style.setProperty(n,i,a)}}function styleFunction(n,i,a){return function(){var s=i.apply(this,arguments);null==s?this.style.removeProperty(n):this.style.setProperty(n,s,a)}}function styleValue(n,i){return n.style.getPropertyValue(i)||defaultView(n).getComputedStyle(n,null).getPropertyValue(i)}function propertyRemove(n){return function(){delete this[n]}}function propertyConstant(n,i){return function(){this[n]=i}}function propertyFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?delete this[n]:this[n]=a}}function classArray(n){return n.trim().split(/^|\s+/)}function classList(n){return n.classList||new ClassList(n)}function ClassList(n){this._node=n,this._names=classArray(n.getAttribute("class")||"")}function classedAdd(n,i){for(var a=classList(n),s=-1,c=i.length;++s=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var X={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(X={mouseenter:"mouseover",mouseleave:"mouseout"}));function filterContextListener(n,i,a){return n=contextListener(n,i,a),function(i){var a=i.relatedTarget;a&&(a===this||8&a.compareDocumentPosition(this))||n.call(this,i)}}function contextListener(n,i,a){return function(s){try{n.call(this,this.__data__,i,a)}finally{}}}function parseTypenames(n){return n.trim().split(/^|\s+/).map((function(n){var i="",a=n.indexOf(".");return a>=0&&(i=n.slice(a+1),n=n.slice(0,a)),{type:n,name:i}}))}function onRemove(n){return function(){var i=this.__on;if(i){for(var a,s=0,c=-1,l=i.length;s=C&&(C=S+1);!(_=x[C])&&++C=0;)(s=c[l])&&(u&&4^s.compareDocumentPosition(u)&&u.parentNode.insertBefore(s,u),u=s);return this},sort:function selection_sort(n){function compareNode(i,a){return i&&a?n(i.__data__,a.__data__):!i-!a}n||(n=ascending);for(var i=this._groups,a=i.length,s=new Array(a),c=0;c1?this.each((null==i?styleRemove:"function"==typeof i?styleFunction:styleConstant)(n,i,null==a?"":a)):styleValue(this.node(),n)},property:function selection_property(n,i){return arguments.length>1?this.each((null==i?propertyRemove:"function"==typeof i?propertyFunction:propertyConstant)(n,i)):this.node()[n]},classed:function selection_classed(n,i){var a=classArray(n+"");if(arguments.length<2){for(var s=classList(this.node()),c=-1,l=a.length;++c *:nth-child(").concat(a.index+1,")")).remove();break;case"APPEND_CHILD":var u=n.select(a.parentId?"#".concat(a.parentId):s).node();u.insertAdjacentHTML?u.insertAdjacentHTML("beforeEnd",a.svg):(insertAdjacentSVG(u,"beforeEnd",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"INSERT_BEFORE":var d=n.select("#".concat(a.refId)).node();d.insertAdjacentHTML?d.insertAdjacentHTML("beforeBegin",a.svg):(insertAdjacentSVG(d,"beforeBegin",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"REMOVE_ATTRIBUTE":n.selectAll(a.id?"#".concat(a.id):"svg").attr(a.name,null);break;case"SET_ATTRIBUTE":a.id&&n.selectAll("#".concat(a.id)).attr(a.name,a.value);break;default:h.debug("unknown update ".concat(a.type," action"))}}catch(n){h.error("Invalid update ".concat(a.type),a),h.error("Error on svg patch",n)}}))}(i)})),updateModelRenderedPosition(i));var c=extractPendingStrokes(i);return c&&c.forEach((function(i){return function drawSymbol(n,i){h.trace("attempting to draw ".concat(n.type," symbol")),"stroke"!==n.type||i.select("id",n.id)?h.warn("impossible to draw ".concat(n.type," symbol")):drawStroke$1(i.append("path").attr("id",n.id),n,a)}(i,n.select("#pendingStrokes"))})),i}});function renderArc(n,i,a){return["M ".concat(i.x,",").concat(i.y),"m ".concat(-a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(2*a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(-2*a,",0")].join(" ")}function renderLine(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);return["M ".concat(c[0].x,",").concat(c[0].y),"L ".concat(l[0].x,",").concat(l[0].y),"L ".concat(l[1].x,",").concat(l[1].y),"L ".concat(c[1].x,",").concat(c[1].y)].join(" ")}function renderQuadratic(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);return["M ".concat(l[0].x,",").concat(l[0].y),"Q ".concat(d[0].x,",").concat(d[0].y," ").concat(u[0].x,",").concat(u[0].y),"L ".concat(u[1].x,",").concat(u[1].y),"Q ".concat(d[1].x,",").concat(d[1].y," ").concat(l[1].x,",").concat(l[1].y)].join(" ")}var G=Object.freeze({__proto__:null,getInfo:function getInfo$2(){return{type:"svg",name:"quadratic"}},drawStroke:function drawStroke(n,i){var a=i.x.length,s=i.width,c=getPointByIndex(i,0),l=a-2,u=[];if(a<3)u.push(renderArc(0,c,.6*s));else{u.push(renderArc(0,c,s*c.p)),u.push(renderLine(0,c,computeMiddlePoint(c,getPointByIndex(i,1)),s));for(var d=0;d=0;--c){var l=this.tryEntries[c],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var d=s.call(l,"catchLoc"),p=s.call(l,"finallyLoc");if(d&&p){if(this.prev=0;--a){var c=this.tryEntries[a];if(c.tryLoc<=this.prev&&s.call(c,"finallyLoc")&&this.prev=0;--i){var a=this.tryEntries[i];if(a.finallyLoc===n)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),m}},catch:function(n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc===n){var s=a.completion;if("throw"===s.type){var c=s.arg;resetTryEntry(a)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(n,a,s){return this.delegate={iterator:values(n),resultName:a,nextLoc:s},"next"===this.method&&(this.arg=i),m}},n}(n.exports);try{regeneratorRuntime=i}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}})),V=$,q=createCommonjsModule((function(n){function _typeof(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(n.exports=_typeof=function _typeof(n){return typeof n},n.exports.default=n.exports,n.exports.__esModule=!0):(n.exports=_typeof=function _typeof(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},n.exports.default=n.exports,n.exports.__esModule=!0),_typeof(i)}n.exports=_typeof,n.exports.default=n.exports,n.exports.__esModule=!0})),J=unwrapExports(q),K=createCommonjsModule((function(n,i){var a;n.exports=(a=a||function(n,i){var a=Object.create||function(){function F(){}return function(n){var i;return F.prototype=n,i=new F,F.prototype=null,i}}(),s={},c=s.lib={},l=c.Base={extend:function(n){var i=a(this);return n&&i.mixIn(n),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}},u=c.WordArray=l.extend({init:function(n,a){n=this.words=n||[],this.sigBytes=a!=i?a:4*n.length},toString:function(n){return(n||p).stringify(this)},concat:function(n){var i=this.words,a=n.words,s=this.sigBytes,c=n.sigBytes;if(this.clamp(),s%4)for(var l=0;l>>2]>>>24-l%4*8&255;i[s+l>>>2]|=u<<24-(s+l)%4*8}else for(l=0;l>>2]=a[l>>>2];return this.sigBytes+=c,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=n.ceil(a/4)},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(i){for(var a,s=[],r=function(i){i=i;var a=987654321,s=4294967295;return function(){var c=((a=36969*(65535&a)+(a>>16)&s)<<16)+(i=18e3*(65535&i)+(i>>16)&s)&s;return c/=4294967296,(c+=.5)*(n.random()>.5?1:-1)}},c=0;c>>2]>>>24-c%4*8&255;s.push((l>>>4).toString(16)),s.push((15&l).toString(16))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>3]|=parseInt(n.substr(s,2),16)<<24-s%8*4;return new u.init(a,i/2)}},h=d.Latin1={stringify:function(n){for(var i=n.words,a=n.sigBytes,s=[],c=0;c>>2]>>>24-c%4*8&255;s.push(String.fromCharCode(l))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>2]|=(255&n.charCodeAt(s))<<24-s%4*8;return new u.init(a,i)}},f=d.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},g=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(n){"string"==typeof n&&(n=f.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(i){var a=this._data,s=a.words,c=a.sigBytes,l=this.blockSize,d=c/(4*l),p=(d=i?n.ceil(d):n.max((0|d)-this._minBufferSize,0))*l,h=n.min(4*p,c);if(p){for(var f=0;f>>1|re<<31)^(ne>>>8|re<<24)^ne>>>7,ie=(re>>>1|ne<<31)^(re>>>8|ne<<24)^(re>>>7|ne<<25),ae=p[K-2],se=ae.high,ce=ae.low,le=(se>>>19|ce<<13)^(se<<3|ce>>>29)^se>>>6,ue=(ce>>>19|se<<13)^(ce<<3|se>>>29)^(ce>>>6|se<<26),de=p[K-7],pe=de.high,he=de.low,fe=p[K-16],ge=fe.high,me=fe.low;Q=(Q=(Q=oe+pe+((ee=ie+he)>>>0>>0?1:0))+le+((ee+=ue)>>>0>>0?1:0))+ge+((ee+=me)>>>0>>0?1:0),Z.high=Q,Z.low=ee}var ve,ye=H&G^~H&$,be=B&Y^~B&V,xe=D&U^D&z^U&z,we=j&O^j&N^O&N,Ee=(D>>>28|j<<4)^(D<<30|j>>>2)^(D<<25|j>>>7),_e=(j>>>28|D<<4)^(j<<30|D>>>2)^(j<<25|D>>>7),Se=(H>>>14|B<<18)^(H>>>18|B<<14)^(H<<23|B>>>9),Ce=(B>>>14|H<<18)^(B>>>18|H<<14)^(B<<23|H>>>9),ke=d[K],Pe=ke.high,Ie=ke.low,Te=q+Se+((ve=J+Ce)>>>0>>0?1:0),Me=_e+we;q=$,J=V,$=G,V=Y,G=H,Y=B,H=W+(Te=(Te=(Te=Te+ye+((ve+=be)>>>0>>0?1:0))+Pe+((ve+=Ie)>>>0>>0?1:0))+Q+((ve+=ee)>>>0>>0?1:0))+((B=X+ve|0)>>>0>>0?1:0)|0,W=z,X=N,z=U,N=O,U=D,O=j,D=Te+(Ee+xe+(Me>>>0<_e>>>0?1:0))+((j=ve+Me|0)>>>0>>0?1:0)|0}y=s.low=y+j,s.high=v+D+(y>>>0>>0?1:0),x=c.low=x+O,c.high=b+U+(x>>>0>>0?1:0),_=l.low=_+N,l.high=w+z+(_>>>0>>0?1:0),C=u.low=C+X,u.high=S+W+(C>>>0>>0?1:0),P=h.low=P+B,h.high=k+H+(P>>>0>>0?1:0),T=f.low=T+Y,f.high=I+G+(T>>>0>>0?1:0),R=g.low=R+V,g.high=M+$+(R>>>0>>0?1:0),A=m.low=A+J,m.high=L+q+(A>>>0>>0?1:0)},_doFinalize:function(){var n=this._data,i=n.words,a=8*this._nDataBytes,s=8*n.sigBytes;return i[s>>>5]|=128<<24-s%32,i[30+(s+128>>>10<<5)]=Math.floor(a/4294967296),i[31+(s+128>>>10<<5)]=a,n.sigBytes=4*i.length,this._process(),this._hash.toX32()},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n},blockSize:32});n.SHA512=i._createHelper(h),n.HmacSHA512=i._createHmacHelper(h)}(),a.SHA512)})),createCommonjsModule((function(n,i){var a,s,c;n.exports=(s=(a=K).lib.Base,c=a.enc.Utf8,void(a.algo.HMAC=s.extend({init:function(n,i){n=this._hasher=new n.init,"string"==typeof i&&(i=c.parse(i));var a=n.blockSize,s=4*a;i.sigBytes>s&&(i=n.finalize(i)),i.clamp();for(var l=this._oKey=i.clone(),u=this._iKey=i.clone(),d=l.words,p=u.words,h=0;h=i.rawStrokes.length-1}function updateRecognitionPositions(n,i){var a=n;return i&&(a.lastPositions.lastSentPosition=i.lastSentPosition,a.lastPositions.lastReceivedPosition=i.lastReceivedPosition),a.lastPositions.lastSentPosition===a.lastPositions.lastReceivedPosition===-1&&delete a.instanceId,a}function setRecognitionContext(n,i){var a=n;return a.recognitionContexts[0]=i,a}function canReconnect(n){return!0===n.websocket.autoReconnect&&n.currentReconnectionCount<=n.websocket.maxRetryCount}function shouldAttemptImmediateReconnect(n){var i=n;return!0===i.websocket.autoReconnect&&i.currentReconnectionCount++<=i.websocket.maxRetryCount}var ee={type:"LOST_CONNECTION"},te=Object.freeze({__proto__:null,createEmptyRecognizerContext:createEmptyRecognizerContext,isResetRequired:isResetRequired,updateRecognitionPositions:updateRecognitionPositions,setRecognitionContext:setRecognitionContext,canReconnect:canReconnect,shouldAttemptImmediateReconnect:shouldAttemptImmediateReconnect,LOST_CONNEXION_MESSAGE:ee,CLOSE_RECOGNIZER_MESSAGE:"CLOSE_RECOGNIZER"}); +var n={EventType:{IDLE:"idle",CHANGED:"changed",IMPORTED:"imported",EXPORTED:"exported",CONVERTED:"converted",RENDERED:"rendered",LOADED:"loaded",UNDO:"undo",REDO:"redo",CLEAR:"clear",IMPORT:"import",SUPPORTED_IMPORT_MIMETYPES:"supportedImportMimeTypes",EXPORT:"export",CONVERT:"convert",ERROR:"error"},RecognitionType:{TEXT:"TEXT",MATH:"MATH",DIAGRAM:"DIAGRAM",RAWCONTENT:"Raw Content"},Protocol:{WEBSOCKET:"WEBSOCKET",REST:"REST"},ModelState:{INITIALIZING:"INITIALIZING",INITIALIZED:"INITIALIZED",EXPORTING:"EXPORTING",EXPORTED:"EXPORTED",PENDING:"PENDING",MODIFIED:"MODIFIED",ERROR:"ERROR"},Trigger:{QUIET_PERIOD:"QUIET_PERIOD",POINTER_UP:"POINTER_UP",DEMAND:"DEMAND"},Logger:{EDITOR:"editor",MODEL:"model",GRABBER:"grabber",RENDERER:"renderer",RECOGNIZER:"recognizer",EVENT:"event",UTIL:"util",SMARTGUIDE:"smartguide"},LogLevel:{TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},Languages:{zh_CN:"Noto Sans CJK tc",zh_HK:"Noto Sans CJK tc",zh_TW:"Noto Sans CJK tc",ko_KR:"Noto Sans CJK kr",ja_JP:"Noto Sans CJK jp",default:"Open Sans"},Error:{NOT_REACHABLE:"MyScript recognition server is not reachable. Please reload once you are connected.",WRONG_CREDENTIALS:"Application credentials are invalid. Please check or regenerate your application key and hmackey.",TOO_OLD:"Session is too old. Max Session Duration Reached.",NO_ACTIVITY:"Session closed due to no activity."},Exports:{JIIX:"application/vnd.myscript.jiix"}},i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function createCommonjsModule(n,i){return n(i={exports:{}},i.exports),i.exports}var a=(0,createCommonjsModule((function(n){!function(i,a){n.exports?n.exports=a():i.log=a()}(i,(function(){var noop=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function bindMethod(n,i){var a=n[i];if("function"==typeof a.bind)return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch(i){return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function traceForIE(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function realMethod(a){return"debug"===a&&(a="log"),typeof console!==n&&("trace"===a&&i?traceForIE:void 0!==console[a]?bindMethod(console,a):void 0!==console.log?bindMethod(console,"log"):noop)}function replaceLoggingMethods(n,i){for(var s=0;s=0&&s<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+s;if(l=s,!1!==c&&function persistLevelIfPossible(i){var s=(a[i]||"silent").toUpperCase();if(typeof window!==n){try{return void(window.localStorage[d]=s)}catch(n){}try{window.document.cookie=encodeURIComponent(d)+"="+s+";"}catch(n){}}}(s),replaceLoggingMethods.call(u,s,i),typeof console===n&&s-1},ListCache.prototype.set=function listCacheSet(n,i){var a=this.__data__,s=assocIndexOf(a,n);return s<0?(++this.size,a.push([n,i])):a[s][1]=i,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(K||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(n){var i=getMapData(this,n).delete(n);return this.size-=i?1:0,i},MapCache.prototype.get=function mapCacheGet(n){return getMapData(this,n).get(n)},MapCache.prototype.has=function mapCacheHas(n){return getMapData(this,n).has(n)},MapCache.prototype.set=function mapCacheSet(n,i){var a=getMapData(this,n),s=a.size;return a.set(n,i),this.size+=a.size==s?0:1,this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(n){var i=this.__data__,a=i.delete(n);return this.size=i.size,a},Stack.prototype.get=function stackGet(n){return this.__data__.get(n)},Stack.prototype.has=function stackHas(n){return this.__data__.has(n)},Stack.prototype.set=function stackSet(n,i){var a=this.__data__;if(a instanceof ListCache){var s=a.__data__;if(!K||s.length<199)return s.push([n,i]),this.size=++a.size,this;a=this.__data__=new MapCache(s)}return a.set(n,i),this.size=a.size,this};var Q=function createBaseFor(n){return function(i,a,s){for(var c=-1,l=Object(i),u=s(i),d=u.length;d--;){var p=u[n?d:++c];if(!1===a(l[p],p,l))break}return i}}();function baseGetTag(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":G&&G in Object(n)?function getRawTag(n){var i=R.call(n,G),a=n[G];try{n[G]=void 0;var s=!0}catch(n){}var c=A.call(n);s&&(i?n[G]=a:delete n[G]);return c}(n):function objectToString(n){return A.call(n)}(n)}function baseIsArguments(n){return isObjectLike(n)&&baseGetTag(n)==l}function baseIsNative(n){return!(!isObject(n)||function isMasked(n){return!!L&&L in n}(n))&&(isFunction(n)?j:p).test(function toSource(n){if(null!=n){try{return M.call(n)}catch(n){}try{return n+""}catch(n){}}return""}(n))}function baseKeysIn(n){if(!isObject(n))return function nativeKeysIn(n){var i=[];if(null!=n)for(var a in Object(n))i.push(a);return i}(n);var i=isPrototype(n),a=[];for(var s in n)("constructor"!=s||!i&&R.call(n,s))&&a.push(s);return a}function baseMerge(n,i,a,s,c){n!==i&&Q(i,(function(l,u){if(c||(c=new Stack),isObject(l))!function baseMergeDeep(n,i,a,s,c,l,u){var p=safeGet(n,a),h=safeGet(i,a),f=u.get(h);if(f)return void assignMergeValue(n,a,f);var g=l?l(p,h,a+"",n,i,u):void 0,m=void 0===g;if(m){var v=ne(h),y=!v&&re(h),b=!v&&!y&&oe(h);g=h,v||y||b?ne(p)?g=p:!function isArrayLikeObject(n){return isObjectLike(n)&&isArrayLike(n)}(p)?y?(m=!1,g=function cloneBuffer(n,i){if(i)return n.slice();var a=n.length,s=N?N(a):new n.constructor(a);return n.copy(s),s}(h,!0)):b?(m=!1,g=function cloneTypedArray(n,i){var a=i?function cloneArrayBuffer(n){var i=new n.constructor(n.byteLength);return new z(i).set(new z(n)),i}(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}(h,!0)):g=[]:g=function copyArray(n,i){var a=-1,s=n.length;i||(i=Array(s));for(;++a-1&&n%1==0&&n0){if(++i>=800)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Y?function(n,i){return Y(n,"toString",{configurable:!0,enumerable:!1,value:(a=i,function(){return a}),writable:!0});var a}:identity);function eq(n,i){return n===i||n!=n&&i!=i}var te=baseIsArguments(function(){return arguments}())?baseIsArguments:function(n){return isObjectLike(n)&&R.call(n,"callee")&&!H.call(n,"callee")},ne=Array.isArray;function isArrayLike(n){return null!=n&&isLength(n.length)&&!isFunction(n)}var re=$||function stubFalse(){return!1};function isFunction(n){if(!isObject(n))return!1;var i=baseGetTag(n);return i==u||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i}function isLength(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=c}function isObject(n){var i=typeof n;return null!=n&&("object"==i||"function"==i)}function isObjectLike(n){return null!=n&&"object"==typeof n}var oe=S?function baseUnary(n){return function(i){return n(i)}}(S):function baseIsTypedArray(n){return isObjectLike(n)&&isLength(n.length)&&!!f[baseGetTag(n)]};function keysIn(n){return isArrayLike(n)?arrayLikeKeys(n,!0):baseKeysIn(n)}var ie=function createAssigner(n){return baseRest((function(i,a){var s=-1,c=a.length,l=c>1?a[c-1]:void 0,u=c>2?a[2]:void 0;for(l=n.length>3&&"function"==typeof l?(c--,l):void 0,u&&function isIterateeCall(n,i,a){if(!isObject(a))return!1;var s=typeof i;if("number"==s?isArrayLike(a)&&isIndex(i,a.length):"string"==s&&i in a)return eq(a[i],n);return!1}(a[0],a[1],u)&&(l=c<3?void 0:l,c=1),i=Object(i);++s10?w[10]:w[i],Math.round(n*a)/a):n}function extractPoint(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=n;l.changedTouches&&(l=l.changedTouches[0]);var u=i.getBoundingClientRect();return{x:roundFloat(l.clientX-u.left-i.clientLeft-c,a.xyFloatPrecision),y:roundFloat(l.clientY-u.top-i.clientTop-s,a.xyFloatPrecision),t:roundFloat(Date.now(),a.timestampFloatPrecision)}}var _=function prevent(n){return n.preventDefault()};var S=Object.freeze({__proto__:null,attach:function attach(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=0;function unfocus(){"None"!==window.getSelection().type&&window.getSelection().removeAllRanges()}function hideMenu(n){var i=document.querySelector(".more-menu");return!(n.target.classList.contains("ellipsis")||n.target.classList.contains("more-menu")||n.target.classList.contains("options-label-button")||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function hideCandidates(n){var i=document.querySelector(".candidates");return!(n.target.classList.contains("candidates")||"SPAN"===n.target.tagName||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function pointerDownHandler(c){var u=c.target.id===i.domElement.id||c.target.classList.contains("ms-canvas");if(void 0!==this.activePointerId)this.activePointerId===c.pointerId&&l.trace("".concat(c.type," event with the same id without any pointer up"),c.pointerId);else if(2!==c.button&&2!==c.buttons&&u){if(!hideMenu(c)&&!hideCandidates(c)){this.activePointerId=c.pointerId;var d=c.pointerId>2147483647?-1:c.pointerId;unfocus(),c.stopPropagation();var p=c.pointerType;i.isErasing&&(p="ERASER"),i.pointerDown(extractPoint(c,n,i.configuration,a,s),p,d)}}else c.target.classList.contains("ellipsis")||c.target.classList.contains("tag-icon")?(hideMenu(c),hideCandidates(c)):(hideMenu(c),hideCandidates(c),this.smartGuidePointerDown=!0,this.downSmartGuidePoint=extractPoint(c,n,i.configuration))}function pointerMoveHandler(u){if(void 0!==this.activePointerId&&this.activePointerId===u.pointerId)unfocus(),i.pointerMove(extractPoint(u,n,i.configuration,a,s));else if(this.smartGuidePointerDown){var d=extractPoint(u,n,i.configuration,a,s),p=Math.abs(this.downSmartGuidePoint.x-d.x),h=Math.abs(this.downSmartGuidePoint.y-d.y);if(c=Math.max(p,c),p<5&&h>5&&c<15||p>5&&h>5&&c<15){this.activePointerId=u.pointerId;var f=u.pointerId>2147483647?-1:u.pointerId;unfocus(),i.pointerDown(this.downSmartGuidePoint,u.pointerType,f)}}else l.trace("".concat(u.type," event from another pointerid (").concat(u.pointerId,")"),this.activePointerId)}function pointerUpHandler(u){c=0,this.smartGuidePointerDown=!1;var d=["smartguide","prompter-text-container","prompter-text","tag-icon","ellipsis"],p=["ps__rail-x","ps__thumb-x"],h=u.relatedTarget&&(d.includes(u.relatedTarget.className)||p.includes(u.relatedTarget.className)),f=u.relatedTarget&&u.target&&(d.includes(u.target.className)||p.includes(u.target.className)),g=u.relatedTarget&&u.target&&("SPAN"===u.target.tagName||"SPAN"===u.relatedTarget.tagName);h||f||g?u.stopPropagation():void 0!==this.activePointerId&&this.activePointerId===u.pointerId?(this.activePointerId=void 0,u.stopPropagation(),i.pointerUp(extractPoint(u,n,i.configuration,a,s))):l.trace("".concat(u.type," event from another pointerid (").concat(u.pointerId,")"),this.activePointerId)}var u={options:i.configuration.listenerOptions,listeners:[{types:["pointerdown"],listener:pointerDownHandler},{types:["pointermove"],listener:pointerMoveHandler},{types:["pointerup","pointerout","pointerleave","pointercancel"],listener:pointerUpHandler}]};return l.debug("attaching listeners",u),u.listeners.forEach((function(i){i.types.forEach((function(a){return n.addEventListener(a,i.listener,u.options)}))})),n.addEventListener("touchmove",_),document.documentElement.addEventListener("pointerdown",(function(){})),u},detach:function detach(n,i){l.debug("detaching listeners",i),i.listeners.forEach((function(a){a.types.forEach((function(s){return n.removeEventListener(s,a.listener,i.options)}))})),n.removeEventListener("touchmove",_),document.documentElement.removeEventListener("pointerdown",(function(){}))}});var k=function _arrayLikeToArray(n,i){(null==i||i>n.length)&&(i=n.length);for(var a=0,s=new Array(i);a=l||Math.abs(s[s.length-1]-i)>=l)&&(u=!0),u}(i.x,i.y,a.x,a.y,a.width)?c.trace("ignore filtered point",i):(a.x.push(i.x),a.y.push(i.y),a.t.push(i.t),a.p.push(function computePressure(n,i,a,s,c,l){var u=1,d=computeDistance(n,i,a,s,l),p=computeLength(n,i,a,s,c,l);0===p?u=.5:d===p?u=1:d<10?u=.2+Math.pow(.1*d,.4):d>p-10&&(u=.2+Math.pow(.1*(p-d),.4));var h=u*Math.max(.1,1-.1*Math.sqrt(d));return isNaN(parseFloat(h))?.5:h}(i.x,i.y,a.x,a.y,a.l,a.x.length-1)),a.l.push(computeLength(i.x,i.y,a.x,a.y,a.l,a.x.length-1))),a}function slice(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.x.length,s=createStrokeComponent({color:n.color,width:n.width}),c=i;c=0&&i1&&void 0!==arguments[1]?arguments[1]:{minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE},a=i;return a=n.filter((function(n){return"stroke"===n.type})).map(getStrokeBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"clef"===n.type})).map(getClefBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"line"===n.type})).map(getLineBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"ellipse"===n.type})).map(getEllipseBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"textLine"===n.type})).map(getTextLineBounds).reduce(mergeBounds,a)}function createModel(n){return{currentStroke:void 0,rawStrokes:[],strokeGroups:[],lastPositions:{lastSentPosition:-1,lastReceivedPosition:-1,lastRenderedPosition:-1},defaultSymbols:[],recognizedSymbols:void 0,exports:void 0,rawResults:{convert:void 0,exports:void 0},creationTime:(new Date).getTime(),modificationTime:void 0}}function clearModel(n){var i=n;return i.currentStroke=void 0,i.rawStrokes=[],i.strokeGroups=[],i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i.lastPositions.lastRenderedPosition=-1,i.recognizedSymbols=void 0,i.exports=void 0,i.rawResults.convert=void 0,i.rawResults.exports=void 0,i}function needRedraw(n){return!!n.recognizedSymbols&&n.rawStrokes.length!==n.recognizedSymbols.filter((function(n){return"stroke"===n.type})).length}function addStroke(n,i){var a=n;return c.debug("addStroke",i),a.rawStrokes.push(i),a}function addStrokeToGroup(n,i,a){var s=n;c.debug("addStroke",i);var l=s.strokeGroups.length-1;if(s.strokeGroups[l]&&s.strokeGroups[l].penStyle===a)s.strokeGroups[l].strokes.push(i);else{var u={penStyle:a,strokes:[]},d={};Object.assign(d,i),u.strokes.push(d),s.strokeGroups.push(u)}return s}function extractPendingStrokes(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastReceivedPosition+1;return n.rawStrokes.slice(i)}function initPendingStroke(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:96;if(a&&a["-myscript-pen-width"]){var l=a["-myscript-pen-width"]*s/25.4;Object.assign(a,{width:l/2})}var u=n;return c.trace("initPendingStroke",i),u.currentStroke=createStrokeComponent(a),u.currentStroke=addPoint(u.currentStroke,i),u}function appendToPendingStroke(n,i){var a=n;return a.currentStroke&&(c.trace("appendToPendingStroke",i),a.currentStroke=addPoint(a.currentStroke,i)),a}function endPendingStroke(n,i,a){var s=n;if(s.currentStroke){c.trace("endPendingStroke",i);var l=addPoint(s.currentStroke,i);addStroke(s,l),addStrokeToGroup(s,l,a),delete s.currentStroke}return s}function getBorderCoordinates(n){var i={minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE};return n.defaultSymbols&&n.defaultSymbols.length>0&&(i=getSymbolsBounds(n.defaultSymbols,i)),n.recognizedSymbols&&n.recognizedSymbols.length>0?(i=getSymbolsBounds(n.recognizedSymbols,i),i=getSymbolsBounds(extractPendingStrokes(n),i)):i=getSymbolsBounds(n.rawStrokes,i),i}function updateModelSentPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.rawStrokes.length-1,a=n;return a.lastPositions.lastSentPosition=i,a}function updateModelReceivedPosition(n){var i=n;return i.lastPositions.lastReceivedPosition=i.lastPositions.lastSentPosition,i}function resetModelPositions(n){var i=n;return i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i}function updateModelRenderedPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.recognizedSymbols?n.recognizedSymbols.length-1:-1,a=n;return a.lastPositions.lastRenderedPosition=i,a}function extractPendingRecognizedSymbols(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastRenderedPosition+1;return n.recognizedSymbols?n.recognizedSymbols.slice(i):[]}function cloneModel(n){var i=Object.assign({},n);return i.defaultSymbols=M(n.defaultSymbols),i.currentStroke=n.currentStroke?Object.assign({},n.currentStroke):void 0,i.rawStrokes=M(n.rawStrokes),i.strokeGroups=JSON.parse(JSON.stringify(n.strokeGroups)),i.lastPositions=Object.assign({},n.lastPositions),i.exports=n.exports?Object.assign({},n.exports):void 0,i.rawResults=Object.assign({},n.rawResults),i.recognizedSymbols=n.recognizedSymbols?M(n.recognizedSymbols):void 0,i}function mergeModels(){for(var n=arguments.length,i=new Array(n),a=0;a1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;u.debug("attach renderer",n);var s=detectPixelRatio(),c=createCanvas(n,"ms-rendering-canvas"),l=createCanvas(n,"ms-capture-canvas"),d={pixelRatio:s,minHeight:i,minWidth:a,renderingCanvas:c,renderingCanvasContext:c.getContext("2d"),capturingCanvas:l,capturingCanvasContext:l.getContext("2d")};return resizeContent(d)},detach:function detach$1(n,i){u.debug("detach renderer",n),n.removeChild(i.renderingCanvas),n.removeChild(i.capturingCanvas)},resize:function resize(n,i,a){return this.drawModel(resizeContent(n),i,a)},drawCurrentStroke:function drawCurrentStroke(n,i,a){return n.capturingCanvasContext.clearRect(0,0,n.capturingCanvas.width,n.capturingCanvas.height),u.trace("drawing current stroke ",i.currentStroke),drawStroke(n.capturingCanvasContext,i.currentStroke,a),i},drawModel:drawModel});function computeLinksPoints(n,i,a){var s=n.p*a;return[{x:n.x-Math.sin(i)*s,y:n.y+Math.cos(i)*s},{x:n.x+Math.sin(i)*s,y:n.y-Math.cos(i)*s}]}function computeMiddlePoint(n,i){return{x:(i.x+n.x)/2,y:(i.y+n.y)/2,p:(i.p+n.p)/2}}function computeAxeAngle(n,i){return Math.atan2(i.y-n.y,i.x-n.x)}function renderArc(n,i,a){n.arc(i.x,i.y,a,0,2*Math.PI,!0)}function renderLine(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);n.moveTo(c[0].x,c[0].y),n.lineTo(l[0].x,l[0].y),n.lineTo(l[1].x,l[1].y),n.lineTo(c[1].x,c[1].y)}function renderQuadratic(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);n.moveTo(l[0].x,l[0].y),n.quadraticCurveTo(d[0].x,d[0].y,u[0].x,u[0].y),n.lineTo(u[1].x,u[1].y),n.quadraticCurveTo(d[1].x,d[1].y,l[1].x,l[1].y)}var j=Object.freeze({__proto__:null,getInfo:function getInfo$1(){return{type:"canvas",name:"quadratic"}},drawStroke:function drawStroke$1(n,i){var a=n,s=i.x.length,c=i.width>0?i.width:a.lineWidth,l=i.color?i.color:a.strokeStyle,u=getPointByIndex(i,0),d=s-2;a.save();try{if(a.beginPath(),s<3)renderArc(a,u,.6*c);else{renderArc(a,u,c*u.p),renderLine(a,u,computeMiddlePoint(u,getPointByIndex(i,1)),c);for(var p=0;p=0&&"xmlns"!==(i=n.slice(0,a))&&(n=n.slice(a+1)),O.hasOwnProperty(i)?{space:O[i],local:n}:n}function creatorInherit(n){return function(){var i=this.ownerDocument,a=this.namespaceURI;return a===U&&i.documentElement.namespaceURI===U?i.createElement(n):i.createElementNS(a,n)}}function creatorFixed(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function creator(n){var i=namespace(n);return(i.local?creatorFixed:creatorInherit)(i)}function none(){}function selector(n){return null==n?none:function(){return this.querySelector(n)}}function empty(){return[]}function sparse(n){return new Array(n.length)}function EnterNode(n,i){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=i}EnterNode.prototype={constructor:EnterNode,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,i){return this._parent.insertBefore(n,i)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function bindIndex(n,i,a,s,c,l){for(var u,d=0,p=i.length,h=l.length;di?1:n>=i?0:NaN}function attrRemove(n){return function(){this.removeAttribute(n)}}function attrRemoveNS(n){return function(){this.removeAttributeNS(n.space,n.local)}}function attrConstant(n,i){return function(){this.setAttribute(n,i)}}function attrConstantNS(n,i){return function(){this.setAttributeNS(n.space,n.local,i)}}function attrFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttribute(n):this.setAttribute(n,a)}}function attrFunctionNS(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,a)}}function defaultView(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function styleRemove(n){return function(){this.style.removeProperty(n)}}function styleConstant(n,i,a){return function(){this.style.setProperty(n,i,a)}}function styleFunction(n,i,a){return function(){var s=i.apply(this,arguments);null==s?this.style.removeProperty(n):this.style.setProperty(n,s,a)}}function styleValue(n,i){return n.style.getPropertyValue(i)||defaultView(n).getComputedStyle(n,null).getPropertyValue(i)}function propertyRemove(n){return function(){delete this[n]}}function propertyConstant(n,i){return function(){this[n]=i}}function propertyFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?delete this[n]:this[n]=a}}function classArray(n){return n.trim().split(/^|\s+/)}function classList(n){return n.classList||new ClassList(n)}function ClassList(n){this._node=n,this._names=classArray(n.getAttribute("class")||"")}function classedAdd(n,i){for(var a=classList(n),s=-1,c=i.length;++s=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var z={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(z={mouseenter:"mouseover",mouseleave:"mouseout"}));function filterContextListener(n,i,a){return n=contextListener(n,i,a),function(i){var a=i.relatedTarget;a&&(a===this||8&a.compareDocumentPosition(this))||n.call(this,i)}}function contextListener(n,i,a){return function(s){try{n.call(this,this.__data__,i,a)}finally{}}}function parseTypenames(n){return n.trim().split(/^|\s+/).map((function(n){var i="",a=n.indexOf(".");return a>=0&&(i=n.slice(a+1),n=n.slice(0,a)),{type:n,name:i}}))}function onRemove(n){return function(){var i=this.__on;if(i){for(var a,s=0,c=-1,l=i.length;s=k&&(k=S+1);!(_=x[k])&&++k=0;)(s=c[l])&&(u&&4^s.compareDocumentPosition(u)&&u.parentNode.insertBefore(s,u),u=s);return this},sort:function selection_sort(n){function compareNode(i,a){return i&&a?n(i.__data__,a.__data__):!i-!a}n||(n=ascending);for(var i=this._groups,a=i.length,s=new Array(a),c=0;c1?this.each((null==i?styleRemove:"function"==typeof i?styleFunction:styleConstant)(n,i,null==a?"":a)):styleValue(this.node(),n)},property:function selection_property(n,i){return arguments.length>1?this.each((null==i?propertyRemove:"function"==typeof i?propertyFunction:propertyConstant)(n,i)):this.node()[n]},classed:function selection_classed(n,i){var a=classArray(n+"");if(arguments.length<2){for(var s=classList(this.node()),c=-1,l=a.length;++c *:nth-child(").concat(a.index+1,")")).remove();break;case"APPEND_CHILD":var d=n.select(a.parentId?"#".concat(a.parentId):s).node();d.insertAdjacentHTML?d.insertAdjacentHTML("beforeEnd",a.svg):(insertAdjacentSVG(d,"beforeEnd",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"INSERT_BEFORE":var p=n.select("#".concat(a.refId)).node();p.insertAdjacentHTML?p.insertAdjacentHTML("beforeBegin",a.svg):(insertAdjacentSVG(p,"beforeBegin",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"REMOVE_ATTRIBUTE":n.selectAll(a.id?"#".concat(a.id):"svg").attr(a.name,null);break;case"SET_ATTRIBUTE":a.id&&n.selectAll("#".concat(a.id)).attr(a.name,a.value);break;default:u.debug("unknown update ".concat(a.type," action"))}}catch(n){u.error("Invalid update ".concat(a.type),a),u.error("Error on svg patch",n)}}))}(i)})),updateModelRenderedPosition(i));var c=extractPendingStrokes(i);return c&&c.forEach((function(i){return function drawSymbol(n,i){u.trace("attempting to draw ".concat(n.type," symbol")),"stroke"!==n.type||i.select("id",n.id)?u.warn("impossible to draw ".concat(n.type," symbol")):drawStroke$2(i.append("path").attr("id",n.id),n,a)}(i,n.select("#pendingStrokes"))})),i}});function renderArc$1(n,i,a){return["M ".concat(i.x,",").concat(i.y),"m ".concat(-a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(2*a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(-2*a,",0")].join(" ")}function renderLine$1(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);return["M ".concat(c[0].x,",").concat(c[0].y),"L ".concat(l[0].x,",").concat(l[0].y),"L ".concat(l[1].x,",").concat(l[1].y),"L ".concat(c[1].x,",").concat(c[1].y)].join(" ")}function renderQuadratic$1(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);return["M ".concat(l[0].x,",").concat(l[0].y),"Q ".concat(d[0].x,",").concat(d[0].y," ").concat(u[0].x,",").concat(u[0].y),"L ".concat(u[1].x,",").concat(u[1].y),"Q ".concat(d[1].x,",").concat(d[1].y," ").concat(l[1].x,",").concat(l[1].y)].join(" ")}var X=Object.freeze({__proto__:null,getInfo:function getInfo$3(){return{type:"svg",name:"quadratic"}},drawStroke:function drawStroke$3(n,i){var a=i.x.length,s=i.width,c=getPointByIndex(i,0),l=a-2,u=[];if(a<3)u.push(renderArc$1(0,c,.6*s));else{u.push(renderArc$1(0,c,s*c.p)),u.push(renderLine$1(0,c,computeMiddlePoint(c,getPointByIndex(i,1)),s));for(var d=0;d=0;--c){var l=this.tryEntries[c],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var d=s.call(l,"catchLoc"),p=s.call(l,"finallyLoc");if(d&&p){if(this.prev=0;--a){var c=this.tryEntries[a];if(c.tryLoc<=this.prev&&s.call(c,"finallyLoc")&&this.prev=0;--i){var a=this.tryEntries[i];if(a.finallyLoc===n)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),m}},catch:function(n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc===n){var s=a.completion;if("throw"===s.type){var c=s.arg;resetTryEntry(a)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(n,a,s){return this.delegate={iterator:values(n),resultName:a,nextLoc:s},"next"===this.method&&(this.arg=i),m}},n}(n.exports);try{regeneratorRuntime=i}catch(n){Function("r","regeneratorRuntime = r")(i)}}));function asyncGeneratorStep(n,i,a,s,c,l,u){try{var d=n[l](u),p=d.value}catch(n){return void a(n)}d.done?i(p):Promise.resolve(p).then(s,c)}var B=function _asyncToGenerator(n){return function(){var i=this,a=arguments;return new Promise((function(s,c){var l=n.apply(i,a);function _next(n){asyncGeneratorStep(l,s,c,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(l,s,c,_next,_throw,"throw",n)}_next(void 0)}))}},G=createCommonjsModule((function(n){function _typeof(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?n.exports=_typeof=function _typeof(n){return typeof n}:n.exports=_typeof=function _typeof(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_typeof(i)}n.exports=_typeof})),Y=createCommonjsModule((function(n,i){var a;n.exports=(a=a||function(n,i){var a=Object.create||function(){function F(){}return function(n){var i;return F.prototype=n,i=new F,F.prototype=null,i}}(),s={},c=s.lib={},l=c.Base={extend:function(n){var i=a(this);return n&&i.mixIn(n),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}},u=c.WordArray=l.extend({init:function(n,a){n=this.words=n||[],this.sigBytes=a!=i?a:4*n.length},toString:function(n){return(n||p).stringify(this)},concat:function(n){var i=this.words,a=n.words,s=this.sigBytes,c=n.sigBytes;if(this.clamp(),s%4)for(var l=0;l>>2]>>>24-l%4*8&255;i[s+l>>>2]|=u<<24-(s+l)%4*8}else for(l=0;l>>2]=a[l>>>2];return this.sigBytes+=c,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=n.ceil(a/4)},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(i){for(var a,s=[],r=function(i){i=i;var a=987654321,s=4294967295;return function(){var c=((a=36969*(65535&a)+(a>>16)&s)<<16)+(i=18e3*(65535&i)+(i>>16)&s)&s;return c/=4294967296,(c+=.5)*(n.random()>.5?1:-1)}},c=0;c>>2]>>>24-c%4*8&255;s.push((l>>>4).toString(16)),s.push((15&l).toString(16))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>3]|=parseInt(n.substr(s,2),16)<<24-s%8*4;return new u.init(a,i/2)}},h=d.Latin1={stringify:function(n){for(var i=n.words,a=n.sigBytes,s=[],c=0;c>>2]>>>24-c%4*8&255;s.push(String.fromCharCode(l))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>2]|=(255&n.charCodeAt(s))<<24-s%4*8;return new u.init(a,i)}},f=d.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},g=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(n){"string"==typeof n&&(n=f.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(i){var a=this._data,s=a.words,c=a.sigBytes,l=this.blockSize,d=c/(4*l),p=(d=i?n.ceil(d):n.max((0|d)-this._minBufferSize,0))*l,h=n.min(4*p,c);if(p){for(var f=0;f>>1|re<<31)^(ne>>>8|re<<24)^ne>>>7,ie=(re>>>1|ne<<31)^(re>>>8|ne<<24)^(re>>>7|ne<<25),ae=p[q-2],se=ae.high,ce=ae.low,le=(se>>>19|ce<<13)^(se<<3|ce>>>29)^se>>>6,ue=(ce>>>19|se<<13)^(ce<<3|se>>>29)^(ce>>>6|se<<26),de=p[q-7],pe=de.high,he=de.low,fe=p[q-16],ge=fe.high,me=fe.low;Q=(Q=(Q=oe+pe+((ee=ie+he)>>>0>>0?1:0))+le+((ee+=ue)>>>0>>0?1:0))+ge+((ee+=me)>>>0>>0?1:0),Z.high=Q,Z.low=ee}var ve,ye=H&G^~H&$,be=B&Y^~B&V,xe=D&U^D&z^U&z,we=j&O^j&N^O&N,Ee=(D>>>28|j<<4)^(D<<30|j>>>2)^(D<<25|j>>>7),_e=(j>>>28|D<<4)^(j<<30|D>>>2)^(j<<25|D>>>7),Se=(H>>>14|B<<18)^(H>>>18|B<<14)^(H<<23|B>>>9),ke=(B>>>14|H<<18)^(B>>>18|H<<14)^(B<<23|H>>>9),Ce=d[q],Pe=Ce.high,Ie=Ce.low,Te=J+Se+((ve=K+ke)>>>0>>0?1:0),Me=_e+we;J=$,K=V,$=G,V=Y,G=H,Y=B,H=W+(Te=(Te=(Te=Te+ye+((ve+=be)>>>0>>0?1:0))+Pe+((ve+=Ie)>>>0>>0?1:0))+Q+((ve+=ee)>>>0>>0?1:0))+((B=X+ve|0)>>>0>>0?1:0)|0,W=z,X=N,z=U,N=O,U=D,O=j,D=Te+(Ee+xe+(Me>>>0<_e>>>0?1:0))+((j=ve+Me|0)>>>0>>0?1:0)|0}y=s.low=y+j,s.high=v+D+(y>>>0>>0?1:0),x=c.low=x+O,c.high=b+U+(x>>>0>>0?1:0),_=l.low=_+N,l.high=w+z+(_>>>0>>0?1:0),k=u.low=k+X,u.high=S+W+(k>>>0>>0?1:0),P=h.low=P+B,h.high=C+H+(P>>>0>>0?1:0),T=f.low=T+Y,f.high=I+G+(T>>>0>>0?1:0),R=g.low=R+V,g.high=M+$+(R>>>0>>0?1:0),A=m.low=A+K,m.high=L+J+(A>>>0>>0?1:0)},_doFinalize:function(){var n=this._data,i=n.words,a=8*this._nDataBytes,s=8*n.sigBytes;return i[s>>>5]|=128<<24-s%32,i[30+(s+128>>>10<<5)]=Math.floor(a/4294967296),i[31+(s+128>>>10<<5)]=a,n.sigBytes=4*i.length,this._process(),this._hash.toX32()},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n},blockSize:32});n.SHA512=i._createHelper(h),n.HmacSHA512=i._createHmacHelper(h)}(),a.SHA512)})),createCommonjsModule((function(n,i){var a,s,c;n.exports=(s=(a=Y).lib.Base,c=a.enc.Utf8,void(a.algo.HMAC=s.extend({init:function(n,i){n=this._hasher=new n.init,"string"==typeof i&&(i=c.parse(i));var a=n.blockSize,s=4*a;i.sigBytes>s&&(i=n.finalize(i)),i.clamp();for(var l=this._oKey=i.clone(),u=this._iKey=i.clone(),d=l.words,p=u.words,h=0;h=i.rawStrokes.length-1}function updateRecognitionPositions(n,i){var a=n;return i&&(a.lastPositions.lastSentPosition=i.lastSentPosition,a.lastPositions.lastReceivedPosition=i.lastReceivedPosition),a.lastPositions.lastSentPosition===a.lastPositions.lastReceivedPosition===-1&&delete a.instanceId,a}function setRecognitionContext(n,i){var a=n;return a.recognitionContexts[0]=i,a}function canReconnect(n){return!0===n.websocket.autoReconnect&&n.currentReconnectionCount<=n.websocket.maxRetryCount}function shouldAttemptImmediateReconnect(n){var i=n;return!0===i.websocket.autoReconnect&&i.currentReconnectionCount++<=i.websocket.maxRetryCount}var J={type:"LOST_CONNECTION"},K=Object.freeze({__proto__:null,createEmptyRecognizerContext:createEmptyRecognizerContext,isResetRequired:isResetRequired,updateRecognitionPositions:updateRecognitionPositions,setRecognitionContext:setRecognitionContext,canReconnect:canReconnect,shouldAttemptImmediateReconnect:shouldAttemptImmediateReconnect,LOST_CONNEXION_MESSAGE:J,CLOSE_RECOGNIZER_MESSAGE:"CLOSE_RECOGNIZER"}); /*! - * perfect-scrollbar v1.5.3 - * Copyright 2021 Hyunje Jun, MDBootstrap and Contributors + * perfect-scrollbar v1.5.0 + * Copyright 2020 Hyunje Jun, MDBootstrap and Contributors * Licensed under MIT */ -function get(n){return getComputedStyle(n)}function set(n,i){for(var a in i){var s=i[a];"number"==typeof s&&(s+="px"),n.style[a]=s}return n}function div(n){var i=document.createElement("div");return i.className=n,i}var ne="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function matches(n,i){if(!ne)throw new Error("No element matching method supported");return ne.call(n,i)}function remove(n){n.remove?n.remove():n.parentNode&&n.parentNode.removeChild(n)}function queryChildren(n,i){return Array.prototype.filter.call(n.children,(function(n){return matches(n,i)}))}var re="ps",oe="ps__rtl",ie={thumb:function(n){return"ps__thumb-"+n},rail:function(n){return"ps__rail-"+n},consuming:"ps__child--consume"},ae={focus:"ps--focus",clicking:"ps--clicking",active:function(n){return"ps--active-"+n},scrolling:function(n){return"ps--scrolling-"+n}},se={x:null,y:null};function addScrollingClass(n,i){var a=n.element.classList,s=ae.scrolling(i);a.contains(s)?clearTimeout(se[i]):a.add(s)}function removeScrollingClass(n,i){se[i]=setTimeout((function(){return n.isAlive&&n.element.classList.remove(ae.scrolling(i))}),n.settings.scrollingThreshold)}var ce=function EventElement(n){this.element=n,this.handlers={}},le={isEmpty:{configurable:!0}};ce.prototype.bind=function bind(n,i){void 0===this.handlers[n]&&(this.handlers[n]=[]),this.handlers[n].push(i),this.element.addEventListener(n,i,!1)},ce.prototype.unbind=function unbind(n,i){var a=this;this.handlers[n]=this.handlers[n].filter((function(s){return!(!i||s===i)||(a.element.removeEventListener(n,s,!1),!1)}))},ce.prototype.unbindAll=function unbindAll(){for(var n in this.handlers)this.unbind(n)},le.isEmpty.get=function(){var n=this;return Object.keys(this.handlers).every((function(i){return 0===n.handlers[i].length}))},Object.defineProperties(ce.prototype,le);var ue=function EventManager(){this.eventElements=[]};function createEvent(n){if("function"==typeof window.CustomEvent)return new CustomEvent(n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,!1,!1,void 0),i}function processScrollDiff(n,i,a,s,c){var l;if(void 0===s&&(s=!0),void 0===c&&(c=!1),"top"===i)l=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==i)throw new Error("A proper axis should be provided");l=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function processScrollDiff$1(n,i,a,s,c){var l=a[0],u=a[1],d=a[2],p=a[3],h=a[4],f=a[5];void 0===s&&(s=!0);void 0===c&&(c=!1);var g=n.element;n.reach[p]=null,g[d]<1&&(n.reach[p]="start");g[d]>n[l]-n[u]-1&&(n.reach[p]="end");i&&(g.dispatchEvent(createEvent("ps-scroll-"+p)),i<0?g.dispatchEvent(createEvent("ps-scroll-"+h)):i>0&&g.dispatchEvent(createEvent("ps-scroll-"+f)),s&&function setScrollingClassInstantly(n,i){addScrollingClass(n,i),removeScrollingClass(n,i)}(n,p));n.reach[p]&&(i||c)&&g.dispatchEvent(createEvent("ps-"+p+"-reach-"+n.reach[p]))}(n,a,l,s,c)}function toInt(n){return parseInt(n,10)||0}ue.prototype.eventElement=function eventElement(n){var i=this.eventElements.filter((function(i){return i.element===n}))[0];return i||(i=new ce(n),this.eventElements.push(i)),i},ue.prototype.bind=function bind(n,i,a){this.eventElement(n).bind(i,a)},ue.prototype.unbind=function unbind(n,i,a){var s=this.eventElement(n);s.unbind(i,a),s.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(s),1)},ue.prototype.unbindAll=function unbindAll(){this.eventElements.forEach((function(n){return n.unbindAll()})),this.eventElements=[]},ue.prototype.once=function once(n,i,a){var s=this.eventElement(n),onceHandler=function(n){s.unbind(i,onceHandler),a(n)};s.bind(i,onceHandler)};var de={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:"undefined"!=typeof navigator&&navigator.msMaxTouchPoints,isChrome:"undefined"!=typeof navigator&&/Chrome/i.test(navigator&&navigator.userAgent)};function updateGeometry(n){var i=n.element,a=Math.floor(i.scrollTop),s=i.getBoundingClientRect();n.containerWidth=Math.round(s.width),n.containerHeight=Math.round(s.height),n.contentWidth=i.scrollWidth,n.contentHeight=i.scrollHeight,i.contains(n.scrollbarXRail)||(queryChildren(i,ie.rail("x")).forEach((function(n){return remove(n)})),i.appendChild(n.scrollbarXRail)),i.contains(n.scrollbarYRail)||(queryChildren(i,ie.rail("y")).forEach((function(n){return remove(n)})),i.appendChild(n.scrollbarYRail)),!n.settings.suppressScrollX&&n.containerWidth+n.settings.scrollXMarginOffset=n.railXWidth-n.scrollbarXWidth&&(n.scrollbarXLeft=n.railXWidth-n.scrollbarXWidth),n.scrollbarYTop>=n.railYHeight-n.scrollbarYHeight&&(n.scrollbarYTop=n.railYHeight-n.scrollbarYHeight),function updateCss(n,i){var a={width:i.railXWidth},s=Math.floor(n.scrollTop);i.isRtl?a.left=i.negativeScrollAdjustment+n.scrollLeft+i.containerWidth-i.contentWidth:a.left=n.scrollLeft;i.isScrollbarXUsingBottom?a.bottom=i.scrollbarXBottom-s:a.top=i.scrollbarXTop+s;set(i.scrollbarXRail,a);var c={top:s,height:i.railYHeight};i.isScrollbarYUsingRight?i.isRtl?c.right=i.contentWidth-(i.negativeScrollAdjustment+n.scrollLeft)-i.scrollbarYRight-i.scrollbarYOuterWidth-9:c.right=i.scrollbarYRight-n.scrollLeft:i.isRtl?c.left=i.negativeScrollAdjustment+n.scrollLeft+2*i.containerWidth-i.contentWidth-i.scrollbarYLeft-i.scrollbarYOuterWidth:c.left=i.scrollbarYLeft+n.scrollLeft;set(i.scrollbarYRail,c),set(i.scrollbarX,{left:i.scrollbarXLeft,width:i.scrollbarXWidth-i.railBorderXWidth}),set(i.scrollbarY,{top:i.scrollbarYTop,height:i.scrollbarYHeight-i.railBorderYWidth})}(i,n),n.scrollbarXActive?i.classList.add(ae.active("x")):(i.classList.remove(ae.active("x")),n.scrollbarXWidth=0,n.scrollbarXLeft=0,i.scrollLeft=!0===n.isRtl?n.contentWidth:0),n.scrollbarYActive?i.classList.add(ae.active("y")):(i.classList.remove(ae.active("y")),n.scrollbarYHeight=0,n.scrollbarYTop=0,i.scrollTop=0)}function getThumbSize(n,i){return n.settings.minScrollbarLength&&(i=Math.max(i,n.settings.minScrollbarLength)),n.settings.maxScrollbarLength&&(i=Math.min(i,n.settings.maxScrollbarLength)),i}function bindMouseScrollHandler(n,i){var a=i[0],s=i[1],c=i[2],l=i[3],u=i[4],d=i[5],p=i[6],h=i[7],f=i[8],g=n.element,m=null,v=null,y=null;function mouseMoveHandler(i){i.touches&&i.touches[0]&&(i[c]=i.touches[0].pageY),g[p]=m+y*(i[c]-v),addScrollingClass(n,h),updateGeometry(n),i.stopPropagation(),i.type.startsWith("touch")&&i.changedTouches.length>1&&i.preventDefault()}function mouseUpHandler(){removeScrollingClass(n,h),n[f].classList.remove(ae.clicking),n.event.unbind(n.ownerDocument,"mousemove",mouseMoveHandler)}function bindMoves(i,u){m=g[p],u&&i.touches&&(i[c]=i.touches[0].pageY),v=i[c],y=(n[s]-n[a])/(n[l]-n[d]),u?n.event.bind(n.ownerDocument,"touchmove",mouseMoveHandler):(n.event.bind(n.ownerDocument,"mousemove",mouseMoveHandler),n.event.once(n.ownerDocument,"mouseup",mouseUpHandler),i.preventDefault()),n[f].classList.add(ae.clicking),i.stopPropagation()}n.event.bind(n[u],"mousedown",(function(n){bindMoves(n)})),n.event.bind(n[u],"touchstart",(function(n){bindMoves(n,!0)}))}var pe={"click-rail":function clickRail(n){n.element,n.event.bind(n.scrollbarY,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarYRail,"mousedown",(function(i){var a=i.pageY-window.pageYOffset-n.scrollbarYRail.getBoundingClientRect().top>n.scrollbarYTop?1:-1;n.element.scrollTop+=a*n.containerHeight,updateGeometry(n),i.stopPropagation()})),n.event.bind(n.scrollbarX,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarXRail,"mousedown",(function(i){var a=i.pageX-window.pageXOffset-n.scrollbarXRail.getBoundingClientRect().left>n.scrollbarXLeft?1:-1;n.element.scrollLeft+=a*n.containerWidth,updateGeometry(n),i.stopPropagation()}))},"drag-thumb":function dragThumb(n){bindMouseScrollHandler(n,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),bindMouseScrollHandler(n,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function keyboard(n){var i=n.element;n.event.bind(n.ownerDocument,"keydown",(function(a){if(!(a.isDefaultPrevented&&a.isDefaultPrevented()||a.defaultPrevented)&&(matches(i,":hover")||matches(n.scrollbarX,":focus")||matches(n.scrollbarY,":focus"))){var s=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(s){if("IFRAME"===s.tagName)s=s.contentDocument.activeElement;else for(;s.shadowRoot;)s=s.shadowRoot.activeElement;if(function isEditable(n){return matches(n,"input,[contenteditable]")||matches(n,"select,[contenteditable]")||matches(n,"textarea,[contenteditable]")||matches(n,"button,[contenteditable]")}(s))return}var c=0,l=0;switch(a.which){case 37:c=a.metaKey?-n.contentWidth:a.altKey?-n.containerWidth:-30;break;case 38:l=a.metaKey?n.contentHeight:a.altKey?n.containerHeight:30;break;case 39:c=a.metaKey?n.contentWidth:a.altKey?n.containerWidth:30;break;case 40:l=a.metaKey?-n.contentHeight:a.altKey?-n.containerHeight:-30;break;case 32:l=a.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:l=n.containerHeight;break;case 34:l=-n.containerHeight;break;case 36:l=n.contentHeight;break;case 35:l=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==c||n.settings.suppressScrollY&&0!==l||(i.scrollTop-=l,i.scrollLeft+=c,updateGeometry(n),function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop);if(0===a){if(!n.scrollbarYActive)return!1;if(0===c&&s>0||c>=n.contentHeight-n.containerHeight&&s<0)return!n.settings.wheelPropagation}var l=i.scrollLeft;if(0===s){if(!n.scrollbarXActive)return!1;if(0===l&&a<0||l>=n.contentWidth-n.containerWidth&&a>0)return!n.settings.wheelPropagation}return!0}(c,l)&&a.preventDefault())}}))},wheel:function wheel(n){var i=n.element;function mousewheelHandler(a){var s=function getDeltaFromEvent(n){var i=n.deltaX,a=-1*n.deltaY;return void 0!==i&&void 0!==a||(i=-1*n.wheelDeltaX/6,a=n.wheelDeltaY/6),n.deltaMode&&1===n.deltaMode&&(i*=10,a*=10),i!=i&&a!=a&&(i=0,a=n.wheelDelta),n.shiftKey?[-a,-i]:[i,a]}(a),c=s[0],l=s[1];if(!function shouldBeConsumedByChild(n,a,s){if(!de.isWebKit&&i.querySelector("select:focus"))return!0;if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ie.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(a.target,c,l)){var u=!1;n.settings.useBothWheelAxes?n.scrollbarYActive&&!n.scrollbarXActive?(l?i.scrollTop-=l*n.settings.wheelSpeed:i.scrollTop+=c*n.settings.wheelSpeed,u=!0):n.scrollbarXActive&&!n.scrollbarYActive&&(c?i.scrollLeft+=c*n.settings.wheelSpeed:i.scrollLeft-=l*n.settings.wheelSpeed,u=!0):(i.scrollTop-=l*n.settings.wheelSpeed,i.scrollLeft+=c*n.settings.wheelSpeed),updateGeometry(n),u=u||function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop),l=0===i.scrollTop,u=c+i.offsetHeight===i.scrollHeight,d=0===i.scrollLeft,p=i.scrollLeft+i.offsetWidth===i.scrollWidth;return!(Math.abs(s)>Math.abs(a)?l||u:d||p)||!n.settings.wheelPropagation}(c,l),u&&!a.ctrlKey&&(a.stopPropagation(),a.preventDefault())}}void 0!==window.onwheel?n.event.bind(i,"wheel",mousewheelHandler):void 0!==window.onmousewheel&&n.event.bind(i,"mousewheel",mousewheelHandler)},touch:function touch(n){if(de.supportsTouch||de.supportsIePointer){var i=n.element,a={},s=0,c={},l=null;de.supportsTouch?(n.event.bind(i,"touchstart",touchStart),n.event.bind(i,"touchmove",touchMove),n.event.bind(i,"touchend",touchEnd)):de.supportsIePointer&&(window.PointerEvent?(n.event.bind(i,"pointerdown",touchStart),n.event.bind(i,"pointermove",touchMove),n.event.bind(i,"pointerup",touchEnd)):window.MSPointerEvent&&(n.event.bind(i,"MSPointerDown",touchStart),n.event.bind(i,"MSPointerMove",touchMove),n.event.bind(i,"MSPointerUp",touchEnd)))}function applyTouchMove(a,s){i.scrollTop-=s,i.scrollLeft-=a,updateGeometry(n)}function getTouch(n){return n.targetTouches?n.targetTouches[0]:n}function shouldHandle(n){return(!n.pointerType||"pen"!==n.pointerType||0!==n.buttons)&&(!(!n.targetTouches||1!==n.targetTouches.length)||!(!n.pointerType||"mouse"===n.pointerType||n.pointerType===n.MSPOINTER_TYPE_MOUSE))}function touchStart(n){if(shouldHandle(n)){var i=getTouch(n);a.pageX=i.pageX,a.pageY=i.pageY,s=(new Date).getTime(),null!==l&&clearInterval(l)}}function touchMove(l){if(shouldHandle(l)){var u=getTouch(l),d={pageX:u.pageX,pageY:u.pageY},p=d.pageX-a.pageX,h=d.pageY-a.pageY;if(function shouldBeConsumedByChild(n,a,s){if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ie.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(l.target,p,h))return;applyTouchMove(p,h),a=d;var f=(new Date).getTime(),g=f-s;g>0&&(c.x=p/g,c.y=h/g,s=f),function shouldPrevent(a,s){var c=Math.floor(i.scrollTop),l=i.scrollLeft,u=Math.abs(a),d=Math.abs(s);if(d>u){if(s<0&&c===n.contentHeight-n.containerHeight||s>0&&0===c)return 0===window.scrollY&&s>0&&de.isChrome}else if(u>d&&(a<0&&l===n.contentWidth-n.containerWidth||a>0&&0===l))return!0;return!0}(p,h)&&l.preventDefault()}}function touchEnd(){n.settings.swipeEasing&&(clearInterval(l),l=setInterval((function(){n.isInitialized?clearInterval(l):c.x||c.y?Math.abs(c.x)<.01&&Math.abs(c.y)<.01?clearInterval(l):n.element?(applyTouchMove(30*c.x,30*c.y),c.x*=.8,c.y*=.8):clearInterval(l):clearInterval(l)}),10))}}},he=function PerfectScrollbar(n,i){var a=this;if(void 0===i&&(i={}),"string"==typeof n&&(n=document.querySelector(n)),!n||!n.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");for(var s in this.element=n,n.classList.add(re),this.settings={handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1},i)this.settings[s]=i[s];this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null;var c,l,focus=function(){return n.classList.add(ae.focus)},blur=function(){return n.classList.remove(ae.focus)};this.isRtl="rtl"===get(n).direction,!0===this.isRtl&&n.classList.add(oe),this.isNegativeScroll=(l=n.scrollLeft,n.scrollLeft=-1,c=n.scrollLeft<0,n.scrollLeft=l,c),this.negativeScrollAdjustment=this.isNegativeScroll?n.scrollWidth-n.clientWidth:0,this.event=new ue,this.ownerDocument=n.ownerDocument||document,this.scrollbarXRail=div(ie.rail("x")),n.appendChild(this.scrollbarXRail),this.scrollbarX=div(ie.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",focus),this.event.bind(this.scrollbarX,"blur",blur),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var u=get(this.scrollbarXRail);this.scrollbarXBottom=parseInt(u.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=toInt(u.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=toInt(u.borderLeftWidth)+toInt(u.borderRightWidth),set(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=toInt(u.marginLeft)+toInt(u.marginRight),set(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=div(ie.rail("y")),n.appendChild(this.scrollbarYRail),this.scrollbarY=div(ie.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",focus),this.event.bind(this.scrollbarY,"blur",blur),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var d=get(this.scrollbarYRail);this.scrollbarYRight=parseInt(d.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=toInt(d.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?function outerWidth(n){var i=get(n);return toInt(i.width)+toInt(i.paddingLeft)+toInt(i.paddingRight)+toInt(i.borderLeftWidth)+toInt(i.borderRightWidth)}(this.scrollbarY):null,this.railBorderYWidth=toInt(d.borderTopWidth)+toInt(d.borderBottomWidth),set(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=toInt(d.marginTop)+toInt(d.marginBottom),set(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:n.scrollLeft<=0?"start":n.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:n.scrollTop<=0?"start":n.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach((function(n){return pe[n](a)})),this.lastScrollTop=Math.floor(n.scrollTop),this.lastScrollLeft=n.scrollLeft,this.event.bind(this.element,"scroll",(function(n){return a.onScroll(n)})),updateGeometry(this)};he.prototype.update=function update(){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,set(this.scrollbarXRail,{display:"block"}),set(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=toInt(get(this.scrollbarXRail).marginLeft)+toInt(get(this.scrollbarXRail).marginRight),this.railYMarginHeight=toInt(get(this.scrollbarYRail).marginTop)+toInt(get(this.scrollbarYRail).marginBottom),set(this.scrollbarXRail,{display:"none"}),set(this.scrollbarYRail,{display:"none"}),updateGeometry(this),processScrollDiff(this,"top",0,!1,!0),processScrollDiff(this,"left",0,!1,!0),set(this.scrollbarXRail,{display:""}),set(this.scrollbarYRail,{display:""}))},he.prototype.onScroll=function onScroll(n){this.isAlive&&(updateGeometry(this),processScrollDiff(this,"top",this.element.scrollTop-this.lastScrollTop),processScrollDiff(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)},he.prototype.destroy=function destroy(){this.isAlive&&(this.event.unbindAll(),remove(this.scrollbarX),remove(this.scrollbarY),remove(this.scrollbarXRail),remove(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)},he.prototype.removePsClasses=function removePsClasses(){this.element.className=this.element.className.split(" ").filter((function(n){return!n.match(/^ps([-_].+|)$/)})).join(" ")};var fe=function select(n){var i;if("SELECT"===n.nodeName)n.focus(),i=n.value;else if("INPUT"===n.nodeName||"TEXTAREA"===n.nodeName){var a=n.hasAttribute("readonly");a||n.setAttribute("readonly",""),n.select(),n.setSelectionRange(0,n.value.length),a||n.removeAttribute("readonly"),i=n.value}else{n.hasAttribute("contenteditable")&&n.focus();var s=window.getSelection(),c=document.createRange();c.selectNodeContents(n),s.removeAllRanges(),s.addRange(c),i=s.toString()}return i},ge=createCommonjsModule((function(n,i){!function(n,i){var a=_interopRequireDefault(i);function _interopRequireDefault(n){return n&&n.__esModule?n:{default:n}}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var c=function(){function defineProperties(n,i){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=n.action,this.container=n.container,this.emitter=n.emitter,this.target=n.target,this.text=n.text,this.trigger=n.trigger,this.selectedText=""}},{key:"initSelection",value:function initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function selectFake(){var n=this,i="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return n.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[i?"right":"left"]="-9999px";var s=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=s+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function selectTarget(){this.selectedText=(0,a.default)(this.target),this.copyText()}},{key:"copyText",value:function copyText(){var n=void 0;try{n=document.execCommand(this.action)}catch(i){n=!1}this.handleResult(n)}},{key:"handleResult",value:function handleResult(n){this.emitter.emit(n?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function destroy(){this.removeFake()}},{key:"action",set:function set(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=n,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function get(){return this._action}},{key:"target",set:function set(n){if(void 0!==n){if(!n||"object"!==(void 0===n?"undefined":s(n))||1!==n.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&n.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(n.hasAttribute("readonly")||n.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=n}},get:function get(){return this._target}}]),ClipboardAction}();n.exports=l}(n,fe)}));function E(){}unwrapExports(ge),E.prototype={on:function(n,i,a){var s=this.e||(this.e={});return(s[n]||(s[n]=[])).push({fn:i,ctx:a}),this},once:function(n,i,a){var s=this;function listener(){s.off(n,listener),i.apply(a,arguments)}return listener._=i,this.on(n,listener,a)},emit:function(n){for(var i=[].slice.call(arguments,1),a=((this.e||(this.e={}))[n]||[]).slice(),s=0,c=a.length;s0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof n.action?n.action:this.defaultAction,this.target="function"==typeof n.target?n.target:this.defaultTarget,this.text="function"==typeof n.text?n.text:this.defaultText,this.container="object"===d(n.container)?n.container:document.body}},{key:"listenClick",value:function listenClick(n){var i=this;this.listener=(0,u.default)(n,"click",(function(n){return i.onClick(n)}))}},{key:"onClick",value:function onClick(n){var i=n.delegateTarget||n.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(i),target:this.target(i),text:this.text(i),container:this.container,trigger:i,emitter:this})}},{key:"defaultAction",value:function defaultAction(n){return getAttributeValue("action",n)}},{key:"defaultTarget",value:function defaultTarget(n){var i=getAttributeValue("target",n);if(i)return document.querySelector(i)}},{key:"defaultText",value:function defaultText(n){return getAttributeValue("text",n)}},{key:"destroy",value:function destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function isSupported(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],i="string"==typeof n?[n]:n,a=!!document.queryCommandSupported;return i.forEach((function(n){a=a&&!!document.queryCommandSupported(n)})),a}}]),Clipboard}(l.default);function getAttributeValue(n,i){var a="data-clipboard-"+n;if(i.hasAttribute(a))return i.getAttribute(a)}n.exports=h}(n,ge,me,Ee)})),Se=unwrapExports(_e);function isInShadow(n){for(var i=n&&n.parentNode;i;){if("[object ShadowRoot]"===i.toString())return!0;i=i.parentNode}return!1}function addListeners(n,i){var s=i.elements;s.textElement.addEventListener("click",(function(s){return function showCandidates(n,i,s){var c=s,l=s.elements;if(n.target.id!=="prompter-text".concat(s.randomString)){var u=n.target.id.replace("word-","").replace(s.randomString,""),d=JSON.parse(i.exports[a.Exports.JIIX]).words;if(c.wordToChange=d[u],c.wordToChange.id=u,l.candidatesElement.innerHTML="",c.wordToChange&&c.wordToChange.candidates){l.candidatesElement.style.display="flex",c.wordToChange.candidates.forEach((function(n,i){c.wordToChange.label===n?l.candidatesElement.innerHTML+='').concat(n,""):l.candidatesElement.innerHTML+='').concat(n,"")}));var p=n.target.getBoundingClientRect().left-60;l.candidatesElement.style.top="".concat(48,"px"),l.candidatesElement.style.left="".concat(p,"px"),n.target.parentNode.parentNode.parentNode.insertBefore(l.candidatesElement,n.target.parentNode.parentNode)}}}(s,n,i)})),s.candidatesElement.addEventListener("click",(function(s){return function clickCandidate(n,i,s){var c=s,l=s.elements,u=n.target.innerText;if(u!==c.wordToChange.label&&c.wordToChange.candidates.includes(u)){var d=JSON.parse(i.exports[a.Exports.JIIX]);d.words[c.wordToChange.id].label=u,i.import_(JSON.stringify(d),a.Exports.JIIX)}l.candidatesElement.style.display="none"}(s,n,i)})),s.ellipsisElement.addEventListener("click",(function(n){return function showActions(n,i){var a=i,s=function positionActions(){var i=n.target.offsetLeft-68;a.menuElement.style.left="".concat(i,"px")},c=document.contains(a.menuElement);isInShadow(a.menuElement)||c?"none"===a.menuElement.style.display&&(s(),a.menuElement.style.display="flex"):(a.menuElement.style.display="flex",s(),function insertActions(){a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),n.target.parentNode.insertBefore(a.menuElement,n.target)}())}(n,s)})),s.copyElement.addEventListener("click",(function(){s.menuElement.style.display="none"})),s.convertElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.convert()})),s.deleteElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.clear()}))}function createSmartGuide(n){var i="-"+Math.random().toString(10).substring(2,12),a=function createHTMLElements(n){var i=document.createElement("div");i.id="smartguide"+n,i.classList.add("smartguide");var a=document.createElement("div");a.id="prompter-text"+n,a.classList.add("prompter-text"),a.setAttribute("touch-action","none");var s=document.createElement("div");s.id="prompter-text-container"+n,s.classList.add("prompter-text-container"),s.appendChild(a);var c=document.createElement("div");c.id="ellipsis"+n,c.classList.add("ellipsis"),c.innerHTML="...";var l=document.createElement("div");l.id="tag-icon"+n,l.classList.add("tag-icon"),l.innerHTML="¶";var u=document.createElement("div");u.id="candidates"+n,u.classList.add("candidates");var d=document.createElement("div");d.id="more-menu"+n,d.classList.add("more-menu");var p=document.createElement("button");p.classList.add("options-label-button"),p.id="convert"+n,p.innerHTML="Convert";var h=document.createElement("button");h.classList.add("options-label-button"),h.id="copy"+n,h.innerHTML="Copy";var f=document.createElement("button");return f.classList.add("options-label-button"),f.id="delete"+n,f.innerHTML="Delete",{smartGuideElement:i,textElement:a,textContainer:s,candidatesElement:u,menuElement:d,tagElement:l,ellipsisElement:c,convertElement:p,copyElement:h,deleteElement:f}}(i);new Se(a.copyElement);var s={editor:n,wordToChange:"",lastWord:"",previousLabelExport:" ",perfectScrollbar:new he(a.textContainer,{suppressScrollY:!0,scrollXMarginOffset:1}),elements:a,smartGuideTimeOutId:0,randomString:i};return addListeners(n,s),n.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable&&function callFadeOutObserver(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4,i=arguments.length>1?arguments[1]:void 0,a=i,s=i.elements;new MutationObserver((function(i){i.forEach((function(){a.smartGuideTimeOutId&&clearTimeout(a.smartGuideTimeOutId),"none"===s.candidatesElement.style.display&&"none"===s.menuElement.style.display?a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n):document.contains(s.candidatesElement)||document.contains(s.menuElement)||(a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n))}))})).observe(s.smartGuideElement,{childList:!0,subtree:!0,attributes:!0})}(n.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration,s),s}function resize$2(n){var i=n,a=n.elements,s=3.779527559*i.editor.configuration.recognitionParams.iink.text.margin.left,c=i.editor.domElement.clientWidth-s-a.tagElement.offsetWidth-35-s;a.textContainer.style.width="".concat(c,"px"),a.textContainer.style.maxWidth="".concat(c,"px"),s=a.tagElement.offsetWidth,s+=c,a.ellipsisElement.style.left="".concat(s,"px"),a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}function launchSmartGuide(n,i){var s=n,c=n.elements,l=document.contains(c.smartGuideElement);isInShadow(c.smartGuideElement)||l||function insertSmartGuide(n){var i=n,a=n.elements,s=3.779527559,c=i.editor.configuration.recognitionParams.iink.text.margin.top*s,l=i.editor.configuration.recognitionParams.iink.text.margin.left*s;!function insertSmartGuideElement(n,s){a.smartGuideElement.style.top="".concat(s,"px"),a.smartGuideElement.style.left="".concat(n,"px"),a.smartGuideElement.style.visibility="hidden",i.editor.domElement.insertBefore(a.smartGuideElement,i.editor.loader)}(l,c-45.354330708),function insertTag(){a.smartGuideElement.appendChild(a.tagElement)}();var u=i.editor.domElement.clientWidth-l-a.tagElement.offsetWidth-35-l;(function insertTextContainer(n,i){a.textContainer.style.left="".concat(n,"px"),a.textContainer.style.width="".concat(i,"px"),a.textContainer.style.maxWidth="".concat(i,"px"),a.smartGuideElement.appendChild(a.textContainer)})(l=a.tagElement.offsetWidth,u),function insertEllipsis(n){a.ellipsisElement.style.left="".concat(n,"px"),a.smartGuideElement.appendChild(a.ellipsisElement)}(l+=u),a.menuElement.style.display="none",a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),a.smartGuideElement.appendChild(a.menuElement),a.candidatesElement.style.display="none",a.smartGuideElement.appendChild(a.candidatesElement),a.smartGuideElement.style.height="48px",a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}(n);var u=function createWordSpan(i,a,s){var c=document.createElement("span");return c.id="word-".concat(a).concat(n.randomString),i?c.innerHTML=" ":c.textContent=s.label,c};if(i&&JSON.parse(i[a.Exports.JIIX]).words.length>0){if(c.smartGuideElement.classList.add("smartguide-in"),c.smartGuideElement.classList.remove("smartguide-out"),c.candidatesElement.style.display="none",c.menuElement.style.display="none",s.previousLabelExport&&s.previousLabelExport!==JSON.parse(i[a.Exports.JIIX]).label){var d=JSON.parse(i[a.Exports.JIIX]).words;!function populatePrompter(n){c.textElement.innerHTML="";var i=document.createDocumentFragment();n.forEach((function(a,l){if(" "===a.label||a.label.includes("\n"))i.appendChild(u(!0,l));else if(l!==n.length-1)i.appendChild(u(!1,l,a));else{c.textElement.appendChild(i),s.perfectScrollbar.update(),""===s.lastWord&&(s.lastWord=a);var d=u(!1,l,a);s.lastWord.candidates!==a.candidates&&s.lastWord.label!==a.label?(d.classList.add("added-word"),c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft,s.lastWord=a):(c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft)}}))}(d),function addAnimationToModifiedWord(l){if(s.tempWords&&s.tempWords.length===l.length){var u=l.map((function(n){return n.label})),d=s.tempWords.map((function(n){return n.label})),p=u.indexOf(u.filter((function(n){return-1===d.indexOf(n)}))[0]);document.getElementById("word-".concat(p).concat(n.randomString))&&p>-1&&(document.getElementById("word-".concat(p).concat(n.randomString)).classList.add("modified-word"),c.textContainer.scrollLeft=document.getElementById("word-".concat(p).concat(n.randomString)).offsetLeft-10)}s.tempWords=JSON.parse(i[a.Exports.JIIX]).words}(d)}s.previousLabelExport=JSON.parse(i[a.Exports.JIIX]).label,c.copyElement.setAttribute("data-clipboard-text",JSON.parse(i[a.Exports.JIIX]).label)}else c.smartGuideElement.classList.add("smartguide-out"),c.smartGuideElement.classList.remove("smartguide-in");return s}var Ce=unwrapExports(createCommonjsModule((function(n){n.exports=function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")},n.exports.default=n.exports,n.exports.__esModule=!0}))),ke=unwrapExports(createCommonjsModule((function(n){function _defineProperties(n,i){for(var a=0;a0,i.canRedo=n.currentPosition1&&void 0!==arguments[1])||arguments[1],a=n.stack[n.currentPosition],s=arguments.length,c=new Array(s>2?s-2:0),l=2;l-1)n.stack.splice(s,1,cloneModel(c)),d.debug("model updated",c);else{var u=n;u.currentPosition+=1,u.stack=u.stack.slice(0,u.currentPosition),u.stack.push(cloneModel(c)),u.stack.length>u.maxSize&&(u.stack.shift(),u.currentPosition--),d.debug("model pushed",c),l.push(a.EventType.CHANGED)}return updateUndoRedoState(n),d.debug("undo/redo stack updated",n),getModel.apply(void 0,[n,!1].concat(l))},undo:function undo$1(n,i){var s=n;return s.currentPosition>0&&(s.currentPosition-=1,updateUndoRedoState(n),d.debug("undo index",s.currentPosition)),getModel(n,!0,a.EventType.CHANGED,a.EventType.EXPORTED)},redo:function redo$1(n,i){var s=n;return s.currentPosition1&&void 0!==arguments[1]?arguments[1]:10,a=document,s=a.createElement("canvas");return s.width=Math.abs(n.maxX-n.minX)+2*i,s.style.width="".concat(s.width,"px"),s.height=Math.abs(n.maxY-n.minY)+2*i,s.style.height="".concat(s.height,"px"),s}var Ie=Object.freeze({__proto__:null,inkImporter:function inkImporter(n,i,a,s){var c=n;u.debug("inkImporter start importing =>",i);var l=Object.assign({},c.behavior.grabber);l.detach=c.behavior.grabber.detach,c.behavior.grabber={};var d=[];i.forEach((function(n){n.convert?d.push({action:"convert",value:!0}):n.setDelay?d.push({action:"setDelay",value:n.setDelay}):(n.color&&d.push({action:"setColor",value:n.color}),n.X.forEach((function(i,a){var s="move";0===a?s="down":a===n.X.length-1&&(s="up"),d.push({action:s,point:{x:n.X[a],y:n.Y[a]}})})))})),u.debug("Array of actions =>",d),function play(n,i,a){if(i2&&void 0!==arguments[2]?arguments[2]:n.configuration.triggers[i];return!(!n.recognizer||!n.recognizer.getInfo().availableTriggers[i].includes(a))||(u.error("".concat(a," is not a valid trigger for ").concat(i)),!1)}function _addStrokes(){return _addStrokes=Y(V.mark((function _callee4(n,i){var a,s,c=arguments;return V.wrap((function _callee4$(l){for(;;)switch(l.prev=l.next){case 0:if(a=c.length>2&&void 0!==c[2]?c[2]:n.configuration.triggers.addStrokes,!n.recognizer||!n.recognizer.addStrokes){l.next=13;break}return l.next=4,n.recognizerContext.initPromise;case 4:if(!l.sent){l.next=13;break}if(!isTriggerValid(n,"addStrokes",a)){l.next=13;break}return l.next=9,manageResetState(n,i);case 9:if(!(s=l.sent)){l.next=12;break}return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,s));case 12:return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,i));case 13:return l.abrupt("return",Promise.reject(new Error("Cannot addStrokes")));case 14:case"end":return l.stop()}}),_callee4)}))),_addStrokes.apply(this,arguments)}function _launchPointerEvents(){return(_launchPointerEvents=Y(V.mark((function _callee5(n,i,a){return V.wrap((function _callee5$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.pointerEvents){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.pointerEvents(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch pointerEvents")));case 7:case"end":return s.stop()}}),_callee5)})))).apply(this,arguments)}function launchExport(n,i,a){return _launchExport.apply(this,arguments)}function _launchExport(){return _launchExport=Y(V.mark((function _callee6(n,i,s){var c,l,u,d,p,h=arguments;return V.wrap((function _callee6$(f){for(;;)switch(f.prev=f.next){case 0:if(c=h.length>3&&void 0!==h[3]?h[3]:n.configuration.triggers.exportContent,!n.recognizer||!n.recognizer.export_){f.next=20;break}return f.next=4,n.recognizerContext.initPromise;case 4:if(!f.sent){f.next=20;break}if(!isTriggerValid(n,"exportContent",c)){f.next=20;break}return l=n,window.clearTimeout(n.exportTimer),u=c===a.Trigger.QUIET_PERIOD?n.configuration.triggerDelay:0,d=delay(u),l.exportTimer=d.timer,f.next=14,d.promise;case 14:return f.next=16,manageResetState(n,i);case 16:if(!(p=f.sent)){f.next=19;break}return f.abrupt("return",n.recognizer.export_(n.recognizerContext,p,s));case 19:return f.abrupt("return",n.recognizer.export_(n.recognizerContext,i,s));case 20:return f.abrupt("return",Promise.reject(new Error("Cannot launch export")));case 21:case"end":return f.stop()}}),_callee6)}))),_launchExport.apply(this,arguments)}function _launchImport(){return(_launchImport=Y(V.mark((function _callee7(n,i,a){return V.wrap((function _callee7$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.import_){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.import_(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch import")));case 7:case"end":return s.stop()}}),_callee7)})))).apply(this,arguments)}function _launchGetSupportedImportMimeTypes(){return(_launchGetSupportedImportMimeTypes=Y(V.mark((function _callee8(n,i){return V.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.getSupportedImportMimeTypes){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.getSupportedImportMimeTypes(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch getSupportedImportMimeTypes")));case 7:case"end":return a.stop()}}),_callee8)})))).apply(this,arguments)}function launchConvert(n,i,a){return _launchConvert.apply(this,arguments)}function _launchConvert(){return(_launchConvert=Y(V.mark((function _callee9(n,i,a){return V.wrap((function _callee9$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.convert){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.convert(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch convert")));case 7:case"end":return s.stop()}}),_callee9)})))).apply(this,arguments)}function launchConfig(n,i){return _launchConfig.apply(this,arguments)}function _launchConfig(){return(_launchConfig=Y(V.mark((function _callee10(n,i){return V.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.sendConfiguration){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.sendConfiguration(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch config")));case 7:case"end":return a.stop()}}),_callee10)})))).apply(this,arguments)}function _launchResize(){return(_launchResize=Y(V.mark((function _callee11(n,i){var a,s;return V.wrap((function _callee11$(c){for(;;)switch(c.prev=c.next){case 0:if(!n.recognizer||!n.recognizer.resize){c.next=13;break}return c.next=3,n.recognizerContext.initPromise;case 3:if(!c.sent){c.next=13;break}return a=n,window.clearTimeout(n.resizeTimer),s=delay(n.configuration.resizeTriggerDelay),a.resizeTimer=s.timer,resize$2(n.smartGuide),c.next=12,s.promise;case 12:return c.abrupt("return",n.recognizer.resize(n.recognizerContext,i,n.domElement));case 13:return c.abrupt("return",Promise.reject(new Error("Cannot launch resize")));case 14:case"end":return c.stop()}}),_callee11)})))).apply(this,arguments)}function _launchWaitForIdle(){return(_launchWaitForIdle=Y(V.mark((function _callee12(n,i){return V.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.waitForIdle){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.waitForIdle(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch wait for idle")));case 7:case"end":return a.stop()}}),_callee12)})))).apply(this,arguments)}function _launchClose(){return(_launchClose=Y(V.mark((function _callee13(n,i){return V.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.close){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.close(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch close")));case 7:case"end":return a.stop()}}),_callee13)})))).apply(this,arguments)}function setPenStyle$1(n,i){return _setPenStyle.apply(this,arguments)}function _setPenStyle(){return(_setPenStyle=Y(V.mark((function _callee14(n,i){return V.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyle){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyle(n.recognizerContext,i,n.penStyle));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set pentStyle")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee14)})))).apply(this,arguments)}function setPenStyleClasses$1(n,i){return _setPenStyleClasses.apply(this,arguments)}function _setPenStyleClasses(){return(_setPenStyleClasses=Y(V.mark((function _callee15(n,i){return V.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyleClasses){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyleClasses(n.recognizerContext,i,n.penStyleClasses));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set penStyleClasses")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee15)})))).apply(this,arguments)}function setTheme$1(n,i){return _setTheme.apply(this,arguments)}function _setTheme(){return(_setTheme=Y(V.mark((function _callee16(n,i){return V.wrap((function _callee16$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setTheme){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setTheme(n.recognizerContext,i,n.theme));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set theme")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee16)})))).apply(this,arguments)}var Te=function(){function Editor(n,i,a,s,c,l){Ce(this,Editor),l=l||"ms-editor";var d=document.createElement("style");d.appendChild(document.createTextNode("")),n.appendChild(d);var p=d.sheet;d.textContent="/*\r\n * Container style\r\n */\r\n.ps {\r\n overflow: hidden !important;\r\n overflow-anchor: none;\r\n -ms-overflow-style: none;\r\n touch-action: auto;\r\n -ms-touch-action: auto;\r\n}\r\n/*\r\n * Scrollbar rail styles\r\n */\r\n.ps__rail-x {\r\n display: none;\r\n opacity: 0;\r\n transition: background-color .2s linear, opacity .2s linear;\r\n -webkit-transition: background-color .2s linear, opacity .2s linear;\r\n height: 15px;\r\n /* there must be 'bottom' or 'top' for ps__rail-x */\r\n bottom: 0px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__rail-y {\r\n display: none;\r\n opacity: 0;\r\n transition: background-color .2s linear, opacity .2s linear;\r\n -webkit-transition: background-color .2s linear, opacity .2s linear;\r\n width: 15px;\r\n /* there must be 'right' or 'left' for ps__rail-y */\r\n right: 0;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps--active-x > .ps__rail-x,\r\n.ps--active-y > .ps__rail-y {\r\n display: block;\r\n background-color: transparent;\r\n}\r\n.ps:hover > .ps__rail-x,\r\n.ps:hover > .ps__rail-y,\r\n.ps--focus > .ps__rail-x,\r\n.ps--focus > .ps__rail-y,\r\n.ps--scrolling-x > .ps__rail-x,\r\n.ps--scrolling-y > .ps__rail-y {\r\n opacity: 0.6;\r\n}\r\n.ps .ps__rail-x:hover,\r\n.ps .ps__rail-y:hover,\r\n.ps .ps__rail-x:focus,\r\n.ps .ps__rail-y:focus,\r\n.ps .ps__rail-x.ps--clicking,\r\n.ps .ps__rail-y.ps--clicking {\r\n background-color: #eee;\r\n opacity: 0.9;\r\n}\r\n/*\r\n * Scrollbar thumb styles\r\n */\r\n.ps__thumb-x {\r\n background-color: #aaa;\r\n border-radius: 6px;\r\n transition: background-color .2s linear, height .2s ease-in-out;\r\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\r\n height: 6px;\r\n /* there must be 'bottom' for ps__thumb-x */\r\n bottom: 2px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__thumb-y {\r\n background-color: #aaa;\r\n border-radius: 6px;\r\n transition: background-color .2s linear, width .2s ease-in-out;\r\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\r\n width: 6px;\r\n /* there must be 'right' for ps__thumb-y */\r\n right: 2px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__rail-x:hover > .ps__thumb-x,\r\n.ps__rail-x:focus > .ps__thumb-x,\r\n.ps__rail-x.ps--clicking .ps__thumb-x {\r\n background-color: #999;\r\n height: 11px;\r\n}\r\n.ps__rail-y:hover > .ps__thumb-y,\r\n.ps__rail-y:focus > .ps__thumb-y,\r\n.ps__rail-y.ps--clicking .ps__thumb-y {\r\n background-color: #999;\r\n width: 11px;\r\n}\r\n/* MS supports */\r\n@supports (-ms-overflow-style: none) {\r\n .ps {\r\n overflow: auto !important;\r\n }\r\n}\r\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\r\n .ps {\r\n overflow: auto !important;\r\n }\r\n}\r\n.ms-editor {\n position: relative;\n z-index: 20;\n color: #1A9FFF;\n font-family: sans-serif;\n}\r\n.ms-editor.erasing {\n cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEsSURBVDiNrdO7SgNBFMbx/3fmCbQ1tunDIayFBvFSKxbxBfSdBPEBtLIWb3Ebl4R9AQWLkE70CWbHZl1Eg2iSr5vL+c1hhhFTMhwOdyX1gQ2gVU+PgTyldNHtdq+/1+jroCiKtpmdSupNO6ApkgZmdtzpdJ5+QGVZ9qqqugSWfkO+5F3SnrvnDVQURTuE8PgP5DNvkjJ3fzaAEMLJDAjAclVVZwCqL/ZqBqSJme2YpMN5EIAYY9+A9XkhST0DVuaFgJYtAAGoDJgsAJoYkM+rSHqwlNL5Ajq6EMBoNLoBtmbsZuDumwYQYzwCXmdw3oAjAAPIsuxF0kG98GdE0r67PzcQgLvnIYQ14P4PyF39WZuH0rRdZVluxxj7kjaA1Xp6nFLKzezc3W+/13wAItdV6XjME1AAAAAASUVORK5CYII='), auto;\n}\r\n.ms-editor canvas,\n.ms-editor svg {\n z-index: 15;\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n}\r\n.ms-editor canvas.ms-rendering-canvas {\n z-index: 10;\n pointer-events: none;\n background-image: linear-gradient(to right, #F5F6F7 1px, transparent 1px),\n linear-gradient(to bottom, #F5F6F7 1px, transparent 1px);\n background-size: 18px 18px;\n}\r\n.ms-editor svg {\n z-index: 10;\n pointer-events: none;\n}\r\n.ms-editor svg[data-layer=\"BACKGROUND\"] {\n z-index: 9;\n}\r\n.ms-editor .loader {\n z-index: 30;\n position: absolute;\n width: 120px;\n height: 120px;\n top: calc(50% - 60px);\n left: calc(50% - 60px);\n border: 16px solid #F5F6F7;\n border-radius: 50%;\n border-top-color: #1A9FFF;\n -webkit-animation: spin 2s linear infinite;\n animation: spin 2s linear infinite;\n}\r\n.ms-editor .error-msg {\n z-index: 25;\n position: absolute;\n width: 200px;\n height: 200px;\n top: calc(50% - 100px);\n left: calc(50% - 100px);\n font-size: 16px;\n text-align: center;\n word-wrap: break-word;\n}\r\n.ms-editor .error-msg::before {\n content: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCA3Ni41IDYxMiA0NTkiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiPgogICAgPHBhdGggZmlsbD0iIzFBOUZGRiIgZD0iTTQ5NC43LDIyOS41Yy0xNy44NTEtODYuNy05NC4zNTEtMTUzLTE4OC43LTE1M2MtMzguMjUsMC03My45NSwxMC4yLTEwMiwzMC42bDM4LjI1LDM4LjI1IGMxNy44NS0xMi43NSw0MC44LTE3Ljg1LDYzLjc1LTE3Ljg1Yzc2LjUsMCwxNDAuMjUsNjMuNzUsMTQwLjI1LDE0MC4yNXYxMi43NWgzOC4yNWM0My4zNSwwLDc2LjUsMzMuMTUsNzYuNSw3Ni41IGMwLDI4LjA1LTE1LjMsNTMuNTUtNDAuOCw2Ni4zbDM4LjI1LDM4LjI1QzU5MS42LDQzOC42LDYxMiw0MDAuMzUsNjEyLDM1N0M2MTIsMjkwLjcsNTU4LjQ1LDIzNC42LDQ5NC43LDIyOS41eiBNNzYuNSwxMDkuNjUgbDcxLjQsNjguODVDNjYuMywxODMuNiwwLDI0OS45LDAsMzMxLjVjMCw4NC4xNSw2OC44NSwxNTMsMTUzLDE1M2gyOTguMzVsNTEsNTFsMzMuMTUtMzMuMTVMMTA5LjY1LDc2LjVMNzYuNSwxMDkuNjV6IE0xOTYuMzUsMjI5LjVsMjA0LDIwNEgxNTNjLTU2LjEsMC0xMDItNDUuOS0xMDItMTAyYzAtNTYuMSw0NS45LTEwMiwxMDItMTAySDE5Ni4zNXoiIC8+Cjwvc3ZnPgo=);\n}\r\n.ms-editor .smartguide {\n position: absolute;\n z-index: 40;\n font-size: 16px;\n}\r\n.ms-editor .smartguide.smartguide-in {\n visibility: visible !important;\n transition: opacity 0.5s;\n opacity: 1;\n}\r\n.ms-editor .smartguide.smartguide-out {\n transition: opacity 1s, visibility 1s;\n visibility: hidden !important;\n opacity: 0;\n}\r\n.ms-editor .smartguide .tag-icon {\n padding: 0 18px;\n border: 1px solid #959DA6;\n font-weight: bold;\n font-size: large;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 48px;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n}\r\n.ms-editor .smartguide .ellipsis {\n cursor: pointer;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 38px;\n padding: 0 8px;\n font-weight: bold;\n font-size: x-large;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .ellipsis:active {\n background-color: #e0e0e0;\n}\r\n.ms-editor .smartguide .prompter-text-container {\n background-color: rgba(255, 255, 255, 0.9);\n height: 48px;\n line-height: 48px;\n overflow: hidden;\n white-space: nowrap;\n display: block;\n text-align: left;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 30;\n color: #bfbfbf;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .prompter-text-container > div > span {\n cursor: pointer;\n display: inline-block;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text {\n margin-left: 12px;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text .added-word {\n animation: 0.1s linear word-added,\n 3s ease-in-out color-input;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text .modified-word {\n animation: 0.1s linear word-modified,\n 3s ease-in-out color-input;\n}\r\n.ms-editor .smartguide .candidates {\n color: black;\n flex-direction: column;\n text-align: center;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n box-shadow: 2px 2px 12px #BDBDBD, -2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n z-index: 100;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .candidates > span {\n cursor: pointer;\n padding: 2px 20px;\n}\r\n.ms-editor .smartguide .candidates > span:hover {\n background-color: #EEEEEE;\n}\r\n.ms-editor .smartguide .candidates > span:active {\n background-color: #E0E0E0;\n}\r\n.ms-editor .smartguide .candidates .selected-word {\n font-weight: bold;\n background-color: #E0E0E0;\n}\r\n.ms-editor .smartguide .more-menu {\n flex-direction: column;\n margin-right: 12px;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n z-index: 100;\n box-shadow: 2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button {\n color: black;\n font-size: 16px;\n cursor: pointer;\n box-sizing: border-box;\n background: transparent;\n border: none;\n padding: 0 24px;\n margin: 0;\n height: 40px;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button:hover {\n background-color: #EEEEEE;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button:active {\n background-color: #E0E0E0;\n}\r\n.ms-editor .ps__rail-x {\n top: 32px !important;\n}\r\n/** Stroke **/\r\n.ms-editor .removed-stroke {\n opacity: 0;\n transition: opacity 0.1s ease-in-out;\n}\r\n.ms-editor .added-stroke {\n animation: 0.2s opacity-appear;\n}\r\n@keyframes color-input {\n 0% {\n color: black;\n }\n 100% {\n color: #bfbfbf;\n }\n}\r\n@keyframes word-added {\n 0% {\n transform: translate(5px, 0);\n }\n 100% {\n transform: none;\n }\n}\r\n@keyframes word-modified {\n 0% {\n transform: translate(0, 5px);\n }\n 100% {\n transform: none;\n }\n}\r\n@keyframes opacity-appear {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity : 1;\n }\n}\r\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\r\n@-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n }\n}\n",this.sheet=p,this.domElement=n,this.domElement.classList.add(l),this.loader=document.createElement("div"),this.loader.classList.add("loader"),this.loader=this.domElement.appendChild(this.loader),this.error=document.createElement("div"),this.error.classList.add("error-msg"),this.error=this.domElement.appendChild(this.error),this.exportTimer=void 0,this.resizeTimer=void 0,this.notifyTimer=void 0,this.innerBehaviors=function overrideDefaultBehaviors(n){if(n){var i={grabber:n.grabber||Xe.grabber,rendererList:n.rendererList||Xe.rendererList,strokerList:n.strokerList||Xe.strokerList,recognizerList:n.recognizerList||Xe.recognizerList,events:n.events||Xe.events,getBehaviorFromConfiguration:n.getBehaviorFromConfiguration||Xe.getBehaviorFromConfiguration};return u.debug("Override default behaviors",i),i}return Xe}(c),this.configuration=i,this.localTheme="",this.theme=s,this.penStyle=a,this.penStyleClasses="",this.isErasing=!1,this.domElement.editor=this}var n,i;return ke(Editor,[{key:"configuration",get:function get(){return this.innerConfiguration},set:function set(n){this.loader.style.display="initial",this.error.style.display="none",this.innerConfiguration=function overrideDefaultConfiguration(n){var i,a=n;return a&&a.recognitionParams.server&&a.recognitionParams.server.useWindowLocation?(a.recognitionParams.server.scheme=window.location.protocol.slice(0,-1),a.recognitionParams.server.host=window.location.host,i=m({},v,void 0===a?{}:a)):i=m({},v,void 0===n?{}:n),u.debug("Override default configuration",i),i}(n),this.behavior=this.behaviors.getBehaviorFromConfiguration(this.behaviors,this.innerConfiguration),this.smartGuide?function reset$1(n){var i=n.elements;i.candidatesElement.innerHTML="",i.smartGuideElement.classList.add("smartguide-out"),i.smartGuideElement.classList.remove("smartguide-in")}(this.smartGuide):this.smartGuide=createSmartGuide(this)}},{key:"penStyle",get:function get(){return this.innerPenStyle},set:function set(n){this.innerPenStyle=function overrideDefaultPenStyle(n){var i=m({},void 0,void 0===n?{}:n);return u.debug("Override default pen style",i),i}(n),this.localPenStyle=this.innerPenStyle,setPenStyle$1(this,this.model)}},{key:"penStyleClasses",get:function get(){return this.innerPenStyleClasses},set:function set(n){this.innerPenStyleClasses=n,this.localPenStyle=this.theme[".".concat(this.innerPenStyleClasses)],setPenStyleClasses$1(this,this.model)}},{key:"theme",get:function get(){return this.innerTheme},set:function set(n){this.innerTheme=function overrideDefaultTheme(n){var i=m({},_,void 0===n?{}:n);return u.debug("Override default theme",i),i}(n),setTheme$1(this,this.model)}},{key:"behaviors",get:function get(){return this.innerBehaviors}},{key:"behavior",get:function get(){return this.innerBehavior},set:function set(n){n&&(this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerBehavior=n,this.renderer=this.innerBehavior.renderer,this.recognizer=this.innerBehavior.recognizer,this.grabberContext=this.grabber.attach(this.domElement,this))}},{key:"recognizer",get:function get(){return this.innerRecognizer},set:function set(n){var i=this;this.undoRedoContext=function createUndoRedoContext(n){return{stack:[],currentPosition:-1,maxSize:n.undoRedoMaxStackSize,canUndo:!1,canRedo:!1}}(this.configuration),this.undoRedoManager=Pe;var a=function initialize(a,s){i.innerRecognizer=n,i.innerRecognizer&&(i.recognizerContext=createEmptyRecognizerContext(i),i.innerRecognizer.undo&&i.innerRecognizer.redo&&i.innerRecognizer.clear&&(i.undoRedoContext=i.recognizerContext,i.undoRedoManager=i.innerRecognizer),i.innerRecognizer.init(i.recognizerContext,a).then((function(n){u.info("Recognizer initialized !"),s&&(setTheme$1(i,i.model),setPenStyle$1(i,i.model),setPenStyleClasses$1(i,i.model)),i.loader.style.display="none"})).catch((function(n){return handleError(i,n)})))};n&&(this.innerRecognizer?this.innerRecognizer.close(this.recognizerContext,this.model).then((function(n){u.info("Recognizer closed"),handleSuccess(i,n),a(clearModel(n),!0)})).catch((function(n){return handleError(i,n)})):(this.model=createModel(this.configuration),a(this.model,!1)))}},{key:"renderer",get:function get(){return this.innerRenderer},set:function set(n){n&&(this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext),this.innerRenderer=n,this.innerRenderer&&(this.rendererContext=this.innerRenderer.attach(this.domElement,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth)))}},{key:"grabber",get:function get(){return this.behavior?this.behavior.grabber:void 0}},{key:"stroker",get:function get(){return this.behavior?this.behavior.stroker:void 0}},{key:"emit",get:function get(){return this.behavior?this.behavior.events:void 0}},{key:"png",get:function get(){return function getImage(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(n.rawStrokes.length>0){var s=getBorderCoordinates(n),c=createCanvas(s,a),l=createCanvas(s,a),u={renderingCanvas:l,renderingCanvasContext:l.getContext("2d"),capturingCanvas:c,capturingCanvasContext:c.getContext("2d")};return u.renderingCanvasContext.translate(-s.minX+a,-s.minY+a),drawModel$1(u,n,i),u.renderingCanvas.toDataURL("image/png")}return null}(this.model,this.stroker)}},{key:"initialized",get:function get(){return!!this.recognizerContext&&this.recognizerContext.initialized}},{key:"enableEraser",value:function enableEraser(){this.isErasing=!0,this.domElement.classList.add("erasing")}},{key:"disableEraser",value:function disableEraser(){document.body.style.cursor="initial",this.isErasing=!1,this.domElement.classList.remove("erasing")}},{key:"pointerDown",value:function pointerDown(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pen",a=arguments.length>2?arguments[2]:void 0;u.trace("Pointer down",n),window.clearTimeout(this.notifyTimer),window.clearTimeout(this.exportTimer),this.model=initPendingStroke(this.model,n,Object.assign({pointerType:i,pointerId:a},this.theme.ink,this.localPenStyle)),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerMove",value:function pointerMove(n){u.trace("Pointer move",n),this.model=appendToPendingStroke(this.model,n),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerUp",value:function pointerUp(n){u.trace("Pointer up",n),this.model=endPendingStroke(this.model,n,this.penStyle),this.isErasing||this.renderer.drawModel(this.rendererContext,this.model,this.stroker),this.recognizer.addStrokes?function addStrokes$1(n,i){return _addStrokes.apply(this,arguments)}(this,this.model):handleSuccess(this,this.model)}},{key:"removeStroke",value:function removeStroke(n){this.model.strokeGroups.forEach((function(i){var a=i.strokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==a&&i.strokes.splice(a,1)}));var i=this.model.rawStrokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==i&&this.model.rawStrokes.splice(i,1),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model),"DEMAND"!==this.configuration.triggers.exportContent&&launchExport(this,this.model)}},{key:"reDraw",value:function reDraw(n,i){var a=this;n.forEach((function(n){addStroke(a.model,n)})),i.forEach((function(n){n.strokes.forEach((function(i){addStrokeToGroup(a.model,i,n.penStyle)}))})),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model)}},{key:"idle",get:function get(){return this.recognizerContext.idle}},{key:"waitForIdle",value:function waitForIdle(){return emitEvents(this,void 0,a.EventType.IDLE),function launchWaitForIdle(n,i){return _launchWaitForIdle.apply(this,arguments)}(this,this.model)}},{key:"canUndo",get:function get(){return this.undoRedoContext.canUndo}},{key:"undo",value:(i=Y(V.mark((function _callee(){var n,i,s,c=this;return V.wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:return u.debug("Undo current model",this.model),emitEvents(this,void 0,a.EventType.UNDO),l.next=4,this.undoRedoManager.undo(this.undoRedoContext,this.model).catch((function(n){return handleError(c,n)}));case 4:return n=l.sent,i=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,i].concat(A(s))),l.abrupt("return",i);case 9:case"end":return l.stop()}}),_callee,this)}))),function undo(){return i.apply(this,arguments)})},{key:"canRedo",get:function get(){return this.undoRedoContext.canRedo}},{key:"redo",value:(n=Y(V.mark((function _callee2(){var n,i,s,c=this;return V.wrap((function _callee2$(l){for(;;)switch(l.prev=l.next){case 0:return u.debug("Redo current model",this.model),emitEvents(this,void 0,a.EventType.REDO),l.next=4,this.undoRedoManager.redo(this.undoRedoContext,this.model).catch((function(n){return handleError(c,n)}));case 4:return n=l.sent,i=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,i].concat(A(s))),l.abrupt("return",i);case 9:case"end":return l.stop()}}),_callee2,this)}))),function redo(){return n.apply(this,arguments)})},{key:"isEmpty",get:function get(){return this.recognizerContext.isEmpty}},{key:"canClear",get:function get(){return!this.isEmpty}},{key:"clear",value:function(){var n=Y(V.mark((function _callee3(){var n,i,s,c=this;return V.wrap((function _callee3$(l){for(;;)switch(l.prev=l.next){case 0:if(!this.canClear){l.next=10;break}return u.debug("Clear current model",this.model),emitEvents(this,void 0,a.EventType.CLEAR),l.next=5,this.recognizer.clear(this.recognizerContext,this.model).catch((function(n){return handleError(c,n)}));case 5:return n=l.sent,i=n.res,s=n.events,handleSuccess.apply(void 0,[this,i].concat(A(s))),l.abrupt("return",i);case 10:return l.abrupt("return",Promise.reject(new Error("Cannot launch clear")));case 11:case"end":return l.stop()}}),_callee3,this)})));return function clear(){return n.apply(this,arguments)}}()},{key:"canConvert",get:function get(){return!!(this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.convert)}},{key:"convert",value:function convert(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"DIGITAL_EDIT";return this.canConvert?(emitEvents(this,void 0,a.EventType.CONVERT),launchConvert(this,this.model,n)):Promise.reject(new Error("Cannot launch convert"))}},{key:"setGuides",value:function setGuides(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.configuration.recognitionParams.iink.text.guides.enable=n,launchConfig(this,this.model)}},{key:"possibleUndoCount",get:function get(){return this.recognizerContext.possibleUndoCount}},{key:"undoStackIndex",get:function get(){return this.recognizerContext.undoStackIndex}},{key:"canExport",get:function get(){return this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.getInfo().availableTriggers.exportContent.includes(a.Trigger.DEMAND)}},{key:"export_",value:function export_(n){return this.canExport?(emitEvents(this,void 0,a.EventType.EXPORT),launchExport(this,this.model,n,a.Trigger.DEMAND)):Promise.reject(new Error("Cannot launch export"))}},{key:"import_",value:function import_(n,i){return emitEvents(this,void 0,a.EventType.IMPORT),function launchImport(n,i,a){return _launchImport.apply(this,arguments)}(this,this.model,n instanceof Blob?n:new Blob([n],{type:i}))}},{key:"getSupportedImportMimeTypes",value:function getSupportedImportMimeTypes(){return function launchGetSupportedImportMimeTypes(n,i){return _launchGetSupportedImportMimeTypes.apply(this,arguments)}(this,this.model)}},{key:"pointerEvents",value:function pointerEvents(n){return function launchPointerEvents(n,i,a){return _launchPointerEvents.apply(this,arguments)}(this,this.model,n)}},{key:"exports",get:function get(){return this.model?this.model.exports:void 0}},{key:"supportedImportMimeTypes",get:function get(){return this.recognizerContext.supportedImportMimeTypes}},{key:"resize",value:function resize(){return u.debug("Resizing editor"),this.renderer.resize(this.rendererContext,this.model,this.stroker,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth),function launchResize(n,i){return _launchResize.apply(this,arguments)}(this,this.model)}},{key:"unload",value:function unload(){this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext)}},{key:"close",value:function close(){return this.configuration.recognitionParams.protocol===a.Protocol.WEBSOCKET?function launchClose(n,i){return _launchClose.apply(this,arguments)}(this,this.model):null}},{key:"forceChange",value:function forceChange(){emitEvents(this,void 0,a.EventType.CHANGED)}},{key:"eastereggs",get:function get(){return Ie}}]),Editor}();function emitEvents(n,i){for(var s=n,c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?l-2:0),d=2;d=n.model.lastPositions.lastReceivedPosition?(s.model=mergeModels(s.model,c),(needRedraw(s.model)||u.includes(a.EventType.RENDERED))&&n.renderer.drawModel(n.rendererContext,s.model,n.stroker)):(s.model=c,n.renderer.drawModel(n.rendererContext,s.model,n.stroker)),emitEvents.apply(void 0,[n,void 0].concat(u))),"TEXT"===n.configuration.recognitionParams.type&&"REST"!==n.configuration.recognitionParams.protocol&&n.configuration.recognitionParams.iink.text.mimeTypes.includes(a.Exports.JIIX)&&n.configuration.recognitionParams.iink.text.smartGuide&&(s.smartGuide=launchSmartGuide(n.smartGuide,c.exports)),extractPendingStrokes(i).length>0&&!n.recognizer.addStrokes&&n.configuration.triggers.exportContent!==a.Trigger.DEMAND&&launchExport(n,i)}function handleError(n,i){var s=n;if("close"!==i.type&&f.error("Error while firing the recognition",i.stack||i),"Invalid application key."===i.message||"Invalid HMAC"===i.message||i.error&&i.error.result&&i.error.result.error&&("InvalidApplicationKeyException"===i.error.result.error||"InvalidHMACSignatureException"===i.error.result.error)||i.code&&"access.not.granted"===i.code?s.error.innerText=a.Error.WRONG_CREDENTIALS:i.code&&"no.activity"===i.code?s.error.innerText=a.Error.NO_ACTIVITY:"Session is too old. Max Session Duration Reached."===i.message||i.code&&"session.too.old"===i.code?s.error.innerText=a.Error.TOO_OLD:1006!==i.code&&1e3!==i.code||"none"!==s.error.style.display||(s.error.innerText=a.Error.NOT_REACHABLE),s.error.innerText!==a.Error.TOO_OLD&&"CLOSE_RECOGNIZER"!==i.reason||!canReconnect(n.recognizerContext)){s.loader.style.display="none",s.error.style.display="initial";for(var c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?a-2:0),c=2;c4&&void 0!==arguments[4]?arguments[4]:"",l=arguments.length>5?arguments[5]:void 0,u=i.editor.configuration;return post(i,"".concat(u.recognitionParams.server.scheme,"://").concat(u.recognitionParams.server.host).concat(n),s(i,a,c),"V4",l).then((function(n){f.debug("iinkRestRecognizer success",n);var a=i.lastPositions;a.lastReceivedPosition=a.lastSentPosition;var s=updateRecognitionPositions(i,a);return n.instanceId&&(s.instanceId=n.instanceId),n}))}function buildData(n,i,a){var s,c=n.editor.configuration;"TEXT"===c.recognitionParams.type?s=function buildTextConf(n){return{text:n.recognitionParams.iink.text,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"MATH"===c.recognitionParams.type?s=function buildMathConf(n){return{math:n.recognitionParams.iink.math,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"DIAGRAM"===c.recognitionParams.type?s=function buildDiagramConf(n){return{diagram:n.recognitionParams.iink.diagram,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"Raw Content"===c.recognitionParams.type&&(s=function buildRawContentConf(n){return{"raw-content":{recognition:n.recognitionParams.iink["raw-content"].recognition},lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c));var l=[];i.strokeGroups.forEach((function(n){var i={penStyle:"{}"===JSON.stringify(n.penStyle)?null:toCSS$1(n.penStyle),strokes:n.strokes.map((function(n){return function toJSON(n){return{x:n.x,y:n.y,t:n.t,pointerType:n.pointerType}}(n)}))};l.push(i)}));var u={configuration:s,xDPI:96,yDPI:96,contentType:"Raw Content"===c.recognitionParams.type?"Raw Content":c.recognitionParams.type.charAt(0).toUpperCase()+c.recognitionParams.type.slice(1).toLowerCase(),theme:toCSS(n.editor.theme),strokeGroups:l};return n.editor.domElement&&(u.height=n.editor.domElement.clientHeight,u.width=n.editor.domElement.clientWidth),a&&(u.conversionState="DIGITAL_EDIT"),updateModelSentPosition(i),u}function extractExports(n,i,a){var s={};return s[i]=a,s}function resultCallback(n,i,s,c,l){f.debug("iinkRestRecognizer result callback",i);var u=updateModelReceivedPosition(i);u.rawResults.exports=c,u.exports?Object.assign(u.exports,extractExports(0,l,c)):u.exports=extractExports(0,l,c),f.debug("iinkRestRecognizer model updated",u),n.editor.undoRedoManager&&handleSuccess(n.editor,u,a.EventType.EXPORTED,a.EventType.IDLE)}function callPostMessage(n,i,a){var s=n.editor.configuration;return postMessage("/api/v4.0/iink/batch",n,i,buildData,s.restConversionState,a).then((function(s){return resultCallback(n,i,0,s,a),i})).catch((function(i){return handleError(n.editor,i),i}))}function export_$1(n,i,a){var s=n.editor.configuration;return a?Promise.all(a.map((function(a){return callPostMessage(n,i,a)}))):"TEXT"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.text.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"DIAGRAM"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.diagram.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"MATH"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.math.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"Raw Content"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink["raw-content"].mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):Promise.reject(new Error("Export failed"))}var Re=Object.freeze({__proto__:null,iinkRestConfiguration:Me,getInfo:function getInfo$1(){return Me},postMessage:postMessage,export_:export_$1,convert:function convert$1(n,i){var a=n.editor.configuration;postMessage("/api/v4.0/iink/batch",n,i,buildData,"DIGITAL_EDIT").then((function(n){return resultCallback(i,a)})).catch((function(i){return handleError(n.editor,i)}))},resize:function resize$1(n,i){i.strokeGroups.length&&export_$1(n,i)},init:function init$2(n,i){var s=resetModelPositions(i);f.debug("Updated model",s);var c=updateRecognitionPositions(n,s.lastPositions);return c.initPromise=Promise.resolve(s),c.initPromise.then((function(n){return c.initialized=!0,f.debug("Updated recognizer context",c),handleSuccess(c.editor,n,a.EventType.LOADED),n}))},close:function close$2(n,i){var a=n;return a.initialized=!1,delete a.instanceId,Promise.resolve(i)},clear:clear$2,reset:function reset(n,i){var a=resetModelPositions(i);f.debug("Updated model",a);var s=updateRecognitionPositions(n,a.lastPositions);return delete s.instanceId,f.debug("Updated recognizer context",s),Promise.resolve({res:a})}}),Le=createCommonjsModule((function(n){n.exports=function _arrayWithHoles(n){if(Array.isArray(n))return n},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(Le);var Ae=createCommonjsModule((function(n){n.exports=function _iterableToArrayLimit(n,i){var a=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=a){var s,c,l=[],u=!0,d=!1;try{for(a=a.call(n);!(u=(s=a.next()).done)&&(l.push(s.value),!i||l.length!==i);u=!0);}catch(n){d=!0,c=n}finally{try{u||null==a.return||a.return()}finally{if(d)throw c}}return l}},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(Ae);var De=createCommonjsModule((function(n){n.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(De);var je=unwrapExports(createCommonjsModule((function(n){n.exports=function _slicedToArray(n,i){return Le(n)||Ae(n,i)||R(n,i)||De()},n.exports.default=n.exports,n.exports.__esModule=!0})));function UUIDjs(){}function getRandomInt(n,i){return Math.floor(Math.random()*(i-n+1))+n}UUIDjs.maxFromBits=function(n){return Math.pow(2,n)},UUIDjs.limitUI04=UUIDjs.maxFromBits(4),UUIDjs.limitUI06=UUIDjs.maxFromBits(6),UUIDjs.limitUI08=UUIDjs.maxFromBits(8),UUIDjs.limitUI12=UUIDjs.maxFromBits(12),UUIDjs.limitUI14=UUIDjs.maxFromBits(14),UUIDjs.limitUI16=UUIDjs.maxFromBits(16),UUIDjs.limitUI32=UUIDjs.maxFromBits(32),UUIDjs.limitUI40=UUIDjs.maxFromBits(40),UUIDjs.limitUI48=UUIDjs.maxFromBits(48),UUIDjs.randomUI04=function(){return getRandomInt(0,UUIDjs.limitUI04-1)},UUIDjs.randomUI06=function(){return getRandomInt(0,UUIDjs.limitUI06-1)},UUIDjs.randomUI08=function(){return getRandomInt(0,UUIDjs.limitUI08-1)},UUIDjs.randomUI12=function(){return getRandomInt(0,UUIDjs.limitUI12-1)},UUIDjs.randomUI14=function(){return getRandomInt(0,UUIDjs.limitUI14-1)},UUIDjs.randomUI16=function(){return getRandomInt(0,UUIDjs.limitUI16-1)},UUIDjs.randomUI32=function(){return getRandomInt(0,UUIDjs.limitUI32-1)},UUIDjs.randomUI40=function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)},UUIDjs.randomUI48=function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)},UUIDjs.paddedString=function(n,i,a){a=a||"0";for(var s=i-(n=String(n)).length;s>0;s>>>=1,a+=a)1&s&&(n=a+n);return n},UUIDjs.prototype.fromParts=function(n,i,a,s,c,l){return this.version=a>>12&15,this.hex=UUIDjs.paddedString(n.toString(16),8)+"-"+UUIDjs.paddedString(i.toString(16),4)+"-"+UUIDjs.paddedString(a.toString(16),4)+"-"+UUIDjs.paddedString(s.toString(16),2)+UUIDjs.paddedString(c.toString(16),2)+"-"+UUIDjs.paddedString(l.toString(16),12),this},UUIDjs.prototype.toString=function(){return this.hex},UUIDjs.prototype.toURN=function(){return"urn:uuid:"+this.hex},UUIDjs.prototype.toBytes=function(){for(var n=this.hex.split("-"),i=[],a=0,s=0;s>>16,timestamp:i}},UUIDjs._create4=function(){return(new UUIDjs).fromParts(UUIDjs.randomUI32(),UUIDjs.randomUI16(),16384|UUIDjs.randomUI12(),128|UUIDjs.randomUI06(),UUIDjs.randomUI08(),UUIDjs.randomUI48())},UUIDjs._create1=function(){var n=(new Date).getTime(),i=UUIDjs.randomUI14(),a=1099511627776*(1|UUIDjs.randomUI08())+UUIDjs.randomUI40(),s=UUIDjs.randomUI04(),c=0;n!=c?(n>>8|128,h=255&i;return(new UUIDjs).fromParts(u,l.mid,d,p,h,a)},UUIDjs.create=function(n){return this["_create"+(n=n||4)]()},UUIDjs.fromTime=function(n,i){i=i||!1;var a=UUIDjs.getTimeFieldValues(n),s=a.low,c=4095&a.hi|4096;return!1===i?(new UUIDjs).fromParts(s,a.mid,c,0,0,0):(new UUIDjs).fromParts(s,a.mid,c,128|UUIDjs.limitUI06,UUIDjs.limitUI08-1,UUIDjs.limitUI48-1)},UUIDjs.firstFromTime=function(n){return UUIDjs.fromTime(n,!1)},UUIDjs.lastFromTime=function(n){return UUIDjs.fromTime(n,!0)},UUIDjs.fromURN=function(n){var i;return(i=/^(?:urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\})?$/i.exec(n))?(new UUIDjs).fromParts(parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),parseInt(i[4],16),parseInt(i[5],16),parseInt(i[6],16)):null},UUIDjs.fromBytes=function(n){if(n.length<5)return null;for(var i="",a=0,s=[4,2,2,2,6],c=0;c255||i[a]<0)throw new Error("Unexpected byte in binary data.");return UUIDjs.fromBytes(i)},UUIDjs.new=function(){return this.create(4)},UUIDjs.newTS=function(){return this.create(1)};var Ue=UUIDjs;function infinitePing(n){var i=n;i.pingLostCount++,i.pingLostCount>i.maxPingLost?n.close(1e3,"PING_LOST"):i.readyState<=1&&setTimeout((function(){i.readyState<=1&&(i.send(JSON.stringify({type:"ping"})),infinitePing(i))}),i.pingDelay)}function openWebSocket(n){var i;try{i=new WebSocket(n.url)}catch(n){f.error("Unable to open websocket, Check the host and your connectivity")}return function addWebsocketAttributes(n,i){var a=i.editor.configuration.recognitionParams.server.websocket,s=n;s.start=new Date,s.autoReconnect=a.autoReconnect,s.maxRetryCount=a.maxRetryCount,s.pingEnabled=a.pingEnabled,s.pingDelay=a.pingDelay,s.maxPingLost=a.maxPingLostCount,s.pingLostCount=0,s.recognizerContext=i}(i,n),i.pingEnabled&&infinitePing(i),i.onopen=function(i){f.trace("onOpen"),n.websocketCallback(i)},i.onclose=function(a){f.trace("onClose",new Date-i.start),n.websocketCallback(a)},i.onerror=function(i){f.trace("onError"),n.websocketCallback(i)},i.onmessage=function(a){if(f.trace("onMessage"),i.pingLostCount=0,"pong"!==JSON.parse(a.data).type){var s={type:a.type,data:JSON.parse(a.data)};n.websocketCallback(s)}},i}function send(n,i){var a=n;a.idle=!1;var s=a.websocket;if(1!==s.readyState)throw ee;s.send(JSON.stringify(i)),f.debug("".concat(i.type," message sent"),i)}function buildWebSocketCallback(n){return function(i){var a=n;f.trace("".concat(i.type," websocket callback"),i);var s=n.recognitionContexts[n.recognitionContexts.length-1];switch(f.debug("Current recognition context",s),i.type){case"open":n.sessionId?send(n,buildRestoreIInkSessionInput(n.editor.configuration,n.editor.domElement,n.sessionId)):send(n,buildNewContentPackageInput(n.editor.configuration,n.editor.domElement));break;case"message":switch(f.debug("Receiving ".concat(i.data.type," message"),i),i.data.type){case"ack":i.data.hmacChallenge&&send(n,function buildHmacMessage(n,i){return{type:"hmac",hmac:computeHmac(i.data.hmacChallenge,n.recognitionParams.server.applicationKey,n.recognitionParams.server.hmacKey)}}(n.editor.configuration,i)),i.data.iinkSessionId&&(a.sessionId=i.data.iinkSessionId);break;case"newPart":break;case"contentPackageDescription":a.currentReconnectionCount=0,a.contentPartCount=i.data.contentPartCount,send(n,buildConfiguration(n.editor.configuration)),a.currentPartId?send(n,buildOpenContentPart(n.editor.configuration,n.currentPartId)):send(n,buildNewContentPart(n.editor.configuration));break;case"partChanged":i.data.partId&&(a.currentPartId=i.data.partId),a.initialized=!0,s.partChange?s.partChange.resolve([void 0,i.data]):s.error(i);break;case"contentChanged":void 0!==i.data.canUndo&&(a.canUndo=i.data.canUndo),void 0!==i.data.canRedo&&(a.canRedo=i.data.canRedo),void 0!==i.data.empty&&(a.isEmpty=i.data.empty),void 0!==i.data.possibleUndoCount&&(a.possibleUndoCount=i.data.possibleUndoCount),void 0!==i.data.undoStackIndex&&(a.undoStackIndex=i.data.undoStackIndex),s.contentChange.resolve([void 0,i.data]);break;case"exported":case"fileChunkAck":s.response(void 0,i.data);break;case"svgPatch":s.patch(void 0,i.data);break;case"supportedImportMimeTypes":a.supportedImportMimeTypes=i.data.mimeTypes,s.response(void 0,i.data);break;case"idle":a.idle=!0,s.patch(void 0,i.data);break;case"error":if(f.debug("Error detected stopping all recognition",i),s){var c=function func(){};s.patch?c=s.patch:s.response&&(c=s.response),c(i.data)}else s.initPromise.reject(Object.assign({},i.data,{recoverable:!1}));break;default:f.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}break;case"error":if(f.debug("Error detected stopping all recognition",i),s){var l=function _func(){};s.patch?l=s.patch:s.response&&(l=s.response),l(Object.assign({},i,{recoverable:!1}))}else s.initPromise.reject(Object.assign({},i,{recoverable:!1}));break;case"close":f.debug("Close detected stopping all recognition",i),a.initialized=!1,"CLOSE_RECOGNIZER"===i.reason?s.initPromise.resolve(i):s?s.error(i):s.initPromise.reject(i);break;default:f.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}}}function init$1(n,i,a,s){var c=i.recognitionContexts[0],l=updateRecognitionPositions(i,c.model.lastPositions);return l.url=function buildUrl(n,i){var a="https"===n.recognitionParams.server.scheme?"wss":"ws";return"".concat(a,"://").concat(n.recognitionParams.server.host).concat(i)}(i.editor.configuration,n),l.reconnect=s,l.initPromise=c.initPromise.promise,f.debug("Opening the websocket for context ",i),l.websocketCallback=a(l),l.websocket=openWebSocket(l),l.initPromise}function retry(n,i,a,s){return _retry.apply(this,arguments)}function _retry(){return _retry=Y(V.mark((function _callee(n,i,a,s){var c,l,u,d=arguments;return V.wrap((function _callee$(p){for(;;)switch(p.prev=p.next){case 0:for(c=d.length,l=new Array(c>4?c-4:0),u=4;u2?a-2:0),c=2;c0)return updateModelSentPosition(i),{type:"addStrokes",strokes:a.map((function(n){return Object.assign({},{id:n.id,pointerType:n.pointerType,pointerId:n.pointerId,x:n.x,y:n.y,t:n.t,p:n.p})}))}}function buildUndo(){return{type:"undo"}}function buildRedo(){return{type:"redo"}}function buildClear(){return{type:"clear"}}function buildConvert(n){return{type:"convert",conversionState:n}}function buildZoom(n){return{type:"zoom",zoom:n}}function buildResize(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{type:"changeViewSize",height:n.clientHeight3?c-3:0),u=3;ua.size];u.push(_prepareMessage.apply(void 0,[c,i,buildImportChunk].concat(p)))}))},p=0;p2&&void 0!==arguments[2]?arguments[2]:10;return _prepareMessage(n,i,buildZoom,a)},setPenStyle:setPenStyle,setPenStyleClasses:setPenStyleClasses,setTheme:setTheme,close:close});var Xe={grabber:P,strokerList:[z,G],rendererList:[O,B],recognizerList:[Re,We],events:function emit(n,i){g.info("emitting ".concat(n," event"),i),this.dispatchEvent(new CustomEvent(n,Object.assign({bubbles:!0,composed:!0},i?{detail:i}:void 0)))},getBehaviorFromConfiguration:function getBehaviorFromConfiguration(n,i){var a={};return a.grabber=n.grabber,i&&("REST"===i.recognitionParams.protocol?(a.stroker=z,a.renderer=O,a.recognizer=Re):(a.stroker=G,a.renderer=B,a.recognizer=We)),a.events=n.events,a}};function register(n,i,a,s,c,l){return u.debug("Registering a new editor"),new Te(n,i,a,s,c,l)}function getAvailableLanguageList(n){return _getAvailableLanguageList.apply(this,arguments)}function _getAvailableLanguageList(){return(_getAvailableLanguageList=Y(V.mark((function _callee(n){var i,a;return V.wrap((function _callee$(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!(n&&n.recognitionParams&&n.recognitionParams.server&&n.recognitionParams.server.host)){s.next=10;break}return i=n.recognitionParams.server,s.next=5,fetch("".concat(i.scheme,"://").concat(i.host,"/api/v4.0/iink/availableLanguageList"));case 5:if(!(a=s.sent)||!a.ok){s.next=8;break}return s.abrupt("return",a.json());case 8:s.next=11;break;case 10:console.error("Cannot get languages ! Please check your configuration!");case 11:s.next=16;break;case 13:s.prev=13,s.t0=s.catch(0),console.error(s.t0);case 16:case"end":return s.stop()}}),_callee,null,[[0,13]])})))).apply(this,arguments)}var He={Constants:a,DefaultConfiguration:v,DefaultBehaviors:Xe,DefaultPenStyle:undefined,DefaultTheme:_,register:register,getAvailableLanguageList:getAvailableLanguageList,LoggerConfig:l,Editor:Te,InkModel:U,RecognizerContext:te};export{a as Constants,Xe as DefaultBehaviors,v as DefaultConfiguration,x as DefaultPenStyle,_ as DefaultTheme,Te as Editor,U as InkModel,l as LoggerConfig,te as RecognizerContext,He as default,getAvailableLanguageList,register}; +function get(n){return getComputedStyle(n)}function set(n,i){for(var a in i){var s=i[a];"number"==typeof s&&(s+="px"),n.style[a]=s}return n}function div(n){var i=document.createElement("div");return i.className=n,i}var q="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function matches(n,i){if(!q)throw new Error("No element matching method supported");return q.call(n,i)}function remove$1(n){n.remove?n.remove():n.parentNode&&n.parentNode.removeChild(n)}function queryChildren(n,i){return Array.prototype.filter.call(n.children,(function(n){return matches(n,i)}))}var Z="ps",Q="ps__rtl",ee={thumb:function(n){return"ps__thumb-"+n},rail:function(n){return"ps__rail-"+n},consuming:"ps__child--consume"},te={focus:"ps--focus",clicking:"ps--clicking",active:function(n){return"ps--active-"+n},scrolling:function(n){return"ps--scrolling-"+n}},ne={x:null,y:null};function addScrollingClass(n,i){var a=n.element.classList,s=te.scrolling(i);a.contains(s)?clearTimeout(ne[i]):a.add(s)}function removeScrollingClass(n,i){ne[i]=setTimeout((function(){return n.isAlive&&n.element.classList.remove(te.scrolling(i))}),n.settings.scrollingThreshold)}var re=function EventElement(n){this.element=n,this.handlers={}},oe={isEmpty:{configurable:!0}};re.prototype.bind=function bind(n,i){void 0===this.handlers[n]&&(this.handlers[n]=[]),this.handlers[n].push(i),this.element.addEventListener(n,i,!1)},re.prototype.unbind=function unbind(n,i){var a=this;this.handlers[n]=this.handlers[n].filter((function(s){return!(!i||s===i)||(a.element.removeEventListener(n,s,!1),!1)}))},re.prototype.unbindAll=function unbindAll(){for(var n in this.handlers)this.unbind(n)},oe.isEmpty.get=function(){var n=this;return Object.keys(this.handlers).every((function(i){return 0===n.handlers[i].length}))},Object.defineProperties(re.prototype,oe);var ie=function EventManager(){this.eventElements=[]};function createEvent(n){if("function"==typeof window.CustomEvent)return new CustomEvent(n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,!1,!1,void 0),i}function processScrollDiff(n,i,a,s,c){var l;if(void 0===s&&(s=!0),void 0===c&&(c=!1),"top"===i)l=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==i)throw new Error("A proper axis should be provided");l=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function processScrollDiff$1(n,i,a,s,c){var l=a[0],u=a[1],d=a[2],p=a[3],h=a[4],f=a[5];void 0===s&&(s=!0);void 0===c&&(c=!1);var g=n.element;n.reach[p]=null,g[d]<1&&(n.reach[p]="start");g[d]>n[l]-n[u]-1&&(n.reach[p]="end");i&&(g.dispatchEvent(createEvent("ps-scroll-"+p)),i<0?g.dispatchEvent(createEvent("ps-scroll-"+h)):i>0&&g.dispatchEvent(createEvent("ps-scroll-"+f)),s&&function setScrollingClassInstantly(n,i){addScrollingClass(n,i),removeScrollingClass(n,i)}(n,p));n.reach[p]&&(i||c)&&g.dispatchEvent(createEvent("ps-"+p+"-reach-"+n.reach[p]))}(n,a,l,s,c)}function toInt(n){return parseInt(n,10)||0}ie.prototype.eventElement=function eventElement(n){var i=this.eventElements.filter((function(i){return i.element===n}))[0];return i||(i=new re(n),this.eventElements.push(i)),i},ie.prototype.bind=function bind(n,i,a){this.eventElement(n).bind(i,a)},ie.prototype.unbind=function unbind(n,i,a){var s=this.eventElement(n);s.unbind(i,a),s.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(s),1)},ie.prototype.unbindAll=function unbindAll(){this.eventElements.forEach((function(n){return n.unbindAll()})),this.eventElements=[]},ie.prototype.once=function once(n,i,a){var s=this.eventElement(n),onceHandler=function(n){s.unbind(i,onceHandler),a(n)};s.bind(i,onceHandler)};var ae={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:"undefined"!=typeof navigator&&navigator.msMaxTouchPoints,isChrome:"undefined"!=typeof navigator&&/Chrome/i.test(navigator&&navigator.userAgent)};function updateGeometry(n){var i=n.element,a=Math.floor(i.scrollTop),s=i.getBoundingClientRect();n.containerWidth=Math.ceil(s.width),n.containerHeight=Math.ceil(s.height),n.contentWidth=i.scrollWidth,n.contentHeight=i.scrollHeight,i.contains(n.scrollbarXRail)||(queryChildren(i,ee.rail("x")).forEach((function(n){return remove$1(n)})),i.appendChild(n.scrollbarXRail)),i.contains(n.scrollbarYRail)||(queryChildren(i,ee.rail("y")).forEach((function(n){return remove$1(n)})),i.appendChild(n.scrollbarYRail)),!n.settings.suppressScrollX&&n.containerWidth+n.settings.scrollXMarginOffset=n.railXWidth-n.scrollbarXWidth&&(n.scrollbarXLeft=n.railXWidth-n.scrollbarXWidth),n.scrollbarYTop>=n.railYHeight-n.scrollbarYHeight&&(n.scrollbarYTop=n.railYHeight-n.scrollbarYHeight),function updateCss(n,i){var a={width:i.railXWidth},s=Math.floor(n.scrollTop);i.isRtl?a.left=i.negativeScrollAdjustment+n.scrollLeft+i.containerWidth-i.contentWidth:a.left=n.scrollLeft;i.isScrollbarXUsingBottom?a.bottom=i.scrollbarXBottom-s:a.top=i.scrollbarXTop+s;set(i.scrollbarXRail,a);var c={top:s,height:i.railYHeight};i.isScrollbarYUsingRight?i.isRtl?c.right=i.contentWidth-(i.negativeScrollAdjustment+n.scrollLeft)-i.scrollbarYRight-i.scrollbarYOuterWidth-9:c.right=i.scrollbarYRight-n.scrollLeft:i.isRtl?c.left=i.negativeScrollAdjustment+n.scrollLeft+2*i.containerWidth-i.contentWidth-i.scrollbarYLeft-i.scrollbarYOuterWidth:c.left=i.scrollbarYLeft+n.scrollLeft;set(i.scrollbarYRail,c),set(i.scrollbarX,{left:i.scrollbarXLeft,width:i.scrollbarXWidth-i.railBorderXWidth}),set(i.scrollbarY,{top:i.scrollbarYTop,height:i.scrollbarYHeight-i.railBorderYWidth})}(i,n),n.scrollbarXActive?i.classList.add(te.active("x")):(i.classList.remove(te.active("x")),n.scrollbarXWidth=0,n.scrollbarXLeft=0,i.scrollLeft=!0===n.isRtl?n.contentWidth:0),n.scrollbarYActive?i.classList.add(te.active("y")):(i.classList.remove(te.active("y")),n.scrollbarYHeight=0,n.scrollbarYTop=0,i.scrollTop=0)}function getThumbSize(n,i){return n.settings.minScrollbarLength&&(i=Math.max(i,n.settings.minScrollbarLength)),n.settings.maxScrollbarLength&&(i=Math.min(i,n.settings.maxScrollbarLength)),i}function bindMouseScrollHandler(n,i){var a=i[0],s=i[1],c=i[2],l=i[3],u=i[4],d=i[5],p=i[6],h=i[7],f=i[8],g=n.element,m=null,v=null,y=null;function mouseMoveHandler(i){i.touches&&i.touches[0]&&(i[c]=i.touches[0].pageY),g[p]=m+y*(i[c]-v),addScrollingClass(n,h),updateGeometry(n),i.stopPropagation(),i.preventDefault()}function mouseUpHandler(){removeScrollingClass(n,h),n[f].classList.remove(te.clicking),n.event.unbind(n.ownerDocument,"mousemove",mouseMoveHandler)}function bindMoves(i,u){m=g[p],u&&i.touches&&(i[c]=i.touches[0].pageY),v=i[c],y=(n[s]-n[a])/(n[l]-n[d]),u?n.event.bind(n.ownerDocument,"touchmove",mouseMoveHandler):(n.event.bind(n.ownerDocument,"mousemove",mouseMoveHandler),n.event.once(n.ownerDocument,"mouseup",mouseUpHandler),i.preventDefault()),n[f].classList.add(te.clicking),i.stopPropagation()}n.event.bind(n[u],"mousedown",(function(n){bindMoves(n)})),n.event.bind(n[u],"touchstart",(function(n){bindMoves(n,!0)}))}var se={"click-rail":function clickRail(n){n.element,n.event.bind(n.scrollbarY,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarYRail,"mousedown",(function(i){var a=i.pageY-window.pageYOffset-n.scrollbarYRail.getBoundingClientRect().top>n.scrollbarYTop?1:-1;n.element.scrollTop+=a*n.containerHeight,updateGeometry(n),i.stopPropagation()})),n.event.bind(n.scrollbarX,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarXRail,"mousedown",(function(i){var a=i.pageX-window.pageXOffset-n.scrollbarXRail.getBoundingClientRect().left>n.scrollbarXLeft?1:-1;n.element.scrollLeft+=a*n.containerWidth,updateGeometry(n),i.stopPropagation()}))},"drag-thumb":function dragThumb(n){bindMouseScrollHandler(n,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),bindMouseScrollHandler(n,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function keyboard(n){var i=n.element;n.event.bind(n.ownerDocument,"keydown",(function(a){if(!(a.isDefaultPrevented&&a.isDefaultPrevented()||a.defaultPrevented)&&(matches(i,":hover")||matches(n.scrollbarX,":focus")||matches(n.scrollbarY,":focus"))){var s=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(s){if("IFRAME"===s.tagName)s=s.contentDocument.activeElement;else for(;s.shadowRoot;)s=s.shadowRoot.activeElement;if(function isEditable(n){return matches(n,"input,[contenteditable]")||matches(n,"select,[contenteditable]")||matches(n,"textarea,[contenteditable]")||matches(n,"button,[contenteditable]")}(s))return}var c=0,l=0;switch(a.which){case 37:c=a.metaKey?-n.contentWidth:a.altKey?-n.containerWidth:-30;break;case 38:l=a.metaKey?n.contentHeight:a.altKey?n.containerHeight:30;break;case 39:c=a.metaKey?n.contentWidth:a.altKey?n.containerWidth:30;break;case 40:l=a.metaKey?-n.contentHeight:a.altKey?-n.containerHeight:-30;break;case 32:l=a.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:l=n.containerHeight;break;case 34:l=-n.containerHeight;break;case 36:l=n.contentHeight;break;case 35:l=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==c||n.settings.suppressScrollY&&0!==l||(i.scrollTop-=l,i.scrollLeft+=c,updateGeometry(n),function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop);if(0===a){if(!n.scrollbarYActive)return!1;if(0===c&&s>0||c>=n.contentHeight-n.containerHeight&&s<0)return!n.settings.wheelPropagation}var l=i.scrollLeft;if(0===s){if(!n.scrollbarXActive)return!1;if(0===l&&a<0||l>=n.contentWidth-n.containerWidth&&a>0)return!n.settings.wheelPropagation}return!0}(c,l)&&a.preventDefault())}}))},wheel:function wheel(n){var i=n.element;function mousewheelHandler(a){var s=function getDeltaFromEvent(n){var i=n.deltaX,a=-1*n.deltaY;return void 0!==i&&void 0!==a||(i=-1*n.wheelDeltaX/6,a=n.wheelDeltaY/6),n.deltaMode&&1===n.deltaMode&&(i*=10,a*=10),i!=i&&a!=a&&(i=0,a=n.wheelDelta),n.shiftKey?[-a,-i]:[i,a]}(a),c=s[0],l=s[1];if(!function shouldBeConsumedByChild(n,a,s){if(!ae.isWebKit&&i.querySelector("select:focus"))return!0;if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ee.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(a.target,c,l)){var u=!1;n.settings.useBothWheelAxes?n.scrollbarYActive&&!n.scrollbarXActive?(l?i.scrollTop-=l*n.settings.wheelSpeed:i.scrollTop+=c*n.settings.wheelSpeed,u=!0):n.scrollbarXActive&&!n.scrollbarYActive&&(c?i.scrollLeft+=c*n.settings.wheelSpeed:i.scrollLeft-=l*n.settings.wheelSpeed,u=!0):(i.scrollTop-=l*n.settings.wheelSpeed,i.scrollLeft+=c*n.settings.wheelSpeed),updateGeometry(n),(u=u||function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop),l=0===i.scrollTop,u=c+i.offsetHeight===i.scrollHeight,d=0===i.scrollLeft,p=i.scrollLeft+i.offsetWidth===i.scrollWidth;return!(Math.abs(s)>Math.abs(a)?l||u:d||p)||!n.settings.wheelPropagation}(c,l))&&!a.ctrlKey&&(a.stopPropagation(),a.preventDefault())}}void 0!==window.onwheel?n.event.bind(i,"wheel",mousewheelHandler):void 0!==window.onmousewheel&&n.event.bind(i,"mousewheel",mousewheelHandler)},touch:function touch(n){if(ae.supportsTouch||ae.supportsIePointer){var i=n.element,a={},s=0,c={},l=null;ae.supportsTouch?(n.event.bind(i,"touchstart",touchStart),n.event.bind(i,"touchmove",touchMove),n.event.bind(i,"touchend",touchEnd)):ae.supportsIePointer&&(window.PointerEvent?(n.event.bind(i,"pointerdown",touchStart),n.event.bind(i,"pointermove",touchMove),n.event.bind(i,"pointerup",touchEnd)):window.MSPointerEvent&&(n.event.bind(i,"MSPointerDown",touchStart),n.event.bind(i,"MSPointerMove",touchMove),n.event.bind(i,"MSPointerUp",touchEnd)))}function applyTouchMove(a,s){i.scrollTop-=s,i.scrollLeft-=a,updateGeometry(n)}function getTouch(n){return n.targetTouches?n.targetTouches[0]:n}function shouldHandle(n){return(!n.pointerType||"pen"!==n.pointerType||0!==n.buttons)&&(!(!n.targetTouches||1!==n.targetTouches.length)||!(!n.pointerType||"mouse"===n.pointerType||n.pointerType===n.MSPOINTER_TYPE_MOUSE))}function touchStart(n){if(shouldHandle(n)){var i=getTouch(n);a.pageX=i.pageX,a.pageY=i.pageY,s=(new Date).getTime(),null!==l&&clearInterval(l)}}function touchMove(l){if(shouldHandle(l)){var u=getTouch(l),d={pageX:u.pageX,pageY:u.pageY},p=d.pageX-a.pageX,h=d.pageY-a.pageY;if(function shouldBeConsumedByChild(n,a,s){if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ee.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(l.target,p,h))return;applyTouchMove(p,h),a=d;var f=(new Date).getTime(),g=f-s;g>0&&(c.x=p/g,c.y=h/g,s=f),function shouldPrevent(a,s){var c=Math.floor(i.scrollTop),l=i.scrollLeft,u=Math.abs(a),d=Math.abs(s);if(d>u){if(s<0&&c===n.contentHeight-n.containerHeight||s>0&&0===c)return 0===window.scrollY&&s>0&&ae.isChrome}else if(u>d&&(a<0&&l===n.contentWidth-n.containerWidth||a>0&&0===l))return!0;return!0}(p,h)&&l.preventDefault()}}function touchEnd(){n.settings.swipeEasing&&(clearInterval(l),l=setInterval((function(){n.isInitialized?clearInterval(l):c.x||c.y?Math.abs(c.x)<.01&&Math.abs(c.y)<.01?clearInterval(l):(applyTouchMove(30*c.x,30*c.y),c.x*=.8,c.y*=.8):clearInterval(l)}),10))}}},ce=function PerfectScrollbar(n,i){var a=this;if(void 0===i&&(i={}),"string"==typeof n&&(n=document.querySelector(n)),!n||!n.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");for(var s in this.element=n,n.classList.add(Z),this.settings={handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1},i)this.settings[s]=i[s];this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null;var c,l,focus=function(){return n.classList.add(te.focus)},blur=function(){return n.classList.remove(te.focus)};this.isRtl="rtl"===get(n).direction,!0===this.isRtl&&n.classList.add(Q),this.isNegativeScroll=(l=n.scrollLeft,n.scrollLeft=-1,c=n.scrollLeft<0,n.scrollLeft=l,c),this.negativeScrollAdjustment=this.isNegativeScroll?n.scrollWidth-n.clientWidth:0,this.event=new ie,this.ownerDocument=n.ownerDocument||document,this.scrollbarXRail=div(ee.rail("x")),n.appendChild(this.scrollbarXRail),this.scrollbarX=div(ee.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",focus),this.event.bind(this.scrollbarX,"blur",blur),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var u=get(this.scrollbarXRail);this.scrollbarXBottom=parseInt(u.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=toInt(u.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=toInt(u.borderLeftWidth)+toInt(u.borderRightWidth),set(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=toInt(u.marginLeft)+toInt(u.marginRight),set(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=div(ee.rail("y")),n.appendChild(this.scrollbarYRail),this.scrollbarY=div(ee.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",focus),this.event.bind(this.scrollbarY,"blur",blur),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var d=get(this.scrollbarYRail);this.scrollbarYRight=parseInt(d.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=toInt(d.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?function outerWidth(n){var i=get(n);return toInt(i.width)+toInt(i.paddingLeft)+toInt(i.paddingRight)+toInt(i.borderLeftWidth)+toInt(i.borderRightWidth)}(this.scrollbarY):null,this.railBorderYWidth=toInt(d.borderTopWidth)+toInt(d.borderBottomWidth),set(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=toInt(d.marginTop)+toInt(d.marginBottom),set(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:n.scrollLeft<=0?"start":n.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:n.scrollTop<=0?"start":n.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach((function(n){return se[n](a)})),this.lastScrollTop=Math.floor(n.scrollTop),this.lastScrollLeft=n.scrollLeft,this.event.bind(this.element,"scroll",(function(n){return a.onScroll(n)})),updateGeometry(this)};ce.prototype.update=function update(){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,set(this.scrollbarXRail,{display:"block"}),set(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=toInt(get(this.scrollbarXRail).marginLeft)+toInt(get(this.scrollbarXRail).marginRight),this.railYMarginHeight=toInt(get(this.scrollbarYRail).marginTop)+toInt(get(this.scrollbarYRail).marginBottom),set(this.scrollbarXRail,{display:"none"}),set(this.scrollbarYRail,{display:"none"}),updateGeometry(this),processScrollDiff(this,"top",0,!1,!0),processScrollDiff(this,"left",0,!1,!0),set(this.scrollbarXRail,{display:""}),set(this.scrollbarYRail,{display:""}))},ce.prototype.onScroll=function onScroll(n){this.isAlive&&(updateGeometry(this),processScrollDiff(this,"top",this.element.scrollTop-this.lastScrollTop),processScrollDiff(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)},ce.prototype.destroy=function destroy(){this.isAlive&&(this.event.unbindAll(),remove$1(this.scrollbarX),remove$1(this.scrollbarY),remove$1(this.scrollbarXRail),remove$1(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)},ce.prototype.removePsClasses=function removePsClasses(){this.element.className=this.element.className.split(" ").filter((function(n){return!n.match(/^ps([-_].+|)$/)})).join(" ")};var le=function select$1(n){var i;if("SELECT"===n.nodeName)n.focus(),i=n.value;else if("INPUT"===n.nodeName||"TEXTAREA"===n.nodeName){var a=n.hasAttribute("readonly");a||n.setAttribute("readonly",""),n.select(),n.setSelectionRange(0,n.value.length),a||n.removeAttribute("readonly"),i=n.value}else{n.hasAttribute("contenteditable")&&n.focus();var s=window.getSelection(),c=document.createRange();c.selectNodeContents(n),s.removeAllRanges(),s.addRange(c),i=s.toString()}return i},ue=createCommonjsModule((function(n,i){!function(n,i){var a=_interopRequireDefault(i);function _interopRequireDefault(n){return n&&n.__esModule?n:{default:n}}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var c=function(){function defineProperties(n,i){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=n.action,this.container=n.container,this.emitter=n.emitter,this.target=n.target,this.text=n.text,this.trigger=n.trigger,this.selectedText=""}},{key:"initSelection",value:function initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function selectFake(){var n=this,i="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return n.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[i?"right":"left"]="-9999px";var s=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=s+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function selectTarget(){this.selectedText=(0,a.default)(this.target),this.copyText()}},{key:"copyText",value:function copyText(){var n=void 0;try{n=document.execCommand(this.action)}catch(i){n=!1}this.handleResult(n)}},{key:"handleResult",value:function handleResult(n){this.emitter.emit(n?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function destroy(){this.removeFake()}},{key:"action",set:function set(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=n,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function get(){return this._action}},{key:"target",set:function set(n){if(void 0!==n){if(!n||"object"!==(void 0===n?"undefined":s(n))||1!==n.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&n.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(n.hasAttribute("readonly")||n.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=n}},get:function get(){return this._target}}]),ClipboardAction}();n.exports=l}(n,le)}));function E(){}unwrapExports(ue),E.prototype={on:function(n,i,a){var s=this.e||(this.e={});return(s[n]||(s[n]=[])).push({fn:i,ctx:a}),this},once:function(n,i,a){var s=this;function listener(){s.off(n,listener),i.apply(a,arguments)}return listener._=i,this.on(n,listener,a)},emit:function(n){for(var i=[].slice.call(arguments,1),a=((this.e||(this.e={}))[n]||[]).slice(),s=0,c=a.length;s0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof n.action?n.action:this.defaultAction,this.target="function"==typeof n.target?n.target:this.defaultTarget,this.text="function"==typeof n.text?n.text:this.defaultText,this.container="object"===d(n.container)?n.container:document.body}},{key:"listenClick",value:function listenClick(n){var i=this;this.listener=(0,u.default)(n,"click",(function(n){return i.onClick(n)}))}},{key:"onClick",value:function onClick(n){var i=n.delegateTarget||n.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(i),target:this.target(i),text:this.text(i),container:this.container,trigger:i,emitter:this})}},{key:"defaultAction",value:function defaultAction(n){return getAttributeValue("action",n)}},{key:"defaultTarget",value:function defaultTarget(n){var i=getAttributeValue("target",n);if(i)return document.querySelector(i)}},{key:"defaultText",value:function defaultText(n){return getAttributeValue("text",n)}},{key:"destroy",value:function destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function isSupported(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],i="string"==typeof n?[n]:n,a=!!document.queryCommandSupported;return i.forEach((function(n){a=a&&!!document.queryCommandSupported(n)})),a}}]),Clipboard}(l.default);function getAttributeValue(n,i){var a="data-clipboard-"+n;if(i.hasAttribute(a))return i.getAttribute(a)}n.exports=h}(n,ue,de,me)})));function isInShadow(n){for(var i=n&&n.parentNode;i;){if("[object ShadowRoot]"===i.toString())return!0;i=i.parentNode}return!1}function addListeners(i,a){var s=a.elements;s.textElement.addEventListener("click",(function(s){return function showCandidates(i,a,s){var c=s,l=s.elements;if(i.target.id!=="prompter-text".concat(s.randomString)){var u=i.target.id.replace("word-","").replace(s.randomString,""),d=JSON.parse(a.exports[n.Exports.JIIX]).words;if(c.wordToChange=d[u],c.wordToChange.id=u,l.candidatesElement.innerHTML="",c.wordToChange&&c.wordToChange.candidates){l.candidatesElement.style.display="flex",c.wordToChange.candidates.forEach((function(n,i){c.wordToChange.label===n?l.candidatesElement.innerHTML+='').concat(n,""):l.candidatesElement.innerHTML+='').concat(n,"")}));var p=i.target.getBoundingClientRect().left-60;l.candidatesElement.style.top="".concat(48,"px"),l.candidatesElement.style.left="".concat(p,"px"),i.target.parentNode.parentNode.parentNode.insertBefore(l.candidatesElement,i.target.parentNode.parentNode)}}}(s,i,a)})),s.candidatesElement.addEventListener("click",(function(s){return function clickCandidate(i,a,s){var c=s,l=s.elements,u=i.target.innerText;if(u!==c.wordToChange.label&&c.wordToChange.candidates.includes(u)){var d=JSON.parse(a.exports[n.Exports.JIIX]);d.words[c.wordToChange.id].label=u,a.import_(JSON.stringify(d),n.Exports.JIIX)}l.candidatesElement.style.display="none"}(s,i,a)})),s.ellipsisElement.addEventListener("click",(function(n){return function showActions(n,i){var a=i,s=function positionActions(){var i=n.target.offsetLeft-68;a.menuElement.style.left="".concat(i,"px")},c=document.contains(a.menuElement);isInShadow(a.menuElement)||c?"none"===a.menuElement.style.display&&(s(),a.menuElement.style.display="flex"):(a.menuElement.style.display="flex",s(),function insertActions(){a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),n.target.parentNode.insertBefore(a.menuElement,n.target)}())}(n,s)})),s.copyElement.addEventListener("click",(function(){s.menuElement.style.display="none"})),s.convertElement.addEventListener("click",(function(){s.menuElement.style.display="none",i.convert()})),s.deleteElement.addEventListener("click",(function(){s.menuElement.style.display="none",i.clear()}))}function createSmartGuide(n){var i="-"+Math.random().toString(10).substring(2,12),a=function createHTMLElements(n){var i=document.createElement("div");i.id="smartguide"+n,i.classList.add("smartguide");var a=document.createElement("div");a.id="prompter-text"+n,a.classList.add("prompter-text"),a.setAttribute("touch-action","none");var s=document.createElement("div");s.id="prompter-text-container"+n,s.classList.add("prompter-text-container"),s.appendChild(a);var c=document.createElement("div");c.id="ellipsis"+n,c.classList.add("ellipsis"),c.innerHTML="...";var l=document.createElement("div");l.id="tag-icon"+n,l.classList.add("tag-icon"),l.innerHTML="¶";var u=document.createElement("div");u.id="candidates"+n,u.classList.add("candidates");var d=document.createElement("div");d.id="more-menu"+n,d.classList.add("more-menu");var p=document.createElement("button");p.classList.add("options-label-button"),p.id="convert"+n,p.innerHTML="Convert";var h=document.createElement("button");h.classList.add("options-label-button"),h.id="copy"+n,h.innerHTML="Copy";var f=document.createElement("button");return f.classList.add("options-label-button"),f.id="delete"+n,f.innerHTML="Delete",{smartGuideElement:i,textElement:a,textContainer:s,candidatesElement:u,menuElement:d,tagElement:l,ellipsisElement:c,convertElement:p,copyElement:h,deleteElement:f}}(i),s=(new ve(a.copyElement),{editor:n,wordToChange:"",lastWord:"",previousLabelExport:" ",perfectScrollbar:new ce(a.textContainer,{suppressScrollY:!0,scrollXMarginOffset:1}),elements:a,smartGuideTimeOutId:0,randomString:i});return addListeners(n,s),n.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable&&function callFadeOutObserver(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4,i=arguments.length>1?arguments[1]:void 0,a=i,s=i.elements;new MutationObserver((function(i){i.forEach((function(){a.smartGuideTimeOutId&&clearTimeout(a.smartGuideTimeOutId),"none"===s.candidatesElement.style.display&&"none"===s.menuElement.style.display?a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n):document.contains(s.candidatesElement)||document.contains(s.menuElement)||(a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n))}))})).observe(s.smartGuideElement,{childList:!0,subtree:!0,attributes:!0})}(n.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration,s),s}function resize$2(n){var i=n,a=n.elements,s=3.779527559*i.editor.configuration.recognitionParams.iink.text.margin.left,c=i.editor.domElement.clientWidth-s-a.tagElement.offsetWidth-35-s;a.textContainer.style.width="".concat(c,"px"),a.textContainer.style.maxWidth="".concat(c,"px"),s=a.tagElement.offsetWidth,s+=c,a.ellipsisElement.style.left="".concat(s,"px"),a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}function launchSmartGuide(i,a){var s=i,c=i.elements,l=document.contains(c.smartGuideElement);isInShadow(c.smartGuideElement)||l||function insertSmartGuide(n){var i=n,a=n.elements,s=3.779527559,c=i.editor.configuration.recognitionParams.iink.text.margin.top*s,l=i.editor.configuration.recognitionParams.iink.text.margin.left*s;!function insertSmartGuideElement(n,s){a.smartGuideElement.style.top="".concat(s,"px"),a.smartGuideElement.style.left="".concat(n,"px"),a.smartGuideElement.style.visibility="hidden",i.editor.domElement.insertBefore(a.smartGuideElement,i.editor.loader)}(l,c-45.354330708),function insertTag(){a.smartGuideElement.appendChild(a.tagElement)}();var u=i.editor.domElement.clientWidth-l-a.tagElement.offsetWidth-35-l;(function insertTextContainer(n,i){a.textContainer.style.left="".concat(n,"px"),a.textContainer.style.width="".concat(i,"px"),a.textContainer.style.maxWidth="".concat(i,"px"),a.smartGuideElement.appendChild(a.textContainer)})(l=a.tagElement.offsetWidth,u),function insertEllipsis(n){a.ellipsisElement.style.left="".concat(n,"px"),a.smartGuideElement.appendChild(a.ellipsisElement)}(l+=u),a.menuElement.style.display="none",a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),a.smartGuideElement.appendChild(a.menuElement),a.candidatesElement.style.display="none",a.smartGuideElement.appendChild(a.candidatesElement),a.smartGuideElement.style.height="48px",a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}(i);var u=function createWordSpan(n,a,s){var c=document.createElement("span");return c.id="word-".concat(a).concat(i.randomString),n?c.innerHTML=" ":c.textContent=s.label,c};if(a&&JSON.parse(a[n.Exports.JIIX]).words.length>0){if(c.smartGuideElement.classList.add("smartguide-in"),c.smartGuideElement.classList.remove("smartguide-out"),c.candidatesElement.style.display="none",c.menuElement.style.display="none",s.previousLabelExport&&s.previousLabelExport!==JSON.parse(a[n.Exports.JIIX]).label){var d=JSON.parse(a[n.Exports.JIIX]).words;!function populatePrompter(n){c.textElement.innerHTML="";var i=document.createDocumentFragment();n.forEach((function(a,l){if(" "===a.label||a.label.includes("\n"))i.appendChild(u(!0,l));else if(l!==n.length-1)i.appendChild(u(!1,l,a));else{c.textElement.appendChild(i),s.perfectScrollbar.update(),""===s.lastWord&&(s.lastWord=a);var d=u(!1,l,a);s.lastWord.candidates!==a.candidates&&s.lastWord.label!==a.label?(d.classList.add("added-word"),c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft,s.lastWord=a):(c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft)}}))}(d),function addAnimationToModifiedWord(l){if(s.tempWords&&s.tempWords.length===l.length){var u=l.map((function(n){return n.label})),d=s.tempWords.map((function(n){return n.label})),p=u.indexOf(u.filter((function(n){return-1===d.indexOf(n)}))[0]);document.getElementById("word-".concat(p).concat(i.randomString))&&p>-1&&(document.getElementById("word-".concat(p).concat(i.randomString)).classList.add("modified-word"),c.textContainer.scrollLeft=document.getElementById("word-".concat(p).concat(i.randomString)).offsetLeft-10)}s.tempWords=JSON.parse(a[n.Exports.JIIX]).words}(d)}s.previousLabelExport=JSON.parse(a[n.Exports.JIIX]).label,c.copyElement.setAttribute("data-clipboard-text",JSON.parse(a[n.Exports.JIIX]).label)}else c.smartGuideElement.classList.add("smartguide-out"),c.smartGuideElement.classList.remove("smartguide-in");return s}var ye=function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")};function _defineProperties(n,i){for(var a=0;a0,i.canRedo=n.currentPosition1&&void 0!==arguments[1])||arguments[1],a=n.stack[n.currentPosition],s=arguments.length,c=new Array(s>2?s-2:0),l=2;l-1)i.stack.splice(s,1,cloneModel(l)),c.debug("model updated",l);else{var d=i;d.currentPosition+=1,d.stack=d.stack.slice(0,d.currentPosition),d.stack.push(cloneModel(l)),d.stack.length>d.maxSize&&(d.stack.shift(),d.currentPosition--),c.debug("model pushed",l),u.push(n.EventType.CHANGED)}return updateUndoRedoState(i),c.debug("undo/redo stack updated",i),getModel.apply(void 0,[i,!1].concat(u))},undo:function undo(i,a){var s=i;return s.currentPosition>0&&(s.currentPosition-=1,updateUndoRedoState(i),c.debug("undo index",s.currentPosition)),getModel(i,!0,n.EventType.CHANGED,n.EventType.EXPORTED)},redo:function redo(i,a){var s=i;return s.currentPosition1&&void 0!==arguments[1]?arguments[1]:10,a=document,s=a.createElement("canvas");return s.width=Math.abs(n.maxX-n.minX)+2*i,s.style.width="".concat(s.width,"px"),s.height=Math.abs(n.maxY-n.minY)+2*i,s.style.height="".concat(s.height,"px"),s}var we=Object.freeze({__proto__:null,inkImporter:function inkImporter(n,i,a,c){var l=n;s.debug("inkImporter start importing =>",i);var u=Object.assign({},l.behavior.grabber);u.detach=l.behavior.grabber.detach,l.behavior.grabber={};var d=[];i.forEach((function(n){n.convert?d.push({action:"convert",value:!0}):n.setDelay?d.push({action:"setDelay",value:n.setDelay}):(n.color&&d.push({action:"setColor",value:n.color}),n.X.forEach((function(i,a){var s="move";0===a?s="down":a===n.X.length-1&&(s="up"),d.push({action:s,point:{x:n.X[a],y:n.Y[a]}})})))})),s.debug("Array of actions =>",d),function play(n,i,a){if(i2&&void 0!==arguments[2]?arguments[2]:n.configuration.triggers[i];return!(!n.recognizer||!n.recognizer.getInfo().availableTriggers[i].includes(a))||(s.error("".concat(a," is not a valid trigger for ").concat(i)),!1)}function _addStrokes(){return(_addStrokes=B(H.mark((function _callee4(n,i){var a,s,c=arguments;return H.wrap((function _callee4$(l){for(;;)switch(l.prev=l.next){case 0:if(a=c.length>2&&void 0!==c[2]?c[2]:n.configuration.triggers.addStrokes,!n.recognizer||!n.recognizer.addStrokes){l.next=13;break}return l.next=4,n.recognizerContext.initPromise;case 4:if(!l.sent){l.next=13;break}if(!isTriggerValid(n,"addStrokes",a)){l.next=13;break}return l.next=9,manageResetState(n,i);case 9:if(!(s=l.sent)){l.next=12;break}return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,s));case 12:return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,i));case 13:return l.abrupt("return",Promise.reject(new Error("Cannot addStrokes")));case 14:case"end":return l.stop()}}),_callee4)})))).apply(this,arguments)}function _launchPointerEvents(){return(_launchPointerEvents=B(H.mark((function _callee5(n,i,a){return H.wrap((function _callee5$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.pointerEvents){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.pointerEvents(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch pointerEvents")));case 7:case"end":return s.stop()}}),_callee5)})))).apply(this,arguments)}function launchExport(n,i,a){return _launchExport.apply(this,arguments)}function _launchExport(){return(_launchExport=B(H.mark((function _callee6(i,a,s){var c,l,u,d,p,h=arguments;return H.wrap((function _callee6$(f){for(;;)switch(f.prev=f.next){case 0:if(c=h.length>3&&void 0!==h[3]?h[3]:i.configuration.triggers.exportContent,!i.recognizer||!i.recognizer.export_){f.next=20;break}return f.next=4,i.recognizerContext.initPromise;case 4:if(!f.sent){f.next=20;break}if(!isTriggerValid(i,"exportContent",c)){f.next=20;break}return l=i,window.clearTimeout(i.exportTimer),u=c===n.Trigger.QUIET_PERIOD?i.configuration.triggerDelay:0,d=delay(u),l.exportTimer=d.timer,f.next=14,d.promise;case 14:return f.next=16,manageResetState(i,a);case 16:if(!(p=f.sent)){f.next=19;break}return f.abrupt("return",i.recognizer.export_(i.recognizerContext,p,s));case 19:return f.abrupt("return",i.recognizer.export_(i.recognizerContext,a,s));case 20:return f.abrupt("return",Promise.reject(new Error("Cannot launch export")));case 21:case"end":return f.stop()}}),_callee6)})))).apply(this,arguments)}function _launchImport(){return(_launchImport=B(H.mark((function _callee7(n,i,a){return H.wrap((function _callee7$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.import_){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.import_(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch import")));case 7:case"end":return s.stop()}}),_callee7)})))).apply(this,arguments)}function _launchGetSupportedImportMimeTypes(){return(_launchGetSupportedImportMimeTypes=B(H.mark((function _callee8(n,i){return H.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.getSupportedImportMimeTypes){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.getSupportedImportMimeTypes(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch getSupportedImportMimeTypes")));case 7:case"end":return a.stop()}}),_callee8)})))).apply(this,arguments)}function launchConvert(n,i,a){return _launchConvert.apply(this,arguments)}function _launchConvert(){return(_launchConvert=B(H.mark((function _callee9(n,i,a){return H.wrap((function _callee9$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.convert){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.convert(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch convert")));case 7:case"end":return s.stop()}}),_callee9)})))).apply(this,arguments)}function launchConfig(n,i){return _launchConfig.apply(this,arguments)}function _launchConfig(){return(_launchConfig=B(H.mark((function _callee10(n,i){return H.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.sendConfiguration){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.sendConfiguration(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch config")));case 7:case"end":return a.stop()}}),_callee10)})))).apply(this,arguments)}function _launchResize(){return(_launchResize=B(H.mark((function _callee11(n,i){var a,s;return H.wrap((function _callee11$(c){for(;;)switch(c.prev=c.next){case 0:if(!n.recognizer||!n.recognizer.resize){c.next=13;break}return c.next=3,n.recognizerContext.initPromise;case 3:if(!c.sent){c.next=13;break}return a=n,window.clearTimeout(n.resizeTimer),s=delay(n.configuration.resizeTriggerDelay),a.resizeTimer=s.timer,resize$2(n.smartGuide),c.next=12,s.promise;case 12:return c.abrupt("return",n.recognizer.resize(n.recognizerContext,i,n.domElement));case 13:return c.abrupt("return",Promise.reject(new Error("Cannot launch resize")));case 14:case"end":return c.stop()}}),_callee11)})))).apply(this,arguments)}function _launchWaitForIdle(){return(_launchWaitForIdle=B(H.mark((function _callee12(n,i){return H.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.waitForIdle){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.waitForIdle(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch wait for idle")));case 7:case"end":return a.stop()}}),_callee12)})))).apply(this,arguments)}function _launchClose(){return(_launchClose=B(H.mark((function _callee13(n,i){return H.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.close){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.close(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch close")));case 7:case"end":return a.stop()}}),_callee13)})))).apply(this,arguments)}function setPenStyle(n,i){return _setPenStyle.apply(this,arguments)}function _setPenStyle(){return(_setPenStyle=B(H.mark((function _callee14(n,i){return H.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyle){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyle(n.recognizerContext,i,n.penStyle));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set pentStyle")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee14)})))).apply(this,arguments)}function setPenStyleClasses(n,i){return _setPenStyleClasses.apply(this,arguments)}function _setPenStyleClasses(){return(_setPenStyleClasses=B(H.mark((function _callee15(n,i){return H.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyleClasses){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyleClasses(n.recognizerContext,i,n.penStyleClasses));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set penStyleClasses")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee15)})))).apply(this,arguments)}function setTheme(n,i){return _setTheme.apply(this,arguments)}function _setTheme(){return(_setTheme=B(H.mark((function _callee16(n,i){return H.wrap((function _callee16$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setTheme){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setTheme(n.recognizerContext,i,n.theme));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set theme")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee16)})))).apply(this,arguments)}var Ee=function(){function Editor(n,i,a,c,l,u){ye(this,Editor),u=u||"ms-editor";var d=document.createElement("style");d.appendChild(document.createTextNode("")),n.appendChild(d);var p=d.sheet;d.textContent="/*\n * Container style\n */\n.ps {\n overflow: hidden !important;\n overflow-anchor: none;\n -ms-overflow-style: none;\n touch-action: auto;\n -ms-touch-action: auto;\n}\n/*\n * Scrollbar rail styles\n */\n.ps__rail-x {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n height: 15px;\n /* there must be 'bottom' or 'top' for ps__rail-x */\n bottom: 0px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__rail-y {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n width: 15px;\n /* there must be 'right' or 'left' for ps__rail-y */\n right: 0;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps--active-x > .ps__rail-x,\n.ps--active-y > .ps__rail-y {\n display: block;\n background-color: transparent;\n}\n.ps:hover > .ps__rail-x,\n.ps:hover > .ps__rail-y,\n.ps--focus > .ps__rail-x,\n.ps--focus > .ps__rail-y,\n.ps--scrolling-x > .ps__rail-x,\n.ps--scrolling-y > .ps__rail-y {\n opacity: 0.6;\n}\n.ps .ps__rail-x:hover,\n.ps .ps__rail-y:hover,\n.ps .ps__rail-x:focus,\n.ps .ps__rail-y:focus,\n.ps .ps__rail-x.ps--clicking,\n.ps .ps__rail-y.ps--clicking {\n background-color: #eee;\n opacity: 0.9;\n}\n/*\n * Scrollbar thumb styles\n */\n.ps__thumb-x {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, height .2s ease-in-out;\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\n height: 6px;\n /* there must be 'bottom' for ps__thumb-x */\n bottom: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__thumb-y {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, width .2s ease-in-out;\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\n width: 6px;\n /* there must be 'right' for ps__thumb-y */\n right: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__rail-x:hover > .ps__thumb-x,\n.ps__rail-x:focus > .ps__thumb-x,\n.ps__rail-x.ps--clicking .ps__thumb-x {\n background-color: #999;\n height: 11px;\n}\n.ps__rail-y:hover > .ps__thumb-y,\n.ps__rail-y:focus > .ps__thumb-y,\n.ps__rail-y.ps--clicking .ps__thumb-y {\n background-color: #999;\n width: 11px;\n}\n/* MS supports */\n@supports (-ms-overflow-style: none) {\n .ps {\n overflow: auto !important;\n }\n}\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n .ps {\n overflow: auto !important;\n }\n}\n.ms-editor {\n position: relative;\n z-index: 20;\n color: #1A9FFF;\n font-family: sans-serif;\n}\n.ms-editor.erasing {\n cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEsSURBVDiNrdO7SgNBFMbx/3fmCbQ1tunDIayFBvFSKxbxBfSdBPEBtLIWb3Ebl4R9AQWLkE70CWbHZl1Eg2iSr5vL+c1hhhFTMhwOdyX1gQ2gVU+PgTyldNHtdq+/1+jroCiKtpmdSupNO6ApkgZmdtzpdJ5+QGVZ9qqqugSWfkO+5F3SnrvnDVQURTuE8PgP5DNvkjJ3fzaAEMLJDAjAclVVZwCqL/ZqBqSJme2YpMN5EIAYY9+A9XkhST0DVuaFgJYtAAGoDJgsAJoYkM+rSHqwlNL5Ajq6EMBoNLoBtmbsZuDumwYQYzwCXmdw3oAjAAPIsuxF0kG98GdE0r67PzcQgLvnIYQ14P4PyF39WZuH0rRdZVluxxj7kjaA1Xp6nFLKzezc3W+/13wAItdV6XjME1AAAAAASUVORK5CYII='), auto;\n}\n.ms-editor canvas,\n.ms-editor svg {\n z-index: 15;\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n}\n.ms-editor canvas.ms-rendering-canvas {\n z-index: 10;\n pointer-events: none;\n background-image: linear-gradient(to right, #F5F6F7 1px, transparent 1px),\n linear-gradient(to bottom, #F5F6F7 1px, transparent 1px);\n background-size: 18px 18px;\n}\n.ms-editor svg {\n z-index: 10;\n pointer-events: none;\n}\n.ms-editor svg[data-layer=\"BACKGROUND\"] {\n z-index: 9;\n}\n.ms-editor .loader {\n z-index: 30;\n position: absolute;\n width: 120px;\n height: 120px;\n top: calc(50% - 60px);\n left: calc(50% - 60px);\n border: 16px solid #F5F6F7;\n border-radius: 50%;\n border-top-color: #1A9FFF;\n -webkit-animation: spin 2s linear infinite;\n animation: spin 2s linear infinite;\n}\n.ms-editor .error-msg {\n z-index: 25;\n position: absolute;\n width: 200px;\n height: 200px;\n top: calc(50% - 100px);\n left: calc(50% - 100px);\n font-size: 16px;\n text-align: center;\n word-wrap: break-word;\n}\n.ms-editor .error-msg::before {\n content: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCA3Ni41IDYxMiA0NTkiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiPgogICAgPHBhdGggZmlsbD0iIzFBOUZGRiIgZD0iTTQ5NC43LDIyOS41Yy0xNy44NTEtODYuNy05NC4zNTEtMTUzLTE4OC43LTE1M2MtMzguMjUsMC03My45NSwxMC4yLTEwMiwzMC42bDM4LjI1LDM4LjI1IGMxNy44NS0xMi43NSw0MC44LTE3Ljg1LDYzLjc1LTE3Ljg1Yzc2LjUsMCwxNDAuMjUsNjMuNzUsMTQwLjI1LDE0MC4yNXYxMi43NWgzOC4yNWM0My4zNSwwLDc2LjUsMzMuMTUsNzYuNSw3Ni41IGMwLDI4LjA1LTE1LjMsNTMuNTUtNDAuOCw2Ni4zbDM4LjI1LDM4LjI1QzU5MS42LDQzOC42LDYxMiw0MDAuMzUsNjEyLDM1N0M2MTIsMjkwLjcsNTU4LjQ1LDIzNC42LDQ5NC43LDIyOS41eiBNNzYuNSwxMDkuNjUgbDcxLjQsNjguODVDNjYuMywxODMuNiwwLDI0OS45LDAsMzMxLjVjMCw4NC4xNSw2OC44NSwxNTMsMTUzLDE1M2gyOTguMzVsNTEsNTFsMzMuMTUtMzMuMTVMMTA5LjY1LDc2LjVMNzYuNSwxMDkuNjV6IE0xOTYuMzUsMjI5LjVsMjA0LDIwNEgxNTNjLTU2LjEsMC0xMDItNDUuOS0xMDItMTAyYzAtNTYuMSw0NS45LTEwMiwxMDItMTAySDE5Ni4zNXoiIC8+Cjwvc3ZnPgo=);\n}\n.ms-editor .smartguide {\n position: absolute;\n z-index: 40;\n font-size: 16px;\n}\n.ms-editor .smartguide.smartguide-in {\n visibility: visible !important;\n transition: opacity 0.5s;\n opacity: 1;\n}\n.ms-editor .smartguide.smartguide-out {\n transition: opacity 1s, visibility 1s;\n visibility: hidden !important;\n opacity: 0;\n}\n.ms-editor .smartguide .tag-icon {\n padding: 0 18px;\n border: 1px solid #959DA6;\n font-weight: bold;\n font-size: large;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 48px;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n}\n.ms-editor .smartguide .ellipsis {\n cursor: pointer;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 38px;\n padding: 0 8px;\n font-weight: bold;\n font-size: x-large;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .ellipsis:active {\n background-color: #e0e0e0;\n}\n.ms-editor .smartguide .prompter-text-container {\n background-color: rgba(255, 255, 255, 0.9);\n height: 48px;\n line-height: 48px;\n overflow: hidden;\n white-space: nowrap;\n display: block;\n text-align: left;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 30;\n color: #bfbfbf;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .prompter-text-container > div > span {\n cursor: pointer;\n display: inline-block;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text {\n margin-left: 12px;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text .added-word {\n animation: 0.1s linear word-added,\n 3s ease-in-out color-input;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text .modified-word {\n animation: 0.1s linear word-modified,\n 3s ease-in-out color-input;\n}\n.ms-editor .smartguide .candidates {\n color: black;\n flex-direction: column;\n text-align: center;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n box-shadow: 2px 2px 12px #BDBDBD, -2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n z-index: 100;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .candidates > span {\n cursor: pointer;\n padding: 2px 20px;\n}\n.ms-editor .smartguide .candidates > span:hover {\n background-color: #EEEEEE;\n}\n.ms-editor .smartguide .candidates > span:active {\n background-color: #E0E0E0;\n}\n.ms-editor .smartguide .candidates .selected-word {\n font-weight: bold;\n background-color: #E0E0E0;\n}\n.ms-editor .smartguide .more-menu {\n flex-direction: column;\n margin-right: 12px;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n z-index: 100;\n box-shadow: 2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n}\n.ms-editor .smartguide .more-menu .options-label-button {\n color: black;\n font-size: 16px;\n cursor: pointer;\n box-sizing: border-box;\n background: transparent;\n border: none;\n padding: 0 24px;\n margin: 0;\n height: 40px;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .more-menu .options-label-button:hover {\n background-color: #EEEEEE;\n}\n.ms-editor .smartguide .more-menu .options-label-button:active {\n background-color: #E0E0E0;\n}\n.ms-editor .ps__rail-x {\n top: 32px !important;\n}\n/** Stroke **/\n.ms-editor .removed-stroke {\n opacity: 0;\n transition: opacity 0.1s ease-in-out;\n}\n.ms-editor .added-stroke {\n animation: 0.2s opacity-appear;\n}\n@keyframes color-input {\n 0% {\n color: black;\n }\n 100% {\n color: #bfbfbf;\n }\n}\n@keyframes word-added {\n 0% {\n transform: translate(5px, 0);\n }\n 100% {\n transform: none;\n }\n}\n@keyframes word-modified {\n 0% {\n transform: translate(0, 5px);\n }\n 100% {\n transform: none;\n }\n}\n@keyframes opacity-appear {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity : 1;\n }\n}\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n@-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n }\n}\n",this.sheet=p,this.domElement=n,this.domElement.classList.add(u),this.loader=document.createElement("div"),this.loader.classList.add("loader"),this.loader=this.domElement.appendChild(this.loader),this.error=document.createElement("div"),this.error.classList.add("error-msg"),this.error=this.domElement.appendChild(this.error),this.exportTimer=void 0,this.resizeTimer=void 0,this.notifyTimer=void 0,this.innerBehaviors=function overrideDefaultBehaviors(n){if(n){var i={grabber:n.grabber||De.grabber,rendererList:n.rendererList||De.rendererList,strokerList:n.strokerList||De.strokerList,recognizerList:n.recognizerList||De.recognizerList,events:n.events||De.events,getBehaviorFromConfiguration:n.getBehaviorFromConfiguration||De.getBehaviorFromConfiguration};return s.debug("Override default behaviors",i),i}return De}(l),this.configuration=i,this.localTheme="",this.theme=c,this.penStyle=a,this.penStyleClasses="",this.isErasing=!1,this.domElement.editor=this}var i,a;return be(Editor,[{key:"enableEraser",value:function enableEraser(){this.isErasing=!0,this.domElement.classList.add("erasing")}},{key:"disableEraser",value:function disableEraser(){document.body.style.cursor="initial",this.isErasing=!1,this.domElement.classList.remove("erasing")}},{key:"pointerDown",value:function pointerDown(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pen",a=arguments.length>2?arguments[2]:void 0;s.trace("Pointer down",n),window.clearTimeout(this.notifyTimer),window.clearTimeout(this.exportTimer),this.model=initPendingStroke(this.model,n,Object.assign({pointerType:i,pointerId:a},this.theme.ink,this.localPenStyle)),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerMove",value:function pointerMove(n){s.trace("Pointer move",n),this.model=appendToPendingStroke(this.model,n),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerUp",value:function pointerUp(n){s.trace("Pointer up",n),this.model=endPendingStroke(this.model,n,this.penStyle),this.isErasing||this.renderer.drawModel(this.rendererContext,this.model,this.stroker),this.recognizer.addStrokes?function addStrokes(n,i){return _addStrokes.apply(this,arguments)}(this,this.model):handleSuccess(this,this.model)}},{key:"removeStroke",value:function removeStroke(n){this.model.strokeGroups.forEach((function(i){var a=i.strokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==a&&i.strokes.splice(a,1)}));var i=this.model.rawStrokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==i&&this.model.rawStrokes.splice(i,1),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model),"DEMAND"!==this.configuration.triggers.exportContent&&launchExport(this,this.model)}},{key:"reDraw",value:function reDraw(n,i){var a=this;n.forEach((function(n){addStroke(a.model,n)})),i.forEach((function(n){n.strokes.forEach((function(i){addStrokeToGroup(a.model,i,n.penStyle)}))})),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model)}},{key:"waitForIdle",value:function waitForIdle(){return emitEvents(this,void 0,n.EventType.IDLE),function launchWaitForIdle(n,i){return _launchWaitForIdle.apply(this,arguments)}(this,this.model)}},{key:"undo",value:(a=B(H.mark((function _callee(){var i,a,c,l=this;return H.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return s.debug("Undo current model",this.model),emitEvents(this,void 0,n.EventType.UNDO),u.next=4,this.undoRedoManager.undo(this.undoRedoContext,this.model).catch((function(n){return handleError(l,n)}));case 4:return i=u.sent,a=i.res,c=i.types,manageRecognizedModel.apply(void 0,[this,a].concat(M(c))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee,this)}))),function undo(){return a.apply(this,arguments)})},{key:"redo",value:(i=B(H.mark((function _callee2(){var i,a,c,l=this;return H.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return s.debug("Redo current model",this.model),emitEvents(this,void 0,n.EventType.REDO),u.next=4,this.undoRedoManager.redo(this.undoRedoContext,this.model).catch((function(n){return handleError(l,n)}));case 4:return i=u.sent,a=i.res,c=i.types,manageRecognizedModel.apply(void 0,[this,a].concat(M(c))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee2,this)}))),function redo(){return i.apply(this,arguments)})},{key:"clear",value:function(){var i=B(H.mark((function _callee3(){var i,a,c,l=this;return H.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:if(!this.canClear){u.next=10;break}return s.debug("Clear current model",this.model),emitEvents(this,void 0,n.EventType.CLEAR),u.next=5,this.recognizer.clear(this.recognizerContext,this.model).catch((function(n){return handleError(l,n)}));case 5:return i=u.sent,a=i.res,c=i.events,handleSuccess.apply(void 0,[this,a].concat(M(c))),u.abrupt("return",a);case 10:return u.abrupt("return",Promise.reject(new Error("Cannot launch clear")));case 11:case"end":return u.stop()}}),_callee3,this)})));return function clear(){return i.apply(this,arguments)}}()},{key:"convert",value:function convert(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"DIGITAL_EDIT";return this.canConvert?(emitEvents(this,void 0,n.EventType.CONVERT),launchConvert(this,this.model,i)):Promise.reject(new Error("Cannot launch convert"))}},{key:"setGuides",value:function setGuides(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.configuration.recognitionParams.iink.text.guides.enable=n,launchConfig(this,this.model)}},{key:"export_",value:function export_(i){return this.canExport?(emitEvents(this,void 0,n.EventType.EXPORT),launchExport(this,this.model,i,n.Trigger.DEMAND)):Promise.reject(new Error("Cannot launch export"))}},{key:"import_",value:function import_(i,a){return emitEvents(this,void 0,n.EventType.IMPORT),function launchImport(n,i,a){return _launchImport.apply(this,arguments)}(this,this.model,i instanceof Blob?i:new Blob([i],{type:a}))}},{key:"getSupportedImportMimeTypes",value:function getSupportedImportMimeTypes(){return function launchGetSupportedImportMimeTypes(n,i){return _launchGetSupportedImportMimeTypes.apply(this,arguments)}(this,this.model)}},{key:"pointerEvents",value:function pointerEvents(n){return function launchPointerEvents(n,i,a){return _launchPointerEvents.apply(this,arguments)}(this,this.model,n)}},{key:"resize",value:function resize(){return s.debug("Resizing editor"),this.renderer.resize(this.rendererContext,this.model,this.stroker,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth),function launchResize(n,i){return _launchResize.apply(this,arguments)}(this,this.model)}},{key:"unload",value:function unload(){this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext)}},{key:"close",value:function close(){return this.configuration.recognitionParams.protocol===n.Protocol.WEBSOCKET?function launchClose(n,i){return _launchClose.apply(this,arguments)}(this,this.model):null}},{key:"forceChange",value:function forceChange(){emitEvents(this,void 0,n.EventType.CHANGED)}},{key:"configuration",set:function set(n){this.loader.style.display="initial",this.error.style.display="none",this.innerConfiguration=function overrideDefaultConfiguration(n){var i,a=n;return a&&a.recognitionParams.server&&a.recognitionParams.server.useWindowLocation?(a.recognitionParams.server.scheme=window.location.protocol.slice(0,-1),a.recognitionParams.server.host=window.location.host,i=h({},f,void 0===a?{}:a)):i=h({},f,void 0===n?{}:n),s.debug("Override default configuration",i),i}(n),this.behavior=this.behaviors.getBehaviorFromConfiguration(this.behaviors,this.innerConfiguration),this.smartGuide?function reset(n){var i=n.elements;i.candidatesElement.innerHTML="",i.smartGuideElement.classList.add("smartguide-out"),i.smartGuideElement.classList.remove("smartguide-in")}(this.smartGuide):this.smartGuide=createSmartGuide(this)},get:function get(){return this.innerConfiguration}},{key:"penStyle",set:function set(n){this.innerPenStyle=function overrideDefaultPenStyle(n){var i=h({},void 0,void 0===n?{}:n);return s.debug("Override default pen style",i),i}(n),this.localPenStyle=this.innerPenStyle,setPenStyle(this,this.model)},get:function get(){return this.innerPenStyle}},{key:"penStyleClasses",set:function set(n){this.innerPenStyleClasses=n,this.localPenStyle=this.theme[".".concat(this.innerPenStyleClasses)],setPenStyleClasses(this,this.model)},get:function get(){return this.innerPenStyleClasses}},{key:"theme",set:function set(n){this.innerTheme=function overrideDefaultTheme(n){var i=h({},b,void 0===n?{}:n);return s.debug("Override default theme",i),i}(n),setTheme(this,this.model)},get:function get(){return this.innerTheme}},{key:"behaviors",get:function get(){return this.innerBehaviors}},{key:"behavior",set:function set(n){n&&(this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerBehavior=n,this.renderer=this.innerBehavior.renderer,this.recognizer=this.innerBehavior.recognizer,this.grabberContext=this.grabber.attach(this.domElement,this))},get:function get(){return this.innerBehavior}},{key:"recognizer",set:function set(n){var i=this;this.undoRedoContext=function createUndoRedoContext(n){return{stack:[],currentPosition:-1,maxSize:n.undoRedoMaxStackSize,canUndo:!1,canRedo:!1}}(this.configuration),this.undoRedoManager=xe;var a=function initialize(a,c){i.innerRecognizer=n,i.innerRecognizer&&(i.recognizerContext=createEmptyRecognizerContext(i),i.innerRecognizer.undo&&i.innerRecognizer.redo&&i.innerRecognizer.clear&&(i.undoRedoContext=i.recognizerContext,i.undoRedoManager=i.innerRecognizer),i.innerRecognizer.init(i.recognizerContext,a).then((function(n){s.info("Recognizer initialized !"),c&&(setTheme(i,i.model),setPenStyle(i,i.model),setPenStyleClasses(i,i.model)),i.loader.style.display="none"})).catch((function(n){return handleError(i,n)})))};n&&(this.innerRecognizer?this.innerRecognizer.close(this.recognizerContext,this.model).then((function(n){s.info("Recognizer closed"),handleSuccess(i,n),a(clearModel(n),!0)})).catch((function(n){return handleError(i,n)})):(this.model=createModel(this.configuration),a(this.model,!1)))},get:function get(){return this.innerRecognizer}},{key:"renderer",set:function set(n){n&&(this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext),this.innerRenderer=n,this.innerRenderer&&(this.rendererContext=this.innerRenderer.attach(this.domElement,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth)))},get:function get(){return this.innerRenderer}},{key:"grabber",get:function get(){return this.behavior?this.behavior.grabber:void 0}},{key:"stroker",get:function get(){return this.behavior?this.behavior.stroker:void 0}},{key:"emit",get:function get(){return this.behavior?this.behavior.events:void 0}},{key:"png",get:function get(){return function getImage(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(n.rawStrokes.length>0){var s=getBorderCoordinates(n),c=createCanvas$1(s,a),l=createCanvas$1(s,a),u={renderingCanvas:l,renderingCanvasContext:l.getContext("2d"),capturingCanvas:c,capturingCanvasContext:c.getContext("2d")};return u.renderingCanvasContext.translate(-s.minX+a,-s.minY+a),drawModel(u,n,i),u.renderingCanvas.toDataURL("image/png")}return null}(this.model,this.stroker)}},{key:"initialized",get:function get(){return!!this.recognizerContext&&this.recognizerContext.initialized}},{key:"idle",get:function get(){return this.recognizerContext.idle}},{key:"canUndo",get:function get(){return this.undoRedoContext.canUndo}},{key:"canRedo",get:function get(){return this.undoRedoContext.canRedo}},{key:"isEmpty",get:function get(){return this.recognizerContext.isEmpty}},{key:"canClear",get:function get(){return!this.isEmpty}},{key:"canConvert",get:function get(){return!!(this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.convert)}},{key:"possibleUndoCount",get:function get(){return this.recognizerContext.possibleUndoCount}},{key:"undoStackIndex",get:function get(){return this.recognizerContext.undoStackIndex}},{key:"canExport",get:function get(){return this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.getInfo().availableTriggers.exportContent.includes(n.Trigger.DEMAND)}},{key:"exports",get:function get(){return this.model?this.model.exports:void 0}},{key:"supportedImportMimeTypes",get:function get(){return this.recognizerContext.supportedImportMimeTypes}},{key:"eastereggs",get:function get(){return we}}]),Editor}();function emitEvents(i,a){for(var s=i,c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?l-2:0),p=2;p=i.model.lastPositions.lastReceivedPosition?(s.model=mergeModels(s.model,c),(needRedraw(s.model)||u.includes(n.EventType.RENDERED))&&i.renderer.drawModel(i.rendererContext,s.model,i.stroker)):(s.model=c,i.renderer.drawModel(i.rendererContext,s.model,i.stroker)),emitEvents.apply(void 0,[i,void 0].concat(u))),"TEXT"===i.configuration.recognitionParams.type&&"REST"!==i.configuration.recognitionParams.protocol&&i.configuration.recognitionParams.iink.text.mimeTypes.includes(n.Exports.JIIX)&&i.configuration.recognitionParams.iink.text.smartGuide&&(s.smartGuide=launchSmartGuide(i.smartGuide,c.exports)),extractPendingStrokes(a).length>0&&!i.recognizer.addStrokes&&i.configuration.triggers.exportContent!==n.Trigger.DEMAND&&launchExport(i,a)}function handleError(i,a){var s=i;if("close"!==a.type&&d.error("Error while firing the recognition",a.stack||a),"Invalid application key."===a.message||"Invalid HMAC"===a.message||a.error&&a.error.result&&a.error.result.error&&("InvalidApplicationKeyException"===a.error.result.error||"InvalidHMACSignatureException"===a.error.result.error)||a.code&&"access.not.granted"===a.code?s.error.innerText=n.Error.WRONG_CREDENTIALS:a.code&&"no.activity"===a.code?s.error.innerText=n.Error.NO_ACTIVITY:"Session is too old. Max Session Duration Reached."===a.message||a.code&&"session.too.old"===a.code?s.error.innerText=n.Error.TOO_OLD:1006!==a.code&&1e3!==a.code||"none"!==s.error.style.display||(s.error.innerText=n.Error.NOT_REACHABLE),s.error.innerText!==n.Error.TOO_OLD&&"CLOSE_RECOGNIZER"!==a.reason||!canReconnect(i.recognizerContext)){s.loader.style.display="none",s.error.style.display="initial";for(var c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?a-2:0),c=2;c4&&void 0!==arguments[4]?arguments[4]:"",l=arguments.length>5?arguments[5]:void 0,u=i.editor.configuration;return post(i,"".concat(u.recognitionParams.server.scheme,"://").concat(u.recognitionParams.server.host).concat(n),s(i,a,c),"V4",l).then((function(n){d.debug("iinkRestRecognizer success",n);var a=i.lastPositions;a.lastReceivedPosition=a.lastSentPosition;var s=updateRecognitionPositions(i,a);return n.instanceId&&(s.instanceId=n.instanceId),n}))}function buildData(n,i,a){var s,c=n.editor.configuration;"TEXT"===c.recognitionParams.type?s=function buildTextConf(n){return{text:n.recognitionParams.iink.text,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"MATH"===c.recognitionParams.type?s=function buildMathConf(n){return{math:n.recognitionParams.iink.math,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"DIAGRAM"===c.recognitionParams.type?s=function buildDiagramConf(n){return{diagram:n.recognitionParams.iink.diagram,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"Raw Content"===c.recognitionParams.type&&(s=function buildRawContentConf(n){return{"raw-content":{recognition:n.recognitionParams.iink["raw-content"].recognition},lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c));var l=[];i.strokeGroups.forEach((function(n){var i={penStyle:"{}"===JSON.stringify(n.penStyle)?null:toCSS(n.penStyle),strokes:n.strokes.map((function(n){return function toJSON(n){return{x:n.x,y:n.y,t:n.t,pointerType:n.pointerType}}(n)}))};l.push(i)}));var u={configuration:s,xDPI:96,yDPI:96,contentType:"Raw Content"===c.recognitionParams.type?"Raw Content":c.recognitionParams.type.charAt(0).toUpperCase()+c.recognitionParams.type.slice(1).toLowerCase(),theme:toCSS$1(n.editor.theme),strokeGroups:l};return n.editor.domElement&&(u.height=n.editor.domElement.clientHeight,u.width=n.editor.domElement.clientWidth),a&&(u.conversionState="DIGITAL_EDIT"),updateModelSentPosition(i),u}function extractExports(n,i,a){var s={};return s[i]=a,s}function resultCallback(i,a,s,c,l){d.debug("iinkRestRecognizer result callback",a);var u=updateModelReceivedPosition(a);u.rawResults.exports=c,u.exports?Object.assign(u.exports,extractExports(0,l,c)):u.exports=extractExports(0,l,c),d.debug("iinkRestRecognizer model updated",u),i.editor.undoRedoManager&&handleSuccess(i.editor,u,n.EventType.EXPORTED,n.EventType.IDLE)}function callPostMessage(n,i,a){var s=n.editor.configuration;return postMessage("/api/v4.0/iink/batch",n,i,buildData,s.restConversionState,a).then((function(s){return resultCallback(n,i,0,s,a),i})).catch((function(i){return handleError(n.editor,i),i}))}function export_(n,i,a){var s=n.editor.configuration;return a?Promise.all(a.map((function(a){return callPostMessage(n,i,a)}))):"TEXT"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.text.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"DIAGRAM"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.diagram.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"MATH"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.math.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"Raw Content"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink["raw-content"].mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):Promise.reject(new Error("Export failed"))}var Se=Object.freeze({__proto__:null,iinkRestConfiguration:_e,getInfo:function getInfo$4(){return _e},postMessage:postMessage,export_:export_,convert:function convert(n,i){var a=n.editor.configuration;postMessage("/api/v4.0/iink/batch",n,i,buildData,"DIGITAL_EDIT").then((function(n){return resultCallback(i,a)})).catch((function(i){return handleError(n.editor,i)}))},resize:function resize$3(n,i){i.strokeGroups.length&&export_(n,i)},init:function init(i,a){var s=resetModelPositions(a);d.debug("Updated model",s);var c=updateRecognitionPositions(i,s.lastPositions);return c.initPromise=Promise.resolve(s),c.initPromise.then((function(i){return c.initialized=!0,d.debug("Updated recognizer context",c),handleSuccess(c.editor,i,n.EventType.LOADED),i}))},close:function close(n,i){var a=n;return a.initialized=!1,delete a.instanceId,Promise.resolve(i)},clear:clear,reset:function reset$1(n,i){var a=resetModelPositions(i);d.debug("Updated model",a);var s=updateRecognitionPositions(n,a.lastPositions);return delete s.instanceId,d.debug("Updated recognizer context",s),Promise.resolve({res:a})}});var ke=function _arrayWithHoles(n){if(Array.isArray(n))return n};var Ce=function _iterableToArrayLimit(n,i){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(n)){var a=[],s=!0,c=!1,l=void 0;try{for(var u,d=n[Symbol.iterator]();!(s=(u=d.next()).done)&&(a.push(u.value),!i||a.length!==i);s=!0);}catch(n){c=!0,l=n}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}return a}};var Pe=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var Ie=function _slicedToArray(n,i){return ke(n)||Ce(n,i)||I(n,i)||Pe()};function UUIDjs(){}function getRandomInt(n,i){return Math.floor(Math.random()*(i-n+1))+n}UUIDjs.maxFromBits=function(n){return Math.pow(2,n)},UUIDjs.limitUI04=UUIDjs.maxFromBits(4),UUIDjs.limitUI06=UUIDjs.maxFromBits(6),UUIDjs.limitUI08=UUIDjs.maxFromBits(8),UUIDjs.limitUI12=UUIDjs.maxFromBits(12),UUIDjs.limitUI14=UUIDjs.maxFromBits(14),UUIDjs.limitUI16=UUIDjs.maxFromBits(16),UUIDjs.limitUI32=UUIDjs.maxFromBits(32),UUIDjs.limitUI40=UUIDjs.maxFromBits(40),UUIDjs.limitUI48=UUIDjs.maxFromBits(48),UUIDjs.randomUI04=function(){return getRandomInt(0,UUIDjs.limitUI04-1)},UUIDjs.randomUI06=function(){return getRandomInt(0,UUIDjs.limitUI06-1)},UUIDjs.randomUI08=function(){return getRandomInt(0,UUIDjs.limitUI08-1)},UUIDjs.randomUI12=function(){return getRandomInt(0,UUIDjs.limitUI12-1)},UUIDjs.randomUI14=function(){return getRandomInt(0,UUIDjs.limitUI14-1)},UUIDjs.randomUI16=function(){return getRandomInt(0,UUIDjs.limitUI16-1)},UUIDjs.randomUI32=function(){return getRandomInt(0,UUIDjs.limitUI32-1)},UUIDjs.randomUI40=function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)},UUIDjs.randomUI48=function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)},UUIDjs.paddedString=function(n,i,a){a=a||"0";for(var s=i-(n=String(n)).length;s>0;s>>>=1,a+=a)1&s&&(n=a+n);return n},UUIDjs.prototype.fromParts=function(n,i,a,s,c,l){return this.version=a>>12&15,this.hex=UUIDjs.paddedString(n.toString(16),8)+"-"+UUIDjs.paddedString(i.toString(16),4)+"-"+UUIDjs.paddedString(a.toString(16),4)+"-"+UUIDjs.paddedString(s.toString(16),2)+UUIDjs.paddedString(c.toString(16),2)+"-"+UUIDjs.paddedString(l.toString(16),12),this},UUIDjs.prototype.toString=function(){return this.hex},UUIDjs.prototype.toURN=function(){return"urn:uuid:"+this.hex},UUIDjs.prototype.toBytes=function(){for(var n=this.hex.split("-"),i=[],a=0,s=0;s>>16,timestamp:i}},UUIDjs._create4=function(){return(new UUIDjs).fromParts(UUIDjs.randomUI32(),UUIDjs.randomUI16(),16384|UUIDjs.randomUI12(),128|UUIDjs.randomUI06(),UUIDjs.randomUI08(),UUIDjs.randomUI48())},UUIDjs._create1=function(){var n=(new Date).getTime(),i=UUIDjs.randomUI14(),a=1099511627776*(1|UUIDjs.randomUI08())+UUIDjs.randomUI40(),s=UUIDjs.randomUI04(),c=0;n!=c?(n>>8|128,h=255&i;return(new UUIDjs).fromParts(u,l.mid,d,p,h,a)},UUIDjs.create=function(n){return this["_create"+(n=n||4)]()},UUIDjs.fromTime=function(n,i){i=i||!1;var a=UUIDjs.getTimeFieldValues(n),s=a.low,c=4095&a.hi|4096;return!1===i?(new UUIDjs).fromParts(s,a.mid,c,0,0,0):(new UUIDjs).fromParts(s,a.mid,c,128|UUIDjs.limitUI06,UUIDjs.limitUI08-1,UUIDjs.limitUI48-1)},UUIDjs.firstFromTime=function(n){return UUIDjs.fromTime(n,!1)},UUIDjs.lastFromTime=function(n){return UUIDjs.fromTime(n,!0)},UUIDjs.fromURN=function(n){var i;return(i=/^(?:urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\})?$/i.exec(n))?(new UUIDjs).fromParts(parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),parseInt(i[4],16),parseInt(i[5],16),parseInt(i[6],16)):null},UUIDjs.fromBytes=function(n){if(n.length<5)return null;for(var i="",a=0,s=[4,2,2,2,6],c=0;c255||i[a]<0)throw new Error("Unexpected byte in binary data.");return UUIDjs.fromBytes(i)},UUIDjs.new=function(){return this.create(4)},UUIDjs.newTS=function(){return this.create(1)};var Te=UUIDjs;function openWebSocket(n){var i;try{i=new WebSocket(n.url)}catch(n){d.error("Unable to open websocket, Check the host and your connectivity")}return function addWebsocketAttributes(n,i){var a=i.editor.configuration.recognitionParams.server.websocket,s=n;s.start=new Date,s.autoReconnect=a.autoReconnect,s.maxRetryCount=a.maxRetryCount,s.pingEnabled=a.pingEnabled,s.pingDelay=a.pingDelay,s.maxPingLost=a.maxPingLostCount,s.pingLostCount=0,s.recognizerContext=i}(i,n),i.pingEnabled&&function infinitePing(n){var i=n;i.pingLostCount++,i.pingLostCount>i.maxPingLost?n.close(1e3,"PING_LOST"):i.readyState<=1&&setTimeout((function(){i.readyState<=1&&(i.send(JSON.stringify({type:"ping"})),infinitePing(i))}),i.pingDelay)}(i),i.onopen=function(i){d.trace("onOpen"),n.websocketCallback(i)},i.onclose=function(a){d.trace("onClose",new Date-i.start),n.websocketCallback(a)},i.onerror=function(i){d.trace("onError"),n.websocketCallback(i)},i.onmessage=function(a){if(d.trace("onMessage"),i.pingLostCount=0,"pong"!==JSON.parse(a.data).type){var s={type:a.type,data:JSON.parse(a.data)};n.websocketCallback(s)}},i}function send(n,i){var a=n;a.idle=!1;var s=a.websocket;if(1!==s.readyState)throw J;s.send(JSON.stringify(i)),d.debug("".concat(i.type," message sent"),i)}function buildWebSocketCallback(n){return function(i){var a=n;d.trace("".concat(i.type," websocket callback"),i);var s=n.recognitionContexts[n.recognitionContexts.length-1];switch(d.debug("Current recognition context",s),i.type){case"open":n.sessionId?send(n,buildRestoreIInkSessionInput(n.editor.configuration,n.editor.domElement,n.sessionId)):send(n,buildNewContentPackageInput(n.editor.configuration,n.editor.domElement));break;case"message":switch(d.debug("Receiving ".concat(i.data.type," message"),i),i.data.type){case"ack":i.data.hmacChallenge&&send(n,function buildHmacMessage(n,i){return{type:"hmac",hmac:computeHmac(i.data.hmacChallenge,n.recognitionParams.server.applicationKey,n.recognitionParams.server.hmacKey)}}(n.editor.configuration,i)),i.data.iinkSessionId&&(a.sessionId=i.data.iinkSessionId);break;case"newPart":break;case"contentPackageDescription":a.currentReconnectionCount=0,a.contentPartCount=i.data.contentPartCount,send(n,buildConfiguration(n.editor.configuration)),a.currentPartId?send(n,buildOpenContentPart(n.editor.configuration,n.currentPartId)):send(n,buildNewContentPart(n.editor.configuration));break;case"partChanged":i.data.partId&&(a.currentPartId=i.data.partId),a.initialized=!0,s.partChange?s.partChange.resolve([void 0,i.data]):s.error(i);break;case"contentChanged":void 0!==i.data.canUndo&&(a.canUndo=i.data.canUndo),void 0!==i.data.canRedo&&(a.canRedo=i.data.canRedo),void 0!==i.data.empty&&(a.isEmpty=i.data.empty),void 0!==i.data.possibleUndoCount&&(a.possibleUndoCount=i.data.possibleUndoCount),void 0!==i.data.undoStackIndex&&(a.undoStackIndex=i.data.undoStackIndex),s.contentChange.resolve([void 0,i.data]);break;case"exported":s.response(void 0,i.data);break;case"svgPatch":s.patch(void 0,i.data);break;case"supportedImportMimeTypes":a.supportedImportMimeTypes=i.data.mimeTypes,s.response(void 0,i.data);break;case"fileChunkAck":s.response(void 0,i.data);break;case"idle":a.idle=!0,s.patch(void 0,i.data);break;case"error":if(d.debug("Error detected stopping all recognition",i),s){var c=function func(){};s.patch?c=s.patch:s.response&&(c=s.response),c(i.data)}else s.initPromise.reject(Object.assign({},i.data,{recoverable:!1}));break;default:d.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}break;case"error":if(d.debug("Error detected stopping all recognition",i),s){var l=function _func(){};s.patch?l=s.patch:s.response&&(l=s.response),l(Object.assign({},i,{recoverable:!1}))}else s.initPromise.reject(Object.assign({},i,{recoverable:!1}));break;case"close":d.debug("Close detected stopping all recognition",i),a.initialized=!1,"CLOSE_RECOGNIZER"===i.reason?s.initPromise.resolve(i):s?s.error(i):s.initPromise.reject(i);break;default:d.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}}}function init$1(n,i,a,s){var c=i.recognitionContexts[0],l=updateRecognitionPositions(i,c.model.lastPositions);return l.url=function buildUrl(n,i){var a="https"===n.recognitionParams.server.scheme?"wss":"ws";return"".concat(a,"://").concat(n.recognitionParams.server.host).concat(i)}(i.editor.configuration,n),l.reconnect=s,l.initPromise=c.initPromise.promise,d.debug("Opening the websocket for context ",i),l.websocketCallback=a(l),l.websocket=openWebSocket(l),l.initPromise}function retry(n,i,a,s){return _retry.apply(this,arguments)}function _retry(){return(_retry=B(H.mark((function _callee(n,i,a,s){var c,l,u,p=arguments;return H.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:for(c=p.length,l=new Array(c>4?c-4:0),u=4;u2?a-2:0),c=2;c0)return updateModelSentPosition(i),{type:"addStrokes",strokes:a.map((function(n){return Object.assign({},{id:n.id,pointerType:n.pointerType,pointerId:n.pointerId,x:n.x,y:n.y,t:n.t,p:n.p})}))}}function buildUndo(){return{type:"undo"}}function buildRedo(){return{type:"redo"}}function buildClear(){return{type:"clear"}}function buildConvert(n){return{type:"convert",conversionState:n}}function buildZoom(n){return{type:"zoom",zoom:n}}function buildResize(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{type:"changeViewSize",height:n.clientHeight3?c-3:0),u=3;ua.size];u.push(_prepareMessage.apply(void 0,[c,i,buildImportChunk].concat(p)))}))},p=0;p2&&void 0!==arguments[2]?arguments[2]:10;return _prepareMessage(n,i,buildZoom,a)},setPenStyle:setPenStyle$1,setPenStyleClasses:setPenStyleClasses$1,setTheme:setTheme$1,close:close$2});var De={grabber:S,strokerList:[j,X],rendererList:[D,W],recognizerList:[Se,Ae],events:function emit(n,i){p.info("emitting ".concat(n," event"),i),this.dispatchEvent(new CustomEvent(n,Object.assign({bubbles:!0,composed:!0},i?{detail:i}:void 0)))},getBehaviorFromConfiguration:function getBehaviorFromConfiguration(n,i){var a={};return a.grabber=n.grabber,i&&("REST"===i.recognitionParams.protocol?(a.stroker=j,a.renderer=D,a.recognizer=Se):(a.stroker=X,a.renderer=W,a.recognizer=Ae)),a.events=n.events,a}};function register(n,i,a,c,l,u){return s.debug("Registering a new editor"),new Ee(n,i,a,c,l,u)}function getAvailableLanguageList(n){return _getAvailableLanguageList.apply(this,arguments)}function _getAvailableLanguageList(){return(_getAvailableLanguageList=B(H.mark((function _callee(n){var i,a;return H.wrap((function _callee$(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!(n&&n.recognitionParams&&n.recognitionParams.server&&n.recognitionParams.server.host)){s.next=10;break}return i=n.recognitionParams.server,s.next=5,fetch("".concat(i.scheme,"://").concat(i.host,"/api/v4.0/iink/availableLanguageList"));case 5:if(!(a=s.sent)||!a.ok){s.next=8;break}return s.abrupt("return",a.json());case 8:s.next=11;break;case 10:console.error("Cannot get languages ! Please check your configuration!");case 11:s.next=16;break;case 13:s.prev=13,s.t0=s.catch(0),console.error(s.t0);case 16:case"end":return s.stop()}}),_callee,null,[[0,13]])})))).apply(this,arguments)}var je={Constants:n,DefaultConfiguration:f,DefaultBehaviors:De,DefaultPenStyle:undefined,DefaultTheme:b,register:register,getAvailableLanguageList:getAvailableLanguageList,LoggerConfig:a,Editor:Ee,InkModel:A,RecognizerContext:K};export default je;export{n as Constants,De as DefaultBehaviors,f as DefaultConfiguration,v as DefaultPenStyle,b as DefaultTheme,Ee as Editor,A as InkModel,a as LoggerConfig,K as RecognizerContext,getAvailableLanguageList,register}; //# sourceMappingURL=iink.esm.js.map diff --git a/dist/iink.esm.js.map b/dist/iink.esm.js.map index b4519334..f2dc34ae 100644 --- a/dist/iink.esm.js.map +++ b/dist/iink.esm.js.map @@ -1 +1 @@ -{"version":3,"file":"iink.esm.js","sources":["../src/configuration/Constants.js","../node_modules/loglevel/lib/loglevel.js","../src/configuration/LoggerConfig.js","../node_modules/lodash.merge/index.js","../src/configuration/DefaultConfiguration.js","../node_modules/json-css/lib/jsoncss.min.js","../src/configuration/DefaultPenStyle.js","../src/configuration/DefaultTheme.js","../src/grabber/PointerEventGrabber.js","../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../node_modules/@babel/runtime/helpers/iterableToArray.js","../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../node_modules/@babel/runtime/helpers/toConsumableArray.js","../src/renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js","../src/renderer/canvas/symbols/ShapeSymbolCanvasRenderer.js","../src/renderer/canvas/symbols/TextSymbolCanvasRenderer.js","../src/model/StrokeComponent.js","../src/model/Symbol.js","../src/model/InkModel.js","../src/renderer/canvas/CanvasRenderer.js","../src/renderer/QuadraticUtils.js","../src/renderer/canvas/stroker/QuadraticCanvasStroker.js","../node_modules/d3-selection/src/namespaces.js","../node_modules/d3-selection/src/namespace.js","../node_modules/d3-selection/src/creator.js","../node_modules/d3-selection/src/selector.js","../node_modules/d3-selection/src/selectorAll.js","../node_modules/d3-selection/src/selection/sparse.js","../node_modules/d3-selection/src/selection/enter.js","../node_modules/d3-selection/src/selection/data.js","../node_modules/d3-selection/src/selection/sort.js","../node_modules/d3-selection/src/selection/attr.js","../node_modules/d3-selection/src/window.js","../node_modules/d3-selection/src/selection/style.js","../node_modules/d3-selection/src/selection/property.js","../node_modules/d3-selection/src/selection/classed.js","../node_modules/d3-selection/src/selection/text.js","../node_modules/d3-selection/src/selection/html.js","../node_modules/d3-selection/src/selection/raise.js","../node_modules/d3-selection/src/selection/lower.js","../node_modules/d3-selection/src/selection/insert.js","../node_modules/d3-selection/src/selection/remove.js","../node_modules/d3-selection/src/selection/clone.js","../node_modules/d3-selection/src/selection/on.js","../node_modules/d3-selection/src/selection/dispatch.js","../node_modules/d3-selection/src/selection/index.js","../src/renderer/svg/symbols/StrokeSymbolSVGRenderer.js","../src/renderer/svg/SVGRenderer.js","../node_modules/d3-selection/src/selection/select.js","../node_modules/d3-selection/src/selection/selectAll.js","../node_modules/d3-selection/src/selection/filter.js","../node_modules/d3-selection/src/matcher.js","../node_modules/d3-selection/src/constant.js","../node_modules/d3-selection/src/selection/exit.js","../node_modules/d3-selection/src/selection/join.js","../node_modules/d3-selection/src/selection/merge.js","../node_modules/d3-selection/src/selection/order.js","../node_modules/d3-selection/src/selection/call.js","../node_modules/d3-selection/src/selection/nodes.js","../node_modules/d3-selection/src/selection/node.js","../node_modules/d3-selection/src/selection/size.js","../node_modules/d3-selection/src/selection/empty.js","../node_modules/d3-selection/src/selection/each.js","../node_modules/d3-selection/src/selection/append.js","../node_modules/d3-selection/src/selection/datum.js","../node_modules/d3-selection/src/select.js","../src/renderer/svg/stroker/QuadraticSVGStroker.js","../node_modules/@babel/runtime/helpers/asyncToGenerator.js","../node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/crypto-js/core.js","../node_modules/crypto-js/enc-hex.js","../node_modules/crypto-js/x64-core.js","../node_modules/crypto-js/sha512.js","../node_modules/crypto-js/hmac.js","../node_modules/crypto-js/hmac-sha512.js","../src/recognizer/CryptoHelper.js","../src/recognizer/rest/networkInterface.js","../src/model/RecognizerContext.js","../node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js","../node_modules/select/src/select.js","../node_modules/clipboard/lib/clipboard-action.js","../node_modules/tiny-emitter/index.js","../node_modules/good-listener/src/is.js","../node_modules/delegate/src/closest.js","../node_modules/delegate/src/delegate.js","../node_modules/good-listener/src/listen.js","../node_modules/clipboard/lib/clipboard.js","../src/smartguide/SmartGuide.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/model/UndoRedoContext.js","../src/model/UndoRedoManager.js","../src/renderer/canvas/ImageRenderer.js","../src/eastereggs/InkImporter.js","../src/util/PromiseHelper.js","../src/Editor.js","../src/configuration/DefaultBehaviors.js","../src/recognizer/RecognizerService.js","../src/recognizer/DefaultRecognizer.js","../src/recognizer/rest/iinkRestRecognizer.js","../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../node_modules/@babel/runtime/helpers/nonIterableRest.js","../node_modules/@babel/runtime/helpers/slicedToArray.js","../node_modules/uuid-js/lib/uuid.js","../src/recognizer/websocket/networkWSInterface.js","../src/recognizer/websocket/WsBuilder.js","../src/recognizer/websocket/WsRecognizerUtil.js","../src/recognizer/websocket/iinkWsRecognizer.js","../src/event/Event.js","../src/EditorFacade.js","../src/iink.js"],"sourcesContent":["/**\n * @typedef {Object} Constants\n */\n\nconst Constants = {\n EventType: {\n IDLE: 'idle',\n CHANGED: 'changed',\n IMPORTED: 'imported',\n EXPORTED: 'exported',\n CONVERTED: 'converted',\n RENDERED: 'rendered', // Internal use only\n LOADED: 'loaded',\n UNDO: 'undo',\n REDO: 'redo',\n CLEAR: 'clear',\n IMPORT: 'import',\n SUPPORTED_IMPORT_MIMETYPES: 'supportedImportMimeTypes',\n EXPORT: 'export',\n CONVERT: 'convert',\n ERROR: 'error'\n },\n RecognitionType: {\n TEXT: 'TEXT',\n MATH: 'MATH',\n DIAGRAM: 'DIAGRAM',\n RAWCONTENT: 'Raw Content'\n },\n Protocol: {\n WEBSOCKET: 'WEBSOCKET',\n REST: 'REST'\n },\n ModelState: {\n INITIALIZING: 'INITIALIZING',\n INITIALIZED: 'INITIALIZED',\n EXPORTING: 'EXPORTING',\n EXPORTED: 'EXPORTED',\n PENDING: 'PENDING',\n MODIFIED: 'MODIFIED',\n ERROR: 'ERROR'\n },\n Trigger: {\n QUIET_PERIOD: 'QUIET_PERIOD',\n POINTER_UP: 'POINTER_UP',\n DEMAND: 'DEMAND'\n },\n Logger: {\n EDITOR: 'editor',\n MODEL: 'model',\n GRABBER: 'grabber',\n RENDERER: 'renderer',\n RECOGNIZER: 'recognizer',\n EVENT: 'event',\n UTIL: 'util',\n SMARTGUIDE: 'smartguide'\n },\n LogLevel: {\n TRACE: 'TRACE',\n DEBUG: 'DEBUG',\n INFO: 'INFO',\n WARN: 'WARN',\n ERROR: 'ERROR'\n },\n Languages: {\n zh_CN: 'Noto Sans CJK tc',\n zh_HK: 'Noto Sans CJK tc',\n zh_TW: 'Noto Sans CJK tc',\n ko_KR: 'Noto Sans CJK kr',\n ja_JP: 'Noto Sans CJK jp',\n default: 'Open Sans'\n },\n Error: {\n NOT_REACHABLE: 'MyScript recognition server is not reachable. Please reload once you are connected.',\n WRONG_CREDENTIALS: 'Application credentials are invalid. Please check or regenerate your application key and hmackey.',\n TOO_OLD: 'Session is too old. Max Session Duration Reached.',\n NO_ACTIVITY: 'Session closed due to no activity.'\n },\n Exports: {\n JIIX: 'application/vnd.myscript.jiix'\n }\n}\nexport default Constants\n","/*\n* loglevel - https://github.com/pimterry/loglevel\n*\n* Copyright (c) 2013 Tim Perry\n* Licensed under the MIT license.\n*/\n(function (root, definition) {\n \"use strict\";\n if (typeof define === 'function' && define.amd) {\n define(definition);\n } else if (typeof module === 'object' && module.exports) {\n module.exports = definition();\n } else {\n root.log = definition();\n }\n}(this, function () {\n \"use strict\";\n\n // Slightly dubious tricks to cut down minimized file size\n var noop = function() {};\n var undefinedType = \"undefined\";\n var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (\n /Trident\\/|MSIE /.test(window.navigator.userAgent)\n );\n\n var logMethods = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\"\n ];\n\n // Cross-browser bind equivalent that works at least back to IE6\n function bindMethod(obj, methodName) {\n var method = obj[methodName];\n if (typeof method.bind === 'function') {\n return method.bind(obj);\n } else {\n try {\n return Function.prototype.bind.call(method, obj);\n } catch (e) {\n // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n return function() {\n return Function.prototype.apply.apply(method, [obj, arguments]);\n };\n }\n }\n }\n\n // Trace() doesn't print the message in IE, so for that case we need to wrap it\n function traceForIE() {\n if (console.log) {\n if (console.log.apply) {\n console.log.apply(console, arguments);\n } else {\n // In old IE, native console methods themselves don't have apply().\n Function.prototype.apply.apply(console.log, [console, arguments]);\n }\n }\n if (console.trace) console.trace();\n }\n\n // Build the best logging method possible for this env\n // Wherever possible we want to bind, not wrap, to preserve stack traces\n function realMethod(methodName) {\n if (methodName === 'debug') {\n methodName = 'log';\n }\n\n if (typeof console === undefinedType) {\n return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n } else if (methodName === 'trace' && isIE) {\n return traceForIE;\n } else if (console[methodName] !== undefined) {\n return bindMethod(console, methodName);\n } else if (console.log !== undefined) {\n return bindMethod(console, 'log');\n } else {\n return noop;\n }\n }\n\n // These private functions always need `this` to be set properly\n\n function replaceLoggingMethods(level, loggerName) {\n /*jshint validthis:true */\n for (var i = 0; i < logMethods.length; i++) {\n var methodName = logMethods[i];\n this[methodName] = (i < level) ?\n noop :\n this.methodFactory(methodName, level, loggerName);\n }\n\n // Define log.log as an alias for log.debug\n this.log = this.debug;\n }\n\n // In old IE versions, the console isn't present until you first open it.\n // We build realMethod() replacements here that regenerate logging methods\n function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {\n return function () {\n if (typeof console !== undefinedType) {\n replaceLoggingMethods.call(this, level, loggerName);\n this[methodName].apply(this, arguments);\n }\n };\n }\n\n // By default, we use closely bound real methods wherever possible, and\n // otherwise we wait for a console to appear, and then try again.\n function defaultMethodFactory(methodName, level, loggerName) {\n /*jshint validthis:true */\n return realMethod(methodName) ||\n enableLoggingWhenConsoleArrives.apply(this, arguments);\n }\n\n function Logger(name, defaultLevel, factory) {\n var self = this;\n var currentLevel;\n\n var storageKey = \"loglevel\";\n if (typeof name === \"string\") {\n storageKey += \":\" + name;\n } else if (typeof name === \"symbol\") {\n storageKey = undefined;\n }\n\n function persistLevelIfPossible(levelNum) {\n var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage[storageKey] = levelName;\n return;\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n } catch (ignore) {}\n }\n\n function getPersistedLevel() {\n var storedLevel;\n\n if (typeof window === undefinedType || !storageKey) return;\n\n try {\n storedLevel = window.localStorage[storageKey];\n } catch (ignore) {}\n\n // Fallback to cookies if local storage gives us nothing\n if (typeof storedLevel === undefinedType) {\n try {\n var cookie = window.document.cookie;\n var location = cookie.indexOf(\n encodeURIComponent(storageKey) + \"=\");\n if (location !== -1) {\n storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];\n }\n } catch (ignore) {}\n }\n\n // If the stored level is not valid, treat it as if nothing was stored.\n if (self.levels[storedLevel] === undefined) {\n storedLevel = undefined;\n }\n\n return storedLevel;\n }\n\n /*\n *\n * Public logger API - see https://github.com/pimterry/loglevel for details\n *\n */\n\n self.name = name;\n\n self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n \"ERROR\": 4, \"SILENT\": 5};\n\n self.methodFactory = factory || defaultMethodFactory;\n\n self.getLevel = function () {\n return currentLevel;\n };\n\n self.setLevel = function (level, persist) {\n if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n level = self.levels[level.toUpperCase()];\n }\n if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n currentLevel = level;\n if (persist !== false) { // defaults to true\n persistLevelIfPossible(level);\n }\n replaceLoggingMethods.call(self, level, name);\n if (typeof console === undefinedType && level < self.levels.SILENT) {\n return \"No console available for logging\";\n }\n } else {\n throw \"log.setLevel() called with invalid level: \" + level;\n }\n };\n\n self.setDefaultLevel = function (level) {\n if (!getPersistedLevel()) {\n self.setLevel(level, false);\n }\n };\n\n self.enableAll = function(persist) {\n self.setLevel(self.levels.TRACE, persist);\n };\n\n self.disableAll = function(persist) {\n self.setLevel(self.levels.SILENT, persist);\n };\n\n // Initialize with the right level\n var initialLevel = getPersistedLevel();\n if (initialLevel == null) {\n initialLevel = defaultLevel == null ? \"WARN\" : defaultLevel;\n }\n self.setLevel(initialLevel, false);\n }\n\n /*\n *\n * Top-level API\n *\n */\n\n var defaultLogger = new Logger();\n\n var _loggersByName = {};\n defaultLogger.getLogger = function getLogger(name) {\n if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n throw new TypeError(\"You must supply a name when creating a logger.\");\n }\n\n var logger = _loggersByName[name];\n if (!logger) {\n logger = _loggersByName[name] = new Logger(\n name, defaultLogger.getLevel(), defaultLogger.methodFactory);\n }\n return logger;\n };\n\n // Grab the current global log variable in case of overwrite\n var _log = (typeof window !== undefinedType) ? window.log : undefined;\n defaultLogger.noConflict = function() {\n if (typeof window !== undefinedType &&\n window.log === defaultLogger) {\n window.log = _log;\n }\n\n return defaultLogger;\n };\n\n defaultLogger.getLoggers = function getLoggers() {\n return _loggersByName;\n };\n\n // ES6 default export, for compatibility\n defaultLogger['default'] = defaultLogger;\n\n return defaultLogger;\n}));\n","import * as loglevel from 'loglevel'\nimport Constants from './Constants'\n\n/**\n * Main log instance\n * @type {Object}\n */\nconst log = loglevel.noConflict()\nexport default log\n\n/**\n * Log editor events\n * @type {Object}\n */\nexport const editorLogger = log.getLogger(Constants.Logger.EDITOR)\neditorLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log editor events\n * @type {Object}\n */\nexport const smartGuideLogger = log.getLogger(Constants.Logger.SMARTGUIDE)\neditorLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log model events\n * @type {Object}\n */\nexport const modelLogger = log.getLogger(Constants.Logger.MODEL)\nmodelLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log grabber events\n * @type {Object}\n */\nexport const grabberLogger = log.getLogger(Constants.Logger.GRABBER)\ngrabberLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log grabber events\n * @type {Object}\n */\nexport const rendererLogger = log.getLogger(Constants.Logger.RENDERER)\nrendererLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log recognizer events\n * @type {Object}\n */\nexport const recognizerLogger = log.getLogger(Constants.Logger.RECOGNIZER)\nrecognizerLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log callback events\n * @type {Object}\n */\nexport const eventLogger = log.getLogger(Constants.Logger.EVENT)\neventLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log util events\n * @type {Object}\n */\nexport const utilLogger = log.getLogger(Constants.Logger.UTIL)\nutilLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log tests events\n * @type {Object}\n */\nexport const testLogger = log.getLogger('test')\ntestLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = merge;\n","import merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * Default configuration\n * See https://developer.myscript.com/docs/interactive-ink/latest/reference/web/configuration/ for a full documentation of parameters.\n */\nconst defaultConfiguration = {\n recognitionParams: {\n type: 'TEXT',\n protocol: 'WEBSOCKET',\n server: {\n scheme: 'https',\n host: 'cloud.myscript.com',\n applicationKey: undefined,\n hmacKey: undefined,\n useWindowLocation: false,\n websocket: {\n pingEnabled: true,\n pingDelay: 30000,\n maxPingLostCount: 10,\n autoReconnect: true,\n maxRetryCount: 2,\n fileChunkSize: 300000\n }\n },\n iink: {\n alwaysConnected: true,\n lang: 'en_US',\n export: {\n 'image-resolution': 300,\n jiix: {\n 'bounding-box': false,\n strokes: false,\n text: {\n chars: false,\n words: true\n }\n }\n },\n renderer: {\n debug: {\n 'draw-text-boxes': false,\n 'draw-image-boxes': false\n }\n },\n math: {\n mimeTypes: ['application/x-latex', 'application/mathml+xml'],\n solver: {\n enable: true,\n 'fractional-part-digits': 3,\n 'decimal-separator': '.',\n 'rounding-mode': 'half up',\n 'angle-unit': 'deg'\n },\n margin: {\n bottom: 10,\n left: 15,\n right: 15,\n top: 10\n },\n eraser: {\n 'erase-precisely': false\n }\n },\n text: {\n guides: {\n enable: true\n },\n smartGuide: true,\n smartGuideFadeOut: {\n enable: false,\n duration: 10000\n },\n mimeTypes: ['text/plain', 'application/vnd.myscript.jiix'],\n margin: {\n top: 20,\n left: 10,\n right: 10\n },\n eraser: {\n 'erase-precisely': false\n }\n },\n diagram: {\n mimeTypes: ['application/vnd.myscript.jiix'],\n margin: {\n bottom: 10,\n left: 15,\n right: 15,\n top: 10\n }\n },\n 'raw-content': {\n recognition: {\n text: false,\n shape: false\n }\n }\n }\n },\n // @see generated documentation on top\n listenerOptions: {\n capture: false,\n passive: true\n },\n undoRedoMaxStackSize: 20,\n xyFloatPrecision: 0,\n timestampFloatPrecision: 0,\n triggerDelay: 2000,\n processDelay: 0,\n resizeTriggerDelay: 200,\n // Configure when the action is triggered.\n // POINTER_UP : Action is triggered on every PenUP. This is the recommended mode for CDK V3 WebSocket recognitions.\n // QUIET_PERIOD : Action is triggered after a quiet period in milli-seconds on every pointer up. I value is set to 2000 for example the recognition will be fired when user stop writing 2 seconds. This is the recommended mode for all REST recognitions.\n triggers: {\n exportContent: 'POINTER_UP',\n addStrokes: 'POINTER_UP'\n },\n restConversionState: '',\n renderingParams: {\n stroker: 'quadratic',\n minHeight: 100,\n minWidth: 100\n }\n}\n\n/**\n * Generate parameters\n * @param {Configuration} configuration Configuration to be used\n * @param {Object} watcher: { update: function, prop: string} function to call when 'prop' is updated\n * @return {Configuration} Overridden configuration\n */\nexport function overrideDefaultConfiguration (configuration) {\n const confRef = configuration\n let currentConfiguration\n if (confRef && confRef.recognitionParams.server && confRef.recognitionParams.server.useWindowLocation) {\n confRef.recognitionParams.server.scheme = window.location.protocol.slice(0, -1)\n confRef.recognitionParams.server.host = window.location.host\n currentConfiguration = merge({}, defaultConfiguration, confRef === undefined ? {} : confRef)\n } else {\n currentConfiguration = merge({}, defaultConfiguration, configuration === undefined ? {} : configuration)\n }\n logger.debug('Override default configuration', currentConfiguration)\n\n return currentConfiguration\n}\n\nexport default defaultConfiguration\n","!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.JsonCSS=e():t.JsonCSS=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\"a\",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p=\"\",e(e.s=1)}([function(t,e,n){\"use strict\";function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}Object.defineProperty(e,\"__esModule\",{value:!0});var r=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},i=function t(e){var n=this;o(this,t),this.toJSON=function(t){if(\"string\"!=typeof t)return console.error(\"Need a CSS string but given \",void 0===t?\"undefined\":r(t),t),\"Not a valid CSS..!\";var e={},o=void 0,i=void 0,u=void 0;try{t.split(\"{\").forEach(function(t){if(i=t.trim())if(-1===i.indexOf(\"}\"))e[i]={},o=i;else{i.substring(0,i.indexOf(\"}\")).split(\";\").forEach(function(t){(u=t.split(\":\"))&&2===u.length&&(e[o][u[0].trim().replace(/^\\\"|\\\"$/g,\"\")]=n._trimSemiColon(u[1].trim().replace(/^\\\"|\\\"$/g,\"\")))});try{o=i.split(\"}\")[1].trim(),o&&(e[o]={})}catch(t){}}})}catch(t){return\"Not a valid CSS..!\"}return e},this.toCSS=function(t){if(\"object\"!==(void 0===t?\"undefined\":r(t)))return console.error(\"Need a JSON object but given \",void 0===t?\"undefined\":r(t),t),\"Not a valid JSON..!\";var e=\"\";try{for(var n in t)if(t.hasOwnProperty(n)){e+=n+\" {\\n\";for(var o in t[n])t[n].hasOwnProperty(o)&&(e+=o+\": \"+t[n][o]+\";\\n\");e+=\"}\\n\"}}catch(t){return\"Not a valid JSON..!\"}return e},this._trimSemiColon=function(t){return\";\"===t.slice(-1)?t.slice(0,n.length-1):t}};e.default=i},function(t,e,n){\"use strict\";t.exports=n(0).default}])});","import JsonCSS from 'json-css'\nimport merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * @typedef {Object} PenStyle\n * @property {String} color=#000000 Color (supported formats rgb() rgba() hsl() hsla() #rgb #rgba #rrggbb #rrggbbaa)\n * @property {String} -myscript-pen-width=1 Width of strokes and primitives in mm (no other unit is supported yet)\n * @property {String} -myscript-pen-fill-style=none\n * @property {String} -myscript-pen-fill-color=#FFFFFF00 Color filled inside the area delimited by strokes and primitives\n */\n\n/**\n * Default style\n * @type {PenStyle}\n */\nconst defaultPenStyle = undefined\nconst parser = new JsonCSS()\n\n/**\n * Generate style\n * @param {PenStyle} style Custom style to be applied\n * @return {PenStyle} Overridden style\n */\nexport function overrideDefaultPenStyle (style) {\n const currentStyle = merge({}, defaultPenStyle, style === undefined ? {} : style)\n logger.debug('Override default pen style', currentStyle)\n return currentStyle\n}\n\nexport function toCSS (penStyle) { // FIXME Ugly hack to parse JSON to CSS inline\n const css = parser.toCSS({ css: penStyle })\n return css.substring(6, css.length - 3)\n}\n\nexport function toJSON (penStyle) { // FIXME Ugly hack to parse CSS inline to JSON\n return parser.toJSON(`css {${penStyle}}`).css\n}\n\nexport default defaultPenStyle\n","import JsonCSS from 'json-css'\nimport merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * @typedef {PenStyle} InkTheme\n */\n/**\n * @typedef {Object} MathTheme\n * @property {String} font-family=STIXGeneral Font-family to be used\n */\n/**\n * @typedef {Object} GeneratedTheme\n * @property {String} font-family=STIXGeneral Font-family to be used\n * @property {String} color=#A8A8A8FF Color to be used\n */\n/**\n * @typedef {Object} TextTheme\n * @property {String} font-family=OpenSans Font-family to be used\n * @property {Number} font-size=10 Font-size to be used\n */\n/**\n * @typedef {Object} Theme\n * @property {InkTheme} ink General settings\n * @property {MathTheme} .math Math theme\n * @property {GeneratedTheme} .math-solver Theme to be used for generated items\n * @property {TextTheme} .text Text theme\n */\n\n/**\n * Default theme\n * @type {Theme}\n */\nconst defaultTheme = {\n ink: {\n color: '#000000',\n '-myscript-pen-width': 1,\n '-myscript-pen-fill-style': 'none',\n '-myscript-pen-fill-color': '#FFFFFF00'\n },\n '.math': {\n 'font-family': 'STIXGeneral'\n },\n '.math-solved': {\n 'font-family': 'STIXGeneral',\n color: '#A8A8A8FF'\n },\n '.text': {\n 'font-family': 'Open Sans',\n 'font-size': 10\n }\n}\nconst parser = new JsonCSS()\n\n/**\n * Generate theme\n * @param {Theme} theme Custom theme to be applied\n * @return {Theme} Overridden theme\n */\nexport function overrideDefaultTheme (theme) {\n const currentTheme = merge({}, defaultTheme, theme === undefined ? {} : theme)\n logger.debug('Override default theme', currentTheme)\n return currentTheme\n}\n\nexport function toCSS (theme) {\n return parser.toCSS(theme)\n}\n\nexport function toJSON (theme) {\n return parser.toJSON(theme)\n}\n\nexport default defaultTheme\n","import { grabberLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Grab pointerDown, pointerMove and pointerUp events\n * @typedef {Object} Grabber\n * @property {function} attach Attach events and decide when to call editor pointerDown/Move/Up methods\n * @property {function} detach Detach the grabber\n */\n\n/**\n * Grabber listener\n * @typedef {Object} GrabberListener\n * @property {Array} types Event types to listen\n * @property {function} listener Event listener for these events\n */\n\n/**\n * Grabber context\n * @typedef {Object} GrabberContext\n * @property {Boolean|Object} options Options object that specifies characteristics about the event listener. (@see addEventListener.options for detail)\n * @property {Array} listeners Registered listeners\n */\n\nconst floatPrecisionArray = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]\n\nfunction roundFloat (oneFloat, requestedFloatPrecision) {\n if (requestedFloatPrecision || requestedFloatPrecision === 0) {\n let floatPrecision\n if (requestedFloatPrecision > 10) {\n floatPrecision = floatPrecisionArray[10]\n } else {\n floatPrecision = floatPrecisionArray[requestedFloatPrecision]\n }\n return Math.round(oneFloat * floatPrecision) / floatPrecision\n }\n return oneFloat\n}\n\nfunction extractPoint (event, domElement, configuration, offsetTop = 0, offsetLeft = 0) {\n let eventRef = event\n if (eventRef.changedTouches) {\n eventRef = eventRef.changedTouches[0]\n }\n const rect = domElement.getBoundingClientRect()\n return {\n x: roundFloat(eventRef.clientX - rect.left - domElement.clientLeft - offsetLeft, configuration.xyFloatPrecision),\n y: roundFloat(eventRef.clientY - rect.top - domElement.clientTop - offsetTop, configuration.xyFloatPrecision),\n t: roundFloat(Date.now(), configuration.timestampFloatPrecision)\n }\n}\n\nconst prevent = (e) => e.preventDefault()\n/**\n * Listen for the desired events\n * @param {Element} element DOM element to attach events listeners\n * @param {Editor} editor Editor to received down/move/up events\n * @param {Number} [offsetTop=0]\n * @param {Number} [offsetLeft=0]\n * @return {GrabberContext} Grabber context\n * @listens {Event} pointermove: a pointer moves, similar to touchmove or mousemove.\n * @listens {Event} pointerdown: a pointer is activated, or a device button held.\n * @listens {Event} pointerup: a pointer is deactivated, or a device button released.\n * @listens {Event} pointerover: a pointer has moved onto an element.\n * @listens {Event} pointerout: a pointer is no longer on an element it once was.\n * @listens {Event} pointerenter: a pointer enters the bounding box of an element.\n * @listens {Event} pointerleave: a pointer leaves the bounding box of an element.\n * @listens {Event} pointercancel: a pointer will no longer generate events.\n */\nexport function attach (element, editor, offsetTop = 0, offsetLeft = 0) {\n let mMaxDiffX = 0\n\n function unfocus () {\n if (window.getSelection().type !== 'None') {\n window.getSelection().removeAllRanges()\n }\n }\n\n function hideMenu (evt) {\n const moreMenuInDocument = document.querySelector('.more-menu')\n if (!evt.target.classList.contains('ellipsis') && !evt.target.classList.contains('more-menu') && !evt.target.classList.contains('options-label-button') && moreMenuInDocument && moreMenuInDocument.style.display !== 'none') {\n moreMenuInDocument.style.display = 'none'\n return true\n }\n return false\n }\n\n function hideCandidates (evt) {\n const candidatesInDocument = document.querySelector('.candidates')\n if (!evt.target.classList.contains('candidates') && !(evt.target.tagName === 'SPAN') && candidatesInDocument && candidatesInDocument.style.display !== 'none') {\n candidatesInDocument.style.display = 'none'\n return true\n }\n return false\n }\n\n function pointerDownHandler (evt) { // Trigger a pointerDown\n const pointerDownOnEditor = evt.target.id === editor.domElement.id || evt.target.classList.contains('ms-canvas')\n if (this.activePointerId !== undefined) {\n if (this.activePointerId === evt.pointerId) {\n logger.trace(`${evt.type} event with the same id without any pointer up`, evt.pointerId)\n }\n } else if ((evt.button !== 2) && (evt.buttons !== 2) && pointerDownOnEditor) { // Ignore right click\n if (!hideMenu(evt) && !hideCandidates(evt)) {\n this.activePointerId = evt.pointerId\n // Hack for iOS 9 Safari : pointerId has to be int so -1 if > max value\n const pointerId = evt.pointerId > 2147483647 ? -1 : evt.pointerId\n unfocus()\n evt.stopPropagation()\n let pointerType = evt.pointerType\n if (editor.isErasing) {\n pointerType = 'ERASER'\n }\n editor.pointerDown(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft), pointerType, pointerId)\n }\n } else if (evt.target.classList.contains('ellipsis') || evt.target.classList.contains('tag-icon')) {\n hideMenu(evt)\n hideCandidates(evt)\n } else { // FIXME add more complete verification to pointer down on smartguide\n hideMenu(evt)\n hideCandidates(evt)\n this.smartGuidePointerDown = true\n this.downSmartGuidePoint = extractPoint(evt, element, editor.configuration)\n }\n }\n\n function pointerMoveHandler (evt) { // Trigger a pointerMove\n // Only considering the active pointer\n if (this.activePointerId !== undefined && this.activePointerId === evt.pointerId) {\n unfocus()\n editor.pointerMove(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft))\n } else if (this.smartGuidePointerDown) {\n const point = extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft)\n const diffX = Math.abs(this.downSmartGuidePoint.x - point.x)\n const diffY = Math.abs(this.downSmartGuidePoint.y - point.y)\n mMaxDiffX = Math.max(diffX, mMaxDiffX)\n const cond1 = diffX < 5 && diffY > 5 && mMaxDiffX < 15\n const cond2 = diffX > 5 && diffY > 5 && mMaxDiffX < 15\n if (cond1 || cond2) {\n this.activePointerId = evt.pointerId\n // Hack for iOS 9 Safari : pointerId has to be int so -1 if > max value\n const pointerId = evt.pointerId > 2147483647 ? -1 : evt.pointerId\n unfocus()\n editor.pointerDown(this.downSmartGuidePoint, evt.pointerType, pointerId)\n }\n } else {\n logger.trace(`${evt.type} event from another pointerid (${evt.pointerId})`, this.activePointerId)\n }\n }\n\n function pointerUpHandler (evt) { // Trigger a pointerUp\n mMaxDiffX = 0\n this.smartGuidePointerDown = false\n const smartGuideIds = ['smartguide', 'prompter-text-container', 'prompter-text', 'tag-icon', 'ellipsis']\n const scrollbarClasses = ['ps__rail-x', 'ps__thumb-x']\n // Check if pointer entered into any smartguide elements or scrollbar\n // Use case : when the pointer is entering the smartguide or scrollbar, a pointerout (or leave) is fired.\n // The related target is then the DOM element that was left.\n // We don't want this to cause editor.pointerUp because the stroke isn't finished.\n const pointerEnteredSmartGuide = evt.relatedTarget && (smartGuideIds.includes(evt.relatedTarget.className) || scrollbarClasses.includes(evt.relatedTarget.className))\n // Check if pointer didn't stay in the smartguide and pointer exited the smartguide or scrollbar\n // Use case : when the pointer is leaving the smartguide or scrollbar, a pointerout (or leave) is fired.\n // The related target is then the DOM element that was left (the smart guide)\n // We are entering again the editor\n // We don't want this to cause editor.pointerUp because the stroke isn't finished.\n const pointerExitedSmartGuide = evt.relatedTarget && evt.target && (smartGuideIds.includes(evt.target.className) || scrollbarClasses.includes(evt.target.className))\n // Check if pointer moved between words in smartguide\n // Same use case as pointerEnteredSmartGuide but for the words in the smartguide (each word is a span).\n const pointerMovedWords = evt.relatedTarget && evt.target && (evt.target.tagName === 'SPAN' || evt.relatedTarget.tagName === 'SPAN')\n if (pointerEnteredSmartGuide || pointerExitedSmartGuide || pointerMovedWords) {\n evt.stopPropagation()\n } else if (this.activePointerId !== undefined && this.activePointerId === evt.pointerId) { // Only considering the active pointer\n this.activePointerId = undefined // Managing the active pointer\n evt.stopPropagation()\n editor.pointerUp(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft))\n } else {\n logger.trace(`${evt.type} event from another pointerid (${evt.pointerId})`, this.activePointerId)\n }\n }\n\n const context = {\n options: editor.configuration.listenerOptions,\n listeners: [{\n types: ['pointerdown'],\n listener: pointerDownHandler\n }, {\n types: ['pointermove'],\n listener: pointerMoveHandler\n }, {\n types: ['pointerup', 'pointerout', 'pointerleave', 'pointercancel'],\n listener: pointerUpHandler\n }]\n }\n\n logger.debug('attaching listeners', context)\n context.listeners.forEach((item) => {\n item.types.forEach(type => element.addEventListener(type, item.listener, context.options))\n })\n\n element.addEventListener('touchmove', prevent)\n\n // FIXME investigate why this is needed for iOS devices\n document.documentElement.addEventListener('pointerdown', () => {})\n return context\n}\n\nexport function detach (element, context) {\n logger.debug('detaching listeners', context)\n context.listeners.forEach((item) => {\n item.types.forEach(type => element.removeEventListener(type, item.listener, context.options))\n })\n element.removeEventListener('touchmove', prevent)\n document.documentElement.removeEventListener('pointerdown', () => {})\n}\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayWithoutHoles = require(\"./arrayWithoutHoles.js\");\n\nvar iterableToArray = require(\"./iterableToArray.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/**\n * Draw a stroke symbol\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Stroke to be drawn\n * @param {Stroker} stroker Stroker to use to render a stroke\n */\nexport function drawStroke (context, stroke, stroker) {\n if (stroker && (!stroke || stroke.pointerType !== 'ERASER')) {\n stroker.drawStroke(context, stroke)\n }\n}\n","import { rendererLogger as logger } from '../../../configuration/LoggerConfig'\n\n/**\n * @type {{table: String, shape: String, recognizedShape: String, ellipse: String, line: String}}\n */\nexport const ShapeSymbols = {\n table: 'table',\n shape: 'shape',\n recognizedShape: 'recognizedShape',\n ellipse: 'ellipse',\n line: 'line'\n}\n\nfunction phi (angle) {\n let returnedAngle = ((angle + Math.PI) % (Math.PI * 2)) - Math.PI\n if (returnedAngle < -Math.PI) {\n returnedAngle += Math.PI * 2\n }\n return returnedAngle\n}\n\nfunction drawEllipseArc (context, centerPoint, maxRadius, minRadius, orientation, startAngle, sweepAngle) {\n const angleStep = 0.02 // angle delta between interpolated\n\n let z1 = Math.cos(orientation)\n let z3 = Math.sin(orientation)\n let z2 = z1\n let z4 = z3\n z1 *= maxRadius\n z2 *= minRadius\n z3 *= maxRadius\n z4 *= minRadius\n\n const n = Math.floor(Math.abs(sweepAngle) / angleStep)\n\n const boundariesPoints = []\n\n context.save()\n try {\n context.beginPath()\n\n for (let i = 0; i <= n; i++) {\n const angle = startAngle + ((i / n) * sweepAngle) // points on the arc, in radian\n const alpha = Math.atan2(Math.sin(angle) / minRadius, Math.cos(angle) / maxRadius)\n\n const cosAlpha = Math.cos(alpha)\n const sinAlpha = Math.sin(alpha)\n\n // current point\n const x = (centerPoint.x + (z1 * cosAlpha)) - (z4 * sinAlpha)\n const y = (centerPoint.y + (z2 * sinAlpha)) + (z3 * cosAlpha)\n if (i === 0) {\n context.moveTo(x, y)\n } else {\n context.lineTo(x, y)\n }\n\n if (i === 0 || i === n) {\n boundariesPoints.push({ x, y })\n }\n }\n\n context.stroke()\n } finally {\n context.restore()\n }\n\n return boundariesPoints\n}\n\nfunction drawArrowHead (context, headPoint, angle, length) {\n const alpha = phi(angle + (Math.PI * (7 / 8)))\n const beta = phi(angle - (Math.PI * (7 / 8)))\n\n const contextReference = context\n contextReference.save()\n try {\n contextReference.fillStyle = contextReference.strokeStyle\n\n contextReference.moveTo(headPoint.x, headPoint.y)\n contextReference.beginPath()\n contextReference.lineTo(headPoint.x + (length * Math.cos(alpha)), headPoint.y + (length * Math.sin(alpha)))\n contextReference.lineTo(headPoint.x + (length * Math.cos(beta)), headPoint.y + (length * Math.sin(beta)))\n contextReference.lineTo(headPoint.x, headPoint.y)\n contextReference.fill()\n } finally {\n contextReference.restore()\n }\n}\n\nfunction drawShapeEllipse (context, shapeEllipse) {\n const points = drawEllipseArc(\n context,\n shapeEllipse.center,\n shapeEllipse.maxRadius,\n shapeEllipse.minRadius,\n shapeEllipse.orientation,\n shapeEllipse.startAngle,\n shapeEllipse.sweepAngle)\n\n if (shapeEllipse.beginDecoration && shapeEllipse.beginDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, points[0], shapeEllipse.beginTangentAngle, 12.0)\n }\n if (shapeEllipse.endDecoration && shapeEllipse.endDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, points[1], shapeEllipse.endTangentAngle, 12.0)\n }\n}\n\n/**\n * Draw a line\n * @param {Object} context Current rendering context\n * @param {{x: Number, y: Number}} p1 Origin point\n * @param {{x: Number, y: Number}} p2 Destination point\n */\nexport function drawLine (context, p1, p2) {\n context.save()\n try {\n context.beginPath()\n context.moveTo(p1.x, p1.y)\n context.lineTo(p2.x, p2.y)\n context.stroke()\n } finally {\n context.restore()\n }\n}\n\nfunction drawShapeLine (context, shapeLine) {\n drawLine(context, shapeLine.firstPoint, shapeLine.lastPoint)\n if (shapeLine.beginDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, shapeLine.firstPoint, shapeLine.beginTangentAngle, 12.0)\n }\n if (shapeLine.endDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, shapeLine.lastPoint, shapeLine.endTangentAngle, 12.0)\n }\n}\n\n/**\n * Draw a shape symbol\n * @param {Object} context Current rendering context\n * @param {Object} symbol Symbol to draw\n */\nexport function drawShapeSymbol (context, symbol) {\n logger.debug(`draw ${symbol.type} symbol`)\n const contextReference = context\n contextReference.save()\n try {\n contextReference.lineWidth = symbol.width\n contextReference.strokeStyle = symbol.color\n\n if (symbol.elementType) {\n switch (symbol.elementType) {\n case ShapeSymbols.shape:\n drawShapeSymbol(contextReference, symbol.candidates[symbol.selectedCandidateIndex])\n break\n case ShapeSymbols.table:\n symbol.lines.forEach(line => drawShapeSymbol(contextReference, line))\n break\n case ShapeSymbols.line:\n drawLine(contextReference, symbol.data.p1, symbol.data.p2)\n break\n default:\n logger.error(`${symbol.elementType} not implemented`)\n break\n }\n } else {\n switch (symbol.type) {\n case ShapeSymbols.ellipse:\n drawShapeEllipse(contextReference, symbol)\n break\n case ShapeSymbols.line:\n drawShapeLine(contextReference, symbol)\n break\n case ShapeSymbols.recognizedShape:\n symbol.primitives.forEach(primitive => drawShapeSymbol(contextReference, primitive))\n break\n default:\n logger.error(`${symbol.type} not implemented`)\n break\n }\n }\n } finally {\n contextReference.restore()\n }\n}\n","import { rendererLogger as logger } from '../../../configuration/LoggerConfig'\nimport { drawLine } from './ShapeSymbolCanvasRenderer'\n\n/**\n * @type {{inputCharacter: String, char: String, string: String, textLine: String}}\n */\nexport const TextSymbols = {\n inputCharacter: 'inputCharacter',\n char: 'char',\n string: 'string',\n textLine: 'textLine'\n}\n\nfunction drawUnderline (context, underline, label, data) {\n const delta = data.width / label.length\n const p1 = {\n x: data.topLeftPoint.x + (underline.data.firstCharacter * delta),\n y: data.topLeftPoint.y + data.height\n }\n const p2 = {\n x: data.topLeftPoint.x + (underline.data.lastCharacter * delta),\n y: data.topLeftPoint.y + data.height\n }\n drawLine(context, p1, p2)\n}\n\nfunction drawText (context, label, data) {\n const contextReference = context\n contextReference.save()\n try {\n contextReference.font = `${data.textHeight}px serif`\n contextReference.textAlign = (data.justificationType === 'CENTER') ? 'center' : 'left'\n contextReference.textBaseline = 'bottom'\n contextReference.fillStyle = contextReference.strokeStyle\n contextReference.fillText(label, data.topLeftPoint.x, (data.topLeftPoint.y + data.height))\n } finally {\n contextReference.restore()\n }\n}\n\nfunction drawTextLine (context, textLine) {\n drawText(context, textLine.label, textLine.data)\n textLine.underlineList.forEach((underline) => {\n drawUnderline(context, underline, textLine.label, textLine.data)\n })\n}\n\n/**\n * Draw a text symbol\n * @param {Object} context Current rendering context\n * @param {Object} symbol Symbol to draw\n */\nexport function drawTextSymbol (context, symbol) {\n logger.debug(`draw ${symbol.type} symbol`)\n const contextReference = context\n contextReference.save()\n try {\n contextReference.lineWidth = symbol.width\n contextReference.strokeStyle = symbol.color\n\n if (symbol.elementType) {\n switch (symbol.elementType) {\n case TextSymbols.textLine:\n drawTextLine(contextReference, symbol)\n break\n default:\n logger.error(`${symbol.elementType} not implemented`)\n break\n }\n } else {\n switch (symbol.type) {\n case TextSymbols.textLine:\n drawTextLine(contextReference, symbol)\n break\n default:\n logger.error(`${symbol.type} not implemented`)\n }\n }\n } finally {\n contextReference.restore()\n }\n}\n","import { modelLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Stroke symbol\n * @typedef {Object} Stroke\n * @property {String} type=stroke Symbol type, 'stroke' for stroke\n * @property {String} pointerType=undefined Pointer type\n * @property {Number} pointerId=undefined Pointer id\n * @property {Array} x=[] X coordinates\n * @property {Array} y=[] Y coordinates\n * @property {Array} t=[] Timestamps matching x,y coordinates\n * @property {Array} p=[] Pressure\n * @property {Array} l=[] Length from origin\n * @property {Number} width=0 (for rendering) Pen/brush width\n * @property {String} color=undefined (for rendering) Pen/brush color\n */\n\n/**\n * pointerEvents symbol\n * @typedef {Object} pointerEvents\n * @property {String} type=pointerEvents Symbol type, 'pointerEvents' for pointerEvents\n * @property {Boolean} processGestures=False indicates if the gestures have to be processed\n * @property {Array} events=[] the events to process\n */\n\nfunction computeDistance (x, y, xArray, yArray, lastIndexPoint) {\n const distance = Math.sqrt(Math.pow((y - yArray[lastIndexPoint - 1]), 2) + Math.pow((x - xArray[lastIndexPoint - 1]), 2))\n return isNaN(distance) ? 0 : distance\n}\n\nfunction computeLength (x, y, xArray, yArray, lArray, lastIndexPoint) {\n const length = lArray[lastIndexPoint - 1] + computeDistance(x, y, xArray, yArray, lastIndexPoint)\n return isNaN(length) ? 0 : length\n}\n\nfunction computePressure (x, y, xArray, yArray, lArray, lastIndexPoint) {\n let ratio = 1.0\n const distance = computeDistance(x, y, xArray, yArray, lastIndexPoint)\n const length = computeLength(x, y, xArray, yArray, lArray, lastIndexPoint)\n\n if (length === 0) {\n ratio = 0.5\n } else if (distance === length) {\n ratio = 1.0\n } else if (distance < 10) {\n ratio = 0.2 + Math.pow(0.1 * distance, 0.4)\n } else if (distance > length - 10) {\n ratio = 0.2 + Math.pow(0.1 * (length - distance), 0.4)\n }\n const pressure = ratio * Math.max(0.1, 1.0 - (0.1 * Math.sqrt(distance)))\n return isNaN(parseFloat(pressure)) ? 0.5 : pressure\n}\n\nfunction filterPointByAcquisitionDelta (x, y, xArray, yArray, width) {\n const delta = (2 + (width / 4))\n let ret = false\n if (xArray.length === 0 || yArray.length === 0 || Math.abs(xArray[xArray.length - 1] - x) >= delta || Math.abs(yArray[yArray.length - 1] - y) >= delta) {\n ret = true\n }\n return ret\n}\n\n/**\n * Create a new stroke\n * @param {Object} properties Properties to be applied to the stroke.\n * @return {Stroke} New stroke with properties for quadratics draw\n */\nexport function createStrokeComponent (properties) {\n const defaultStroke = {\n type: 'stroke',\n x: [],\n y: [],\n t: [],\n p: [],\n l: [],\n width: 0\n }\n return Object.assign({}, defaultStroke, properties)\n}\n\n/**\n * Get a JSON copy of a stroke by filtering its properties\n * @param {Stroke} stroke Current stroke\n * @return {{x: Array, y: Array, t: Array}} Simplified stroke object\n */\nexport function toJSON (stroke) {\n return { x: stroke.x, y: stroke.y, t: stroke.t, pointerType: stroke.pointerType }\n}\n\n/**\n * Mutate a stroke by adding a point to it.\n * @param {Stroke} stroke Current stroke\n * @param {{x: Number, y: Number, t: Number}} point Point to add\n * @return {Stroke} Updated stroke\n */\nexport function addPoint (stroke, point) {\n const strokeReference = stroke\n if (filterPointByAcquisitionDelta(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.width)) {\n strokeReference.x.push(point.x)\n strokeReference.y.push(point.y)\n strokeReference.t.push(point.t)\n strokeReference.p.push(computePressure(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.l, strokeReference.x.length - 1))\n strokeReference.l.push(computeLength(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.l, strokeReference.x.length - 1))\n } else {\n logger.trace('ignore filtered point', point)\n }\n return strokeReference\n}\n\n/**\n * Slice a stroke and return the sliced part of it\n * @param {Stroke} stroke Current stroke\n * @param {Number} [start=0] Zero-based index at which to begin extraction\n * @param {Number} [end=length] Zero-based index at which to end extraction\n * @return {Stroke} Sliced stroke\n */\nexport function slice (stroke, start = 0, end = stroke.x.length) {\n const slicedStroke = createStrokeComponent({ color: stroke.color, width: stroke.width })\n for (let i = start; i < end; i++) {\n addPoint(slicedStroke, {\n x: stroke.x[i],\n y: stroke.y[i],\n t: stroke.t[i]\n })\n }\n return slicedStroke\n}\n\n/**\n * Extract point by index\n * @param {Stroke} stroke Current stroke\n * @param {Number} index Zero-based index\n * @return {{x: Number, y: Number, t: Number, p: Number, l: Number}} Point with properties for quadratics draw\n */\nexport function getPointByIndex (stroke, index) {\n let point\n if (index !== undefined && index >= 0 && index < stroke.x.length) {\n point = {\n x: stroke.x[index],\n y: stroke.y[index],\n t: stroke.t[index],\n p: stroke.p[index],\n l: stroke.l[index]\n }\n }\n return point\n}\n","function mergeBounds (boundsA, boundsB) {\n return {\n minX: Math.min(boundsA.minX, boundsB.minX),\n maxX: Math.max(boundsA.maxX, boundsB.maxX),\n minY: Math.min(boundsA.minY, boundsB.minY),\n maxY: Math.max(boundsA.maxY, boundsB.maxY)\n }\n}\n\nfunction getLineBounds (line) {\n return {\n minX: Math.min(line.firstPoint.x, line.lastPoint.x),\n maxX: Math.max(line.firstPoint.x, line.lastPoint.x),\n minY: Math.min(line.firstPoint.y, line.lastPoint.y),\n maxY: Math.max(line.firstPoint.y, line.lastPoint.y)\n }\n}\n\nfunction getEllipseBounds (ellipse) {\n const angleStep = 0.02 // angle delta between interpolated points on the arc, in radian\n\n let z1 = Math.cos(ellipse.orientation)\n let z3 = Math.sin(ellipse.orientation)\n let z2 = z1\n let z4 = z3\n z1 *= ellipse.maxRadius\n z2 *= ellipse.minRadius\n z3 *= ellipse.maxRadius\n z4 *= ellipse.minRadius\n\n const n = Math.abs(ellipse.sweepAngle) / angleStep\n\n const x = []\n const y = []\n\n for (let i = 0; i <= n; i++) {\n const angle = ellipse.startAngle + ((i / n) * ellipse.sweepAngle)\n const alpha = Math.atan2(Math.sin(angle) / ellipse.minRadius, Math.cos(angle) / ellipse.maxRadius)\n\n const cosAlpha = Math.cos(alpha)\n const sinAlpha = Math.sin(alpha)\n\n x.push(ellipse.center.x + ((z1 * cosAlpha) - (z4 * sinAlpha)))\n y.push(ellipse.center.y + ((z2 * sinAlpha) + (z3 * cosAlpha)))\n }\n\n return {\n minX: Math.min(...x),\n maxX: Math.max(...x),\n minY: Math.min(...y),\n maxY: Math.max(...y)\n }\n}\n\nfunction getTextLineBounds (textLine) {\n return {\n minX: textLine.data.topLeftPoint.x,\n maxX: textLine.data.topLeftPoint.x + textLine.data.width,\n minY: textLine.data.topLeftPoint.y,\n maxY: textLine.data.topLeftPoint.y + textLine.data.height\n }\n}\n\nfunction getClefBounds (clef) {\n return {\n minX: clef.boundingBox.x,\n maxX: clef.boundingBox.x + clef.boundingBox.width,\n minY: clef.boundingBox.y,\n maxY: clef.boundingBox.y + clef.boundingBox.height\n }\n}\n\nfunction getStrokeBounds (stroke) {\n return {\n minX: Math.min(...stroke.x),\n maxX: Math.max(...stroke.x),\n minY: Math.min(...stroke.y),\n maxY: Math.max(...stroke.y)\n }\n}\n\n/**\n * Get the box enclosing the given symbols\n * @param {Array} symbols Symbols to extract bounds from\n * @param {Bounds} [bounds] Starting bounds for recursion\n * @return {Bounds} Bounding box enclosing symbols\n */\nexport function getSymbolsBounds (symbols, bounds = { minX: Number.MAX_VALUE, maxX: Number.MIN_VALUE, minY: Number.MAX_VALUE, maxY: Number.MIN_VALUE }) {\n let boundsRef = bounds\n boundsRef = symbols\n .filter(symbol => symbol.type === 'stroke')\n .map(getStrokeBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'clef')\n .map(getClefBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'line')\n .map(getLineBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'ellipse')\n .map(getEllipseBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'textLine')\n .map(getTextLineBounds)\n .reduce(mergeBounds, boundsRef)\n return boundsRef\n}\n","import { modelLogger as logger } from '../configuration/LoggerConfig'\nimport * as StrokeComponent from './StrokeComponent'\nimport { getSymbolsBounds } from './Symbol'\n\n/**\n * Recognition positions\n * @typedef {Object} RecognitionPositions\n * @property {Number} [lastSentPosition=-1] Index of the last sent stroke.\n * @property {Number} [lastReceivedPosition=-1] Index of the last received stroke.\n * @property {Number} [lastRenderedPosition=-1] Last rendered recognized symbol position\n */\n\n/**\n * Raw results\n * @typedef {Object} RawResults\n * @property {Object} convert=undefined The convert result\n * @property {Object} exports=undefined The exports output as return by the recognition service.\n */\n\n/**\n * Editor model\n * @typedef {Object} Model\n * @property {Stroke} currentStroke=undefined Stroke in building process.\n * @property {Array} rawStrokes=[] List of captured strokes.\n * @property {Array} strokeGroups=[] Group of strokes with same pen style.\n * @property {RecognitionPositions} lastPositions Last recognition sent/received stroke indexes.\n * @property {Array} defaultSymbols=[] Default symbols, relative to the current recognition type.\n * @property {Array} recognizedSymbols=undefined Symbols to render (e.g. stroke, shape primitives, string, characters...).\n * @property {Object} exports=undefined Result of the export (e.g. mathml, latex, text...).\n * @property {RawResults} rawResults The recognition output as return by the recognition service.\n * @property {Number} creationTime Date of creation timestamp.\n * @property {Number} modificationTime=undefined Date of lastModification.\n */\n\n/**\n * Bounding box\n * @typedef {Object} Bounds\n * @property {Number} minX Minimal x coordinate\n * @property {Number} maxX Maximal x coordinate\n * @property {Number} minY Minimal y coordinate\n * @property {Number} maxY Maximal y coordinate\n */\n\n/**\n * Create a new model\n * @param {Configuration} [configuration] Parameters to use to populate default recognition symbols\n * @return {Model} New model\n */\nexport function createModel (configuration) {\n // see @typedef documentation on top\n return {\n currentStroke: undefined,\n rawStrokes: [],\n strokeGroups: [],\n lastPositions: {\n lastSentPosition: -1,\n lastReceivedPosition: -1,\n lastRenderedPosition: -1\n },\n defaultSymbols: [],\n recognizedSymbols: undefined,\n exports: undefined,\n rawResults: {\n convert: undefined,\n exports: undefined\n },\n creationTime: new Date().getTime(),\n modificationTime: undefined\n }\n}\n\n/**\n * Clear the model.\n * @param {Model} model Current model\n * @return {Model} Cleared model\n */\nexport function clearModel (model) {\n const modelReference = model\n modelReference.currentStroke = undefined\n modelReference.rawStrokes = []\n modelReference.strokeGroups = []\n modelReference.lastPositions.lastSentPosition = -1\n modelReference.lastPositions.lastReceivedPosition = -1\n modelReference.lastPositions.lastRenderedPosition = -1\n modelReference.recognizedSymbols = undefined\n modelReference.exports = undefined\n modelReference.rawResults.convert = undefined\n modelReference.rawResults.exports = undefined\n return modelReference\n}\n\n/**\n * Check if the model needs to be redrawn.\n * @param {Model} model Current model\n * @return {Boolean} True if the model needs to be redrawn, false otherwise\n */\nexport function needRedraw (model) {\n return model.recognizedSymbols ? (model.rawStrokes.length !== model.recognizedSymbols.filter(symbol => symbol.type === 'stroke').length) : false\n}\n\n/**\n * Mutate the model given in parameter by adding the new strokeToAdd.\n * @param {Model} model Current model\n * @param {Stroke} stroke Stroke to be added to pending ones\n * @return {Model} Updated model\n */\nexport function addStroke (model, stroke) {\n // We use a reference to the model. The purpose here is to update the pending stroke only.\n const modelReference = model\n logger.debug('addStroke', stroke)\n modelReference.rawStrokes.push(stroke)\n return modelReference\n}\n\n/**\n * Mutate the model given in parameter by adding the new strokeToAdd and the penstyle. Used for iink REST.\n * @param {Model} model Current model\n * @param {Stroke} stroke Stroke to be added to pending ones\n * @param {PenStyle} strokePenStyle\n * @return {Model} Updated model\n */\nexport function addStrokeToGroup (model, stroke, strokePenStyle) {\n // We use a reference to the model. The purpose here is to update the pending stroke only.\n const modelReference = model\n logger.debug('addStroke', stroke)\n const lastGroup = modelReference.strokeGroups.length - 1\n if (modelReference.strokeGroups[lastGroup] && modelReference.strokeGroups[lastGroup].penStyle === strokePenStyle) {\n modelReference.strokeGroups[lastGroup].strokes.push(stroke)\n } else {\n const newStrokeGroup = {\n penStyle: strokePenStyle,\n strokes: []\n }\n const strokeCopy = {}\n Object.assign(strokeCopy, stroke)\n newStrokeGroup.strokes.push(strokeCopy)\n modelReference.strokeGroups.push(newStrokeGroup)\n }\n return modelReference\n}\n\n/**\n * Get the strokes that needs to be recognized\n * @param {Model} model Current model\n * @param {Number} [position=lastReceived] Index from where to extract strokes\n * @return {Array} Pending strokes\n */\nexport function extractPendingStrokes (model, position = model.lastPositions.lastReceivedPosition + 1) {\n return model.rawStrokes.slice(position)\n}\n\n/**\n * Mutate the model by adding a point and close the current stroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to create current stroke\n * @param {Object} properties Properties to be applied to the current stroke\n * @param {Number} [dpi=96] The screen dpi resolution\n * @return {Model} Updated model\n */\nexport function initPendingStroke (model, point, properties, dpi = 96) {\n if (properties && properties['-myscript-pen-width']) {\n const pxWidth = (properties['-myscript-pen-width'] * dpi) / 25.4\n Object.assign(properties, { width: pxWidth / 2 }) // FIXME hack to get better render\n }\n const modelReference = model\n logger.trace('initPendingStroke', point)\n // Setting the current stroke to an empty one\n modelReference.currentStroke = StrokeComponent.createStrokeComponent(properties)\n modelReference.currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n return modelReference\n}\n\n/**\n * Mutate the model by adding a point to the current pending stroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to be append to the current stroke\n * @return {Model} Updated model\n */\nexport function appendToPendingStroke (model, point) {\n const modelReference = model\n if (modelReference.currentStroke) {\n logger.trace('appendToPendingStroke', point)\n modelReference.currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n }\n return modelReference\n}\n\n/**\n * Mutate the model by adding the new point on a initPendingStroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to be append to the current stroke\n * @param {PenStyle} penStyle\n * @return {Model} Updated model\n */\nexport function endPendingStroke (model, point, penStyle) {\n const modelReference = model\n if (modelReference.currentStroke) {\n logger.trace('endPendingStroke', point)\n const currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n // Mutating pending strokes\n addStroke(modelReference, currentStroke)\n addStrokeToGroup(modelReference, currentStroke, penStyle)\n // Resetting the current stroke to an undefined one\n delete modelReference.currentStroke\n }\n return modelReference\n}\n\n/**\n * Get the bounds of the current model.\n * @param {Model} model Current model\n * @return {Bounds} Bounding box enclosing the current drawn model\n */\nexport function getBorderCoordinates (model) {\n let modelBounds = { minX: Number.MAX_VALUE, maxX: Number.MIN_VALUE, minY: Number.MAX_VALUE, maxY: Number.MIN_VALUE }\n\n // Default symbols\n if (model.defaultSymbols && model.defaultSymbols.length > 0) {\n modelBounds = getSymbolsBounds(model.defaultSymbols, modelBounds)\n }\n // Recognized symbols\n if (model.recognizedSymbols && model.recognizedSymbols.length > 0) {\n modelBounds = getSymbolsBounds(model.recognizedSymbols, modelBounds)\n // Pending strokes\n modelBounds = getSymbolsBounds(extractPendingStrokes(model), modelBounds)\n } else {\n modelBounds = getSymbolsBounds(model.rawStrokes, modelBounds)\n }\n return modelBounds\n}\n\n/**\n * Extract strokes from an ink range\n * @param {Model} model Current model\n * @param {Number} firstStroke First stroke index to extract\n * @param {Number} lastStroke Last stroke index to extract\n * @param {Number} firstPoint First point index to extract\n * @param {Number} lastPoint Last point index to extract\n * @return {Array} The extracted strokes\n */\nexport function extractStrokesFromInkRange (model, firstStroke, lastStroke, firstPoint, lastPoint) {\n return model.rawStrokes.slice(firstStroke, lastStroke + 1).map((stroke, index, slicedStrokes) => {\n if (slicedStrokes.length < 2) {\n return StrokeComponent.slice(stroke, firstPoint, lastPoint + 1)\n }\n if (index === 0) {\n return StrokeComponent.slice(stroke, firstPoint)\n }\n if (index === (slicedStrokes.length - 1)) {\n return StrokeComponent.slice(stroke, 0, lastPoint + 1)\n }\n return stroke\n })\n}\n\n/**\n * Update model lastSentPosition\n * @param {Model} model\n * @param {Number} [position]\n * @return {Model}\n */\nexport function updateModelSentPosition (model, position = model.rawStrokes.length - 1) {\n const modelReference = model\n modelReference.lastPositions.lastSentPosition = position\n return modelReference\n}\n\n/**\n * Update model lastReceivedPosition regarding to lastSentPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function updateModelReceivedPosition (model) {\n const modelReference = model\n modelReference.lastPositions.lastReceivedPosition = modelReference.lastPositions.lastSentPosition\n return modelReference\n}\n\n/**\n * Reset model lastReceivedPosition and lastSentPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function resetModelPositions (model) {\n const modelReference = model\n modelReference.lastPositions.lastSentPosition = -1\n modelReference.lastPositions.lastReceivedPosition = -1\n return modelReference\n}\n\n/**\n * Reset model lastRenderedPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function resetModelRendererPosition (model) {\n const modelReference = model\n modelReference.lastPositions.lastRenderedPosition = -1\n return modelReference\n}\n\n/**\n * Update model lastRenderedPosition\n * @param {Model} model\n * @param {Number} [position]\n * @return {Model}\n */\nexport function updateModelRenderedPosition (model, position = model.recognizedSymbols ? model.recognizedSymbols.length - 1 : -1) {\n const modelReference = model\n modelReference.lastPositions.lastRenderedPosition = position\n return modelReference\n}\n\n/**\n * Get the symbols that needs to be rendered\n * @param {Model} model Current model\n * @param {Number} [position=lastRendered] Index from where to extract symbols\n * @return {Array}\n */\nexport function extractPendingRecognizedSymbols (model, position = model.lastPositions.lastRenderedPosition + 1) {\n return model.recognizedSymbols ? model.recognizedSymbols.slice(position) : []\n}\n\n/**\n * Clone model\n * @param {Model} model Current model\n * @return {Model} Clone of the current model\n */\nexport function cloneModel (model) {\n const clonedModel = Object.assign({}, model)\n // We clone the properties that need to be. Take care of arrays.\n clonedModel.defaultSymbols = [...model.defaultSymbols]\n clonedModel.currentStroke = model.currentStroke ? Object.assign({}, model.currentStroke) : undefined\n clonedModel.rawStrokes = [...model.rawStrokes]\n clonedModel.strokeGroups = JSON.parse(JSON.stringify(model.strokeGroups))\n clonedModel.lastPositions = Object.assign({}, model.lastPositions)\n clonedModel.exports = model.exports ? Object.assign({}, model.exports) : undefined\n clonedModel.rawResults = Object.assign({}, model.rawResults)\n clonedModel.recognizedSymbols = model.recognizedSymbols ? [...model.recognizedSymbols] : undefined\n return clonedModel\n}\n\n/**\n * Merge models\n * @param {...Model} models Models to merge (ordered)\n * @return {Model} Updated model\n */\nexport function mergeModels (...models) {\n return models.reduce((a, b) => {\n const modelRef = a\n modelRef.recognizedSymbols = b.recognizedSymbols\n modelRef.lastPositions.lastSentPosition = b.lastPositions.lastSentPosition\n modelRef.lastPositions.lastReceivedPosition = b.lastPositions.lastReceivedPosition\n modelRef.lastPositions.lastRenderedPosition = b.lastPositions.lastRenderedPosition\n modelRef.rawResults = b.rawResults\n modelRef.exports = b.exports\n return modelRef\n })\n}\n","import { rendererLogger as logger } from '../../configuration/LoggerConfig'\nimport { drawStroke } from './symbols/StrokeSymbolCanvasRenderer'\nimport { drawTextSymbol, TextSymbols } from './symbols/TextSymbolCanvasRenderer'\nimport { drawShapeSymbol, ShapeSymbols } from './symbols/ShapeSymbolCanvasRenderer'\nimport * as InkModel from '../../model/InkModel'\n\n/**\n * Renderer info\n * @typedef {Object} RendererInfo\n * @property {String} type Renderer type.\n * @property {String} apiVersion Supported api version.\n */\n\n/**\n * Default renderer\n * @typedef {Object} Renderer\n * @property {function} getInfo Get some information about this renderer\n * @property {function} attach Populate the DOM element to create rendering area.\n * @property {function} detach Remove rendering area from the DOM element.\n * @property {function} resize Explicitly resize the rendering area.\n * @property {function} drawCurrentStroke Draw the model currentStroke.\n * @property {function} drawModel Draw the model defaultSymbols and recognizedSymbols.\n */\n\n/**\n * Get info\n * @return {RendererInfo} Information about this renderer\n */\nexport function getInfo () {\n return {\n type: 'canvas'\n }\n}\n\nfunction getPixelRatio (canvas) {\n if (canvas) {\n const context = canvas.getContext('2d')\n // we are using a browser object\n // eslint-disable-next-line no-undef\n const devicePixelRatio = window.devicePixelRatio || 1\n const backingStoreRatio = context.webkitBackingStorePixelRatio ||\n context.mozBackingStorePixelRatio ||\n context.msBackingStorePixelRatio ||\n context.oBackingStorePixelRatio ||\n context.backingStorePixelRatio || 1\n return devicePixelRatio / backingStoreRatio\n }\n return 1\n}\n\nfunction detectPixelRatio (element) {\n // we are using a browser object\n // eslint-disable-next-line no-undef\n const tempCanvas = document.createElement('canvas')\n const canvasRatio = getPixelRatio(tempCanvas)\n // document.removeChild(tempCanvas);\n return canvasRatio\n}\n\nfunction createCanvas (element, type) {\n // eslint-disable-next-line no-undef\n const browserDocument = document\n const canvas = browserDocument.createElement('canvas')\n canvas.classList.add(type)\n canvas.classList.add('ms-canvas')\n element.appendChild(canvas)\n logger.debug('canvas created', canvas)\n return canvas\n}\n\nfunction resizeContent (context) {\n const elements = [context.renderingCanvas, context.capturingCanvas]\n elements.forEach((canvas) => {\n const domElement = canvas.parentNode\n const width = domElement.clientWidth < context.minWidth ? context.minWidth : domElement.clientWidth\n const height = domElement.clientHeight < context.minHeight ? context.minHeight : domElement.clientHeight\n /* eslint-disable no-param-reassign */\n canvas.width = width * context.pixelRatio\n canvas.height = height * context.pixelRatio\n canvas.style.width = `${width}px`\n canvas.style.height = `${height}px`\n /* eslint-enable no-param-reassign */\n canvas.getContext('2d').scale(context.pixelRatio, context.pixelRatio)\n logger.debug('canvas size changed', canvas)\n })\n return context\n}\n\n/**\n * Attach the renderer to the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Number} [minHeight=0] Minimal height of the editor\n * @param {Number} [minWidth=0] Minimal width of the editor\n * @return {Object} The renderer context to give as parameter when a draw model will be call\n */\nexport function attach (element, minHeight = 0, minWidth = 0) {\n logger.debug('attach renderer', element)\n const pixelRatio = detectPixelRatio(element)\n\n const renderingCanvas = createCanvas(element, 'ms-rendering-canvas')\n const capturingCanvas = createCanvas(element, 'ms-capture-canvas')\n\n const context = {\n pixelRatio,\n minHeight,\n minWidth,\n renderingCanvas,\n renderingCanvasContext: renderingCanvas.getContext('2d'),\n capturingCanvas,\n capturingCanvasContext: capturingCanvas.getContext('2d')\n }\n\n return resizeContent(context)\n}\n\n/**\n * Detach the renderer from the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Object} context Current rendering context\n */\nexport function detach (element, context) {\n logger.debug('detach renderer', element)\n element.removeChild(context.renderingCanvas)\n element.removeChild(context.capturingCanvas)\n}\n\n/**\n * Update the rendering context size\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function resize (context, model, stroker) {\n return this.drawModel(resizeContent(context), model, stroker)\n}\n\nfunction drawSymbol (context, symbol, stroker) {\n const type = symbol.elementType ? symbol.elementType : symbol.type\n logger.trace(`attempting to draw ${type} symbol`)\n if (type === 'stroke') {\n drawStroke(context, symbol, stroker)\n } else if (TextSymbols[type]) {\n drawTextSymbol(context, symbol)\n } else if (ShapeSymbols[type]) {\n drawShapeSymbol(context, symbol)\n } else {\n logger.warn(`impossible to draw ${type} symbol`)\n }\n}\n\n/**\n * Draw the current stroke from the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawCurrentStroke (context, model, stroker) {\n // Render the current stroke\n context.capturingCanvasContext.clearRect(0, 0, context.capturingCanvas.width, context.capturingCanvas.height)\n logger.trace('drawing current stroke ', model.currentStroke)\n drawStroke(context.capturingCanvasContext, model.currentStroke, stroker)\n return model\n}\n\n/**\n * Draw all symbols contained into the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawModel (context, model, stroker) {\n context.renderingCanvasContext.clearRect(0, 0, context.renderingCanvas.width, context.renderingCanvas.height)\n // Displaying the default symbols and pending strokes\n const symbols = [...model.defaultSymbols]\n // Displaying the recognition symbols or raw strokes\n if (model.recognizedSymbols) {\n symbols.push(...model.recognizedSymbols)\n symbols.push(...InkModel.extractPendingStrokes(model))\n } else {\n symbols.push(...model.rawStrokes)\n }\n symbols.forEach(symbol => drawSymbol(context.renderingCanvasContext, symbol, stroker))\n context.capturingCanvasContext.clearRect(0, 0, context.capturingCanvas.width, context.capturingCanvas.height)\n return model\n}\n","/** ===============================================================================================\n * Compute quadratics control points\n * ============================================================================================= */\n\n/**\n *\n * @param {{x: Number, y: Number, p: Number}} point\n * @param angle\n * @param width\n * @return {({x: number, y: *}|{x: *, y: number})}\n */\nexport function computeLinksPoints (point, angle, width) {\n const radius = point.p * width\n return [{\n x: (point.x - (Math.sin(angle) * radius)),\n y: (point.y + (Math.cos(angle) * radius))\n }, {\n x: (point.x + (Math.sin(angle) * radius)),\n y: (point.y - (Math.cos(angle) * radius))\n }]\n}\n\n/**\n *\n * @param {{x: Number, y: Number, p: Number}} point1\n * @param {{x: Number, y: Number, p: Number}} point2\n * @return {{x: Number, y: Number, p: Number}}\n */\nexport function computeMiddlePoint (point1, point2) {\n return {\n x: ((point2.x + point1.x) / 2),\n y: ((point2.y + point1.y) / 2),\n p: ((point2.p + point1.p) / 2)\n }\n}\n\n/**\n *\n * @param {{x: Number, y: Number}} begin\n * @param {{x: Number, y: Number}} end\n * @return {Number}\n */\nexport function computeAxeAngle (begin, end) {\n return Math.atan2(end.y - begin.y, end.x - begin.x)\n}\n","import * as StrokeComponent from '../../../model/StrokeComponent'\nimport { computeLinksPoints, computeMiddlePoint, computeAxeAngle } from '../../QuadraticUtils'\n\n/**\n * Stroker info\n * @typedef {Object} StrokerInfo\n * @property {String} type Renderer type.\n * @property {String} name Stroker name.\n * @property {String} apiVersion Supported api version.\n */\n\n/**\n * Define how a stroke should be drawn\n * @typedef {Object} Stroker\n * @property {function} getInfo Get some information about this stroker\n * @property {function} drawStroke Render a stroke on the current context.\n */\n\n/**\n * Get info\n * @return {StrokerInfo} Information about this stroker\n */\nexport function getInfo () {\n return {\n type: 'canvas',\n name: 'quadratic'\n }\n}\n\nfunction renderArc (context, center, radius) {\n context.arc(center.x, center.y, radius, 0, Math.PI * 2, true)\n}\n\nfunction renderLine (context, begin, end, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, end), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(begin, end), width)\n\n context.moveTo(linkPoints1[0].x, linkPoints1[0].y)\n context.lineTo(linkPoints2[0].x, linkPoints2[0].y)\n context.lineTo(linkPoints2[1].x, linkPoints2[1].y)\n context.lineTo(linkPoints1[1].x, linkPoints1[1].y)\n}\n\nfunction renderFinal (context, begin, end, width) {\n const ARCSPLIT = 6\n const angle = computeAxeAngle(begin, end)\n const linkPoints = computeLinksPoints(end, angle, width)\n context.moveTo(linkPoints[0].x, linkPoints[0].y)\n for (let i = 1; i <= ARCSPLIT; i++) {\n const newAngle = angle - ((i * Math.PI) / ARCSPLIT)\n context.lineTo(end.x - ((end.p * width) * Math.sin(newAngle)), end.y + (end.p * width * Math.cos(newAngle)))\n }\n}\n\nfunction renderQuadratic (context, begin, end, ctrl, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, ctrl), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(ctrl, end), width)\n const linkPoints3 = computeLinksPoints(ctrl, computeAxeAngle(begin, end), width)\n\n context.moveTo(linkPoints1[0].x, linkPoints1[0].y)\n context.quadraticCurveTo(linkPoints3[0].x, linkPoints3[0].y, linkPoints2[0].x, linkPoints2[0].y)\n context.lineTo(linkPoints2[1].x, linkPoints2[1].y)\n context.quadraticCurveTo(linkPoints3[1].x, linkPoints3[1].y, linkPoints1[1].x, linkPoints1[1].y)\n}\n\n/**\n * Draw a stroke on a canvas, using quadratics\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Current stroke to be drawn\n */\nexport function drawStroke (context, stroke) {\n const contextReference = context\n const length = stroke.x.length\n const width = stroke.width > 0 ? stroke.width : contextReference.lineWidth\n const color = stroke.color ? stroke.color : contextReference.strokeStyle\n const firstPoint = StrokeComponent.getPointByIndex(stroke, 0)\n const nbquadratics = length - 2\n\n contextReference.save()\n try {\n contextReference.beginPath()\n if (length < 3) {\n renderArc(contextReference, firstPoint, width * 0.6)\n } else {\n renderArc(contextReference, firstPoint, width * firstPoint.p)\n renderLine(contextReference, firstPoint, computeMiddlePoint(firstPoint, StrokeComponent.getPointByIndex(stroke, 1)), width)\n\n // Possibility to try this (the start looks better when the ink is large)\n // var first = computeMiddlePoint(stroke[0], stroke[1]);\n // contextReference.arc(first.x, first.y, width * first.p, 0, Math.PI * 2, true);\n\n for (let i = 0; i < nbquadratics; i++) {\n renderQuadratic(contextReference, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i), StrokeComponent.getPointByIndex(stroke, i + 1)), computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i + 1), StrokeComponent.getPointByIndex(stroke, i + 2)), StrokeComponent.getPointByIndex(stroke, i + 1), width)\n }\n renderLine(contextReference, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1)), StrokeComponent.getPointByIndex(stroke, length - 1), width)\n renderFinal(contextReference, StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1), width)\n }\n contextReference.closePath()\n if (color !== undefined) {\n contextReference.fillStyle = color\n contextReference.fill()\n }\n } finally {\n contextReference.restore()\n }\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;\n}\n","import namespace from \"./namespace\";\nimport {xhtml} from \"./namespaces\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse\";\nimport {Selection} from \"./index\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index\";\nimport {EnterNode} from \"./enter\";\nimport constant from \"../constant\";\n\nvar keyPrefix = \"$\"; // Protect against keys like “__proto__”.\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = {},\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);\n if (keyValue in nodeByKeyValue) {\n exit[i] = node;\n } else {\n nodeByKeyValue[keyValue] = node;\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = keyPrefix + key.call(parent, data[i], i, data);\n if (node = nodeByKeyValue[keyValue]) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue[keyValue] = null;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {\n exit[i] = node;\n }\n }\n}\n\nexport default function(value, key) {\n if (!value) {\n data = new Array(this.size()), j = -1;\n this.each(function(d) { data[++j] = d; });\n return data;\n }\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = value.call(parent, parent && parent.__data__, j, parents),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n","import {Selection} from \"./index\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import namespace from \"../namespace\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import creator from \"../creator\";\nimport selector from \"../selector\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","var filterEvents = {};\n\nexport var event = null;\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!(\"onmouseenter\" in element)) {\n filterEvents = {mouseenter: \"mouseover\", mouseleave: \"mouseout\"};\n }\n}\n\nfunction filterContextListener(listener, index, group) {\n listener = contextListener(listener, index, group);\n return function(event) {\n var related = event.relatedTarget;\n if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {\n listener.call(this, event);\n }\n };\n}\n\nfunction contextListener(listener, index, group) {\n return function(event1) {\n var event0 = event; // Events can be reentrant (e.g., focus).\n event = event1;\n try {\n listener.call(this, this.__data__, index, group);\n } finally {\n event = event0;\n }\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, capture) {\n var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;\n return function(d, i, group) {\n var on = this.__on, o, listener = wrap(value, i, group);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n this.addEventListener(o.type, o.listener = listener, o.capture = capture);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, capture);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, capture) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n if (capture == null) capture = false;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));\n return this;\n}\n\nexport function customEvent(event1, listener, that, args) {\n var event0 = event;\n event1.sourceEvent = event;\n event = event1;\n try {\n return listener.apply(that, args);\n } finally {\n event = event0;\n }\n}\n","import defaultView from \"../window\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select\";\nimport selection_selectAll from \"./selectAll\";\nimport selection_filter from \"./filter\";\nimport selection_data from \"./data\";\nimport selection_enter from \"./enter\";\nimport selection_exit from \"./exit\";\nimport selection_join from \"./join\";\nimport selection_merge from \"./merge\";\nimport selection_order from \"./order\";\nimport selection_sort from \"./sort\";\nimport selection_call from \"./call\";\nimport selection_nodes from \"./nodes\";\nimport selection_node from \"./node\";\nimport selection_size from \"./size\";\nimport selection_empty from \"./empty\";\nimport selection_each from \"./each\";\nimport selection_attr from \"./attr\";\nimport selection_style from \"./style\";\nimport selection_property from \"./property\";\nimport selection_classed from \"./classed\";\nimport selection_text from \"./text\";\nimport selection_html from \"./html\";\nimport selection_raise from \"./raise\";\nimport selection_lower from \"./lower\";\nimport selection_append from \"./append\";\nimport selection_insert from \"./insert\";\nimport selection_remove from \"./remove\";\nimport selection_clone from \"./clone\";\nimport selection_datum from \"./datum\";\nimport selection_on from \"./on\";\nimport selection_dispatch from \"./dispatch\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch\n};\n\nexport default selection;\n","/**\n * Draw a stroke symbol\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Stroke to be drawn\n * @param {Stroker} stroker Stroker to use to render a stroke\n */\nexport function drawStroke (context, stroke, stroker) {\n if (stroker) {\n stroker.drawStroke(context, stroke)\n }\n}\n","import * as d3 from 'd3-selection'\nimport { rendererLogger as logger } from '../../configuration/LoggerConfig'\nimport { drawStroke } from './symbols/StrokeSymbolSVGRenderer'\nimport * as InkModel from '../../model/InkModel'\n\n/**\n * Get info\n * @return {RendererInfo} Information about this renderer\n */\nexport function getInfo () {\n return {\n type: 'svg'\n }\n}\n\n/**\n * Populate the dom element\n * @param {Element} element DOM element to attach the rendering elements\n * @return {Object} The renderer context to give as parameter when a draw model will be call\n */\nexport function attach (element) {\n const elementRef = element\n logger.debug('populate root element', elementRef)\n elementRef.style.fontSize = '10px'\n return d3.select(elementRef)\n}\n\n/**\n * Detach the renderer from the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Object} context Current rendering context\n */\nexport function detach (element, context) {\n logger.debug('detach renderer', element)\n context.select('svg').remove()\n}\n\n/**\n * Update the rendering context size\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @param {Number} minHeight Minimal height for resize\n * @param {Number} minWidth Minimal Width for resize\n * @return {Model}\n */\nexport function resize (context, model, stroker, minHeight, minWidth) {\n const rect = context.node().getBoundingClientRect()\n const svg = context.selectAll('svg')\n const width = rect.width < minWidth ? minWidth : rect.width\n const height = rect.height < minHeight ? minHeight : rect.height\n svg.attr('viewBox', `0 0 ${width}, ${height}`)\n svg.attr('width', `${width}px`)\n svg.attr('height', `${height}px`)\n logger.debug('svg viewBox changed', svg)\n return model\n}\n\n/**\n * Draw the current stroke from the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawCurrentStroke (context, model, stroker) {\n const modelRef = model\n // Add a pending id for pending strokes rendering\n modelRef.currentStroke.id = `pendingStroke-${model.rawStrokes.length}`\n // Render the current stroke\n logger.trace('drawing current stroke ', model.currentStroke)\n context.select(`#pendingStrokes #${modelRef.currentStroke.id}`).remove()\n drawStroke(context.select('#pendingStrokes').append('path').attr('id', model.currentStroke.id), model.currentStroke, stroker)\n return modelRef\n}\n\nfunction insertAdjacentSVG (element, position, html) {\n const container = element.ownerDocument.createElementNS('http://www.w3.org/2000/svg', '_')\n container.innerHTML = html\n\n switch (position.toLowerCase()) {\n case 'beforebegin':\n element.parentNode.insertBefore(container.firstChild, element)\n break\n case 'afterbegin':\n element.insertBefore(container.lastChild, element.firstChild)\n break\n case 'beforeend':\n element.appendChild(container.firstChild)\n break\n case 'afterend':\n element.parentNode.insertBefore(container.lastChild, element.nextSibling)\n break\n default:\n logger.warn('Invalid insertAdjacentHTML position')\n break\n }\n}\n\n/**\n * Draw all symbols contained into the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawModel (context, model, stroker) {\n const drawSymbol = (symbol, symbolContext) => {\n logger.trace(`attempting to draw ${symbol.type} symbol`)\n if (symbol.type === 'stroke' && !symbolContext.select('id', symbol.id)) {\n drawStroke(symbolContext.append('path').attr('id', symbol.id), symbol, stroker)\n } else {\n logger.warn(`impossible to draw ${symbol.type} symbol`)\n }\n }\n\n const updateView = (patchUpdate) => {\n // We only add in the stack patch with updates\n patchUpdate.updates.forEach((update) => {\n try {\n const svgElementSelector = 'svg[data-layer=\"' + patchUpdate.layer + '\"]'\n switch (update.type) {\n case 'REPLACE_ALL': {\n context.select(svgElementSelector).remove()\n const parent = context.node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n }\n if (patchUpdate.layer === 'MODEL') {\n context.select(svgElementSelector).append('g').attr('id', 'pendingStrokes')\n }\n }\n break\n case 'REMOVE_ELEMENT': {\n if (update.id.includes('s') || update.id.includes('MODEL')) {\n context.select(`#${update.id}`).remove()\n } else {\n context.select(`#${update.id}`).attr('class', 'removed-stroke')\n context.select(`#${update.id}`).remove()\n }\n break\n }\n case 'REPLACE_ELEMENT': {\n const parent = context.select(`#${update.id}`).node().parentNode\n context.select(`#${update.id}`).remove()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'REMOVE_CHILD':\n context.select(`#${update.parentId} > *:nth-child(${update.index + 1})`).remove()\n break\n case 'APPEND_CHILD': {\n const parent = context.select(update.parentId ? `#${update.parentId}` : svgElementSelector).node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'INSERT_BEFORE': {\n const parent = context.select(`#${update.refId}`).node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeBegin', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeBegin', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'REMOVE_ATTRIBUTE':\n context.selectAll(update.id ? `#${update.id}` : 'svg').attr(update.name, null)\n break\n case 'SET_ATTRIBUTE': {\n // We ignore setAttributes on the svg element because we handle the resize elsewhere to prevent a blink effect\n // that occurs if we are waiting for the server to resize.\n if (update.id) {\n context.selectAll(`#${update.id}`).attr(update.name, update.value)\n }\n break\n }\n default:\n logger.debug(`unknown update ${update.type} action`)\n break\n }\n } catch (e) {\n logger.error(`Invalid update ${update.type}`, update)\n logger.error('Error on svg patch', e)\n }\n })\n }\n\n const pendingRecognizedSymbols = InkModel.extractPendingRecognizedSymbols(model)\n if (pendingRecognizedSymbols) {\n pendingRecognizedSymbols.forEach(patch => updateView(patch))\n InkModel.updateModelRenderedPosition(model)\n }\n\n const pendingStrokes = InkModel.extractPendingStrokes(model)\n if (pendingStrokes) {\n pendingStrokes.forEach(stroke => drawSymbol(stroke, context.select('#pendingStrokes')))\n }\n return model\n}\n","import {Selection} from \"./index\";\nimport selector from \"../selector\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index\";\nimport selectorAll from \"../selectorAll\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","import {Selection} from \"./index\";\nimport matcher from \"../matcher\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse\";\nimport {Selection} from \"./index\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n enter = typeof onenter === \"function\" ? onenter(enter) : enter.append(onenter + \"\");\n if (onupdate != null) update = onupdate(update);\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index\";\n\nexport default function(selection) {\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n var nodes = new Array(this.size()), i = -1;\n this.each(function() { nodes[++i] = this; });\n return nodes;\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n var size = 0;\n this.each(function() { ++size; });\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","import {Selection, root} from \"./selection/index\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import * as StrokeComponent from '../../../model/StrokeComponent'\nimport { computeLinksPoints, computeMiddlePoint, computeAxeAngle } from '../../QuadraticUtils'\n\n/**\n * Get info\n * @return {StrokerInfo} Information about this stroker\n */\nexport function getInfo () {\n return {\n type: 'svg',\n name: 'quadratic'\n }\n}\n\nfunction renderArc (context, center, radius) {\n const svgPath = [\n `M ${center.x},${center.y}`,\n `m ${-radius},0`,\n `a ${radius},${radius} 0 1 0 ${radius * 2},0`,\n `a ${radius},${radius} 0 1 0 ${-(radius * 2)},0`\n ].join(' ')\n return svgPath\n}\n\nfunction renderLine (context, begin, end, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, end), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(begin, end), width)\n\n const svgPath = [\n `M ${linkPoints1[0].x},${linkPoints1[0].y}`,\n `L ${linkPoints2[0].x},${linkPoints2[0].y}`,\n `L ${linkPoints2[1].x},${linkPoints2[1].y}`,\n `L ${linkPoints1[1].x},${linkPoints1[1].y}`\n ].join(' ')\n return svgPath\n}\n\nfunction renderFinal (context, begin, end, width) {\n const ARCSPLIT = 6\n const angle = computeAxeAngle(begin, end)\n const linkPoints = computeLinksPoints(end, angle, width)\n\n const parts = [`M ${linkPoints[0].x},${linkPoints[0].y}`]\n for (let i = 1; i <= ARCSPLIT; i++) {\n const newAngle = angle - (i * (Math.PI / ARCSPLIT))\n parts.push(`L ${end.x - (end.p * width * Math.sin(newAngle))},${end.y + (end.p * width * Math.cos(newAngle))}`)\n }\n const svgPath = parts.join(' ')\n return svgPath\n}\n\nfunction renderQuadratic (context, begin, end, ctrl, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, ctrl), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(ctrl, end), width)\n const linkPoints3 = computeLinksPoints(ctrl, computeAxeAngle(begin, end), width)\n\n const svgPath = [\n `M ${linkPoints1[0].x},${linkPoints1[0].y}`,\n `Q ${linkPoints3[0].x},${linkPoints3[0].y} ${linkPoints2[0].x},${linkPoints2[0].y}`,\n `L ${linkPoints2[1].x},${linkPoints2[1].y}`,\n `Q ${linkPoints3[1].x},${linkPoints3[1].y} ${linkPoints1[1].x},${linkPoints1[1].y}`\n ].join(' ')\n return svgPath\n}\n\n/**\n * Draw a stroke on a svg tag, using quadratics\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Current stroke to be drawn\n */\nexport function drawStroke (context, stroke) {\n const length = stroke.x.length\n const width = stroke.width\n const firstPoint = StrokeComponent.getPointByIndex(stroke, 0)\n const nbquadratics = length - 2\n\n const parts = []\n if (length < 3) {\n parts.push(renderArc(context, firstPoint, width * 0.6))\n } else {\n parts.push(renderArc(context, firstPoint, width * firstPoint.p))\n parts.push(renderLine(context, firstPoint, computeMiddlePoint(firstPoint, StrokeComponent.getPointByIndex(stroke, 1)), width))\n\n for (let i = 0; i < nbquadratics; i++) {\n parts.push(renderQuadratic(context, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i), StrokeComponent.getPointByIndex(stroke, i + 1)), computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i + 1), StrokeComponent.getPointByIndex(stroke, i + 2)), StrokeComponent.getPointByIndex(stroke, i + 1), width))\n }\n parts.push(renderLine(context, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1)), StrokeComponent.getPointByIndex(stroke, length - 1), width))\n parts.push(renderFinal(context, StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1), width))\n }\n const svgPath = parts.join(' ')\n\n context\n .attr('color', stroke.color)\n .style('fill', stroke.color)\n .style('stroke', 'transparent')\n .classed('pending-stroke', true)\n .attr('d', `${svgPath}Z`)\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","module.exports = require(\"regenerator-runtime\");\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t /*\n\t * Local polyfil of Object.create\n\t */\n\t var create = Object.create || (function () {\n\t function F() {};\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }())\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t var r = (function (m_w) {\n\t var m_w = m_w;\n\t var m_z = 0x3ade68b1;\n\t var mask = 0xffffffff;\n\n\t return function () {\n\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t var result = ((m_z << 0x10) + m_w) & mask;\n\t result /= 0x100000000;\n\t result += 0.5;\n\t return result * (Math.random() > .5 ? 1 : -1);\n\t }\n\t });\n\n\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t var _r = r((rcache || Math.random()) * 0x100000000);\n\n\t rcache = _r() * 0x3ade67b7;\n\t words.push((_r() * 0x100000000) | 0);\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t var processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.enc.Hex;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var X32WordArray = C_lib.WordArray;\n\n\t /**\n\t * x64 namespace.\n\t */\n\t var C_x64 = C.x64 = {};\n\n\t /**\n\t * A 64-bit word.\n\t */\n\t var X64Word = C_x64.Word = Base.extend({\n\t /**\n\t * Initializes a newly created 64-bit word.\n\t *\n\t * @param {number} high The high 32 bits.\n\t * @param {number} low The low 32 bits.\n\t *\n\t * @example\n\t *\n\t * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);\n\t */\n\t init: function (high, low) {\n\t this.high = high;\n\t this.low = low;\n\t }\n\n\t /**\n\t * Bitwise NOTs this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after negating.\n\t *\n\t * @example\n\t *\n\t * var negated = x64Word.not();\n\t */\n\t // not: function () {\n\t // var high = ~this.high;\n\t // var low = ~this.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ANDs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to AND with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ANDing.\n\t *\n\t * @example\n\t *\n\t * var anded = x64Word.and(anotherX64Word);\n\t */\n\t // and: function (word) {\n\t // var high = this.high & word.high;\n\t // var low = this.low & word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to OR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ORing.\n\t *\n\t * @example\n\t *\n\t * var ored = x64Word.or(anotherX64Word);\n\t */\n\t // or: function (word) {\n\t // var high = this.high | word.high;\n\t // var low = this.low | word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise XORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to XOR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after XORing.\n\t *\n\t * @example\n\t *\n\t * var xored = x64Word.xor(anotherX64Word);\n\t */\n\t // xor: function (word) {\n\t // var high = this.high ^ word.high;\n\t // var low = this.low ^ word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftL(25);\n\t */\n\t // shiftL: function (n) {\n\t // if (n < 32) {\n\t // var high = (this.high << n) | (this.low >>> (32 - n));\n\t // var low = this.low << n;\n\t // } else {\n\t // var high = this.low << (n - 32);\n\t // var low = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftR(7);\n\t */\n\t // shiftR: function (n) {\n\t // if (n < 32) {\n\t // var low = (this.low >>> n) | (this.high << (32 - n));\n\t // var high = this.high >>> n;\n\t // } else {\n\t // var low = this.high >>> (n - 32);\n\t // var high = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotL(25);\n\t */\n\t // rotL: function (n) {\n\t // return this.shiftL(n).or(this.shiftR(64 - n));\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotR(7);\n\t */\n\t // rotR: function (n) {\n\t // return this.shiftR(n).or(this.shiftL(64 - n));\n\t // },\n\n\t /**\n\t * Adds this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to add with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after adding.\n\t *\n\t * @example\n\t *\n\t * var added = x64Word.add(anotherX64Word);\n\t */\n\t // add: function (word) {\n\t // var low = (this.low + word.low) | 0;\n\t // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;\n\t // var high = (this.high + word.high + carry) | 0;\n\n\t // return X64Word.create(high, low);\n\t // }\n\t });\n\n\t /**\n\t * An array of 64-bit words.\n\t *\n\t * @property {Array} words The array of CryptoJS.x64.Word objects.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var X64WordArray = C_x64.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create();\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ]);\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ], 10);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 8;\n\t }\n\t },\n\n\t /**\n\t * Converts this 64-bit word array to a 32-bit word array.\n\t *\n\t * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.\n\t *\n\t * @example\n\t *\n\t * var x32WordArray = x64WordArray.toX32();\n\t */\n\t toX32: function () {\n\t // Shortcuts\n\t var x64Words = this.words;\n\t var x64WordsLength = x64Words.length;\n\n\t // Convert\n\t var x32Words = [];\n\t for (var i = 0; i < x64WordsLength; i++) {\n\t var x64Word = x64Words[i];\n\t x32Words.push(x64Word.high);\n\t x32Words.push(x64Word.low);\n\t }\n\n\t return X32WordArray.create(x32Words, this.sigBytes);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {X64WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = x64WordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\n\t // Clone \"words\" array\n\t var words = clone.words = this.words.slice(0);\n\n\t // Clone each X64Word object\n\t var wordsLength = words.length;\n\t for (var i = 0; i < wordsLength; i++) {\n\t words[i] = words[i].clone();\n\t }\n\n\t return clone;\n\t }\n\t });\n\t}());\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./x64-core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./x64-core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Hasher = C_lib.Hasher;\n\t var C_x64 = C.x64;\n\t var X64Word = C_x64.Word;\n\t var X64WordArray = C_x64.WordArray;\n\t var C_algo = C.algo;\n\n\t function X64Word_create() {\n\t return X64Word.create.apply(X64Word, arguments);\n\t }\n\n\t // Constants\n\t var K = [\n\t X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),\n\t X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),\n\t X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),\n\t X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),\n\t X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),\n\t X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),\n\t X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),\n\t X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),\n\t X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),\n\t X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),\n\t X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),\n\t X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),\n\t X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),\n\t X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),\n\t X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),\n\t X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),\n\t X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),\n\t X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),\n\t X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),\n\t X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),\n\t X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),\n\t X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),\n\t X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),\n\t X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),\n\t X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),\n\t X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),\n\t X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),\n\t X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),\n\t X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),\n\t X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),\n\t X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),\n\t X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),\n\t X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),\n\t X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),\n\t X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),\n\t X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),\n\t X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),\n\t X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),\n\t X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),\n\t X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)\n\t ];\n\n\t // Reusable objects\n\t var W = [];\n\t (function () {\n\t for (var i = 0; i < 80; i++) {\n\t W[i] = X64Word_create();\n\t }\n\t }());\n\n\t /**\n\t * SHA-512 hash algorithm.\n\t */\n\t var SHA512 = C_algo.SHA512 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new X64WordArray.init([\n\t new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),\n\t new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),\n\t new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),\n\t new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcuts\n\t var H = this._hash.words;\n\n\t var H0 = H[0];\n\t var H1 = H[1];\n\t var H2 = H[2];\n\t var H3 = H[3];\n\t var H4 = H[4];\n\t var H5 = H[5];\n\t var H6 = H[6];\n\t var H7 = H[7];\n\n\t var H0h = H0.high;\n\t var H0l = H0.low;\n\t var H1h = H1.high;\n\t var H1l = H1.low;\n\t var H2h = H2.high;\n\t var H2l = H2.low;\n\t var H3h = H3.high;\n\t var H3l = H3.low;\n\t var H4h = H4.high;\n\t var H4l = H4.low;\n\t var H5h = H5.high;\n\t var H5l = H5.low;\n\t var H6h = H6.high;\n\t var H6l = H6.low;\n\t var H7h = H7.high;\n\t var H7l = H7.low;\n\n\t // Working variables\n\t var ah = H0h;\n\t var al = H0l;\n\t var bh = H1h;\n\t var bl = H1l;\n\t var ch = H2h;\n\t var cl = H2l;\n\t var dh = H3h;\n\t var dl = H3l;\n\t var eh = H4h;\n\t var el = H4l;\n\t var fh = H5h;\n\t var fl = H5l;\n\t var gh = H6h;\n\t var gl = H6l;\n\t var hh = H7h;\n\t var hl = H7l;\n\n\t // Rounds\n\t for (var i = 0; i < 80; i++) {\n\t // Shortcut\n\t var Wi = W[i];\n\n\t // Extend message\n\t if (i < 16) {\n\t var Wih = Wi.high = M[offset + i * 2] | 0;\n\t var Wil = Wi.low = M[offset + i * 2 + 1] | 0;\n\t } else {\n\t // Gamma0\n\t var gamma0x = W[i - 15];\n\t var gamma0xh = gamma0x.high;\n\t var gamma0xl = gamma0x.low;\n\t var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);\n\t var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));\n\n\t // Gamma1\n\t var gamma1x = W[i - 2];\n\t var gamma1xh = gamma1x.high;\n\t var gamma1xl = gamma1x.low;\n\t var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);\n\t var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));\n\n\t // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n\t var Wi7 = W[i - 7];\n\t var Wi7h = Wi7.high;\n\t var Wi7l = Wi7.low;\n\n\t var Wi16 = W[i - 16];\n\t var Wi16h = Wi16.high;\n\t var Wi16l = Wi16.low;\n\n\t var Wil = gamma0l + Wi7l;\n\t var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);\n\t var Wil = Wil + gamma1l;\n\t var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);\n\t var Wil = Wil + Wi16l;\n\t var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);\n\n\t Wi.high = Wih;\n\t Wi.low = Wil;\n\t }\n\n\t var chh = (eh & fh) ^ (~eh & gh);\n\t var chl = (el & fl) ^ (~el & gl);\n\t var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);\n\t var majl = (al & bl) ^ (al & cl) ^ (bl & cl);\n\n\t var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));\n\t var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));\n\t var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));\n\t var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));\n\n\t // t1 = h + sigma1 + ch + K[i] + W[i]\n\t var Ki = K[i];\n\t var Kih = Ki.high;\n\t var Kil = Ki.low;\n\n\t var t1l = hl + sigma1l;\n\t var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);\n\t var t1l = t1l + chl;\n\t var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);\n\t var t1l = t1l + Kil;\n\t var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);\n\t var t1l = t1l + Wil;\n\t var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);\n\n\t // t2 = sigma0 + maj\n\t var t2l = sigma0l + majl;\n\t var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);\n\n\t // Update working variables\n\t hh = gh;\n\t hl = gl;\n\t gh = fh;\n\t gl = fl;\n\t fh = eh;\n\t fl = el;\n\t el = (dl + t1l) | 0;\n\t eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;\n\t dh = ch;\n\t dl = cl;\n\t ch = bh;\n\t cl = bl;\n\t bh = ah;\n\t bl = al;\n\t al = (t1l + t2l) | 0;\n\t ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H0l = H0.low = (H0l + al);\n\t H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));\n\t H1l = H1.low = (H1l + bl);\n\t H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));\n\t H2l = H2.low = (H2l + cl);\n\t H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));\n\t H3l = H3.low = (H3l + dl);\n\t H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));\n\t H4l = H4.low = (H4l + el);\n\t H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));\n\t H5l = H5.low = (H5l + fl);\n\t H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));\n\t H6l = H6.low = (H6l + gl);\n\t H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));\n\t H7l = H7.low = (H7l + hl);\n\t H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Convert hash to 32-bit word array before returning\n\t var hash = this._hash.toX32();\n\n\t // Return final computed hash\n\t return hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t },\n\n\t blockSize: 1024/32\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA512('message');\n\t * var hash = CryptoJS.SHA512(wordArray);\n\t */\n\t C.SHA512 = Hasher._createHelper(SHA512);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA512(message, key);\n\t */\n\t C.HmacSHA512 = Hasher._createHmacHelper(SHA512);\n\t}());\n\n\n\treturn CryptoJS.SHA512;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./x64-core\"), require(\"./sha512\"), require(\"./hmac\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./x64-core\", \"./sha512\", \"./hmac\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.HmacSHA512;\n\n}));","import Hex from 'crypto-js/enc-hex'\nimport HmacSHA512 from 'crypto-js/hmac-sha512'\nimport { recognizerLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Compute HMAC signature for server authentication\n *\n * @param {Object} input Input data to compute HMAC\n * @param {String} applicationKey Current applicationKey\n * @param {String} hmacKey Current hmacKey\n * @return {String} Signature\n */\nexport function computeHmac (input, applicationKey, hmacKey) {\n const jsonInput = (typeof input === 'object') ? JSON.stringify(input) : input\n logger.debug('The HmacSHA512 function is loaded', HmacSHA512)\n return new HmacSHA512(jsonInput, applicationKey + hmacKey).toString(Hex)\n}\n","/* eslint-disable no-unused-expressions */\nimport * as CryptoHelper from '../CryptoHelper'\n\n/**\n * Post request\n * @param {RecognizerContext} recognizerContext Recognizer context\n * @param {String} url URL\n * @param {Object} data Data to be sent\n * @param {String} apiVersion api version\n * @param {String} mimeType MimeType to be used\n * @return {Promise}\n */\nexport async function post (recognizerContext, url, data, apiVersion, mimeType) {\n const configuration = recognizerContext.editor.configuration\n const recognizerContextRef = recognizerContext\n if (recognizerContextRef) {\n recognizerContextRef.idle = true\n }\n try {\n const headers = new Headers()\n headers.append('Accept', 'application/json,' + mimeType)\n headers.append('applicationKey', configuration.recognitionParams.server.applicationKey)\n headers.append('hmac', CryptoHelper.computeHmac(JSON.stringify(data), configuration.recognitionParams.server.applicationKey, configuration.recognitionParams.server.hmacKey))\n headers.append('Content-Type', 'application/json')\n const reqInit = {\n method: 'POST',\n headers,\n credentials: 'include',\n body: JSON.stringify(data)\n }\n const request = new Request(url, reqInit)\n const response = await fetch(request)\n const contentType = response.headers.get('content-type')\n let result = ''\n switch (contentType) {\n case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':\n case 'image/png':\n case 'image/jpeg':\n result = await response.blob()\n break\n case 'application/json':\n result = await response.json()\n break\n case 'application/vnd.myscript.jiix':\n result = await response.clone().json().catch(async () => await response.text())\n break\n default:\n result = await response.text()\n break\n }\n return result\n } catch (error) {\n throw new Error({ msg: `Could not connect to ${url} connection error`, recoverable: false })\n }\n}\n","import { recognizerLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Recognition context\n * @typedef {Object} RecognitionContext\n * @property {Model} model\n * @property {Callback} callback\n */\n\n/**\n * Recognizer context\n * @typedef {Object} RecognizerContext\n * @property {Editor} editor Get a reference to the current editor\n * @property {Array} recognitionContexts=[]\n * @property {Promise} initPromise=undefined\n * @property {RecognitionPositions} lastPositions Last recognition sent/received stroke indexes.\n * @property {String} url=undefined\n * @property {WebSocket} websocket=undefined\n * @property {function} websocketCallback=undefined\n * @property {function} reconnect=undefined\n * @property {Number} currentReconnectionCount=0\n * @property {String} sessionId=undefined\n * @property {Number} contentPartCount=0\n * @property {String} currentPartId=undefined\n * @property {String} instanceId=undefined\n * @property {Boolean} canUndo=false\n * @property {Boolean} canRedo=false\n * @property {Boolean} isEmpty=false\n * @property {Array} supportedImportMimeTypes=[]\n * @property {Number} undoStackIndex=0\n * @property {Number} possibleUndoCount=0\n * @property {Boolean} idle=true\n * @property {Boolean} initialized=false\n */\n/**\n * Create a new recognizer context\n * @param {Editor} editor\n * @return {RecognizerContext} An object that contains all recognizer context\n */\nexport function createEmptyRecognizerContext (editor) {\n const id = Date.now()\n logger.info('Create empty recognizer context with ID: ' + id)\n return {\n id,\n editor,\n // websocket\n recognitionContexts: [],\n initPromise: undefined,\n lastPositions: {\n lastSentPosition: -1,\n lastReceivedPosition: -1\n },\n url: undefined,\n websocket: undefined,\n websocketCallback: undefined,\n reconnect: undefined,\n currentReconnectionCount: 0,\n sessionId: undefined,\n contentPartCount: 0,\n currentPartId: undefined,\n instanceId: undefined,\n canUndo: false,\n canRedo: false,\n isEmpty: undefined,\n supportedImportMimeTypes: [],\n undoStackIndex: 0,\n possibleUndoCount: 0,\n idle: true,\n initialized: false\n }\n}\n\n/**\n * Return true if a reset is required, false otherwise\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n * @return {Boolean}\n */\nexport function isResetRequired (recognizerContext, model) {\n if (recognizerContext.lastPositions) {\n return recognizerContext.lastPositions.lastSentPosition >= model.rawStrokes.length - 1\n }\n return false\n}\n\n/**\n * Update the recognition context positions\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {RecognitionPositions} positions Current recognition positions\n * @return {RecognizerContext}\n */\nexport function updateRecognitionPositions (recognizerContext, positions) {\n const recognizerContextRef = recognizerContext\n if (positions) {\n recognizerContextRef.lastPositions.lastSentPosition = positions.lastSentPosition\n recognizerContextRef.lastPositions.lastReceivedPosition = positions.lastReceivedPosition\n }\n if (recognizerContextRef.lastPositions.lastSentPosition === recognizerContextRef.lastPositions.lastReceivedPosition === -1) {\n delete recognizerContextRef.instanceId\n }\n return recognizerContextRef\n}\n\n/**\n * Set the recognition context\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {RecognitionContext} recognitionContext\n * @return {RecognizerContext}\n */\nexport function setRecognitionContext (recognizerContext, recognitionContext) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.recognitionContexts[0] = recognitionContext\n return recognizerContextRef\n}\n\n/**\n * Test if it is possible to reconnect\n * @param {RecognizerContext} recognizerContext\n * @return {Boolean} True if possible, false otherwise\n */\nexport function canReconnect (recognizerContext) {\n return recognizerContext.websocket.autoReconnect === true && recognizerContext.currentReconnectionCount <= recognizerContext.websocket.maxRetryCount\n}\n\n/**\n * Test if it should attempt immediate reconnect\n * @param {RecognizerContext} recognizerContext\n * @return {Boolean} True if should attempt reconnect, false otherwise\n */\nexport function shouldAttemptImmediateReconnect (recognizerContext) {\n const recognizerContextRef = recognizerContext\n return recognizerContextRef.websocket.autoReconnect === true && recognizerContextRef.currentReconnectionCount++ <= recognizerContextRef.websocket.maxRetryCount\n}\n\n/**\n * Lost connection message\n * @type {{type: string}}\n */\nexport const LOST_CONNEXION_MESSAGE = { type: 'LOST_CONNECTION' }\n\n/**\n * Explicit close message\n * @type {String}\n */\nexport const CLOSE_RECOGNIZER_MESSAGE = 'CLOSE_RECOGNIZER'\n","/*!\r\n * perfect-scrollbar v1.5.3\r\n * Copyright 2021 Hyunje Jun, MDBootstrap and Contributors\r\n * Licensed under MIT\r\n */\r\n\r\nfunction get(element) {\r\n return getComputedStyle(element);\r\n}\r\n\r\nfunction set(element, obj) {\r\n for (var key in obj) {\r\n var val = obj[key];\r\n if (typeof val === 'number') {\r\n val = val + \"px\";\r\n }\r\n element.style[key] = val;\r\n }\r\n return element;\r\n}\r\n\r\nfunction div(className) {\r\n var div = document.createElement('div');\r\n div.className = className;\r\n return div;\r\n}\r\n\r\nvar elMatches =\r\n typeof Element !== 'undefined' &&\r\n (Element.prototype.matches ||\r\n Element.prototype.webkitMatchesSelector ||\r\n Element.prototype.mozMatchesSelector ||\r\n Element.prototype.msMatchesSelector);\r\n\r\nfunction matches(element, query) {\r\n if (!elMatches) {\r\n throw new Error('No element matching method supported');\r\n }\r\n\r\n return elMatches.call(element, query);\r\n}\r\n\r\nfunction remove(element) {\r\n if (element.remove) {\r\n element.remove();\r\n } else {\r\n if (element.parentNode) {\r\n element.parentNode.removeChild(element);\r\n }\r\n }\r\n}\r\n\r\nfunction queryChildren(element, selector) {\r\n return Array.prototype.filter.call(element.children, function (child) { return matches(child, selector); }\r\n );\r\n}\r\n\r\nvar cls = {\r\n main: 'ps',\r\n rtl: 'ps__rtl',\r\n element: {\r\n thumb: function (x) { return (\"ps__thumb-\" + x); },\r\n rail: function (x) { return (\"ps__rail-\" + x); },\r\n consuming: 'ps__child--consume',\r\n },\r\n state: {\r\n focus: 'ps--focus',\r\n clicking: 'ps--clicking',\r\n active: function (x) { return (\"ps--active-\" + x); },\r\n scrolling: function (x) { return (\"ps--scrolling-\" + x); },\r\n },\r\n};\r\n\r\n/*\r\n * Helper methods\r\n */\r\nvar scrollingClassTimeout = { x: null, y: null };\r\n\r\nfunction addScrollingClass(i, x) {\r\n var classList = i.element.classList;\r\n var className = cls.state.scrolling(x);\r\n\r\n if (classList.contains(className)) {\r\n clearTimeout(scrollingClassTimeout[x]);\r\n } else {\r\n classList.add(className);\r\n }\r\n}\r\n\r\nfunction removeScrollingClass(i, x) {\r\n scrollingClassTimeout[x] = setTimeout(\r\n function () { return i.isAlive && i.element.classList.remove(cls.state.scrolling(x)); },\r\n i.settings.scrollingThreshold\r\n );\r\n}\r\n\r\nfunction setScrollingClassInstantly(i, x) {\r\n addScrollingClass(i, x);\r\n removeScrollingClass(i, x);\r\n}\r\n\r\nvar EventElement = function EventElement(element) {\r\n this.element = element;\r\n this.handlers = {};\r\n};\r\n\r\nvar prototypeAccessors = { isEmpty: { configurable: true } };\r\n\r\nEventElement.prototype.bind = function bind (eventName, handler) {\r\n if (typeof this.handlers[eventName] === 'undefined') {\r\n this.handlers[eventName] = [];\r\n }\r\n this.handlers[eventName].push(handler);\r\n this.element.addEventListener(eventName, handler, false);\r\n};\r\n\r\nEventElement.prototype.unbind = function unbind (eventName, target) {\r\n var this$1 = this;\r\n\r\n this.handlers[eventName] = this.handlers[eventName].filter(function (handler) {\r\n if (target && handler !== target) {\r\n return true;\r\n }\r\n this$1.element.removeEventListener(eventName, handler, false);\r\n return false;\r\n });\r\n};\r\n\r\nEventElement.prototype.unbindAll = function unbindAll () {\r\n for (var name in this.handlers) {\r\n this.unbind(name);\r\n }\r\n};\r\n\r\nprototypeAccessors.isEmpty.get = function () {\r\n var this$1 = this;\r\n\r\n return Object.keys(this.handlers).every(\r\n function (key) { return this$1.handlers[key].length === 0; }\r\n );\r\n};\r\n\r\nObject.defineProperties( EventElement.prototype, prototypeAccessors );\r\n\r\nvar EventManager = function EventManager() {\r\n this.eventElements = [];\r\n};\r\n\r\nEventManager.prototype.eventElement = function eventElement (element) {\r\n var ee = this.eventElements.filter(function (ee) { return ee.element === element; })[0];\r\n if (!ee) {\r\n ee = new EventElement(element);\r\n this.eventElements.push(ee);\r\n }\r\n return ee;\r\n};\r\n\r\nEventManager.prototype.bind = function bind (element, eventName, handler) {\r\n this.eventElement(element).bind(eventName, handler);\r\n};\r\n\r\nEventManager.prototype.unbind = function unbind (element, eventName, handler) {\r\n var ee = this.eventElement(element);\r\n ee.unbind(eventName, handler);\r\n\r\n if (ee.isEmpty) {\r\n // remove\r\n this.eventElements.splice(this.eventElements.indexOf(ee), 1);\r\n }\r\n};\r\n\r\nEventManager.prototype.unbindAll = function unbindAll () {\r\n this.eventElements.forEach(function (e) { return e.unbindAll(); });\r\n this.eventElements = [];\r\n};\r\n\r\nEventManager.prototype.once = function once (element, eventName, handler) {\r\n var ee = this.eventElement(element);\r\n var onceHandler = function (evt) {\r\n ee.unbind(eventName, onceHandler);\r\n handler(evt);\r\n };\r\n ee.bind(eventName, onceHandler);\r\n};\r\n\r\nfunction createEvent(name) {\r\n if (typeof window.CustomEvent === 'function') {\r\n return new CustomEvent(name);\r\n } else {\r\n var evt = document.createEvent('CustomEvent');\r\n evt.initCustomEvent(name, false, false, undefined);\r\n return evt;\r\n }\r\n}\r\n\r\nfunction processScrollDiff(\r\n i,\r\n axis,\r\n diff,\r\n useScrollingClass,\r\n forceFireReachEvent\r\n) {\r\n if ( useScrollingClass === void 0 ) useScrollingClass = true;\r\n if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;\r\n\r\n var fields;\r\n if (axis === 'top') {\r\n fields = [\r\n 'contentHeight',\r\n 'containerHeight',\r\n 'scrollTop',\r\n 'y',\r\n 'up',\r\n 'down' ];\r\n } else if (axis === 'left') {\r\n fields = [\r\n 'contentWidth',\r\n 'containerWidth',\r\n 'scrollLeft',\r\n 'x',\r\n 'left',\r\n 'right' ];\r\n } else {\r\n throw new Error('A proper axis should be provided');\r\n }\r\n\r\n processScrollDiff$1(i, diff, fields, useScrollingClass, forceFireReachEvent);\r\n}\r\n\r\nfunction processScrollDiff$1(\r\n i,\r\n diff,\r\n ref,\r\n useScrollingClass,\r\n forceFireReachEvent\r\n) {\r\n var contentHeight = ref[0];\r\n var containerHeight = ref[1];\r\n var scrollTop = ref[2];\r\n var y = ref[3];\r\n var up = ref[4];\r\n var down = ref[5];\r\n if ( useScrollingClass === void 0 ) useScrollingClass = true;\r\n if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;\r\n\r\n var element = i.element;\r\n\r\n // reset reach\r\n i.reach[y] = null;\r\n\r\n // 1 for subpixel rounding\r\n if (element[scrollTop] < 1) {\r\n i.reach[y] = 'start';\r\n }\r\n\r\n // 1 for subpixel rounding\r\n if (element[scrollTop] > i[contentHeight] - i[containerHeight] - 1) {\r\n i.reach[y] = 'end';\r\n }\r\n\r\n if (diff) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + y)));\r\n\r\n if (diff < 0) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + up)));\r\n } else if (diff > 0) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + down)));\r\n }\r\n\r\n if (useScrollingClass) {\r\n setScrollingClassInstantly(i, y);\r\n }\r\n }\r\n\r\n if (i.reach[y] && (diff || forceFireReachEvent)) {\r\n element.dispatchEvent(createEvent((\"ps-\" + y + \"-reach-\" + (i.reach[y]))));\r\n }\r\n}\r\n\r\nfunction toInt(x) {\r\n return parseInt(x, 10) || 0;\r\n}\r\n\r\nfunction isEditable(el) {\r\n return (\r\n matches(el, 'input,[contenteditable]') ||\r\n matches(el, 'select,[contenteditable]') ||\r\n matches(el, 'textarea,[contenteditable]') ||\r\n matches(el, 'button,[contenteditable]')\r\n );\r\n}\r\n\r\nfunction outerWidth(element) {\r\n var styles = get(element);\r\n return (\r\n toInt(styles.width) +\r\n toInt(styles.paddingLeft) +\r\n toInt(styles.paddingRight) +\r\n toInt(styles.borderLeftWidth) +\r\n toInt(styles.borderRightWidth)\r\n );\r\n}\r\n\r\nvar env = {\r\n isWebKit:\r\n typeof document !== 'undefined' &&\r\n 'WebkitAppearance' in document.documentElement.style,\r\n supportsTouch:\r\n typeof window !== 'undefined' &&\r\n ('ontouchstart' in window ||\r\n ('maxTouchPoints' in window.navigator &&\r\n window.navigator.maxTouchPoints > 0) ||\r\n (window.DocumentTouch && document instanceof window.DocumentTouch)),\r\n supportsIePointer:\r\n typeof navigator !== 'undefined' && navigator.msMaxTouchPoints,\r\n isChrome:\r\n typeof navigator !== 'undefined' &&\r\n /Chrome/i.test(navigator && navigator.userAgent),\r\n};\r\n\r\nfunction updateGeometry(i) {\r\n var element = i.element;\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n var rect = element.getBoundingClientRect();\r\n\r\n i.containerWidth = Math.round(rect.width);\r\n i.containerHeight = Math.round(rect.height);\r\n\r\n i.contentWidth = element.scrollWidth;\r\n i.contentHeight = element.scrollHeight;\r\n\r\n if (!element.contains(i.scrollbarXRail)) {\r\n // clean up and append\r\n queryChildren(element, cls.element.rail('x')).forEach(function (el) { return remove(el); }\r\n );\r\n element.appendChild(i.scrollbarXRail);\r\n }\r\n if (!element.contains(i.scrollbarYRail)) {\r\n // clean up and append\r\n queryChildren(element, cls.element.rail('y')).forEach(function (el) { return remove(el); }\r\n );\r\n element.appendChild(i.scrollbarYRail);\r\n }\r\n\r\n if (\r\n !i.settings.suppressScrollX &&\r\n i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth\r\n ) {\r\n i.scrollbarXActive = true;\r\n i.railXWidth = i.containerWidth - i.railXMarginWidth;\r\n i.railXRatio = i.containerWidth / i.railXWidth;\r\n i.scrollbarXWidth = getThumbSize(\r\n i,\r\n toInt((i.railXWidth * i.containerWidth) / i.contentWidth)\r\n );\r\n i.scrollbarXLeft = toInt(\r\n ((i.negativeScrollAdjustment + element.scrollLeft) *\r\n (i.railXWidth - i.scrollbarXWidth)) /\r\n (i.contentWidth - i.containerWidth)\r\n );\r\n } else {\r\n i.scrollbarXActive = false;\r\n }\r\n\r\n if (\r\n !i.settings.suppressScrollY &&\r\n i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight\r\n ) {\r\n i.scrollbarYActive = true;\r\n i.railYHeight = i.containerHeight - i.railYMarginHeight;\r\n i.railYRatio = i.containerHeight / i.railYHeight;\r\n i.scrollbarYHeight = getThumbSize(\r\n i,\r\n toInt((i.railYHeight * i.containerHeight) / i.contentHeight)\r\n );\r\n i.scrollbarYTop = toInt(\r\n (roundedScrollTop * (i.railYHeight - i.scrollbarYHeight)) /\r\n (i.contentHeight - i.containerHeight)\r\n );\r\n } else {\r\n i.scrollbarYActive = false;\r\n }\r\n\r\n if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) {\r\n i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth;\r\n }\r\n if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) {\r\n i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight;\r\n }\r\n\r\n updateCss(element, i);\r\n\r\n if (i.scrollbarXActive) {\r\n element.classList.add(cls.state.active('x'));\r\n } else {\r\n element.classList.remove(cls.state.active('x'));\r\n i.scrollbarXWidth = 0;\r\n i.scrollbarXLeft = 0;\r\n element.scrollLeft = i.isRtl === true ? i.contentWidth : 0;\r\n }\r\n if (i.scrollbarYActive) {\r\n element.classList.add(cls.state.active('y'));\r\n } else {\r\n element.classList.remove(cls.state.active('y'));\r\n i.scrollbarYHeight = 0;\r\n i.scrollbarYTop = 0;\r\n element.scrollTop = 0;\r\n }\r\n}\r\n\r\nfunction getThumbSize(i, thumbSize) {\r\n if (i.settings.minScrollbarLength) {\r\n thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength);\r\n }\r\n if (i.settings.maxScrollbarLength) {\r\n thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength);\r\n }\r\n return thumbSize;\r\n}\r\n\r\nfunction updateCss(element, i) {\r\n var xRailOffset = { width: i.railXWidth };\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n\r\n if (i.isRtl) {\r\n xRailOffset.left =\r\n i.negativeScrollAdjustment +\r\n element.scrollLeft +\r\n i.containerWidth -\r\n i.contentWidth;\r\n } else {\r\n xRailOffset.left = element.scrollLeft;\r\n }\r\n if (i.isScrollbarXUsingBottom) {\r\n xRailOffset.bottom = i.scrollbarXBottom - roundedScrollTop;\r\n } else {\r\n xRailOffset.top = i.scrollbarXTop + roundedScrollTop;\r\n }\r\n set(i.scrollbarXRail, xRailOffset);\r\n\r\n var yRailOffset = { top: roundedScrollTop, height: i.railYHeight };\r\n if (i.isScrollbarYUsingRight) {\r\n if (i.isRtl) {\r\n yRailOffset.right =\r\n i.contentWidth -\r\n (i.negativeScrollAdjustment + element.scrollLeft) -\r\n i.scrollbarYRight -\r\n i.scrollbarYOuterWidth -\r\n 9;\r\n } else {\r\n yRailOffset.right = i.scrollbarYRight - element.scrollLeft;\r\n }\r\n } else {\r\n if (i.isRtl) {\r\n yRailOffset.left =\r\n i.negativeScrollAdjustment +\r\n element.scrollLeft +\r\n i.containerWidth * 2 -\r\n i.contentWidth -\r\n i.scrollbarYLeft -\r\n i.scrollbarYOuterWidth;\r\n } else {\r\n yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;\r\n }\r\n }\r\n set(i.scrollbarYRail, yRailOffset);\r\n\r\n set(i.scrollbarX, {\r\n left: i.scrollbarXLeft,\r\n width: i.scrollbarXWidth - i.railBorderXWidth,\r\n });\r\n set(i.scrollbarY, {\r\n top: i.scrollbarYTop,\r\n height: i.scrollbarYHeight - i.railBorderYWidth,\r\n });\r\n}\r\n\r\nfunction clickRail(i) {\r\n var element = i.element;\r\n\r\n i.event.bind(i.scrollbarY, 'mousedown', function (e) { return e.stopPropagation(); });\r\n i.event.bind(i.scrollbarYRail, 'mousedown', function (e) {\r\n var positionTop =\r\n e.pageY -\r\n window.pageYOffset -\r\n i.scrollbarYRail.getBoundingClientRect().top;\r\n var direction = positionTop > i.scrollbarYTop ? 1 : -1;\r\n\r\n i.element.scrollTop += direction * i.containerHeight;\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n });\r\n\r\n i.event.bind(i.scrollbarX, 'mousedown', function (e) { return e.stopPropagation(); });\r\n i.event.bind(i.scrollbarXRail, 'mousedown', function (e) {\r\n var positionLeft =\r\n e.pageX -\r\n window.pageXOffset -\r\n i.scrollbarXRail.getBoundingClientRect().left;\r\n var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;\r\n\r\n i.element.scrollLeft += direction * i.containerWidth;\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n });\r\n}\r\n\r\nfunction dragThumb(i) {\r\n bindMouseScrollHandler(i, [\r\n 'containerWidth',\r\n 'contentWidth',\r\n 'pageX',\r\n 'railXWidth',\r\n 'scrollbarX',\r\n 'scrollbarXWidth',\r\n 'scrollLeft',\r\n 'x',\r\n 'scrollbarXRail' ]);\r\n bindMouseScrollHandler(i, [\r\n 'containerHeight',\r\n 'contentHeight',\r\n 'pageY',\r\n 'railYHeight',\r\n 'scrollbarY',\r\n 'scrollbarYHeight',\r\n 'scrollTop',\r\n 'y',\r\n 'scrollbarYRail' ]);\r\n}\r\n\r\nfunction bindMouseScrollHandler(\r\n i,\r\n ref\r\n) {\r\n var containerHeight = ref[0];\r\n var contentHeight = ref[1];\r\n var pageY = ref[2];\r\n var railYHeight = ref[3];\r\n var scrollbarY = ref[4];\r\n var scrollbarYHeight = ref[5];\r\n var scrollTop = ref[6];\r\n var y = ref[7];\r\n var scrollbarYRail = ref[8];\r\n\r\n var element = i.element;\r\n\r\n var startingScrollTop = null;\r\n var startingMousePageY = null;\r\n var scrollBy = null;\r\n\r\n function mouseMoveHandler(e) {\r\n if (e.touches && e.touches[0]) {\r\n e[pageY] = e.touches[0].pageY;\r\n }\r\n element[scrollTop] =\r\n startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);\r\n addScrollingClass(i, y);\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n if (e.type.startsWith('touch') && e.changedTouches.length > 1) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n function mouseUpHandler() {\r\n removeScrollingClass(i, y);\r\n i[scrollbarYRail].classList.remove(cls.state.clicking);\r\n i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);\r\n }\r\n\r\n function bindMoves(e, touchMode) {\r\n startingScrollTop = element[scrollTop];\r\n if (touchMode && e.touches) {\r\n e[pageY] = e.touches[0].pageY;\r\n }\r\n startingMousePageY = e[pageY];\r\n scrollBy =\r\n (i[contentHeight] - i[containerHeight]) /\r\n (i[railYHeight] - i[scrollbarYHeight]);\r\n if (!touchMode) {\r\n i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);\r\n i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);\r\n e.preventDefault();\r\n } else {\r\n i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler);\r\n }\r\n\r\n i[scrollbarYRail].classList.add(cls.state.clicking);\r\n\r\n e.stopPropagation();\r\n }\r\n\r\n i.event.bind(i[scrollbarY], 'mousedown', function (e) {\r\n bindMoves(e);\r\n });\r\n i.event.bind(i[scrollbarY], 'touchstart', function (e) {\r\n bindMoves(e, true);\r\n });\r\n}\r\n\r\nfunction keyboard(i) {\r\n var element = i.element;\r\n\r\n var elementHovered = function () { return matches(element, ':hover'); };\r\n var scrollbarFocused = function () { return matches(i.scrollbarX, ':focus') || matches(i.scrollbarY, ':focus'); };\r\n\r\n function shouldPreventDefault(deltaX, deltaY) {\r\n var scrollTop = Math.floor(element.scrollTop);\r\n if (deltaX === 0) {\r\n if (!i.scrollbarYActive) {\r\n return false;\r\n }\r\n if (\r\n (scrollTop === 0 && deltaY > 0) ||\r\n (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)\r\n ) {\r\n return !i.settings.wheelPropagation;\r\n }\r\n }\r\n\r\n var scrollLeft = element.scrollLeft;\r\n if (deltaY === 0) {\r\n if (!i.scrollbarXActive) {\r\n return false;\r\n }\r\n if (\r\n (scrollLeft === 0 && deltaX < 0) ||\r\n (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)\r\n ) {\r\n return !i.settings.wheelPropagation;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n i.event.bind(i.ownerDocument, 'keydown', function (e) {\r\n if (\r\n (e.isDefaultPrevented && e.isDefaultPrevented()) ||\r\n e.defaultPrevented\r\n ) {\r\n return;\r\n }\r\n\r\n if (!elementHovered() && !scrollbarFocused()) {\r\n return;\r\n }\r\n\r\n var activeElement = document.activeElement\r\n ? document.activeElement\r\n : i.ownerDocument.activeElement;\r\n if (activeElement) {\r\n if (activeElement.tagName === 'IFRAME') {\r\n activeElement = activeElement.contentDocument.activeElement;\r\n } else {\r\n // go deeper if element is a webcomponent\r\n while (activeElement.shadowRoot) {\r\n activeElement = activeElement.shadowRoot.activeElement;\r\n }\r\n }\r\n if (isEditable(activeElement)) {\r\n return;\r\n }\r\n }\r\n\r\n var deltaX = 0;\r\n var deltaY = 0;\r\n\r\n switch (e.which) {\r\n case 37: // left\r\n if (e.metaKey) {\r\n deltaX = -i.contentWidth;\r\n } else if (e.altKey) {\r\n deltaX = -i.containerWidth;\r\n } else {\r\n deltaX = -30;\r\n }\r\n break;\r\n case 38: // up\r\n if (e.metaKey) {\r\n deltaY = i.contentHeight;\r\n } else if (e.altKey) {\r\n deltaY = i.containerHeight;\r\n } else {\r\n deltaY = 30;\r\n }\r\n break;\r\n case 39: // right\r\n if (e.metaKey) {\r\n deltaX = i.contentWidth;\r\n } else if (e.altKey) {\r\n deltaX = i.containerWidth;\r\n } else {\r\n deltaX = 30;\r\n }\r\n break;\r\n case 40: // down\r\n if (e.metaKey) {\r\n deltaY = -i.contentHeight;\r\n } else if (e.altKey) {\r\n deltaY = -i.containerHeight;\r\n } else {\r\n deltaY = -30;\r\n }\r\n break;\r\n case 32: // space bar\r\n if (e.shiftKey) {\r\n deltaY = i.containerHeight;\r\n } else {\r\n deltaY = -i.containerHeight;\r\n }\r\n break;\r\n case 33: // page up\r\n deltaY = i.containerHeight;\r\n break;\r\n case 34: // page down\r\n deltaY = -i.containerHeight;\r\n break;\r\n case 36: // home\r\n deltaY = i.contentHeight;\r\n break;\r\n case 35: // end\r\n deltaY = -i.contentHeight;\r\n break;\r\n default:\r\n return;\r\n }\r\n\r\n if (i.settings.suppressScrollX && deltaX !== 0) {\r\n return;\r\n }\r\n if (i.settings.suppressScrollY && deltaY !== 0) {\r\n return;\r\n }\r\n\r\n element.scrollTop -= deltaY;\r\n element.scrollLeft += deltaX;\r\n updateGeometry(i);\r\n\r\n if (shouldPreventDefault(deltaX, deltaY)) {\r\n e.preventDefault();\r\n }\r\n });\r\n}\r\n\r\nfunction wheel(i) {\r\n var element = i.element;\r\n\r\n function shouldPreventDefault(deltaX, deltaY) {\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n var isTop = element.scrollTop === 0;\r\n var isBottom =\r\n roundedScrollTop + element.offsetHeight === element.scrollHeight;\r\n var isLeft = element.scrollLeft === 0;\r\n var isRight =\r\n element.scrollLeft + element.offsetWidth === element.scrollWidth;\r\n\r\n var hitsBound;\r\n\r\n // pick axis with primary direction\r\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\r\n hitsBound = isTop || isBottom;\r\n } else {\r\n hitsBound = isLeft || isRight;\r\n }\r\n\r\n return hitsBound ? !i.settings.wheelPropagation : true;\r\n }\r\n\r\n function getDeltaFromEvent(e) {\r\n var deltaX = e.deltaX;\r\n var deltaY = -1 * e.deltaY;\r\n\r\n if (typeof deltaX === 'undefined' || typeof deltaY === 'undefined') {\r\n // OS X Safari\r\n deltaX = (-1 * e.wheelDeltaX) / 6;\r\n deltaY = e.wheelDeltaY / 6;\r\n }\r\n\r\n if (e.deltaMode && e.deltaMode === 1) {\r\n // Firefox in deltaMode 1: Line scrolling\r\n deltaX *= 10;\r\n deltaY *= 10;\r\n }\r\n\r\n if (deltaX !== deltaX && deltaY !== deltaY /* NaN checks */) {\r\n // IE in some mouse drivers\r\n deltaX = 0;\r\n deltaY = e.wheelDelta;\r\n }\r\n\r\n if (e.shiftKey) {\r\n // reverse axis with shift key\r\n return [-deltaY, -deltaX];\r\n }\r\n return [deltaX, deltaY];\r\n }\r\n\r\n function shouldBeConsumedByChild(target, deltaX, deltaY) {\r\n // FIXME: this is a workaround for issue in FF and IE #571\n if (!env.isWebKit && element.querySelector('select:focus')) {\n return true;\n }\n\n if (!element.contains(target)) {\n return false;\n }\n\n var cursor = target;\n\n while (cursor && cursor !== element) {\n if (cursor.classList.contains(cls.element.consuming)) {\n return true;\n }\n\n var style = get(cursor);\n\n // if deltaY && vertical scrollable\n if (deltaY && style.overflowY.match(/(scroll|auto)/)) {\n var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;\n if (maxScrollTop > 0) {\n if (\n (cursor.scrollTop > 0 && deltaY < 0) ||\n (cursor.scrollTop < maxScrollTop && deltaY > 0)\n ) {\n return true;\n }\n }\n }\n // if deltaX && horizontal scrollable\n if (deltaX && style.overflowX.match(/(scroll|auto)/)) {\n var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth;\n if (maxScrollLeft > 0) {\n if (\n (cursor.scrollLeft > 0 && deltaX < 0) ||\n (cursor.scrollLeft < maxScrollLeft && deltaX > 0)\n ) {\n return true;\n }\n }\n }\n\n cursor = cursor.parentNode;\n }\n\n return false;\n }\n\n function mousewheelHandler(e) {\n var ref = getDeltaFromEvent(e);\n var deltaX = ref[0];\n var deltaY = ref[1];\n\n if (shouldBeConsumedByChild(e.target, deltaX, deltaY)) {\n return;\n }\n\n var shouldPrevent = false;\n if (!i.settings.useBothWheelAxes) {\n // deltaX will only be used for horizontal scrolling and deltaY will\n // only be used for vertical scrolling - this is the default\n element.scrollTop -= deltaY * i.settings.wheelSpeed;\n element.scrollLeft += deltaX * i.settings.wheelSpeed;\n } else if (i.scrollbarYActive && !i.scrollbarXActive) {\n // only vertical scrollbar is active and useBothWheelAxes option is\n // active, so let's scroll vertical bar using both mouse wheel axes\n if (deltaY) {\n element.scrollTop -= deltaY * i.settings.wheelSpeed;\n } else {\n element.scrollTop += deltaX * i.settings.wheelSpeed;\n }\n shouldPrevent = true;\n } else if (i.scrollbarXActive && !i.scrollbarYActive) {\n // useBothWheelAxes and only horizontal bar is active, so use both\n // wheel axes for horizontal bar\n if (deltaX) {\n element.scrollLeft += deltaX * i.settings.wheelSpeed;\n } else {\n element.scrollLeft -= deltaY * i.settings.wheelSpeed;\n }\n shouldPrevent = true;\n }\n\n updateGeometry(i);\n\n shouldPrevent = shouldPrevent || shouldPreventDefault(deltaX, deltaY);\n if (shouldPrevent && !e.ctrlKey) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n if (typeof window.onwheel !== 'undefined') {\n i.event.bind(element, 'wheel', mousewheelHandler);\n } else if (typeof window.onmousewheel !== 'undefined') {\n i.event.bind(element, 'mousewheel', mousewheelHandler);\n }\n}\n\nfunction touch(i) {\n if (!env.supportsTouch && !env.supportsIePointer) {\n return;\n }\n\n var element = i.element;\n\n function shouldPrevent(deltaX, deltaY) {\n var scrollTop = Math.floor(element.scrollTop);\n var scrollLeft = element.scrollLeft;\n var magnitudeX = Math.abs(deltaX);\n var magnitudeY = Math.abs(deltaY);\n\n if (magnitudeY > magnitudeX) {\n // user is perhaps trying to swipe up/down the page\n\n if (\n (deltaY < 0 && scrollTop === i.contentHeight - i.containerHeight) ||\n (deltaY > 0 && scrollTop === 0)\n ) {\n // set prevent for mobile Chrome refresh\n return window.scrollY === 0 && deltaY > 0 && env.isChrome;\n }\n } else if (magnitudeX > magnitudeY) {\n // user is perhaps trying to swipe left/right across the page\n\n if (\n (deltaX < 0 && scrollLeft === i.contentWidth - i.containerWidth) ||\n (deltaX > 0 && scrollLeft === 0)\n ) {\n return true;\n }\n }\n\n return true;\n }\n\n function applyTouchMove(differenceX, differenceY) {\n element.scrollTop -= differenceY;\n element.scrollLeft -= differenceX;\n\n updateGeometry(i);\n }\n\n var startOffset = {};\n var startTime = 0;\n var speed = {};\n var easingLoop = null;\n\n function getTouch(e) {\n if (e.targetTouches) {\n return e.targetTouches[0];\n } else {\n // Maybe IE pointer\n return e;\n }\n }\n\n function shouldHandle(e) {\n if (e.pointerType && e.pointerType === 'pen' && e.buttons === 0) {\n return false;\n }\n if (e.targetTouches && e.targetTouches.length === 1) {\n return true;\n }\n if (\n e.pointerType &&\n e.pointerType !== 'mouse' &&\n e.pointerType !== e.MSPOINTER_TYPE_MOUSE\n ) {\n return true;\n }\n return false;\n }\n\n function touchStart(e) {\n if (!shouldHandle(e)) {\n return;\n }\n\n var touch = getTouch(e);\n\n startOffset.pageX = touch.pageX;\n startOffset.pageY = touch.pageY;\n\n startTime = new Date().getTime();\n\n if (easingLoop !== null) {\n clearInterval(easingLoop);\n }\n }\n\n function shouldBeConsumedByChild(target, deltaX, deltaY) {\n if (!element.contains(target)) {\n return false;\n }\n\n var cursor = target;\n\n while (cursor && cursor !== element) {\n if (cursor.classList.contains(cls.element.consuming)) {\n return true;\n }\n\n var style = get(cursor);\n\n // if deltaY && vertical scrollable\n if (deltaY && style.overflowY.match(/(scroll|auto)/)) {\n var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;\n if (maxScrollTop > 0) {\n if (\n (cursor.scrollTop > 0 && deltaY < 0) ||\n (cursor.scrollTop < maxScrollTop && deltaY > 0)\n ) {\n return true;\n }\n }\n }\n // if deltaX && horizontal scrollable\n if (deltaX && style.overflowX.match(/(scroll|auto)/)) {\n var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth;\n if (maxScrollLeft > 0) {\n if (\n (cursor.scrollLeft > 0 && deltaX < 0) ||\n (cursor.scrollLeft < maxScrollLeft && deltaX > 0)\n ) {\n return true;\n }\n }\n }\n\n cursor = cursor.parentNode;\n }\n\n return false;\n }\n\n function touchMove(e) {\n if (shouldHandle(e)) {\n var touch = getTouch(e);\n\n var currentOffset = { pageX: touch.pageX, pageY: touch.pageY };\n\n var differenceX = currentOffset.pageX - startOffset.pageX;\n var differenceY = currentOffset.pageY - startOffset.pageY;\n\n if (shouldBeConsumedByChild(e.target, differenceX, differenceY)) {\n return;\n }\n\n applyTouchMove(differenceX, differenceY);\n startOffset = currentOffset;\n\n var currentTime = new Date().getTime();\n\n var timeGap = currentTime - startTime;\n if (timeGap > 0) {\n speed.x = differenceX / timeGap;\n speed.y = differenceY / timeGap;\n startTime = currentTime;\n }\n\n if (shouldPrevent(differenceX, differenceY)) {\n e.preventDefault();\n }\n }\n }\n function touchEnd() {\n if (i.settings.swipeEasing) {\n clearInterval(easingLoop);\n easingLoop = setInterval(function() {\n if (i.isInitialized) {\n clearInterval(easingLoop);\n return;\n }\n\n if (!speed.x && !speed.y) {\n clearInterval(easingLoop);\n return;\n }\n\n if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {\n clearInterval(easingLoop);\n return;\n }\n\n applyTouchMove(speed.x * 30, speed.y * 30);\n\n speed.x *= 0.8;\n speed.y *= 0.8;\n }, 10);\n }\n }\n\n if (env.supportsTouch) {\n i.event.bind(element, 'touchstart', touchStart);\n i.event.bind(element, 'touchmove', touchMove);\n i.event.bind(element, 'touchend', touchEnd);\n } else if (env.supportsIePointer) {\n if (window.PointerEvent) {\n i.event.bind(element, 'pointerdown', touchStart);\n i.event.bind(element, 'pointermove', touchMove);\n i.event.bind(element, 'pointerup', touchEnd);\n } else if (window.MSPointerEvent) {\n i.event.bind(element, 'MSPointerDown', touchStart);\n i.event.bind(element, 'MSPointerMove', touchMove);\n i.event.bind(element, 'MSPointerUp', touchEnd);\n }\n }\n}\n\nvar defaultSettings = function () { return ({\n handlers: ['click-rail', 'drag-thumb', 'keyboard', 'wheel', 'touch'],\n maxScrollbarLength: null,\n minScrollbarLength: null,\n scrollingThreshold: 1000,\n scrollXMarginOffset: 0,\n scrollYMarginOffset: 0,\n suppressScrollX: false,\n suppressScrollY: false,\n swipeEasing: true,\n useBothWheelAxes: false,\n wheelPropagation: true,\n wheelSpeed: 1,\n}); };\n\nvar handlers = {\n 'click-rail': clickRail,\n 'drag-thumb': dragThumb,\n keyboard: keyboard,\n wheel: wheel,\n touch: touch,\n};\n\nvar PerfectScrollbar = function PerfectScrollbar(element, userSettings) {\n var this$1 = this;\n if ( userSettings === void 0 ) userSettings = {};\n\n if (typeof element === 'string') {\n element = document.querySelector(element);\n }\n\n if (!element || !element.nodeName) {\n throw new Error('no element is specified to initialize PerfectScrollbar');\n }\n\n this.element = element;\n\n element.classList.add(cls.main);\n\n this.settings = defaultSettings();\n for (var key in userSettings) {\n this.settings[key] = userSettings[key];\n }\n\n this.containerWidth = null;\n this.containerHeight = null;\n this.contentWidth = null;\n this.contentHeight = null;\n\n var focus = function () { return element.classList.add(cls.state.focus); };\n var blur = function () { return element.classList.remove(cls.state.focus); };\n\n this.isRtl = get(element).direction === 'rtl';\n if (this.isRtl === true) {\n element.classList.add(cls.rtl);\n }\n this.isNegativeScroll = (function () {\n var originalScrollLeft = element.scrollLeft;\n var result = null;\n element.scrollLeft = -1;\n result = element.scrollLeft < 0;\n element.scrollLeft = originalScrollLeft;\n return result;\n })();\n this.negativeScrollAdjustment = this.isNegativeScroll\n ? element.scrollWidth - element.clientWidth\n : 0;\n this.event = new EventManager();\n this.ownerDocument = element.ownerDocument || document;\n\n this.scrollbarXRail = div(cls.element.rail('x'));\n element.appendChild(this.scrollbarXRail);\n this.scrollbarX = div(cls.element.thumb('x'));\n this.scrollbarXRail.appendChild(this.scrollbarX);\n this.scrollbarX.setAttribute('tabindex', 0);\n this.event.bind(this.scrollbarX, 'focus', focus);\n this.event.bind(this.scrollbarX, 'blur', blur);\n this.scrollbarXActive = null;\n this.scrollbarXWidth = null;\n this.scrollbarXLeft = null;\n var railXStyle = get(this.scrollbarXRail);\n this.scrollbarXBottom = parseInt(railXStyle.bottom, 10);\n if (isNaN(this.scrollbarXBottom)) {\n this.isScrollbarXUsingBottom = false;\n this.scrollbarXTop = toInt(railXStyle.top);\n } else {\n this.isScrollbarXUsingBottom = true;\n }\n this.railBorderXWidth =\n toInt(railXStyle.borderLeftWidth) + toInt(railXStyle.borderRightWidth);\n // Set rail to display:block to calculate margins\n set(this.scrollbarXRail, { display: 'block' });\n this.railXMarginWidth =\n toInt(railXStyle.marginLeft) + toInt(railXStyle.marginRight);\n set(this.scrollbarXRail, { display: '' });\n this.railXWidth = null;\n this.railXRatio = null;\n\n this.scrollbarYRail = div(cls.element.rail('y'));\n element.appendChild(this.scrollbarYRail);\n this.scrollbarY = div(cls.element.thumb('y'));\n this.scrollbarYRail.appendChild(this.scrollbarY);\n this.scrollbarY.setAttribute('tabindex', 0);\n this.event.bind(this.scrollbarY, 'focus', focus);\n this.event.bind(this.scrollbarY, 'blur', blur);\n this.scrollbarYActive = null;\n this.scrollbarYHeight = null;\n this.scrollbarYTop = null;\n var railYStyle = get(this.scrollbarYRail);\n this.scrollbarYRight = parseInt(railYStyle.right, 10);\n if (isNaN(this.scrollbarYRight)) {\n this.isScrollbarYUsingRight = false;\n this.scrollbarYLeft = toInt(railYStyle.left);\n } else {\n this.isScrollbarYUsingRight = true;\n }\n this.scrollbarYOuterWidth = this.isRtl ? outerWidth(this.scrollbarY) : null;\n this.railBorderYWidth =\n toInt(railYStyle.borderTopWidth) + toInt(railYStyle.borderBottomWidth);\n set(this.scrollbarYRail, { display: 'block' });\n this.railYMarginHeight =\n toInt(railYStyle.marginTop) + toInt(railYStyle.marginBottom);\n set(this.scrollbarYRail, { display: '' });\n this.railYHeight = null;\n this.railYRatio = null;\n\n this.reach = {\n x:\n element.scrollLeft <= 0\n ? 'start'\n : element.scrollLeft >= this.contentWidth - this.containerWidth\n ? 'end'\n : null,\n y:\n element.scrollTop <= 0\n ? 'start'\n : element.scrollTop >= this.contentHeight - this.containerHeight\n ? 'end'\n : null,\n };\n\n this.isAlive = true;\n\n this.settings.handlers.forEach(function (handlerName) { return handlers[handlerName](this$1); });\n\n this.lastScrollTop = Math.floor(element.scrollTop); // for onScroll only\n this.lastScrollLeft = element.scrollLeft; // for onScroll only\n this.event.bind(this.element, 'scroll', function (e) { return this$1.onScroll(e); });\n updateGeometry(this);\n};\n\nPerfectScrollbar.prototype.update = function update () {\n if (!this.isAlive) {\n return;\n }\n\n // Recalcuate negative scrollLeft adjustment\n this.negativeScrollAdjustment = this.isNegativeScroll\n ? this.element.scrollWidth - this.element.clientWidth\n : 0;\n\n // Recalculate rail margins\n set(this.scrollbarXRail, { display: 'block' });\n set(this.scrollbarYRail, { display: 'block' });\n this.railXMarginWidth =\n toInt(get(this.scrollbarXRail).marginLeft) +\n toInt(get(this.scrollbarXRail).marginRight);\n this.railYMarginHeight =\n toInt(get(this.scrollbarYRail).marginTop) +\n toInt(get(this.scrollbarYRail).marginBottom);\n\n // Hide scrollbars not to affect scrollWidth and scrollHeight\n set(this.scrollbarXRail, { display: 'none' });\n set(this.scrollbarYRail, { display: 'none' });\n\n updateGeometry(this);\n\n processScrollDiff(this, 'top', 0, false, true);\n processScrollDiff(this, 'left', 0, false, true);\n\n set(this.scrollbarXRail, { display: '' });\n set(this.scrollbarYRail, { display: '' });\n};\n\nPerfectScrollbar.prototype.onScroll = function onScroll (e) {\n if (!this.isAlive) {\n return;\n }\n\n updateGeometry(this);\n processScrollDiff(this, 'top', this.element.scrollTop - this.lastScrollTop);\n processScrollDiff(\n this,\n 'left',\n this.element.scrollLeft - this.lastScrollLeft\n );\n\n this.lastScrollTop = Math.floor(this.element.scrollTop);\n this.lastScrollLeft = this.element.scrollLeft;\n};\n\nPerfectScrollbar.prototype.destroy = function destroy () {\n if (!this.isAlive) {\n return;\n }\n\n this.event.unbindAll();\n remove(this.scrollbarX);\n remove(this.scrollbarY);\n remove(this.scrollbarXRail);\n remove(this.scrollbarYRail);\n this.removePsClasses();\n\n // unset elements\n this.element = null;\n this.scrollbarX = null;\n this.scrollbarY = null;\n this.scrollbarXRail = null;\n this.scrollbarYRail = null;\n\n this.isAlive = false;\n};\n\nPerfectScrollbar.prototype.removePsClasses = function removePsClasses () {\n this.element.className = this.element.className\n .split(' ')\n .filter(function (name) { return !name.match(/^ps([-_].+|)$/); })\n .join(' ');\n};\n\nexport default PerfectScrollbar;\n//# sourceMappingURL=perfect-scrollbar.esm.js.map\n","function select(element) {\n var selectedText;\n\n if (element.nodeName === 'SELECT') {\n element.focus();\n\n selectedText = element.value;\n }\n else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {\n var isReadOnly = element.hasAttribute('readonly');\n\n if (!isReadOnly) {\n element.setAttribute('readonly', '');\n }\n\n element.select();\n element.setSelectionRange(0, element.value.length);\n\n if (!isReadOnly) {\n element.removeAttribute('readonly');\n }\n\n selectedText = element.value;\n }\n else {\n if (element.hasAttribute('contenteditable')) {\n element.focus();\n }\n\n var selection = window.getSelection();\n var range = document.createRange();\n\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n\n selectedText = selection.toString();\n }\n\n return selectedText;\n}\n\nmodule.exports = select;\n","(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', 'select'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('select'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.select);\n global.clipboardAction = mod.exports;\n }\n})(this, function (module, _select) {\n 'use strict';\n\n var _select2 = _interopRequireDefault(_select);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n\n var ClipboardAction = function () {\n /**\n * @param {Object} options\n */\n function ClipboardAction(options) {\n _classCallCheck(this, ClipboardAction);\n\n this.resolveOptions(options);\n this.initSelection();\n }\n\n /**\n * Defines base properties passed from constructor.\n * @param {Object} options\n */\n\n\n _createClass(ClipboardAction, [{\n key: 'resolveOptions',\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.action = options.action;\n this.container = options.container;\n this.emitter = options.emitter;\n this.target = options.target;\n this.text = options.text;\n this.trigger = options.trigger;\n\n this.selectedText = '';\n }\n }, {\n key: 'initSelection',\n value: function initSelection() {\n if (this.text) {\n this.selectFake();\n } else if (this.target) {\n this.selectTarget();\n }\n }\n }, {\n key: 'selectFake',\n value: function selectFake() {\n var _this = this;\n\n var isRTL = document.documentElement.getAttribute('dir') == 'rtl';\n\n this.removeFake();\n\n this.fakeHandlerCallback = function () {\n return _this.removeFake();\n };\n this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;\n\n this.fakeElem = document.createElement('textarea');\n // Prevent zooming on iOS\n this.fakeElem.style.fontSize = '12pt';\n // Reset box model\n this.fakeElem.style.border = '0';\n this.fakeElem.style.padding = '0';\n this.fakeElem.style.margin = '0';\n // Move element out of screen horizontally\n this.fakeElem.style.position = 'absolute';\n this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';\n // Move element to the same position vertically\n var yPosition = window.pageYOffset || document.documentElement.scrollTop;\n this.fakeElem.style.top = yPosition + 'px';\n\n this.fakeElem.setAttribute('readonly', '');\n this.fakeElem.value = this.text;\n\n this.container.appendChild(this.fakeElem);\n\n this.selectedText = (0, _select2.default)(this.fakeElem);\n this.copyText();\n }\n }, {\n key: 'removeFake',\n value: function removeFake() {\n if (this.fakeHandler) {\n this.container.removeEventListener('click', this.fakeHandlerCallback);\n this.fakeHandler = null;\n this.fakeHandlerCallback = null;\n }\n\n if (this.fakeElem) {\n this.container.removeChild(this.fakeElem);\n this.fakeElem = null;\n }\n }\n }, {\n key: 'selectTarget',\n value: function selectTarget() {\n this.selectedText = (0, _select2.default)(this.target);\n this.copyText();\n }\n }, {\n key: 'copyText',\n value: function copyText() {\n var succeeded = void 0;\n\n try {\n succeeded = document.execCommand(this.action);\n } catch (err) {\n succeeded = false;\n }\n\n this.handleResult(succeeded);\n }\n }, {\n key: 'handleResult',\n value: function handleResult(succeeded) {\n this.emitter.emit(succeeded ? 'success' : 'error', {\n action: this.action,\n text: this.selectedText,\n trigger: this.trigger,\n clearSelection: this.clearSelection.bind(this)\n });\n }\n }, {\n key: 'clearSelection',\n value: function clearSelection() {\n if (this.trigger) {\n this.trigger.focus();\n }\n\n window.getSelection().removeAllRanges();\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.removeFake();\n }\n }, {\n key: 'action',\n set: function set() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';\n\n this._action = action;\n\n if (this._action !== 'copy' && this._action !== 'cut') {\n throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n }\n },\n get: function get() {\n return this._action;\n }\n }, {\n key: 'target',\n set: function set(target) {\n if (target !== undefined) {\n if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {\n if (this.action === 'copy' && target.hasAttribute('disabled')) {\n throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n }\n\n if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n }\n\n this._target = target;\n } else {\n throw new Error('Invalid \"target\" value, use a valid Element');\n }\n }\n },\n get: function get() {\n return this._target;\n }\n }]);\n\n return ClipboardAction;\n }();\n\n module.exports = ClipboardAction;\n});","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\n","/**\n * Check if argument is a HTML element.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.node = function(value) {\n return value !== undefined\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Check if argument is a list of HTML elements.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.nodeList = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return value !== undefined\n && (type === '[object NodeList]' || type === '[object HTMLCollection]')\n && ('length' in value)\n && (value.length === 0 || exports.node(value[0]));\n};\n\n/**\n * Check if argument is a string.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.string = function(value) {\n return typeof value === 'string'\n || value instanceof String;\n};\n\n/**\n * Check if argument is a function.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.fn = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return type === '[object Function]';\n};\n","var DOCUMENT_NODE_TYPE = 9;\n\n/**\n * A polyfill for Element.matches()\n */\nif (typeof Element !== 'undefined' && !Element.prototype.matches) {\n var proto = Element.prototype;\n\n proto.matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector;\n}\n\n/**\n * Finds the closest parent that matches a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @return {Function}\n */\nfunction closest (element, selector) {\n while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {\n if (typeof element.matches === 'function' &&\n element.matches(selector)) {\n return element;\n }\n element = element.parentNode;\n }\n}\n\nmodule.exports = closest;\n","var closest = require('./closest');\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction delegate(element, selector, type, callback, useCapture) {\n var listenerFn = listener.apply(this, arguments);\n\n element.addEventListener(type, listenerFn, useCapture);\n\n return {\n destroy: function() {\n element.removeEventListener(type, listenerFn, useCapture);\n }\n }\n}\n\n/**\n * Finds closest match and invokes callback.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Function}\n */\nfunction listener(element, selector, type, callback) {\n return function(e) {\n e.delegateTarget = closest(e.target, selector);\n\n if (e.delegateTarget) {\n callback.call(element, e);\n }\n }\n}\n\nmodule.exports = delegate;\n","var is = require('./is');\nvar delegate = require('delegate');\n\n/**\n * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n if (!target && !type && !callback) {\n throw new Error('Missing required arguments');\n }\n\n if (!is.string(type)) {\n throw new TypeError('Second argument must be a String');\n }\n\n if (!is.fn(callback)) {\n throw new TypeError('Third argument must be a Function');\n }\n\n if (is.node(target)) {\n return listenNode(target, type, callback);\n }\n else if (is.nodeList(target)) {\n return listenNodeList(target, type, callback);\n }\n else if (is.string(target)) {\n return listenSelector(target, type, callback);\n }\n else {\n throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n }\n}\n\n/**\n * Adds an event listener to a HTML element\n * and returns a remove listener function.\n *\n * @param {HTMLElement} node\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNode(node, type, callback) {\n node.addEventListener(type, callback);\n\n return {\n destroy: function() {\n node.removeEventListener(type, callback);\n }\n }\n}\n\n/**\n * Add an event listener to a list of HTML elements\n * and returns a remove listener function.\n *\n * @param {NodeList|HTMLCollection} nodeList\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNodeList(nodeList, type, callback) {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.addEventListener(type, callback);\n });\n\n return {\n destroy: function() {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.removeEventListener(type, callback);\n });\n }\n }\n}\n\n/**\n * Add an event listener to a selector\n * and returns a remove listener function.\n *\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenSelector(selector, type, callback) {\n return delegate(document.body, selector, type, callback);\n}\n\nmodule.exports = listen;\n","(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);\n global.clipboard = mod.exports;\n }\n})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {\n 'use strict';\n\n var _clipboardAction2 = _interopRequireDefault(_clipboardAction);\n\n var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);\n\n var _goodListener2 = _interopRequireDefault(_goodListener);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n\n function _possibleConstructorReturn(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n }\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n }\n\n var Clipboard = function (_Emitter) {\n _inherits(Clipboard, _Emitter);\n\n /**\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n * @param {Object} options\n */\n function Clipboard(trigger, options) {\n _classCallCheck(this, Clipboard);\n\n var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));\n\n _this.resolveOptions(options);\n _this.listenClick(trigger);\n return _this;\n }\n\n /**\n * Defines if attributes would be resolved using internal setter functions\n * or custom functions that were passed in the constructor.\n * @param {Object} options\n */\n\n\n _createClass(Clipboard, [{\n key: 'resolveOptions',\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.action = typeof options.action === 'function' ? options.action : this.defaultAction;\n this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;\n this.text = typeof options.text === 'function' ? options.text : this.defaultText;\n this.container = _typeof(options.container) === 'object' ? options.container : document.body;\n }\n }, {\n key: 'listenClick',\n value: function listenClick(trigger) {\n var _this2 = this;\n\n this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {\n return _this2.onClick(e);\n });\n }\n }, {\n key: 'onClick',\n value: function onClick(e) {\n var trigger = e.delegateTarget || e.currentTarget;\n\n if (this.clipboardAction) {\n this.clipboardAction = null;\n }\n\n this.clipboardAction = new _clipboardAction2.default({\n action: this.action(trigger),\n target: this.target(trigger),\n text: this.text(trigger),\n container: this.container,\n trigger: trigger,\n emitter: this\n });\n }\n }, {\n key: 'defaultAction',\n value: function defaultAction(trigger) {\n return getAttributeValue('action', trigger);\n }\n }, {\n key: 'defaultTarget',\n value: function defaultTarget(trigger) {\n var selector = getAttributeValue('target', trigger);\n\n if (selector) {\n return document.querySelector(selector);\n }\n }\n }, {\n key: 'defaultText',\n value: function defaultText(trigger) {\n return getAttributeValue('text', trigger);\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.listener.destroy();\n\n if (this.clipboardAction) {\n this.clipboardAction.destroy();\n this.clipboardAction = null;\n }\n }\n }], [{\n key: 'isSupported',\n value: function isSupported() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];\n\n var actions = typeof action === 'string' ? [action] : action;\n var support = !!document.queryCommandSupported;\n\n actions.forEach(function (action) {\n support = support && !!document.queryCommandSupported(action);\n });\n\n return support;\n }\n }]);\n\n return Clipboard;\n }(_tinyEmitter2.default);\n\n /**\n * Helper function to retrieve attribute value.\n * @param {String} suffix\n * @param {Element} element\n */\n function getAttributeValue(suffix, element) {\n var attribute = 'data-clipboard-' + suffix;\n\n if (!element.hasAttribute(attribute)) {\n return;\n }\n\n return element.getAttribute(attribute);\n }\n\n module.exports = Clipboard;\n});","import PerfectScrollbar from 'perfect-scrollbar'\nimport Clipboard from 'clipboard'\nimport Constants from '../configuration/Constants'\n\n/**\n * Smart guide\n * @typedef {Object} SmartGuide\n * @property {Editor} editor - A reference to the current editor.\n * @property {String} wordToChange - Word to change following a click on a word.\n * @property {String} lastWord - Keep the last word of the previous export to compare with the new and scroll if it's different.\n * @property {String} previousLabelExport - Keep the previous label export to know if we should repopulate the prompter text.\n * @property {PerfectScrollbar} perfectScrollbar - Perfect Scrollbar used to get gestures from smart guide using touch-action none anyway and get scrolling too.\n * @property {Object} elements - All the HTML elements of the smart guide.\n * @property {Number} smartGuideTimeOutId - Id of the setTimeOut from fade out animation to clear.\n * @property {String} randomString - Random string used in case of multiple smart guide.\n */\n\n/**\n * Create all the smart guide HTML elements.\n */\nfunction createHTMLElements (randomString) {\n /**\n * The smart guide element.\n * @type {HTMLDivElement}\n */\n const smartGuideElement = document.createElement('div')\n smartGuideElement.id = 'smartguide' + randomString\n smartGuideElement.classList.add('smartguide')\n\n /**\n * The prompter text element that contains the text to get the overflow working.\n * @type {HTMLDivElement}\n */\n const textElement = document.createElement('div')\n textElement.id = 'prompter-text' + randomString\n textElement.classList.add('prompter-text')\n textElement.setAttribute('touch-action', 'none')\n\n /**\n * The text container element that contains the text element.\n * @type {HTMLDivElement}\n */\n const textContainer = document.createElement('div')\n textContainer.id = 'prompter-text-container' + randomString\n textContainer.classList.add('prompter-text-container')\n textContainer.appendChild(textElement)\n\n /**\n * The actions menu represented by the ellipsis character.\n * @type {HTMLDivElement}\n */\n const ellipsisElement = document.createElement('div')\n ellipsisElement.id = 'ellipsis' + randomString\n ellipsisElement.classList.add('ellipsis')\n ellipsisElement.innerHTML = '...'\n\n /**\n * The tag element.\n * @type {HTMLDivElement}\n */\n const tagElement = document.createElement('div')\n tagElement.id = 'tag-icon' + randomString\n tagElement.classList.add('tag-icon')\n tagElement.innerHTML = '¶'\n\n /**\n * The candidates element that contains the candidates for a word.\n * @type {HTMLDivElement}\n */\n const candidatesElement = document.createElement('div')\n candidatesElement.id = 'candidates' + randomString\n candidatesElement.classList.add('candidates')\n\n /**\n * The menu element that contains the actions.\n * @type {HTMLDivElement}\n */\n const menuElement = document.createElement('div')\n menuElement.id = 'more-menu' + randomString\n menuElement.classList.add('more-menu')\n\n /**\n * The convert button from actions menu.\n * @type {HTMLButtonElement}\n */\n const convertElement = document.createElement('button')\n convertElement.classList.add('options-label-button')\n convertElement.id = 'convert' + randomString\n convertElement.innerHTML = 'Convert'\n\n /**\n * The copy button from actions menu.\n * @type {HTMLButtonElement}\n */\n const copyElement = document.createElement('button')\n copyElement.classList.add('options-label-button')\n copyElement.id = 'copy' + randomString\n copyElement.innerHTML = 'Copy'\n\n /**\n * The delete button from actions menu.\n * @type {HTMLButtonElement}\n */\n const deleteElement = document.createElement('button')\n deleteElement.classList.add('options-label-button')\n deleteElement.id = 'delete' + randomString\n deleteElement.innerHTML = 'Delete'\n\n return {\n smartGuideElement,\n textElement,\n textContainer,\n candidatesElement,\n menuElement,\n tagElement,\n ellipsisElement,\n convertElement,\n copyElement,\n deleteElement\n }\n}\n\n/**\n * Check if node is in shadow dom\n * @param {Node} node - A node element.\n * @returns {boolean} true if is in shadow dom, false otherwise.\n */\nfunction isInShadow (node) {\n let parent = (node && node.parentNode)\n while (parent) {\n if (parent.toString() === '[object ShadowRoot]') {\n return true\n }\n parent = parent.parentNode\n }\n return false\n}\n\n/**\n * Show the actions of the action menu.\n * @param {Event} evt - Event used to insert the option div using the event's target.\n * @param {Object} elements - All the elements of the smart guide.\n * @param {SmartGuide} smartGuide\n */\nfunction showActions (evt, elements) {\n const elementsRef = elements\n\n const insertActions = () => {\n elementsRef.menuElement.appendChild(elementsRef.convertElement)\n elementsRef.menuElement.appendChild(elementsRef.copyElement)\n elementsRef.menuElement.appendChild(elementsRef.deleteElement)\n\n const parent = evt.target.parentNode\n parent.insertBefore(elementsRef.menuElement, evt.target)\n }\n\n const positionActions = () => {\n // 48 to get the boundary of smart guide element.\n const left = evt.target.offsetLeft - 68\n elementsRef.menuElement.style.left = `${left}px`\n }\n\n const isMenuInDocument = document.contains(elementsRef.menuElement)\n if (!isInShadow(elementsRef.menuElement) && !isMenuInDocument) {\n elementsRef.menuElement.style.display = 'flex'\n positionActions()\n insertActions()\n } else if (elementsRef.menuElement.style.display === 'none') {\n positionActions()\n elementsRef.menuElement.style.display = 'flex'\n }\n}\n\n/**\n * Show the candidates of the clicked word.\n * @param {Event} evt - Event used to determine the clicked word.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction showCandidates (evt, editor, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n if (evt.target.id !== `prompter-text${smartGuide.randomString}`) {\n const id = evt.target.id.replace('word-', '').replace(smartGuide.randomString, '')\n const words = JSON.parse(editor.exports[Constants.Exports.JIIX]).words\n smartGuideRef.wordToChange = words[id]\n smartGuideRef.wordToChange.id = id\n elementsRef.candidatesElement.innerHTML = ''\n if (smartGuideRef.wordToChange && smartGuideRef.wordToChange.candidates) {\n elementsRef.candidatesElement.style.display = 'flex'\n smartGuideRef.wordToChange.candidates.forEach((word, index) => {\n if (smartGuideRef.wordToChange.label === word) {\n elementsRef.candidatesElement.innerHTML += `${word}`\n } else {\n elementsRef.candidatesElement.innerHTML += `${word}`\n }\n })\n // get the parent parent of word to insert just before smart guide, 48 to get the boundary of smart guide element.\n const top = 48\n const left = evt.target.getBoundingClientRect().left - 60\n elementsRef.candidatesElement.style.top = `${top}px`\n elementsRef.candidatesElement.style.left = `${left}px`\n\n const parent = evt.target.parentNode.parentNode.parentNode\n parent.insertBefore(elementsRef.candidatesElement, evt.target.parentNode.parentNode)\n }\n }\n}\n\n/**\n * Call the import_ function of the editor to import the modified Jiix with the new label.\n * @param {Event} evt - Event to determine the clicked candidate.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction clickCandidate (evt, editor, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n const candidate = evt.target.innerText\n\n if (candidate !== smartGuideRef.wordToChange.label && smartGuideRef.wordToChange.candidates.includes(candidate)) {\n const jiixToImport = JSON.parse(editor.exports[Constants.Exports.JIIX])\n jiixToImport.words[smartGuideRef.wordToChange.id].label = candidate\n // eslint-disable-next-line no-underscore-dangle\n editor.import_(JSON.stringify(jiixToImport), Constants.Exports.JIIX)\n }\n elementsRef.candidatesElement.style.display = 'none'\n}\n\n/**\n * Add the listeners to the smart guide elements.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction addListeners (editor, smartGuide) {\n const elementsRef = smartGuide.elements\n\n elementsRef.textElement.addEventListener('click', evt => showCandidates(evt, editor, smartGuide))\n elementsRef.candidatesElement.addEventListener('click', evt => clickCandidate(evt, editor, smartGuide))\n elementsRef.ellipsisElement.addEventListener('click', evt => showActions(evt, elementsRef))\n elementsRef.copyElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n })\n elementsRef.convertElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n editor.convert()\n })\n elementsRef.deleteElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n editor.clear()\n })\n}\n\n/**\n * Call mutation observer to trigger fade out animation.\n * @param {number} [duration=10000] - the duration in milliseconds before calling the fade out animation.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction callFadeOutObserver (duration = 10000, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n // eslint-disable-next-line no-undef\n const observer = new MutationObserver((mutations) => {\n mutations.forEach(() => {\n if (smartGuideRef.smartGuideTimeOutId) {\n clearTimeout(smartGuideRef.smartGuideTimeOutId)\n }\n if (elementsRef.candidatesElement.style.display === 'none' && elementsRef.menuElement.style.display === 'none') {\n smartGuideRef.smartGuideTimeOutId = setTimeout(() => {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }, duration)\n } else if (!document.contains(elementsRef.candidatesElement) && !document.contains(elementsRef.menuElement)) {\n smartGuideRef.smartGuideTimeOutId = setTimeout(() => {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }, duration)\n }\n })\n })\n observer.observe(elementsRef.smartGuideElement, { childList: true, subtree: true, attributes: true })\n}\n\n/**\n * Insert the smart guide HTML elements in the DOM.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction insertSmartGuide (smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const insertSmartGuideElement = (left, top) => {\n elementsRef.smartGuideElement.style.top = `${top}px`\n elementsRef.smartGuideElement.style.left = `${left}px`\n elementsRef.smartGuideElement.style.visibility = 'hidden'\n\n const parent = smartGuideRef.editor.domElement\n parent.insertBefore(elementsRef.smartGuideElement, smartGuideRef.editor.loader)\n }\n const insertTag = () => {\n elementsRef.smartGuideElement.appendChild(elementsRef.tagElement)\n }\n const insertTextContainer = (left, maxWidth) => {\n elementsRef.textContainer.style.left = `${left}px`\n\n // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px)\n elementsRef.textContainer.style.width = `${maxWidth}px`\n elementsRef.textContainer.style.maxWidth = `${maxWidth}px`\n\n elementsRef.smartGuideElement.appendChild(elementsRef.textContainer)\n }\n const insertEllipsis = (left) => {\n elementsRef.ellipsisElement.style.left = `${left}px`\n\n elementsRef.smartGuideElement.appendChild(elementsRef.ellipsisElement)\n }\n\n // FIXME Use value from contentChanged when available\n\n const mmToPixels = 3.779527559\n\n const marginTop = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.top * mmToPixels\n const marginLeft = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels\n\n // 12 is the space between line in mm\n const top = marginTop - (12 * mmToPixels)\n let left = marginLeft\n\n insertSmartGuideElement(left, top)\n insertTag()\n\n // 35 is the ellipsis element width\n const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left\n left = elementsRef.tagElement.offsetWidth\n insertTextContainer(left, maxWidthTextContainer)\n\n left += maxWidthTextContainer\n insertEllipsis(left)\n\n elementsRef.menuElement.style.display = 'none'\n elementsRef.menuElement.appendChild(elementsRef.convertElement)\n elementsRef.menuElement.appendChild(elementsRef.copyElement)\n elementsRef.menuElement.appendChild(elementsRef.deleteElement)\n elementsRef.smartGuideElement.appendChild(elementsRef.menuElement)\n\n elementsRef.candidatesElement.style.display = 'none'\n elementsRef.smartGuideElement.appendChild(elementsRef.candidatesElement)\n\n // 48px as set in css\n elementsRef.smartGuideElement.style.height = '48px'\n elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px`\n smartGuideRef.perfectScrollbar.update()\n}\n\n/**\n * Create a new smart guide\n * @param {Editor} editor - A reference to the editor.\n * @returns {SmartGuide} New smart guide\n */\nexport function createSmartGuide (editor) {\n const randomString = '-' + Math.random().toString(10).substring(2, 12)\n const elements = createHTMLElements(randomString)\n\n /**\n * Clipboard from clipboard.js used to get copy across all browsers.\n * @type {Clipboard}\n */\n // eslint-disable-next-line no-unused-vars\n const clipboard = new Clipboard(elements.copyElement)\n const perfectScrollbar = new PerfectScrollbar(elements.textContainer, { suppressScrollY: true, scrollXMarginOffset: 1 })\n\n const smartGuide = {\n editor,\n wordToChange: '',\n lastWord: '',\n previousLabelExport: ' ',\n perfectScrollbar,\n elements,\n smartGuideTimeOutId: 0,\n randomString\n }\n addListeners(editor, smartGuide)\n\n if (editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable) {\n callFadeOutObserver(editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration, smartGuide)\n }\n\n return smartGuide\n}\n\nexport function resize (smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const mmToPixels = 3.779527559\n let left = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels\n\n const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left\n\n // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px)\n elementsRef.textContainer.style.width = `${maxWidthTextContainer}px`\n elementsRef.textContainer.style.maxWidth = `${maxWidthTextContainer}px`\n\n left = elementsRef.tagElement.offsetWidth\n left += maxWidthTextContainer\n elementsRef.ellipsisElement.style.left = `${left}px`\n\n elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px`\n smartGuideRef.perfectScrollbar.update()\n}\n\n/**\n * Launch the smartguide.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n * @param {Object} exports - The export from the editor.\n */\nexport function launchSmartGuide (smartGuide, exports) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const isSmartGuideInDocument = document.contains(elementsRef.smartGuideElement)\n\n if (!isInShadow(elementsRef.smartGuideElement) && !isSmartGuideInDocument) {\n insertSmartGuide(smartGuide)\n }\n\n const addAnimationToModifiedWord = (words) => {\n if (smartGuideRef.tempWords && smartGuideRef.tempWords.length === words.length) {\n const labelWordsArray = words.map(word => word.label)\n const tempLabelWordsArray = smartGuideRef.tempWords.map(word => word.label)\n const wordChangedId = labelWordsArray.indexOf(labelWordsArray.filter(a => tempLabelWordsArray.indexOf(a) === -1)[0])\n if (document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`) && wordChangedId > -1) {\n document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`).classList.add('modified-word')\n elementsRef.textContainer.scrollLeft = document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`).offsetLeft - 10\n }\n }\n smartGuideRef.tempWords = JSON.parse(exports[Constants.Exports.JIIX]).words\n }\n\n const createWordSpan = (empty, index, word) => {\n const span = document.createElement('span')\n span.id = `word-${index}${smartGuide.randomString}`\n if (empty) {\n span.innerHTML = ' '\n } else {\n span.textContent = word.label\n }\n return span\n }\n\n // Possible optimisation ? Check if we can find a way to not repopulate the smartguide every time even if we now use Document fragment\n const populatePrompter = (words) => {\n elementsRef.textElement.innerHTML = ''\n // We use a DocumentFragment to reflow the DOM only one time as it is not part of the DOM\n const myFragment = document.createDocumentFragment()\n words.forEach((word, index) => {\n if (word.label === ' ' || word.label.includes('\\n')) {\n myFragment.appendChild(createWordSpan(true, index))\n } else if (index !== words.length - 1) {\n myFragment.appendChild(createWordSpan(false, index, word))\n } else {\n elementsRef.textElement.appendChild(myFragment)\n smartGuideRef.perfectScrollbar.update()\n if (smartGuideRef.lastWord === '') {\n smartGuideRef.lastWord = word\n }\n const span = createWordSpan(false, index, word)\n // This is used to scroll to last word if last word is modified\n if ((smartGuideRef.lastWord.candidates !== word.candidates) && (smartGuideRef.lastWord.label !== word.label)) {\n span.classList.add('added-word')\n elementsRef.textElement.appendChild(span)\n elementsRef.textContainer.scrollLeft = span.offsetLeft\n smartGuideRef.lastWord = word\n } else {\n elementsRef.textElement.appendChild(span)\n elementsRef.textContainer.scrollLeft = span.offsetLeft\n }\n }\n })\n }\n\n if (exports && JSON.parse(exports[Constants.Exports.JIIX]).words.length > 0) {\n elementsRef.smartGuideElement.classList.add('smartguide-in')\n elementsRef.smartGuideElement.classList.remove('smartguide-out')\n elementsRef.candidatesElement.style.display = 'none'\n elementsRef.menuElement.style.display = 'none'\n if (smartGuideRef.previousLabelExport && smartGuideRef.previousLabelExport !== JSON.parse(exports[Constants.Exports.JIIX]).label) {\n const words = JSON.parse(exports[Constants.Exports.JIIX]).words\n populatePrompter(words)\n addAnimationToModifiedWord(words)\n }\n smartGuideRef.previousLabelExport = JSON.parse(exports[Constants.Exports.JIIX]).label\n // This is required by clipboard.js to get the text to be copied.\n elementsRef.copyElement.setAttribute('data-clipboard-text', JSON.parse(exports[Constants.Exports.JIIX]).label)\n } else {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }\n\n return smartGuideRef\n}\n\nexport function reset (smartGuide) {\n const elementsRef = smartGuide.elements\n elementsRef.candidatesElement.innerHTML = ''\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n}\n","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Undo/redo context\n * @typedef {Object} UndoRedoContext\n * @property {Array} stack=[] List of processed models.\n * @property {Number} currentPosition=-1 Current model index into the stack.\n * @property {Number} maxSize Max size of the stack.\n * @property {Boolean} canUndo=false\n * @property {Boolean} canRedo=false\n */\n\n/**\n * Create a new undo/redo context\n * @param {Configuration} configuration Current configuration\n * @return {UndoRedoContext} New undo/redo context\n */\nexport function createUndoRedoContext (configuration) {\n return {\n stack: [],\n currentPosition: -1,\n maxSize: configuration.undoRedoMaxStackSize,\n canUndo: false,\n canRedo: false\n }\n}\n\n/**\n * Update the undo/redo state\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context\n * @return {UndoRedoContext} Updated undo/redo context\n */\nexport function updateUndoRedoState (undoRedoContext) {\n const undoRedoContextRef = undoRedoContext\n undoRedoContextRef.canUndo = undoRedoContext.currentPosition > 0\n undoRedoContextRef.canRedo = undoRedoContext.currentPosition < (undoRedoContext.stack.length - 1)\n return undoRedoContextRef\n}\n","import * as InkModel from '../model/InkModel'\nimport * as UndoRedoContext from '../model/UndoRedoContext'\nimport { modelLogger as logger } from '../configuration/LoggerConfig'\nimport Constants from '../configuration/Constants'\n\n/**\n * Undo/redo manager\n * @typedef {Object} UndoRedoManager\n * @property {function} updateModel Push the current model into the undo/redo context.\n * @property {function} undo Undo.\n * @property {function} redo Redo.\n * @property {function} clear Clear.\n */\n\n/**\n * Get current model in stack\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context\n * @param {Boolean} [clone=true] Whether or not to clone the model\n * @param {...String} types\n */\nexport function getModel (undoRedoContext, clone = true, ...types) {\n const model = undoRedoContext.stack[undoRedoContext.currentPosition]\n const val = {\n res: clone ? InkModel.cloneModel(model) : model,\n types\n }\n return Promise.resolve(val)\n}\n\n/**\n * Mutate the undoRedo stack by adding a new model to it.\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function updateModel (undoRedoContext, model) {\n // Used to update the model with the recognition result if relevant\n const modelIndex = undoRedoContext.stack.findIndex(item => (item.modificationTime === model.modificationTime) && (item.rawStrokes.length === model.rawStrokes.length))\n\n const modelReference = model\n modelReference.modificationTime = new Date().getTime()\n\n const types = []\n if (modelIndex > -1) {\n undoRedoContext.stack.splice(modelIndex, 1, InkModel.cloneModel(modelReference))\n logger.debug('model updated', modelReference)\n } else {\n const undoRedoContextReference = undoRedoContext\n undoRedoContextReference.currentPosition += 1\n undoRedoContextReference.stack = undoRedoContextReference.stack.slice(0, undoRedoContextReference.currentPosition)\n undoRedoContextReference.stack.push(InkModel.cloneModel(modelReference))\n if (undoRedoContextReference.stack.length > undoRedoContextReference.maxSize) {\n undoRedoContextReference.stack.shift()\n undoRedoContextReference.currentPosition--\n }\n logger.debug('model pushed', modelReference)\n types.push(Constants.EventType.CHANGED)\n }\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('undo/redo stack updated', undoRedoContext)\n return getModel(undoRedoContext, false, ...types)\n}\n\n/**\n * Undo\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function undo (undoRedoContext, model) {\n const undoRedoContextReference = undoRedoContext\n if (undoRedoContextReference.currentPosition > 0) {\n undoRedoContextReference.currentPosition -= 1\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('undo index', undoRedoContextReference.currentPosition)\n }\n return getModel(undoRedoContext, true, Constants.EventType.CHANGED, Constants.EventType.EXPORTED)\n}\n\n/**\n * Redo\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function redo (undoRedoContext, model) {\n const undoRedoContextReference = undoRedoContext\n if (undoRedoContextReference.currentPosition < undoRedoContextReference.stack.length - 1) {\n undoRedoContextReference.currentPosition += 1\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('redo index', undoRedoContextReference.currentPosition)\n }\n return getModel(undoRedoContext, true, Constants.EventType.CHANGED, Constants.EventType.EXPORTED)\n}\n","import { drawModel } from './CanvasRenderer'\nimport * as InkModel from '../../model/InkModel'\n\nfunction createCanvas (borderCoordinates, margin = 10) {\n // eslint-disable-next-line no-undef\n const browserDocument = document\n const canvas = browserDocument.createElement('canvas')\n canvas.width = Math.abs(borderCoordinates.maxX - borderCoordinates.minX) + (2 * margin)\n canvas.style.width = `${canvas.width}px`\n canvas.height = Math.abs(borderCoordinates.maxY - borderCoordinates.minY) + (2 * margin)\n canvas.style.height = `${canvas.height}px`\n return canvas\n}\n\n/**\n * Generate a PNG image data url from the model\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @param {Number} [margin=10] Margins to apply around the image\n * @return {String} Image data string result\n */\nexport function getImage (model, stroker, margin = 10) {\n if (model.rawStrokes.length > 0) {\n const borderCoordinates = InkModel.getBorderCoordinates(model)\n\n const capturingCanvas = createCanvas(borderCoordinates, margin)\n const renderingCanvas = createCanvas(borderCoordinates, margin)\n const renderStructure = {\n renderingCanvas,\n renderingCanvasContext: renderingCanvas.getContext('2d'),\n capturingCanvas,\n capturingCanvasContext: capturingCanvas.getContext('2d')\n }\n // Change canvas origin\n renderStructure.renderingCanvasContext.translate(-borderCoordinates.minX + margin, -borderCoordinates.minY + margin)\n drawModel(renderStructure, model, stroker)\n return renderStructure.renderingCanvas.toDataURL('image/png')\n }\n return null\n}\n","/* eslint-disable no-undef */\nimport { editorLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\n\n/**\n * Function to copy past to inject ink during tutorial.\n * @param editorParam\n * @param strokes\n * @param delayBetweenStrokes\n * @param lastOneDelay\n */\nexport function inkImporter (editorParam, strokes, delayBetweenStrokes, lastOneDelay) {\n const editor = editorParam\n logger.debug('inkImporter start importing =>', strokes)\n const origGrabber = Object.assign({}, editor.behavior.grabber)\n origGrabber.detach = editor.behavior.grabber.detach\n editor.behavior.grabber = {}\n const actions = []\n strokes.forEach((stroke) => {\n if (stroke.convert) {\n actions.push({ action: 'convert', value: true })\n } else if (stroke.setDelay) {\n actions.push({ action: 'setDelay', value: stroke.setDelay })\n } else {\n if (stroke.color) {\n actions.push({ action: 'setColor', value: stroke.color })\n }\n stroke.X.forEach((x, idx) => {\n let action = 'move'\n if (idx === 0) {\n action = 'down'\n } else if (idx === (stroke.X.length - 1)) {\n action = 'up'\n }\n actions.push({ action, point: { x: stroke.X[idx], y: stroke.Y[idx] } })\n })\n }\n })\n logger.debug('Array of actions =>', actions)\n const play = (actionsArray, position, delay) => {\n if (position < actionsArray.length) {\n const currentAction = actionsArray[position]\n let nextDelay = delay\n if (currentAction.action === 'convert') {\n editor.convert()\n } else if (currentAction.action === 'setDelay') {\n nextDelay = currentAction.value\n } else if (currentAction.action === 'setColor') {\n editor.penStyle = {\n color: currentAction.value\n }\n } else {\n currentAction.point.t = new Date().getTime()\n if (currentAction.action === 'down') {\n editor.pointerDown(currentAction.point)\n } else if (currentAction.action === 'up') {\n editor.pointerUp(currentAction.point)\n } else if (currentAction.action === 'move') {\n editor.pointerMove(currentAction.point)\n }\n } if (lastOneDelay && position === actionsArray.map(x => x.action).lastIndexOf('down') - 1) {\n setTimeout(() => {\n play(actionsArray, position + 1, nextDelay)\n }, lastOneDelay)\n } else if (position === actionsArray.length - 1) {\n const event = new Event('drawEnded')\n document.dispatchEvent(event)\n editor.behavior.grabber = origGrabber\n } else {\n setTimeout(() => {\n play(actionsArray, position + 1, nextDelay)\n }, nextDelay)\n }\n }\n }\n play(actions, 0, delayBetweenStrokes)\n}\n\nexport function importStrokeGroups (editorParam, strokeGroups) {\n strokeGroups.forEach((group) => {\n group.strokes.forEach((strokeFromGroup) => {\n InkModel.addStroke(editorParam.model, strokeFromGroup)\n InkModel.addStrokeToGroup(editorParam.model, strokeFromGroup, group.penStyle)\n })\n })\n editorParam.renderer.drawModel(editorParam.rendererContext, editorParam.model, editorParam.stroker)\n}\n","/**\n * @typedef {Object} DestructuredPromise\n * @property {Promise} promise\n * @property {function} resolve\n * @property {function} reject\n */\n\n/**\n * destructurePromise\n * @returns {{resolve: *, reject: *, promise: Promise}}\n */\nexport function destructurePromise () {\n let resolveParam\n let rejectParam\n const initPromise = new Promise(\n (resolve, reject) => {\n resolveParam = resolve\n rejectParam = reject\n })\n return { promise: initPromise, resolve: resolveParam, reject: rejectParam }\n}\n\n/**\n * @param time\n * @return {{timer: *, promise: Promise}}\n */\nexport function delay (time) {\n let timer = null\n const promise = new Promise((resolve) => {\n timer = setTimeout(resolve, time)\n })\n return {\n promise,\n timer\n }\n}\n","/* eslint-disable no-underscore-dangle */\nimport style from './iink.css'\nimport { editorLogger as logger } from './configuration/LoggerConfig'\nimport * as DefaultBehaviors from './configuration/DefaultBehaviors'\nimport * as DefaultConfiguration from './configuration/DefaultConfiguration'\nimport * as DefaultStyles from './configuration/DefaultPenStyle'\nimport * as DefaultTheme from './configuration/DefaultTheme'\nimport * as InkModel from './model/InkModel'\nimport * as UndoRedoContext from './model/UndoRedoContext'\nimport * as UndoRedoManager from './model/UndoRedoManager'\nimport * as ImageRenderer from './renderer/canvas/ImageRenderer'\nimport * as RecognizerContext from './model/RecognizerContext'\nimport * as SmartGuide from './smartguide/SmartGuide'\nimport Constants from './configuration/Constants'\nimport * as eastereggs from './eastereggs/InkImporter'\nimport {\n handleError,\n handleSuccess,\n emitEvents,\n manageRecognizedModel\n} from './recognizer/RecognizerService'\nimport * as PromiseHelper from './util/PromiseHelper'\n\n/**\n * Check if a clear is required, and does it if it is\n * @param {Editor} editor\n * @param {Model} model Current model\n * @return {Promise<*>}\n */\nfunction manageResetState (editor, model) {\n // If strokes moved in the undo redo stack then a clear is mandatory before sending strokes.\n if (editor.recognizer.reset && !editor.isErasing && RecognizerContext.isResetRequired(editor.recognizerContext, model)) {\n return editor.recognizer.reset(editor.recognizerContext, model)\n }\n return null\n}\n\n/**\n * Check if the trigger in parameter is valid.\n * @param {Editor} editor\n * @param {String} type\n * @param {String} [trigger]\n * @return {Boolean}\n */\nfunction isTriggerValid (editor, type, trigger = editor.configuration.triggers[type]) {\n if (editor.recognizer &&\n editor.recognizer.getInfo().availableTriggers[type].includes(trigger)) {\n return true\n }\n logger.error(`${trigger} is not a valid trigger for ${type}`)\n return false\n}\n\n/**\n * Launch the recognition with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} [trigger]\n * @return {Promise}\n */\nasync function addStrokes (editor, model, trigger = editor.configuration.triggers.addStrokes) {\n if (editor.recognizer && editor.recognizer.addStrokes) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n // Firing addStrokes only if recognizer is configure to do it\n if (isTriggerValid(editor, 'addStrokes', trigger)) {\n const res = await manageResetState(editor, model)\n if (res) {\n return editor.recognizer.addStrokes(editor.recognizerContext, res)\n }\n return editor.recognizer.addStrokes(editor.recognizerContext, model)\n }\n }\n }\n return Promise.reject(new Error('Cannot addStrokes'))\n}\n\n/**\n * Launch ink import.\n * @param {Editor} editor\n * @param {Model} model\n * @param {PointerEvents} events\n * @return {Promise<*>}\n */\nasync function launchPointerEvents (editor, model, events) {\n if (editor.recognizer && editor.recognizer.pointerEvents) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.pointerEvents(editor.recognizerContext, model, events)\n }\n }\n return Promise.reject(new Error('Cannot launch pointerEvents'))\n}\n\n/**\n * Launch the recognition with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} [requestedMimeTypes]\n * @param {String} [trigger]\n */\nexport async function launchExport (editor, model, requestedMimeTypes, trigger = editor.configuration.triggers.exportContent) {\n if (editor.recognizer && editor.recognizer.export_) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n if (isTriggerValid(editor, 'exportContent', trigger)) {\n const editorRef = editor\n window.clearTimeout(editor.exportTimer)\n const timeout = trigger === Constants.Trigger.QUIET_PERIOD ? editor.configuration.triggerDelay : 0\n const delayer = PromiseHelper.delay(timeout)\n editorRef.exportTimer = delayer.timer\n await delayer.promise\n const res = await manageResetState(editor, model)\n if (res) {\n return editor.recognizer.export_(editor.recognizerContext, res, requestedMimeTypes)\n }\n return editor.recognizer.export_(editor.recognizerContext, model, requestedMimeTypes)\n }\n }\n }\n return Promise.reject(new Error('Cannot launch export'))\n}\n\n/**\n * Launch the import.\n * @param {Editor} editor\n * @param {Model} model\n * @param {Blob} data\n * @return {Promise<*>}\n */\nasync function launchImport (editor, model, data) {\n if (editor.recognizer && editor.recognizer.import_) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.import_(editor.recognizerContext, model, data)\n }\n }\n return Promise.reject(new Error('Cannot launch import'))\n}\n\n/**\n * Get the supported mimetypes for import.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchGetSupportedImportMimeTypes (editor, model) {\n if (editor.recognizer && editor.recognizer.getSupportedImportMimeTypes) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.getSupportedImportMimeTypes(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch getSupportedImportMimeTypes'))\n}\n\n/**\n * Launch the convert with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} conversionState\n * @return {Promise<*>}\n */\nasync function launchConvert (editor, model, conversionState) {\n if (editor.recognizer && editor.recognizer.convert) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.convert(editor.recognizerContext, model, conversionState)\n }\n }\n return Promise.reject(new Error('Cannot launch convert'))\n}\n\n/**\n * Launch the configuration for the editor\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchConfig (editor, model) {\n if (editor.recognizer && editor.recognizer.sendConfiguration) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.sendConfiguration(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch config'))\n}\n\n/**\n * Launch the resize.\n * @param {Editor} editor\n * @param {Model} model\n */\nasync function launchResize (editor, model) {\n if (editor.recognizer && editor.recognizer.resize) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n const editorRef = editor\n window.clearTimeout(editor.resizeTimer)\n const delayer = PromiseHelper.delay(editor.configuration.resizeTriggerDelay)\n editorRef.resizeTimer = delayer.timer\n SmartGuide.resize(editor.smartGuide)\n await delayer.promise\n return editor.recognizer.resize(editor.recognizerContext, model, editor.domElement)\n }\n }\n return Promise.reject(new Error('Cannot launch resize'))\n}\n\n/**\n * Launch wait for idle\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchWaitForIdle (editor, model) {\n if (editor.recognizer && editor.recognizer.waitForIdle) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.waitForIdle(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch wait for idle'))\n}\n\n/**\n * Launch websocket close\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchClose (editor, model) {\n if (editor.recognizer && editor.recognizer.close) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.close(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch close'))\n}\n\n/**\n * Set pen style.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setPenStyle (editor, model) {\n if (editor.recognizer && editor.recognizer.setPenStyle) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setPenStyle(editor.recognizerContext, model, editor.penStyle)\n }\n return Promise.reject(new Error('Cannot set pentStyle'))\n }\n return null\n}\n\n/**\n * Set pen style.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setPenStyleClasses (editor, model) {\n if (editor.recognizer && editor.recognizer.setPenStyleClasses) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setPenStyleClasses(editor.recognizerContext, model, editor.penStyleClasses)\n }\n return Promise.reject(new Error('Cannot set penStyleClasses'))\n }\n return null\n}\n\n/**\n * Set theme.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setTheme (editor, model) {\n if (editor.recognizer && editor.recognizer.setTheme) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setTheme(editor.recognizerContext, model, editor.theme)\n }\n return Promise.reject(new Error('Cannot set theme'))\n }\n return null\n}\n\n/**\n * Editor\n */\nexport class Editor {\n /**\n * @param {Element} element DOM element to attach this editor\n * @param {Configuration} [configuration] Configuration to apply\n * @param {Theme} [theme] Custom theme to apply\n * @param {PenStyle} [penStyle] Custom style to apply\n * @param {Behaviors} [behaviors] Custom behaviors to apply\n */\n constructor (element, configuration, penStyle, theme, behaviors, globalClassCss) {\n globalClassCss = globalClassCss || 'ms-editor'\n\n const styleElement = document.createElement('style')\n styleElement.appendChild(document.createTextNode(''))\n element.appendChild(styleElement)\n\n const sheet = styleElement.sheet\n styleElement.textContent = style\n\n this.sheet = sheet\n /**\n * Inner reference to the DOM Element\n * @type {Element}\n */\n this.domElement = element\n this.domElement.classList.add(globalClassCss)\n\n // eslint-disable-next-line no-undef\n this.loader = document.createElement('div')\n this.loader.classList.add('loader')\n this.loader = this.domElement.appendChild(this.loader)\n\n // eslint-disable-next-line no-undef\n this.error = document.createElement('div')\n this.error.classList.add('error-msg')\n this.error = this.domElement.appendChild(this.error)\n\n /**\n * Launch export timer\n * @type {Number}\n */\n this.exportTimer = undefined\n\n /**\n * Launch resize timer\n * @type {Number}\n */\n this.resizeTimer = undefined\n\n /**\n * Notify delay timer\n * @type {Number}\n */\n this.notifyTimer = undefined\n\n /**\n * @private\n * @type {Behaviors}\n */\n this.innerBehaviors = DefaultBehaviors.overrideDefaultBehaviors(behaviors)\n this.configuration = configuration\n\n /**\n * Pen color used only for pending stroke\n * @type {string}\n */\n this.localTheme = ''\n\n this.theme = theme\n this.penStyle = penStyle\n this.penStyleClasses = ''\n\n // To override pointerType when ERASER\n this.isErasing = false\n\n this.domElement.editor = this\n }\n\n /**\n * Set the recognition parameters\n * WARNING : Need to fire a clear if user have already input some strokes.\n * @param {Configuration} configuration\n */\n set configuration (configuration) {\n this.loader.style.display = 'initial'\n this.error.style.display = 'none'\n /**\n * @private\n * @type {Configuration}\n */\n this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration)\n this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)\n if (this.smartGuide) {\n SmartGuide.reset(this.smartGuide)\n } else {\n this.smartGuide = SmartGuide.createSmartGuide(this)\n }\n }\n\n /**\n * Get the current recognition parameters\n * @return {Configuration}\n */\n get configuration () {\n return this.innerConfiguration\n }\n\n /**\n * Set the pen style\n * @param {PenStyle} penStyle\n */\n set penStyle (penStyle) {\n /**\n * @private\n * @type {PenStyle}\n */\n this.innerPenStyle = DefaultStyles.overrideDefaultPenStyle(penStyle)\n this.localPenStyle = this.innerPenStyle\n setPenStyle(this, this.model)\n }\n\n /**\n * Get the pen style\n * @return {PenStyle}\n */\n get penStyle () {\n return this.innerPenStyle\n }\n\n /**\n * Set the pen style\n * @param {String} penStyleClasses\n */\n set penStyleClasses (penStyleClasses) {\n /**\n * @private\n * @type {String}\n */\n this.innerPenStyleClasses = penStyleClasses\n this.localPenStyle = this.theme[`.${this.innerPenStyleClasses}`]\n setPenStyleClasses(this, this.model)\n }\n\n /**\n * Get the pen style\n * @return {String}\n */\n get penStyleClasses () {\n return this.innerPenStyleClasses\n }\n\n /**\n * Set the theme\n * @param {Theme} theme\n */\n set theme (theme) {\n /**\n * @private\n * @type {Theme}\n */\n this.innerTheme = DefaultTheme.overrideDefaultTheme(theme)\n setTheme(this, this.model)\n }\n\n /**\n * Get the theme\n * @return {Theme}\n */\n get theme () {\n return this.innerTheme\n }\n\n /**\n * Get behaviors\n * @return {Behaviors}\n */\n get behaviors () {\n return this.innerBehaviors\n }\n\n /**\n * @private\n * @param {Behavior} behavior\n */\n set behavior (behavior) {\n if (behavior) {\n if (this.grabber) { // Remove event handlers to avoid multiplication (detach grabber)\n this.grabber.detach(this.domElement, this.grabberContext)\n }\n /**\n * @private\n * @type {Behavior}\n */\n this.innerBehavior = behavior\n this.renderer = this.innerBehavior.renderer\n this.recognizer = this.innerBehavior.recognizer\n /**\n * Current grabber context\n * @type {GrabberContext}\n */\n this.grabberContext = this.grabber.attach(this.domElement, this)\n }\n }\n\n /**\n * Get current behavior\n * @return {Behavior}\n */\n get behavior () {\n return this.innerBehavior\n }\n\n /**\n * Set the current recognizer\n * @private\n * @param {Recognizer} recognizer\n */\n set recognizer (recognizer) {\n this.undoRedoContext = UndoRedoContext.createUndoRedoContext(this.configuration)\n this.undoRedoManager = UndoRedoManager\n\n const initialize = (model, shouldSendTheme) => {\n /**\n * @private\n * @type {Recognizer}\n */\n this.innerRecognizer = recognizer\n if (this.innerRecognizer) {\n /**\n * Current recognition context\n * @type {RecognizerContext}\n */\n this.recognizerContext = RecognizerContext.createEmptyRecognizerContext(this)\n // FIXME: merge undo/redo manager with default recognizer\n if (this.innerRecognizer.undo && this.innerRecognizer.redo && this.innerRecognizer.clear) {\n this.undoRedoContext = this.recognizerContext\n this.undoRedoManager = this.innerRecognizer\n }\n\n this.innerRecognizer.init(this.recognizerContext, model)\n .then((values) => {\n logger.info('Recognizer initialized !')\n if (shouldSendTheme) {\n setTheme(this, this.model)\n setPenStyle(this, this.model)\n setPenStyleClasses(this, this.model)\n }\n this.loader.style.display = 'none'\n })\n .catch(err => handleError(this, err))\n }\n }\n\n if (recognizer) {\n if (this.innerRecognizer) {\n this.innerRecognizer.close(this.recognizerContext, this.model)\n .then((model) => {\n logger.info('Recognizer closed')\n handleSuccess(this, model)\n initialize(InkModel.clearModel(model), true)\n })\n .catch(err => handleError(this, err))\n } else {\n /**\n * Current model\n * @type {Model}\n */\n this.model = InkModel.createModel(this.configuration)\n\n // INFO: Recognizer needs model to be initialized\n initialize(this.model, false)\n }\n }\n }\n\n /**\n * Get current recognizer\n * @return {Recognizer}\n */\n get recognizer () {\n return this.innerRecognizer\n }\n\n /**\n * Set the current renderer\n * @private\n * @param {Renderer} renderer\n */\n set renderer (renderer) {\n if (renderer) {\n if (this.innerRenderer) {\n this.innerRenderer.detach(this.domElement, this.rendererContext)\n }\n\n /**\n * @private\n * @type {Renderer}\n */\n this.innerRenderer = renderer\n if (this.innerRenderer) {\n /**\n * Current rendering context\n * @type {Object}\n */\n this.rendererContext = this.innerRenderer.attach(this.domElement, this.configuration.renderingParams.minHeight, this.configuration.renderingParams.minWidth)\n }\n }\n }\n\n /**\n * Get current renderer\n * @return {Renderer}\n */\n get renderer () {\n return this.innerRenderer\n }\n\n /**\n * Get current grabber\n * @return {Grabber}\n */\n get grabber () {\n return this.behavior ? this.behavior.grabber : undefined\n }\n\n /**\n * Get current stroker\n * @return {Stroker}\n */\n get stroker () {\n return this.behavior ? this.behavior.stroker : undefined\n }\n\n /**\n * Get current events\n * @return {Array}\n */\n get emit () {\n return this.behavior ? this.behavior.events : undefined\n }\n\n /**\n * Get a PNG image data url from the data model\n * @return {String}\n */\n get png () {\n return ImageRenderer.getImage(this.model, this.stroker)\n }\n\n /**\n * True if initialized, false otherwise\n * @return {Boolean}\n */\n get initialized () {\n return this.recognizerContext ? this.recognizerContext.initialized : false\n }\n\n enableEraser () {\n this.isErasing = true\n this.domElement.classList.add('erasing')\n }\n\n disableEraser () {\n document.body.style.cursor = 'initial'\n this.isErasing = false\n this.domElement.classList.remove('erasing')\n }\n\n /**\n * Handle a pointer down\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n * @param {String} [pointerType=mouse] Current pointer type\n * @param {String} [pointerId] Current pointer id\n */\n pointerDown (point, pointerType = 'pen', pointerId) {\n logger.trace('Pointer down', point)\n window.clearTimeout(this.notifyTimer)\n window.clearTimeout(this.exportTimer)\n this.model = InkModel.initPendingStroke(this.model, point, Object.assign({ pointerType, pointerId }, this.theme.ink, this.localPenStyle))\n if (!this.isErasing) {\n this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)\n }\n // Currently no recognition on pointer down\n }\n\n /**\n * Handle a pointer move\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n */\n pointerMove (point) {\n logger.trace('Pointer move', point)\n this.model = InkModel.appendToPendingStroke(this.model, point)\n if (!this.isErasing) {\n this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)\n }\n // Currently no recognition on pointer move\n }\n\n /**\n * Handle a pointer up\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n */\n pointerUp (point) {\n logger.trace('Pointer up', point)\n this.model = InkModel.endPendingStroke(this.model, point, this.penStyle)\n if (!this.isErasing) {\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n }\n\n if (this.recognizer.addStrokes) {\n addStrokes(this, this.model)\n } else {\n // Push model in undo redo manager\n handleSuccess(this, this.model)\n }\n }\n\n removeStroke (stroke) {\n this.model.strokeGroups.forEach((group) => {\n const stringStrokes = group.strokes.map(strokeFromGroup => JSON.stringify(strokeFromGroup))\n const strokeIndex = stringStrokes.indexOf(JSON.stringify(stroke))\n if (strokeIndex !== -1) {\n group.strokes.splice(strokeIndex, 1)\n }\n })\n const stringRawStrokes = this.model.rawStrokes.map(strokes => JSON.stringify(strokes))\n const strokeIndex = stringRawStrokes.indexOf(JSON.stringify(stroke))\n if (strokeIndex !== -1) {\n this.model.rawStrokes.splice(strokeIndex, 1)\n }\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n handleSuccess(this, this.model)\n if (!(this.configuration.triggers.exportContent === 'DEMAND')) {\n launchExport(this, this.model)\n }\n }\n\n /**\n * @Deprecated\n * @param rawStrokes\n * @param strokeGroups\n */\n reDraw (rawStrokes, strokeGroups) {\n rawStrokes.forEach((stroke) => {\n InkModel.addStroke(this.model, stroke)\n })\n strokeGroups.forEach((group) => {\n group.strokes.forEach((strokeFromGroup) => {\n InkModel.addStrokeToGroup(this.model, strokeFromGroup, group.penStyle)\n })\n })\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n handleSuccess(this, this.model)\n }\n\n /**\n * True if idle state\n * @return {Boolean}\n */\n get idle () {\n return this.recognizerContext.idle\n }\n\n /**\n * Wait for idle state.\n * @return {Promise<*>}\n */\n waitForIdle () {\n emitEvents(this, undefined, Constants.EventType.IDLE)\n return launchWaitForIdle(this, this.model)\n }\n\n /**\n * True if can undo, false otherwise.\n * @return {Boolean}\n */\n get canUndo () {\n return this.undoRedoContext.canUndo\n }\n\n /**\n * Undo the last action.\n * @return {Promise<*>}\n */\n async undo () {\n logger.debug('Undo current model', this.model)\n emitEvents(this, undefined, Constants.EventType.UNDO)\n const { res, types } = await this.undoRedoManager.undo(this.undoRedoContext, this.model)\n .catch(err => handleError(this, err))\n manageRecognizedModel(this, res, ...types)\n return res\n }\n\n /**\n * True if can redo, false otherwise.\n * @return {Boolean}\n */\n get canRedo () {\n return this.undoRedoContext.canRedo\n }\n\n /**\n * Redo the last action.\n * @return {Promise<*>}\n */\n async redo () {\n logger.debug('Redo current model', this.model)\n emitEvents(this, undefined, Constants.EventType.REDO)\n const { res, types } = await this.undoRedoManager.redo(this.undoRedoContext, this.model)\n .catch(err => handleError(this, err))\n manageRecognizedModel(this, res, ...types)\n return res\n }\n\n /**\n * True if empty, false otherwise\n * @return {boolean}\n */\n get isEmpty () {\n return this.recognizerContext.isEmpty\n }\n\n /**\n * True if can clear, false otherwise.\n * @return {Boolean}\n */\n get canClear () {\n return !this.isEmpty\n }\n\n /**\n * Clear the output and the recognition result.\n * @return {Promise<*>}\n */\n async clear () {\n if (this.canClear) {\n logger.debug('Clear current model', this.model)\n emitEvents(this, undefined, Constants.EventType.CLEAR)\n const { res, events } = await this.recognizer.clear(this.recognizerContext, this.model)\n .catch(error => handleError(this, error))\n handleSuccess(this, res, ...events)\n return res\n }\n return Promise.reject(new Error('Cannot launch clear'))\n }\n\n /**\n * True if can convert, false otherwise.\n * @return {Boolean}\n */\n get canConvert () {\n return !!(this.canUndo && this.canClear && this.recognizer && this.recognizer.convert)\n }\n\n /**\n * Convert the current content\n * @param {string} conversionState\n * @return {Promise<*>}\n */\n convert (conversionState = 'DIGITAL_EDIT') {\n if (this.canConvert) {\n emitEvents(this, undefined, Constants.EventType.CONVERT)\n return launchConvert(this, this.model, conversionState)\n }\n return Promise.reject(new Error('Cannot launch convert'))\n }\n\n /**\n * Set the guides for text\n * @param {Boolean} [enable]\n * @return {Promise<*|null>}\n */\n setGuides (enable = true) {\n this.configuration.recognitionParams.iink.text.guides.enable = enable\n return launchConfig(this, this.model)\n }\n\n /**\n * Return the position of the cursor identifying the current state in the internal iink undo/redo stack.\n * @returns {Number}\n */\n get possibleUndoCount () {\n return this.recognizerContext.possibleUndoCount\n }\n\n /**\n * The number of operations that it is currently possible to undo.\n * @returns {Number}\n */\n get undoStackIndex () {\n return this.recognizerContext.undoStackIndex\n }\n\n /**\n * True if can export, false otherwise.\n * @return {Boolean}\n */\n get canExport () {\n return this.canUndo && this.canClear && this.recognizer && this.recognizer.getInfo().availableTriggers.exportContent.includes(Constants.Trigger.DEMAND)\n }\n\n /**\n * Explicitly ask to perform an export. You have to listen to events to get the content as this function is non blocking and does not have a return type.\n * @param {Array} requestedMimeTypes Requested mime-types. Be sure to ask all the types required by the listeners of exported event.\n */\n export_ (requestedMimeTypes) {\n if (this.canExport) {\n emitEvents(this, undefined, Constants.EventType.EXPORT)\n return launchExport(this, this.model, requestedMimeTypes, Constants.Trigger.DEMAND)\n }\n return Promise.reject(new Error('Cannot launch export'))\n }\n\n /**\n * Import content.\n * @param {Blob|*} data Data to import\n * @param {String} [mimetype] Mimetype of the data, needed if data is not a Blob\n */\n import_ (data, mimetype) {\n emitEvents(this, undefined, Constants.EventType.IMPORT)\n return launchImport(this, this.model, !(data instanceof Blob) ? new Blob([data], { type: mimetype }) : data)\n }\n\n /**\n * Get supported import mime types\n * @return {Promise<*|null>}\n */\n getSupportedImportMimeTypes () {\n return launchGetSupportedImportMimeTypes(this, this.model)\n }\n\n /**\n * pointer events\n * @param {PointerEvents} events\n * @return {Promise<*|null>}\n */\n pointerEvents (events) {\n return launchPointerEvents(this, this.model, events)\n }\n\n /**\n * Get current state exports\n * @return {Object}\n */\n get exports () {\n return this.model ? this.model.exports : undefined\n }\n\n get supportedImportMimeTypes () {\n return this.recognizerContext.supportedImportMimeTypes\n }\n\n /**\n * Function to call when the dom element link to the current ink paper has been resize.\n */\n resize () {\n logger.debug('Resizing editor')\n this.renderer.resize(this.rendererContext, this.model, this.stroker, this.configuration.renderingParams.minHeight, this.configuration.renderingParams.minWidth)\n return launchResize(this, this.model)\n }\n\n /**\n * Detach event listeners from the DOM element created at editor creation.\n */\n unload () {\n if (this.grabber) { // Remove event handlers to avoid multiplication (detach grabber)\n this.grabber.detach(this.domElement, this.grabberContext)\n }\n if (this.innerRenderer) {\n this.innerRenderer.detach(this.domElement, this.rendererContext)\n }\n }\n\n /**\n * Close websocket connection\n * @return {Promise<*>}\n */\n close () {\n if (this.configuration.recognitionParams.protocol === Constants.Protocol.WEBSOCKET) {\n return launchClose(this, this.model)\n }\n return null\n }\n\n /**\n * Trigger the change callbacks (and by default send a change event).\n */\n forceChange () {\n emitEvents(this, undefined, Constants.EventType.CHANGED)\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Get access to some easter egg features link ink injection. Use at your own risk (less tested and may be removed without notice).\n */\n get eastereggs () {\n return eastereggs\n }\n /* eslint-enable class-methods-use-this */\n}\n","import { editorLogger as logger } from './LoggerConfig'\nimport * as PointerEventGrabber from '../grabber/PointerEventGrabber'\nimport * as CanvasRenderer from '../renderer/canvas/CanvasRenderer'\nimport * as QuadraticCanvasStroker from '../renderer/canvas/stroker/QuadraticCanvasStroker'\nimport * as SVGRenderer from '../renderer/svg/SVGRenderer'\nimport * as QuadraticSVGStroker from '../renderer/svg/stroker/QuadraticSVGStroker'\nimport * as iinkRestRecognizer from '../recognizer/rest/iinkRestRecognizer'\nimport * as iinkWsRecognizer from '../recognizer/websocket/iinkWsRecognizer'\nimport emit from '../event/Event'\n\n/**\n * Current behavior\n * @typedef {Object} Behavior\n * @property {Grabber} grabber Grabber to capture strokes\n * @property {Stroker} stroker Stroker to draw stroke\n * @property {Renderer} renderer Renderer to draw on the editor\n * @property {Recognizer} recognizer Recognizer to call the recognition service\n * @property {Array} events Functions to handle model changes\n */\n\n/**\n * Set of behaviors to be used by the {@link Editor}\n * @typedef {Object} Behaviors\n * @property {Grabber} grabber Grabber to capture strokes\n * @property {Array} strokerList List of stroker to draw stroke\n * @property {Array} rendererList List of renderer to draw on the editor\n * @property {Array} recognizerList Recognizers to call the recognition service\n * @property {function} getBehaviorFromConfiguration Get the current behavior to use regarding the current configuration\n * @property {Array} events Functions to handle model changes\n */\n\n/**\n * Default behaviors\n * @type {Behaviors}\n */\nexport const defaultBehaviors = {\n grabber: PointerEventGrabber,\n strokerList: [QuadraticCanvasStroker, QuadraticSVGStroker],\n rendererList: [CanvasRenderer, SVGRenderer],\n recognizerList: [iinkRestRecognizer, iinkWsRecognizer],\n events: emit,\n getBehaviorFromConfiguration: (behaviors, configuration) => {\n const behavior = {}\n behavior.grabber = behaviors.grabber\n if (configuration) {\n if (configuration.recognitionParams.protocol === 'REST') {\n behavior.stroker = QuadraticCanvasStroker\n behavior.renderer = CanvasRenderer\n behavior.recognizer = iinkRestRecognizer\n } else {\n behavior.stroker = QuadraticSVGStroker\n behavior.renderer = SVGRenderer\n behavior.recognizer = iinkWsRecognizer\n }\n }\n behavior.events = behaviors.events\n return behavior\n }\n}\n\n/**\n * Generate behaviors\n * @param {Behaviors} behaviors Behaviors to be used\n * @return {Behaviors} Overridden behaviors\n */\nexport function overrideDefaultBehaviors (behaviors) {\n if (behaviors) {\n const currentBehaviors = {\n grabber: behaviors.grabber || defaultBehaviors.grabber,\n rendererList: behaviors.rendererList || defaultBehaviors.rendererList,\n strokerList: behaviors.strokerList || defaultBehaviors.strokerList,\n recognizerList: behaviors.recognizerList || defaultBehaviors.recognizerList,\n events: behaviors.events || defaultBehaviors.events,\n getBehaviorFromConfiguration: behaviors.getBehaviorFromConfiguration || defaultBehaviors.getBehaviorFromConfiguration\n }\n logger.debug('Override default behaviors', currentBehaviors)\n return currentBehaviors\n }\n return defaultBehaviors\n}\n\nexport default defaultBehaviors\n","import Constants from '../configuration/Constants'\nimport { recognizerLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\nimport * as SmartGuide from '../smartguide/SmartGuide'\nimport * as RecognizerContext from '../model/RecognizerContext'\nimport { launchExport } from '../Editor'\n\n/**\n * Emit events\n * @param {Editor} editor\n * @param {Object} data\n * @param {...String} types\n * @return {Model}\n */\nexport function emitEvents (editor, data, ...types) {\n const editorRef = editor\n types.forEach((type) => {\n switch (type) {\n case Constants.EventType.RENDERED:\n break // Internal use only\n case Constants.EventType.UNDO:\n case Constants.EventType.REDO:\n case Constants.EventType.CLEAR:\n case Constants.EventType.CONVERT:\n case Constants.EventType.EXPORT:\n editor.emit.call(editor.domElement, type)\n break\n case Constants.EventType.LOADED:\n case Constants.EventType.CHANGED:\n editor.emit.call(editor.domElement, type, {\n initialized: editor.initialized,\n canUndo: editor.canUndo,\n canRedo: editor.canRedo,\n canClear: editor.canClear,\n isEmpty: editor.isEmpty,\n possibleUndoCount: editor.possibleUndoCount,\n undoStackIndex: editor.undoStackIndex,\n canConvert: editor.canConvert,\n canExport: editor.canExport\n })\n break\n case Constants.EventType.EXPORTED:\n window.clearTimeout(editorRef.notifyTimer)\n editorRef.notifyTimer = window.setTimeout(() => {\n editor.emit.call(editor.domElement, type, {\n exports: editor.exports\n })\n }, editorRef.configuration.processDelay)\n break\n case Constants.EventType.SUPPORTED_IMPORT_MIMETYPES:\n editor.emit.call(editor.domElement, type, {\n mimeTypes: editor.supportedImportMimeTypes\n })\n break\n case Constants.EventType.ERROR:\n editor.emit.call(editor.domElement, type, data)\n break\n case Constants.EventType.IDLE:\n editor.emit.call(editor.domElement, type, {\n idle: editor.idle\n })\n break\n default:\n logger.debug(`No valid trigger configured for ${type}`)\n break\n }\n })\n}\n\n/**\n * Manage recognized model\n * @param {Editor} editor\n * @param {Model} model\n * @param {...String} types\n */\nexport function manageRecognizedModel (editor, model, ...types) {\n const editorRef = editor\n const modelRef = model\n logger.debug(`model changed callback on ${types} event(s)`, model)\n if (modelRef.creationTime === editor.model.creationTime) {\n // Merge recognized model if relevant and return current editor model\n if ((modelRef.rawStrokes.length === editor.model.rawStrokes.length) &&\n (modelRef.lastPositions.lastSentPosition >= editor.model.lastPositions.lastReceivedPosition)) {\n editorRef.model = InkModel.mergeModels(editorRef.model, modelRef)\n if (InkModel.needRedraw(editorRef.model) || types.includes(Constants.EventType.RENDERED)) {\n editor.renderer.drawModel(editor.rendererContext, editorRef.model, editor.stroker)\n }\n } else {\n editorRef.model = modelRef\n editor.renderer.drawModel(editor.rendererContext, editorRef.model, editor.stroker)\n }\n emitEvents(editor, undefined, ...types)\n }\n\n if (editor.configuration.recognitionParams.type === 'TEXT' &&\n editor.configuration.recognitionParams.protocol !== 'REST' &&\n editor.configuration.recognitionParams.iink.text.mimeTypes.includes(Constants.Exports.JIIX) &&\n editor.configuration.recognitionParams.iink.text.smartGuide) {\n // eslint-disable-next-line no-use-before-define\n editorRef.smartGuide = SmartGuide.launchSmartGuide(editor.smartGuide, modelRef.exports)\n }\n\n if ((InkModel.extractPendingStrokes(model).length > 0) &&\n (!editor.recognizer.addStrokes) && // FIXME: Ugly hack to avoid double export (addStrokes + export)\n (editor.configuration.triggers.exportContent !== Constants.Trigger.DEMAND)) {\n launchExport(editor, model)\n }\n}\n\n/**\n * Method called when server respond with an error\n * Use in catch on Promises\n * @param {Editor} editor\n * @param {Object} err\n * @param {...String} events\n */\nexport function handleError (editor, err, ...events) {\n const editorRef = editor\n if (err.type !== 'close') {\n logger.error('Error while firing the recognition', err.stack || err) // Handle any error from all above steps\n }\n if (\n // IInk error managment before refactor\n (err.message === 'Invalid application key.') || (err.message === 'Invalid HMAC') ||\n // CDK error managment\n (err.error &&\n err.error.result &&\n err.error.result.error &&\n (err.error.result.error === 'InvalidApplicationKeyException' || err.error.result.error === 'InvalidHMACSignatureException')) ||\n // IInk error managment after refactor\n (err.code && err.code === 'access.not.granted')) {\n editorRef.error.innerText = Constants.Error.WRONG_CREDENTIALS\n } else if (err.code && err.code === 'no.activity') {\n editorRef.error.innerText = Constants.Error.NO_ACTIVITY\n } else if (err.message === 'Session is too old. Max Session Duration Reached.' ||\n (err.code && err.code === 'session.too.old')) {\n editorRef.error.innerText = Constants.Error.TOO_OLD\n } else if ((err.code === 1006 || err.code === 1000) && editorRef.error.style.display === 'none') {\n editorRef.error.innerText = Constants.Error.NOT_REACHABLE\n }\n if ((editorRef.error.innerText === Constants.Error.TOO_OLD || err.reason === 'CLOSE_RECOGNIZER') && RecognizerContext.canReconnect(editor.recognizerContext)) {\n logger.info('Reconnection is available', err.stack || err)\n editorRef.error.style.display = 'none'\n } else {\n editorRef.loader.style.display = 'none'\n editorRef.error.style.display = 'initial'\n emitEvents(editor, err, Constants.EventType.ERROR, ...events)\n }\n}\n\n/**\n * Method called when server respond correctly to request or WS\n * Use in then on Promises\n * @param {Editor} editor\n * @param {Object} model\n * @param {...String} events\n */\nexport function handleSuccess (editor, model, ...events) {\n const editorRef = editor\n if (editor.undoRedoManager.updateModel) {\n editor.undoRedoManager.updateModel(editor.undoRedoContext, model)\n .then(({ res, types }) => {\n manageRecognizedModel(editorRef, res, ...[...events, ...types].filter((el, i, a) => i === a.indexOf(el)))\n })\n } else {\n if (editorRef.error.style.display === 'initial') {\n editorRef.error.style.display = 'none'\n }\n manageRecognizedModel(editorRef, model, ...events)\n }\n}\n","import { recognizerLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\nimport * as RecognizerContext from '../model/RecognizerContext'\nimport Constants from '../configuration/Constants'\nimport { handleSuccess } from './RecognizerService'\n\n/**\n * Triggers\n * @typedef {Object} Triggers\n * @property {Array} exportContent Supported triggers for exporting content.\n * @property {Array} [addStrokes] Supported triggers for adding strokes.\n */\n\n/**\n * Recognizer info\n * @typedef {Object} RecognizerInfo\n * @property {Array} types Supported recognition types (TEXT, MATH, SHAPE, MUSIC, ANALYZER).\n * @property {String} protocol Supported protocol (REST, WEBSOCKET).\n * @property {String} apiVersion Supported API version.\n * @property {Triggers} availableTriggers Supported triggers for this recognizer.\n */\n\n/**\n * Recognizer callback\n * @typedef {function} RecognizerCallback\n * @param {Object} [err] Error\n * @param {Model} [model] Result\n * @param {...String} [types] Result types\n */\n\n/**\n * Simple callback\n * @typedef {function} Callback\n * @param {Object} [err] Error\n * @param {Object} [res] Result\n */\n\n/**\n * Recognition service entry point\n * @typedef {Object} Recognizer\n * @property {function} getInfo Get information about the supported configuration (protocol, type, apiVersion, ...).\n * @property {function} init Initialize recognition.\n * @property {function} clear Clear server context. Currently nothing to do there.\n * @property {function} close Close and free all resources that will no longer be used by the recognizer.\n * @property {function} [undo] Undo Undo the last done action.\n * @property {function} [redo] Redo Redo the previously undone action.\n * @property {function} [resize] Resize.\n * @property {function} [pointerEvents] Pointer Events.\n * @property {function} [addStrokes] Add strokes.\n * @property {function} [export_] Export content.\n * @property {function} [import_] Import content.\n * @property {function} [convert] Convert.\n * @property {function} [waitForIdle] Wait for idle.\n * @property {function} [setPenStyle] Set pen style.\n * @property {function} [setPenStyleClasses] Set pen style classes.\n * @property {function} [setTheme] Set theme.\n */\n\n/**\n * Initialize recognition\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function init (recognizerContext, model) {\n const modelRef = InkModel.resetModelPositions(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n recognizerContextRef.initPromise = Promise.resolve(modelRef)\n return recognizerContextRef.initPromise\n .then((res) => {\n recognizerContextRef.initialized = true\n logger.debug('Updated recognizer context', recognizerContextRef)\n handleSuccess(recognizerContextRef.editor, res, Constants.EventType.LOADED)\n return res\n })\n}\n\n/**\n * Reset server context. Currently nothing to do there.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function reset (recognizerContext, model) {\n const modelRef = InkModel.resetModelPositions(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n delete recognizerContextRef.instanceId\n logger.debug('Updated recognizer context', recognizerContextRef)\n return Promise.resolve({\n res: modelRef\n })\n}\n\n/**\n * Clear server context. Currently nothing to do there.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function clear (recognizerContext, model) {\n const modelRef = InkModel.clearModel(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n delete recognizerContextRef.instanceId\n logger.debug('Updated recognizer context', recognizerContextRef)\n return Promise.resolve({\n err: undefined,\n res: modelRef,\n events: [Constants.EventType.CHANGED, Constants.EventType.EXPORTED, Constants.EventType.RENDERED]\n })\n}\n\n/**\n * Close and free all resources that will no longer be used by the recognizer.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function close (recognizerContext, model) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.initialized = false\n delete recognizerContextRef.instanceId\n return Promise.resolve(model)\n}\n","/* eslint-disable no-underscore-dangle */\nimport * as NetworkInterface from './networkInterface'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport Constants from '../../configuration/Constants'\nimport * as InkModel from '../../model/InkModel'\nimport * as StrokeComponent from '../../model/StrokeComponent'\nimport * as DefaultTheme from '../../configuration/DefaultTheme'\nimport * as DefaultPenStyle from '../../configuration/DefaultPenStyle'\nimport { handleError, handleSuccess } from '../RecognizerService'\n\nexport { init, close, clear, reset } from '../DefaultRecognizer'\n\n/**\n * Recognizer configuration\n * @type {RecognizerInfo}\n */\nexport const iinkRestConfiguration = {\n types: [Constants.RecognitionType.TEXT, Constants.RecognitionType.DIAGRAM, Constants.RecognitionType.MATH, Constants.RecognitionType.RAWCONTENT],\n protocol: Constants.Protocol.REST,\n availableTriggers: {\n exportContent: [\n Constants.Trigger.QUIET_PERIOD,\n Constants.Trigger.DEMAND\n ]\n }\n}\n\n/**\n * Get the configuration supported by this recognizer\n * @return {RecognizerInfo}\n */\nexport function getInfo () {\n return iinkRestConfiguration\n}\n\n/**\n * @param {String} suffixUrl\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n * @param {function} buildMessage\n * @param {String} conversionState\n * @param {String} mimeType\n * @return {Promise.} Promise that return an updated model as a result\n */\nexport function postMessage (suffixUrl, recognizerContext, model, buildMessage, conversionState = '', mimeType) {\n const configuration = recognizerContext.editor.configuration\n return NetworkInterface.post(recognizerContext, `${configuration.recognitionParams.server.scheme}://${configuration.recognitionParams.server.host}${suffixUrl}`, buildMessage(recognizerContext, model, conversionState), 'V4', mimeType)\n .then((response) => {\n logger.debug('iinkRestRecognizer success', response)\n const positions = recognizerContext.lastPositions\n positions.lastReceivedPosition = positions.lastSentPosition\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, positions)\n if (response.instanceId) {\n recognizerContextReference.instanceId = response.instanceId\n }\n return response\n })\n}\n\nfunction buildTextConf (configuration) {\n return {\n text: configuration.recognitionParams.iink.text,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildMathConf (configuration) {\n return {\n math: configuration.recognitionParams.iink.math,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildDiagramConf (configuration) {\n return {\n diagram: configuration.recognitionParams.iink.diagram,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildRawContentConf (configuration) {\n return {\n 'raw-content': {\n recognition: configuration.recognitionParams.iink['raw-content'].recognition\n },\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildData (recognizerContext, model, conversionState) {\n const configuration = recognizerContext.editor.configuration\n let dataConf\n\n if (configuration.recognitionParams.type === 'TEXT') {\n dataConf = buildTextConf(configuration)\n } else if (configuration.recognitionParams.type === 'MATH') {\n dataConf = buildMathConf(configuration)\n } else if (configuration.recognitionParams.type === 'DIAGRAM') {\n dataConf = buildDiagramConf(configuration)\n } else if (configuration.recognitionParams.type === 'Raw Content') {\n dataConf = buildRawContentConf(configuration)\n }\n\n const newStrokes = []\n model.strokeGroups.forEach((group) => {\n const newPenStyle = JSON.stringify(group.penStyle) === '{}' ? null : DefaultPenStyle.toCSS(group.penStyle)\n const newGroup = {\n penStyle: newPenStyle,\n strokes: group.strokes.map(stroke => StrokeComponent.toJSON(stroke))\n }\n newStrokes.push(newGroup)\n })\n\n const contentType = configuration.recognitionParams.type === 'Raw Content' ? 'Raw Content' : configuration.recognitionParams.type.charAt(0)\n .toUpperCase() + configuration.recognitionParams.type.slice(1)\n .toLowerCase()\n\n const data = {\n configuration: dataConf,\n xDPI: 96,\n yDPI: 96,\n contentType,\n theme: DefaultTheme.toCSS(recognizerContext.editor.theme),\n strokeGroups: newStrokes\n }\n\n if (recognizerContext.editor.domElement) {\n data.height = recognizerContext.editor.domElement.clientHeight\n data.width = recognizerContext.editor.domElement.clientWidth\n }\n\n if (conversionState) {\n data.conversionState = 'DIGITAL_EDIT'\n }\n\n InkModel.updateModelSentPosition(model)\n return data\n}\n\nfunction extractExports (configuration, mimeType, res) {\n const exports = {}\n exports[mimeType] = res\n return exports\n}\n\nfunction resultCallback (recognizerContext, model, configuration, res, mimeType) {\n logger.debug('iinkRestRecognizer result callback', model)\n const modelReference = InkModel.updateModelReceivedPosition(model)\n modelReference.rawResults.exports = res\n if (modelReference.exports) {\n Object.assign(modelReference.exports, extractExports(configuration, mimeType, res))\n } else {\n modelReference.exports = extractExports(configuration, mimeType, res)\n }\n logger.debug('iinkRestRecognizer model updated', modelReference)\n\n if (recognizerContext.editor.undoRedoManager) {\n handleSuccess(recognizerContext.editor, modelReference, Constants.EventType.EXPORTED, Constants.EventType.IDLE)\n }\n}\n\nfunction callPostMessage (recognizerContext, model, mimeType) {\n const configuration = recognizerContext.editor.configuration\n return postMessage('/api/v4.0/iink/batch', recognizerContext, model, buildData, configuration.restConversionState, mimeType)\n .then((res) => {\n resultCallback(recognizerContext, model, configuration, res, mimeType)\n return model\n })\n .catch((err) => {\n handleError(recognizerContext.editor, err)\n return err\n })\n}\n\n/**\n * Export content\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @param {Array} requestedMimeTypes\n */\nexport function export_ (recognizerContext, model, requestedMimeTypes) {\n const configuration = recognizerContext.editor.configuration\n if (requestedMimeTypes) {\n return Promise.all(requestedMimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'TEXT') {\n return Promise.all(configuration.recognitionParams.iink.text.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'DIAGRAM') {\n return Promise.all(configuration.recognitionParams.iink.diagram.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'MATH') {\n return Promise.all(configuration.recognitionParams.iink.math.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'Raw Content') {\n return Promise.all(configuration.recognitionParams.iink['raw-content'].mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n }\n return Promise.reject(new Error('Export failed'))\n}\n\n/**\n * Ask for conversion using DIGITAL_EDIT\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n */\nexport function convert (recognizerContext, model) {\n const configuration = recognizerContext.editor.configuration\n postMessage('/api/v4.0/iink/batch', recognizerContext, model, buildData, 'DIGITAL_EDIT')\n .then(res => resultCallback(model, configuration, res))\n .catch(err => handleError(recognizerContext.editor, err))\n}\n\n/**\n * Resize\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function resize (recognizerContext, model) {\n if (model.strokeGroups.length) {\n export_(recognizerContext, model)\n }\n}\n","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/*\n * UUID-js: A js library to generate and parse UUIDs, TimeUUIDs and generate\n * TimeUUID based on dates for range selections.\n * @see http://www.ietf.org/rfc/rfc4122.txt\n **/\n\nfunction UUIDjs() {\n};\n\nUUIDjs.maxFromBits = function(bits) {\n return Math.pow(2, bits);\n};\n\nUUIDjs.limitUI04 = UUIDjs.maxFromBits(4);\nUUIDjs.limitUI06 = UUIDjs.maxFromBits(6);\nUUIDjs.limitUI08 = UUIDjs.maxFromBits(8);\nUUIDjs.limitUI12 = UUIDjs.maxFromBits(12);\nUUIDjs.limitUI14 = UUIDjs.maxFromBits(14);\nUUIDjs.limitUI16 = UUIDjs.maxFromBits(16);\nUUIDjs.limitUI32 = UUIDjs.maxFromBits(32);\nUUIDjs.limitUI40 = UUIDjs.maxFromBits(40);\nUUIDjs.limitUI48 = UUIDjs.maxFromBits(48);\n\n// Returns a random integer between min and max\n// Using Math.round() will give you a non-uniform distribution!\n// @see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random\nfunction getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nUUIDjs.randomUI04 = function() {\n return getRandomInt(0, UUIDjs.limitUI04-1);\n};\nUUIDjs.randomUI06 = function() {\n return getRandomInt(0, UUIDjs.limitUI06-1);\n};\nUUIDjs.randomUI08 = function() {\n return getRandomInt(0, UUIDjs.limitUI08-1);\n};\nUUIDjs.randomUI12 = function() {\n return getRandomInt(0, UUIDjs.limitUI12-1);\n};\nUUIDjs.randomUI14 = function() {\n return getRandomInt(0, UUIDjs.limitUI14-1);\n};\nUUIDjs.randomUI16 = function() {\n return getRandomInt(0, UUIDjs.limitUI16-1);\n};\nUUIDjs.randomUI32 = function() {\n return getRandomInt(0, UUIDjs.limitUI32-1);\n};\nUUIDjs.randomUI40 = function() {\n return (0 | Math.random() * (1 << 30)) + (0 | Math.random() * (1 << 40 - 30)) * (1 << 30);\n};\nUUIDjs.randomUI48 = function() {\n return (0 | Math.random() * (1 << 30)) + (0 | Math.random() * (1 << 48 - 30)) * (1 << 30);\n};\n\nUUIDjs.paddedString = function(string, length, z) {\n string = String(string);\n z = (!z) ? '0' : z;\n var i = length - string.length;\n for (; i > 0; i >>>= 1, z += z) {\n if (i & 1) {\n string = z + string;\n }\n }\n return string;\n};\n\nUUIDjs.prototype.fromParts = function(timeLow, timeMid, timeHiAndVersion, clockSeqHiAndReserved, clockSeqLow, node) {\n this.version = (timeHiAndVersion >> 12) & 0xF;\n this.hex = UUIDjs.paddedString(timeLow.toString(16), 8)\n + '-'\n + UUIDjs.paddedString(timeMid.toString(16), 4)\n + '-'\n + UUIDjs.paddedString(timeHiAndVersion.toString(16), 4)\n + '-'\n + UUIDjs.paddedString(clockSeqHiAndReserved.toString(16), 2)\n + UUIDjs.paddedString(clockSeqLow.toString(16), 2)\n + '-'\n + UUIDjs.paddedString(node.toString(16), 12);\n return this;\n};\n\nUUIDjs.prototype.toString = function() {\n return this.hex;\n};\nUUIDjs.prototype.toURN = function() {\n return 'urn:uuid:' + this.hex;\n};\n\nUUIDjs.prototype.toBytes = function() {\n var parts = this.hex.split('-');\n var ints = [];\n var intPos = 0;\n for (var i = 0; i < parts.length; i++) {\n for (var j = 0; j < parts[i].length; j+=2) {\n ints[intPos++] = parseInt(parts[i].substr(j, 2), 16);\n }\n }\n return ints;\n};\n\nUUIDjs.prototype.equals = function(uuid) {\n if (!(uuid instanceof UUID)) {\n return false;\n }\n if (this.hex !== uuid.hex) {\n return false;\n }\n return true;\n};\n\nUUIDjs.getTimeFieldValues = function(time) {\n var ts = time - Date.UTC(1582, 9, 15);\n var hm = ((ts / 0x100000000) * 10000) & 0xFFFFFFF;\n return { low: ((ts & 0xFFFFFFF) * 10000) % 0x100000000,\n mid: hm & 0xFFFF, hi: hm >>> 16, timestamp: ts };\n};\n\nUUIDjs._create4 = function() {\n return new UUIDjs().fromParts(\n UUIDjs.randomUI32(),\n UUIDjs.randomUI16(),\n 0x4000 | UUIDjs.randomUI12(),\n 0x80 | UUIDjs.randomUI06(),\n UUIDjs.randomUI08(),\n UUIDjs.randomUI48()\n );\n};\n\nUUIDjs._create1 = function() {\n var now = new Date().getTime();\n var sequence = UUIDjs.randomUI14();\n var node = (UUIDjs.randomUI08() | 1) * 0x10000000000 + UUIDjs.randomUI40();\n var tick = UUIDjs.randomUI04();\n var timestamp = 0;\n var timestampRatio = 1/4;\n\n if (now != timestamp) {\n if (now < timestamp) {\n sequence++;\n }\n timestamp = now;\n tick = UUIDjs.randomUI04();\n } else if (Math.random() < timestampRatio && tick < 9984) {\n tick += 1 + UUIDjs.randomUI04();\n } else {\n sequence++;\n }\n\n var tf = UUIDjs.getTimeFieldValues(timestamp);\n var tl = tf.low + tick;\n var thav = (tf.hi & 0xFFF) | 0x1000;\n\n sequence &= 0x3FFF;\n var cshar = (sequence >>> 8) | 0x80;\n var csl = sequence & 0xFF;\n\n return new UUIDjs().fromParts(tl, tf.mid, thav, cshar, csl, node);\n};\n\nUUIDjs.create = function(version) {\n version = version || 4;\n return this['_create' + version]();\n};\n\nUUIDjs.fromTime = function(time, last) {\n last = (!last) ? false : last;\n var tf = UUIDjs.getTimeFieldValues(time);\n var tl = tf.low;\n var thav = (tf.hi & 0xFFF) | 0x1000; // set version '0001'\n if (last === false) {\n return new UUIDjs().fromParts(tl, tf.mid, thav, 0, 0, 0);\n } else {\n return new UUIDjs().fromParts(tl, tf.mid, thav, 0x80 | UUIDjs.limitUI06, UUIDjs.limitUI08 - 1, UUIDjs.limitUI48 - 1);\n }\n};\n\nUUIDjs.firstFromTime = function(time) {\n return UUIDjs.fromTime(time, false);\n};\nUUIDjs.lastFromTime = function(time) {\n return UUIDjs.fromTime(time, true);\n};\n\nUUIDjs.fromURN = function(strId) {\n var r, p = /^(?:urn:uuid:|\\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\\})?$/i;\n if ((r = p.exec(strId))) {\n return new UUIDjs().fromParts(parseInt(r[1], 16), parseInt(r[2], 16),\n parseInt(r[3], 16), parseInt(r[4], 16),\n parseInt(r[5], 16), parseInt(r[6], 16));\n }\n return null;\n};\n\nUUIDjs.fromBytes = function(ints) {\n if (ints.length < 5) {\n return null;\n }\n var str = '';\n var pos = 0;\n var parts = [4, 2, 2, 2, 6];\n for (var i = 0; i < parts.length; i++) {\n for (var j = 0; j < parts[i]; j++) {\n var octet = ints[pos++].toString(16);\n if (octet.length == 1) {\n octet = '0' + octet;\n }\n str += octet;\n }\n if (parts[i] !== 6) {\n str += '-';\n }\n }\n return UUIDjs.fromURN(str);\n};\n\nUUIDjs.fromBinary = function(binary) {\n var ints = [];\n for (var i = 0; i < binary.length; i++) {\n ints[i] = binary.charCodeAt(i);\n if (ints[i] > 255 || ints[i] < 0) {\n throw new Error('Unexpected byte in binary data.');\n }\n }\n return UUIDjs.fromBytes(ints);\n};\n\n// Aliases to support legacy code. Do not use these when writing new code as\n// they may be removed in future versions!\nUUIDjs.new = function() {\n return this.create(4);\n};\nUUIDjs.newTS = function() {\n return this.create(1);\n};\n\nmodule.exports = UUIDjs;\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as RecognizerContext from '../../model/RecognizerContext'\n\nfunction infinitePing (websocket) {\n const websocketRef = websocket\n websocketRef.pingLostCount++\n if (websocketRef.pingLostCount > websocketRef.maxPingLost) {\n websocket.close(1000, 'PING_LOST')\n } else if (websocketRef.readyState <= 1) {\n setTimeout(() => {\n if (websocketRef.readyState <= 1) {\n websocketRef.send(JSON.stringify({ type: 'ping' }))\n infinitePing(websocketRef)\n }\n }, websocketRef.pingDelay)\n }\n}\n\n/**\n * Attach all socket attributes helping managing server connexion\n * @param {WebSocket} websocket Current WebSocket\n * @param {RecognizerContext} recognizerContext\n */\nfunction addWebsocketAttributes (websocket, recognizerContext) {\n const websocketConfiguration = recognizerContext.editor.configuration.recognitionParams.server.websocket\n const socket = websocket\n socket.start = new Date()\n socket.autoReconnect = websocketConfiguration.autoReconnect\n socket.maxRetryCount = websocketConfiguration.maxRetryCount\n socket.pingEnabled = websocketConfiguration.pingEnabled\n socket.pingDelay = websocketConfiguration.pingDelay\n socket.maxPingLost = websocketConfiguration.maxPingLostCount\n socket.pingLostCount = 0\n socket.recognizerContext = recognizerContext\n}\n\n/**\n * @param {RecognizerContext} recognizerContext Recognizer context\n * @return {WebSocket} Opened WebSocket\n */\nexport function openWebSocket (recognizerContext) {\n let socket\n try {\n // eslint-disable-next-line no-undef\n socket = new WebSocket(recognizerContext.url)\n } catch (error) {\n logger.error('Unable to open websocket, Check the host and your connectivity')\n }\n addWebsocketAttributes(socket, recognizerContext)\n if (socket.pingEnabled) {\n infinitePing(socket)\n }\n\n socket.onopen = (e) => {\n logger.trace('onOpen')\n recognizerContext.websocketCallback(e)\n }\n\n socket.onclose = (e) => {\n logger.trace('onClose', new Date() - socket.start)\n recognizerContext.websocketCallback(e)\n }\n\n socket.onerror = (e) => {\n logger.trace('onError')\n recognizerContext.websocketCallback(e)\n }\n\n socket.onmessage = (e) => {\n logger.trace('onMessage')\n socket.pingLostCount = 0\n const parsedMessage = JSON.parse(e.data)\n if (parsedMessage.type !== 'pong') {\n const callBackParam = {\n type: e.type,\n data: JSON.parse(e.data)\n }\n recognizerContext.websocketCallback(callBackParam)\n }\n }\n\n return socket\n}\n\n/**\n * Send data message\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Object} message Data message\n */\nexport function send (recognizerContext, message) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.idle = false\n\n const websocket = recognizerContextRef.websocket\n if (websocket.readyState === 1) {\n websocket.send(JSON.stringify(message))\n logger.debug(`${message.type} message sent`, message)\n } else {\n throw RecognizerContext.LOST_CONNEXION_MESSAGE\n }\n}\n\n/**\n * Close the websocket\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Number} code Exit code\n * @param {String} reason Exit reason\n */\nexport function close (recognizerContext, code, reason) {\n const websocket = recognizerContext.websocket\n if (websocket && websocket.readyState < 2) {\n websocket.close(code, reason)\n }\n}\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as CryptoHelper from '../CryptoHelper'\nimport * as NetworkWSInterface from './networkWSInterface'\n\nimport {\n buildNewContentPackageInput,\n buildRestoreIInkSessionInput,\n buildNewContentPart,\n buildOpenContentPart,\n buildConfiguration\n} from './iinkWsRecognizer'\n\n/**\n * A websocket dialog have this sequence :\n * ---------- Client ------------------------------------- Server ----------------------------------\n * init (send the new content package) ================>\n * <=========== hmacChallenge\n * answerToHmacChallenge (send the hmac) =========>\n * newPart (send the parameters ) ===============>\n * <=========== update\n * addStrokes (send the strokes ) ============>\n * <=========== update\n */\n\nfunction buildHmacMessage (configuration, message) {\n return {\n type: 'hmac',\n hmac: CryptoHelper.computeHmac(message.data.hmacChallenge, configuration.recognitionParams.server.applicationKey, configuration.recognitionParams.server.hmacKey)\n }\n}\n\n/**\n * This function bind the right behaviour when a message is receive by the websocket.\n * @param {DestructuredPromise} destructuredPromise\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @return {function} Callback to handle WebSocket results\n */\nexport function buildWebSocketCallback (recognizerContext) {\n return (message) => {\n const recognizerContextRef = recognizerContext\n // Handle websocket messages\n logger.trace(`${message.type} websocket callback`, message)\n const recognitionContext = recognizerContext.recognitionContexts[recognizerContext.recognitionContexts.length - 1]\n logger.debug('Current recognition context', recognitionContext)\n\n switch (message.type) {\n case 'open':\n if (recognizerContext.sessionId) {\n NetworkWSInterface.send(recognizerContext, buildRestoreIInkSessionInput(recognizerContext.editor.configuration, recognizerContext.editor.domElement, recognizerContext.sessionId))\n } else {\n NetworkWSInterface.send(recognizerContext, buildNewContentPackageInput(recognizerContext.editor.configuration, recognizerContext.editor.domElement))\n }\n break\n case 'message':\n logger.debug(`Receiving ${message.data.type} message`, message)\n switch (message.data.type) {\n case 'ack':\n if (message.data.hmacChallenge) {\n NetworkWSInterface.send(recognizerContext, buildHmacMessage(recognizerContext.editor.configuration, message))\n }\n if (message.data.iinkSessionId) {\n recognizerContextRef.sessionId = message.data.iinkSessionId\n }\n break\n case 'newPart':\n break\n case 'contentPackageDescription':\n recognizerContextRef.currentReconnectionCount = 0\n recognizerContextRef.contentPartCount = message.data.contentPartCount\n NetworkWSInterface.send(recognizerContext, buildConfiguration(recognizerContext.editor.configuration))\n if (recognizerContextRef.currentPartId) { // FIXME: Ugly hack to resolve init promise after opening part\n NetworkWSInterface.send(recognizerContext, buildOpenContentPart(recognizerContext.editor.configuration, recognizerContext.currentPartId))\n } else {\n NetworkWSInterface.send(recognizerContext, buildNewContentPart(recognizerContext.editor.configuration))\n }\n break\n case 'partChanged':\n if (message.data.partId) {\n recognizerContextRef.currentPartId = message.data.partId\n }\n recognizerContextRef.initialized = true\n if (recognitionContext.partChange) {\n recognitionContext.partChange.resolve([undefined, message.data])\n } else {\n recognitionContext.error(message)\n }\n break\n case 'contentChanged':\n if (message.data.canUndo !== undefined) {\n recognizerContextRef.canUndo = message.data.canUndo\n }\n if (message.data.canRedo !== undefined) {\n recognizerContextRef.canRedo = message.data.canRedo\n }\n if (message.data.empty !== undefined) {\n recognizerContextRef.isEmpty = message.data.empty\n }\n if (message.data.possibleUndoCount !== undefined) {\n recognizerContextRef.possibleUndoCount = message.data.possibleUndoCount\n }\n if (message.data.undoStackIndex !== undefined) {\n recognizerContextRef.undoStackIndex = message.data.undoStackIndex\n }\n recognitionContext.contentChange.resolve([undefined, message.data])\n break\n case 'exported':\n recognitionContext.response(undefined, message.data)\n break\n case 'svgPatch':\n recognitionContext.patch(undefined, message.data)\n break\n case 'supportedImportMimeTypes':\n recognizerContextRef.supportedImportMimeTypes = message.data.mimeTypes\n recognitionContext.response(undefined, message.data)\n break\n case 'fileChunkAck':\n recognitionContext.response(undefined, message.data)\n break\n case 'idle':\n recognizerContextRef.idle = true\n recognitionContext.patch(undefined, message.data)\n break\n case 'error':\n logger.debug('Error detected stopping all recognition', message)\n if (recognitionContext) {\n let func = () => {}\n if (recognitionContext.patch) {\n func = recognitionContext.patch\n } else if (recognitionContext.response) {\n func = recognitionContext.response\n }\n func(message.data)\n } else {\n recognitionContext.initPromise.reject(Object.assign({}, message.data, { recoverable: false }))\n }\n break\n default :\n logger.warn('This is something unexpected in current recognizer. Not the type of message we should have here.', message)\n }\n break\n case 'error':\n logger.debug('Error detected stopping all recognition', message)\n if (recognitionContext) {\n let func = () => {}\n if (recognitionContext.patch) {\n func = recognitionContext.patch\n } else if (recognitionContext.response) {\n func = recognitionContext.response\n }\n func(Object.assign({}, message, { recoverable: false }))\n } else {\n recognitionContext.initPromise.reject(Object.assign({}, message, { recoverable: false }))\n }\n break\n case 'close':\n logger.debug('Close detected stopping all recognition', message)\n recognizerContextRef.initialized = false\n if (message.reason === 'CLOSE_RECOGNIZER') {\n recognitionContext.initPromise.resolve(message)\n } else {\n if (recognitionContext) {\n recognitionContext.error(message)\n } else {\n recognitionContext.initPromise.reject(message)\n }\n }\n break\n default :\n logger.warn('This is something unexpected in current recognizer. Not the type of message we should have here.', message)\n }\n }\n}\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as NetworkWSInterface from './networkWSInterface'\nimport * as PromiseHelper from '../../util/PromiseHelper'\nimport * as InkModel from '../../model/InkModel'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport {\n responseCallback,\n setTheme,\n setPenStyle,\n setPenStyleClasses\n} from './iinkWsRecognizer'\n\nfunction buildUrl (configuration, suffixUrl) {\n const scheme = (configuration.recognitionParams.server.scheme === 'https') ? 'wss' : 'ws'\n return `${scheme}://${configuration.recognitionParams.server.host}${suffixUrl}`\n}\n\n/**\n * Build websocket function\n * @typedef {function} BuildWebSocketFunction\n * @param {DestructuredPromise} destructuredPromise\n * @param {RecognizerContext} recognizerContext\n * @return {Callback}\n */\n\n/**\n * Init the websocket recognizer.\n * Open the connexion and proceed to the hmac challenge.\n * @param {String} suffixUrl\n * @param {RecognizerContext} recognizerContext\n * @param {BuildWebSocketFunction} buildWebSocketCallback\n * @param {function} reconnect\n * @return {Promise} Fulfilled when the init phase is over.\n */\nexport function init (suffixUrl, recognizerContext, buildWebSocketCallback, reconnect) {\n const recognitionContext = recognizerContext.recognitionContexts[0]\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, recognitionContext.model.lastPositions)\n recognizerContextReference.url = buildUrl(recognizerContext.editor.configuration, suffixUrl)\n recognizerContextReference.reconnect = reconnect\n\n recognizerContextReference.initPromise = recognitionContext.initPromise.promise\n\n logger.debug('Opening the websocket for context ', recognizerContext)\n recognizerContextReference.websocketCallback = buildWebSocketCallback(recognizerContextReference)\n recognizerContextReference.websocket = NetworkWSInterface.openWebSocket(recognizerContextReference)\n return recognizerContextReference.initPromise\n}\n\nexport async function retry (func, recognizerContext, model, buildFunc, ...params) {\n if (RecognizerContext.shouldAttemptImmediateReconnect(recognizerContext) && recognizerContext.reconnect) {\n logger.info('Attempting a retry', recognizerContext.currentReconnectionCount)\n await recognizerContext.reconnect(recognizerContext, model)\n .catch((err) => {\n logger.error('Failed retry', err)\n retry(func, recognizerContext, model, buildFunc, ...params)\n })\n setTheme(recognizerContext, model, recognizerContext.editor.theme)\n setPenStyle(recognizerContext, model, recognizerContext.editor.penStyle)\n setPenStyleClasses(recognizerContext, model, recognizerContext.editor.penStyleClasses)\n\n return func(recognizerContext, model, buildFunc, ...params)\n } else {\n responseCallback(model, 'Unable to reconnect')\n }\n}\n\n/**\n * @param {RecognizerContext} recognizerContext\n * @param {function} buildMessage\n * @param {...Object} params\n * @return {Promise}\n */\nexport function sendMessage (recognizerContext, buildMessage, ...params) {\n return recognizerContext.initPromise\n .then(() => {\n logger.trace('Init was done. Sending message')\n const message = buildMessage(...params)\n if (message) {\n NetworkWSInterface.send(recognizerContext, message)\n const positions = recognizerContext.recognitionContexts[0].model.lastPositions\n if (positions) {\n RecognizerContext.updateRecognitionPositions(recognizerContext, positions)\n }\n } else {\n logger.warn('empty message')\n }\n })\n}\n\n/**\n * Do what is needed to clean the server context.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @param {RecognizerCallback} callback\n */\nexport function clear (recognizerContext, model, callback) {\n const modelRef = InkModel.clearModel(model)\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n if (recognizerContextReference && recognizerContextReference.websocket) {\n // We have to send again all strokes after a clear.\n delete recognizerContextReference.instanceId\n try {\n NetworkWSInterface.send(recognizerContextReference, { type: 'reset' })\n } catch (sendFailedException) {\n // To force failure without breaking the flow\n // FIXME not working at all\n recognizerContextReference.websocketCallback(PromiseHelper.destructurePromise(), recognizerContextReference, model)\n }\n }\n // We do not keep track of the success of clear.\n callback(undefined, modelRef)\n}\n\n/**\n * Close and free all resources that will no longer be used by the recognizer.\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n */\nexport function close (recognizerContext, model) {\n const initPromise = PromiseHelper.destructurePromise()\n const recognizerContextRef = recognizerContext\n const recognitionContext = {\n model,\n initPromise,\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n }\n\n return recognizerContext.initPromise\n .then(() => {\n recognizerContextRef.recognitionContexts[0] = recognitionContext\n return recognizerContextRef\n })\n .then((context) => {\n NetworkWSInterface.close(context, 1000, RecognizerContext.CLOSE_RECOGNIZER_MESSAGE)\n return recognitionContext.model\n })\n}\n","import uuid from 'uuid-js'\nimport { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport Constants from '../../configuration/Constants'\nimport * as DefaultTheme from '../../configuration/DefaultTheme'\nimport * as DefaultPenStyle from '../../configuration/DefaultPenStyle'\nimport * as InkModel from '../../model/InkModel'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport * as DefaultRecognizer from '../DefaultRecognizer'\nimport * as WsBuilder from './WsBuilder'\nimport * as WsRecognizerUtil from './WsRecognizerUtil'\nimport * as PromiseHelper from '../../util/PromiseHelper'\nimport { handleError, handleSuccess } from '../RecognizerService'\n\nexport { close } from './WsRecognizerUtil'\n\nfunction readBlob (blob) {\n const fileReader = new FileReader()\n return new Promise((resolve, reject) => {\n fileReader.onload = event => resolve(event.target.result)\n fileReader.onerror = () => reject(new Error(this))\n fileReader.readAsText(blob)\n })\n}\n\nfunction getDPI (element) {\n // const startDpi = 56;\n // for (let dpi = startDpi; dpi < 2000; dpi++) {\n // if (window.matchMedia(`(max-resolution: ${dpi}dpi)`).matches === true) {\n // return dpi;\n // }\n // }\n // return startDpi;\n return 96\n}\n\n/**\n * Recognizer configuration\n * @type {RecognizerInfo}\n */\nexport const IinkWsConfiguration = {\n types: [Constants.RecognitionType.MATH, Constants.RecognitionType.TEXT, Constants.RecognitionType.DIAGRAM, Constants.RecognitionType.NEBO],\n protocol: Constants.Protocol.WEBSOCKET,\n availableTriggers: {\n exportContent: [Constants.Trigger.POINTER_UP, Constants.Trigger.DEMAND],\n addStrokes: [Constants.Trigger.POINTER_UP]\n }\n}\n\n/**\n * Get the configuration supported by this recognizer\n * @return {RecognizerInfo}\n */\nexport function getInfo () {\n return IinkWsConfiguration\n}\n\nexport function buildNewContentPackageInput (configuration, element) {\n return {\n type: 'newContentPackage',\n applicationKey: configuration.recognitionParams.server.applicationKey,\n xDpi: getDPI(element),\n yDpi: getDPI(element),\n viewSizeHeight: element.clientHeight < configuration.renderingParams.minHeight ? configuration.renderingParams.minHeight : element.clientHeight,\n viewSizeWidth: element.clientWidth < configuration.renderingParams.minWidth ? configuration.renderingParams.minWidth : element.clientWidth\n }\n}\n\nexport function buildRestoreIInkSessionInput (configuration, element, sessionId) {\n return {\n type: 'restoreIInkSession',\n iinkSessionId: sessionId,\n applicationKey: configuration.recognitionParams.server.applicationKey,\n xDpi: getDPI(element),\n yDpi: getDPI(element),\n viewSizeHeight: element.clientHeight < configuration.renderingParams.minHeight ? configuration.renderingParams.minHeight : element.clientHeight,\n viewSizeWidth: element.clientWidth < configuration.renderingParams.minWidth ? configuration.renderingParams.minWidth : element.clientWidth\n }\n}\n\nexport function buildNewContentPart (configuration) {\n return {\n type: 'newContentPart',\n contentType: configuration.recognitionParams.type,\n mimeTypes: (configuration.triggers.exportContent !== Constants.Trigger.DEMAND)\n ? configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes : undefined\n }\n}\n\nexport function buildOpenContentPart (configuration, partId) {\n return {\n type: 'openContentPart',\n id: partId,\n mimeTypes: (configuration.triggers.exportContent !== Constants.Trigger.DEMAND)\n ? configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes : undefined\n }\n}\n\nexport function buildConfiguration (configuration) {\n return Object.assign({ type: 'configuration' }, configuration.recognitionParams.iink)\n}\n\nfunction buildAddStrokes (recognizerContext, model) {\n const strokes = InkModel.extractPendingStrokes(model, recognizerContext.lastPositions.lastSentPosition + 1)\n if (strokes.length > 0) {\n InkModel.updateModelSentPosition(model)\n return {\n type: 'addStrokes',\n strokes: strokes.map(stroke => Object.assign({}, {\n id: stroke.id,\n pointerType: stroke.pointerType,\n pointerId: stroke.pointerId,\n x: stroke.x,\n y: stroke.y,\n t: stroke.t,\n p: stroke.p\n }))\n }\n }\n return undefined\n}\n\nfunction buildUndo () {\n return {\n type: 'undo'\n }\n}\n\nfunction buildRedo () {\n return {\n type: 'redo'\n }\n}\n\nfunction buildClear () {\n return {\n type: 'clear'\n }\n}\n\nfunction buildConvert (state) {\n return {\n type: 'convert',\n conversionState: state\n }\n}\n\nfunction buildZoom (value) {\n return {\n type: 'zoom',\n zoom: value\n }\n}\n\nfunction buildResize (element, minHeight = 0, minWidth = 0) {\n return {\n type: 'changeViewSize',\n height: element.clientHeight < minHeight ? minHeight : element.clientHeight,\n width: element.clientWidth < minWidth ? minWidth : element.clientWidth\n }\n}\n\nfunction buildExport (configuration, partId, requestedMimeType) {\n let usedMimeType\n if (requestedMimeType && Object.keys(requestedMimeType).length !== 0) {\n usedMimeType = requestedMimeType\n } else {\n usedMimeType = configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes\n }\n\n return {\n type: 'export',\n partId,\n mimeTypes: usedMimeType\n }\n}\n\nfunction buildImportFile (id, mimetype) {\n return {\n type: 'importFile',\n importFileId: id,\n mimeType: mimetype\n }\n}\n\nfunction buildImportChunk (id, data, lastChunk) {\n return {\n type: 'fileChunk',\n importFileId: id,\n data,\n lastChunk\n }\n}\n\nfunction buildPointerEvents (events) {\n return Object.assign({ type: 'pointerEvents' }, events)\n}\n\nfunction buildWaitForIdle () {\n return {\n type: 'waitForIdle'\n }\n}\n\nfunction buildGetSupportedImportMimeTypes () {\n return {\n type: 'getSupportedImportMimeTypes'\n }\n}\n\nexport function buildSetPenStyle (penStyle) {\n return {\n type: 'setPenStyle',\n style: penStyle ? DefaultPenStyle.toCSS(penStyle) : ''\n }\n}\n\nexport function buildSetPenStyleClasses (penStyleClasses) {\n return {\n type: 'setPenStyleClasses',\n styleClasses: penStyleClasses\n }\n}\n\nexport function buildSetTheme (theme) {\n return {\n type: 'setTheme',\n theme: DefaultTheme.toCSS(theme)\n }\n}\n\nexport const responseCallback = (model, err, res, recognizerContext) => {\n const modelReference = InkModel.updateModelReceivedPosition(model)\n if (res) {\n let event = ''\n if (res.updates !== undefined) {\n if (modelReference.recognizedSymbols) {\n modelReference.recognizedSymbols.push(res)\n } else {\n modelReference.recognizedSymbols = [res]\n }\n event = Constants.EventType.RENDERED\n }\n if (res.exports !== undefined) {\n modelReference.rawResults.exports = res\n modelReference.exports = res.exports\n event = Constants.EventType.EXPORTED\n }\n\n if ((res.canUndo !== undefined) || (res.canRedo !== undefined)) {\n event = Constants.EventType.CHANGED\n }\n\n if (res.type === 'supportedImportMimeTypes') {\n event = Constants.EventType.SUPPORTED_IMPORT_MIMETYPES\n }\n\n if (res.type === 'partChanged') {\n event = Constants.EventType.LOADED\n }\n\n if (res.type === 'idle') {\n event = Constants.EventType.IDLE\n }\n\n if (res.type === 'close') {\n event = Constants.EventType.CHANGED\n }\n return handleSuccess(recognizerContext.editor, model, event)\n }\n return handleError(recognizerContext.editor, err)\n}\n\n/**\n * Initialize recognition\n * The init process is in multiple part :\n * - partChange\n * - contentChange\n * - initPromise: resolved only if partChange & contentChange resolved except for MATH recognition\n *\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n */\nexport async function init (recognizerContext, model) {\n const contentChange = PromiseHelper.destructurePromise()\n const partChange = PromiseHelper.destructurePromise()\n const initPromise = PromiseHelper.destructurePromise()\n\n let recognizerContextRef\n let contentChanged = null\n\n if (recognizerContext.editor.innerConfiguration.recognitionParams.type === 'MATH' ||\n recognizerContext.editor.innerConfiguration.recognitionParams.type === 'DIAGRAM') {\n recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model: InkModel.updateModelSentPosition(model, model.lastPositions.lastReceivedPosition),\n partChange,\n initPromise,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n } else {\n recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model: InkModel.updateModelSentPosition(model, model.lastPositions.lastReceivedPosition),\n contentChange,\n partChange,\n response: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n initPromise,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n contentChanged = recognizerContextRef.recognitionContexts[0].contentChange.promise\n }\n\n WsRecognizerUtil.init('/api/v4.0/iink/document', recognizerContextRef, WsBuilder.buildWebSocketCallback, init)\n .catch(async (err) => {\n if (RecognizerContext.shouldAttemptImmediateReconnect(recognizerContext) && recognizerContext.reconnect) {\n logger.info('Attempting a reconnect', recognizerContext.currentReconnectionCount)\n await recognizerContext.reconnect(recognizerContext, model)\n } else {\n logger.error('Unable to reconnect', err)\n responseCallback(model, err, undefined, recognizerContext)\n }\n })\n\n const [errPartChanged, resPartChanged] = await recognizerContextRef.recognitionContexts[0].partChange.promise\n if (resPartChanged) {\n responseCallback(model, errPartChanged, resPartChanged, recognizerContext)\n if (contentChanged !== null) {\n const [errContentChanged, resContentChanged] = await contentChanged\n if (resContentChanged) {\n responseCallback(model, errContentChanged, resContentChanged, recognizerContext)\n }\n }\n recognizerContextRef.recognitionContexts[0].initPromise.resolve(true)\n }\n\n return recognizerContextRef.recognitionContexts[0].initPromise\n}\n\n/**\n *\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Function} buildFunction build the websocket message\n * @param {...Object} params spread parameters, will be passed to buildFunction\n * @private\n */\n// eslint-disable-next-line no-underscore-dangle\nasync function _prepareMessage (recognizerContext, model, buildFunction, ...params) {\n logger.info(`-- Prepare message for ${buildFunction.name} --`)\n const contentChange = PromiseHelper.destructurePromise()\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model,\n response: (err, res) => {\n const onDemand = recognizerContext.editor.configuration.triggers.exportContent === Constants.Trigger.DEMAND\n if (!onDemand || (onDemand && buildFunction.name === 'buildExport')) {\n responseCallback(model, err, res, recognizerContextRef)\n }\n },\n contentChange,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n WsRecognizerUtil.sendMessage(recognizerContextRef, buildFunction, ...params)\n .catch((err) => {\n logger.error(err)\n WsRecognizerUtil.retry(_prepareMessage, recognizerContext, model, buildFunction, ...params)\n })\n\n const contentChanged = await recognizerContextRef.recognitionContexts[0].contentChange.promise\n\n if (contentChanged) {\n responseCallback(model, contentChanged[0], contentChanged[1], recognizerContextRef)\n return {\n res: model,\n types: []\n }\n }\n\n return null\n}\n\n/**\n * Create a new content part\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function newContentPart (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildNewContentPart, recognizerContext.editor.configuration)\n}\n\n/**\n * Open the recognizer context content part\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function openContentPart (recognizerContext, model) {\n const params = [recognizerContext.editor.configuration, recognizerContext.currentPartId]\n return _prepareMessage(recognizerContext, model, buildOpenContentPart, params)\n}\n\n/**\n * Send the recognizer configuration\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function sendConfiguration (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildConfiguration, recognizerContext.editor.configuration)\n}\n\n/**\n * Pointer Events\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {PointerEvents} events to be imported\n */\nexport function pointerEvents (recognizerContext, model, events) {\n return _prepareMessage(recognizerContext, model, buildPointerEvents, events)\n}\n\n/**\n * Add strokes to the model\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function addStrokes (recognizerContext, model) {\n const params = [recognizerContext, model]\n return _prepareMessage(recognizerContext, model, buildAddStrokes, ...params)\n}\n\n/**\n * Undo last action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function undo (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildUndo)\n}\n\n/**\n * Redo last action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function redo (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildRedo)\n}\n\n/**\n * Clear action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport async function clear (recognizerContext, model) {\n const contentChange = PromiseHelper.destructurePromise()\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model,\n response: (err, res) => {\n if (recognizerContext.editor.configuration.triggers.exportContent !== Constants.Trigger.DEMAND) {\n responseCallback(model, err, res, recognizerContextRef)\n }\n },\n contentChange,\n // eslint-disable-next-line handle-callback-err\n patch: async (error, result) => {\n const { err, res } = await DefaultRecognizer.clear(recognizerContext, model)\n responseCallback(res, err, result, recognizerContextRef)\n }\n })\n WsRecognizerUtil.sendMessage(recognizerContextRef, buildClear)\n .catch(exception => WsRecognizerUtil.retry(clear, recognizerContext, model))\n\n const contentChanged = await recognizerContextRef.recognitionContexts[0].contentChange.promise\n\n if (contentChanged) {\n responseCallback(model, contentChanged[0], contentChanged[1], recognizerContextRef)\n return {\n err: undefined,\n res: recognizerContextRef.recognitionContexts[0].model,\n events: []\n }\n }\n\n return null\n}\n\n/**\n * Convert action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {String} conversionState Conversion State, by default DigitalEdit\n */\nexport function convert (recognizerContext, model, conversionState) {\n return _prepareMessage(recognizerContext, model, buildConvert, conversionState)\n}\n\n/**\n * Export action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Array} requestedMimeTypes\n */\n// eslint-disable-next-line no-underscore-dangle\nexport function export_ (recognizerContext, model, requestedMimeTypes) {\n const params = [recognizerContext.editor.configuration, recognizerContext.currentPartId, requestedMimeTypes]\n return _prepareMessage(recognizerContext, model, buildExport, ...params)\n}\n\n/**\n * Import action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Blob} data Import data\n */\n// eslint-disable-next-line no-underscore-dangle\nexport function import_ (recognizerContext, model, data) {\n const recognitionContext = {\n model,\n response: (err, res) => responseCallback(model, err, res, recognizerContext),\n importFileId: uuid.create(4).toString()\n }\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, recognitionContext)\n\n const chunkSize = recognizerContext.editor.configuration.recognitionParams.server.websocket.fileChunkSize\n\n const messages = []\n for (let i = 0; i < data.size; i += chunkSize) {\n if (i === 0) {\n messages.push(_prepareMessage(recognizerContextRef, model, buildImportFile, recognitionContext.importFileId, data.type))\n }\n const blobPart = data.slice(i, chunkSize, data.type)\n readBlob(blobPart).then((res) => {\n const params = [recognitionContext.importFileId, res, i + chunkSize > data.size]\n messages.push(_prepareMessage(recognizerContextRef, model, buildImportChunk, ...params))\n })\n }\n\n return Promise.all(messages)\n}\n\n/**\n * Ask for the supported mimetypes\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function getSupportedImportMimeTypes (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildGetSupportedImportMimeTypes)\n}\n\n/**\n * WaitForIdle action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function waitForIdle (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildWaitForIdle)\n}\n\n/**\n * Resize\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Element} element Current element\n */\nexport function resize (recognizerContext, model, element) {\n const params = [element, recognizerContext.editor.configuration.renderingParams.minHeight, recognizerContext.editor.configuration.renderingParams.minWidth]\n return _prepareMessage(recognizerContext, model, buildResize, ...params)\n}\n\n/**\n * Zoom action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Number} value=10 Zoom value\n */\nexport function zoom (recognizerContext, model, value = 10) {\n return _prepareMessage(recognizerContext, model, buildZoom, value)\n}\n\n/**\n * SetPenStyle action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {PenStyle} penStyle Current penStyle\n */\nexport function setPenStyle (recognizerContext, model, penStyle) {\n return _prepareMessage(recognizerContext, model, buildSetPenStyle, penStyle)\n}\n\n/**\n * setPenStyleClasses action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {String} penStyleClasses Current penStyleClasses\n */\nexport function setPenStyleClasses (recognizerContext, model, penStyleClasses) {\n return _prepareMessage(recognizerContext, model, buildSetPenStyleClasses, penStyleClasses)\n}\n\n/**\n * SetTheme action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Theme} theme Current theme\n */\nexport function setTheme (recognizerContext, model, theme) {\n return _prepareMessage(recognizerContext, model, buildSetTheme, theme)\n}\n","import { eventLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Emits an event when the editor state change\n * @param {String} type\n * @param {Object} data\n * @emits {Event}\n */\nexport default function emit (type, data) {\n logger.info(`emitting ${type} event`, data)\n // We are making usage of a browser provided class\n // eslint-disable-next-line no-undef\n this.dispatchEvent(new CustomEvent(type, Object.assign({ bubbles: true, composed: true }, data ? { detail: data } : undefined)))\n}\n","import { editorLogger as logger } from './configuration/LoggerConfig'\nimport { Editor } from './Editor'\n\n/**\n * Attach an Editor to a DOMElement\n * @param {Element} element DOM element to attach an editor\n * @param {Configuration} [configuration] Configuration to apply\n * @param {PenStyle} [penStyle] Pen style to apply\n * @param {Theme} [theme] Theme to apply\n * @param {Behaviors} [behaviors] Custom behaviors to apply\n * @param {String} [globalClassCSS] Replace global class css 'ms-editor' to customize style\n * @return {Editor} New editor\n */\nexport function register (element, configuration, penStyle, theme, behaviors, globalClassCSS) {\n logger.debug('Registering a new editor')\n return new Editor(element, configuration, penStyle, theme, behaviors, globalClassCSS)\n}\n\n/**\n * Return the list of available recognition languages\n * @param {Configuration} [configuration] Configuration to get the languages\n * @return {JSON} A list of available languages\n */\nexport async function getAvailableLanguageList (configuration) {\n try {\n if (configuration && configuration.recognitionParams &&\n configuration.recognitionParams.server && configuration.recognitionParams.server.host) {\n const serverConfig = configuration.recognitionParams.server\n const response = await fetch(`${serverConfig.scheme}://${serverConfig.host}/api/v4.0/iink/availableLanguageList`)\n if (response && response.ok) {\n return response.json()\n }\n } else {\n console.error('Cannot get languages ! Please check your configuration!')\n }\n } catch (error) {\n console.error(error)\n }\n}\n","import Constants from './configuration/Constants'\nimport LoggerConfig from './configuration/LoggerConfig'\nimport DefaultConfiguration from './configuration/DefaultConfiguration'\nimport DefaultPenStyle from './configuration/DefaultPenStyle'\nimport DefaultTheme from './configuration/DefaultTheme'\nimport DefaultBehaviors from './configuration/DefaultBehaviors'\nimport * as InkModel from './model/InkModel'\nimport { Editor } from './Editor'\nimport { register, getAvailableLanguageList } from './EditorFacade'\nimport * as RecognizerContext from './model/RecognizerContext'\n\nconst iink = {\n Constants,\n // Default instantiations\n DefaultConfiguration,\n DefaultBehaviors,\n DefaultPenStyle,\n DefaultTheme,\n // Helper functions\n register,\n getAvailableLanguageList,\n // Internals\n LoggerConfig,\n Editor,\n InkModel,\n RecognizerContext\n}\n\nexport {\n iink as default,\n Constants,\n // Default instantiations\n DefaultConfiguration,\n DefaultBehaviors,\n DefaultPenStyle,\n DefaultTheme,\n // Helper functions\n register,\n getAvailableLanguageList,\n // Internals\n LoggerConfig,\n Editor,\n InkModel,\n RecognizerContext\n}\n"],"names":["Constants","EventType","IDLE","CHANGED","IMPORTED","EXPORTED","CONVERTED","RENDERED","LOADED","UNDO","REDO","CLEAR","IMPORT","SUPPORTED_IMPORT_MIMETYPES","EXPORT","CONVERT","ERROR","RecognitionType","TEXT","MATH","DIAGRAM","RAWCONTENT","Protocol","WEBSOCKET","REST","ModelState","INITIALIZING","INITIALIZED","EXPORTING","PENDING","MODIFIED","Trigger","QUIET_PERIOD","POINTER_UP","DEMAND","Logger","EDITOR","MODEL","GRABBER","RENDERER","RECOGNIZER","EVENT","UTIL","SMARTGUIDE","LogLevel","TRACE","DEBUG","INFO","WARN","Languages","zh_CN","zh_HK","zh_TW","ko_KR","ja_JP","Error","NOT_REACHABLE","WRONG_CREDENTIALS","TOO_OLD","NO_ACTIVITY","Exports","JIIX","log","loglevel","root","definition","module","exports","this","noop","undefinedType","isIE","window","navigator","test","userAgent","logMethods","bindMethod","obj","methodName","method","bind","Function","prototype","call","e","apply","arguments","traceForIE","console","trace","realMethod","undefined","replaceLoggingMethods","level","loggerName","i","length","methodFactory","debug","enableLoggingWhenConsoleArrives","defaultMethodFactory","name","defaultLevel","factory","currentLevel","self","storageKey","getPersistedLevel","storedLevel","localStorage","ignore","cookie","document","location","indexOf","encodeURIComponent","exec","slice","levels","SILENT","getLevel","setLevel","persist","toUpperCase","persistLevelIfPossible","levelNum","levelName","setDefaultLevel","enableAll","disableAll","initialLevel","defaultLogger","_loggersByName","getLogger","TypeError","logger","_log","noConflict","getLoggers","editorLogger","modelLogger","grabberLogger","rendererLogger","recognizerLogger","eventLogger","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","global","Object","freeSelf","freeExports","nodeType","freeModule","moduleExports","freeProcess","process","nodeUtil","types","require","binding","nodeIsTypedArray","isTypedArray","func","thisArg","args","uid","arrayProto","Array","funcProto","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","Symbol","Uint8Array","allocUnsafe","getPrototype","overArg","transform","arg","getPrototypeOf","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","defineProperty","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","max","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","index","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","arrayLikeKeys","value","inherited","isArr","isArray","isArg","isArguments","isBuff","isType","skipIndexes","baseTimes","n","iteratee","String","key","isIndex","push","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","configurable","enumerable","writable","hashClear","hashDelete","has","get","hashGet","hashHas","hashSet","listCacheClear","listCacheDelete","pop","listCacheGet","listCacheHas","listCacheSet","mapCacheClear","hash","map","string","mapCacheDelete","getMapData","mapCacheGet","mapCacheHas","mapCacheSet","stackClear","stackDelete","stackGet","stackHas","stackSet","pairs","LARGE_ARRAY_SIZE","baseFor","createBaseFor","fromRight","keysFunc","iterable","props","baseGetTag","getRawTag","isOwn","tag","unmasked","objectToString","baseIsArguments","isObjectLike","baseIsNative","isMasked","isFunction","toSource","baseKeysIn","nativeKeysIn","isProto","isPrototype","baseMerge","source","srcIndex","customizer","stack","srcValue","baseMergeDeep","mergeFunc","safeGet","stacked","newValue","isCommon","isTyped","isArrayLikeObject","isArrayLike","cloneBuffer","buffer","isDeep","constructor","copy","cloneTypedArray","typedArray","cloneArrayBuffer","arrayBuffer","byteLength","byteOffset","copyArray","isPlainObject","Ctor","toPlainObject","copyObject","isNew","keysIn","initCloneObject","baseRest","start","setToString","overRest","otherArgs","identity","isKeyable","type","getValue","shortOut","count","lastCalled","stamp","remaining","other","isLength","stubFalse","baseUnary","baseIsTypedArray","merge","createAssigner","assigner","sources","guard","isIterateeCall","defaultConfiguration","recognitionParams","protocol","server","scheme","host","applicationKey","hmacKey","useWindowLocation","websocket","pingEnabled","pingDelay","maxPingLostCount","autoReconnect","maxRetryCount","fileChunkSize","iink","alwaysConnected","lang","jiix","strokes","text","chars","words","renderer","math","mimeTypes","solver","enable","margin","bottom","left","right","top","eraser","guides","smartGuide","smartGuideFadeOut","duration","diagram","recognition","shape","listenerOptions","capture","passive","undoRedoMaxStackSize","xyFloatPrecision","timestampFloatPrecision","triggerDelay","processDelay","resizeTriggerDelay","triggers","exportContent","addStrokes","restConversionState","renderingParams","stroker","minHeight","minWidth","t","o","r","l","m","c","d","__esModule","default","p","s","iterator","toJSON","error","u","split","forEach","trim","substring","_trimSemiColon","toCSS","defaultPenStyle","parser","JsonCSS","penStyle","css","defaultTheme","ink","color","theme","floatPrecisionArray","roundFloat","oneFloat","requestedFloatPrecision","floatPrecision","round","extractPoint","event","domElement","configuration","offsetTop","offsetLeft","eventRef","changedTouches","rect","getBoundingClientRect","x","clientX","clientLeft","y","clientY","clientTop","prevent","preventDefault","attach","element","editor","mMaxDiffX","unfocus","getSelection","removeAllRanges","hideMenu","evt","moreMenuInDocument","querySelector","target","classList","contains","style","display","hideCandidates","candidatesInDocument","tagName","pointerDownHandler","pointerDownOnEditor","id","activePointerId","pointerId","button","buttons","stopPropagation","pointerType","isErasing","pointerDown","smartGuidePointerDown","downSmartGuidePoint","pointerMoveHandler","pointerMove","point","diffX","abs","diffY","pointerUpHandler","smartGuideIds","scrollbarClasses","pointerEnteredSmartGuide","relatedTarget","includes","className","pointerExitedSmartGuide","pointerMovedWords","pointerUp","context","options","listeners","listener","item","addEventListener","documentElement","detach","removeEventListener","_arrayLikeToArray","arr","len","arr2","_arrayWithoutHoles","arrayLikeToArray","_iterableToArray","iter","from","_unsupportedIterableToArray","minLen","_nonIterableSpread","_toConsumableArray","arrayWithoutHoles","iterableToArray","unsupportedIterableToArray","nonIterableSpread","drawStroke","stroke","ShapeSymbols","table","recognizedShape","ellipse","line","phi","angle","returnedAngle","PI","drawArrowHead","headPoint","alpha","beta","contextReference","save","fillStyle","strokeStyle","moveTo","beginPath","lineTo","cos","sin","fill","restore","drawShapeEllipse","shapeEllipse","points","drawEllipseArc","centerPoint","maxRadius","minRadius","orientation","startAngle","sweepAngle","z1","z3","z2","z4","floor","boundariesPoints","atan2","cosAlpha","sinAlpha","center","beginDecoration","beginTangentAngle","endDecoration","endTangentAngle","drawLine","p1","p2","drawShapeSymbol","symbol","lineWidth","width","elementType","candidates","selectedCandidateIndex","lines","drawShapeLine","shapeLine","firstPoint","lastPoint","primitives","primitive","TextSymbols","inputCharacter","textLine","drawTextLine","drawText","label","font","textHeight","textAlign","justificationType","textBaseline","fillText","topLeftPoint","height","underlineList","underline","drawUnderline","delta","firstCharacter","lastCharacter","computeDistance","xArray","yArray","lastIndexPoint","distance","sqrt","pow","isNaN","computeLength","lArray","createStrokeComponent","properties","assign","addPoint","strokeReference","filterPointByAcquisitionDelta","ret","computePressure","ratio","pressure","parseFloat","end","slicedStroke","getPointByIndex","mergeBounds","boundsA","boundsB","minX","min","maxX","minY","maxY","getLineBounds","getEllipseBounds","getTextLineBounds","getClefBounds","clef","boundingBox","getStrokeBounds","getSymbolsBounds","symbols","bounds","Number","MAX_VALUE","MIN_VALUE","boundsRef","filter","reduce","createModel","currentStroke","rawStrokes","strokeGroups","lastPositions","lastSentPosition","lastReceivedPosition","lastRenderedPosition","defaultSymbols","recognizedSymbols","rawResults","convert","creationTime","getTime","modificationTime","clearModel","model","modelReference","needRedraw","addStroke","addStrokeToGroup","strokePenStyle","lastGroup","newStrokeGroup","strokeCopy","extractPendingStrokes","position","initPendingStroke","dpi","pxWidth","StrokeComponent","appendToPendingStroke","endPendingStroke","getBorderCoordinates","modelBounds","updateModelSentPosition","updateModelReceivedPosition","resetModelPositions","updateModelRenderedPosition","extractPendingRecognizedSymbols","cloneModel","clonedModel","JSON","parse","stringify","mergeModels","models","a","b","modelRef","extractStrokesFromInkRange","firstStroke","lastStroke","slicedStrokes","resetModelRendererPosition","detectPixelRatio","getPixelRatio","canvas","getContext","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","createElement","createCanvas","add","appendChild","resizeContent","renderingCanvas","capturingCanvas","parentNode","clientWidth","clientHeight","pixelRatio","scale","drawSymbol","drawTextSymbol","warn","drawModel","renderingCanvasContext","clearRect","InkModel","capturingCanvasContext","getInfo","removeChild","resize","drawCurrentStroke","computeLinksPoints","radius","computeMiddlePoint","point1","point2","computeAxeAngle","begin","renderArc","arc","renderLine","linkPoints1","linkPoints2","renderQuadratic","ctrl","linkPoints3","quadraticCurveTo","nbquadratics","renderFinal","linkPoints","newAngle","closePath","xhtml","svg","xlink","xml","xmlns","prefix","namespaces","space","local","creatorInherit","ownerDocument","uri","namespaceURI","createElementNS","creatorFixed","fullname","namespace","none","selector","empty","update","EnterNode","parent","datum","_next","_parent","child","insertBefore","next","querySelectorAll","bindIndex","group","enter","exit","node","groupLength","dataLength","bindKey","keyValue","nodeByKeyValue","keyValues","ascending","NaN","attrRemove","removeAttribute","attrRemoveNS","removeAttributeNS","attrConstant","setAttribute","attrConstantNS","setAttributeNS","attrFunction","v","attrFunctionNS","defaultView","styleRemove","removeProperty","styleConstant","priority","setProperty","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","ClassList","_node","_names","getAttribute","classedAdd","names","list","classedRemove","remove","classedTrue","classedFalse","classedFunction","textRemove","textContent","textConstant","textFunction","htmlRemove","innerHTML","htmlConstant","htmlFunction","raise","nextSibling","lower","previousSibling","firstChild","constantNull","selection_cloneShallow","clone","cloneNode","selection_cloneDeep","join","filterEvents","mouseenter","mouseleave","filterContextListener","contextListener","related","compareDocumentPosition","event1","parseTypenames","typenames","onRemove","typename","on","__on","j","onAdd","wrap","dispatchEvent","params","CustomEvent","createEvent","initEvent","bubbles","cancelable","detail","dispatchConstant","dispatchFunction","Selection","groups","parents","_groups","_parents","insertAdjacentSVG","html","container","toLowerCase","lastChild","selection","select","subgroups","subnode","subgroup","selectAll","selectorAll","match","matches","matcher","each","constant","enterGroup","updateGroup","previous","i0","i1","_enter","_exit","sparse","onenter","onupdate","onexit","append","order","groups0","groups1","m0","m1","merges","group0","group1","sort","compare","compareNode","sortgroups","sortgroup","callback","nodes","attr","getAttributeNS","property","classed","creator","insert","before","deep","dispatch","elementRef","fontSize","d3","pendingRecognizedSymbols","patch","updateView","patchUpdate","updates","svgElementSelector","layer","insertAdjacentHTML","outerHTML","parentId","refId","pendingStrokes","symbolContext","parts","svgPath","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","Context","_invoke","makeInvokeMethod","state","GenStateSuspendedStart","invoke","GenStateExecuting","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","fn","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","previousPromise","enqueue","callInvokeWithMethodAndArg","resolve","reject","__await","then","unwrapped","info","resultName","nextLoc","pushTryEntry","locs","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iteratorMethod","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","Promise","reverse","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","asyncGeneratorStep","gen","_throw","_asyncToGenerator","_typeof","CryptoJS","F","subtype","C","C_lib","lib","Base","extend","overrides","mixIn","init","$super","instance","propertyName","WordArray","sigBytes","encoder","Hex","concat","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","thatByte","ceil","random","nBytes","rcache","m_w","m_z","mask","_r","C_enc","enc","hexChars","bite","hexStr","hexStrLength","parseInt","substr","Latin1","latin1Chars","fromCharCode","latin1Str","latin1StrLength","charCodeAt","Utf8","decodeURIComponent","escape","utf8Str","unescape","BufferedBlockAlgorithm","_data","_nDataBytes","_append","_process","doFlush","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","_minBufferSize","nBytesReady","offset","_doProcessBlock","processedWords","C_algo","Hasher","cfg","_doReset","messageUpdate","finalize","_doFinalize","_createHelper","hasher","message","_createHmacHelper","HMAC","algo","require$$0","X32WordArray","C_x64","x64","Word","high","low","toX32","x64Words","x64WordsLength","x32Words","x64Word","wordsLength","X64Word","X64WordArray","X64Word_create","K","W","SHA512","_hash","M","H","H0","H1","H2","H3","H4","H5","H6","H7","H0h","H0l","H1h","H1l","H2h","H2l","H3h","H3l","H4h","H4l","H5h","H5l","H6h","H6l","H7h","H7l","ah","al","bh","bl","ch","cl","dh","dl","eh","el","fh","fl","gh","gl","hh","hl","Wi","Wih","Wil","gamma0x","gamma0xh","gamma0xl","gamma0h","gamma0l","gamma1x","gamma1xh","gamma1xl","gamma1h","gamma1l","Wi7","Wi7h","Wi7l","Wi16","Wi16h","Wi16l","t1l","chh","chl","majh","majl","sigma0h","sigma0l","sigma1h","sigma1l","Ki","Kih","Kil","t1h","t2l","nBitsTotal","nBitsLeft","HmacSHA512","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","computeHmac","input","jsonInput","post","recognizerContext","url","apiVersion","mimeType","recognizerContextRef","idle","headers","Headers","CryptoHelper","reqInit","credentials","body","request","Request","fetch","response","contentType","blob","json","msg","recoverable","createEmptyRecognizerContext","recognitionContexts","initPromise","websocketCallback","reconnect","currentReconnectionCount","sessionId","contentPartCount","currentPartId","instanceId","canUndo","canRedo","isEmpty","supportedImportMimeTypes","undoStackIndex","possibleUndoCount","initialized","isResetRequired","updateRecognitionPositions","positions","setRecognitionContext","recognitionContext","canReconnect","shouldAttemptImmediateReconnect","LOST_CONNEXION_MESSAGE","val","div","elMatches","Element","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","query","queryChildren","children","cls","thumb","rail","consuming","focus","clicking","active","scrolling","scrollingClassTimeout","addScrollingClass","clearTimeout","removeScrollingClass","setTimeout","isAlive","settings","scrollingThreshold","EventElement","handlers","prototypeAccessors","eventName","handler","unbind","this$1","unbindAll","every","defineProperties","EventManager","eventElements","initCustomEvent","processScrollDiff","axis","diff","useScrollingClass","forceFireReachEvent","fields","processScrollDiff$1","ref","contentHeight","containerHeight","scrollTop","up","down","reach","setScrollingClassInstantly","toInt","eventElement","ee","once","onceHandler","env","isWebKit","supportsTouch","maxTouchPoints","DocumentTouch","supportsIePointer","msMaxTouchPoints","isChrome","updateGeometry","roundedScrollTop","containerWidth","contentWidth","scrollWidth","scrollHeight","scrollbarXRail","scrollbarYRail","suppressScrollX","scrollXMarginOffset","scrollbarXActive","railXWidth","railXMarginWidth","railXRatio","scrollbarXWidth","getThumbSize","scrollbarXLeft","negativeScrollAdjustment","scrollLeft","suppressScrollY","scrollYMarginOffset","scrollbarYActive","railYHeight","railYMarginHeight","railYRatio","scrollbarYHeight","scrollbarYTop","updateCss","xRailOffset","isRtl","isScrollbarXUsingBottom","scrollbarXBottom","scrollbarXTop","yRailOffset","isScrollbarYUsingRight","scrollbarYRight","scrollbarYOuterWidth","scrollbarYLeft","scrollbarX","railBorderXWidth","scrollbarY","railBorderYWidth","thumbSize","minScrollbarLength","maxScrollbarLength","bindMouseScrollHandler","pageY","startingScrollTop","startingMousePageY","scrollBy","mouseMoveHandler","touches","mouseUpHandler","bindMoves","touchMode","click-rail","clickRail","direction","pageYOffset","pageX","pageXOffset","drag-thumb","dragThumb","keyboard","isDefaultPrevented","defaultPrevented","activeElement","contentDocument","shadowRoot","isEditable","deltaX","deltaY","which","metaKey","altKey","shiftKey","shouldPreventDefault","wheelPropagation","wheel","mousewheelHandler","getDeltaFromEvent","wheelDeltaX","wheelDeltaY","deltaMode","wheelDelta","shouldBeConsumedByChild","cursor","overflowY","maxScrollTop","overflowX","maxScrollLeft","shouldPrevent","useBothWheelAxes","wheelSpeed","isTop","isBottom","offsetHeight","isLeft","isRight","offsetWidth","ctrlKey","onwheel","onmousewheel","touch","startOffset","startTime","speed","easingLoop","touchStart","touchMove","touchEnd","PointerEvent","MSPointerEvent","applyTouchMove","differenceX","differenceY","getTouch","targetTouches","shouldHandle","MSPOINTER_TYPE_MOUSE","clearInterval","currentOffset","currentTime","timeGap","magnitudeX","magnitudeY","scrollY","swipeEasing","setInterval","isInitialized","PerfectScrollbar","userSettings","nodeName","originalScrollLeft","blur","isNegativeScroll","railXStyle","borderLeftWidth","borderRightWidth","marginLeft","marginRight","railYStyle","outerWidth","styles","paddingLeft","paddingRight","borderTopWidth","borderBottomWidth","marginTop","marginBottom","handlerName","lastScrollTop","lastScrollLeft","onScroll","destroy","removePsClasses","selectedText","isReadOnly","hasAttribute","setSelectionRange","range","createRange","selectNodeContents","addRange","_select","_select2","_interopRequireDefault","_classCallCheck","Constructor","_createClass","descriptor","protoProps","staticProps","ClipboardAction","resolveOptions","initSelection","action","emitter","trigger","selectFake","selectTarget","_this","isRTL","removeFake","fakeHandlerCallback","fakeHandler","fakeElem","border","padding","yPosition","copyText","succeeded","execCommand","handleResult","emit","clearSelection","_action","_target","E","ctx","off","_","evtArr","evts","liveEvents","HTMLElement","matchesSelector","oMatchesSelector","closest","delegateTarget","useCapture","listenerFn","listen","is","listenNode","nodeList","listenNodeList","listenSelector","_clipboardAction","_tinyEmitter","_goodListener","_clipboardAction2","_tinyEmitter2","_goodListener2","_possibleConstructorReturn","ReferenceError","_inherits","subClass","superClass","Clipboard","_Emitter","listenClick","defaultAction","defaultTarget","defaultText","_this2","onClick","currentTarget","clipboardAction","getAttributeValue","isSupported","actions","support","queryCommandSupported","suffix","attribute","require$$1","require$$2","isInShadow","addListeners","elementsRef","elements","textElement","showCandidates","smartGuideRef","randomString","wordToChange","candidatesElement","word","clickCandidate","candidate","innerText","jiixToImport","import_","ellipsisElement","showActions","positionActions","menuElement","isMenuInDocument","insertActions","convertElement","copyElement","deleteElement","createSmartGuide","createHTMLElements","smartGuideElement","textContainer","tagElement","lastWord","previousLabelExport","perfectScrollbar","smartGuideTimeOutId","callFadeOutObserver","MutationObserver","mutations","observe","childList","subtree","attributes","maxWidthTextContainer","maxWidth","launchSmartGuide","isSmartGuideInDocument","insertSmartGuide","mmToPixels","insertSmartGuideElement","visibility","loader","insertTag","insertTextContainer","insertEllipsis","createWordSpan","span","populatePrompter","myFragment","createDocumentFragment","addAnimationToModifiedWord","tempWords","labelWordsArray","tempLabelWordsArray","wordChangedId","getElementById","_defineProperties","updateUndoRedoState","undoRedoContext","undoRedoContextRef","currentPosition","getModel","res","updateModel","modelIndex","findIndex","undoRedoContextReference","maxSize","shift","UndoRedoContext","undo","redo","borderCoordinates","browserDocument","inkImporter","editorParam","delayBetweenStrokes","lastOneDelay","origGrabber","behavior","grabber","setDelay","X","idx","Y","play","actionsArray","delay","currentAction","nextDelay","lastIndexOf","Event","importStrokeGroups","strokeFromGroup","rendererContext","destructurePromise","resolveParam","rejectParam","promise","time","timer","manageResetState","recognizer","RecognizerContext","isTriggerValid","availableTriggers","events","pointerEvents","launchExport","requestedMimeTypes","export_","editorRef","exportTimer","timeout","delayer","PromiseHelper","getSupportedImportMimeTypes","launchConvert","conversionState","launchConfig","sendConfiguration","resizeTimer","SmartGuide","waitForIdle","close","setPenStyle","setPenStyleClasses","penStyleClasses","setTheme","Editor","behaviors","globalClassCss","styleElement","createTextNode","sheet","notifyTimer","innerBehaviors","overrideDefaultBehaviors","currentBehaviors","defaultBehaviors","rendererList","strokerList","recognizerList","getBehaviorFromConfiguration","DefaultBehaviors","localTheme","localPenStyle","handleSuccess","strokeIndex","emitEvents","launchWaitForIdle","undoRedoManager","handleError","manageRecognizedModel","_this3","canClear","_this4","canConvert","canExport","mimetype","launchImport","Blob","launchGetSupportedImportMimeTypes","launchPointerEvents","launchResize","grabberContext","innerRenderer","launchClose","innerConfiguration","overrideDefaultConfiguration","currentConfiguration","confRef","DefaultConfiguration","innerPenStyle","overrideDefaultPenStyle","currentStyle","DefaultStyles","innerPenStyleClasses","innerTheme","overrideDefaultTheme","currentTheme","DefaultTheme","innerBehavior","createUndoRedoContext","UndoRedoManager","initialize","shouldSendTheme","_this5","innerRecognizer","getImage","renderStructure","translate","toDataURL","ImageRenderer","eastereggs","code","reason","iinkRestConfiguration","postMessage","suffixUrl","buildMessage","NetworkInterface","recognizerContextReference","buildData","dataConf","buildTextConf","buildMathConf","buildDiagramConf","buildRawContentConf","newStrokes","newGroup","DefaultPenStyle","xDPI","yDPI","extractExports","resultCallback","callPostMessage","all","_arrayWithHoles","_iterableToArrayLimit","_arr","_n","_d","_e","_s","_i","_nonIterableRest","_slicedToArray","arrayWithHoles","iterableToArrayLimit","nonIterableRest","UUIDjs","getRandomInt","maxFromBits","bits","limitUI04","limitUI06","limitUI08","limitUI12","limitUI14","limitUI16","limitUI32","limitUI40","limitUI48","randomUI04","randomUI06","randomUI08","randomUI12","randomUI14","randomUI16","randomUI32","randomUI40","randomUI48","paddedString","z","fromParts","timeLow","timeMid","timeHiAndVersion","clockSeqHiAndReserved","clockSeqLow","version","hex","toURN","toBytes","ints","intPos","equals","uuid","UUID","getTimeFieldValues","ts","UTC","hm","mid","hi","timestamp","_create4","_create1","sequence","tick","tf","tl","thav","cshar","csl","fromTime","last","firstFromTime","lastFromTime","fromURN","strId","fromBytes","str","pos","octet","fromBinary","binary","new","newTS","openWebSocket","socket","WebSocket","addWebsocketAttributes","websocketConfiguration","maxPingLost","pingLostCount","infinitePing","websocketRef","readyState","send","onopen","onclose","onerror","onmessage","callBackParam","buildWebSocketCallback","NetworkWSInterface","buildRestoreIInkSessionInput","buildNewContentPackageInput","hmacChallenge","buildHmacMessage","hmac","iinkSessionId","buildConfiguration","buildOpenContentPart","buildNewContentPart","partId","partChange","contentChange","buildUrl","retry","buildFunc","responseCallback","sendMessage","sendFailedException","IinkWsConfiguration","NEBO","xDpi","yDpi","viewSizeHeight","viewSizeWidth","buildAddStrokes","buildUndo","buildRedo","buildClear","buildConvert","buildZoom","zoom","buildResize","buildExport","requestedMimeType","buildImportFile","importFileId","buildImportChunk","lastChunk","buildPointerEvents","buildWaitForIdle","buildGetSupportedImportMimeTypes","buildSetPenStyle","buildSetPenStyleClasses","styleClasses","buildSetTheme","contentChanged","WsRecognizerUtil","WsBuilder","errPartChanged","resPartChanged","errContentChanged","resContentChanged","_prepareMessage","buildFunction","onDemand","DefaultRecognizer","newContentPart","openContentPart","chunkSize","messages","readBlob","fileReader","FileReader","onload","readAsText","PointerEventGrabber","QuadraticCanvasStroker","QuadraticSVGStroker","CanvasRenderer","SVGRenderer","iinkRestRecognizer","iinkWsRecognizer","composed","register","globalClassCSS","getAvailableLanguageList","serverConfig","ok","LoggerConfig"],"mappings":"IAIMA,EAAY,CAChBC,UAAW,CACTC,KAAM,OACNC,QAAS,UACTC,SAAU,WACVC,SAAU,WACVC,UAAW,YACXC,SAAU,WACVC,OAAQ,SACRC,KAAM,OACNC,KAAM,OACNC,MAAO,QACPC,OAAQ,SACRC,2BAA4B,2BAC5BC,OAAQ,SACRC,QAAS,UACTC,MAAO,SAETC,gBAAiB,CACfC,KAAM,OACNC,KAAM,OACNC,QAAS,UACTC,WAAY,eAEdC,SAAU,CACRC,UAAW,YACXC,KAAM,QAERC,WAAY,CACVC,aAAc,eACdC,YAAa,cACbC,UAAW,YACXvB,SAAU,WACVwB,QAAS,UACTC,SAAU,WACVd,MAAO,SAETe,QAAS,CACPC,aAAc,eACdC,WAAY,aACZC,OAAQ,UAEVC,OAAQ,CACNC,OAAQ,SACRC,MAAO,QACPC,QAAS,UACTC,SAAU,WACVC,WAAY,aACZC,MAAO,QACPC,KAAM,OACNC,WAAY,cAEdC,SAAU,CACRC,MAAO,QACPC,MAAO,QACPC,KAAM,OACNC,KAAM,OACNhC,MAAO,SAETiC,UAAW,CACTC,MAAO,mBACPC,MAAO,mBACPC,MAAO,mBACPC,MAAO,mBACPC,MAAO,2BACE,aAEXC,MAAO,CACLC,cAAe,sFACfC,kBAAmB,oGACnBC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nY,UAAAA,EAEAqzD,qBAAAA,EACA5B,iBAAAA,GACAmE,gB5GAsBhwD,U4GCtBkuD,aAAAA,EAEAkN,SAAAA,SACAE,yBAAAA,yBAEAG,aAAAA,EACA3Q,OAAAA,GACAlgC,SAAAA,EACAw+B,kBAAAA"} \ No newline at end of file diff --git a/dist/iink.min.js b/dist/iink.min.js index 98cea22b..cb529420 100644 --- a/dist/iink.min.js +++ b/dist/iink.min.js @@ -1,8 +1,8 @@ -!function(n,i){n.getElementById("livereloadscript")||((i=n.createElement("script")).async=1,i.src="//"+(window.location.host||"localhost").split(":")[0]+":35729/livereload.js?snipver=1",i.id="livereloadscript",n.getElementsByTagName("head")[0].appendChild(i))}(window.document),function(n,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((n="undefined"!=typeof globalThis?globalThis:n||self).iink={})}(this,(function(n){"use strict";var i={EventType:{IDLE:"idle",CHANGED:"changed",IMPORTED:"imported",EXPORTED:"exported",CONVERTED:"converted",RENDERED:"rendered",LOADED:"loaded",UNDO:"undo",REDO:"redo",CLEAR:"clear",IMPORT:"import",SUPPORTED_IMPORT_MIMETYPES:"supportedImportMimeTypes",EXPORT:"export",CONVERT:"convert",ERROR:"error"},RecognitionType:{TEXT:"TEXT",MATH:"MATH",DIAGRAM:"DIAGRAM",RAWCONTENT:"Raw Content"},Protocol:{WEBSOCKET:"WEBSOCKET",REST:"REST"},ModelState:{INITIALIZING:"INITIALIZING",INITIALIZED:"INITIALIZED",EXPORTING:"EXPORTING",EXPORTED:"EXPORTED",PENDING:"PENDING",MODIFIED:"MODIFIED",ERROR:"ERROR"},Trigger:{QUIET_PERIOD:"QUIET_PERIOD",POINTER_UP:"POINTER_UP",DEMAND:"DEMAND"},Logger:{EDITOR:"editor",MODEL:"model",GRABBER:"grabber",RENDERER:"renderer",RECOGNIZER:"recognizer",EVENT:"event",UTIL:"util",SMARTGUIDE:"smartguide"},LogLevel:{TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},Languages:{zh_CN:"Noto Sans CJK tc",zh_HK:"Noto Sans CJK tc",zh_TW:"Noto Sans CJK tc",ko_KR:"Noto Sans CJK kr",ja_JP:"Noto Sans CJK jp",default:"Open Sans"},Error:{NOT_REACHABLE:"MyScript recognition server is not reachable. Please reload once you are connected.",WRONG_CREDENTIALS:"Application credentials are invalid. Please check or regenerate your application key and hmackey.",TOO_OLD:"Session is too old. Max Session Duration Reached.",NO_ACTIVITY:"Session closed due to no activity."},Exports:{JIIX:"application/vnd.myscript.jiix"}},a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function createCommonjsModule(n,i){return n(i={exports:{}},i.exports),i.exports}var s=createCommonjsModule((function(n){!function(i,a){n.exports?n.exports=a():i.log=a()}(a,(function(){var noop=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function bindMethod(n,i){var a=n[i];if("function"==typeof a.bind)return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch(i){return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function traceForIE(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function realMethod(a){return"debug"===a&&(a="log"),typeof console!==n&&("trace"===a&&i?traceForIE:void 0!==console[a]?bindMethod(console,a):void 0!==console.log?bindMethod(console,"log"):noop)}function replaceLoggingMethods(n,i){for(var s=0;s=0&&s<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+s;if(l=s,!1!==c&&function persistLevelIfPossible(i){var s=(a[i]||"silent").toUpperCase();if(typeof window!==n&&d){try{return void(window.localStorage[d]=s)}catch(n){}try{window.document.cookie=encodeURIComponent(d)+"="+s+";"}catch(n){}}}(s),replaceLoggingMethods.call(u,s,i),typeof console===n&&s-1},ListCache.prototype.set=function listCacheSet(n,i){var a=this.__data__,s=assocIndexOf(a,n);return s<0?(++this.size,a.push([n,i])):a[s][1]=i,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(J||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(n){var i=getMapData(this,n).delete(n);return this.size-=i?1:0,i},MapCache.prototype.get=function mapCacheGet(n){return getMapData(this,n).get(n)},MapCache.prototype.has=function mapCacheHas(n){return getMapData(this,n).has(n)},MapCache.prototype.set=function mapCacheSet(n,i){var a=getMapData(this,n),s=a.size;return a.set(n,i),this.size+=a.size==s?0:1,this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(n){var i=this.__data__,a=i.delete(n);return this.size=i.size,a},Stack.prototype.get=function stackGet(n){return this.__data__.get(n)},Stack.prototype.has=function stackHas(n){return this.__data__.has(n)},Stack.prototype.set=function stackSet(n,i){var a=this.__data__;if(a instanceof ListCache){var s=a.__data__;if(!J||s.length<199)return s.push([n,i]),this.size=++a.size,this;a=this.__data__=new MapCache(s)}return a.set(n,i),this.size=a.size,this};var Q=function createBaseFor(n){return function(i,a,s){for(var c=-1,l=Object(i),u=s(i),d=u.length;d--;){var p=u[n?d:++c];if(!1===a(l[p],p,l))break}return i}}();function baseGetTag(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":G&&G in Object(n)?function getRawTag(n){var i=R.call(n,G),a=n[G];try{n[G]=void 0;var s=!0}catch(n){}var c=A.call(n);s&&(i?n[G]=a:delete n[G]);return c}(n):function objectToString(n){return A.call(n)}(n)}function baseIsArguments(n){return isObjectLike(n)&&baseGetTag(n)==l}function baseIsNative(n){return!(!isObject(n)||function isMasked(n){return!!L&&L in n}(n))&&(isFunction(n)?j:p).test(function toSource(n){if(null!=n){try{return M.call(n)}catch(n){}try{return n+""}catch(n){}}return""}(n))}function baseKeysIn(n){if(!isObject(n))return function nativeKeysIn(n){var i=[];if(null!=n)for(var a in Object(n))i.push(a);return i}(n);var i=isPrototype(n),a=[];for(var s in n)("constructor"!=s||!i&&R.call(n,s))&&a.push(s);return a}function baseMerge(n,i,a,s,c){n!==i&&Q(i,(function(l,u){if(c||(c=new Stack),isObject(l))!function baseMergeDeep(n,i,a,s,c,l,u){var p=safeGet(n,a),h=safeGet(i,a),f=u.get(h);if(f)return void assignMergeValue(n,a,f);var g=l?l(p,h,a+"",n,i,u):void 0,m=void 0===g;if(m){var v=ne(h),y=!v&&re(h),b=!v&&!y&&oe(h);g=h,v||y||b?ne(p)?g=p:!function isArrayLikeObject(n){return isObjectLike(n)&&isArrayLike(n)}(p)?y?(m=!1,g=function cloneBuffer(n,i){if(i)return n.slice();var a=n.length,s=N?N(a):new n.constructor(a);return n.copy(s),s}(h,!0)):b?(m=!1,g=function cloneTypedArray(n,i){var a=i?function cloneArrayBuffer(n){var i=new n.constructor(n.byteLength);return new z(i).set(new z(n)),i}(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}(h,!0)):g=[]:g=function copyArray(n,i){var a=-1,s=n.length;i||(i=Array(s));for(;++a-1&&n%1==0&&n0){if(++i>=800)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Y?function(n,i){return Y(n,"toString",{configurable:!0,enumerable:!1,value:(a=i,function(){return a}),writable:!0});var a}:identity);function eq(n,i){return n===i||n!=n&&i!=i}var te=baseIsArguments(function(){return arguments}())?baseIsArguments:function(n){return isObjectLike(n)&&R.call(n,"callee")&&!H.call(n,"callee")},ne=Array.isArray;function isArrayLike(n){return null!=n&&isLength(n.length)&&!isFunction(n)}var re=$||function stubFalse(){return!1};function isFunction(n){if(!isObject(n))return!1;var i=baseGetTag(n);return i==u||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i}function isLength(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=c}function isObject(n){var i=typeof n;return null!=n&&("object"==i||"function"==i)}function isObjectLike(n){return null!=n&&"object"==typeof n}var oe=S?function baseUnary(n){return function(i){return n(i)}}(S):function baseIsTypedArray(n){return isObjectLike(n)&&isLength(n.length)&&!!f[baseGetTag(n)]};function keysIn(n){return isArrayLike(n)?arrayLikeKeys(n,!0):baseKeysIn(n)}var ie=function createAssigner(n){return baseRest((function(i,a){var s=-1,c=a.length,l=c>1?a[c-1]:void 0,u=c>2?a[2]:void 0;for(l=n.length>3&&"function"==typeof l?(c--,l):void 0,u&&function isIterateeCall(n,i,a){if(!isObject(a))return!1;var s=typeof i;if("number"==s?isArrayLike(a)&&isIndex(i,a.length):"string"==s&&i in a)return eq(a[i],n);return!1}(a[0],a[1],u)&&(l=c<3?void 0:l,c=1),i=Object(i);++s10?S[10]:S[i],Math.round(n*a)/a):n}function extractPoint(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=n;l.changedTouches&&(l=l.changedTouches[0]);var u=i.getBoundingClientRect();return{x:roundFloat(l.clientX-u.left-i.clientLeft-c,a.xyFloatPrecision),y:roundFloat(l.clientY-u.top-i.clientTop-s,a.xyFloatPrecision),t:roundFloat(Date.now(),a.timestampFloatPrecision)}}var C=function prevent(n){return n.preventDefault()};var k=Object.freeze({__proto__:null,attach:function attach$2(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=0;function unfocus(){"None"!==window.getSelection().type&&window.getSelection().removeAllRanges()}function hideMenu(n){var i=document.querySelector(".more-menu");return!(n.target.classList.contains("ellipsis")||n.target.classList.contains("more-menu")||n.target.classList.contains("options-label-button")||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function hideCandidates(n){var i=document.querySelector(".candidates");return!(n.target.classList.contains("candidates")||"SPAN"===n.target.tagName||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function pointerDownHandler(c){var l=c.target.id===i.domElement.id||c.target.classList.contains("ms-canvas");if(void 0!==this.activePointerId)this.activePointerId===c.pointerId&&d.trace("".concat(c.type," event with the same id without any pointer up"),c.pointerId);else if(2!==c.button&&2!==c.buttons&&l){if(!hideMenu(c)&&!hideCandidates(c)){this.activePointerId=c.pointerId;var u=c.pointerId>2147483647?-1:c.pointerId;unfocus(),c.stopPropagation();var p=c.pointerType;i.isErasing&&(p="ERASER"),i.pointerDown(extractPoint(c,n,i.configuration,a,s),p,u)}}else c.target.classList.contains("ellipsis")||c.target.classList.contains("tag-icon")?(hideMenu(c),hideCandidates(c)):(hideMenu(c),hideCandidates(c),this.smartGuidePointerDown=!0,this.downSmartGuidePoint=extractPoint(c,n,i.configuration))}function pointerMoveHandler(l){if(void 0!==this.activePointerId&&this.activePointerId===l.pointerId)unfocus(),i.pointerMove(extractPoint(l,n,i.configuration,a,s));else if(this.smartGuidePointerDown){var u=extractPoint(l,n,i.configuration,a,s),p=Math.abs(this.downSmartGuidePoint.x-u.x),h=Math.abs(this.downSmartGuidePoint.y-u.y);if(c=Math.max(p,c),p<5&&h>5&&c<15||p>5&&h>5&&c<15){this.activePointerId=l.pointerId;var f=l.pointerId>2147483647?-1:l.pointerId;unfocus(),i.pointerDown(this.downSmartGuidePoint,l.pointerType,f)}}else d.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}function pointerUpHandler(l){c=0,this.smartGuidePointerDown=!1;var u=["smartguide","prompter-text-container","prompter-text","tag-icon","ellipsis"],p=["ps__rail-x","ps__thumb-x"],h=l.relatedTarget&&(u.includes(l.relatedTarget.className)||p.includes(l.relatedTarget.className)),f=l.relatedTarget&&l.target&&(u.includes(l.target.className)||p.includes(l.target.className)),g=l.relatedTarget&&l.target&&("SPAN"===l.target.tagName||"SPAN"===l.relatedTarget.tagName);h||f||g?l.stopPropagation():void 0!==this.activePointerId&&this.activePointerId===l.pointerId?(this.activePointerId=void 0,l.stopPropagation(),i.pointerUp(extractPoint(l,n,i.configuration,a,s))):d.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}var l={options:i.configuration.listenerOptions,listeners:[{types:["pointerdown"],listener:pointerDownHandler},{types:["pointermove"],listener:pointerMoveHandler},{types:["pointerup","pointerout","pointerleave","pointercancel"],listener:pointerUpHandler}]};return d.debug("attaching listeners",l),l.listeners.forEach((function(i){i.types.forEach((function(a){return n.addEventListener(a,i.listener,l.options)}))})),n.addEventListener("touchmove",C),document.documentElement.addEventListener("pointerdown",(function(){})),l},detach:function detach$2(n,i){d.debug("detaching listeners",i),i.listeners.forEach((function(a){a.types.forEach((function(s){return n.removeEventListener(s,a.listener,i.options)}))})),n.removeEventListener("touchmove",C),document.documentElement.removeEventListener("pointerdown",(function(){}))}}),P=createCommonjsModule((function(n){n.exports=function _arrayLikeToArray(n,i){(null==i||i>n.length)&&(i=n.length);for(var a=0,s=new Array(i);a=l||Math.abs(s[s.length-1]-i)>=l)&&(u=!0),u}(i.x,i.y,a.x,a.y,a.width)?u.trace("ignore filtered point",i):(a.x.push(i.x),a.y.push(i.y),a.t.push(i.t),a.p.push(function computePressure(n,i,a,s,c,l){var u=1,d=computeDistance(n,i,a,s,l),p=computeLength(n,i,a,s,c,l);0===p?u=.5:d===p?u=1:d<10?u=.2+Math.pow(.1*d,.4):d>p-10&&(u=.2+Math.pow(.1*(p-d),.4));var h=u*Math.max(.1,1-.1*Math.sqrt(d));return isNaN(parseFloat(h))?.5:h}(i.x,i.y,a.x,a.y,a.l,a.x.length-1)),a.l.push(computeLength(i.x,i.y,a.x,a.y,a.l,a.x.length-1))),a}function slice(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.x.length,s=createStrokeComponent({color:n.color,width:n.width}),c=i;c=0&&i1&&void 0!==arguments[1]?arguments[1]:{minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE},a=i;return a=n.filter((function(n){return"stroke"===n.type})).map(getStrokeBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"clef"===n.type})).map(getClefBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"line"===n.type})).map(getLineBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"ellipse"===n.type})).map(getEllipseBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"textLine"===n.type})).map(getTextLineBounds).reduce(mergeBounds,a)}function createModel(n){return{currentStroke:void 0,rawStrokes:[],strokeGroups:[],lastPositions:{lastSentPosition:-1,lastReceivedPosition:-1,lastRenderedPosition:-1},defaultSymbols:[],recognizedSymbols:void 0,exports:void 0,rawResults:{convert:void 0,exports:void 0},creationTime:(new Date).getTime(),modificationTime:void 0}}function clearModel(n){var i=n;return i.currentStroke=void 0,i.rawStrokes=[],i.strokeGroups=[],i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i.lastPositions.lastRenderedPosition=-1,i.recognizedSymbols=void 0,i.exports=void 0,i.rawResults.convert=void 0,i.rawResults.exports=void 0,i}function needRedraw(n){return!!n.recognizedSymbols&&n.rawStrokes.length!==n.recognizedSymbols.filter((function(n){return"stroke"===n.type})).length}function addStroke(n,i){var a=n;return u.debug("addStroke",i),a.rawStrokes.push(i),a}function addStrokeToGroup(n,i,a){var s=n;u.debug("addStroke",i);var c=s.strokeGroups.length-1;if(s.strokeGroups[c]&&s.strokeGroups[c].penStyle===a)s.strokeGroups[c].strokes.push(i);else{var l={penStyle:a,strokes:[]},d={};Object.assign(d,i),l.strokes.push(d),s.strokeGroups.push(l)}return s}function extractPendingStrokes(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastReceivedPosition+1;return n.rawStrokes.slice(i)}function initPendingStroke(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:96;if(a&&a["-myscript-pen-width"]){var c=a["-myscript-pen-width"]*s/25.4;Object.assign(a,{width:c/2})}var l=n;return u.trace("initPendingStroke",i),l.currentStroke=createStrokeComponent(a),l.currentStroke=addPoint(l.currentStroke,i),l}function appendToPendingStroke(n,i){var a=n;return a.currentStroke&&(u.trace("appendToPendingStroke",i),a.currentStroke=addPoint(a.currentStroke,i)),a}function endPendingStroke(n,i,a){var s=n;if(s.currentStroke){u.trace("endPendingStroke",i);var c=addPoint(s.currentStroke,i);addStroke(s,c),addStrokeToGroup(s,c,a),delete s.currentStroke}return s}function getBorderCoordinates(n){var i={minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE};return n.defaultSymbols&&n.defaultSymbols.length>0&&(i=getSymbolsBounds(n.defaultSymbols,i)),n.recognizedSymbols&&n.recognizedSymbols.length>0?(i=getSymbolsBounds(n.recognizedSymbols,i),i=getSymbolsBounds(extractPendingStrokes(n),i)):i=getSymbolsBounds(n.rawStrokes,i),i}function updateModelSentPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.rawStrokes.length-1,a=n;return a.lastPositions.lastSentPosition=i,a}function updateModelReceivedPosition(n){var i=n;return i.lastPositions.lastReceivedPosition=i.lastPositions.lastSentPosition,i}function resetModelPositions(n){var i=n;return i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i}function updateModelRenderedPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.recognizedSymbols?n.recognizedSymbols.length-1:-1,a=n;return a.lastPositions.lastRenderedPosition=i,a}function extractPendingRecognizedSymbols(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastRenderedPosition+1;return n.recognizedSymbols?n.recognizedSymbols.slice(i):[]}function cloneModel(n){var i=Object.assign({},n);return i.defaultSymbols=L(n.defaultSymbols),i.currentStroke=n.currentStroke?Object.assign({},n.currentStroke):void 0,i.rawStrokes=L(n.rawStrokes),i.strokeGroups=JSON.parse(JSON.stringify(n.strokeGroups)),i.lastPositions=Object.assign({},n.lastPositions),i.exports=n.exports?Object.assign({},n.exports):void 0,i.rawResults=Object.assign({},n.rawResults),i.recognizedSymbols=n.recognizedSymbols?L(n.recognizedSymbols):void 0,i}function mergeModels(){for(var n=arguments.length,i=new Array(n),a=0;a1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;p.debug("attach renderer",n);var s=detectPixelRatio(),c=createCanvas$1(n,"ms-rendering-canvas"),l=createCanvas$1(n,"ms-capture-canvas"),u={pixelRatio:s,minHeight:i,minWidth:a,renderingCanvas:c,renderingCanvasContext:c.getContext("2d"),capturingCanvas:l,capturingCanvasContext:l.getContext("2d")};return resizeContent(u)},detach:function detach$1(n,i){p.debug("detach renderer",n),n.removeChild(i.renderingCanvas),n.removeChild(i.capturingCanvas)},resize:function resize$4(n,i,a){return this.drawModel(resizeContent(n),i,a)},drawCurrentStroke:function drawCurrentStroke$1(n,i,a){return n.capturingCanvasContext.clearRect(0,0,n.capturingCanvas.width,n.capturingCanvas.height),p.trace("drawing current stroke ",i.currentStroke),drawStroke$3(n.capturingCanvasContext,i.currentStroke,a),i},drawModel:drawModel$1});function computeLinksPoints(n,i,a){var s=n.p*a;return[{x:n.x-Math.sin(i)*s,y:n.y+Math.cos(i)*s},{x:n.x+Math.sin(i)*s,y:n.y-Math.cos(i)*s}]}function computeMiddlePoint(n,i){return{x:(i.x+n.x)/2,y:(i.y+n.y)/2,p:(i.p+n.p)/2}}function computeAxeAngle(n,i){return Math.atan2(i.y-n.y,i.x-n.x)}function renderArc$1(n,i,a){n.arc(i.x,i.y,a,0,2*Math.PI,!0)}function renderLine$1(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);n.moveTo(c[0].x,c[0].y),n.lineTo(l[0].x,l[0].y),n.lineTo(l[1].x,l[1].y),n.lineTo(c[1].x,c[1].y)}function renderQuadratic$1(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);n.moveTo(l[0].x,l[0].y),n.quadraticCurveTo(d[0].x,d[0].y,u[0].x,u[0].y),n.lineTo(u[1].x,u[1].y),n.quadraticCurveTo(d[1].x,d[1].y,l[1].x,l[1].y)}var O=Object.freeze({__proto__:null,getInfo:function getInfo$4(){return{type:"canvas",name:"quadratic"}},drawStroke:function drawStroke$2(n,i){var a=n,s=i.x.length,c=i.width>0?i.width:a.lineWidth,l=i.color?i.color:a.strokeStyle,u=getPointByIndex(i,0),d=s-2;a.save();try{if(a.beginPath(),s<3)renderArc$1(a,u,.6*c);else{renderArc$1(a,u,c*u.p),renderLine$1(a,u,computeMiddlePoint(u,getPointByIndex(i,1)),c);for(var p=0;p=0&&"xmlns"!==(i=n.slice(0,a))&&(n=n.slice(a+1)),N.hasOwnProperty(i)?{space:N[i],local:n}:n}function creatorInherit(n){return function(){var i=this.ownerDocument,a=this.namespaceURI;return a===z&&i.documentElement.namespaceURI===z?i.createElement(n):i.createElementNS(a,n)}}function creatorFixed(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function creator(n){var i=namespace(n);return(i.local?creatorFixed:creatorInherit)(i)}function none(){}function selector(n){return null==n?none:function(){return this.querySelector(n)}}function empty(){return[]}function sparse(n){return new Array(n.length)}function EnterNode(n,i){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=i}EnterNode.prototype={constructor:EnterNode,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,i){return this._parent.insertBefore(n,i)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function bindIndex(n,i,a,s,c,l){for(var u,d=0,p=i.length,h=l.length;di?1:n>=i?0:NaN}function attrRemove(n){return function(){this.removeAttribute(n)}}function attrRemoveNS(n){return function(){this.removeAttributeNS(n.space,n.local)}}function attrConstant(n,i){return function(){this.setAttribute(n,i)}}function attrConstantNS(n,i){return function(){this.setAttributeNS(n.space,n.local,i)}}function attrFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttribute(n):this.setAttribute(n,a)}}function attrFunctionNS(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,a)}}function defaultView(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function styleRemove(n){return function(){this.style.removeProperty(n)}}function styleConstant(n,i,a){return function(){this.style.setProperty(n,i,a)}}function styleFunction(n,i,a){return function(){var s=i.apply(this,arguments);null==s?this.style.removeProperty(n):this.style.setProperty(n,s,a)}}function styleValue(n,i){return n.style.getPropertyValue(i)||defaultView(n).getComputedStyle(n,null).getPropertyValue(i)}function propertyRemove(n){return function(){delete this[n]}}function propertyConstant(n,i){return function(){this[n]=i}}function propertyFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?delete this[n]:this[n]=a}}function classArray(n){return n.trim().split(/^|\s+/)}function classList(n){return n.classList||new ClassList(n)}function ClassList(n){this._node=n,this._names=classArray(n.getAttribute("class")||"")}function classedAdd(n,i){for(var a=classList(n),s=-1,c=i.length;++s=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var W={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(W={mouseenter:"mouseover",mouseleave:"mouseout"}));function filterContextListener(n,i,a){return n=contextListener(n,i,a),function(i){var a=i.relatedTarget;a&&(a===this||8&a.compareDocumentPosition(this))||n.call(this,i)}}function contextListener(n,i,a){return function(s){try{n.call(this,this.__data__,i,a)}finally{}}}function parseTypenames(n){return n.trim().split(/^|\s+/).map((function(n){var i="",a=n.indexOf(".");return a>=0&&(i=n.slice(a+1),n=n.slice(0,a)),{type:n,name:i}}))}function onRemove(n){return function(){var i=this.__on;if(i){for(var a,s=0,c=-1,l=i.length;s=C&&(C=S+1);!(_=x[C])&&++C=0;)(s=c[l])&&(u&&4^s.compareDocumentPosition(u)&&u.parentNode.insertBefore(s,u),u=s);return this},sort:function selection_sort(n){function compareNode(i,a){return i&&a?n(i.__data__,a.__data__):!i-!a}n||(n=ascending);for(var i=this._groups,a=i.length,s=new Array(a),c=0;c1?this.each((null==i?styleRemove:"function"==typeof i?styleFunction:styleConstant)(n,i,null==a?"":a)):styleValue(this.node(),n)},property:function selection_property(n,i){return arguments.length>1?this.each((null==i?propertyRemove:"function"==typeof i?propertyFunction:propertyConstant)(n,i)):this.node()[n]},classed:function selection_classed(n,i){var a=classArray(n+"");if(arguments.length<2){for(var s=classList(this.node()),c=-1,l=a.length;++c *:nth-child(").concat(a.index+1,")")).remove();break;case"APPEND_CHILD":var u=n.select(a.parentId?"#".concat(a.parentId):s).node();u.insertAdjacentHTML?u.insertAdjacentHTML("beforeEnd",a.svg):(insertAdjacentSVG(u,"beforeEnd",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"INSERT_BEFORE":var d=n.select("#".concat(a.refId)).node();d.insertAdjacentHTML?d.insertAdjacentHTML("beforeBegin",a.svg):(insertAdjacentSVG(d,"beforeBegin",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"REMOVE_ATTRIBUTE":n.selectAll(a.id?"#".concat(a.id):"svg").attr(a.name,null);break;case"SET_ATTRIBUTE":a.id&&n.selectAll("#".concat(a.id)).attr(a.name,a.value);break;default:p.debug("unknown update ".concat(a.type," action"))}}catch(n){p.error("Invalid update ".concat(a.type),a),p.error("Error on svg patch",n)}}))}(i)})),updateModelRenderedPosition(i));var c=extractPendingStrokes(i);return c&&c.forEach((function(i){return function drawSymbol(n,i){p.trace("attempting to draw ".concat(n.type," symbol")),"stroke"!==n.type||i.select("id",n.id)?p.warn("impossible to draw ".concat(n.type," symbol")):drawStroke$1(i.append("path").attr("id",n.id),n,a)}(i,n.select("#pendingStrokes"))})),i}});function renderArc(n,i,a){return["M ".concat(i.x,",").concat(i.y),"m ".concat(-a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(2*a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(-2*a,",0")].join(" ")}function renderLine(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);return["M ".concat(c[0].x,",").concat(c[0].y),"L ".concat(l[0].x,",").concat(l[0].y),"L ".concat(l[1].x,",").concat(l[1].y),"L ".concat(c[1].x,",").concat(c[1].y)].join(" ")}function renderQuadratic(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);return["M ".concat(l[0].x,",").concat(l[0].y),"Q ".concat(d[0].x,",").concat(d[0].y," ").concat(u[0].x,",").concat(u[0].y),"L ".concat(u[1].x,",").concat(u[1].y),"Q ".concat(d[1].x,",").concat(d[1].y," ").concat(l[1].x,",").concat(l[1].y)].join(" ")}var B=Object.freeze({__proto__:null,getInfo:function getInfo$2(){return{type:"svg",name:"quadratic"}},drawStroke:function drawStroke(n,i){var a=i.x.length,s=i.width,c=getPointByIndex(i,0),l=a-2,u=[];if(a<3)u.push(renderArc(0,c,.6*s));else{u.push(renderArc(0,c,s*c.p)),u.push(renderLine(0,c,computeMiddlePoint(c,getPointByIndex(i,1)),s));for(var d=0;d=0;--c){var l=this.tryEntries[c],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var d=s.call(l,"catchLoc"),p=s.call(l,"finallyLoc");if(d&&p){if(this.prev=0;--a){var c=this.tryEntries[a];if(c.tryLoc<=this.prev&&s.call(c,"finallyLoc")&&this.prev=0;--i){var a=this.tryEntries[i];if(a.finallyLoc===n)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),m}},catch:function(n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc===n){var s=a.completion;if("throw"===s.type){var c=s.arg;resetTryEntry(a)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(n,a,s){return this.delegate={iterator:values(n),resultName:a,nextLoc:s},"next"===this.method&&(this.arg=i),m}},n}(n.exports);try{regeneratorRuntime=i}catch(n){"object"==typeof globalThis?globalThis.regeneratorRuntime=i:Function("r","regeneratorRuntime = r")(i)}})),V=$,q=createCommonjsModule((function(n){function _typeof(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(n.exports=_typeof=function _typeof(n){return typeof n},n.exports.default=n.exports,n.exports.__esModule=!0):(n.exports=_typeof=function _typeof(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},n.exports.default=n.exports,n.exports.__esModule=!0),_typeof(i)}n.exports=_typeof,n.exports.default=n.exports,n.exports.__esModule=!0})),J=unwrapExports(q),K=createCommonjsModule((function(n,i){var a;n.exports=(a=a||function(n,i){var a=Object.create||function(){function F(){}return function(n){var i;return F.prototype=n,i=new F,F.prototype=null,i}}(),s={},c=s.lib={},l=c.Base={extend:function(n){var i=a(this);return n&&i.mixIn(n),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}},u=c.WordArray=l.extend({init:function(n,a){n=this.words=n||[],this.sigBytes=a!=i?a:4*n.length},toString:function(n){return(n||p).stringify(this)},concat:function(n){var i=this.words,a=n.words,s=this.sigBytes,c=n.sigBytes;if(this.clamp(),s%4)for(var l=0;l>>2]>>>24-l%4*8&255;i[s+l>>>2]|=u<<24-(s+l)%4*8}else for(l=0;l>>2]=a[l>>>2];return this.sigBytes+=c,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=n.ceil(a/4)},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(i){for(var a,s=[],r=function(i){i=i;var a=987654321,s=4294967295;return function(){var c=((a=36969*(65535&a)+(a>>16)&s)<<16)+(i=18e3*(65535&i)+(i>>16)&s)&s;return c/=4294967296,(c+=.5)*(n.random()>.5?1:-1)}},c=0;c>>2]>>>24-c%4*8&255;s.push((l>>>4).toString(16)),s.push((15&l).toString(16))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>3]|=parseInt(n.substr(s,2),16)<<24-s%8*4;return new u.init(a,i/2)}},h=d.Latin1={stringify:function(n){for(var i=n.words,a=n.sigBytes,s=[],c=0;c>>2]>>>24-c%4*8&255;s.push(String.fromCharCode(l))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>2]|=(255&n.charCodeAt(s))<<24-s%4*8;return new u.init(a,i)}},f=d.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},g=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(n){"string"==typeof n&&(n=f.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(i){var a=this._data,s=a.words,c=a.sigBytes,l=this.blockSize,d=c/(4*l),p=(d=i?n.ceil(d):n.max((0|d)-this._minBufferSize,0))*l,h=n.min(4*p,c);if(p){for(var f=0;f>>1|re<<31)^(ne>>>8|re<<24)^ne>>>7,ie=(re>>>1|ne<<31)^(re>>>8|ne<<24)^(re>>>7|ne<<25),ae=p[K-2],se=ae.high,ce=ae.low,le=(se>>>19|ce<<13)^(se<<3|ce>>>29)^se>>>6,ue=(ce>>>19|se<<13)^(ce<<3|se>>>29)^(ce>>>6|se<<26),de=p[K-7],pe=de.high,he=de.low,fe=p[K-16],ge=fe.high,me=fe.low;Q=(Q=(Q=oe+pe+((ee=ie+he)>>>0>>0?1:0))+le+((ee+=ue)>>>0>>0?1:0))+ge+((ee+=me)>>>0>>0?1:0),Z.high=Q,Z.low=ee}var ve,ye=H&G^~H&$,be=B&Y^~B&V,xe=D&U^D&z^U&z,we=j&O^j&N^O&N,Ee=(D>>>28|j<<4)^(D<<30|j>>>2)^(D<<25|j>>>7),_e=(j>>>28|D<<4)^(j<<30|D>>>2)^(j<<25|D>>>7),Se=(H>>>14|B<<18)^(H>>>18|B<<14)^(H<<23|B>>>9),Ce=(B>>>14|H<<18)^(B>>>18|H<<14)^(B<<23|H>>>9),ke=d[K],Pe=ke.high,Ie=ke.low,Te=q+Se+((ve=J+Ce)>>>0>>0?1:0),Me=_e+we;q=$,J=V,$=G,V=Y,G=H,Y=B,H=W+(Te=(Te=(Te=Te+ye+((ve+=be)>>>0>>0?1:0))+Pe+((ve+=Ie)>>>0>>0?1:0))+Q+((ve+=ee)>>>0>>0?1:0))+((B=X+ve|0)>>>0>>0?1:0)|0,W=z,X=N,z=U,N=O,U=D,O=j,D=Te+(Ee+xe+(Me>>>0<_e>>>0?1:0))+((j=ve+Me|0)>>>0>>0?1:0)|0}y=s.low=y+j,s.high=v+D+(y>>>0>>0?1:0),x=c.low=x+O,c.high=b+U+(x>>>0>>0?1:0),_=l.low=_+N,l.high=w+z+(_>>>0>>0?1:0),C=u.low=C+X,u.high=S+W+(C>>>0>>0?1:0),P=h.low=P+B,h.high=k+H+(P>>>0>>0?1:0),T=f.low=T+Y,f.high=I+G+(T>>>0>>0?1:0),R=g.low=R+V,g.high=M+$+(R>>>0>>0?1:0),A=m.low=A+J,m.high=L+q+(A>>>0>>0?1:0)},_doFinalize:function(){var n=this._data,i=n.words,a=8*this._nDataBytes,s=8*n.sigBytes;return i[s>>>5]|=128<<24-s%32,i[30+(s+128>>>10<<5)]=Math.floor(a/4294967296),i[31+(s+128>>>10<<5)]=a,n.sigBytes=4*i.length,this._process(),this._hash.toX32()},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n},blockSize:32});n.SHA512=i._createHelper(h),n.HmacSHA512=i._createHmacHelper(h)}(),a.SHA512)})),createCommonjsModule((function(n,i){var a,s,c;n.exports=(s=(a=K).lib.Base,c=a.enc.Utf8,void(a.algo.HMAC=s.extend({init:function(n,i){n=this._hasher=new n.init,"string"==typeof i&&(i=c.parse(i));var a=n.blockSize,s=4*a;i.sigBytes>s&&(i=n.finalize(i)),i.clamp();for(var l=this._oKey=i.clone(),u=this._iKey=i.clone(),d=l.words,p=u.words,h=0;h=i.rawStrokes.length-1}function updateRecognitionPositions(n,i){var a=n;return i&&(a.lastPositions.lastSentPosition=i.lastSentPosition,a.lastPositions.lastReceivedPosition=i.lastReceivedPosition),a.lastPositions.lastSentPosition===a.lastPositions.lastReceivedPosition===-1&&delete a.instanceId,a}function setRecognitionContext(n,i){var a=n;return a.recognitionContexts[0]=i,a}function canReconnect(n){return!0===n.websocket.autoReconnect&&n.currentReconnectionCount<=n.websocket.maxRetryCount}function shouldAttemptImmediateReconnect(n){var i=n;return!0===i.websocket.autoReconnect&&i.currentReconnectionCount++<=i.websocket.maxRetryCount}var ee={type:"LOST_CONNECTION"},te="CLOSE_RECOGNIZER",ne=Object.freeze({__proto__:null,createEmptyRecognizerContext:createEmptyRecognizerContext,isResetRequired:isResetRequired,updateRecognitionPositions:updateRecognitionPositions,setRecognitionContext:setRecognitionContext,canReconnect:canReconnect,shouldAttemptImmediateReconnect:shouldAttemptImmediateReconnect,LOST_CONNEXION_MESSAGE:ee,CLOSE_RECOGNIZER_MESSAGE:te}); +!function(n,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports):"function"==typeof define&&define.amd?define(["exports"],i):i((n=n||self).iink={})}(this,(function(n){"use strict";var i={EventType:{IDLE:"idle",CHANGED:"changed",IMPORTED:"imported",EXPORTED:"exported",CONVERTED:"converted",RENDERED:"rendered",LOADED:"loaded",UNDO:"undo",REDO:"redo",CLEAR:"clear",IMPORT:"import",SUPPORTED_IMPORT_MIMETYPES:"supportedImportMimeTypes",EXPORT:"export",CONVERT:"convert",ERROR:"error"},RecognitionType:{TEXT:"TEXT",MATH:"MATH",DIAGRAM:"DIAGRAM",RAWCONTENT:"Raw Content"},Protocol:{WEBSOCKET:"WEBSOCKET",REST:"REST"},ModelState:{INITIALIZING:"INITIALIZING",INITIALIZED:"INITIALIZED",EXPORTING:"EXPORTING",EXPORTED:"EXPORTED",PENDING:"PENDING",MODIFIED:"MODIFIED",ERROR:"ERROR"},Trigger:{QUIET_PERIOD:"QUIET_PERIOD",POINTER_UP:"POINTER_UP",DEMAND:"DEMAND"},Logger:{EDITOR:"editor",MODEL:"model",GRABBER:"grabber",RENDERER:"renderer",RECOGNIZER:"recognizer",EVENT:"event",UTIL:"util",SMARTGUIDE:"smartguide"},LogLevel:{TRACE:"TRACE",DEBUG:"DEBUG",INFO:"INFO",WARN:"WARN",ERROR:"ERROR"},Languages:{zh_CN:"Noto Sans CJK tc",zh_HK:"Noto Sans CJK tc",zh_TW:"Noto Sans CJK tc",ko_KR:"Noto Sans CJK kr",ja_JP:"Noto Sans CJK jp",default:"Open Sans"},Error:{NOT_REACHABLE:"MyScript recognition server is not reachable. Please reload once you are connected.",WRONG_CREDENTIALS:"Application credentials are invalid. Please check or regenerate your application key and hmackey.",TOO_OLD:"Session is too old. Max Session Duration Reached.",NO_ACTIVITY:"Session closed due to no activity."},Exports:{JIIX:"application/vnd.myscript.jiix"}},a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function unwrapExports(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function createCommonjsModule(n,i){return n(i={exports:{}},i.exports),i.exports}var s=(0,createCommonjsModule((function(n){!function(i,a){n.exports?n.exports=a():i.log=a()}(a,(function(){var noop=function(){},n="undefined",i=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),a=["trace","debug","info","warn","error"];function bindMethod(n,i){var a=n[i];if("function"==typeof a.bind)return a.bind(n);try{return Function.prototype.bind.call(a,n)}catch(i){return function(){return Function.prototype.apply.apply(a,[n,arguments])}}}function traceForIE(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function realMethod(a){return"debug"===a&&(a="log"),typeof console!==n&&("trace"===a&&i?traceForIE:void 0!==console[a]?bindMethod(console,a):void 0!==console.log?bindMethod(console,"log"):noop)}function replaceLoggingMethods(n,i){for(var s=0;s=0&&s<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+s;if(l=s,!1!==c&&function persistLevelIfPossible(i){var s=(a[i]||"silent").toUpperCase();if(typeof window!==n){try{return void(window.localStorage[d]=s)}catch(n){}try{window.document.cookie=encodeURIComponent(d)+"="+s+";"}catch(n){}}}(s),replaceLoggingMethods.call(u,s,i),typeof console===n&&s-1},ListCache.prototype.set=function listCacheSet(n,i){var a=this.__data__,s=assocIndexOf(a,n);return s<0?(++this.size,a.push([n,i])):a[s][1]=i,this},MapCache.prototype.clear=function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(K||ListCache),string:new Hash}},MapCache.prototype.delete=function mapCacheDelete(n){var i=getMapData(this,n).delete(n);return this.size-=i?1:0,i},MapCache.prototype.get=function mapCacheGet(n){return getMapData(this,n).get(n)},MapCache.prototype.has=function mapCacheHas(n){return getMapData(this,n).has(n)},MapCache.prototype.set=function mapCacheSet(n,i){var a=getMapData(this,n),s=a.size;return a.set(n,i),this.size+=a.size==s?0:1,this},Stack.prototype.clear=function stackClear(){this.__data__=new ListCache,this.size=0},Stack.prototype.delete=function stackDelete(n){var i=this.__data__,a=i.delete(n);return this.size=i.size,a},Stack.prototype.get=function stackGet(n){return this.__data__.get(n)},Stack.prototype.has=function stackHas(n){return this.__data__.has(n)},Stack.prototype.set=function stackSet(n,i){var a=this.__data__;if(a instanceof ListCache){var s=a.__data__;if(!K||s.length<199)return s.push([n,i]),this.size=++a.size,this;a=this.__data__=new MapCache(s)}return a.set(n,i),this.size=a.size,this};var Q=function createBaseFor(n){return function(i,a,s){for(var c=-1,l=Object(i),u=s(i),d=u.length;d--;){var p=u[n?d:++c];if(!1===a(l[p],p,l))break}return i}}();function baseGetTag(n){return null==n?void 0===n?"[object Undefined]":"[object Null]":G&&G in Object(n)?function getRawTag(n){var i=R.call(n,G),a=n[G];try{n[G]=void 0;var s=!0}catch(n){}var c=A.call(n);s&&(i?n[G]=a:delete n[G]);return c}(n):function objectToString(n){return A.call(n)}(n)}function baseIsArguments(n){return isObjectLike(n)&&baseGetTag(n)==l}function baseIsNative(n){return!(!isObject(n)||function isMasked(n){return!!L&&L in n}(n))&&(isFunction(n)?j:p).test(function toSource(n){if(null!=n){try{return M.call(n)}catch(n){}try{return n+""}catch(n){}}return""}(n))}function baseKeysIn(n){if(!isObject(n))return function nativeKeysIn(n){var i=[];if(null!=n)for(var a in Object(n))i.push(a);return i}(n);var i=isPrototype(n),a=[];for(var s in n)("constructor"!=s||!i&&R.call(n,s))&&a.push(s);return a}function baseMerge(n,i,a,s,c){n!==i&&Q(i,(function(l,u){if(c||(c=new Stack),isObject(l))!function baseMergeDeep(n,i,a,s,c,l,u){var p=safeGet(n,a),h=safeGet(i,a),f=u.get(h);if(f)return void assignMergeValue(n,a,f);var g=l?l(p,h,a+"",n,i,u):void 0,m=void 0===g;if(m){var v=ne(h),y=!v&&re(h),b=!v&&!y&&oe(h);g=h,v||y||b?ne(p)?g=p:!function isArrayLikeObject(n){return isObjectLike(n)&&isArrayLike(n)}(p)?y?(m=!1,g=function cloneBuffer(n,i){if(i)return n.slice();var a=n.length,s=N?N(a):new n.constructor(a);return n.copy(s),s}(h,!0)):b?(m=!1,g=function cloneTypedArray(n,i){var a=i?function cloneArrayBuffer(n){var i=new n.constructor(n.byteLength);return new z(i).set(new z(n)),i}(n.buffer):n.buffer;return new n.constructor(a,n.byteOffset,n.length)}(h,!0)):g=[]:g=function copyArray(n,i){var a=-1,s=n.length;i||(i=Array(s));for(;++a-1&&n%1==0&&n0){if(++i>=800)return arguments[0]}else i=0;return n.apply(void 0,arguments)}}(Y?function(n,i){return Y(n,"toString",{configurable:!0,enumerable:!1,value:(a=i,function(){return a}),writable:!0});var a}:identity);function eq(n,i){return n===i||n!=n&&i!=i}var te=baseIsArguments(function(){return arguments}())?baseIsArguments:function(n){return isObjectLike(n)&&R.call(n,"callee")&&!H.call(n,"callee")},ne=Array.isArray;function isArrayLike(n){return null!=n&&isLength(n.length)&&!isFunction(n)}var re=$||function stubFalse(){return!1};function isFunction(n){if(!isObject(n))return!1;var i=baseGetTag(n);return i==u||"[object GeneratorFunction]"==i||"[object AsyncFunction]"==i||"[object Proxy]"==i}function isLength(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=c}function isObject(n){var i=typeof n;return null!=n&&("object"==i||"function"==i)}function isObjectLike(n){return null!=n&&"object"==typeof n}var oe=S?function baseUnary(n){return function(i){return n(i)}}(S):function baseIsTypedArray(n){return isObjectLike(n)&&isLength(n.length)&&!!f[baseGetTag(n)]};function keysIn(n){return isArrayLike(n)?arrayLikeKeys(n,!0):baseKeysIn(n)}var ie=function createAssigner(n){return baseRest((function(i,a){var s=-1,c=a.length,l=c>1?a[c-1]:void 0,u=c>2?a[2]:void 0;for(l=n.length>3&&"function"==typeof l?(c--,l):void 0,u&&function isIterateeCall(n,i,a){if(!isObject(a))return!1;var s=typeof i;if("number"==s?isArrayLike(a)&&isIndex(i,a.length):"string"==s&&i in a)return eq(a[i],n);return!1}(a[0],a[1],u)&&(l=c<3?void 0:l,c=1),i=Object(i);++s10?_[10]:_[i],Math.round(n*a)/a):n}function extractPoint(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,l=n;l.changedTouches&&(l=l.changedTouches[0]);var u=i.getBoundingClientRect();return{x:roundFloat(l.clientX-u.left-i.clientLeft-c,a.xyFloatPrecision),y:roundFloat(l.clientY-u.top-i.clientTop-s,a.xyFloatPrecision),t:roundFloat(Date.now(),a.timestampFloatPrecision)}}var S=function prevent(n){return n.preventDefault()};var k=Object.freeze({__proto__:null,attach:function attach(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,c=0;function unfocus(){"None"!==window.getSelection().type&&window.getSelection().removeAllRanges()}function hideMenu(n){var i=document.querySelector(".more-menu");return!(n.target.classList.contains("ellipsis")||n.target.classList.contains("more-menu")||n.target.classList.contains("options-label-button")||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function hideCandidates(n){var i=document.querySelector(".candidates");return!(n.target.classList.contains("candidates")||"SPAN"===n.target.tagName||!i||"none"===i.style.display)&&(i.style.display="none",!0)}function pointerDownHandler(c){var l=c.target.id===i.domElement.id||c.target.classList.contains("ms-canvas");if(void 0!==this.activePointerId)this.activePointerId===c.pointerId&&u.trace("".concat(c.type," event with the same id without any pointer up"),c.pointerId);else if(2!==c.button&&2!==c.buttons&&l){if(!hideMenu(c)&&!hideCandidates(c)){this.activePointerId=c.pointerId;var d=c.pointerId>2147483647?-1:c.pointerId;unfocus(),c.stopPropagation();var p=c.pointerType;i.isErasing&&(p="ERASER"),i.pointerDown(extractPoint(c,n,i.configuration,a,s),p,d)}}else c.target.classList.contains("ellipsis")||c.target.classList.contains("tag-icon")?(hideMenu(c),hideCandidates(c)):(hideMenu(c),hideCandidates(c),this.smartGuidePointerDown=!0,this.downSmartGuidePoint=extractPoint(c,n,i.configuration))}function pointerMoveHandler(l){if(void 0!==this.activePointerId&&this.activePointerId===l.pointerId)unfocus(),i.pointerMove(extractPoint(l,n,i.configuration,a,s));else if(this.smartGuidePointerDown){var d=extractPoint(l,n,i.configuration,a,s),p=Math.abs(this.downSmartGuidePoint.x-d.x),h=Math.abs(this.downSmartGuidePoint.y-d.y);if(c=Math.max(p,c),p<5&&h>5&&c<15||p>5&&h>5&&c<15){this.activePointerId=l.pointerId;var f=l.pointerId>2147483647?-1:l.pointerId;unfocus(),i.pointerDown(this.downSmartGuidePoint,l.pointerType,f)}}else u.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}function pointerUpHandler(l){c=0,this.smartGuidePointerDown=!1;var d=["smartguide","prompter-text-container","prompter-text","tag-icon","ellipsis"],p=["ps__rail-x","ps__thumb-x"],h=l.relatedTarget&&(d.includes(l.relatedTarget.className)||p.includes(l.relatedTarget.className)),f=l.relatedTarget&&l.target&&(d.includes(l.target.className)||p.includes(l.target.className)),g=l.relatedTarget&&l.target&&("SPAN"===l.target.tagName||"SPAN"===l.relatedTarget.tagName);h||f||g?l.stopPropagation():void 0!==this.activePointerId&&this.activePointerId===l.pointerId?(this.activePointerId=void 0,l.stopPropagation(),i.pointerUp(extractPoint(l,n,i.configuration,a,s))):u.trace("".concat(l.type," event from another pointerid (").concat(l.pointerId,")"),this.activePointerId)}var l={options:i.configuration.listenerOptions,listeners:[{types:["pointerdown"],listener:pointerDownHandler},{types:["pointermove"],listener:pointerMoveHandler},{types:["pointerup","pointerout","pointerleave","pointercancel"],listener:pointerUpHandler}]};return u.debug("attaching listeners",l),l.listeners.forEach((function(i){i.types.forEach((function(a){return n.addEventListener(a,i.listener,l.options)}))})),n.addEventListener("touchmove",S),document.documentElement.addEventListener("pointerdown",(function(){})),l},detach:function detach(n,i){u.debug("detaching listeners",i),i.listeners.forEach((function(a){a.types.forEach((function(s){return n.removeEventListener(s,a.listener,i.options)}))})),n.removeEventListener("touchmove",S),document.documentElement.removeEventListener("pointerdown",(function(){}))}});var C=function _arrayLikeToArray(n,i){(null==i||i>n.length)&&(i=n.length);for(var a=0,s=new Array(i);a=l||Math.abs(s[s.length-1]-i)>=l)&&(u=!0),u}(i.x,i.y,a.x,a.y,a.width)?l.trace("ignore filtered point",i):(a.x.push(i.x),a.y.push(i.y),a.t.push(i.t),a.p.push(function computePressure(n,i,a,s,c,l){var u=1,d=computeDistance(n,i,a,s,l),p=computeLength(n,i,a,s,c,l);0===p?u=.5:d===p?u=1:d<10?u=.2+Math.pow(.1*d,.4):d>p-10&&(u=.2+Math.pow(.1*(p-d),.4));var h=u*Math.max(.1,1-.1*Math.sqrt(d));return isNaN(parseFloat(h))?.5:h}(i.x,i.y,a.x,a.y,a.l,a.x.length-1)),a.l.push(computeLength(i.x,i.y,a.x,a.y,a.l,a.x.length-1))),a}function slice(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.x.length,s=createStrokeComponent({color:n.color,width:n.width}),c=i;c=0&&i1&&void 0!==arguments[1]?arguments[1]:{minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE},a=i;return a=n.filter((function(n){return"stroke"===n.type})).map(getStrokeBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"clef"===n.type})).map(getClefBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"line"===n.type})).map(getLineBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"ellipse"===n.type})).map(getEllipseBounds).reduce(mergeBounds,a),a=n.filter((function(n){return"textLine"===n.type})).map(getTextLineBounds).reduce(mergeBounds,a)}function createModel(n){return{currentStroke:void 0,rawStrokes:[],strokeGroups:[],lastPositions:{lastSentPosition:-1,lastReceivedPosition:-1,lastRenderedPosition:-1},defaultSymbols:[],recognizedSymbols:void 0,exports:void 0,rawResults:{convert:void 0,exports:void 0},creationTime:(new Date).getTime(),modificationTime:void 0}}function clearModel(n){var i=n;return i.currentStroke=void 0,i.rawStrokes=[],i.strokeGroups=[],i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i.lastPositions.lastRenderedPosition=-1,i.recognizedSymbols=void 0,i.exports=void 0,i.rawResults.convert=void 0,i.rawResults.exports=void 0,i}function needRedraw(n){return!!n.recognizedSymbols&&n.rawStrokes.length!==n.recognizedSymbols.filter((function(n){return"stroke"===n.type})).length}function addStroke(n,i){var a=n;return l.debug("addStroke",i),a.rawStrokes.push(i),a}function addStrokeToGroup(n,i,a){var s=n;l.debug("addStroke",i);var c=s.strokeGroups.length-1;if(s.strokeGroups[c]&&s.strokeGroups[c].penStyle===a)s.strokeGroups[c].strokes.push(i);else{var u={penStyle:a,strokes:[]},d={};Object.assign(d,i),u.strokes.push(d),s.strokeGroups.push(u)}return s}function extractPendingStrokes(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastReceivedPosition+1;return n.rawStrokes.slice(i)}function initPendingStroke(n,i,a){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:96;if(a&&a["-myscript-pen-width"]){var c=a["-myscript-pen-width"]*s/25.4;Object.assign(a,{width:c/2})}var u=n;return l.trace("initPendingStroke",i),u.currentStroke=createStrokeComponent(a),u.currentStroke=addPoint(u.currentStroke,i),u}function appendToPendingStroke(n,i){var a=n;return a.currentStroke&&(l.trace("appendToPendingStroke",i),a.currentStroke=addPoint(a.currentStroke,i)),a}function endPendingStroke(n,i,a){var s=n;if(s.currentStroke){l.trace("endPendingStroke",i);var c=addPoint(s.currentStroke,i);addStroke(s,c),addStrokeToGroup(s,c,a),delete s.currentStroke}return s}function getBorderCoordinates(n){var i={minX:Number.MAX_VALUE,maxX:Number.MIN_VALUE,minY:Number.MAX_VALUE,maxY:Number.MIN_VALUE};return n.defaultSymbols&&n.defaultSymbols.length>0&&(i=getSymbolsBounds(n.defaultSymbols,i)),n.recognizedSymbols&&n.recognizedSymbols.length>0?(i=getSymbolsBounds(n.recognizedSymbols,i),i=getSymbolsBounds(extractPendingStrokes(n),i)):i=getSymbolsBounds(n.rawStrokes,i),i}function updateModelSentPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.rawStrokes.length-1,a=n;return a.lastPositions.lastSentPosition=i,a}function updateModelReceivedPosition(n){var i=n;return i.lastPositions.lastReceivedPosition=i.lastPositions.lastSentPosition,i}function resetModelPositions(n){var i=n;return i.lastPositions.lastSentPosition=-1,i.lastPositions.lastReceivedPosition=-1,i}function updateModelRenderedPosition(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.recognizedSymbols?n.recognizedSymbols.length-1:-1,a=n;return a.lastPositions.lastRenderedPosition=i,a}function extractPendingRecognizedSymbols(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.lastPositions.lastRenderedPosition+1;return n.recognizedSymbols?n.recognizedSymbols.slice(i):[]}function cloneModel(n){var i=Object.assign({},n);return i.defaultSymbols=R(n.defaultSymbols),i.currentStroke=n.currentStroke?Object.assign({},n.currentStroke):void 0,i.rawStrokes=R(n.rawStrokes),i.strokeGroups=JSON.parse(JSON.stringify(n.strokeGroups)),i.lastPositions=Object.assign({},n.lastPositions),i.exports=n.exports?Object.assign({},n.exports):void 0,i.rawResults=Object.assign({},n.rawResults),i.recognizedSymbols=n.recognizedSymbols?R(n.recognizedSymbols):void 0,i}function mergeModels(){for(var n=arguments.length,i=new Array(n),a=0;a1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;d.debug("attach renderer",n);var s=detectPixelRatio(),c=createCanvas(n,"ms-rendering-canvas"),l=createCanvas(n,"ms-capture-canvas"),u={pixelRatio:s,minHeight:i,minWidth:a,renderingCanvas:c,renderingCanvasContext:c.getContext("2d"),capturingCanvas:l,capturingCanvasContext:l.getContext("2d")};return resizeContent(u)},detach:function detach$1(n,i){d.debug("detach renderer",n),n.removeChild(i.renderingCanvas),n.removeChild(i.capturingCanvas)},resize:function resize(n,i,a){return this.drawModel(resizeContent(n),i,a)},drawCurrentStroke:function drawCurrentStroke(n,i,a){return n.capturingCanvasContext.clearRect(0,0,n.capturingCanvas.width,n.capturingCanvas.height),d.trace("drawing current stroke ",i.currentStroke),drawStroke(n.capturingCanvasContext,i.currentStroke,a),i},drawModel:drawModel});function computeLinksPoints(n,i,a){var s=n.p*a;return[{x:n.x-Math.sin(i)*s,y:n.y+Math.cos(i)*s},{x:n.x+Math.sin(i)*s,y:n.y-Math.cos(i)*s}]}function computeMiddlePoint(n,i){return{x:(i.x+n.x)/2,y:(i.y+n.y)/2,p:(i.p+n.p)/2}}function computeAxeAngle(n,i){return Math.atan2(i.y-n.y,i.x-n.x)}function renderArc(n,i,a){n.arc(i.x,i.y,a,0,2*Math.PI,!0)}function renderLine(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);n.moveTo(c[0].x,c[0].y),n.lineTo(l[0].x,l[0].y),n.lineTo(l[1].x,l[1].y),n.lineTo(c[1].x,c[1].y)}function renderQuadratic(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);n.moveTo(l[0].x,l[0].y),n.quadraticCurveTo(d[0].x,d[0].y,u[0].x,u[0].y),n.lineTo(u[1].x,u[1].y),n.quadraticCurveTo(d[1].x,d[1].y,l[1].x,l[1].y)}var U=Object.freeze({__proto__:null,getInfo:function getInfo$1(){return{type:"canvas",name:"quadratic"}},drawStroke:function drawStroke$1(n,i){var a=n,s=i.x.length,c=i.width>0?i.width:a.lineWidth,l=i.color?i.color:a.strokeStyle,u=getPointByIndex(i,0),d=s-2;a.save();try{if(a.beginPath(),s<3)renderArc(a,u,.6*c);else{renderArc(a,u,c*u.p),renderLine(a,u,computeMiddlePoint(u,getPointByIndex(i,1)),c);for(var p=0;p=0&&"xmlns"!==(i=n.slice(0,a))&&(n=n.slice(a+1)),z.hasOwnProperty(i)?{space:z[i],local:n}:n}function creatorInherit(n){return function(){var i=this.ownerDocument,a=this.namespaceURI;return a===O&&i.documentElement.namespaceURI===O?i.createElement(n):i.createElementNS(a,n)}}function creatorFixed(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function creator(n){var i=namespace(n);return(i.local?creatorFixed:creatorInherit)(i)}function none(){}function selector(n){return null==n?none:function(){return this.querySelector(n)}}function empty(){return[]}function sparse(n){return new Array(n.length)}function EnterNode(n,i){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=i}EnterNode.prototype={constructor:EnterNode,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,i){return this._parent.insertBefore(n,i)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function bindIndex(n,i,a,s,c,l){for(var u,d=0,p=i.length,h=l.length;di?1:n>=i?0:NaN}function attrRemove(n){return function(){this.removeAttribute(n)}}function attrRemoveNS(n){return function(){this.removeAttributeNS(n.space,n.local)}}function attrConstant(n,i){return function(){this.setAttribute(n,i)}}function attrConstantNS(n,i){return function(){this.setAttributeNS(n.space,n.local,i)}}function attrFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttribute(n):this.setAttribute(n,a)}}function attrFunctionNS(n,i){return function(){var a=i.apply(this,arguments);null==a?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,a)}}function defaultView(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function styleRemove(n){return function(){this.style.removeProperty(n)}}function styleConstant(n,i,a){return function(){this.style.setProperty(n,i,a)}}function styleFunction(n,i,a){return function(){var s=i.apply(this,arguments);null==s?this.style.removeProperty(n):this.style.setProperty(n,s,a)}}function styleValue(n,i){return n.style.getPropertyValue(i)||defaultView(n).getComputedStyle(n,null).getPropertyValue(i)}function propertyRemove(n){return function(){delete this[n]}}function propertyConstant(n,i){return function(){this[n]=i}}function propertyFunction(n,i){return function(){var a=i.apply(this,arguments);null==a?delete this[n]:this[n]=a}}function classArray(n){return n.trim().split(/^|\s+/)}function classList(n){return n.classList||new ClassList(n)}function ClassList(n){this._node=n,this._names=classArray(n.getAttribute("class")||"")}function classedAdd(n,i){for(var a=classList(n),s=-1,c=i.length;++s=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};var N={};"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(N={mouseenter:"mouseover",mouseleave:"mouseout"}));function filterContextListener(n,i,a){return n=contextListener(n,i,a),function(i){var a=i.relatedTarget;a&&(a===this||8&a.compareDocumentPosition(this))||n.call(this,i)}}function contextListener(n,i,a){return function(s){try{n.call(this,this.__data__,i,a)}finally{}}}function parseTypenames(n){return n.trim().split(/^|\s+/).map((function(n){var i="",a=n.indexOf(".");return a>=0&&(i=n.slice(a+1),n=n.slice(0,a)),{type:n,name:i}}))}function onRemove(n){return function(){var i=this.__on;if(i){for(var a,s=0,c=-1,l=i.length;s=k&&(k=S+1);!(_=x[k])&&++k=0;)(s=c[l])&&(u&&4^s.compareDocumentPosition(u)&&u.parentNode.insertBefore(s,u),u=s);return this},sort:function selection_sort(n){function compareNode(i,a){return i&&a?n(i.__data__,a.__data__):!i-!a}n||(n=ascending);for(var i=this._groups,a=i.length,s=new Array(a),c=0;c1?this.each((null==i?styleRemove:"function"==typeof i?styleFunction:styleConstant)(n,i,null==a?"":a)):styleValue(this.node(),n)},property:function selection_property(n,i){return arguments.length>1?this.each((null==i?propertyRemove:"function"==typeof i?propertyFunction:propertyConstant)(n,i)):this.node()[n]},classed:function selection_classed(n,i){var a=classArray(n+"");if(arguments.length<2){for(var s=classList(this.node()),c=-1,l=a.length;++c *:nth-child(").concat(a.index+1,")")).remove();break;case"APPEND_CHILD":var u=n.select(a.parentId?"#".concat(a.parentId):s).node();u.insertAdjacentHTML?u.insertAdjacentHTML("beforeEnd",a.svg):(insertAdjacentSVG(u,"beforeEnd",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"INSERT_BEFORE":var p=n.select("#".concat(a.refId)).node();p.insertAdjacentHTML?p.insertAdjacentHTML("beforeBegin",a.svg):(insertAdjacentSVG(p,"beforeBegin",a.svg),n.node().insertAdjacentHTML("beforeEnd",n.select(s).remove().node().outerHTML));break;case"REMOVE_ATTRIBUTE":n.selectAll(a.id?"#".concat(a.id):"svg").attr(a.name,null);break;case"SET_ATTRIBUTE":a.id&&n.selectAll("#".concat(a.id)).attr(a.name,a.value);break;default:d.debug("unknown update ".concat(a.type," action"))}}catch(n){d.error("Invalid update ".concat(a.type),a),d.error("Error on svg patch",n)}}))}(i)})),updateModelRenderedPosition(i));var c=extractPendingStrokes(i);return c&&c.forEach((function(i){return function drawSymbol(n,i){d.trace("attempting to draw ".concat(n.type," symbol")),"stroke"!==n.type||i.select("id",n.id)?d.warn("impossible to draw ".concat(n.type," symbol")):drawStroke$2(i.append("path").attr("id",n.id),n,a)}(i,n.select("#pendingStrokes"))})),i}});function renderArc$1(n,i,a){return["M ".concat(i.x,",").concat(i.y),"m ".concat(-a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(2*a,",0"),"a ".concat(a,",").concat(a," 0 1 0 ").concat(-2*a,",0")].join(" ")}function renderLine$1(n,i,a,s){var c=computeLinksPoints(i,computeAxeAngle(i,a),s),l=computeLinksPoints(a,computeAxeAngle(i,a),s);return["M ".concat(c[0].x,",").concat(c[0].y),"L ".concat(l[0].x,",").concat(l[0].y),"L ".concat(l[1].x,",").concat(l[1].y),"L ".concat(c[1].x,",").concat(c[1].y)].join(" ")}function renderQuadratic$1(n,i,a,s,c){var l=computeLinksPoints(i,computeAxeAngle(i,s),c),u=computeLinksPoints(a,computeAxeAngle(s,a),c),d=computeLinksPoints(s,computeAxeAngle(i,a),c);return["M ".concat(l[0].x,",").concat(l[0].y),"Q ".concat(d[0].x,",").concat(d[0].y," ").concat(u[0].x,",").concat(u[0].y),"L ".concat(u[1].x,",").concat(u[1].y),"Q ".concat(d[1].x,",").concat(d[1].y," ").concat(l[1].x,",").concat(l[1].y)].join(" ")}var H=Object.freeze({__proto__:null,getInfo:function getInfo$3(){return{type:"svg",name:"quadratic"}},drawStroke:function drawStroke$3(n,i){var a=i.x.length,s=i.width,c=getPointByIndex(i,0),l=a-2,u=[];if(a<3)u.push(renderArc$1(0,c,.6*s));else{u.push(renderArc$1(0,c,s*c.p)),u.push(renderLine$1(0,c,computeMiddlePoint(c,getPointByIndex(i,1)),s));for(var d=0;d=0;--c){var l=this.tryEntries[c],u=l.completion;if("root"===l.tryLoc)return handle("end");if(l.tryLoc<=this.prev){var d=s.call(l,"catchLoc"),p=s.call(l,"finallyLoc");if(d&&p){if(this.prev=0;--a){var c=this.tryEntries[a];if(c.tryLoc<=this.prev&&s.call(c,"finallyLoc")&&this.prev=0;--i){var a=this.tryEntries[i];if(a.finallyLoc===n)return this.complete(a.completion,a.afterLoc),resetTryEntry(a),m}},catch:function(n){for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i];if(a.tryLoc===n){var s=a.completion;if("throw"===s.type){var c=s.arg;resetTryEntry(a)}return c}}throw new Error("illegal catch attempt")},delegateYield:function(n,a,s){return this.delegate={iterator:values(n),resultName:a,nextLoc:s},"next"===this.method&&(this.arg=i),m}},n}(n.exports);try{regeneratorRuntime=i}catch(n){Function("r","regeneratorRuntime = r")(i)}}));function asyncGeneratorStep(n,i,a,s,c,l,u){try{var d=n[l](u),p=d.value}catch(n){return void a(n)}d.done?i(p):Promise.resolve(p).then(s,c)}var G=function _asyncToGenerator(n){return function(){var i=this,a=arguments;return new Promise((function(s,c){var l=n.apply(i,a);function _next(n){asyncGeneratorStep(l,s,c,_next,_throw,"next",n)}function _throw(n){asyncGeneratorStep(l,s,c,_next,_throw,"throw",n)}_next(void 0)}))}},Y=createCommonjsModule((function(n){function _typeof(i){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?n.exports=_typeof=function _typeof(n){return typeof n}:n.exports=_typeof=function _typeof(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_typeof(i)}n.exports=_typeof})),$=createCommonjsModule((function(n,i){var a;n.exports=(a=a||function(n,i){var a=Object.create||function(){function F(){}return function(n){var i;return F.prototype=n,i=new F,F.prototype=null,i}}(),s={},c=s.lib={},l=c.Base={extend:function(n){var i=a(this);return n&&i.mixIn(n),i.hasOwnProperty("init")&&this.init!==i.init||(i.init=function(){i.$super.init.apply(this,arguments)}),i.init.prototype=i,i.$super=this,i},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}},u=c.WordArray=l.extend({init:function(n,a){n=this.words=n||[],this.sigBytes=a!=i?a:4*n.length},toString:function(n){return(n||p).stringify(this)},concat:function(n){var i=this.words,a=n.words,s=this.sigBytes,c=n.sigBytes;if(this.clamp(),s%4)for(var l=0;l>>2]>>>24-l%4*8&255;i[s+l>>>2]|=u<<24-(s+l)%4*8}else for(l=0;l>>2]=a[l>>>2];return this.sigBytes+=c,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=n.ceil(a/4)},clone:function(){var n=l.clone.call(this);return n.words=this.words.slice(0),n},random:function(i){for(var a,s=[],r=function(i){i=i;var a=987654321,s=4294967295;return function(){var c=((a=36969*(65535&a)+(a>>16)&s)<<16)+(i=18e3*(65535&i)+(i>>16)&s)&s;return c/=4294967296,(c+=.5)*(n.random()>.5?1:-1)}},c=0;c>>2]>>>24-c%4*8&255;s.push((l>>>4).toString(16)),s.push((15&l).toString(16))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>3]|=parseInt(n.substr(s,2),16)<<24-s%8*4;return new u.init(a,i/2)}},h=d.Latin1={stringify:function(n){for(var i=n.words,a=n.sigBytes,s=[],c=0;c>>2]>>>24-c%4*8&255;s.push(String.fromCharCode(l))}return s.join("")},parse:function(n){for(var i=n.length,a=[],s=0;s>>2]|=(255&n.charCodeAt(s))<<24-s%4*8;return new u.init(a,i)}},f=d.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch(n){throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},g=c.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(n){"string"==typeof n&&(n=f.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(i){var a=this._data,s=a.words,c=a.sigBytes,l=this.blockSize,d=c/(4*l),p=(d=i?n.ceil(d):n.max((0|d)-this._minBufferSize,0))*l,h=n.min(4*p,c);if(p){for(var f=0;f>>1|re<<31)^(ne>>>8|re<<24)^ne>>>7,ie=(re>>>1|ne<<31)^(re>>>8|ne<<24)^(re>>>7|ne<<25),ae=p[q-2],se=ae.high,ce=ae.low,le=(se>>>19|ce<<13)^(se<<3|ce>>>29)^se>>>6,ue=(ce>>>19|se<<13)^(ce<<3|se>>>29)^(ce>>>6|se<<26),de=p[q-7],pe=de.high,he=de.low,fe=p[q-16],ge=fe.high,me=fe.low;Q=(Q=(Q=oe+pe+((ee=ie+he)>>>0>>0?1:0))+le+((ee+=ue)>>>0>>0?1:0))+ge+((ee+=me)>>>0>>0?1:0),Z.high=Q,Z.low=ee}var ve,ye=H&G^~H&$,be=B&Y^~B&V,xe=D&U^D&z^U&z,we=j&O^j&N^O&N,Ee=(D>>>28|j<<4)^(D<<30|j>>>2)^(D<<25|j>>>7),_e=(j>>>28|D<<4)^(j<<30|D>>>2)^(j<<25|D>>>7),Se=(H>>>14|B<<18)^(H>>>18|B<<14)^(H<<23|B>>>9),ke=(B>>>14|H<<18)^(B>>>18|H<<14)^(B<<23|H>>>9),Ce=d[q],Pe=Ce.high,Ie=Ce.low,Te=J+Se+((ve=K+ke)>>>0>>0?1:0),Me=_e+we;J=$,K=V,$=G,V=Y,G=H,Y=B,H=W+(Te=(Te=(Te=Te+ye+((ve+=be)>>>0>>0?1:0))+Pe+((ve+=Ie)>>>0>>0?1:0))+Q+((ve+=ee)>>>0>>0?1:0))+((B=X+ve|0)>>>0>>0?1:0)|0,W=z,X=N,z=U,N=O,U=D,O=j,D=Te+(Ee+xe+(Me>>>0<_e>>>0?1:0))+((j=ve+Me|0)>>>0>>0?1:0)|0}y=s.low=y+j,s.high=v+D+(y>>>0>>0?1:0),x=c.low=x+O,c.high=b+U+(x>>>0>>0?1:0),_=l.low=_+N,l.high=w+z+(_>>>0>>0?1:0),k=u.low=k+X,u.high=S+W+(k>>>0>>0?1:0),P=h.low=P+B,h.high=C+H+(P>>>0>>0?1:0),T=f.low=T+Y,f.high=I+G+(T>>>0>>0?1:0),R=g.low=R+V,g.high=M+$+(R>>>0>>0?1:0),A=m.low=A+K,m.high=L+J+(A>>>0>>0?1:0)},_doFinalize:function(){var n=this._data,i=n.words,a=8*this._nDataBytes,s=8*n.sigBytes;return i[s>>>5]|=128<<24-s%32,i[30+(s+128>>>10<<5)]=Math.floor(a/4294967296),i[31+(s+128>>>10<<5)]=a,n.sigBytes=4*i.length,this._process(),this._hash.toX32()},clone:function(){var n=i.clone.call(this);return n._hash=this._hash.clone(),n},blockSize:32});n.SHA512=i._createHelper(h),n.HmacSHA512=i._createHmacHelper(h)}(),a.SHA512)})),createCommonjsModule((function(n,i){var a,s,c;n.exports=(s=(a=$).lib.Base,c=a.enc.Utf8,void(a.algo.HMAC=s.extend({init:function(n,i){n=this._hasher=new n.init,"string"==typeof i&&(i=c.parse(i));var a=n.blockSize,s=4*a;i.sigBytes>s&&(i=n.finalize(i)),i.clamp();for(var l=this._oKey=i.clone(),u=this._iKey=i.clone(),d=l.words,p=u.words,h=0;h=i.rawStrokes.length-1}function updateRecognitionPositions(n,i){var a=n;return i&&(a.lastPositions.lastSentPosition=i.lastSentPosition,a.lastPositions.lastReceivedPosition=i.lastReceivedPosition),a.lastPositions.lastSentPosition===a.lastPositions.lastReceivedPosition===-1&&delete a.instanceId,a}function setRecognitionContext(n,i){var a=n;return a.recognitionContexts[0]=i,a}function canReconnect(n){return!0===n.websocket.autoReconnect&&n.currentReconnectionCount<=n.websocket.maxRetryCount}function shouldAttemptImmediateReconnect(n){var i=n;return!0===i.websocket.autoReconnect&&i.currentReconnectionCount++<=i.websocket.maxRetryCount}var K={type:"LOST_CONNECTION"},q="CLOSE_RECOGNIZER",Z=Object.freeze({__proto__:null,createEmptyRecognizerContext:createEmptyRecognizerContext,isResetRequired:isResetRequired,updateRecognitionPositions:updateRecognitionPositions,setRecognitionContext:setRecognitionContext,canReconnect:canReconnect,shouldAttemptImmediateReconnect:shouldAttemptImmediateReconnect,LOST_CONNEXION_MESSAGE:K,CLOSE_RECOGNIZER_MESSAGE:q}); /*! - * perfect-scrollbar v1.5.3 - * Copyright 2021 Hyunje Jun, MDBootstrap and Contributors + * perfect-scrollbar v1.5.0 + * Copyright 2020 Hyunje Jun, MDBootstrap and Contributors * Licensed under MIT */ -function get(n){return getComputedStyle(n)}function set(n,i){for(var a in i){var s=i[a];"number"==typeof s&&(s+="px"),n.style[a]=s}return n}function div(n){var i=document.createElement("div");return i.className=n,i}var re="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function matches(n,i){if(!re)throw new Error("No element matching method supported");return re.call(n,i)}function remove(n){n.remove?n.remove():n.parentNode&&n.parentNode.removeChild(n)}function queryChildren(n,i){return Array.prototype.filter.call(n.children,(function(n){return matches(n,i)}))}var oe="ps",ie="ps__rtl",ae={thumb:function(n){return"ps__thumb-"+n},rail:function(n){return"ps__rail-"+n},consuming:"ps__child--consume"},se={focus:"ps--focus",clicking:"ps--clicking",active:function(n){return"ps--active-"+n},scrolling:function(n){return"ps--scrolling-"+n}},ce={x:null,y:null};function addScrollingClass(n,i){var a=n.element.classList,s=se.scrolling(i);a.contains(s)?clearTimeout(ce[i]):a.add(s)}function removeScrollingClass(n,i){ce[i]=setTimeout((function(){return n.isAlive&&n.element.classList.remove(se.scrolling(i))}),n.settings.scrollingThreshold)}var le=function EventElement(n){this.element=n,this.handlers={}},ue={isEmpty:{configurable:!0}};le.prototype.bind=function bind(n,i){void 0===this.handlers[n]&&(this.handlers[n]=[]),this.handlers[n].push(i),this.element.addEventListener(n,i,!1)},le.prototype.unbind=function unbind(n,i){var a=this;this.handlers[n]=this.handlers[n].filter((function(s){return!(!i||s===i)||(a.element.removeEventListener(n,s,!1),!1)}))},le.prototype.unbindAll=function unbindAll(){for(var n in this.handlers)this.unbind(n)},ue.isEmpty.get=function(){var n=this;return Object.keys(this.handlers).every((function(i){return 0===n.handlers[i].length}))},Object.defineProperties(le.prototype,ue);var de=function EventManager(){this.eventElements=[]};function createEvent(n){if("function"==typeof window.CustomEvent)return new CustomEvent(n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,!1,!1,void 0),i}function processScrollDiff(n,i,a,s,c){var l;if(void 0===s&&(s=!0),void 0===c&&(c=!1),"top"===i)l=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==i)throw new Error("A proper axis should be provided");l=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function processScrollDiff$1(n,i,a,s,c){var l=a[0],u=a[1],d=a[2],p=a[3],h=a[4],f=a[5];void 0===s&&(s=!0);void 0===c&&(c=!1);var g=n.element;n.reach[p]=null,g[d]<1&&(n.reach[p]="start");g[d]>n[l]-n[u]-1&&(n.reach[p]="end");i&&(g.dispatchEvent(createEvent("ps-scroll-"+p)),i<0?g.dispatchEvent(createEvent("ps-scroll-"+h)):i>0&&g.dispatchEvent(createEvent("ps-scroll-"+f)),s&&function setScrollingClassInstantly(n,i){addScrollingClass(n,i),removeScrollingClass(n,i)}(n,p));n.reach[p]&&(i||c)&&g.dispatchEvent(createEvent("ps-"+p+"-reach-"+n.reach[p]))}(n,a,l,s,c)}function toInt(n){return parseInt(n,10)||0}de.prototype.eventElement=function eventElement(n){var i=this.eventElements.filter((function(i){return i.element===n}))[0];return i||(i=new le(n),this.eventElements.push(i)),i},de.prototype.bind=function bind(n,i,a){this.eventElement(n).bind(i,a)},de.prototype.unbind=function unbind(n,i,a){var s=this.eventElement(n);s.unbind(i,a),s.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(s),1)},de.prototype.unbindAll=function unbindAll(){this.eventElements.forEach((function(n){return n.unbindAll()})),this.eventElements=[]},de.prototype.once=function once(n,i,a){var s=this.eventElement(n),onceHandler=function(n){s.unbind(i,onceHandler),a(n)};s.bind(i,onceHandler)};var pe={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:"undefined"!=typeof navigator&&navigator.msMaxTouchPoints,isChrome:"undefined"!=typeof navigator&&/Chrome/i.test(navigator&&navigator.userAgent)};function updateGeometry(n){var i=n.element,a=Math.floor(i.scrollTop),s=i.getBoundingClientRect();n.containerWidth=Math.round(s.width),n.containerHeight=Math.round(s.height),n.contentWidth=i.scrollWidth,n.contentHeight=i.scrollHeight,i.contains(n.scrollbarXRail)||(queryChildren(i,ae.rail("x")).forEach((function(n){return remove(n)})),i.appendChild(n.scrollbarXRail)),i.contains(n.scrollbarYRail)||(queryChildren(i,ae.rail("y")).forEach((function(n){return remove(n)})),i.appendChild(n.scrollbarYRail)),!n.settings.suppressScrollX&&n.containerWidth+n.settings.scrollXMarginOffset=n.railXWidth-n.scrollbarXWidth&&(n.scrollbarXLeft=n.railXWidth-n.scrollbarXWidth),n.scrollbarYTop>=n.railYHeight-n.scrollbarYHeight&&(n.scrollbarYTop=n.railYHeight-n.scrollbarYHeight),function updateCss(n,i){var a={width:i.railXWidth},s=Math.floor(n.scrollTop);i.isRtl?a.left=i.negativeScrollAdjustment+n.scrollLeft+i.containerWidth-i.contentWidth:a.left=n.scrollLeft;i.isScrollbarXUsingBottom?a.bottom=i.scrollbarXBottom-s:a.top=i.scrollbarXTop+s;set(i.scrollbarXRail,a);var c={top:s,height:i.railYHeight};i.isScrollbarYUsingRight?i.isRtl?c.right=i.contentWidth-(i.negativeScrollAdjustment+n.scrollLeft)-i.scrollbarYRight-i.scrollbarYOuterWidth-9:c.right=i.scrollbarYRight-n.scrollLeft:i.isRtl?c.left=i.negativeScrollAdjustment+n.scrollLeft+2*i.containerWidth-i.contentWidth-i.scrollbarYLeft-i.scrollbarYOuterWidth:c.left=i.scrollbarYLeft+n.scrollLeft;set(i.scrollbarYRail,c),set(i.scrollbarX,{left:i.scrollbarXLeft,width:i.scrollbarXWidth-i.railBorderXWidth}),set(i.scrollbarY,{top:i.scrollbarYTop,height:i.scrollbarYHeight-i.railBorderYWidth})}(i,n),n.scrollbarXActive?i.classList.add(se.active("x")):(i.classList.remove(se.active("x")),n.scrollbarXWidth=0,n.scrollbarXLeft=0,i.scrollLeft=!0===n.isRtl?n.contentWidth:0),n.scrollbarYActive?i.classList.add(se.active("y")):(i.classList.remove(se.active("y")),n.scrollbarYHeight=0,n.scrollbarYTop=0,i.scrollTop=0)}function getThumbSize(n,i){return n.settings.minScrollbarLength&&(i=Math.max(i,n.settings.minScrollbarLength)),n.settings.maxScrollbarLength&&(i=Math.min(i,n.settings.maxScrollbarLength)),i}function bindMouseScrollHandler(n,i){var a=i[0],s=i[1],c=i[2],l=i[3],u=i[4],d=i[5],p=i[6],h=i[7],f=i[8],g=n.element,m=null,v=null,y=null;function mouseMoveHandler(i){i.touches&&i.touches[0]&&(i[c]=i.touches[0].pageY),g[p]=m+y*(i[c]-v),addScrollingClass(n,h),updateGeometry(n),i.stopPropagation(),i.type.startsWith("touch")&&i.changedTouches.length>1&&i.preventDefault()}function mouseUpHandler(){removeScrollingClass(n,h),n[f].classList.remove(se.clicking),n.event.unbind(n.ownerDocument,"mousemove",mouseMoveHandler)}function bindMoves(i,u){m=g[p],u&&i.touches&&(i[c]=i.touches[0].pageY),v=i[c],y=(n[s]-n[a])/(n[l]-n[d]),u?n.event.bind(n.ownerDocument,"touchmove",mouseMoveHandler):(n.event.bind(n.ownerDocument,"mousemove",mouseMoveHandler),n.event.once(n.ownerDocument,"mouseup",mouseUpHandler),i.preventDefault()),n[f].classList.add(se.clicking),i.stopPropagation()}n.event.bind(n[u],"mousedown",(function(n){bindMoves(n)})),n.event.bind(n[u],"touchstart",(function(n){bindMoves(n,!0)}))}var he={"click-rail":function clickRail(n){n.element,n.event.bind(n.scrollbarY,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarYRail,"mousedown",(function(i){var a=i.pageY-window.pageYOffset-n.scrollbarYRail.getBoundingClientRect().top>n.scrollbarYTop?1:-1;n.element.scrollTop+=a*n.containerHeight,updateGeometry(n),i.stopPropagation()})),n.event.bind(n.scrollbarX,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarXRail,"mousedown",(function(i){var a=i.pageX-window.pageXOffset-n.scrollbarXRail.getBoundingClientRect().left>n.scrollbarXLeft?1:-1;n.element.scrollLeft+=a*n.containerWidth,updateGeometry(n),i.stopPropagation()}))},"drag-thumb":function dragThumb(n){bindMouseScrollHandler(n,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),bindMouseScrollHandler(n,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function keyboard(n){var i=n.element;n.event.bind(n.ownerDocument,"keydown",(function(a){if(!(a.isDefaultPrevented&&a.isDefaultPrevented()||a.defaultPrevented)&&(matches(i,":hover")||matches(n.scrollbarX,":focus")||matches(n.scrollbarY,":focus"))){var s=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(s){if("IFRAME"===s.tagName)s=s.contentDocument.activeElement;else for(;s.shadowRoot;)s=s.shadowRoot.activeElement;if(function isEditable(n){return matches(n,"input,[contenteditable]")||matches(n,"select,[contenteditable]")||matches(n,"textarea,[contenteditable]")||matches(n,"button,[contenteditable]")}(s))return}var c=0,l=0;switch(a.which){case 37:c=a.metaKey?-n.contentWidth:a.altKey?-n.containerWidth:-30;break;case 38:l=a.metaKey?n.contentHeight:a.altKey?n.containerHeight:30;break;case 39:c=a.metaKey?n.contentWidth:a.altKey?n.containerWidth:30;break;case 40:l=a.metaKey?-n.contentHeight:a.altKey?-n.containerHeight:-30;break;case 32:l=a.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:l=n.containerHeight;break;case 34:l=-n.containerHeight;break;case 36:l=n.contentHeight;break;case 35:l=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==c||n.settings.suppressScrollY&&0!==l||(i.scrollTop-=l,i.scrollLeft+=c,updateGeometry(n),function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop);if(0===a){if(!n.scrollbarYActive)return!1;if(0===c&&s>0||c>=n.contentHeight-n.containerHeight&&s<0)return!n.settings.wheelPropagation}var l=i.scrollLeft;if(0===s){if(!n.scrollbarXActive)return!1;if(0===l&&a<0||l>=n.contentWidth-n.containerWidth&&a>0)return!n.settings.wheelPropagation}return!0}(c,l)&&a.preventDefault())}}))},wheel:function wheel(n){var i=n.element;function mousewheelHandler(a){var s=function getDeltaFromEvent(n){var i=n.deltaX,a=-1*n.deltaY;return void 0!==i&&void 0!==a||(i=-1*n.wheelDeltaX/6,a=n.wheelDeltaY/6),n.deltaMode&&1===n.deltaMode&&(i*=10,a*=10),i!=i&&a!=a&&(i=0,a=n.wheelDelta),n.shiftKey?[-a,-i]:[i,a]}(a),c=s[0],l=s[1];if(!function shouldBeConsumedByChild(n,a,s){if(!pe.isWebKit&&i.querySelector("select:focus"))return!0;if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ae.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(a.target,c,l)){var u=!1;n.settings.useBothWheelAxes?n.scrollbarYActive&&!n.scrollbarXActive?(l?i.scrollTop-=l*n.settings.wheelSpeed:i.scrollTop+=c*n.settings.wheelSpeed,u=!0):n.scrollbarXActive&&!n.scrollbarYActive&&(c?i.scrollLeft+=c*n.settings.wheelSpeed:i.scrollLeft-=l*n.settings.wheelSpeed,u=!0):(i.scrollTop-=l*n.settings.wheelSpeed,i.scrollLeft+=c*n.settings.wheelSpeed),updateGeometry(n),u=u||function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop),l=0===i.scrollTop,u=c+i.offsetHeight===i.scrollHeight,d=0===i.scrollLeft,p=i.scrollLeft+i.offsetWidth===i.scrollWidth;return!(Math.abs(s)>Math.abs(a)?l||u:d||p)||!n.settings.wheelPropagation}(c,l),u&&!a.ctrlKey&&(a.stopPropagation(),a.preventDefault())}}void 0!==window.onwheel?n.event.bind(i,"wheel",mousewheelHandler):void 0!==window.onmousewheel&&n.event.bind(i,"mousewheel",mousewheelHandler)},touch:function touch(n){if(pe.supportsTouch||pe.supportsIePointer){var i=n.element,a={},s=0,c={},l=null;pe.supportsTouch?(n.event.bind(i,"touchstart",touchStart),n.event.bind(i,"touchmove",touchMove),n.event.bind(i,"touchend",touchEnd)):pe.supportsIePointer&&(window.PointerEvent?(n.event.bind(i,"pointerdown",touchStart),n.event.bind(i,"pointermove",touchMove),n.event.bind(i,"pointerup",touchEnd)):window.MSPointerEvent&&(n.event.bind(i,"MSPointerDown",touchStart),n.event.bind(i,"MSPointerMove",touchMove),n.event.bind(i,"MSPointerUp",touchEnd)))}function applyTouchMove(a,s){i.scrollTop-=s,i.scrollLeft-=a,updateGeometry(n)}function getTouch(n){return n.targetTouches?n.targetTouches[0]:n}function shouldHandle(n){return(!n.pointerType||"pen"!==n.pointerType||0!==n.buttons)&&(!(!n.targetTouches||1!==n.targetTouches.length)||!(!n.pointerType||"mouse"===n.pointerType||n.pointerType===n.MSPOINTER_TYPE_MOUSE))}function touchStart(n){if(shouldHandle(n)){var i=getTouch(n);a.pageX=i.pageX,a.pageY=i.pageY,s=(new Date).getTime(),null!==l&&clearInterval(l)}}function touchMove(l){if(shouldHandle(l)){var u=getTouch(l),d={pageX:u.pageX,pageY:u.pageY},p=d.pageX-a.pageX,h=d.pageY-a.pageY;if(function shouldBeConsumedByChild(n,a,s){if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ae.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(l.target,p,h))return;applyTouchMove(p,h),a=d;var f=(new Date).getTime(),g=f-s;g>0&&(c.x=p/g,c.y=h/g,s=f),function shouldPrevent(a,s){var c=Math.floor(i.scrollTop),l=i.scrollLeft,u=Math.abs(a),d=Math.abs(s);if(d>u){if(s<0&&c===n.contentHeight-n.containerHeight||s>0&&0===c)return 0===window.scrollY&&s>0&&pe.isChrome}else if(u>d&&(a<0&&l===n.contentWidth-n.containerWidth||a>0&&0===l))return!0;return!0}(p,h)&&l.preventDefault()}}function touchEnd(){n.settings.swipeEasing&&(clearInterval(l),l=setInterval((function(){n.isInitialized?clearInterval(l):c.x||c.y?Math.abs(c.x)<.01&&Math.abs(c.y)<.01?clearInterval(l):n.element?(applyTouchMove(30*c.x,30*c.y),c.x*=.8,c.y*=.8):clearInterval(l):clearInterval(l)}),10))}}},fe=function PerfectScrollbar(n,i){var a=this;if(void 0===i&&(i={}),"string"==typeof n&&(n=document.querySelector(n)),!n||!n.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");for(var s in this.element=n,n.classList.add(oe),this.settings={handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1},i)this.settings[s]=i[s];this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null;var c,l,focus=function(){return n.classList.add(se.focus)},blur=function(){return n.classList.remove(se.focus)};this.isRtl="rtl"===get(n).direction,!0===this.isRtl&&n.classList.add(ie),this.isNegativeScroll=(l=n.scrollLeft,n.scrollLeft=-1,c=n.scrollLeft<0,n.scrollLeft=l,c),this.negativeScrollAdjustment=this.isNegativeScroll?n.scrollWidth-n.clientWidth:0,this.event=new de,this.ownerDocument=n.ownerDocument||document,this.scrollbarXRail=div(ae.rail("x")),n.appendChild(this.scrollbarXRail),this.scrollbarX=div(ae.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",focus),this.event.bind(this.scrollbarX,"blur",blur),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var u=get(this.scrollbarXRail);this.scrollbarXBottom=parseInt(u.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=toInt(u.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=toInt(u.borderLeftWidth)+toInt(u.borderRightWidth),set(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=toInt(u.marginLeft)+toInt(u.marginRight),set(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=div(ae.rail("y")),n.appendChild(this.scrollbarYRail),this.scrollbarY=div(ae.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",focus),this.event.bind(this.scrollbarY,"blur",blur),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var d=get(this.scrollbarYRail);this.scrollbarYRight=parseInt(d.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=toInt(d.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?function outerWidth(n){var i=get(n);return toInt(i.width)+toInt(i.paddingLeft)+toInt(i.paddingRight)+toInt(i.borderLeftWidth)+toInt(i.borderRightWidth)}(this.scrollbarY):null,this.railBorderYWidth=toInt(d.borderTopWidth)+toInt(d.borderBottomWidth),set(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=toInt(d.marginTop)+toInt(d.marginBottom),set(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:n.scrollLeft<=0?"start":n.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:n.scrollTop<=0?"start":n.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach((function(n){return he[n](a)})),this.lastScrollTop=Math.floor(n.scrollTop),this.lastScrollLeft=n.scrollLeft,this.event.bind(this.element,"scroll",(function(n){return a.onScroll(n)})),updateGeometry(this)};fe.prototype.update=function update(){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,set(this.scrollbarXRail,{display:"block"}),set(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=toInt(get(this.scrollbarXRail).marginLeft)+toInt(get(this.scrollbarXRail).marginRight),this.railYMarginHeight=toInt(get(this.scrollbarYRail).marginTop)+toInt(get(this.scrollbarYRail).marginBottom),set(this.scrollbarXRail,{display:"none"}),set(this.scrollbarYRail,{display:"none"}),updateGeometry(this),processScrollDiff(this,"top",0,!1,!0),processScrollDiff(this,"left",0,!1,!0),set(this.scrollbarXRail,{display:""}),set(this.scrollbarYRail,{display:""}))},fe.prototype.onScroll=function onScroll(n){this.isAlive&&(updateGeometry(this),processScrollDiff(this,"top",this.element.scrollTop-this.lastScrollTop),processScrollDiff(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)},fe.prototype.destroy=function destroy(){this.isAlive&&(this.event.unbindAll(),remove(this.scrollbarX),remove(this.scrollbarY),remove(this.scrollbarXRail),remove(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)},fe.prototype.removePsClasses=function removePsClasses(){this.element.className=this.element.className.split(" ").filter((function(n){return!n.match(/^ps([-_].+|)$/)})).join(" ")};var ge=function select(n){var i;if("SELECT"===n.nodeName)n.focus(),i=n.value;else if("INPUT"===n.nodeName||"TEXTAREA"===n.nodeName){var a=n.hasAttribute("readonly");a||n.setAttribute("readonly",""),n.select(),n.setSelectionRange(0,n.value.length),a||n.removeAttribute("readonly"),i=n.value}else{n.hasAttribute("contenteditable")&&n.focus();var s=window.getSelection(),c=document.createRange();c.selectNodeContents(n),s.removeAllRanges(),s.addRange(c),i=s.toString()}return i},me=createCommonjsModule((function(n,i){!function(n,i){var a=_interopRequireDefault(i);function _interopRequireDefault(n){return n&&n.__esModule?n:{default:n}}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var c=function(){function defineProperties(n,i){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=n.action,this.container=n.container,this.emitter=n.emitter,this.target=n.target,this.text=n.text,this.trigger=n.trigger,this.selectedText=""}},{key:"initSelection",value:function initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function selectFake(){var n=this,i="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return n.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[i?"right":"left"]="-9999px";var s=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=s+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function selectTarget(){this.selectedText=(0,a.default)(this.target),this.copyText()}},{key:"copyText",value:function copyText(){var n=void 0;try{n=document.execCommand(this.action)}catch(i){n=!1}this.handleResult(n)}},{key:"handleResult",value:function handleResult(n){this.emitter.emit(n?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function destroy(){this.removeFake()}},{key:"action",set:function set(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=n,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function get(){return this._action}},{key:"target",set:function set(n){if(void 0!==n){if(!n||"object"!==(void 0===n?"undefined":s(n))||1!==n.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&n.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(n.hasAttribute("readonly")||n.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=n}},get:function get(){return this._target}}]),ClipboardAction}();n.exports=l}(n,ge)}));function E(){}unwrapExports(me),E.prototype={on:function(n,i,a){var s=this.e||(this.e={});return(s[n]||(s[n]=[])).push({fn:i,ctx:a}),this},once:function(n,i,a){var s=this;function listener(){s.off(n,listener),i.apply(a,arguments)}return listener._=i,this.on(n,listener,a)},emit:function(n){for(var i=[].slice.call(arguments,1),a=((this.e||(this.e={}))[n]||[]).slice(),s=0,c=a.length;s0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof n.action?n.action:this.defaultAction,this.target="function"==typeof n.target?n.target:this.defaultTarget,this.text="function"==typeof n.text?n.text:this.defaultText,this.container="object"===d(n.container)?n.container:document.body}},{key:"listenClick",value:function listenClick(n){var i=this;this.listener=(0,u.default)(n,"click",(function(n){return i.onClick(n)}))}},{key:"onClick",value:function onClick(n){var i=n.delegateTarget||n.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(i),target:this.target(i),text:this.text(i),container:this.container,trigger:i,emitter:this})}},{key:"defaultAction",value:function defaultAction(n){return getAttributeValue("action",n)}},{key:"defaultTarget",value:function defaultTarget(n){var i=getAttributeValue("target",n);if(i)return document.querySelector(i)}},{key:"defaultText",value:function defaultText(n){return getAttributeValue("text",n)}},{key:"destroy",value:function destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function isSupported(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],i="string"==typeof n?[n]:n,a=!!document.queryCommandSupported;return i.forEach((function(n){a=a&&!!document.queryCommandSupported(n)})),a}}]),Clipboard}(l.default);function getAttributeValue(n,i){var a="data-clipboard-"+n;if(i.hasAttribute(a))return i.getAttribute(a)}n.exports=h}(n,me,ve,_e)})),Ce=unwrapExports(Se);function isInShadow(n){for(var i=n&&n.parentNode;i;){if("[object ShadowRoot]"===i.toString())return!0;i=i.parentNode}return!1}function addListeners(n,a){var s=a.elements;s.textElement.addEventListener("click",(function(s){return function showCandidates(n,a,s){var c=s,l=s.elements;if(n.target.id!=="prompter-text".concat(s.randomString)){var u=n.target.id.replace("word-","").replace(s.randomString,""),d=JSON.parse(a.exports[i.Exports.JIIX]).words;if(c.wordToChange=d[u],c.wordToChange.id=u,l.candidatesElement.innerHTML="",c.wordToChange&&c.wordToChange.candidates){l.candidatesElement.style.display="flex",c.wordToChange.candidates.forEach((function(n,i){c.wordToChange.label===n?l.candidatesElement.innerHTML+='').concat(n,""):l.candidatesElement.innerHTML+='').concat(n,"")}));var p=n.target.getBoundingClientRect().left-60;l.candidatesElement.style.top="".concat(48,"px"),l.candidatesElement.style.left="".concat(p,"px"),n.target.parentNode.parentNode.parentNode.insertBefore(l.candidatesElement,n.target.parentNode.parentNode)}}}(s,n,a)})),s.candidatesElement.addEventListener("click",(function(s){return function clickCandidate(n,a,s){var c=s,l=s.elements,u=n.target.innerText;if(u!==c.wordToChange.label&&c.wordToChange.candidates.includes(u)){var d=JSON.parse(a.exports[i.Exports.JIIX]);d.words[c.wordToChange.id].label=u,a.import_(JSON.stringify(d),i.Exports.JIIX)}l.candidatesElement.style.display="none"}(s,n,a)})),s.ellipsisElement.addEventListener("click",(function(n){return function showActions(n,i){var a=i,s=function positionActions(){var i=n.target.offsetLeft-68;a.menuElement.style.left="".concat(i,"px")},c=document.contains(a.menuElement);isInShadow(a.menuElement)||c?"none"===a.menuElement.style.display&&(s(),a.menuElement.style.display="flex"):(a.menuElement.style.display="flex",s(),function insertActions(){a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),n.target.parentNode.insertBefore(a.menuElement,n.target)}())}(n,s)})),s.copyElement.addEventListener("click",(function(){s.menuElement.style.display="none"})),s.convertElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.convert()})),s.deleteElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.clear()}))}function createSmartGuide(n){var i="-"+Math.random().toString(10).substring(2,12),a=function createHTMLElements(n){var i=document.createElement("div");i.id="smartguide"+n,i.classList.add("smartguide");var a=document.createElement("div");a.id="prompter-text"+n,a.classList.add("prompter-text"),a.setAttribute("touch-action","none");var s=document.createElement("div");s.id="prompter-text-container"+n,s.classList.add("prompter-text-container"),s.appendChild(a);var c=document.createElement("div");c.id="ellipsis"+n,c.classList.add("ellipsis"),c.innerHTML="...";var l=document.createElement("div");l.id="tag-icon"+n,l.classList.add("tag-icon"),l.innerHTML="¶";var u=document.createElement("div");u.id="candidates"+n,u.classList.add("candidates");var d=document.createElement("div");d.id="more-menu"+n,d.classList.add("more-menu");var p=document.createElement("button");p.classList.add("options-label-button"),p.id="convert"+n,p.innerHTML="Convert";var h=document.createElement("button");h.classList.add("options-label-button"),h.id="copy"+n,h.innerHTML="Copy";var f=document.createElement("button");return f.classList.add("options-label-button"),f.id="delete"+n,f.innerHTML="Delete",{smartGuideElement:i,textElement:a,textContainer:s,candidatesElement:u,menuElement:d,tagElement:l,ellipsisElement:c,convertElement:p,copyElement:h,deleteElement:f}}(i);new Ce(a.copyElement);var s={editor:n,wordToChange:"",lastWord:"",previousLabelExport:" ",perfectScrollbar:new fe(a.textContainer,{suppressScrollY:!0,scrollXMarginOffset:1}),elements:a,smartGuideTimeOutId:0,randomString:i};return addListeners(n,s),n.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable&&function callFadeOutObserver(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4,i=arguments.length>1?arguments[1]:void 0,a=i,s=i.elements;new MutationObserver((function(i){i.forEach((function(){a.smartGuideTimeOutId&&clearTimeout(a.smartGuideTimeOutId),"none"===s.candidatesElement.style.display&&"none"===s.menuElement.style.display?a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n):document.contains(s.candidatesElement)||document.contains(s.menuElement)||(a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n))}))})).observe(s.smartGuideElement,{childList:!0,subtree:!0,attributes:!0})}(n.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration,s),s}function resize$2(n){var i=n,a=n.elements,s=3.779527559*i.editor.configuration.recognitionParams.iink.text.margin.left,c=i.editor.domElement.clientWidth-s-a.tagElement.offsetWidth-35-s;a.textContainer.style.width="".concat(c,"px"),a.textContainer.style.maxWidth="".concat(c,"px"),s=a.tagElement.offsetWidth,s+=c,a.ellipsisElement.style.left="".concat(s,"px"),a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}function launchSmartGuide(n,a){var s=n,c=n.elements,l=document.contains(c.smartGuideElement);isInShadow(c.smartGuideElement)||l||function insertSmartGuide(n){var i=n,a=n.elements,s=3.779527559,c=i.editor.configuration.recognitionParams.iink.text.margin.top*s,l=i.editor.configuration.recognitionParams.iink.text.margin.left*s;!function insertSmartGuideElement(n,s){a.smartGuideElement.style.top="".concat(s,"px"),a.smartGuideElement.style.left="".concat(n,"px"),a.smartGuideElement.style.visibility="hidden",i.editor.domElement.insertBefore(a.smartGuideElement,i.editor.loader)}(l,c-45.354330708),function insertTag(){a.smartGuideElement.appendChild(a.tagElement)}();var u=i.editor.domElement.clientWidth-l-a.tagElement.offsetWidth-35-l;(function insertTextContainer(n,i){a.textContainer.style.left="".concat(n,"px"),a.textContainer.style.width="".concat(i,"px"),a.textContainer.style.maxWidth="".concat(i,"px"),a.smartGuideElement.appendChild(a.textContainer)})(l=a.tagElement.offsetWidth,u),function insertEllipsis(n){a.ellipsisElement.style.left="".concat(n,"px"),a.smartGuideElement.appendChild(a.ellipsisElement)}(l+=u),a.menuElement.style.display="none",a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),a.smartGuideElement.appendChild(a.menuElement),a.candidatesElement.style.display="none",a.smartGuideElement.appendChild(a.candidatesElement),a.smartGuideElement.style.height="48px",a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}(n);var u=function createWordSpan(i,a,s){var c=document.createElement("span");return c.id="word-".concat(a).concat(n.randomString),i?c.innerHTML=" ":c.textContent=s.label,c};if(a&&JSON.parse(a[i.Exports.JIIX]).words.length>0){if(c.smartGuideElement.classList.add("smartguide-in"),c.smartGuideElement.classList.remove("smartguide-out"),c.candidatesElement.style.display="none",c.menuElement.style.display="none",s.previousLabelExport&&s.previousLabelExport!==JSON.parse(a[i.Exports.JIIX]).label){var d=JSON.parse(a[i.Exports.JIIX]).words;!function populatePrompter(n){c.textElement.innerHTML="";var i=document.createDocumentFragment();n.forEach((function(a,l){if(" "===a.label||a.label.includes("\n"))i.appendChild(u(!0,l));else if(l!==n.length-1)i.appendChild(u(!1,l,a));else{c.textElement.appendChild(i),s.perfectScrollbar.update(),""===s.lastWord&&(s.lastWord=a);var d=u(!1,l,a);s.lastWord.candidates!==a.candidates&&s.lastWord.label!==a.label?(d.classList.add("added-word"),c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft,s.lastWord=a):(c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft)}}))}(d),function addAnimationToModifiedWord(l){if(s.tempWords&&s.tempWords.length===l.length){var u=l.map((function(n){return n.label})),d=s.tempWords.map((function(n){return n.label})),p=u.indexOf(u.filter((function(n){return-1===d.indexOf(n)}))[0]);document.getElementById("word-".concat(p).concat(n.randomString))&&p>-1&&(document.getElementById("word-".concat(p).concat(n.randomString)).classList.add("modified-word"),c.textContainer.scrollLeft=document.getElementById("word-".concat(p).concat(n.randomString)).offsetLeft-10)}s.tempWords=JSON.parse(a[i.Exports.JIIX]).words}(d)}s.previousLabelExport=JSON.parse(a[i.Exports.JIIX]).label,c.copyElement.setAttribute("data-clipboard-text",JSON.parse(a[i.Exports.JIIX]).label)}else c.smartGuideElement.classList.add("smartguide-out"),c.smartGuideElement.classList.remove("smartguide-in");return s}var ke=unwrapExports(createCommonjsModule((function(n){n.exports=function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")},n.exports.default=n.exports,n.exports.__esModule=!0}))),Pe=unwrapExports(createCommonjsModule((function(n){function _defineProperties(n,i){for(var a=0;a0,i.canRedo=n.currentPosition1&&void 0!==arguments[1])||arguments[1],a=n.stack[n.currentPosition],s=arguments.length,c=new Array(s>2?s-2:0),l=2;l-1)n.stack.splice(s,1,cloneModel(c)),u.debug("model updated",c);else{var d=n;d.currentPosition+=1,d.stack=d.stack.slice(0,d.currentPosition),d.stack.push(cloneModel(c)),d.stack.length>d.maxSize&&(d.stack.shift(),d.currentPosition--),u.debug("model pushed",c),l.push(i.EventType.CHANGED)}return updateUndoRedoState(n),u.debug("undo/redo stack updated",n),getModel.apply(void 0,[n,!1].concat(l))},undo:function undo$1(n,a){var s=n;return s.currentPosition>0&&(s.currentPosition-=1,updateUndoRedoState(n),u.debug("undo index",s.currentPosition)),getModel(n,!0,i.EventType.CHANGED,i.EventType.EXPORTED)},redo:function redo$1(n,a){var s=n;return s.currentPosition1&&void 0!==arguments[1]?arguments[1]:10,a=document,s=a.createElement("canvas");return s.width=Math.abs(n.maxX-n.minX)+2*i,s.style.width="".concat(s.width,"px"),s.height=Math.abs(n.maxY-n.minY)+2*i,s.style.height="".concat(s.height,"px"),s}var Te=Object.freeze({__proto__:null,inkImporter:function inkImporter(n,i,a,s){var c=n;l.debug("inkImporter start importing =>",i);var u=Object.assign({},c.behavior.grabber);u.detach=c.behavior.grabber.detach,c.behavior.grabber={};var d=[];i.forEach((function(n){n.convert?d.push({action:"convert",value:!0}):n.setDelay?d.push({action:"setDelay",value:n.setDelay}):(n.color&&d.push({action:"setColor",value:n.color}),n.X.forEach((function(i,a){var s="move";0===a?s="down":a===n.X.length-1&&(s="up"),d.push({action:s,point:{x:n.X[a],y:n.Y[a]}})})))})),l.debug("Array of actions =>",d),function play(n,i,a){if(i2&&void 0!==arguments[2]?arguments[2]:n.configuration.triggers[i];return!(!n.recognizer||!n.recognizer.getInfo().availableTriggers[i].includes(a))||(l.error("".concat(a," is not a valid trigger for ").concat(i)),!1)}function _addStrokes(){return _addStrokes=Y(V.mark((function _callee4(n,i){var a,s,c=arguments;return V.wrap((function _callee4$(l){for(;;)switch(l.prev=l.next){case 0:if(a=c.length>2&&void 0!==c[2]?c[2]:n.configuration.triggers.addStrokes,!n.recognizer||!n.recognizer.addStrokes){l.next=13;break}return l.next=4,n.recognizerContext.initPromise;case 4:if(!l.sent){l.next=13;break}if(!isTriggerValid(n,"addStrokes",a)){l.next=13;break}return l.next=9,manageResetState(n,i);case 9:if(!(s=l.sent)){l.next=12;break}return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,s));case 12:return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,i));case 13:return l.abrupt("return",Promise.reject(new Error("Cannot addStrokes")));case 14:case"end":return l.stop()}}),_callee4)}))),_addStrokes.apply(this,arguments)}function _launchPointerEvents(){return(_launchPointerEvents=Y(V.mark((function _callee5(n,i,a){return V.wrap((function _callee5$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.pointerEvents){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.pointerEvents(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch pointerEvents")));case 7:case"end":return s.stop()}}),_callee5)})))).apply(this,arguments)}function launchExport(n,i,a){return _launchExport.apply(this,arguments)}function _launchExport(){return _launchExport=Y(V.mark((function _callee6(n,a,s){var c,l,u,d,p,h=arguments;return V.wrap((function _callee6$(f){for(;;)switch(f.prev=f.next){case 0:if(c=h.length>3&&void 0!==h[3]?h[3]:n.configuration.triggers.exportContent,!n.recognizer||!n.recognizer.export_){f.next=20;break}return f.next=4,n.recognizerContext.initPromise;case 4:if(!f.sent){f.next=20;break}if(!isTriggerValid(n,"exportContent",c)){f.next=20;break}return l=n,window.clearTimeout(n.exportTimer),u=c===i.Trigger.QUIET_PERIOD?n.configuration.triggerDelay:0,d=delay(u),l.exportTimer=d.timer,f.next=14,d.promise;case 14:return f.next=16,manageResetState(n,a);case 16:if(!(p=f.sent)){f.next=19;break}return f.abrupt("return",n.recognizer.export_(n.recognizerContext,p,s));case 19:return f.abrupt("return",n.recognizer.export_(n.recognizerContext,a,s));case 20:return f.abrupt("return",Promise.reject(new Error("Cannot launch export")));case 21:case"end":return f.stop()}}),_callee6)}))),_launchExport.apply(this,arguments)}function _launchImport(){return(_launchImport=Y(V.mark((function _callee7(n,i,a){return V.wrap((function _callee7$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.import_){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.import_(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch import")));case 7:case"end":return s.stop()}}),_callee7)})))).apply(this,arguments)}function _launchGetSupportedImportMimeTypes(){return(_launchGetSupportedImportMimeTypes=Y(V.mark((function _callee8(n,i){return V.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.getSupportedImportMimeTypes){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.getSupportedImportMimeTypes(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch getSupportedImportMimeTypes")));case 7:case"end":return a.stop()}}),_callee8)})))).apply(this,arguments)}function launchConvert(n,i,a){return _launchConvert.apply(this,arguments)}function _launchConvert(){return(_launchConvert=Y(V.mark((function _callee9(n,i,a){return V.wrap((function _callee9$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.convert){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.convert(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch convert")));case 7:case"end":return s.stop()}}),_callee9)})))).apply(this,arguments)}function launchConfig(n,i){return _launchConfig.apply(this,arguments)}function _launchConfig(){return(_launchConfig=Y(V.mark((function _callee10(n,i){return V.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.sendConfiguration){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.sendConfiguration(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch config")));case 7:case"end":return a.stop()}}),_callee10)})))).apply(this,arguments)}function _launchResize(){return(_launchResize=Y(V.mark((function _callee11(n,i){var a,s;return V.wrap((function _callee11$(c){for(;;)switch(c.prev=c.next){case 0:if(!n.recognizer||!n.recognizer.resize){c.next=13;break}return c.next=3,n.recognizerContext.initPromise;case 3:if(!c.sent){c.next=13;break}return a=n,window.clearTimeout(n.resizeTimer),s=delay(n.configuration.resizeTriggerDelay),a.resizeTimer=s.timer,resize$2(n.smartGuide),c.next=12,s.promise;case 12:return c.abrupt("return",n.recognizer.resize(n.recognizerContext,i,n.domElement));case 13:return c.abrupt("return",Promise.reject(new Error("Cannot launch resize")));case 14:case"end":return c.stop()}}),_callee11)})))).apply(this,arguments)}function _launchWaitForIdle(){return(_launchWaitForIdle=Y(V.mark((function _callee12(n,i){return V.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.waitForIdle){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.waitForIdle(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch wait for idle")));case 7:case"end":return a.stop()}}),_callee12)})))).apply(this,arguments)}function _launchClose(){return(_launchClose=Y(V.mark((function _callee13(n,i){return V.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.close){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.close(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch close")));case 7:case"end":return a.stop()}}),_callee13)})))).apply(this,arguments)}function setPenStyle$1(n,i){return _setPenStyle.apply(this,arguments)}function _setPenStyle(){return(_setPenStyle=Y(V.mark((function _callee14(n,i){return V.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyle){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyle(n.recognizerContext,i,n.penStyle));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set pentStyle")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee14)})))).apply(this,arguments)}function setPenStyleClasses$1(n,i){return _setPenStyleClasses.apply(this,arguments)}function _setPenStyleClasses(){return(_setPenStyleClasses=Y(V.mark((function _callee15(n,i){return V.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyleClasses){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyleClasses(n.recognizerContext,i,n.penStyleClasses));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set penStyleClasses")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee15)})))).apply(this,arguments)}function setTheme$1(n,i){return _setTheme.apply(this,arguments)}function _setTheme(){return(_setTheme=Y(V.mark((function _callee16(n,i){return V.wrap((function _callee16$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setTheme){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setTheme(n.recognizerContext,i,n.theme));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set theme")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee16)})))).apply(this,arguments)}var Me=function(){function Editor(n,i,a,s,c,u){ke(this,Editor),u=u||"ms-editor";var d=document.createElement("style");d.appendChild(document.createTextNode("")),n.appendChild(d);var p=d.sheet;d.textContent="/*\r\n * Container style\r\n */\r\n.ps {\r\n overflow: hidden !important;\r\n overflow-anchor: none;\r\n -ms-overflow-style: none;\r\n touch-action: auto;\r\n -ms-touch-action: auto;\r\n}\r\n/*\r\n * Scrollbar rail styles\r\n */\r\n.ps__rail-x {\r\n display: none;\r\n opacity: 0;\r\n transition: background-color .2s linear, opacity .2s linear;\r\n -webkit-transition: background-color .2s linear, opacity .2s linear;\r\n height: 15px;\r\n /* there must be 'bottom' or 'top' for ps__rail-x */\r\n bottom: 0px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__rail-y {\r\n display: none;\r\n opacity: 0;\r\n transition: background-color .2s linear, opacity .2s linear;\r\n -webkit-transition: background-color .2s linear, opacity .2s linear;\r\n width: 15px;\r\n /* there must be 'right' or 'left' for ps__rail-y */\r\n right: 0;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps--active-x > .ps__rail-x,\r\n.ps--active-y > .ps__rail-y {\r\n display: block;\r\n background-color: transparent;\r\n}\r\n.ps:hover > .ps__rail-x,\r\n.ps:hover > .ps__rail-y,\r\n.ps--focus > .ps__rail-x,\r\n.ps--focus > .ps__rail-y,\r\n.ps--scrolling-x > .ps__rail-x,\r\n.ps--scrolling-y > .ps__rail-y {\r\n opacity: 0.6;\r\n}\r\n.ps .ps__rail-x:hover,\r\n.ps .ps__rail-y:hover,\r\n.ps .ps__rail-x:focus,\r\n.ps .ps__rail-y:focus,\r\n.ps .ps__rail-x.ps--clicking,\r\n.ps .ps__rail-y.ps--clicking {\r\n background-color: #eee;\r\n opacity: 0.9;\r\n}\r\n/*\r\n * Scrollbar thumb styles\r\n */\r\n.ps__thumb-x {\r\n background-color: #aaa;\r\n border-radius: 6px;\r\n transition: background-color .2s linear, height .2s ease-in-out;\r\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\r\n height: 6px;\r\n /* there must be 'bottom' for ps__thumb-x */\r\n bottom: 2px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__thumb-y {\r\n background-color: #aaa;\r\n border-radius: 6px;\r\n transition: background-color .2s linear, width .2s ease-in-out;\r\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\r\n width: 6px;\r\n /* there must be 'right' for ps__thumb-y */\r\n right: 2px;\r\n /* please don't change 'position' */\r\n position: absolute;\r\n}\r\n.ps__rail-x:hover > .ps__thumb-x,\r\n.ps__rail-x:focus > .ps__thumb-x,\r\n.ps__rail-x.ps--clicking .ps__thumb-x {\r\n background-color: #999;\r\n height: 11px;\r\n}\r\n.ps__rail-y:hover > .ps__thumb-y,\r\n.ps__rail-y:focus > .ps__thumb-y,\r\n.ps__rail-y.ps--clicking .ps__thumb-y {\r\n background-color: #999;\r\n width: 11px;\r\n}\r\n/* MS supports */\r\n@supports (-ms-overflow-style: none) {\r\n .ps {\r\n overflow: auto !important;\r\n }\r\n}\r\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\r\n .ps {\r\n overflow: auto !important;\r\n }\r\n}\r\n.ms-editor {\n position: relative;\n z-index: 20;\n color: #1A9FFF;\n font-family: sans-serif;\n}\r\n.ms-editor.erasing {\n cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEsSURBVDiNrdO7SgNBFMbx/3fmCbQ1tunDIayFBvFSKxbxBfSdBPEBtLIWb3Ebl4R9AQWLkE70CWbHZl1Eg2iSr5vL+c1hhhFTMhwOdyX1gQ2gVU+PgTyldNHtdq+/1+jroCiKtpmdSupNO6ApkgZmdtzpdJ5+QGVZ9qqqugSWfkO+5F3SnrvnDVQURTuE8PgP5DNvkjJ3fzaAEMLJDAjAclVVZwCqL/ZqBqSJme2YpMN5EIAYY9+A9XkhST0DVuaFgJYtAAGoDJgsAJoYkM+rSHqwlNL5Ajq6EMBoNLoBtmbsZuDumwYQYzwCXmdw3oAjAAPIsuxF0kG98GdE0r67PzcQgLvnIYQ14P4PyF39WZuH0rRdZVluxxj7kjaA1Xp6nFLKzezc3W+/13wAItdV6XjME1AAAAAASUVORK5CYII='), auto;\n}\r\n.ms-editor canvas,\n.ms-editor svg {\n z-index: 15;\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n}\r\n.ms-editor canvas.ms-rendering-canvas {\n z-index: 10;\n pointer-events: none;\n background-image: linear-gradient(to right, #F5F6F7 1px, transparent 1px),\n linear-gradient(to bottom, #F5F6F7 1px, transparent 1px);\n background-size: 18px 18px;\n}\r\n.ms-editor svg {\n z-index: 10;\n pointer-events: none;\n}\r\n.ms-editor svg[data-layer=\"BACKGROUND\"] {\n z-index: 9;\n}\r\n.ms-editor .loader {\n z-index: 30;\n position: absolute;\n width: 120px;\n height: 120px;\n top: calc(50% - 60px);\n left: calc(50% - 60px);\n border: 16px solid #F5F6F7;\n border-radius: 50%;\n border-top-color: #1A9FFF;\n -webkit-animation: spin 2s linear infinite;\n animation: spin 2s linear infinite;\n}\r\n.ms-editor .error-msg {\n z-index: 25;\n position: absolute;\n width: 200px;\n height: 200px;\n top: calc(50% - 100px);\n left: calc(50% - 100px);\n font-size: 16px;\n text-align: center;\n word-wrap: break-word;\n}\r\n.ms-editor .error-msg::before {\n content: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCA3Ni41IDYxMiA0NTkiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiPgogICAgPHBhdGggZmlsbD0iIzFBOUZGRiIgZD0iTTQ5NC43LDIyOS41Yy0xNy44NTEtODYuNy05NC4zNTEtMTUzLTE4OC43LTE1M2MtMzguMjUsMC03My45NSwxMC4yLTEwMiwzMC42bDM4LjI1LDM4LjI1IGMxNy44NS0xMi43NSw0MC44LTE3Ljg1LDYzLjc1LTE3Ljg1Yzc2LjUsMCwxNDAuMjUsNjMuNzUsMTQwLjI1LDE0MC4yNXYxMi43NWgzOC4yNWM0My4zNSwwLDc2LjUsMzMuMTUsNzYuNSw3Ni41IGMwLDI4LjA1LTE1LjMsNTMuNTUtNDAuOCw2Ni4zbDM4LjI1LDM4LjI1QzU5MS42LDQzOC42LDYxMiw0MDAuMzUsNjEyLDM1N0M2MTIsMjkwLjcsNTU4LjQ1LDIzNC42LDQ5NC43LDIyOS41eiBNNzYuNSwxMDkuNjUgbDcxLjQsNjguODVDNjYuMywxODMuNiwwLDI0OS45LDAsMzMxLjVjMCw4NC4xNSw2OC44NSwxNTMsMTUzLDE1M2gyOTguMzVsNTEsNTFsMzMuMTUtMzMuMTVMMTA5LjY1LDc2LjVMNzYuNSwxMDkuNjV6IE0xOTYuMzUsMjI5LjVsMjA0LDIwNEgxNTNjLTU2LjEsMC0xMDItNDUuOS0xMDItMTAyYzAtNTYuMSw0NS45LTEwMiwxMDItMTAySDE5Ni4zNXoiIC8+Cjwvc3ZnPgo=);\n}\r\n.ms-editor .smartguide {\n position: absolute;\n z-index: 40;\n font-size: 16px;\n}\r\n.ms-editor .smartguide.smartguide-in {\n visibility: visible !important;\n transition: opacity 0.5s;\n opacity: 1;\n}\r\n.ms-editor .smartguide.smartguide-out {\n transition: opacity 1s, visibility 1s;\n visibility: hidden !important;\n opacity: 0;\n}\r\n.ms-editor .smartguide .tag-icon {\n padding: 0 18px;\n border: 1px solid #959DA6;\n font-weight: bold;\n font-size: large;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 48px;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n}\r\n.ms-editor .smartguide .ellipsis {\n cursor: pointer;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 38px;\n padding: 0 8px;\n font-weight: bold;\n font-size: x-large;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .ellipsis:active {\n background-color: #e0e0e0;\n}\r\n.ms-editor .smartguide .prompter-text-container {\n background-color: rgba(255, 255, 255, 0.9);\n height: 48px;\n line-height: 48px;\n overflow: hidden;\n white-space: nowrap;\n display: block;\n text-align: left;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 30;\n color: #bfbfbf;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .prompter-text-container > div > span {\n cursor: pointer;\n display: inline-block;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text {\n margin-left: 12px;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text .added-word {\n animation: 0.1s linear word-added,\n 3s ease-in-out color-input;\n}\r\n.ms-editor .smartguide .prompter-text-container .prompter-text .modified-word {\n animation: 0.1s linear word-modified,\n 3s ease-in-out color-input;\n}\r\n.ms-editor .smartguide .candidates {\n color: black;\n flex-direction: column;\n text-align: center;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n box-shadow: 2px 2px 12px #BDBDBD, -2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n z-index: 100;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .candidates > span {\n cursor: pointer;\n padding: 2px 20px;\n}\r\n.ms-editor .smartguide .candidates > span:hover {\n background-color: #EEEEEE;\n}\r\n.ms-editor .smartguide .candidates > span:active {\n background-color: #E0E0E0;\n}\r\n.ms-editor .smartguide .candidates .selected-word {\n font-weight: bold;\n background-color: #E0E0E0;\n}\r\n.ms-editor .smartguide .more-menu {\n flex-direction: column;\n margin-right: 12px;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n z-index: 100;\n box-shadow: 2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button {\n color: black;\n font-size: 16px;\n cursor: pointer;\n box-sizing: border-box;\n background: transparent;\n border: none;\n padding: 0 24px;\n margin: 0;\n height: 40px;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button:hover {\n background-color: #EEEEEE;\n}\r\n.ms-editor .smartguide .more-menu .options-label-button:active {\n background-color: #E0E0E0;\n}\r\n.ms-editor .ps__rail-x {\n top: 32px !important;\n}\r\n/** Stroke **/\r\n.ms-editor .removed-stroke {\n opacity: 0;\n transition: opacity 0.1s ease-in-out;\n}\r\n.ms-editor .added-stroke {\n animation: 0.2s opacity-appear;\n}\r\n@keyframes color-input {\n 0% {\n color: black;\n }\n 100% {\n color: #bfbfbf;\n }\n}\r\n@keyframes word-added {\n 0% {\n transform: translate(5px, 0);\n }\n 100% {\n transform: none;\n }\n}\r\n@keyframes word-modified {\n 0% {\n transform: translate(0, 5px);\n }\n 100% {\n transform: none;\n }\n}\r\n@keyframes opacity-appear {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity : 1;\n }\n}\r\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\r\n@-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n }\n}\n",this.sheet=p,this.domElement=n,this.domElement.classList.add(u),this.loader=document.createElement("div"),this.loader.classList.add("loader"),this.loader=this.domElement.appendChild(this.loader),this.error=document.createElement("div"),this.error.classList.add("error-msg"),this.error=this.domElement.appendChild(this.error),this.exportTimer=void 0,this.resizeTimer=void 0,this.notifyTimer=void 0,this.innerBehaviors=function overrideDefaultBehaviors(n){if(n){var i={grabber:n.grabber||He.grabber,rendererList:n.rendererList||He.rendererList,strokerList:n.strokerList||He.strokerList,recognizerList:n.recognizerList||He.recognizerList,events:n.events||He.events,getBehaviorFromConfiguration:n.getBehaviorFromConfiguration||He.getBehaviorFromConfiguration};return l.debug("Override default behaviors",i),i}return He}(c),this.configuration=i,this.localTheme="",this.theme=s,this.penStyle=a,this.penStyleClasses="",this.isErasing=!1,this.domElement.editor=this}var n,a;return Pe(Editor,[{key:"configuration",get:function get(){return this.innerConfiguration},set:function set(n){this.loader.style.display="initial",this.error.style.display="none",this.innerConfiguration=function overrideDefaultConfiguration(n){var i,a=n;return a&&a.recognitionParams.server&&a.recognitionParams.server.useWindowLocation?(a.recognitionParams.server.scheme=window.location.protocol.slice(0,-1),a.recognitionParams.server.host=window.location.host,i=g({},m,void 0===a?{}:a)):i=g({},m,void 0===n?{}:n),l.debug("Override default configuration",i),i}(n),this.behavior=this.behaviors.getBehaviorFromConfiguration(this.behaviors,this.innerConfiguration),this.smartGuide?function reset$1(n){var i=n.elements;i.candidatesElement.innerHTML="",i.smartGuideElement.classList.add("smartguide-out"),i.smartGuideElement.classList.remove("smartguide-in")}(this.smartGuide):this.smartGuide=createSmartGuide(this)}},{key:"penStyle",get:function get(){return this.innerPenStyle},set:function set(n){this.innerPenStyle=function overrideDefaultPenStyle(n){var i=g({},b,void 0===n?{}:n);return l.debug("Override default pen style",i),i}(n),this.localPenStyle=this.innerPenStyle,setPenStyle$1(this,this.model)}},{key:"penStyleClasses",get:function get(){return this.innerPenStyleClasses},set:function set(n){this.innerPenStyleClasses=n,this.localPenStyle=this.theme[".".concat(this.innerPenStyleClasses)],setPenStyleClasses$1(this,this.model)}},{key:"theme",get:function get(){return this.innerTheme},set:function set(n){this.innerTheme=function overrideDefaultTheme(n){var i=g({},w,void 0===n?{}:n);return l.debug("Override default theme",i),i}(n),setTheme$1(this,this.model)}},{key:"behaviors",get:function get(){return this.innerBehaviors}},{key:"behavior",get:function get(){return this.innerBehavior},set:function set(n){n&&(this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerBehavior=n,this.renderer=this.innerBehavior.renderer,this.recognizer=this.innerBehavior.recognizer,this.grabberContext=this.grabber.attach(this.domElement,this))}},{key:"recognizer",get:function get(){return this.innerRecognizer},set:function set(n){var i=this;this.undoRedoContext=function createUndoRedoContext(n){return{stack:[],currentPosition:-1,maxSize:n.undoRedoMaxStackSize,canUndo:!1,canRedo:!1}}(this.configuration),this.undoRedoManager=Ie;var a=function initialize(a,s){i.innerRecognizer=n,i.innerRecognizer&&(i.recognizerContext=createEmptyRecognizerContext(i),i.innerRecognizer.undo&&i.innerRecognizer.redo&&i.innerRecognizer.clear&&(i.undoRedoContext=i.recognizerContext,i.undoRedoManager=i.innerRecognizer),i.innerRecognizer.init(i.recognizerContext,a).then((function(n){l.info("Recognizer initialized !"),s&&(setTheme$1(i,i.model),setPenStyle$1(i,i.model),setPenStyleClasses$1(i,i.model)),i.loader.style.display="none"})).catch((function(n){return handleError(i,n)})))};n&&(this.innerRecognizer?this.innerRecognizer.close(this.recognizerContext,this.model).then((function(n){l.info("Recognizer closed"),handleSuccess(i,n),a(clearModel(n),!0)})).catch((function(n){return handleError(i,n)})):(this.model=createModel(this.configuration),a(this.model,!1)))}},{key:"renderer",get:function get(){return this.innerRenderer},set:function set(n){n&&(this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext),this.innerRenderer=n,this.innerRenderer&&(this.rendererContext=this.innerRenderer.attach(this.domElement,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth)))}},{key:"grabber",get:function get(){return this.behavior?this.behavior.grabber:void 0}},{key:"stroker",get:function get(){return this.behavior?this.behavior.stroker:void 0}},{key:"emit",get:function get(){return this.behavior?this.behavior.events:void 0}},{key:"png",get:function get(){return function getImage(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(n.rawStrokes.length>0){var s=getBorderCoordinates(n),c=createCanvas(s,a),l=createCanvas(s,a),u={renderingCanvas:l,renderingCanvasContext:l.getContext("2d"),capturingCanvas:c,capturingCanvasContext:c.getContext("2d")};return u.renderingCanvasContext.translate(-s.minX+a,-s.minY+a),drawModel$1(u,n,i),u.renderingCanvas.toDataURL("image/png")}return null}(this.model,this.stroker)}},{key:"initialized",get:function get(){return!!this.recognizerContext&&this.recognizerContext.initialized}},{key:"enableEraser",value:function enableEraser(){this.isErasing=!0,this.domElement.classList.add("erasing")}},{key:"disableEraser",value:function disableEraser(){document.body.style.cursor="initial",this.isErasing=!1,this.domElement.classList.remove("erasing")}},{key:"pointerDown",value:function pointerDown(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pen",a=arguments.length>2?arguments[2]:void 0;l.trace("Pointer down",n),window.clearTimeout(this.notifyTimer),window.clearTimeout(this.exportTimer),this.model=initPendingStroke(this.model,n,Object.assign({pointerType:i,pointerId:a},this.theme.ink,this.localPenStyle)),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerMove",value:function pointerMove(n){l.trace("Pointer move",n),this.model=appendToPendingStroke(this.model,n),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerUp",value:function pointerUp(n){l.trace("Pointer up",n),this.model=endPendingStroke(this.model,n,this.penStyle),this.isErasing||this.renderer.drawModel(this.rendererContext,this.model,this.stroker),this.recognizer.addStrokes?function addStrokes$1(n,i){return _addStrokes.apply(this,arguments)}(this,this.model):handleSuccess(this,this.model)}},{key:"removeStroke",value:function removeStroke(n){this.model.strokeGroups.forEach((function(i){var a=i.strokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==a&&i.strokes.splice(a,1)}));var i=this.model.rawStrokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==i&&this.model.rawStrokes.splice(i,1),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model),"DEMAND"!==this.configuration.triggers.exportContent&&launchExport(this,this.model)}},{key:"reDraw",value:function reDraw(n,i){var a=this;n.forEach((function(n){addStroke(a.model,n)})),i.forEach((function(n){n.strokes.forEach((function(i){addStrokeToGroup(a.model,i,n.penStyle)}))})),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model)}},{key:"idle",get:function get(){return this.recognizerContext.idle}},{key:"waitForIdle",value:function waitForIdle(){return emitEvents(this,void 0,i.EventType.IDLE),function launchWaitForIdle(n,i){return _launchWaitForIdle.apply(this,arguments)}(this,this.model)}},{key:"canUndo",get:function get(){return this.undoRedoContext.canUndo}},{key:"undo",value:(a=Y(V.mark((function _callee(){var n,a,s,c=this;return V.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return l.debug("Undo current model",this.model),emitEvents(this,void 0,i.EventType.UNDO),u.next=4,this.undoRedoManager.undo(this.undoRedoContext,this.model).catch((function(n){return handleError(c,n)}));case 4:return n=u.sent,a=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,a].concat(L(s))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee,this)}))),function undo(){return a.apply(this,arguments)})},{key:"canRedo",get:function get(){return this.undoRedoContext.canRedo}},{key:"redo",value:(n=Y(V.mark((function _callee2(){var n,a,s,c=this;return V.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return l.debug("Redo current model",this.model),emitEvents(this,void 0,i.EventType.REDO),u.next=4,this.undoRedoManager.redo(this.undoRedoContext,this.model).catch((function(n){return handleError(c,n)}));case 4:return n=u.sent,a=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,a].concat(L(s))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee2,this)}))),function redo(){return n.apply(this,arguments)})},{key:"isEmpty",get:function get(){return this.recognizerContext.isEmpty}},{key:"canClear",get:function get(){return!this.isEmpty}},{key:"clear",value:function(){var n=Y(V.mark((function _callee3(){var n,a,s,c=this;return V.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:if(!this.canClear){u.next=10;break}return l.debug("Clear current model",this.model),emitEvents(this,void 0,i.EventType.CLEAR),u.next=5,this.recognizer.clear(this.recognizerContext,this.model).catch((function(n){return handleError(c,n)}));case 5:return n=u.sent,a=n.res,s=n.events,handleSuccess.apply(void 0,[this,a].concat(L(s))),u.abrupt("return",a);case 10:return u.abrupt("return",Promise.reject(new Error("Cannot launch clear")));case 11:case"end":return u.stop()}}),_callee3,this)})));return function clear(){return n.apply(this,arguments)}}()},{key:"canConvert",get:function get(){return!!(this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.convert)}},{key:"convert",value:function convert(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"DIGITAL_EDIT";return this.canConvert?(emitEvents(this,void 0,i.EventType.CONVERT),launchConvert(this,this.model,n)):Promise.reject(new Error("Cannot launch convert"))}},{key:"setGuides",value:function setGuides(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.configuration.recognitionParams.iink.text.guides.enable=n,launchConfig(this,this.model)}},{key:"possibleUndoCount",get:function get(){return this.recognizerContext.possibleUndoCount}},{key:"undoStackIndex",get:function get(){return this.recognizerContext.undoStackIndex}},{key:"canExport",get:function get(){return this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.getInfo().availableTriggers.exportContent.includes(i.Trigger.DEMAND)}},{key:"export_",value:function export_(n){return this.canExport?(emitEvents(this,void 0,i.EventType.EXPORT),launchExport(this,this.model,n,i.Trigger.DEMAND)):Promise.reject(new Error("Cannot launch export"))}},{key:"import_",value:function import_(n,a){return emitEvents(this,void 0,i.EventType.IMPORT),function launchImport(n,i,a){return _launchImport.apply(this,arguments)}(this,this.model,n instanceof Blob?n:new Blob([n],{type:a}))}},{key:"getSupportedImportMimeTypes",value:function getSupportedImportMimeTypes(){return function launchGetSupportedImportMimeTypes(n,i){return _launchGetSupportedImportMimeTypes.apply(this,arguments)}(this,this.model)}},{key:"pointerEvents",value:function pointerEvents(n){return function launchPointerEvents(n,i,a){return _launchPointerEvents.apply(this,arguments)}(this,this.model,n)}},{key:"exports",get:function get(){return this.model?this.model.exports:void 0}},{key:"supportedImportMimeTypes",get:function get(){return this.recognizerContext.supportedImportMimeTypes}},{key:"resize",value:function resize(){return l.debug("Resizing editor"),this.renderer.resize(this.rendererContext,this.model,this.stroker,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth),function launchResize(n,i){return _launchResize.apply(this,arguments)}(this,this.model)}},{key:"unload",value:function unload(){this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext)}},{key:"close",value:function close(){return this.configuration.recognitionParams.protocol===i.Protocol.WEBSOCKET?function launchClose(n,i){return _launchClose.apply(this,arguments)}(this,this.model):null}},{key:"forceChange",value:function forceChange(){emitEvents(this,void 0,i.EventType.CHANGED)}},{key:"eastereggs",get:function get(){return Te}}]),Editor}();function emitEvents(n,a){for(var s=n,c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?l-2:0),d=2;d=n.model.lastPositions.lastReceivedPosition?(s.model=mergeModels(s.model,c),(needRedraw(s.model)||u.includes(i.EventType.RENDERED))&&n.renderer.drawModel(n.rendererContext,s.model,n.stroker)):(s.model=c,n.renderer.drawModel(n.rendererContext,s.model,n.stroker)),emitEvents.apply(void 0,[n,void 0].concat(u))),"TEXT"===n.configuration.recognitionParams.type&&"REST"!==n.configuration.recognitionParams.protocol&&n.configuration.recognitionParams.iink.text.mimeTypes.includes(i.Exports.JIIX)&&n.configuration.recognitionParams.iink.text.smartGuide&&(s.smartGuide=launchSmartGuide(n.smartGuide,c.exports)),extractPendingStrokes(a).length>0&&!n.recognizer.addStrokes&&n.configuration.triggers.exportContent!==i.Trigger.DEMAND&&launchExport(n,a)}function handleError(n,a){var s=n;if("close"!==a.type&&h.error("Error while firing the recognition",a.stack||a),"Invalid application key."===a.message||"Invalid HMAC"===a.message||a.error&&a.error.result&&a.error.result.error&&("InvalidApplicationKeyException"===a.error.result.error||"InvalidHMACSignatureException"===a.error.result.error)||a.code&&"access.not.granted"===a.code?s.error.innerText=i.Error.WRONG_CREDENTIALS:a.code&&"no.activity"===a.code?s.error.innerText=i.Error.NO_ACTIVITY:"Session is too old. Max Session Duration Reached."===a.message||a.code&&"session.too.old"===a.code?s.error.innerText=i.Error.TOO_OLD:1006!==a.code&&1e3!==a.code||"none"!==s.error.style.display||(s.error.innerText=i.Error.NOT_REACHABLE),s.error.innerText!==i.Error.TOO_OLD&&"CLOSE_RECOGNIZER"!==a.reason||!canReconnect(n.recognizerContext)){s.loader.style.display="none",s.error.style.display="initial";for(var c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?a-2:0),c=2;c4&&void 0!==arguments[4]?arguments[4]:"",l=arguments.length>5?arguments[5]:void 0,u=i.editor.configuration;return post(i,"".concat(u.recognitionParams.server.scheme,"://").concat(u.recognitionParams.server.host).concat(n),s(i,a,c),"V4",l).then((function(n){h.debug("iinkRestRecognizer success",n);var a=i.lastPositions;a.lastReceivedPosition=a.lastSentPosition;var s=updateRecognitionPositions(i,a);return n.instanceId&&(s.instanceId=n.instanceId),n}))}function buildData(n,i,a){var s,c=n.editor.configuration;"TEXT"===c.recognitionParams.type?s=function buildTextConf(n){return{text:n.recognitionParams.iink.text,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"MATH"===c.recognitionParams.type?s=function buildMathConf(n){return{math:n.recognitionParams.iink.math,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"DIAGRAM"===c.recognitionParams.type?s=function buildDiagramConf(n){return{diagram:n.recognitionParams.iink.diagram,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"Raw Content"===c.recognitionParams.type&&(s=function buildRawContentConf(n){return{"raw-content":{recognition:n.recognitionParams.iink["raw-content"].recognition},lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c));var l=[];i.strokeGroups.forEach((function(n){var i={penStyle:"{}"===JSON.stringify(n.penStyle)?null:toCSS$1(n.penStyle),strokes:n.strokes.map((function(n){return function toJSON(n){return{x:n.x,y:n.y,t:n.t,pointerType:n.pointerType}}(n)}))};l.push(i)}));var u={configuration:s,xDPI:96,yDPI:96,contentType:"Raw Content"===c.recognitionParams.type?"Raw Content":c.recognitionParams.type.charAt(0).toUpperCase()+c.recognitionParams.type.slice(1).toLowerCase(),theme:toCSS(n.editor.theme),strokeGroups:l};return n.editor.domElement&&(u.height=n.editor.domElement.clientHeight,u.width=n.editor.domElement.clientWidth),a&&(u.conversionState="DIGITAL_EDIT"),updateModelSentPosition(i),u}function extractExports(n,i,a){var s={};return s[i]=a,s}function resultCallback(n,a,s,c,l){h.debug("iinkRestRecognizer result callback",a);var u=updateModelReceivedPosition(a);u.rawResults.exports=c,u.exports?Object.assign(u.exports,extractExports(0,l,c)):u.exports=extractExports(0,l,c),h.debug("iinkRestRecognizer model updated",u),n.editor.undoRedoManager&&handleSuccess(n.editor,u,i.EventType.EXPORTED,i.EventType.IDLE)}function callPostMessage(n,i,a){var s=n.editor.configuration;return postMessage("/api/v4.0/iink/batch",n,i,buildData,s.restConversionState,a).then((function(s){return resultCallback(n,i,0,s,a),i})).catch((function(i){return handleError(n.editor,i),i}))}function export_$1(n,i,a){var s=n.editor.configuration;return a?Promise.all(a.map((function(a){return callPostMessage(n,i,a)}))):"TEXT"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.text.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"DIAGRAM"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.diagram.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"MATH"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.math.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"Raw Content"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink["raw-content"].mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):Promise.reject(new Error("Export failed"))}var Le=Object.freeze({__proto__:null,iinkRestConfiguration:Re,getInfo:function getInfo$1(){return Re},postMessage:postMessage,export_:export_$1,convert:function convert$1(n,i){var a=n.editor.configuration;postMessage("/api/v4.0/iink/batch",n,i,buildData,"DIGITAL_EDIT").then((function(n){return resultCallback(i,a)})).catch((function(i){return handleError(n.editor,i)}))},resize:function resize$1(n,i){i.strokeGroups.length&&export_$1(n,i)},init:function init$2(n,a){var s=resetModelPositions(a);h.debug("Updated model",s);var c=updateRecognitionPositions(n,s.lastPositions);return c.initPromise=Promise.resolve(s),c.initPromise.then((function(n){return c.initialized=!0,h.debug("Updated recognizer context",c),handleSuccess(c.editor,n,i.EventType.LOADED),n}))},close:function close$2(n,i){var a=n;return a.initialized=!1,delete a.instanceId,Promise.resolve(i)},clear:clear$2,reset:function reset(n,i){var a=resetModelPositions(i);h.debug("Updated model",a);var s=updateRecognitionPositions(n,a.lastPositions);return delete s.instanceId,h.debug("Updated recognizer context",s),Promise.resolve({res:a})}}),Ae=createCommonjsModule((function(n){n.exports=function _arrayWithHoles(n){if(Array.isArray(n))return n},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(Ae);var De=createCommonjsModule((function(n){n.exports=function _iterableToArrayLimit(n,i){var a=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=a){var s,c,l=[],u=!0,d=!1;try{for(a=a.call(n);!(u=(s=a.next()).done)&&(l.push(s.value),!i||l.length!==i);u=!0);}catch(n){d=!0,c=n}finally{try{u||null==a.return||a.return()}finally{if(d)throw c}}return l}},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(De);var je=createCommonjsModule((function(n){n.exports=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},n.exports.default=n.exports,n.exports.__esModule=!0}));unwrapExports(je);var Ue=unwrapExports(createCommonjsModule((function(n){n.exports=function _slicedToArray(n,i){return Ae(n)||De(n,i)||M(n,i)||je()},n.exports.default=n.exports,n.exports.__esModule=!0})));function UUIDjs(){}function getRandomInt(n,i){return Math.floor(Math.random()*(i-n+1))+n}UUIDjs.maxFromBits=function(n){return Math.pow(2,n)},UUIDjs.limitUI04=UUIDjs.maxFromBits(4),UUIDjs.limitUI06=UUIDjs.maxFromBits(6),UUIDjs.limitUI08=UUIDjs.maxFromBits(8),UUIDjs.limitUI12=UUIDjs.maxFromBits(12),UUIDjs.limitUI14=UUIDjs.maxFromBits(14),UUIDjs.limitUI16=UUIDjs.maxFromBits(16),UUIDjs.limitUI32=UUIDjs.maxFromBits(32),UUIDjs.limitUI40=UUIDjs.maxFromBits(40),UUIDjs.limitUI48=UUIDjs.maxFromBits(48),UUIDjs.randomUI04=function(){return getRandomInt(0,UUIDjs.limitUI04-1)},UUIDjs.randomUI06=function(){return getRandomInt(0,UUIDjs.limitUI06-1)},UUIDjs.randomUI08=function(){return getRandomInt(0,UUIDjs.limitUI08-1)},UUIDjs.randomUI12=function(){return getRandomInt(0,UUIDjs.limitUI12-1)},UUIDjs.randomUI14=function(){return getRandomInt(0,UUIDjs.limitUI14-1)},UUIDjs.randomUI16=function(){return getRandomInt(0,UUIDjs.limitUI16-1)},UUIDjs.randomUI32=function(){return getRandomInt(0,UUIDjs.limitUI32-1)},UUIDjs.randomUI40=function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)},UUIDjs.randomUI48=function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)},UUIDjs.paddedString=function(n,i,a){a=a||"0";for(var s=i-(n=String(n)).length;s>0;s>>>=1,a+=a)1&s&&(n=a+n);return n},UUIDjs.prototype.fromParts=function(n,i,a,s,c,l){return this.version=a>>12&15,this.hex=UUIDjs.paddedString(n.toString(16),8)+"-"+UUIDjs.paddedString(i.toString(16),4)+"-"+UUIDjs.paddedString(a.toString(16),4)+"-"+UUIDjs.paddedString(s.toString(16),2)+UUIDjs.paddedString(c.toString(16),2)+"-"+UUIDjs.paddedString(l.toString(16),12),this},UUIDjs.prototype.toString=function(){return this.hex},UUIDjs.prototype.toURN=function(){return"urn:uuid:"+this.hex},UUIDjs.prototype.toBytes=function(){for(var n=this.hex.split("-"),i=[],a=0,s=0;s>>16,timestamp:i}},UUIDjs._create4=function(){return(new UUIDjs).fromParts(UUIDjs.randomUI32(),UUIDjs.randomUI16(),16384|UUIDjs.randomUI12(),128|UUIDjs.randomUI06(),UUIDjs.randomUI08(),UUIDjs.randomUI48())},UUIDjs._create1=function(){var n=(new Date).getTime(),i=UUIDjs.randomUI14(),a=1099511627776*(1|UUIDjs.randomUI08())+UUIDjs.randomUI40(),s=UUIDjs.randomUI04(),c=0;n!=c?(n>>8|128,h=255&i;return(new UUIDjs).fromParts(u,l.mid,d,p,h,a)},UUIDjs.create=function(n){return this["_create"+(n=n||4)]()},UUIDjs.fromTime=function(n,i){i=i||!1;var a=UUIDjs.getTimeFieldValues(n),s=a.low,c=4095&a.hi|4096;return!1===i?(new UUIDjs).fromParts(s,a.mid,c,0,0,0):(new UUIDjs).fromParts(s,a.mid,c,128|UUIDjs.limitUI06,UUIDjs.limitUI08-1,UUIDjs.limitUI48-1)},UUIDjs.firstFromTime=function(n){return UUIDjs.fromTime(n,!1)},UUIDjs.lastFromTime=function(n){return UUIDjs.fromTime(n,!0)},UUIDjs.fromURN=function(n){var i;return(i=/^(?:urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\})?$/i.exec(n))?(new UUIDjs).fromParts(parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),parseInt(i[4],16),parseInt(i[5],16),parseInt(i[6],16)):null},UUIDjs.fromBytes=function(n){if(n.length<5)return null;for(var i="",a=0,s=[4,2,2,2,6],c=0;c255||i[a]<0)throw new Error("Unexpected byte in binary data.");return UUIDjs.fromBytes(i)},UUIDjs.new=function(){return this.create(4)},UUIDjs.newTS=function(){return this.create(1)};var Oe=UUIDjs;function infinitePing(n){var i=n;i.pingLostCount++,i.pingLostCount>i.maxPingLost?n.close(1e3,"PING_LOST"):i.readyState<=1&&setTimeout((function(){i.readyState<=1&&(i.send(JSON.stringify({type:"ping"})),infinitePing(i))}),i.pingDelay)}function openWebSocket(n){var i;try{i=new WebSocket(n.url)}catch(n){h.error("Unable to open websocket, Check the host and your connectivity")}return function addWebsocketAttributes(n,i){var a=i.editor.configuration.recognitionParams.server.websocket,s=n;s.start=new Date,s.autoReconnect=a.autoReconnect,s.maxRetryCount=a.maxRetryCount,s.pingEnabled=a.pingEnabled,s.pingDelay=a.pingDelay,s.maxPingLost=a.maxPingLostCount,s.pingLostCount=0,s.recognizerContext=i}(i,n),i.pingEnabled&&infinitePing(i),i.onopen=function(i){h.trace("onOpen"),n.websocketCallback(i)},i.onclose=function(a){h.trace("onClose",new Date-i.start),n.websocketCallback(a)},i.onerror=function(i){h.trace("onError"),n.websocketCallback(i)},i.onmessage=function(a){if(h.trace("onMessage"),i.pingLostCount=0,"pong"!==JSON.parse(a.data).type){var s={type:a.type,data:JSON.parse(a.data)};n.websocketCallback(s)}},i}function send(n,i){var a=n;a.idle=!1;var s=a.websocket;if(1!==s.readyState)throw ee;s.send(JSON.stringify(i)),h.debug("".concat(i.type," message sent"),i)}function buildWebSocketCallback(n){return function(i){var a=n;h.trace("".concat(i.type," websocket callback"),i);var s=n.recognitionContexts[n.recognitionContexts.length-1];switch(h.debug("Current recognition context",s),i.type){case"open":n.sessionId?send(n,buildRestoreIInkSessionInput(n.editor.configuration,n.editor.domElement,n.sessionId)):send(n,buildNewContentPackageInput(n.editor.configuration,n.editor.domElement));break;case"message":switch(h.debug("Receiving ".concat(i.data.type," message"),i),i.data.type){case"ack":i.data.hmacChallenge&&send(n,function buildHmacMessage(n,i){return{type:"hmac",hmac:computeHmac(i.data.hmacChallenge,n.recognitionParams.server.applicationKey,n.recognitionParams.server.hmacKey)}}(n.editor.configuration,i)),i.data.iinkSessionId&&(a.sessionId=i.data.iinkSessionId);break;case"newPart":break;case"contentPackageDescription":a.currentReconnectionCount=0,a.contentPartCount=i.data.contentPartCount,send(n,buildConfiguration(n.editor.configuration)),a.currentPartId?send(n,buildOpenContentPart(n.editor.configuration,n.currentPartId)):send(n,buildNewContentPart(n.editor.configuration));break;case"partChanged":i.data.partId&&(a.currentPartId=i.data.partId),a.initialized=!0,s.partChange?s.partChange.resolve([void 0,i.data]):s.error(i);break;case"contentChanged":void 0!==i.data.canUndo&&(a.canUndo=i.data.canUndo),void 0!==i.data.canRedo&&(a.canRedo=i.data.canRedo),void 0!==i.data.empty&&(a.isEmpty=i.data.empty),void 0!==i.data.possibleUndoCount&&(a.possibleUndoCount=i.data.possibleUndoCount),void 0!==i.data.undoStackIndex&&(a.undoStackIndex=i.data.undoStackIndex),s.contentChange.resolve([void 0,i.data]);break;case"exported":case"fileChunkAck":s.response(void 0,i.data);break;case"svgPatch":s.patch(void 0,i.data);break;case"supportedImportMimeTypes":a.supportedImportMimeTypes=i.data.mimeTypes,s.response(void 0,i.data);break;case"idle":a.idle=!0,s.patch(void 0,i.data);break;case"error":if(h.debug("Error detected stopping all recognition",i),s){var c=function func(){};s.patch?c=s.patch:s.response&&(c=s.response),c(i.data)}else s.initPromise.reject(Object.assign({},i.data,{recoverable:!1}));break;default:h.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}break;case"error":if(h.debug("Error detected stopping all recognition",i),s){var l=function _func(){};s.patch?l=s.patch:s.response&&(l=s.response),l(Object.assign({},i,{recoverable:!1}))}else s.initPromise.reject(Object.assign({},i,{recoverable:!1}));break;case"close":h.debug("Close detected stopping all recognition",i),a.initialized=!1,"CLOSE_RECOGNIZER"===i.reason?s.initPromise.resolve(i):s?s.error(i):s.initPromise.reject(i);break;default:h.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}}}function init$1(n,i,a,s){var c=i.recognitionContexts[0],l=updateRecognitionPositions(i,c.model.lastPositions);return l.url=function buildUrl(n,i){var a="https"===n.recognitionParams.server.scheme?"wss":"ws";return"".concat(a,"://").concat(n.recognitionParams.server.host).concat(i)}(i.editor.configuration,n),l.reconnect=s,l.initPromise=c.initPromise.promise,h.debug("Opening the websocket for context ",i),l.websocketCallback=a(l),l.websocket=openWebSocket(l),l.initPromise}function retry(n,i,a,s){return _retry.apply(this,arguments)}function _retry(){return _retry=Y(V.mark((function _callee(n,i,a,s){var c,l,u,d=arguments;return V.wrap((function _callee$(p){for(;;)switch(p.prev=p.next){case 0:for(c=d.length,l=new Array(c>4?c-4:0),u=4;u2?a-2:0),c=2;c0)return updateModelSentPosition(i),{type:"addStrokes",strokes:a.map((function(n){return Object.assign({},{id:n.id,pointerType:n.pointerType,pointerId:n.pointerId,x:n.x,y:n.y,t:n.t,p:n.p})}))}}function buildUndo(){return{type:"undo"}}function buildRedo(){return{type:"redo"}}function buildClear(){return{type:"clear"}}function buildConvert(n){return{type:"convert",conversionState:n}}function buildZoom(n){return{type:"zoom",zoom:n}}function buildResize(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{type:"changeViewSize",height:n.clientHeight3?c-3:0),u=3;ua.size];u.push(_prepareMessage.apply(void 0,[c,i,buildImportChunk].concat(p)))}))},p=0;p2&&void 0!==arguments[2]?arguments[2]:10;return _prepareMessage(n,i,buildZoom,a)},setPenStyle:setPenStyle,setPenStyleClasses:setPenStyleClasses,setTheme:setTheme,close:close});var He={grabber:k,strokerList:[O,B],rendererList:[U,H],recognizerList:[Le,Xe],events:function emit(n,i){f.info("emitting ".concat(n," event"),i),this.dispatchEvent(new CustomEvent(n,Object.assign({bubbles:!0,composed:!0},i?{detail:i}:void 0)))},getBehaviorFromConfiguration:function getBehaviorFromConfiguration(n,i){var a={};return a.grabber=n.grabber,i&&("REST"===i.recognitionParams.protocol?(a.stroker=O,a.renderer=U,a.recognizer=Le):(a.stroker=B,a.renderer=H,a.recognizer=Xe)),a.events=n.events,a}};function register(n,i,a,s,c,u){return l.debug("Registering a new editor"),new Me(n,i,a,s,c,u)}function getAvailableLanguageList(n){return _getAvailableLanguageList.apply(this,arguments)}function _getAvailableLanguageList(){return(_getAvailableLanguageList=Y(V.mark((function _callee(n){var i,a;return V.wrap((function _callee$(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!(n&&n.recognitionParams&&n.recognitionParams.server&&n.recognitionParams.server.host)){s.next=10;break}return i=n.recognitionParams.server,s.next=5,fetch("".concat(i.scheme,"://").concat(i.host,"/api/v4.0/iink/availableLanguageList"));case 5:if(!(a=s.sent)||!a.ok){s.next=8;break}return s.abrupt("return",a.json());case 8:s.next=11;break;case 10:console.error("Cannot get languages ! Please check your configuration!");case 11:s.next=16;break;case 13:s.prev=13,s.t0=s.catch(0),console.error(s.t0);case 16:case"end":return s.stop()}}),_callee,null,[[0,13]])})))).apply(this,arguments)}var Be={Constants:i,DefaultConfiguration:m,DefaultBehaviors:He,DefaultPenStyle:b,DefaultTheme:w,register:register,getAvailableLanguageList:getAvailableLanguageList,LoggerConfig:c,Editor:Me,InkModel:j,RecognizerContext:ne};n.Constants=i,n.DefaultBehaviors=He,n.DefaultConfiguration=m,n.DefaultPenStyle=b,n.DefaultTheme=w,n.Editor=Me,n.InkModel=j,n.LoggerConfig=c,n.RecognizerContext=ne,n.default=Be,n.getAvailableLanguageList=getAvailableLanguageList,n.register=register,Object.defineProperty(n,"__esModule",{value:!0})})); +function get(n){return getComputedStyle(n)}function set(n,i){for(var a in i){var s=i[a];"number"==typeof s&&(s+="px"),n.style[a]=s}return n}function div(n){var i=document.createElement("div");return i.className=n,i}var Q="undefined"!=typeof Element&&(Element.prototype.matches||Element.prototype.webkitMatchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector);function matches(n,i){if(!Q)throw new Error("No element matching method supported");return Q.call(n,i)}function remove$1(n){n.remove?n.remove():n.parentNode&&n.parentNode.removeChild(n)}function queryChildren(n,i){return Array.prototype.filter.call(n.children,(function(n){return matches(n,i)}))}var ee="ps",te="ps__rtl",ne={thumb:function(n){return"ps__thumb-"+n},rail:function(n){return"ps__rail-"+n},consuming:"ps__child--consume"},re={focus:"ps--focus",clicking:"ps--clicking",active:function(n){return"ps--active-"+n},scrolling:function(n){return"ps--scrolling-"+n}},oe={x:null,y:null};function addScrollingClass(n,i){var a=n.element.classList,s=re.scrolling(i);a.contains(s)?clearTimeout(oe[i]):a.add(s)}function removeScrollingClass(n,i){oe[i]=setTimeout((function(){return n.isAlive&&n.element.classList.remove(re.scrolling(i))}),n.settings.scrollingThreshold)}var ie=function EventElement(n){this.element=n,this.handlers={}},ae={isEmpty:{configurable:!0}};ie.prototype.bind=function bind(n,i){void 0===this.handlers[n]&&(this.handlers[n]=[]),this.handlers[n].push(i),this.element.addEventListener(n,i,!1)},ie.prototype.unbind=function unbind(n,i){var a=this;this.handlers[n]=this.handlers[n].filter((function(s){return!(!i||s===i)||(a.element.removeEventListener(n,s,!1),!1)}))},ie.prototype.unbindAll=function unbindAll(){for(var n in this.handlers)this.unbind(n)},ae.isEmpty.get=function(){var n=this;return Object.keys(this.handlers).every((function(i){return 0===n.handlers[i].length}))},Object.defineProperties(ie.prototype,ae);var se=function EventManager(){this.eventElements=[]};function createEvent(n){if("function"==typeof window.CustomEvent)return new CustomEvent(n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(n,!1,!1,void 0),i}function processScrollDiff(n,i,a,s,c){var l;if(void 0===s&&(s=!0),void 0===c&&(c=!1),"top"===i)l=["contentHeight","containerHeight","scrollTop","y","up","down"];else{if("left"!==i)throw new Error("A proper axis should be provided");l=["contentWidth","containerWidth","scrollLeft","x","left","right"]}!function processScrollDiff$1(n,i,a,s,c){var l=a[0],u=a[1],d=a[2],p=a[3],h=a[4],f=a[5];void 0===s&&(s=!0);void 0===c&&(c=!1);var g=n.element;n.reach[p]=null,g[d]<1&&(n.reach[p]="start");g[d]>n[l]-n[u]-1&&(n.reach[p]="end");i&&(g.dispatchEvent(createEvent("ps-scroll-"+p)),i<0?g.dispatchEvent(createEvent("ps-scroll-"+h)):i>0&&g.dispatchEvent(createEvent("ps-scroll-"+f)),s&&function setScrollingClassInstantly(n,i){addScrollingClass(n,i),removeScrollingClass(n,i)}(n,p));n.reach[p]&&(i||c)&&g.dispatchEvent(createEvent("ps-"+p+"-reach-"+n.reach[p]))}(n,a,l,s,c)}function toInt(n){return parseInt(n,10)||0}se.prototype.eventElement=function eventElement(n){var i=this.eventElements.filter((function(i){return i.element===n}))[0];return i||(i=new ie(n),this.eventElements.push(i)),i},se.prototype.bind=function bind(n,i,a){this.eventElement(n).bind(i,a)},se.prototype.unbind=function unbind(n,i,a){var s=this.eventElement(n);s.unbind(i,a),s.isEmpty&&this.eventElements.splice(this.eventElements.indexOf(s),1)},se.prototype.unbindAll=function unbindAll(){this.eventElements.forEach((function(n){return n.unbindAll()})),this.eventElements=[]},se.prototype.once=function once(n,i,a){var s=this.eventElement(n),onceHandler=function(n){s.unbind(i,onceHandler),a(n)};s.bind(i,onceHandler)};var ce={isWebKit:"undefined"!=typeof document&&"WebkitAppearance"in document.documentElement.style,supportsTouch:"undefined"!=typeof window&&("ontouchstart"in window||"maxTouchPoints"in window.navigator&&window.navigator.maxTouchPoints>0||window.DocumentTouch&&document instanceof window.DocumentTouch),supportsIePointer:"undefined"!=typeof navigator&&navigator.msMaxTouchPoints,isChrome:"undefined"!=typeof navigator&&/Chrome/i.test(navigator&&navigator.userAgent)};function updateGeometry(n){var i=n.element,a=Math.floor(i.scrollTop),s=i.getBoundingClientRect();n.containerWidth=Math.ceil(s.width),n.containerHeight=Math.ceil(s.height),n.contentWidth=i.scrollWidth,n.contentHeight=i.scrollHeight,i.contains(n.scrollbarXRail)||(queryChildren(i,ne.rail("x")).forEach((function(n){return remove$1(n)})),i.appendChild(n.scrollbarXRail)),i.contains(n.scrollbarYRail)||(queryChildren(i,ne.rail("y")).forEach((function(n){return remove$1(n)})),i.appendChild(n.scrollbarYRail)),!n.settings.suppressScrollX&&n.containerWidth+n.settings.scrollXMarginOffset=n.railXWidth-n.scrollbarXWidth&&(n.scrollbarXLeft=n.railXWidth-n.scrollbarXWidth),n.scrollbarYTop>=n.railYHeight-n.scrollbarYHeight&&(n.scrollbarYTop=n.railYHeight-n.scrollbarYHeight),function updateCss(n,i){var a={width:i.railXWidth},s=Math.floor(n.scrollTop);i.isRtl?a.left=i.negativeScrollAdjustment+n.scrollLeft+i.containerWidth-i.contentWidth:a.left=n.scrollLeft;i.isScrollbarXUsingBottom?a.bottom=i.scrollbarXBottom-s:a.top=i.scrollbarXTop+s;set(i.scrollbarXRail,a);var c={top:s,height:i.railYHeight};i.isScrollbarYUsingRight?i.isRtl?c.right=i.contentWidth-(i.negativeScrollAdjustment+n.scrollLeft)-i.scrollbarYRight-i.scrollbarYOuterWidth-9:c.right=i.scrollbarYRight-n.scrollLeft:i.isRtl?c.left=i.negativeScrollAdjustment+n.scrollLeft+2*i.containerWidth-i.contentWidth-i.scrollbarYLeft-i.scrollbarYOuterWidth:c.left=i.scrollbarYLeft+n.scrollLeft;set(i.scrollbarYRail,c),set(i.scrollbarX,{left:i.scrollbarXLeft,width:i.scrollbarXWidth-i.railBorderXWidth}),set(i.scrollbarY,{top:i.scrollbarYTop,height:i.scrollbarYHeight-i.railBorderYWidth})}(i,n),n.scrollbarXActive?i.classList.add(re.active("x")):(i.classList.remove(re.active("x")),n.scrollbarXWidth=0,n.scrollbarXLeft=0,i.scrollLeft=!0===n.isRtl?n.contentWidth:0),n.scrollbarYActive?i.classList.add(re.active("y")):(i.classList.remove(re.active("y")),n.scrollbarYHeight=0,n.scrollbarYTop=0,i.scrollTop=0)}function getThumbSize(n,i){return n.settings.minScrollbarLength&&(i=Math.max(i,n.settings.minScrollbarLength)),n.settings.maxScrollbarLength&&(i=Math.min(i,n.settings.maxScrollbarLength)),i}function bindMouseScrollHandler(n,i){var a=i[0],s=i[1],c=i[2],l=i[3],u=i[4],d=i[5],p=i[6],h=i[7],f=i[8],g=n.element,m=null,v=null,y=null;function mouseMoveHandler(i){i.touches&&i.touches[0]&&(i[c]=i.touches[0].pageY),g[p]=m+y*(i[c]-v),addScrollingClass(n,h),updateGeometry(n),i.stopPropagation(),i.preventDefault()}function mouseUpHandler(){removeScrollingClass(n,h),n[f].classList.remove(re.clicking),n.event.unbind(n.ownerDocument,"mousemove",mouseMoveHandler)}function bindMoves(i,u){m=g[p],u&&i.touches&&(i[c]=i.touches[0].pageY),v=i[c],y=(n[s]-n[a])/(n[l]-n[d]),u?n.event.bind(n.ownerDocument,"touchmove",mouseMoveHandler):(n.event.bind(n.ownerDocument,"mousemove",mouseMoveHandler),n.event.once(n.ownerDocument,"mouseup",mouseUpHandler),i.preventDefault()),n[f].classList.add(re.clicking),i.stopPropagation()}n.event.bind(n[u],"mousedown",(function(n){bindMoves(n)})),n.event.bind(n[u],"touchstart",(function(n){bindMoves(n,!0)}))}var le={"click-rail":function clickRail(n){n.element,n.event.bind(n.scrollbarY,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarYRail,"mousedown",(function(i){var a=i.pageY-window.pageYOffset-n.scrollbarYRail.getBoundingClientRect().top>n.scrollbarYTop?1:-1;n.element.scrollTop+=a*n.containerHeight,updateGeometry(n),i.stopPropagation()})),n.event.bind(n.scrollbarX,"mousedown",(function(n){return n.stopPropagation()})),n.event.bind(n.scrollbarXRail,"mousedown",(function(i){var a=i.pageX-window.pageXOffset-n.scrollbarXRail.getBoundingClientRect().left>n.scrollbarXLeft?1:-1;n.element.scrollLeft+=a*n.containerWidth,updateGeometry(n),i.stopPropagation()}))},"drag-thumb":function dragThumb(n){bindMouseScrollHandler(n,["containerWidth","contentWidth","pageX","railXWidth","scrollbarX","scrollbarXWidth","scrollLeft","x","scrollbarXRail"]),bindMouseScrollHandler(n,["containerHeight","contentHeight","pageY","railYHeight","scrollbarY","scrollbarYHeight","scrollTop","y","scrollbarYRail"])},keyboard:function keyboard(n){var i=n.element;n.event.bind(n.ownerDocument,"keydown",(function(a){if(!(a.isDefaultPrevented&&a.isDefaultPrevented()||a.defaultPrevented)&&(matches(i,":hover")||matches(n.scrollbarX,":focus")||matches(n.scrollbarY,":focus"))){var s=document.activeElement?document.activeElement:n.ownerDocument.activeElement;if(s){if("IFRAME"===s.tagName)s=s.contentDocument.activeElement;else for(;s.shadowRoot;)s=s.shadowRoot.activeElement;if(function isEditable(n){return matches(n,"input,[contenteditable]")||matches(n,"select,[contenteditable]")||matches(n,"textarea,[contenteditable]")||matches(n,"button,[contenteditable]")}(s))return}var c=0,l=0;switch(a.which){case 37:c=a.metaKey?-n.contentWidth:a.altKey?-n.containerWidth:-30;break;case 38:l=a.metaKey?n.contentHeight:a.altKey?n.containerHeight:30;break;case 39:c=a.metaKey?n.contentWidth:a.altKey?n.containerWidth:30;break;case 40:l=a.metaKey?-n.contentHeight:a.altKey?-n.containerHeight:-30;break;case 32:l=a.shiftKey?n.containerHeight:-n.containerHeight;break;case 33:l=n.containerHeight;break;case 34:l=-n.containerHeight;break;case 36:l=n.contentHeight;break;case 35:l=-n.contentHeight;break;default:return}n.settings.suppressScrollX&&0!==c||n.settings.suppressScrollY&&0!==l||(i.scrollTop-=l,i.scrollLeft+=c,updateGeometry(n),function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop);if(0===a){if(!n.scrollbarYActive)return!1;if(0===c&&s>0||c>=n.contentHeight-n.containerHeight&&s<0)return!n.settings.wheelPropagation}var l=i.scrollLeft;if(0===s){if(!n.scrollbarXActive)return!1;if(0===l&&a<0||l>=n.contentWidth-n.containerWidth&&a>0)return!n.settings.wheelPropagation}return!0}(c,l)&&a.preventDefault())}}))},wheel:function wheel(n){var i=n.element;function mousewheelHandler(a){var s=function getDeltaFromEvent(n){var i=n.deltaX,a=-1*n.deltaY;return void 0!==i&&void 0!==a||(i=-1*n.wheelDeltaX/6,a=n.wheelDeltaY/6),n.deltaMode&&1===n.deltaMode&&(i*=10,a*=10),i!=i&&a!=a&&(i=0,a=n.wheelDelta),n.shiftKey?[-a,-i]:[i,a]}(a),c=s[0],l=s[1];if(!function shouldBeConsumedByChild(n,a,s){if(!ce.isWebKit&&i.querySelector("select:focus"))return!0;if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ne.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(a.target,c,l)){var u=!1;n.settings.useBothWheelAxes?n.scrollbarYActive&&!n.scrollbarXActive?(l?i.scrollTop-=l*n.settings.wheelSpeed:i.scrollTop+=c*n.settings.wheelSpeed,u=!0):n.scrollbarXActive&&!n.scrollbarYActive&&(c?i.scrollLeft+=c*n.settings.wheelSpeed:i.scrollLeft-=l*n.settings.wheelSpeed,u=!0):(i.scrollTop-=l*n.settings.wheelSpeed,i.scrollLeft+=c*n.settings.wheelSpeed),updateGeometry(n),(u=u||function shouldPreventDefault(a,s){var c=Math.floor(i.scrollTop),l=0===i.scrollTop,u=c+i.offsetHeight===i.scrollHeight,d=0===i.scrollLeft,p=i.scrollLeft+i.offsetWidth===i.scrollWidth;return!(Math.abs(s)>Math.abs(a)?l||u:d||p)||!n.settings.wheelPropagation}(c,l))&&!a.ctrlKey&&(a.stopPropagation(),a.preventDefault())}}void 0!==window.onwheel?n.event.bind(i,"wheel",mousewheelHandler):void 0!==window.onmousewheel&&n.event.bind(i,"mousewheel",mousewheelHandler)},touch:function touch(n){if(ce.supportsTouch||ce.supportsIePointer){var i=n.element,a={},s=0,c={},l=null;ce.supportsTouch?(n.event.bind(i,"touchstart",touchStart),n.event.bind(i,"touchmove",touchMove),n.event.bind(i,"touchend",touchEnd)):ce.supportsIePointer&&(window.PointerEvent?(n.event.bind(i,"pointerdown",touchStart),n.event.bind(i,"pointermove",touchMove),n.event.bind(i,"pointerup",touchEnd)):window.MSPointerEvent&&(n.event.bind(i,"MSPointerDown",touchStart),n.event.bind(i,"MSPointerMove",touchMove),n.event.bind(i,"MSPointerUp",touchEnd)))}function applyTouchMove(a,s){i.scrollTop-=s,i.scrollLeft-=a,updateGeometry(n)}function getTouch(n){return n.targetTouches?n.targetTouches[0]:n}function shouldHandle(n){return(!n.pointerType||"pen"!==n.pointerType||0!==n.buttons)&&(!(!n.targetTouches||1!==n.targetTouches.length)||!(!n.pointerType||"mouse"===n.pointerType||n.pointerType===n.MSPOINTER_TYPE_MOUSE))}function touchStart(n){if(shouldHandle(n)){var i=getTouch(n);a.pageX=i.pageX,a.pageY=i.pageY,s=(new Date).getTime(),null!==l&&clearInterval(l)}}function touchMove(l){if(shouldHandle(l)){var u=getTouch(l),d={pageX:u.pageX,pageY:u.pageY},p=d.pageX-a.pageX,h=d.pageY-a.pageY;if(function shouldBeConsumedByChild(n,a,s){if(!i.contains(n))return!1;for(var c=n;c&&c!==i;){if(c.classList.contains(ne.consuming))return!0;var l=get(c);if(s&&l.overflowY.match(/(scroll|auto)/)){var u=c.scrollHeight-c.clientHeight;if(u>0&&(c.scrollTop>0&&s<0||c.scrollTop0))return!0}if(a&&l.overflowX.match(/(scroll|auto)/)){var d=c.scrollWidth-c.clientWidth;if(d>0&&(c.scrollLeft>0&&a<0||c.scrollLeft0))return!0}c=c.parentNode}return!1}(l.target,p,h))return;applyTouchMove(p,h),a=d;var f=(new Date).getTime(),g=f-s;g>0&&(c.x=p/g,c.y=h/g,s=f),function shouldPrevent(a,s){var c=Math.floor(i.scrollTop),l=i.scrollLeft,u=Math.abs(a),d=Math.abs(s);if(d>u){if(s<0&&c===n.contentHeight-n.containerHeight||s>0&&0===c)return 0===window.scrollY&&s>0&&ce.isChrome}else if(u>d&&(a<0&&l===n.contentWidth-n.containerWidth||a>0&&0===l))return!0;return!0}(p,h)&&l.preventDefault()}}function touchEnd(){n.settings.swipeEasing&&(clearInterval(l),l=setInterval((function(){n.isInitialized?clearInterval(l):c.x||c.y?Math.abs(c.x)<.01&&Math.abs(c.y)<.01?clearInterval(l):(applyTouchMove(30*c.x,30*c.y),c.x*=.8,c.y*=.8):clearInterval(l)}),10))}}},ue=function PerfectScrollbar(n,i){var a=this;if(void 0===i&&(i={}),"string"==typeof n&&(n=document.querySelector(n)),!n||!n.nodeName)throw new Error("no element is specified to initialize PerfectScrollbar");for(var s in this.element=n,n.classList.add(ee),this.settings={handlers:["click-rail","drag-thumb","keyboard","wheel","touch"],maxScrollbarLength:null,minScrollbarLength:null,scrollingThreshold:1e3,scrollXMarginOffset:0,scrollYMarginOffset:0,suppressScrollX:!1,suppressScrollY:!1,swipeEasing:!0,useBothWheelAxes:!1,wheelPropagation:!0,wheelSpeed:1},i)this.settings[s]=i[s];this.containerWidth=null,this.containerHeight=null,this.contentWidth=null,this.contentHeight=null;var c,l,focus=function(){return n.classList.add(re.focus)},blur=function(){return n.classList.remove(re.focus)};this.isRtl="rtl"===get(n).direction,!0===this.isRtl&&n.classList.add(te),this.isNegativeScroll=(l=n.scrollLeft,n.scrollLeft=-1,c=n.scrollLeft<0,n.scrollLeft=l,c),this.negativeScrollAdjustment=this.isNegativeScroll?n.scrollWidth-n.clientWidth:0,this.event=new se,this.ownerDocument=n.ownerDocument||document,this.scrollbarXRail=div(ne.rail("x")),n.appendChild(this.scrollbarXRail),this.scrollbarX=div(ne.thumb("x")),this.scrollbarXRail.appendChild(this.scrollbarX),this.scrollbarX.setAttribute("tabindex",0),this.event.bind(this.scrollbarX,"focus",focus),this.event.bind(this.scrollbarX,"blur",blur),this.scrollbarXActive=null,this.scrollbarXWidth=null,this.scrollbarXLeft=null;var u=get(this.scrollbarXRail);this.scrollbarXBottom=parseInt(u.bottom,10),isNaN(this.scrollbarXBottom)?(this.isScrollbarXUsingBottom=!1,this.scrollbarXTop=toInt(u.top)):this.isScrollbarXUsingBottom=!0,this.railBorderXWidth=toInt(u.borderLeftWidth)+toInt(u.borderRightWidth),set(this.scrollbarXRail,{display:"block"}),this.railXMarginWidth=toInt(u.marginLeft)+toInt(u.marginRight),set(this.scrollbarXRail,{display:""}),this.railXWidth=null,this.railXRatio=null,this.scrollbarYRail=div(ne.rail("y")),n.appendChild(this.scrollbarYRail),this.scrollbarY=div(ne.thumb("y")),this.scrollbarYRail.appendChild(this.scrollbarY),this.scrollbarY.setAttribute("tabindex",0),this.event.bind(this.scrollbarY,"focus",focus),this.event.bind(this.scrollbarY,"blur",blur),this.scrollbarYActive=null,this.scrollbarYHeight=null,this.scrollbarYTop=null;var d=get(this.scrollbarYRail);this.scrollbarYRight=parseInt(d.right,10),isNaN(this.scrollbarYRight)?(this.isScrollbarYUsingRight=!1,this.scrollbarYLeft=toInt(d.left)):this.isScrollbarYUsingRight=!0,this.scrollbarYOuterWidth=this.isRtl?function outerWidth(n){var i=get(n);return toInt(i.width)+toInt(i.paddingLeft)+toInt(i.paddingRight)+toInt(i.borderLeftWidth)+toInt(i.borderRightWidth)}(this.scrollbarY):null,this.railBorderYWidth=toInt(d.borderTopWidth)+toInt(d.borderBottomWidth),set(this.scrollbarYRail,{display:"block"}),this.railYMarginHeight=toInt(d.marginTop)+toInt(d.marginBottom),set(this.scrollbarYRail,{display:""}),this.railYHeight=null,this.railYRatio=null,this.reach={x:n.scrollLeft<=0?"start":n.scrollLeft>=this.contentWidth-this.containerWidth?"end":null,y:n.scrollTop<=0?"start":n.scrollTop>=this.contentHeight-this.containerHeight?"end":null},this.isAlive=!0,this.settings.handlers.forEach((function(n){return le[n](a)})),this.lastScrollTop=Math.floor(n.scrollTop),this.lastScrollLeft=n.scrollLeft,this.event.bind(this.element,"scroll",(function(n){return a.onScroll(n)})),updateGeometry(this)};ue.prototype.update=function update(){this.isAlive&&(this.negativeScrollAdjustment=this.isNegativeScroll?this.element.scrollWidth-this.element.clientWidth:0,set(this.scrollbarXRail,{display:"block"}),set(this.scrollbarYRail,{display:"block"}),this.railXMarginWidth=toInt(get(this.scrollbarXRail).marginLeft)+toInt(get(this.scrollbarXRail).marginRight),this.railYMarginHeight=toInt(get(this.scrollbarYRail).marginTop)+toInt(get(this.scrollbarYRail).marginBottom),set(this.scrollbarXRail,{display:"none"}),set(this.scrollbarYRail,{display:"none"}),updateGeometry(this),processScrollDiff(this,"top",0,!1,!0),processScrollDiff(this,"left",0,!1,!0),set(this.scrollbarXRail,{display:""}),set(this.scrollbarYRail,{display:""}))},ue.prototype.onScroll=function onScroll(n){this.isAlive&&(updateGeometry(this),processScrollDiff(this,"top",this.element.scrollTop-this.lastScrollTop),processScrollDiff(this,"left",this.element.scrollLeft-this.lastScrollLeft),this.lastScrollTop=Math.floor(this.element.scrollTop),this.lastScrollLeft=this.element.scrollLeft)},ue.prototype.destroy=function destroy(){this.isAlive&&(this.event.unbindAll(),remove$1(this.scrollbarX),remove$1(this.scrollbarY),remove$1(this.scrollbarXRail),remove$1(this.scrollbarYRail),this.removePsClasses(),this.element=null,this.scrollbarX=null,this.scrollbarY=null,this.scrollbarXRail=null,this.scrollbarYRail=null,this.isAlive=!1)},ue.prototype.removePsClasses=function removePsClasses(){this.element.className=this.element.className.split(" ").filter((function(n){return!n.match(/^ps([-_].+|)$/)})).join(" ")};var de=function select$1(n){var i;if("SELECT"===n.nodeName)n.focus(),i=n.value;else if("INPUT"===n.nodeName||"TEXTAREA"===n.nodeName){var a=n.hasAttribute("readonly");a||n.setAttribute("readonly",""),n.select(),n.setSelectionRange(0,n.value.length),a||n.removeAttribute("readonly"),i=n.value}else{n.hasAttribute("contenteditable")&&n.focus();var s=window.getSelection(),c=document.createRange();c.selectNodeContents(n),s.removeAllRanges(),s.addRange(c),i=s.toString()}return i},pe=createCommonjsModule((function(n,i){!function(n,i){var a=_interopRequireDefault(i);function _interopRequireDefault(n){return n&&n.__esModule?n:{default:n}}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")}var c=function(){function defineProperties(n,i){for(var a=0;a0&&void 0!==arguments[0]?arguments[0]:{};this.action=n.action,this.container=n.container,this.emitter=n.emitter,this.target=n.target,this.text=n.text,this.trigger=n.trigger,this.selectedText=""}},{key:"initSelection",value:function initSelection(){this.text?this.selectFake():this.target&&this.selectTarget()}},{key:"selectFake",value:function selectFake(){var n=this,i="rtl"==document.documentElement.getAttribute("dir");this.removeFake(),this.fakeHandlerCallback=function(){return n.removeFake()},this.fakeHandler=this.container.addEventListener("click",this.fakeHandlerCallback)||!0,this.fakeElem=document.createElement("textarea"),this.fakeElem.style.fontSize="12pt",this.fakeElem.style.border="0",this.fakeElem.style.padding="0",this.fakeElem.style.margin="0",this.fakeElem.style.position="absolute",this.fakeElem.style[i?"right":"left"]="-9999px";var s=window.pageYOffset||document.documentElement.scrollTop;this.fakeElem.style.top=s+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,this.container.appendChild(this.fakeElem),this.selectedText=(0,a.default)(this.fakeElem),this.copyText()}},{key:"removeFake",value:function removeFake(){this.fakeHandler&&(this.container.removeEventListener("click",this.fakeHandlerCallback),this.fakeHandler=null,this.fakeHandlerCallback=null),this.fakeElem&&(this.container.removeChild(this.fakeElem),this.fakeElem=null)}},{key:"selectTarget",value:function selectTarget(){this.selectedText=(0,a.default)(this.target),this.copyText()}},{key:"copyText",value:function copyText(){var n=void 0;try{n=document.execCommand(this.action)}catch(i){n=!1}this.handleResult(n)}},{key:"handleResult",value:function handleResult(n){this.emitter.emit(n?"success":"error",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})}},{key:"clearSelection",value:function clearSelection(){this.trigger&&this.trigger.focus(),window.getSelection().removeAllRanges()}},{key:"destroy",value:function destroy(){this.removeFake()}},{key:"action",set:function set(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"copy";if(this._action=n,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"')},get:function get(){return this._action}},{key:"target",set:function set(n){if(void 0!==n){if(!n||"object"!==(void 0===n?"undefined":s(n))||1!==n.nodeType)throw new Error('Invalid "target" value, use a valid Element');if("copy"===this.action&&n.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if("cut"===this.action&&(n.hasAttribute("readonly")||n.hasAttribute("disabled")))throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');this._target=n}},get:function get(){return this._target}}]),ClipboardAction}();n.exports=l}(n,de)}));function E(){}unwrapExports(pe),E.prototype={on:function(n,i,a){var s=this.e||(this.e={});return(s[n]||(s[n]=[])).push({fn:i,ctx:a}),this},once:function(n,i,a){var s=this;function listener(){s.off(n,listener),i.apply(a,arguments)}return listener._=i,this.on(n,listener,a)},emit:function(n){for(var i=[].slice.call(arguments,1),a=((this.e||(this.e={}))[n]||[]).slice(),s=0,c=a.length;s0&&void 0!==arguments[0]?arguments[0]:{};this.action="function"==typeof n.action?n.action:this.defaultAction,this.target="function"==typeof n.target?n.target:this.defaultTarget,this.text="function"==typeof n.text?n.text:this.defaultText,this.container="object"===d(n.container)?n.container:document.body}},{key:"listenClick",value:function listenClick(n){var i=this;this.listener=(0,u.default)(n,"click",(function(n){return i.onClick(n)}))}},{key:"onClick",value:function onClick(n){var i=n.delegateTarget||n.currentTarget;this.clipboardAction&&(this.clipboardAction=null),this.clipboardAction=new c.default({action:this.action(i),target:this.target(i),text:this.text(i),container:this.container,trigger:i,emitter:this})}},{key:"defaultAction",value:function defaultAction(n){return getAttributeValue("action",n)}},{key:"defaultTarget",value:function defaultTarget(n){var i=getAttributeValue("target",n);if(i)return document.querySelector(i)}},{key:"defaultText",value:function defaultText(n){return getAttributeValue("text",n)}},{key:"destroy",value:function destroy(){this.listener.destroy(),this.clipboardAction&&(this.clipboardAction.destroy(),this.clipboardAction=null)}}],[{key:"isSupported",value:function isSupported(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["copy","cut"],i="string"==typeof n?[n]:n,a=!!document.queryCommandSupported;return i.forEach((function(n){a=a&&!!document.queryCommandSupported(n)})),a}}]),Clipboard}(l.default);function getAttributeValue(n,i){var a="data-clipboard-"+n;if(i.hasAttribute(a))return i.getAttribute(a)}n.exports=h}(n,pe,he,ye)})));function isInShadow(n){for(var i=n&&n.parentNode;i;){if("[object ShadowRoot]"===i.toString())return!0;i=i.parentNode}return!1}function addListeners(n,a){var s=a.elements;s.textElement.addEventListener("click",(function(s){return function showCandidates(n,a,s){var c=s,l=s.elements;if(n.target.id!=="prompter-text".concat(s.randomString)){var u=n.target.id.replace("word-","").replace(s.randomString,""),d=JSON.parse(a.exports[i.Exports.JIIX]).words;if(c.wordToChange=d[u],c.wordToChange.id=u,l.candidatesElement.innerHTML="",c.wordToChange&&c.wordToChange.candidates){l.candidatesElement.style.display="flex",c.wordToChange.candidates.forEach((function(n,i){c.wordToChange.label===n?l.candidatesElement.innerHTML+='').concat(n,""):l.candidatesElement.innerHTML+='').concat(n,"")}));var p=n.target.getBoundingClientRect().left-60;l.candidatesElement.style.top="".concat(48,"px"),l.candidatesElement.style.left="".concat(p,"px"),n.target.parentNode.parentNode.parentNode.insertBefore(l.candidatesElement,n.target.parentNode.parentNode)}}}(s,n,a)})),s.candidatesElement.addEventListener("click",(function(s){return function clickCandidate(n,a,s){var c=s,l=s.elements,u=n.target.innerText;if(u!==c.wordToChange.label&&c.wordToChange.candidates.includes(u)){var d=JSON.parse(a.exports[i.Exports.JIIX]);d.words[c.wordToChange.id].label=u,a.import_(JSON.stringify(d),i.Exports.JIIX)}l.candidatesElement.style.display="none"}(s,n,a)})),s.ellipsisElement.addEventListener("click",(function(n){return function showActions(n,i){var a=i,s=function positionActions(){var i=n.target.offsetLeft-68;a.menuElement.style.left="".concat(i,"px")},c=document.contains(a.menuElement);isInShadow(a.menuElement)||c?"none"===a.menuElement.style.display&&(s(),a.menuElement.style.display="flex"):(a.menuElement.style.display="flex",s(),function insertActions(){a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),n.target.parentNode.insertBefore(a.menuElement,n.target)}())}(n,s)})),s.copyElement.addEventListener("click",(function(){s.menuElement.style.display="none"})),s.convertElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.convert()})),s.deleteElement.addEventListener("click",(function(){s.menuElement.style.display="none",n.clear()}))}function createSmartGuide(n){var i="-"+Math.random().toString(10).substring(2,12),a=function createHTMLElements(n){var i=document.createElement("div");i.id="smartguide"+n,i.classList.add("smartguide");var a=document.createElement("div");a.id="prompter-text"+n,a.classList.add("prompter-text"),a.setAttribute("touch-action","none");var s=document.createElement("div");s.id="prompter-text-container"+n,s.classList.add("prompter-text-container"),s.appendChild(a);var c=document.createElement("div");c.id="ellipsis"+n,c.classList.add("ellipsis"),c.innerHTML="...";var l=document.createElement("div");l.id="tag-icon"+n,l.classList.add("tag-icon"),l.innerHTML="¶";var u=document.createElement("div");u.id="candidates"+n,u.classList.add("candidates");var d=document.createElement("div");d.id="more-menu"+n,d.classList.add("more-menu");var p=document.createElement("button");p.classList.add("options-label-button"),p.id="convert"+n,p.innerHTML="Convert";var h=document.createElement("button");h.classList.add("options-label-button"),h.id="copy"+n,h.innerHTML="Copy";var f=document.createElement("button");return f.classList.add("options-label-button"),f.id="delete"+n,f.innerHTML="Delete",{smartGuideElement:i,textElement:a,textContainer:s,candidatesElement:u,menuElement:d,tagElement:l,ellipsisElement:c,convertElement:p,copyElement:h,deleteElement:f}}(i),s=(new be(a.copyElement),{editor:n,wordToChange:"",lastWord:"",previousLabelExport:" ",perfectScrollbar:new ue(a.textContainer,{suppressScrollY:!0,scrollXMarginOffset:1}),elements:a,smartGuideTimeOutId:0,randomString:i});return addListeners(n,s),n.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable&&function callFadeOutObserver(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4,i=arguments.length>1?arguments[1]:void 0,a=i,s=i.elements;new MutationObserver((function(i){i.forEach((function(){a.smartGuideTimeOutId&&clearTimeout(a.smartGuideTimeOutId),"none"===s.candidatesElement.style.display&&"none"===s.menuElement.style.display?a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n):document.contains(s.candidatesElement)||document.contains(s.menuElement)||(a.smartGuideTimeOutId=setTimeout((function(){s.smartGuideElement.classList.add("smartguide-out"),s.smartGuideElement.classList.remove("smartguide-in")}),n))}))})).observe(s.smartGuideElement,{childList:!0,subtree:!0,attributes:!0})}(n.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration,s),s}function resize$2(n){var i=n,a=n.elements,s=3.779527559*i.editor.configuration.recognitionParams.iink.text.margin.left,c=i.editor.domElement.clientWidth-s-a.tagElement.offsetWidth-35-s;a.textContainer.style.width="".concat(c,"px"),a.textContainer.style.maxWidth="".concat(c,"px"),s=a.tagElement.offsetWidth,s+=c,a.ellipsisElement.style.left="".concat(s,"px"),a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}function launchSmartGuide(n,a){var s=n,c=n.elements,l=document.contains(c.smartGuideElement);isInShadow(c.smartGuideElement)||l||function insertSmartGuide(n){var i=n,a=n.elements,s=3.779527559,c=i.editor.configuration.recognitionParams.iink.text.margin.top*s,l=i.editor.configuration.recognitionParams.iink.text.margin.left*s;!function insertSmartGuideElement(n,s){a.smartGuideElement.style.top="".concat(s,"px"),a.smartGuideElement.style.left="".concat(n,"px"),a.smartGuideElement.style.visibility="hidden",i.editor.domElement.insertBefore(a.smartGuideElement,i.editor.loader)}(l,c-45.354330708),function insertTag(){a.smartGuideElement.appendChild(a.tagElement)}();var u=i.editor.domElement.clientWidth-l-a.tagElement.offsetWidth-35-l;(function insertTextContainer(n,i){a.textContainer.style.left="".concat(n,"px"),a.textContainer.style.width="".concat(i,"px"),a.textContainer.style.maxWidth="".concat(i,"px"),a.smartGuideElement.appendChild(a.textContainer)})(l=a.tagElement.offsetWidth,u),function insertEllipsis(n){a.ellipsisElement.style.left="".concat(n,"px"),a.smartGuideElement.appendChild(a.ellipsisElement)}(l+=u),a.menuElement.style.display="none",a.menuElement.appendChild(a.convertElement),a.menuElement.appendChild(a.copyElement),a.menuElement.appendChild(a.deleteElement),a.smartGuideElement.appendChild(a.menuElement),a.candidatesElement.style.display="none",a.smartGuideElement.appendChild(a.candidatesElement),a.smartGuideElement.style.height="48px",a.smartGuideElement.style.width="".concat(a.tagElement.offsetWidth+a.textContainer.offsetWidth+a.ellipsisElement.offsetWidth,"px"),i.perfectScrollbar.update()}(n);var u=function createWordSpan(i,a,s){var c=document.createElement("span");return c.id="word-".concat(a).concat(n.randomString),i?c.innerHTML=" ":c.textContent=s.label,c};if(a&&JSON.parse(a[i.Exports.JIIX]).words.length>0){if(c.smartGuideElement.classList.add("smartguide-in"),c.smartGuideElement.classList.remove("smartguide-out"),c.candidatesElement.style.display="none",c.menuElement.style.display="none",s.previousLabelExport&&s.previousLabelExport!==JSON.parse(a[i.Exports.JIIX]).label){var d=JSON.parse(a[i.Exports.JIIX]).words;!function populatePrompter(n){c.textElement.innerHTML="";var i=document.createDocumentFragment();n.forEach((function(a,l){if(" "===a.label||a.label.includes("\n"))i.appendChild(u(!0,l));else if(l!==n.length-1)i.appendChild(u(!1,l,a));else{c.textElement.appendChild(i),s.perfectScrollbar.update(),""===s.lastWord&&(s.lastWord=a);var d=u(!1,l,a);s.lastWord.candidates!==a.candidates&&s.lastWord.label!==a.label?(d.classList.add("added-word"),c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft,s.lastWord=a):(c.textElement.appendChild(d),c.textContainer.scrollLeft=d.offsetLeft)}}))}(d),function addAnimationToModifiedWord(l){if(s.tempWords&&s.tempWords.length===l.length){var u=l.map((function(n){return n.label})),d=s.tempWords.map((function(n){return n.label})),p=u.indexOf(u.filter((function(n){return-1===d.indexOf(n)}))[0]);document.getElementById("word-".concat(p).concat(n.randomString))&&p>-1&&(document.getElementById("word-".concat(p).concat(n.randomString)).classList.add("modified-word"),c.textContainer.scrollLeft=document.getElementById("word-".concat(p).concat(n.randomString)).offsetLeft-10)}s.tempWords=JSON.parse(a[i.Exports.JIIX]).words}(d)}s.previousLabelExport=JSON.parse(a[i.Exports.JIIX]).label,c.copyElement.setAttribute("data-clipboard-text",JSON.parse(a[i.Exports.JIIX]).label)}else c.smartGuideElement.classList.add("smartguide-out"),c.smartGuideElement.classList.remove("smartguide-in");return s}var xe=function _classCallCheck(n,i){if(!(n instanceof i))throw new TypeError("Cannot call a class as a function")};function _defineProperties(n,i){for(var a=0;a0,i.canRedo=n.currentPosition1&&void 0!==arguments[1])||arguments[1],a=n.stack[n.currentPosition],s=arguments.length,c=new Array(s>2?s-2:0),l=2;l-1)n.stack.splice(s,1,cloneModel(c)),l.debug("model updated",c);else{var d=n;d.currentPosition+=1,d.stack=d.stack.slice(0,d.currentPosition),d.stack.push(cloneModel(c)),d.stack.length>d.maxSize&&(d.stack.shift(),d.currentPosition--),l.debug("model pushed",c),u.push(i.EventType.CHANGED)}return updateUndoRedoState(n),l.debug("undo/redo stack updated",n),getModel.apply(void 0,[n,!1].concat(u))},undo:function undo(n,a){var s=n;return s.currentPosition>0&&(s.currentPosition-=1,updateUndoRedoState(n),l.debug("undo index",s.currentPosition)),getModel(n,!0,i.EventType.CHANGED,i.EventType.EXPORTED)},redo:function redo(n,a){var s=n;return s.currentPosition1&&void 0!==arguments[1]?arguments[1]:10,a=document,s=a.createElement("canvas");return s.width=Math.abs(n.maxX-n.minX)+2*i,s.style.width="".concat(s.width,"px"),s.height=Math.abs(n.maxY-n.minY)+2*i,s.style.height="".concat(s.height,"px"),s}var _e=Object.freeze({__proto__:null,inkImporter:function inkImporter(n,i,a,s){var l=n;c.debug("inkImporter start importing =>",i);var u=Object.assign({},l.behavior.grabber);u.detach=l.behavior.grabber.detach,l.behavior.grabber={};var d=[];i.forEach((function(n){n.convert?d.push({action:"convert",value:!0}):n.setDelay?d.push({action:"setDelay",value:n.setDelay}):(n.color&&d.push({action:"setColor",value:n.color}),n.X.forEach((function(i,a){var s="move";0===a?s="down":a===n.X.length-1&&(s="up"),d.push({action:s,point:{x:n.X[a],y:n.Y[a]}})})))})),c.debug("Array of actions =>",d),function play(n,i,a){if(i2&&void 0!==arguments[2]?arguments[2]:n.configuration.triggers[i];return!(!n.recognizer||!n.recognizer.getInfo().availableTriggers[i].includes(a))||(c.error("".concat(a," is not a valid trigger for ").concat(i)),!1)}function _addStrokes(){return(_addStrokes=G(B.mark((function _callee4(n,i){var a,s,c=arguments;return B.wrap((function _callee4$(l){for(;;)switch(l.prev=l.next){case 0:if(a=c.length>2&&void 0!==c[2]?c[2]:n.configuration.triggers.addStrokes,!n.recognizer||!n.recognizer.addStrokes){l.next=13;break}return l.next=4,n.recognizerContext.initPromise;case 4:if(!l.sent){l.next=13;break}if(!isTriggerValid(n,"addStrokes",a)){l.next=13;break}return l.next=9,manageResetState(n,i);case 9:if(!(s=l.sent)){l.next=12;break}return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,s));case 12:return l.abrupt("return",n.recognizer.addStrokes(n.recognizerContext,i));case 13:return l.abrupt("return",Promise.reject(new Error("Cannot addStrokes")));case 14:case"end":return l.stop()}}),_callee4)})))).apply(this,arguments)}function _launchPointerEvents(){return(_launchPointerEvents=G(B.mark((function _callee5(n,i,a){return B.wrap((function _callee5$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.pointerEvents){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.pointerEvents(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch pointerEvents")));case 7:case"end":return s.stop()}}),_callee5)})))).apply(this,arguments)}function launchExport(n,i,a){return _launchExport.apply(this,arguments)}function _launchExport(){return(_launchExport=G(B.mark((function _callee6(n,a,s){var c,l,u,d,p,h=arguments;return B.wrap((function _callee6$(f){for(;;)switch(f.prev=f.next){case 0:if(c=h.length>3&&void 0!==h[3]?h[3]:n.configuration.triggers.exportContent,!n.recognizer||!n.recognizer.export_){f.next=20;break}return f.next=4,n.recognizerContext.initPromise;case 4:if(!f.sent){f.next=20;break}if(!isTriggerValid(n,"exportContent",c)){f.next=20;break}return l=n,window.clearTimeout(n.exportTimer),u=c===i.Trigger.QUIET_PERIOD?n.configuration.triggerDelay:0,d=delay(u),l.exportTimer=d.timer,f.next=14,d.promise;case 14:return f.next=16,manageResetState(n,a);case 16:if(!(p=f.sent)){f.next=19;break}return f.abrupt("return",n.recognizer.export_(n.recognizerContext,p,s));case 19:return f.abrupt("return",n.recognizer.export_(n.recognizerContext,a,s));case 20:return f.abrupt("return",Promise.reject(new Error("Cannot launch export")));case 21:case"end":return f.stop()}}),_callee6)})))).apply(this,arguments)}function _launchImport(){return(_launchImport=G(B.mark((function _callee7(n,i,a){return B.wrap((function _callee7$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.import_){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.import_(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch import")));case 7:case"end":return s.stop()}}),_callee7)})))).apply(this,arguments)}function _launchGetSupportedImportMimeTypes(){return(_launchGetSupportedImportMimeTypes=G(B.mark((function _callee8(n,i){return B.wrap((function _callee8$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.getSupportedImportMimeTypes){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.getSupportedImportMimeTypes(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch getSupportedImportMimeTypes")));case 7:case"end":return a.stop()}}),_callee8)})))).apply(this,arguments)}function launchConvert(n,i,a){return _launchConvert.apply(this,arguments)}function _launchConvert(){return(_launchConvert=G(B.mark((function _callee9(n,i,a){return B.wrap((function _callee9$(s){for(;;)switch(s.prev=s.next){case 0:if(!n.recognizer||!n.recognizer.convert){s.next=6;break}return s.next=3,n.recognizerContext.initPromise;case 3:if(!s.sent){s.next=6;break}return s.abrupt("return",n.recognizer.convert(n.recognizerContext,i,a));case 6:return s.abrupt("return",Promise.reject(new Error("Cannot launch convert")));case 7:case"end":return s.stop()}}),_callee9)})))).apply(this,arguments)}function launchConfig(n,i){return _launchConfig.apply(this,arguments)}function _launchConfig(){return(_launchConfig=G(B.mark((function _callee10(n,i){return B.wrap((function _callee10$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.sendConfiguration){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.sendConfiguration(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch config")));case 7:case"end":return a.stop()}}),_callee10)})))).apply(this,arguments)}function _launchResize(){return(_launchResize=G(B.mark((function _callee11(n,i){var a,s;return B.wrap((function _callee11$(c){for(;;)switch(c.prev=c.next){case 0:if(!n.recognizer||!n.recognizer.resize){c.next=13;break}return c.next=3,n.recognizerContext.initPromise;case 3:if(!c.sent){c.next=13;break}return a=n,window.clearTimeout(n.resizeTimer),s=delay(n.configuration.resizeTriggerDelay),a.resizeTimer=s.timer,resize$2(n.smartGuide),c.next=12,s.promise;case 12:return c.abrupt("return",n.recognizer.resize(n.recognizerContext,i,n.domElement));case 13:return c.abrupt("return",Promise.reject(new Error("Cannot launch resize")));case 14:case"end":return c.stop()}}),_callee11)})))).apply(this,arguments)}function _launchWaitForIdle(){return(_launchWaitForIdle=G(B.mark((function _callee12(n,i){return B.wrap((function _callee12$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.waitForIdle){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.waitForIdle(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch wait for idle")));case 7:case"end":return a.stop()}}),_callee12)})))).apply(this,arguments)}function _launchClose(){return(_launchClose=G(B.mark((function _callee13(n,i){return B.wrap((function _callee13$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.close){a.next=6;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.close(n.recognizerContext,i));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot launch close")));case 7:case"end":return a.stop()}}),_callee13)})))).apply(this,arguments)}function setPenStyle(n,i){return _setPenStyle.apply(this,arguments)}function _setPenStyle(){return(_setPenStyle=G(B.mark((function _callee14(n,i){return B.wrap((function _callee14$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyle){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyle(n.recognizerContext,i,n.penStyle));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set pentStyle")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee14)})))).apply(this,arguments)}function setPenStyleClasses(n,i){return _setPenStyleClasses.apply(this,arguments)}function _setPenStyleClasses(){return(_setPenStyleClasses=G(B.mark((function _callee15(n,i){return B.wrap((function _callee15$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setPenStyleClasses){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setPenStyleClasses(n.recognizerContext,i,n.penStyleClasses));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set penStyleClasses")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee15)})))).apply(this,arguments)}function setTheme(n,i){return _setTheme.apply(this,arguments)}function _setTheme(){return(_setTheme=G(B.mark((function _callee16(n,i){return B.wrap((function _callee16$(a){for(;;)switch(a.prev=a.next){case 0:if(!n.recognizer||!n.recognizer.setTheme){a.next=7;break}return a.next=3,n.recognizerContext.initPromise;case 3:if(!a.sent){a.next=6;break}return a.abrupt("return",n.recognizer.setTheme(n.recognizerContext,i,n.theme));case 6:return a.abrupt("return",Promise.reject(new Error("Cannot set theme")));case 7:return a.abrupt("return",null);case 8:case"end":return a.stop()}}),_callee16)})))).apply(this,arguments)}var Se=function(){function Editor(n,i,a,s,l,u){xe(this,Editor),u=u||"ms-editor";var d=document.createElement("style");d.appendChild(document.createTextNode("")),n.appendChild(d);var p=d.sheet;d.textContent="/*\n * Container style\n */\n.ps {\n overflow: hidden !important;\n overflow-anchor: none;\n -ms-overflow-style: none;\n touch-action: auto;\n -ms-touch-action: auto;\n}\n/*\n * Scrollbar rail styles\n */\n.ps__rail-x {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n height: 15px;\n /* there must be 'bottom' or 'top' for ps__rail-x */\n bottom: 0px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__rail-y {\n display: none;\n opacity: 0;\n transition: background-color .2s linear, opacity .2s linear;\n -webkit-transition: background-color .2s linear, opacity .2s linear;\n width: 15px;\n /* there must be 'right' or 'left' for ps__rail-y */\n right: 0;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps--active-x > .ps__rail-x,\n.ps--active-y > .ps__rail-y {\n display: block;\n background-color: transparent;\n}\n.ps:hover > .ps__rail-x,\n.ps:hover > .ps__rail-y,\n.ps--focus > .ps__rail-x,\n.ps--focus > .ps__rail-y,\n.ps--scrolling-x > .ps__rail-x,\n.ps--scrolling-y > .ps__rail-y {\n opacity: 0.6;\n}\n.ps .ps__rail-x:hover,\n.ps .ps__rail-y:hover,\n.ps .ps__rail-x:focus,\n.ps .ps__rail-y:focus,\n.ps .ps__rail-x.ps--clicking,\n.ps .ps__rail-y.ps--clicking {\n background-color: #eee;\n opacity: 0.9;\n}\n/*\n * Scrollbar thumb styles\n */\n.ps__thumb-x {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, height .2s ease-in-out;\n -webkit-transition: background-color .2s linear, height .2s ease-in-out;\n height: 6px;\n /* there must be 'bottom' for ps__thumb-x */\n bottom: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__thumb-y {\n background-color: #aaa;\n border-radius: 6px;\n transition: background-color .2s linear, width .2s ease-in-out;\n -webkit-transition: background-color .2s linear, width .2s ease-in-out;\n width: 6px;\n /* there must be 'right' for ps__thumb-y */\n right: 2px;\n /* please don't change 'position' */\n position: absolute;\n}\n.ps__rail-x:hover > .ps__thumb-x,\n.ps__rail-x:focus > .ps__thumb-x,\n.ps__rail-x.ps--clicking .ps__thumb-x {\n background-color: #999;\n height: 11px;\n}\n.ps__rail-y:hover > .ps__thumb-y,\n.ps__rail-y:focus > .ps__thumb-y,\n.ps__rail-y.ps--clicking .ps__thumb-y {\n background-color: #999;\n width: 11px;\n}\n/* MS supports */\n@supports (-ms-overflow-style: none) {\n .ps {\n overflow: auto !important;\n }\n}\n@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {\n .ps {\n overflow: auto !important;\n }\n}\n.ms-editor {\n position: relative;\n z-index: 20;\n color: #1A9FFF;\n font-family: sans-serif;\n}\n.ms-editor.erasing {\n cursor: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEsSURBVDiNrdO7SgNBFMbx/3fmCbQ1tunDIayFBvFSKxbxBfSdBPEBtLIWb3Ebl4R9AQWLkE70CWbHZl1Eg2iSr5vL+c1hhhFTMhwOdyX1gQ2gVU+PgTyldNHtdq+/1+jroCiKtpmdSupNO6ApkgZmdtzpdJ5+QGVZ9qqqugSWfkO+5F3SnrvnDVQURTuE8PgP5DNvkjJ3fzaAEMLJDAjAclVVZwCqL/ZqBqSJme2YpMN5EIAYY9+A9XkhST0DVuaFgJYtAAGoDJgsAJoYkM+rSHqwlNL5Ajq6EMBoNLoBtmbsZuDumwYQYzwCXmdw3oAjAAPIsuxF0kG98GdE0r67PzcQgLvnIYQ14P4PyF39WZuH0rRdZVluxxj7kjaA1Xp6nFLKzezc3W+/13wAItdV6XjME1AAAAAASUVORK5CYII='), auto;\n}\n.ms-editor canvas,\n.ms-editor svg {\n z-index: 15;\n position: absolute;\n left: 0;\n top: 0;\n height: 100%;\n width: 100%;\n}\n.ms-editor canvas.ms-rendering-canvas {\n z-index: 10;\n pointer-events: none;\n background-image: linear-gradient(to right, #F5F6F7 1px, transparent 1px),\n linear-gradient(to bottom, #F5F6F7 1px, transparent 1px);\n background-size: 18px 18px;\n}\n.ms-editor svg {\n z-index: 10;\n pointer-events: none;\n}\n.ms-editor svg[data-layer=\"BACKGROUND\"] {\n z-index: 9;\n}\n.ms-editor .loader {\n z-index: 30;\n position: absolute;\n width: 120px;\n height: 120px;\n top: calc(50% - 60px);\n left: calc(50% - 60px);\n border: 16px solid #F5F6F7;\n border-radius: 50%;\n border-top-color: #1A9FFF;\n -webkit-animation: spin 2s linear infinite;\n animation: spin 2s linear infinite;\n}\n.ms-editor .error-msg {\n z-index: 25;\n position: absolute;\n width: 200px;\n height: 200px;\n top: calc(50% - 100px);\n left: calc(50% - 100px);\n font-size: 16px;\n text-align: center;\n word-wrap: break-word;\n}\n.ms-editor .error-msg::before {\n content: url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCA3Ni41IDYxMiA0NTkiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiPgogICAgPHBhdGggZmlsbD0iIzFBOUZGRiIgZD0iTTQ5NC43LDIyOS41Yy0xNy44NTEtODYuNy05NC4zNTEtMTUzLTE4OC43LTE1M2MtMzguMjUsMC03My45NSwxMC4yLTEwMiwzMC42bDM4LjI1LDM4LjI1IGMxNy44NS0xMi43NSw0MC44LTE3Ljg1LDYzLjc1LTE3Ljg1Yzc2LjUsMCwxNDAuMjUsNjMuNzUsMTQwLjI1LDE0MC4yNXYxMi43NWgzOC4yNWM0My4zNSwwLDc2LjUsMzMuMTUsNzYuNSw3Ni41IGMwLDI4LjA1LTE1LjMsNTMuNTUtNDAuOCw2Ni4zbDM4LjI1LDM4LjI1QzU5MS42LDQzOC42LDYxMiw0MDAuMzUsNjEyLDM1N0M2MTIsMjkwLjcsNTU4LjQ1LDIzNC42LDQ5NC43LDIyOS41eiBNNzYuNSwxMDkuNjUgbDcxLjQsNjguODVDNjYuMywxODMuNiwwLDI0OS45LDAsMzMxLjVjMCw4NC4xNSw2OC44NSwxNTMsMTUzLDE1M2gyOTguMzVsNTEsNTFsMzMuMTUtMzMuMTVMMTA5LjY1LDc2LjVMNzYuNSwxMDkuNjV6IE0xOTYuMzUsMjI5LjVsMjA0LDIwNEgxNTNjLTU2LjEsMC0xMDItNDUuOS0xMDItMTAyYzAtNTYuMSw0NS45LTEwMiwxMDItMTAySDE5Ni4zNXoiIC8+Cjwvc3ZnPgo=);\n}\n.ms-editor .smartguide {\n position: absolute;\n z-index: 40;\n font-size: 16px;\n}\n.ms-editor .smartguide.smartguide-in {\n visibility: visible !important;\n transition: opacity 0.5s;\n opacity: 1;\n}\n.ms-editor .smartguide.smartguide-out {\n transition: opacity 1s, visibility 1s;\n visibility: hidden !important;\n opacity: 0;\n}\n.ms-editor .smartguide .tag-icon {\n padding: 0 18px;\n border: 1px solid #959DA6;\n font-weight: bold;\n font-size: large;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 48px;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n}\n.ms-editor .smartguide .ellipsis {\n cursor: pointer;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 31;\n height: 48px;\n line-height: 38px;\n padding: 0 8px;\n font-weight: bold;\n font-size: x-large;\n background-color: rgba(255, 255, 255, 0.9);\n color: #959DA6;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .ellipsis:active {\n background-color: #e0e0e0;\n}\n.ms-editor .smartguide .prompter-text-container {\n background-color: rgba(255, 255, 255, 0.9);\n height: 48px;\n line-height: 48px;\n overflow: hidden;\n white-space: nowrap;\n display: block;\n text-align: left;\n border-bottom: 1px solid #959DA6;\n position: absolute;\n z-index: 30;\n color: #bfbfbf;\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .prompter-text-container > div > span {\n cursor: pointer;\n display: inline-block;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text {\n margin-left: 12px;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text .added-word {\n animation: 0.1s linear word-added,\n 3s ease-in-out color-input;\n}\n.ms-editor .smartguide .prompter-text-container .prompter-text .modified-word {\n animation: 0.1s linear word-modified,\n 3s ease-in-out color-input;\n}\n.ms-editor .smartguide .candidates {\n color: black;\n flex-direction: column;\n text-align: center;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n box-shadow: 2px 2px 12px #BDBDBD, -2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n z-index: 100;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .candidates > span {\n cursor: pointer;\n padding: 2px 20px;\n}\n.ms-editor .smartguide .candidates > span:hover {\n background-color: #EEEEEE;\n}\n.ms-editor .smartguide .candidates > span:active {\n background-color: #E0E0E0;\n}\n.ms-editor .smartguide .candidates .selected-word {\n font-weight: bold;\n background-color: #E0E0E0;\n}\n.ms-editor .smartguide .more-menu {\n flex-direction: column;\n margin-right: 12px;\n line-height: 30px;\n border-radius: 3px;\n position: absolute;\n z-index: 100;\n box-shadow: 2px 2px 12px #BDBDBD;\n background-color: #F5F5F5;\n}\n.ms-editor .smartguide .more-menu .options-label-button {\n color: black;\n font-size: 16px;\n cursor: pointer;\n box-sizing: border-box;\n background: transparent;\n border: none;\n padding: 0 24px;\n margin: 0;\n height: 40px;\n outline: none;\n -webkit-tap-highlight-color: transparent;\n}\n.ms-editor .smartguide .more-menu .options-label-button:hover {\n background-color: #EEEEEE;\n}\n.ms-editor .smartguide .more-menu .options-label-button:active {\n background-color: #E0E0E0;\n}\n.ms-editor .ps__rail-x {\n top: 32px !important;\n}\n/** Stroke **/\n.ms-editor .removed-stroke {\n opacity: 0;\n transition: opacity 0.1s ease-in-out;\n}\n.ms-editor .added-stroke {\n animation: 0.2s opacity-appear;\n}\n@keyframes color-input {\n 0% {\n color: black;\n }\n 100% {\n color: #bfbfbf;\n }\n}\n@keyframes word-added {\n 0% {\n transform: translate(5px, 0);\n }\n 100% {\n transform: none;\n }\n}\n@keyframes word-modified {\n 0% {\n transform: translate(0, 5px);\n }\n 100% {\n transform: none;\n }\n}\n@keyframes opacity-appear {\n 0% {\n opacity: 0;\n }\n 100% {\n opacity : 1;\n }\n}\n@keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n@-webkit-keyframes spin {\n 0% {\n -webkit-transform: rotate(0deg);\n }\n 100% {\n -webkit-transform: rotate(360deg);\n }\n}\n",this.sheet=p,this.domElement=n,this.domElement.classList.add(u),this.loader=document.createElement("div"),this.loader.classList.add("loader"),this.loader=this.domElement.appendChild(this.loader),this.error=document.createElement("div"),this.error.classList.add("error-msg"),this.error=this.domElement.appendChild(this.error),this.exportTimer=void 0,this.resizeTimer=void 0,this.notifyTimer=void 0,this.innerBehaviors=function overrideDefaultBehaviors(n){if(n){var i={grabber:n.grabber||Ue.grabber,rendererList:n.rendererList||Ue.rendererList,strokerList:n.strokerList||Ue.strokerList,recognizerList:n.recognizerList||Ue.recognizerList,events:n.events||Ue.events,getBehaviorFromConfiguration:n.getBehaviorFromConfiguration||Ue.getBehaviorFromConfiguration};return c.debug("Override default behaviors",i),i}return Ue}(l),this.configuration=i,this.localTheme="",this.theme=s,this.penStyle=a,this.penStyleClasses="",this.isErasing=!1,this.domElement.editor=this}var n,a;return we(Editor,[{key:"enableEraser",value:function enableEraser(){this.isErasing=!0,this.domElement.classList.add("erasing")}},{key:"disableEraser",value:function disableEraser(){document.body.style.cursor="initial",this.isErasing=!1,this.domElement.classList.remove("erasing")}},{key:"pointerDown",value:function pointerDown(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"pen",a=arguments.length>2?arguments[2]:void 0;c.trace("Pointer down",n),window.clearTimeout(this.notifyTimer),window.clearTimeout(this.exportTimer),this.model=initPendingStroke(this.model,n,Object.assign({pointerType:i,pointerId:a},this.theme.ink,this.localPenStyle)),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerMove",value:function pointerMove(n){c.trace("Pointer move",n),this.model=appendToPendingStroke(this.model,n),this.isErasing||this.renderer.drawCurrentStroke(this.rendererContext,this.model,this.stroker)}},{key:"pointerUp",value:function pointerUp(n){c.trace("Pointer up",n),this.model=endPendingStroke(this.model,n,this.penStyle),this.isErasing||this.renderer.drawModel(this.rendererContext,this.model,this.stroker),this.recognizer.addStrokes?function addStrokes(n,i){return _addStrokes.apply(this,arguments)}(this,this.model):handleSuccess(this,this.model)}},{key:"removeStroke",value:function removeStroke(n){this.model.strokeGroups.forEach((function(i){var a=i.strokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==a&&i.strokes.splice(a,1)}));var i=this.model.rawStrokes.map((function(n){return JSON.stringify(n)})).indexOf(JSON.stringify(n));-1!==i&&this.model.rawStrokes.splice(i,1),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model),"DEMAND"!==this.configuration.triggers.exportContent&&launchExport(this,this.model)}},{key:"reDraw",value:function reDraw(n,i){var a=this;n.forEach((function(n){addStroke(a.model,n)})),i.forEach((function(n){n.strokes.forEach((function(i){addStrokeToGroup(a.model,i,n.penStyle)}))})),this.renderer.drawModel(this.rendererContext,this.model,this.stroker),handleSuccess(this,this.model)}},{key:"waitForIdle",value:function waitForIdle(){return emitEvents(this,void 0,i.EventType.IDLE),function launchWaitForIdle(n,i){return _launchWaitForIdle.apply(this,arguments)}(this,this.model)}},{key:"undo",value:(a=G(B.mark((function _callee(){var n,a,s,l=this;return B.wrap((function _callee$(u){for(;;)switch(u.prev=u.next){case 0:return c.debug("Undo current model",this.model),emitEvents(this,void 0,i.EventType.UNDO),u.next=4,this.undoRedoManager.undo(this.undoRedoContext,this.model).catch((function(n){return handleError(l,n)}));case 4:return n=u.sent,a=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,a].concat(R(s))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee,this)}))),function undo(){return a.apply(this,arguments)})},{key:"redo",value:(n=G(B.mark((function _callee2(){var n,a,s,l=this;return B.wrap((function _callee2$(u){for(;;)switch(u.prev=u.next){case 0:return c.debug("Redo current model",this.model),emitEvents(this,void 0,i.EventType.REDO),u.next=4,this.undoRedoManager.redo(this.undoRedoContext,this.model).catch((function(n){return handleError(l,n)}));case 4:return n=u.sent,a=n.res,s=n.types,manageRecognizedModel.apply(void 0,[this,a].concat(R(s))),u.abrupt("return",a);case 9:case"end":return u.stop()}}),_callee2,this)}))),function redo(){return n.apply(this,arguments)})},{key:"clear",value:function(){var n=G(B.mark((function _callee3(){var n,a,s,l=this;return B.wrap((function _callee3$(u){for(;;)switch(u.prev=u.next){case 0:if(!this.canClear){u.next=10;break}return c.debug("Clear current model",this.model),emitEvents(this,void 0,i.EventType.CLEAR),u.next=5,this.recognizer.clear(this.recognizerContext,this.model).catch((function(n){return handleError(l,n)}));case 5:return n=u.sent,a=n.res,s=n.events,handleSuccess.apply(void 0,[this,a].concat(R(s))),u.abrupt("return",a);case 10:return u.abrupt("return",Promise.reject(new Error("Cannot launch clear")));case 11:case"end":return u.stop()}}),_callee3,this)})));return function clear(){return n.apply(this,arguments)}}()},{key:"convert",value:function convert(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"DIGITAL_EDIT";return this.canConvert?(emitEvents(this,void 0,i.EventType.CONVERT),launchConvert(this,this.model,n)):Promise.reject(new Error("Cannot launch convert"))}},{key:"setGuides",value:function setGuides(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.configuration.recognitionParams.iink.text.guides.enable=n,launchConfig(this,this.model)}},{key:"export_",value:function export_(n){return this.canExport?(emitEvents(this,void 0,i.EventType.EXPORT),launchExport(this,this.model,n,i.Trigger.DEMAND)):Promise.reject(new Error("Cannot launch export"))}},{key:"import_",value:function import_(n,a){return emitEvents(this,void 0,i.EventType.IMPORT),function launchImport(n,i,a){return _launchImport.apply(this,arguments)}(this,this.model,n instanceof Blob?n:new Blob([n],{type:a}))}},{key:"getSupportedImportMimeTypes",value:function getSupportedImportMimeTypes(){return function launchGetSupportedImportMimeTypes(n,i){return _launchGetSupportedImportMimeTypes.apply(this,arguments)}(this,this.model)}},{key:"pointerEvents",value:function pointerEvents(n){return function launchPointerEvents(n,i,a){return _launchPointerEvents.apply(this,arguments)}(this,this.model,n)}},{key:"resize",value:function resize(){return c.debug("Resizing editor"),this.renderer.resize(this.rendererContext,this.model,this.stroker,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth),function launchResize(n,i){return _launchResize.apply(this,arguments)}(this,this.model)}},{key:"unload",value:function unload(){this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext)}},{key:"close",value:function close(){return this.configuration.recognitionParams.protocol===i.Protocol.WEBSOCKET?function launchClose(n,i){return _launchClose.apply(this,arguments)}(this,this.model):null}},{key:"forceChange",value:function forceChange(){emitEvents(this,void 0,i.EventType.CHANGED)}},{key:"configuration",set:function set(n){this.loader.style.display="initial",this.error.style.display="none",this.innerConfiguration=function overrideDefaultConfiguration(n){var i,a=n;return a&&a.recognitionParams.server&&a.recognitionParams.server.useWindowLocation?(a.recognitionParams.server.scheme=window.location.protocol.slice(0,-1),a.recognitionParams.server.host=window.location.host,i=f({},g,void 0===a?{}:a)):i=f({},g,void 0===n?{}:n),c.debug("Override default configuration",i),i}(n),this.behavior=this.behaviors.getBehaviorFromConfiguration(this.behaviors,this.innerConfiguration),this.smartGuide?function reset(n){var i=n.elements;i.candidatesElement.innerHTML="",i.smartGuideElement.classList.add("smartguide-out"),i.smartGuideElement.classList.remove("smartguide-in")}(this.smartGuide):this.smartGuide=createSmartGuide(this)},get:function get(){return this.innerConfiguration}},{key:"penStyle",set:function set(n){this.innerPenStyle=function overrideDefaultPenStyle(n){var i=f({},y,void 0===n?{}:n);return c.debug("Override default pen style",i),i}(n),this.localPenStyle=this.innerPenStyle,setPenStyle(this,this.model)},get:function get(){return this.innerPenStyle}},{key:"penStyleClasses",set:function set(n){this.innerPenStyleClasses=n,this.localPenStyle=this.theme[".".concat(this.innerPenStyleClasses)],setPenStyleClasses(this,this.model)},get:function get(){return this.innerPenStyleClasses}},{key:"theme",set:function set(n){this.innerTheme=function overrideDefaultTheme(n){var i=f({},x,void 0===n?{}:n);return c.debug("Override default theme",i),i}(n),setTheme(this,this.model)},get:function get(){return this.innerTheme}},{key:"behaviors",get:function get(){return this.innerBehaviors}},{key:"behavior",set:function set(n){n&&(this.grabber&&this.grabber.detach(this.domElement,this.grabberContext),this.innerBehavior=n,this.renderer=this.innerBehavior.renderer,this.recognizer=this.innerBehavior.recognizer,this.grabberContext=this.grabber.attach(this.domElement,this))},get:function get(){return this.innerBehavior}},{key:"recognizer",set:function set(n){var i=this;this.undoRedoContext=function createUndoRedoContext(n){return{stack:[],currentPosition:-1,maxSize:n.undoRedoMaxStackSize,canUndo:!1,canRedo:!1}}(this.configuration),this.undoRedoManager=Ee;var a=function initialize(a,s){i.innerRecognizer=n,i.innerRecognizer&&(i.recognizerContext=createEmptyRecognizerContext(i),i.innerRecognizer.undo&&i.innerRecognizer.redo&&i.innerRecognizer.clear&&(i.undoRedoContext=i.recognizerContext,i.undoRedoManager=i.innerRecognizer),i.innerRecognizer.init(i.recognizerContext,a).then((function(n){c.info("Recognizer initialized !"),s&&(setTheme(i,i.model),setPenStyle(i,i.model),setPenStyleClasses(i,i.model)),i.loader.style.display="none"})).catch((function(n){return handleError(i,n)})))};n&&(this.innerRecognizer?this.innerRecognizer.close(this.recognizerContext,this.model).then((function(n){c.info("Recognizer closed"),handleSuccess(i,n),a(clearModel(n),!0)})).catch((function(n){return handleError(i,n)})):(this.model=createModel(this.configuration),a(this.model,!1)))},get:function get(){return this.innerRecognizer}},{key:"renderer",set:function set(n){n&&(this.innerRenderer&&this.innerRenderer.detach(this.domElement,this.rendererContext),this.innerRenderer=n,this.innerRenderer&&(this.rendererContext=this.innerRenderer.attach(this.domElement,this.configuration.renderingParams.minHeight,this.configuration.renderingParams.minWidth)))},get:function get(){return this.innerRenderer}},{key:"grabber",get:function get(){return this.behavior?this.behavior.grabber:void 0}},{key:"stroker",get:function get(){return this.behavior?this.behavior.stroker:void 0}},{key:"emit",get:function get(){return this.behavior?this.behavior.events:void 0}},{key:"png",get:function get(){return function getImage(n,i){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(n.rawStrokes.length>0){var s=getBorderCoordinates(n),c=createCanvas$1(s,a),l=createCanvas$1(s,a),u={renderingCanvas:l,renderingCanvasContext:l.getContext("2d"),capturingCanvas:c,capturingCanvasContext:c.getContext("2d")};return u.renderingCanvasContext.translate(-s.minX+a,-s.minY+a),drawModel(u,n,i),u.renderingCanvas.toDataURL("image/png")}return null}(this.model,this.stroker)}},{key:"initialized",get:function get(){return!!this.recognizerContext&&this.recognizerContext.initialized}},{key:"idle",get:function get(){return this.recognizerContext.idle}},{key:"canUndo",get:function get(){return this.undoRedoContext.canUndo}},{key:"canRedo",get:function get(){return this.undoRedoContext.canRedo}},{key:"isEmpty",get:function get(){return this.recognizerContext.isEmpty}},{key:"canClear",get:function get(){return!this.isEmpty}},{key:"canConvert",get:function get(){return!!(this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.convert)}},{key:"possibleUndoCount",get:function get(){return this.recognizerContext.possibleUndoCount}},{key:"undoStackIndex",get:function get(){return this.recognizerContext.undoStackIndex}},{key:"canExport",get:function get(){return this.canUndo&&this.canClear&&this.recognizer&&this.recognizer.getInfo().availableTriggers.exportContent.includes(i.Trigger.DEMAND)}},{key:"exports",get:function get(){return this.model?this.model.exports:void 0}},{key:"supportedImportMimeTypes",get:function get(){return this.recognizerContext.supportedImportMimeTypes}},{key:"eastereggs",get:function get(){return _e}}]),Editor}();function emitEvents(n,a){for(var s=n,c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?l-2:0),d=2;d=n.model.lastPositions.lastReceivedPosition?(s.model=mergeModels(s.model,c),(needRedraw(s.model)||u.includes(i.EventType.RENDERED))&&n.renderer.drawModel(n.rendererContext,s.model,n.stroker)):(s.model=c,n.renderer.drawModel(n.rendererContext,s.model,n.stroker)),emitEvents.apply(void 0,[n,void 0].concat(u))),"TEXT"===n.configuration.recognitionParams.type&&"REST"!==n.configuration.recognitionParams.protocol&&n.configuration.recognitionParams.iink.text.mimeTypes.includes(i.Exports.JIIX)&&n.configuration.recognitionParams.iink.text.smartGuide&&(s.smartGuide=launchSmartGuide(n.smartGuide,c.exports)),extractPendingStrokes(a).length>0&&!n.recognizer.addStrokes&&n.configuration.triggers.exportContent!==i.Trigger.DEMAND&&launchExport(n,a)}function handleError(n,a){var s=n;if("close"!==a.type&&p.error("Error while firing the recognition",a.stack||a),"Invalid application key."===a.message||"Invalid HMAC"===a.message||a.error&&a.error.result&&a.error.result.error&&("InvalidApplicationKeyException"===a.error.result.error||"InvalidHMACSignatureException"===a.error.result.error)||a.code&&"access.not.granted"===a.code?s.error.innerText=i.Error.WRONG_CREDENTIALS:a.code&&"no.activity"===a.code?s.error.innerText=i.Error.NO_ACTIVITY:"Session is too old. Max Session Duration Reached."===a.message||a.code&&"session.too.old"===a.code?s.error.innerText=i.Error.TOO_OLD:1006!==a.code&&1e3!==a.code||"none"!==s.error.style.display||(s.error.innerText=i.Error.NOT_REACHABLE),s.error.innerText!==i.Error.TOO_OLD&&"CLOSE_RECOGNIZER"!==a.reason||!canReconnect(n.recognizerContext)){s.loader.style.display="none",s.error.style.display="initial";for(var c=arguments.length,l=new Array(c>2?c-2:0),u=2;u2?a-2:0),c=2;c4&&void 0!==arguments[4]?arguments[4]:"",l=arguments.length>5?arguments[5]:void 0,u=i.editor.configuration;return post(i,"".concat(u.recognitionParams.server.scheme,"://").concat(u.recognitionParams.server.host).concat(n),s(i,a,c),"V4",l).then((function(n){p.debug("iinkRestRecognizer success",n);var a=i.lastPositions;a.lastReceivedPosition=a.lastSentPosition;var s=updateRecognitionPositions(i,a);return n.instanceId&&(s.instanceId=n.instanceId),n}))}function buildData(n,i,a){var s,c=n.editor.configuration;"TEXT"===c.recognitionParams.type?s=function buildTextConf(n){return{text:n.recognitionParams.iink.text,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"MATH"===c.recognitionParams.type?s=function buildMathConf(n){return{math:n.recognitionParams.iink.math,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"DIAGRAM"===c.recognitionParams.type?s=function buildDiagramConf(n){return{diagram:n.recognitionParams.iink.diagram,lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c):"Raw Content"===c.recognitionParams.type&&(s=function buildRawContentConf(n){return{"raw-content":{recognition:n.recognitionParams.iink["raw-content"].recognition},lang:n.recognitionParams.iink.lang,export:n.recognitionParams.iink.export}}(c));var l=[];i.strokeGroups.forEach((function(n){var i={penStyle:"{}"===JSON.stringify(n.penStyle)?null:toCSS(n.penStyle),strokes:n.strokes.map((function(n){return function toJSON(n){return{x:n.x,y:n.y,t:n.t,pointerType:n.pointerType}}(n)}))};l.push(i)}));var u={configuration:s,xDPI:96,yDPI:96,contentType:"Raw Content"===c.recognitionParams.type?"Raw Content":c.recognitionParams.type.charAt(0).toUpperCase()+c.recognitionParams.type.slice(1).toLowerCase(),theme:toCSS$1(n.editor.theme),strokeGroups:l};return n.editor.domElement&&(u.height=n.editor.domElement.clientHeight,u.width=n.editor.domElement.clientWidth),a&&(u.conversionState="DIGITAL_EDIT"),updateModelSentPosition(i),u}function extractExports(n,i,a){var s={};return s[i]=a,s}function resultCallback(n,a,s,c,l){p.debug("iinkRestRecognizer result callback",a);var u=updateModelReceivedPosition(a);u.rawResults.exports=c,u.exports?Object.assign(u.exports,extractExports(0,l,c)):u.exports=extractExports(0,l,c),p.debug("iinkRestRecognizer model updated",u),n.editor.undoRedoManager&&handleSuccess(n.editor,u,i.EventType.EXPORTED,i.EventType.IDLE)}function callPostMessage(n,i,a){var s=n.editor.configuration;return postMessage("/api/v4.0/iink/batch",n,i,buildData,s.restConversionState,a).then((function(s){return resultCallback(n,i,0,s,a),i})).catch((function(i){return handleError(n.editor,i),i}))}function export_(n,i,a){var s=n.editor.configuration;return a?Promise.all(a.map((function(a){return callPostMessage(n,i,a)}))):"TEXT"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.text.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"DIAGRAM"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.diagram.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"MATH"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink.math.mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):"Raw Content"===s.recognitionParams.type?Promise.all(s.recognitionParams.iink["raw-content"].mimeTypes.map((function(a){return callPostMessage(n,i,a)}))):Promise.reject(new Error("Export failed"))}var Ce=Object.freeze({__proto__:null,iinkRestConfiguration:ke,getInfo:function getInfo$4(){return ke},postMessage:postMessage,export_:export_,convert:function convert(n,i){var a=n.editor.configuration;postMessage("/api/v4.0/iink/batch",n,i,buildData,"DIGITAL_EDIT").then((function(n){return resultCallback(i,a)})).catch((function(i){return handleError(n.editor,i)}))},resize:function resize$3(n,i){i.strokeGroups.length&&export_(n,i)},init:function init(n,a){var s=resetModelPositions(a);p.debug("Updated model",s);var c=updateRecognitionPositions(n,s.lastPositions);return c.initPromise=Promise.resolve(s),c.initPromise.then((function(n){return c.initialized=!0,p.debug("Updated recognizer context",c),handleSuccess(c.editor,n,i.EventType.LOADED),n}))},close:function close(n,i){var a=n;return a.initialized=!1,delete a.instanceId,Promise.resolve(i)},clear:clear,reset:function reset$1(n,i){var a=resetModelPositions(i);p.debug("Updated model",a);var s=updateRecognitionPositions(n,a.lastPositions);return delete s.instanceId,p.debug("Updated recognizer context",s),Promise.resolve({res:a})}});var Pe=function _arrayWithHoles(n){if(Array.isArray(n))return n};var Ie=function _iterableToArrayLimit(n,i){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(n)){var a=[],s=!0,c=!1,l=void 0;try{for(var u,d=n[Symbol.iterator]();!(s=(u=d.next()).done)&&(a.push(u.value),!i||a.length!==i);s=!0);}catch(n){c=!0,l=n}finally{try{s||null==d.return||d.return()}finally{if(c)throw l}}return a}};var Te=function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var Me=function _slicedToArray(n,i){return Pe(n)||Ie(n,i)||T(n,i)||Te()};function UUIDjs(){}function getRandomInt(n,i){return Math.floor(Math.random()*(i-n+1))+n}UUIDjs.maxFromBits=function(n){return Math.pow(2,n)},UUIDjs.limitUI04=UUIDjs.maxFromBits(4),UUIDjs.limitUI06=UUIDjs.maxFromBits(6),UUIDjs.limitUI08=UUIDjs.maxFromBits(8),UUIDjs.limitUI12=UUIDjs.maxFromBits(12),UUIDjs.limitUI14=UUIDjs.maxFromBits(14),UUIDjs.limitUI16=UUIDjs.maxFromBits(16),UUIDjs.limitUI32=UUIDjs.maxFromBits(32),UUIDjs.limitUI40=UUIDjs.maxFromBits(40),UUIDjs.limitUI48=UUIDjs.maxFromBits(48),UUIDjs.randomUI04=function(){return getRandomInt(0,UUIDjs.limitUI04-1)},UUIDjs.randomUI06=function(){return getRandomInt(0,UUIDjs.limitUI06-1)},UUIDjs.randomUI08=function(){return getRandomInt(0,UUIDjs.limitUI08-1)},UUIDjs.randomUI12=function(){return getRandomInt(0,UUIDjs.limitUI12-1)},UUIDjs.randomUI14=function(){return getRandomInt(0,UUIDjs.limitUI14-1)},UUIDjs.randomUI16=function(){return getRandomInt(0,UUIDjs.limitUI16-1)},UUIDjs.randomUI32=function(){return getRandomInt(0,UUIDjs.limitUI32-1)},UUIDjs.randomUI40=function(){return(0|Math.random()*(1<<30))+(0|1024*Math.random())*(1<<30)},UUIDjs.randomUI48=function(){return(0|Math.random()*(1<<30))+(0|Math.random()*(1<<18))*(1<<30)},UUIDjs.paddedString=function(n,i,a){a=a||"0";for(var s=i-(n=String(n)).length;s>0;s>>>=1,a+=a)1&s&&(n=a+n);return n},UUIDjs.prototype.fromParts=function(n,i,a,s,c,l){return this.version=a>>12&15,this.hex=UUIDjs.paddedString(n.toString(16),8)+"-"+UUIDjs.paddedString(i.toString(16),4)+"-"+UUIDjs.paddedString(a.toString(16),4)+"-"+UUIDjs.paddedString(s.toString(16),2)+UUIDjs.paddedString(c.toString(16),2)+"-"+UUIDjs.paddedString(l.toString(16),12),this},UUIDjs.prototype.toString=function(){return this.hex},UUIDjs.prototype.toURN=function(){return"urn:uuid:"+this.hex},UUIDjs.prototype.toBytes=function(){for(var n=this.hex.split("-"),i=[],a=0,s=0;s>>16,timestamp:i}},UUIDjs._create4=function(){return(new UUIDjs).fromParts(UUIDjs.randomUI32(),UUIDjs.randomUI16(),16384|UUIDjs.randomUI12(),128|UUIDjs.randomUI06(),UUIDjs.randomUI08(),UUIDjs.randomUI48())},UUIDjs._create1=function(){var n=(new Date).getTime(),i=UUIDjs.randomUI14(),a=1099511627776*(1|UUIDjs.randomUI08())+UUIDjs.randomUI40(),s=UUIDjs.randomUI04(),c=0;n!=c?(n>>8|128,h=255&i;return(new UUIDjs).fromParts(u,l.mid,d,p,h,a)},UUIDjs.create=function(n){return this["_create"+(n=n||4)]()},UUIDjs.fromTime=function(n,i){i=i||!1;var a=UUIDjs.getTimeFieldValues(n),s=a.low,c=4095&a.hi|4096;return!1===i?(new UUIDjs).fromParts(s,a.mid,c,0,0,0):(new UUIDjs).fromParts(s,a.mid,c,128|UUIDjs.limitUI06,UUIDjs.limitUI08-1,UUIDjs.limitUI48-1)},UUIDjs.firstFromTime=function(n){return UUIDjs.fromTime(n,!1)},UUIDjs.lastFromTime=function(n){return UUIDjs.fromTime(n,!0)},UUIDjs.fromURN=function(n){var i;return(i=/^(?:urn:uuid:|\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\})?$/i.exec(n))?(new UUIDjs).fromParts(parseInt(i[1],16),parseInt(i[2],16),parseInt(i[3],16),parseInt(i[4],16),parseInt(i[5],16),parseInt(i[6],16)):null},UUIDjs.fromBytes=function(n){if(n.length<5)return null;for(var i="",a=0,s=[4,2,2,2,6],c=0;c255||i[a]<0)throw new Error("Unexpected byte in binary data.");return UUIDjs.fromBytes(i)},UUIDjs.new=function(){return this.create(4)},UUIDjs.newTS=function(){return this.create(1)};var Re=UUIDjs;function openWebSocket(n){var i;try{i=new WebSocket(n.url)}catch(n){p.error("Unable to open websocket, Check the host and your connectivity")}return function addWebsocketAttributes(n,i){var a=i.editor.configuration.recognitionParams.server.websocket,s=n;s.start=new Date,s.autoReconnect=a.autoReconnect,s.maxRetryCount=a.maxRetryCount,s.pingEnabled=a.pingEnabled,s.pingDelay=a.pingDelay,s.maxPingLost=a.maxPingLostCount,s.pingLostCount=0,s.recognizerContext=i}(i,n),i.pingEnabled&&function infinitePing(n){var i=n;i.pingLostCount++,i.pingLostCount>i.maxPingLost?n.close(1e3,"PING_LOST"):i.readyState<=1&&setTimeout((function(){i.readyState<=1&&(i.send(JSON.stringify({type:"ping"})),infinitePing(i))}),i.pingDelay)}(i),i.onopen=function(i){p.trace("onOpen"),n.websocketCallback(i)},i.onclose=function(a){p.trace("onClose",new Date-i.start),n.websocketCallback(a)},i.onerror=function(i){p.trace("onError"),n.websocketCallback(i)},i.onmessage=function(a){if(p.trace("onMessage"),i.pingLostCount=0,"pong"!==JSON.parse(a.data).type){var s={type:a.type,data:JSON.parse(a.data)};n.websocketCallback(s)}},i}function send(n,i){var a=n;a.idle=!1;var s=a.websocket;if(1!==s.readyState)throw K;s.send(JSON.stringify(i)),p.debug("".concat(i.type," message sent"),i)}function buildWebSocketCallback(n){return function(i){var a=n;p.trace("".concat(i.type," websocket callback"),i);var s=n.recognitionContexts[n.recognitionContexts.length-1];switch(p.debug("Current recognition context",s),i.type){case"open":n.sessionId?send(n,buildRestoreIInkSessionInput(n.editor.configuration,n.editor.domElement,n.sessionId)):send(n,buildNewContentPackageInput(n.editor.configuration,n.editor.domElement));break;case"message":switch(p.debug("Receiving ".concat(i.data.type," message"),i),i.data.type){case"ack":i.data.hmacChallenge&&send(n,function buildHmacMessage(n,i){return{type:"hmac",hmac:computeHmac(i.data.hmacChallenge,n.recognitionParams.server.applicationKey,n.recognitionParams.server.hmacKey)}}(n.editor.configuration,i)),i.data.iinkSessionId&&(a.sessionId=i.data.iinkSessionId);break;case"newPart":break;case"contentPackageDescription":a.currentReconnectionCount=0,a.contentPartCount=i.data.contentPartCount,send(n,buildConfiguration(n.editor.configuration)),a.currentPartId?send(n,buildOpenContentPart(n.editor.configuration,n.currentPartId)):send(n,buildNewContentPart(n.editor.configuration));break;case"partChanged":i.data.partId&&(a.currentPartId=i.data.partId),a.initialized=!0,s.partChange?s.partChange.resolve([void 0,i.data]):s.error(i);break;case"contentChanged":void 0!==i.data.canUndo&&(a.canUndo=i.data.canUndo),void 0!==i.data.canRedo&&(a.canRedo=i.data.canRedo),void 0!==i.data.empty&&(a.isEmpty=i.data.empty),void 0!==i.data.possibleUndoCount&&(a.possibleUndoCount=i.data.possibleUndoCount),void 0!==i.data.undoStackIndex&&(a.undoStackIndex=i.data.undoStackIndex),s.contentChange.resolve([void 0,i.data]);break;case"exported":s.response(void 0,i.data);break;case"svgPatch":s.patch(void 0,i.data);break;case"supportedImportMimeTypes":a.supportedImportMimeTypes=i.data.mimeTypes,s.response(void 0,i.data);break;case"fileChunkAck":s.response(void 0,i.data);break;case"idle":a.idle=!0,s.patch(void 0,i.data);break;case"error":if(p.debug("Error detected stopping all recognition",i),s){var c=function func(){};s.patch?c=s.patch:s.response&&(c=s.response),c(i.data)}else s.initPromise.reject(Object.assign({},i.data,{recoverable:!1}));break;default:p.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}break;case"error":if(p.debug("Error detected stopping all recognition",i),s){var l=function _func(){};s.patch?l=s.patch:s.response&&(l=s.response),l(Object.assign({},i,{recoverable:!1}))}else s.initPromise.reject(Object.assign({},i,{recoverable:!1}));break;case"close":p.debug("Close detected stopping all recognition",i),a.initialized=!1,"CLOSE_RECOGNIZER"===i.reason?s.initPromise.resolve(i):s?s.error(i):s.initPromise.reject(i);break;default:p.warn("This is something unexpected in current recognizer. Not the type of message we should have here.",i)}}}function init$1(n,i,a,s){var c=i.recognitionContexts[0],l=updateRecognitionPositions(i,c.model.lastPositions);return l.url=function buildUrl(n,i){var a="https"===n.recognitionParams.server.scheme?"wss":"ws";return"".concat(a,"://").concat(n.recognitionParams.server.host).concat(i)}(i.editor.configuration,n),l.reconnect=s,l.initPromise=c.initPromise.promise,p.debug("Opening the websocket for context ",i),l.websocketCallback=a(l),l.websocket=openWebSocket(l),l.initPromise}function retry(n,i,a,s){return _retry.apply(this,arguments)}function _retry(){return(_retry=G(B.mark((function _callee(n,i,a,s){var c,l,u,d=arguments;return B.wrap((function _callee$(h){for(;;)switch(h.prev=h.next){case 0:for(c=d.length,l=new Array(c>4?c-4:0),u=4;u2?a-2:0),c=2;c0)return updateModelSentPosition(i),{type:"addStrokes",strokes:a.map((function(n){return Object.assign({},{id:n.id,pointerType:n.pointerType,pointerId:n.pointerId,x:n.x,y:n.y,t:n.t,p:n.p})}))}}function buildUndo(){return{type:"undo"}}function buildRedo(){return{type:"redo"}}function buildClear(){return{type:"clear"}}function buildConvert(n){return{type:"convert",conversionState:n}}function buildZoom(n){return{type:"zoom",zoom:n}}function buildResize(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return{type:"changeViewSize",height:n.clientHeight3?c-3:0),u=3;ua.size];u.push(_prepareMessage.apply(void 0,[c,i,buildImportChunk].concat(p)))}))},p=0;p2&&void 0!==arguments[2]?arguments[2]:10;return _prepareMessage(n,i,buildZoom,a)},setPenStyle:setPenStyle$1,setPenStyleClasses:setPenStyleClasses$1,setTheme:setTheme$1,close:close$2});var Ue={grabber:k,strokerList:[U,H],rendererList:[j,X],recognizerList:[Ce,je],events:function emit(n,i){h.info("emitting ".concat(n," event"),i),this.dispatchEvent(new CustomEvent(n,Object.assign({bubbles:!0,composed:!0},i?{detail:i}:void 0)))},getBehaviorFromConfiguration:function getBehaviorFromConfiguration(n,i){var a={};return a.grabber=n.grabber,i&&("REST"===i.recognitionParams.protocol?(a.stroker=U,a.renderer=j,a.recognizer=Ce):(a.stroker=H,a.renderer=X,a.recognizer=je)),a.events=n.events,a}};function register(n,i,a,s,l,u){return c.debug("Registering a new editor"),new Se(n,i,a,s,l,u)}function getAvailableLanguageList(n){return _getAvailableLanguageList.apply(this,arguments)}function _getAvailableLanguageList(){return(_getAvailableLanguageList=G(B.mark((function _callee(n){var i,a;return B.wrap((function _callee$(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,!(n&&n.recognitionParams&&n.recognitionParams.server&&n.recognitionParams.server.host)){s.next=10;break}return i=n.recognitionParams.server,s.next=5,fetch("".concat(i.scheme,"://").concat(i.host,"/api/v4.0/iink/availableLanguageList"));case 5:if(!(a=s.sent)||!a.ok){s.next=8;break}return s.abrupt("return",a.json());case 8:s.next=11;break;case 10:console.error("Cannot get languages ! Please check your configuration!");case 11:s.next=16;break;case 13:s.prev=13,s.t0=s.catch(0),console.error(s.t0);case 16:case"end":return s.stop()}}),_callee,null,[[0,13]])})))).apply(this,arguments)}var Oe={Constants:i,DefaultConfiguration:g,DefaultBehaviors:Ue,DefaultPenStyle:y,DefaultTheme:x,register:register,getAvailableLanguageList:getAvailableLanguageList,LoggerConfig:s,Editor:Se,InkModel:D,RecognizerContext:Z};n.Constants=i,n.DefaultBehaviors=Ue,n.DefaultConfiguration=g,n.DefaultPenStyle=y,n.DefaultTheme=x,n.Editor=Se,n.InkModel=D,n.LoggerConfig=s,n.RecognizerContext=Z,n.default=Oe,n.getAvailableLanguageList=getAvailableLanguageList,n.register=register,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=iink.min.js.map diff --git a/dist/iink.min.js.map b/dist/iink.min.js.map index 3e7903bc..7522c769 100644 --- a/dist/iink.min.js.map +++ b/dist/iink.min.js.map @@ -1 +1 @@ -{"version":3,"file":"iink.min.js","sources":["../src/configuration/Constants.js","../node_modules/loglevel/lib/loglevel.js","../src/configuration/LoggerConfig.js","../node_modules/lodash.merge/index.js","../src/configuration/DefaultConfiguration.js","../node_modules/json-css/lib/jsoncss.min.js","../src/configuration/DefaultPenStyle.js","../src/configuration/DefaultTheme.js","../src/grabber/PointerEventGrabber.js","../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../node_modules/@babel/runtime/helpers/iterableToArray.js","../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../node_modules/@babel/runtime/helpers/toConsumableArray.js","../src/renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js","../src/renderer/canvas/symbols/ShapeSymbolCanvasRenderer.js","../src/renderer/canvas/symbols/TextSymbolCanvasRenderer.js","../src/model/StrokeComponent.js","../src/model/Symbol.js","../src/model/InkModel.js","../src/renderer/canvas/CanvasRenderer.js","../src/renderer/QuadraticUtils.js","../src/renderer/canvas/stroker/QuadraticCanvasStroker.js","../node_modules/d3-selection/src/namespaces.js","../node_modules/d3-selection/src/namespace.js","../node_modules/d3-selection/src/creator.js","../node_modules/d3-selection/src/selector.js","../node_modules/d3-selection/src/selectorAll.js","../node_modules/d3-selection/src/selection/sparse.js","../node_modules/d3-selection/src/selection/enter.js","../node_modules/d3-selection/src/selection/data.js","../node_modules/d3-selection/src/selection/sort.js","../node_modules/d3-selection/src/selection/attr.js","../node_modules/d3-selection/src/window.js","../node_modules/d3-selection/src/selection/style.js","../node_modules/d3-selection/src/selection/property.js","../node_modules/d3-selection/src/selection/classed.js","../node_modules/d3-selection/src/selection/text.js","../node_modules/d3-selection/src/selection/html.js","../node_modules/d3-selection/src/selection/raise.js","../node_modules/d3-selection/src/selection/lower.js","../node_modules/d3-selection/src/selection/insert.js","../node_modules/d3-selection/src/selection/remove.js","../node_modules/d3-selection/src/selection/clone.js","../node_modules/d3-selection/src/selection/on.js","../node_modules/d3-selection/src/selection/dispatch.js","../node_modules/d3-selection/src/selection/index.js","../src/renderer/svg/symbols/StrokeSymbolSVGRenderer.js","../src/renderer/svg/SVGRenderer.js","../node_modules/d3-selection/src/selection/select.js","../node_modules/d3-selection/src/selection/selectAll.js","../node_modules/d3-selection/src/selection/filter.js","../node_modules/d3-selection/src/matcher.js","../node_modules/d3-selection/src/constant.js","../node_modules/d3-selection/src/selection/exit.js","../node_modules/d3-selection/src/selection/join.js","../node_modules/d3-selection/src/selection/merge.js","../node_modules/d3-selection/src/selection/order.js","../node_modules/d3-selection/src/selection/call.js","../node_modules/d3-selection/src/selection/nodes.js","../node_modules/d3-selection/src/selection/node.js","../node_modules/d3-selection/src/selection/size.js","../node_modules/d3-selection/src/selection/empty.js","../node_modules/d3-selection/src/selection/each.js","../node_modules/d3-selection/src/selection/append.js","../node_modules/d3-selection/src/selection/datum.js","../node_modules/d3-selection/src/select.js","../src/renderer/svg/stroker/QuadraticSVGStroker.js","../node_modules/@babel/runtime/helpers/asyncToGenerator.js","../node_modules/regenerator-runtime/runtime.js","../node_modules/@babel/runtime/regenerator/index.js","../node_modules/@babel/runtime/helpers/typeof.js","../node_modules/crypto-js/core.js","../node_modules/crypto-js/enc-hex.js","../node_modules/crypto-js/x64-core.js","../node_modules/crypto-js/sha512.js","../node_modules/crypto-js/hmac.js","../node_modules/crypto-js/hmac-sha512.js","../src/recognizer/CryptoHelper.js","../src/recognizer/rest/networkInterface.js","../src/model/RecognizerContext.js","../node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js","../node_modules/select/src/select.js","../node_modules/clipboard/lib/clipboard-action.js","../node_modules/tiny-emitter/index.js","../node_modules/good-listener/src/is.js","../node_modules/delegate/src/closest.js","../node_modules/delegate/src/delegate.js","../node_modules/good-listener/src/listen.js","../node_modules/clipboard/lib/clipboard.js","../src/smartguide/SmartGuide.js","../node_modules/@babel/runtime/helpers/classCallCheck.js","../node_modules/@babel/runtime/helpers/createClass.js","../src/model/UndoRedoContext.js","../src/model/UndoRedoManager.js","../src/renderer/canvas/ImageRenderer.js","../src/eastereggs/InkImporter.js","../src/util/PromiseHelper.js","../src/Editor.js","../src/configuration/DefaultBehaviors.js","../src/recognizer/RecognizerService.js","../src/recognizer/DefaultRecognizer.js","../src/recognizer/rest/iinkRestRecognizer.js","../node_modules/@babel/runtime/helpers/arrayWithHoles.js","../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js","../node_modules/@babel/runtime/helpers/nonIterableRest.js","../node_modules/@babel/runtime/helpers/slicedToArray.js","../node_modules/uuid-js/lib/uuid.js","../src/recognizer/websocket/networkWSInterface.js","../src/recognizer/websocket/WsBuilder.js","../src/recognizer/websocket/WsRecognizerUtil.js","../src/recognizer/websocket/iinkWsRecognizer.js","../src/event/Event.js","../src/EditorFacade.js","../src/iink.js"],"sourcesContent":["/**\n * @typedef {Object} Constants\n */\n\nconst Constants = {\n EventType: {\n IDLE: 'idle',\n CHANGED: 'changed',\n IMPORTED: 'imported',\n EXPORTED: 'exported',\n CONVERTED: 'converted',\n RENDERED: 'rendered', // Internal use only\n LOADED: 'loaded',\n UNDO: 'undo',\n REDO: 'redo',\n CLEAR: 'clear',\n IMPORT: 'import',\n SUPPORTED_IMPORT_MIMETYPES: 'supportedImportMimeTypes',\n EXPORT: 'export',\n CONVERT: 'convert',\n ERROR: 'error'\n },\n RecognitionType: {\n TEXT: 'TEXT',\n MATH: 'MATH',\n DIAGRAM: 'DIAGRAM',\n RAWCONTENT: 'Raw Content'\n },\n Protocol: {\n WEBSOCKET: 'WEBSOCKET',\n REST: 'REST'\n },\n ModelState: {\n INITIALIZING: 'INITIALIZING',\n INITIALIZED: 'INITIALIZED',\n EXPORTING: 'EXPORTING',\n EXPORTED: 'EXPORTED',\n PENDING: 'PENDING',\n MODIFIED: 'MODIFIED',\n ERROR: 'ERROR'\n },\n Trigger: {\n QUIET_PERIOD: 'QUIET_PERIOD',\n POINTER_UP: 'POINTER_UP',\n DEMAND: 'DEMAND'\n },\n Logger: {\n EDITOR: 'editor',\n MODEL: 'model',\n GRABBER: 'grabber',\n RENDERER: 'renderer',\n RECOGNIZER: 'recognizer',\n EVENT: 'event',\n UTIL: 'util',\n SMARTGUIDE: 'smartguide'\n },\n LogLevel: {\n TRACE: 'TRACE',\n DEBUG: 'DEBUG',\n INFO: 'INFO',\n WARN: 'WARN',\n ERROR: 'ERROR'\n },\n Languages: {\n zh_CN: 'Noto Sans CJK tc',\n zh_HK: 'Noto Sans CJK tc',\n zh_TW: 'Noto Sans CJK tc',\n ko_KR: 'Noto Sans CJK kr',\n ja_JP: 'Noto Sans CJK jp',\n default: 'Open Sans'\n },\n Error: {\n NOT_REACHABLE: 'MyScript recognition server is not reachable. Please reload once you are connected.',\n WRONG_CREDENTIALS: 'Application credentials are invalid. Please check or regenerate your application key and hmackey.',\n TOO_OLD: 'Session is too old. Max Session Duration Reached.',\n NO_ACTIVITY: 'Session closed due to no activity.'\n },\n Exports: {\n JIIX: 'application/vnd.myscript.jiix'\n }\n}\nexport default Constants\n","/*\n* loglevel - https://github.com/pimterry/loglevel\n*\n* Copyright (c) 2013 Tim Perry\n* Licensed under the MIT license.\n*/\n(function (root, definition) {\n \"use strict\";\n if (typeof define === 'function' && define.amd) {\n define(definition);\n } else if (typeof module === 'object' && module.exports) {\n module.exports = definition();\n } else {\n root.log = definition();\n }\n}(this, function () {\n \"use strict\";\n\n // Slightly dubious tricks to cut down minimized file size\n var noop = function() {};\n var undefinedType = \"undefined\";\n var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (\n /Trident\\/|MSIE /.test(window.navigator.userAgent)\n );\n\n var logMethods = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\"\n ];\n\n // Cross-browser bind equivalent that works at least back to IE6\n function bindMethod(obj, methodName) {\n var method = obj[methodName];\n if (typeof method.bind === 'function') {\n return method.bind(obj);\n } else {\n try {\n return Function.prototype.bind.call(method, obj);\n } catch (e) {\n // Missing bind shim or IE8 + Modernizr, fallback to wrapping\n return function() {\n return Function.prototype.apply.apply(method, [obj, arguments]);\n };\n }\n }\n }\n\n // Trace() doesn't print the message in IE, so for that case we need to wrap it\n function traceForIE() {\n if (console.log) {\n if (console.log.apply) {\n console.log.apply(console, arguments);\n } else {\n // In old IE, native console methods themselves don't have apply().\n Function.prototype.apply.apply(console.log, [console, arguments]);\n }\n }\n if (console.trace) console.trace();\n }\n\n // Build the best logging method possible for this env\n // Wherever possible we want to bind, not wrap, to preserve stack traces\n function realMethod(methodName) {\n if (methodName === 'debug') {\n methodName = 'log';\n }\n\n if (typeof console === undefinedType) {\n return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives\n } else if (methodName === 'trace' && isIE) {\n return traceForIE;\n } else if (console[methodName] !== undefined) {\n return bindMethod(console, methodName);\n } else if (console.log !== undefined) {\n return bindMethod(console, 'log');\n } else {\n return noop;\n }\n }\n\n // These private functions always need `this` to be set properly\n\n function replaceLoggingMethods(level, loggerName) {\n /*jshint validthis:true */\n for (var i = 0; i < logMethods.length; i++) {\n var methodName = logMethods[i];\n this[methodName] = (i < level) ?\n noop :\n this.methodFactory(methodName, level, loggerName);\n }\n\n // Define log.log as an alias for log.debug\n this.log = this.debug;\n }\n\n // In old IE versions, the console isn't present until you first open it.\n // We build realMethod() replacements here that regenerate logging methods\n function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {\n return function () {\n if (typeof console !== undefinedType) {\n replaceLoggingMethods.call(this, level, loggerName);\n this[methodName].apply(this, arguments);\n }\n };\n }\n\n // By default, we use closely bound real methods wherever possible, and\n // otherwise we wait for a console to appear, and then try again.\n function defaultMethodFactory(methodName, level, loggerName) {\n /*jshint validthis:true */\n return realMethod(methodName) ||\n enableLoggingWhenConsoleArrives.apply(this, arguments);\n }\n\n function Logger(name, defaultLevel, factory) {\n var self = this;\n var currentLevel;\n\n var storageKey = \"loglevel\";\n if (typeof name === \"string\") {\n storageKey += \":\" + name;\n } else if (typeof name === \"symbol\") {\n storageKey = undefined;\n }\n\n function persistLevelIfPossible(levelNum) {\n var levelName = (logMethods[levelNum] || 'silent').toUpperCase();\n\n if (typeof window === undefinedType || !storageKey) return;\n\n // Use localStorage if available\n try {\n window.localStorage[storageKey] = levelName;\n return;\n } catch (ignore) {}\n\n // Use session cookie as fallback\n try {\n window.document.cookie =\n encodeURIComponent(storageKey) + \"=\" + levelName + \";\";\n } catch (ignore) {}\n }\n\n function getPersistedLevel() {\n var storedLevel;\n\n if (typeof window === undefinedType || !storageKey) return;\n\n try {\n storedLevel = window.localStorage[storageKey];\n } catch (ignore) {}\n\n // Fallback to cookies if local storage gives us nothing\n if (typeof storedLevel === undefinedType) {\n try {\n var cookie = window.document.cookie;\n var location = cookie.indexOf(\n encodeURIComponent(storageKey) + \"=\");\n if (location !== -1) {\n storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];\n }\n } catch (ignore) {}\n }\n\n // If the stored level is not valid, treat it as if nothing was stored.\n if (self.levels[storedLevel] === undefined) {\n storedLevel = undefined;\n }\n\n return storedLevel;\n }\n\n /*\n *\n * Public logger API - see https://github.com/pimterry/loglevel for details\n *\n */\n\n self.name = name;\n\n self.levels = { \"TRACE\": 0, \"DEBUG\": 1, \"INFO\": 2, \"WARN\": 3,\n \"ERROR\": 4, \"SILENT\": 5};\n\n self.methodFactory = factory || defaultMethodFactory;\n\n self.getLevel = function () {\n return currentLevel;\n };\n\n self.setLevel = function (level, persist) {\n if (typeof level === \"string\" && self.levels[level.toUpperCase()] !== undefined) {\n level = self.levels[level.toUpperCase()];\n }\n if (typeof level === \"number\" && level >= 0 && level <= self.levels.SILENT) {\n currentLevel = level;\n if (persist !== false) { // defaults to true\n persistLevelIfPossible(level);\n }\n replaceLoggingMethods.call(self, level, name);\n if (typeof console === undefinedType && level < self.levels.SILENT) {\n return \"No console available for logging\";\n }\n } else {\n throw \"log.setLevel() called with invalid level: \" + level;\n }\n };\n\n self.setDefaultLevel = function (level) {\n if (!getPersistedLevel()) {\n self.setLevel(level, false);\n }\n };\n\n self.enableAll = function(persist) {\n self.setLevel(self.levels.TRACE, persist);\n };\n\n self.disableAll = function(persist) {\n self.setLevel(self.levels.SILENT, persist);\n };\n\n // Initialize with the right level\n var initialLevel = getPersistedLevel();\n if (initialLevel == null) {\n initialLevel = defaultLevel == null ? \"WARN\" : defaultLevel;\n }\n self.setLevel(initialLevel, false);\n }\n\n /*\n *\n * Top-level API\n *\n */\n\n var defaultLogger = new Logger();\n\n var _loggersByName = {};\n defaultLogger.getLogger = function getLogger(name) {\n if ((typeof name !== \"symbol\" && typeof name !== \"string\") || name === \"\") {\n throw new TypeError(\"You must supply a name when creating a logger.\");\n }\n\n var logger = _loggersByName[name];\n if (!logger) {\n logger = _loggersByName[name] = new Logger(\n name, defaultLogger.getLevel(), defaultLogger.methodFactory);\n }\n return logger;\n };\n\n // Grab the current global log variable in case of overwrite\n var _log = (typeof window !== undefinedType) ? window.log : undefined;\n defaultLogger.noConflict = function() {\n if (typeof window !== undefinedType &&\n window.log === defaultLogger) {\n window.log = _log;\n }\n\n return defaultLogger;\n };\n\n defaultLogger.getLoggers = function getLoggers() {\n return _loggersByName;\n };\n\n // ES6 default export, for compatibility\n defaultLogger['default'] = defaultLogger;\n\n return defaultLogger;\n}));\n","import * as loglevel from 'loglevel'\nimport Constants from './Constants'\n\n/**\n * Main log instance\n * @type {Object}\n */\nconst log = loglevel.noConflict()\nexport default log\n\n/**\n * Log editor events\n * @type {Object}\n */\nexport const editorLogger = log.getLogger(Constants.Logger.EDITOR)\neditorLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log editor events\n * @type {Object}\n */\nexport const smartGuideLogger = log.getLogger(Constants.Logger.SMARTGUIDE)\neditorLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log model events\n * @type {Object}\n */\nexport const modelLogger = log.getLogger(Constants.Logger.MODEL)\nmodelLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log grabber events\n * @type {Object}\n */\nexport const grabberLogger = log.getLogger(Constants.Logger.GRABBER)\ngrabberLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log grabber events\n * @type {Object}\n */\nexport const rendererLogger = log.getLogger(Constants.Logger.RENDERER)\nrendererLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log recognizer events\n * @type {Object}\n */\nexport const recognizerLogger = log.getLogger(Constants.Logger.RECOGNIZER)\nrecognizerLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log callback events\n * @type {Object}\n */\nexport const eventLogger = log.getLogger(Constants.Logger.EVENT)\neventLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log util events\n * @type {Object}\n */\nexport const utilLogger = log.getLogger(Constants.Logger.UTIL)\nutilLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n\n/**\n * Log tests events\n * @type {Object}\n */\nexport const testLogger = log.getLogger('test')\ntestLogger.setDefaultLevel(Constants.LogLevel.ERROR)\n","/**\n * Lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright OpenJS Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used to detect hot functions by number of calls within a span of milliseconds. */\nvar HOT_COUNT = 800,\n HOT_SPAN = 16;\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n asyncTag = '[object AsyncFunction]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n nullTag = '[object Null]',\n objectTag = '[object Object]',\n proxyTag = '[object Proxy]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n undefinedTag = '[object Undefined]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\n/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\n/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype,\n funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n Symbol = root.Symbol,\n Uint8Array = root.Uint8Array,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined,\n getPrototype = overArg(Object.getPrototypeOf, Object),\n objectCreate = Object.create,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n splice = arrayProto.splice,\n symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined,\n nativeMax = Math.max,\n nativeNow = Date.now;\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map'),\n nativeCreate = getNative(Object, 'create');\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\n/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\n/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\n/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * This function is like `assignValue` except that it doesn't assign\n * `undefined` values.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignMergeValue(object, key, value) {\n if ((value !== undefined && !eq(object[key], value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `baseForOwn` which iterates over `object`\n * properties returned by `keysFunc` and invokes `iteratee` for each property.\n * Iteratee functions may exit iteration early by explicitly returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\nvar baseFor = createBaseFor();\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.merge` without support for multiple sources.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMerge(object, source, srcIndex, customizer, stack) {\n if (object === source) {\n return;\n }\n baseFor(source, function(srcValue, key) {\n stack || (stack = new Stack);\n if (isObject(srcValue)) {\n baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);\n }\n else {\n var newValue = customizer\n ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack)\n : undefined;\n\n if (newValue === undefined) {\n newValue = srcValue;\n }\n assignMergeValue(object, key, newValue);\n }\n }, keysIn);\n}\n\n/**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {number} srcIndex The index of `source`.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {Object} [stack] Tracks traversed source values and their merged\n * counterparts.\n */\nfunction baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {\n var objValue = safeGet(object, key),\n srcValue = safeGet(source, key),\n stacked = stack.get(srcValue);\n\n if (stacked) {\n assignMergeValue(object, key, stacked);\n return;\n }\n var newValue = customizer\n ? customizer(objValue, srcValue, (key + ''), object, source, stack)\n : undefined;\n\n var isCommon = newValue === undefined;\n\n if (isCommon) {\n var isArr = isArray(srcValue),\n isBuff = !isArr && isBuffer(srcValue),\n isTyped = !isArr && !isBuff && isTypedArray(srcValue);\n\n newValue = srcValue;\n if (isArr || isBuff || isTyped) {\n if (isArray(objValue)) {\n newValue = objValue;\n }\n else if (isArrayLikeObject(objValue)) {\n newValue = copyArray(objValue);\n }\n else if (isBuff) {\n isCommon = false;\n newValue = cloneBuffer(srcValue, true);\n }\n else if (isTyped) {\n isCommon = false;\n newValue = cloneTypedArray(srcValue, true);\n }\n else {\n newValue = [];\n }\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n newValue = objValue;\n if (isArguments(objValue)) {\n newValue = toPlainObject(objValue);\n }\n else if (!isObject(objValue) || isFunction(objValue)) {\n newValue = initCloneObject(srcValue);\n }\n }\n else {\n isCommon = false;\n }\n }\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n stack.set(srcValue, newValue);\n mergeFunc(newValue, srcValue, srcIndex, customizer, stack);\n stack['delete'](srcValue);\n }\n assignMergeValue(object, key, newValue);\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n return setToString(overRest(func, start, identity), func + '');\n}\n\n/**\n * The base implementation of `setToString` without support for hot loop shorting.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar baseSetToString = !defineProperty ? identity : function(func, string) {\n return defineProperty(func, 'toString', {\n 'configurable': true,\n 'enumerable': false,\n 'value': constant(string),\n 'writable': true\n });\n};\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\n/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Creates a base function for methods like `_.forIn` and `_.forOwn`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\nfunction createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var index = -1,\n iterable = Object(object),\n props = keysFunc(object),\n length = props.length;\n\n while (length--) {\n var key = props[fromRight ? length : ++index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n}\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\n/**\n * A specialized version of `baseRest` which transforms the rest array.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @param {Function} transform The rest array transform.\n * @returns {Function} Returns the new function.\n */\nfunction overRest(func, start, transform) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = transform(array);\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Gets the value at `key`, unless `key` is \"__proto__\" or \"constructor\".\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction safeGet(object, key) {\n if (key === 'constructor' && typeof object[key] === 'function') {\n return;\n }\n\n if (key == '__proto__') {\n return;\n }\n\n return object[key];\n}\n\n/**\n * Sets the `toString` method of `func` to return `string`.\n *\n * @private\n * @param {Function} func The function to modify.\n * @param {Function} string The `toString` result.\n * @returns {Function} Returns `func`.\n */\nvar setToString = shortOut(baseSetToString);\n\n/**\n * Creates a function that'll short out and invoke `identity` instead\n * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`\n * milliseconds.\n *\n * @private\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new shortable function.\n */\nfunction shortOut(func) {\n var count = 0,\n lastCalled = 0;\n\n return function() {\n var stamp = nativeNow(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return arguments[0];\n }\n } else {\n count = 0;\n }\n return func.apply(undefined, arguments);\n };\n}\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\n/**\n * Converts `value` to a plain object flattening inherited enumerable string\n * keyed properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\nfunction toPlainObject(value) {\n return copyObject(value, keysIn(value));\n}\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\n/**\n * This method is like `_.assign` except that it recursively merges own and\n * inherited enumerable string keyed properties of source objects into the\n * destination object. Source properties that resolve to `undefined` are\n * skipped if a destination value exists. Array and plain object properties\n * are merged recursively. Other objects and value types are overridden by\n * assignment. Source objects are applied from left to right. Subsequent\n * sources overwrite property assignments of previous sources.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 0.5.0\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = {\n * 'a': [{ 'b': 2 }, { 'd': 4 }]\n * };\n *\n * var other = {\n * 'a': [{ 'c': 3 }, { 'e': 5 }]\n * };\n *\n * _.merge(object, other);\n * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }\n */\nvar merge = createAssigner(function(object, source, srcIndex) {\n baseMerge(object, source, srcIndex);\n});\n\n/**\n * Creates a function that returns `value`.\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Util\n * @param {*} value The value to return from the new function.\n * @returns {Function} Returns the new constant function.\n * @example\n *\n * var objects = _.times(2, _.constant({ 'a': 1 }));\n *\n * console.log(objects);\n * // => [{ 'a': 1 }, { 'a': 1 }]\n *\n * console.log(objects[0] === objects[1]);\n * // => true\n */\nfunction constant(value) {\n return function() {\n return value;\n };\n}\n\n/**\n * This method returns the first argument it receives.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Util\n * @param {*} value Any value.\n * @returns {*} Returns `value`.\n * @example\n *\n * var object = { 'a': 1 };\n *\n * console.log(_.identity(object) === object);\n * // => true\n */\nfunction identity(value) {\n return value;\n}\n\n/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = merge;\n","import merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * Default configuration\n * See https://developer.myscript.com/docs/interactive-ink/latest/reference/web/configuration/ for a full documentation of parameters.\n */\nconst defaultConfiguration = {\n recognitionParams: {\n type: 'TEXT',\n protocol: 'WEBSOCKET',\n server: {\n scheme: 'https',\n host: 'cloud.myscript.com',\n applicationKey: undefined,\n hmacKey: undefined,\n useWindowLocation: false,\n websocket: {\n pingEnabled: true,\n pingDelay: 30000,\n maxPingLostCount: 10,\n autoReconnect: true,\n maxRetryCount: 2,\n fileChunkSize: 300000\n }\n },\n iink: {\n alwaysConnected: true,\n lang: 'en_US',\n export: {\n 'image-resolution': 300,\n jiix: {\n 'bounding-box': false,\n strokes: false,\n text: {\n chars: false,\n words: true\n }\n }\n },\n renderer: {\n debug: {\n 'draw-text-boxes': false,\n 'draw-image-boxes': false\n }\n },\n math: {\n mimeTypes: ['application/x-latex', 'application/mathml+xml'],\n solver: {\n enable: true,\n 'fractional-part-digits': 3,\n 'decimal-separator': '.',\n 'rounding-mode': 'half up',\n 'angle-unit': 'deg'\n },\n margin: {\n bottom: 10,\n left: 15,\n right: 15,\n top: 10\n },\n eraser: {\n 'erase-precisely': false\n }\n },\n text: {\n guides: {\n enable: true\n },\n smartGuide: true,\n smartGuideFadeOut: {\n enable: false,\n duration: 10000\n },\n mimeTypes: ['text/plain', 'application/vnd.myscript.jiix'],\n margin: {\n top: 20,\n left: 10,\n right: 10\n },\n eraser: {\n 'erase-precisely': false\n }\n },\n diagram: {\n mimeTypes: ['application/vnd.myscript.jiix'],\n margin: {\n bottom: 10,\n left: 15,\n right: 15,\n top: 10\n }\n },\n 'raw-content': {\n recognition: {\n text: false,\n shape: false\n }\n }\n }\n },\n // @see generated documentation on top\n listenerOptions: {\n capture: false,\n passive: true\n },\n undoRedoMaxStackSize: 20,\n xyFloatPrecision: 0,\n timestampFloatPrecision: 0,\n triggerDelay: 2000,\n processDelay: 0,\n resizeTriggerDelay: 200,\n // Configure when the action is triggered.\n // POINTER_UP : Action is triggered on every PenUP. This is the recommended mode for CDK V3 WebSocket recognitions.\n // QUIET_PERIOD : Action is triggered after a quiet period in milli-seconds on every pointer up. I value is set to 2000 for example the recognition will be fired when user stop writing 2 seconds. This is the recommended mode for all REST recognitions.\n triggers: {\n exportContent: 'POINTER_UP',\n addStrokes: 'POINTER_UP'\n },\n restConversionState: '',\n renderingParams: {\n stroker: 'quadratic',\n minHeight: 100,\n minWidth: 100\n }\n}\n\n/**\n * Generate parameters\n * @param {Configuration} configuration Configuration to be used\n * @param {Object} watcher: { update: function, prop: string} function to call when 'prop' is updated\n * @return {Configuration} Overridden configuration\n */\nexport function overrideDefaultConfiguration (configuration) {\n const confRef = configuration\n let currentConfiguration\n if (confRef && confRef.recognitionParams.server && confRef.recognitionParams.server.useWindowLocation) {\n confRef.recognitionParams.server.scheme = window.location.protocol.slice(0, -1)\n confRef.recognitionParams.server.host = window.location.host\n currentConfiguration = merge({}, defaultConfiguration, confRef === undefined ? {} : confRef)\n } else {\n currentConfiguration = merge({}, defaultConfiguration, configuration === undefined ? {} : configuration)\n }\n logger.debug('Override default configuration', currentConfiguration)\n\n return currentConfiguration\n}\n\nexport default defaultConfiguration\n","!function(t,e){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=e():\"function\"==typeof define&&define.amd?define([],e):\"object\"==typeof exports?exports.JsonCSS=e():t.JsonCSS=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,\"a\",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p=\"\",e(e.s=1)}([function(t,e,n){\"use strict\";function o(t,e){if(!(t instanceof e))throw new TypeError(\"Cannot call a class as a function\")}Object.defineProperty(e,\"__esModule\",{value:!0});var r=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&\"function\"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?\"symbol\":typeof t},i=function t(e){var n=this;o(this,t),this.toJSON=function(t){if(\"string\"!=typeof t)return console.error(\"Need a CSS string but given \",void 0===t?\"undefined\":r(t),t),\"Not a valid CSS..!\";var e={},o=void 0,i=void 0,u=void 0;try{t.split(\"{\").forEach(function(t){if(i=t.trim())if(-1===i.indexOf(\"}\"))e[i]={},o=i;else{i.substring(0,i.indexOf(\"}\")).split(\";\").forEach(function(t){(u=t.split(\":\"))&&2===u.length&&(e[o][u[0].trim().replace(/^\\\"|\\\"$/g,\"\")]=n._trimSemiColon(u[1].trim().replace(/^\\\"|\\\"$/g,\"\")))});try{o=i.split(\"}\")[1].trim(),o&&(e[o]={})}catch(t){}}})}catch(t){return\"Not a valid CSS..!\"}return e},this.toCSS=function(t){if(\"object\"!==(void 0===t?\"undefined\":r(t)))return console.error(\"Need a JSON object but given \",void 0===t?\"undefined\":r(t),t),\"Not a valid JSON..!\";var e=\"\";try{for(var n in t)if(t.hasOwnProperty(n)){e+=n+\" {\\n\";for(var o in t[n])t[n].hasOwnProperty(o)&&(e+=o+\": \"+t[n][o]+\";\\n\");e+=\"}\\n\"}}catch(t){return\"Not a valid JSON..!\"}return e},this._trimSemiColon=function(t){return\";\"===t.slice(-1)?t.slice(0,n.length-1):t}};e.default=i},function(t,e,n){\"use strict\";t.exports=n(0).default}])});","import JsonCSS from 'json-css'\nimport merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * @typedef {Object} PenStyle\n * @property {String} color=#000000 Color (supported formats rgb() rgba() hsl() hsla() #rgb #rgba #rrggbb #rrggbbaa)\n * @property {String} -myscript-pen-width=1 Width of strokes and primitives in mm (no other unit is supported yet)\n * @property {String} -myscript-pen-fill-style=none\n * @property {String} -myscript-pen-fill-color=#FFFFFF00 Color filled inside the area delimited by strokes and primitives\n */\n\n/**\n * Default style\n * @type {PenStyle}\n */\nconst defaultPenStyle = undefined\nconst parser = new JsonCSS()\n\n/**\n * Generate style\n * @param {PenStyle} style Custom style to be applied\n * @return {PenStyle} Overridden style\n */\nexport function overrideDefaultPenStyle (style) {\n const currentStyle = merge({}, defaultPenStyle, style === undefined ? {} : style)\n logger.debug('Override default pen style', currentStyle)\n return currentStyle\n}\n\nexport function toCSS (penStyle) { // FIXME Ugly hack to parse JSON to CSS inline\n const css = parser.toCSS({ css: penStyle })\n return css.substring(6, css.length - 3)\n}\n\nexport function toJSON (penStyle) { // FIXME Ugly hack to parse CSS inline to JSON\n return parser.toJSON(`css {${penStyle}}`).css\n}\n\nexport default defaultPenStyle\n","import JsonCSS from 'json-css'\nimport merge from 'lodash.merge'\nimport { editorLogger as logger } from './LoggerConfig'\n\n/**\n * @typedef {PenStyle} InkTheme\n */\n/**\n * @typedef {Object} MathTheme\n * @property {String} font-family=STIXGeneral Font-family to be used\n */\n/**\n * @typedef {Object} GeneratedTheme\n * @property {String} font-family=STIXGeneral Font-family to be used\n * @property {String} color=#A8A8A8FF Color to be used\n */\n/**\n * @typedef {Object} TextTheme\n * @property {String} font-family=OpenSans Font-family to be used\n * @property {Number} font-size=10 Font-size to be used\n */\n/**\n * @typedef {Object} Theme\n * @property {InkTheme} ink General settings\n * @property {MathTheme} .math Math theme\n * @property {GeneratedTheme} .math-solver Theme to be used for generated items\n * @property {TextTheme} .text Text theme\n */\n\n/**\n * Default theme\n * @type {Theme}\n */\nconst defaultTheme = {\n ink: {\n color: '#000000',\n '-myscript-pen-width': 1,\n '-myscript-pen-fill-style': 'none',\n '-myscript-pen-fill-color': '#FFFFFF00'\n },\n '.math': {\n 'font-family': 'STIXGeneral'\n },\n '.math-solved': {\n 'font-family': 'STIXGeneral',\n color: '#A8A8A8FF'\n },\n '.text': {\n 'font-family': 'Open Sans',\n 'font-size': 10\n }\n}\nconst parser = new JsonCSS()\n\n/**\n * Generate theme\n * @param {Theme} theme Custom theme to be applied\n * @return {Theme} Overridden theme\n */\nexport function overrideDefaultTheme (theme) {\n const currentTheme = merge({}, defaultTheme, theme === undefined ? {} : theme)\n logger.debug('Override default theme', currentTheme)\n return currentTheme\n}\n\nexport function toCSS (theme) {\n return parser.toCSS(theme)\n}\n\nexport function toJSON (theme) {\n return parser.toJSON(theme)\n}\n\nexport default defaultTheme\n","import { grabberLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Grab pointerDown, pointerMove and pointerUp events\n * @typedef {Object} Grabber\n * @property {function} attach Attach events and decide when to call editor pointerDown/Move/Up methods\n * @property {function} detach Detach the grabber\n */\n\n/**\n * Grabber listener\n * @typedef {Object} GrabberListener\n * @property {Array} types Event types to listen\n * @property {function} listener Event listener for these events\n */\n\n/**\n * Grabber context\n * @typedef {Object} GrabberContext\n * @property {Boolean|Object} options Options object that specifies characteristics about the event listener. (@see addEventListener.options for detail)\n * @property {Array} listeners Registered listeners\n */\n\nconst floatPrecisionArray = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000]\n\nfunction roundFloat (oneFloat, requestedFloatPrecision) {\n if (requestedFloatPrecision || requestedFloatPrecision === 0) {\n let floatPrecision\n if (requestedFloatPrecision > 10) {\n floatPrecision = floatPrecisionArray[10]\n } else {\n floatPrecision = floatPrecisionArray[requestedFloatPrecision]\n }\n return Math.round(oneFloat * floatPrecision) / floatPrecision\n }\n return oneFloat\n}\n\nfunction extractPoint (event, domElement, configuration, offsetTop = 0, offsetLeft = 0) {\n let eventRef = event\n if (eventRef.changedTouches) {\n eventRef = eventRef.changedTouches[0]\n }\n const rect = domElement.getBoundingClientRect()\n return {\n x: roundFloat(eventRef.clientX - rect.left - domElement.clientLeft - offsetLeft, configuration.xyFloatPrecision),\n y: roundFloat(eventRef.clientY - rect.top - domElement.clientTop - offsetTop, configuration.xyFloatPrecision),\n t: roundFloat(Date.now(), configuration.timestampFloatPrecision)\n }\n}\n\nconst prevent = (e) => e.preventDefault()\n/**\n * Listen for the desired events\n * @param {Element} element DOM element to attach events listeners\n * @param {Editor} editor Editor to received down/move/up events\n * @param {Number} [offsetTop=0]\n * @param {Number} [offsetLeft=0]\n * @return {GrabberContext} Grabber context\n * @listens {Event} pointermove: a pointer moves, similar to touchmove or mousemove.\n * @listens {Event} pointerdown: a pointer is activated, or a device button held.\n * @listens {Event} pointerup: a pointer is deactivated, or a device button released.\n * @listens {Event} pointerover: a pointer has moved onto an element.\n * @listens {Event} pointerout: a pointer is no longer on an element it once was.\n * @listens {Event} pointerenter: a pointer enters the bounding box of an element.\n * @listens {Event} pointerleave: a pointer leaves the bounding box of an element.\n * @listens {Event} pointercancel: a pointer will no longer generate events.\n */\nexport function attach (element, editor, offsetTop = 0, offsetLeft = 0) {\n let mMaxDiffX = 0\n\n function unfocus () {\n if (window.getSelection().type !== 'None') {\n window.getSelection().removeAllRanges()\n }\n }\n\n function hideMenu (evt) {\n const moreMenuInDocument = document.querySelector('.more-menu')\n if (!evt.target.classList.contains('ellipsis') && !evt.target.classList.contains('more-menu') && !evt.target.classList.contains('options-label-button') && moreMenuInDocument && moreMenuInDocument.style.display !== 'none') {\n moreMenuInDocument.style.display = 'none'\n return true\n }\n return false\n }\n\n function hideCandidates (evt) {\n const candidatesInDocument = document.querySelector('.candidates')\n if (!evt.target.classList.contains('candidates') && !(evt.target.tagName === 'SPAN') && candidatesInDocument && candidatesInDocument.style.display !== 'none') {\n candidatesInDocument.style.display = 'none'\n return true\n }\n return false\n }\n\n function pointerDownHandler (evt) { // Trigger a pointerDown\n const pointerDownOnEditor = evt.target.id === editor.domElement.id || evt.target.classList.contains('ms-canvas')\n if (this.activePointerId !== undefined) {\n if (this.activePointerId === evt.pointerId) {\n logger.trace(`${evt.type} event with the same id without any pointer up`, evt.pointerId)\n }\n } else if ((evt.button !== 2) && (evt.buttons !== 2) && pointerDownOnEditor) { // Ignore right click\n if (!hideMenu(evt) && !hideCandidates(evt)) {\n this.activePointerId = evt.pointerId\n // Hack for iOS 9 Safari : pointerId has to be int so -1 if > max value\n const pointerId = evt.pointerId > 2147483647 ? -1 : evt.pointerId\n unfocus()\n evt.stopPropagation()\n let pointerType = evt.pointerType\n if (editor.isErasing) {\n pointerType = 'ERASER'\n }\n editor.pointerDown(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft), pointerType, pointerId)\n }\n } else if (evt.target.classList.contains('ellipsis') || evt.target.classList.contains('tag-icon')) {\n hideMenu(evt)\n hideCandidates(evt)\n } else { // FIXME add more complete verification to pointer down on smartguide\n hideMenu(evt)\n hideCandidates(evt)\n this.smartGuidePointerDown = true\n this.downSmartGuidePoint = extractPoint(evt, element, editor.configuration)\n }\n }\n\n function pointerMoveHandler (evt) { // Trigger a pointerMove\n // Only considering the active pointer\n if (this.activePointerId !== undefined && this.activePointerId === evt.pointerId) {\n unfocus()\n editor.pointerMove(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft))\n } else if (this.smartGuidePointerDown) {\n const point = extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft)\n const diffX = Math.abs(this.downSmartGuidePoint.x - point.x)\n const diffY = Math.abs(this.downSmartGuidePoint.y - point.y)\n mMaxDiffX = Math.max(diffX, mMaxDiffX)\n const cond1 = diffX < 5 && diffY > 5 && mMaxDiffX < 15\n const cond2 = diffX > 5 && diffY > 5 && mMaxDiffX < 15\n if (cond1 || cond2) {\n this.activePointerId = evt.pointerId\n // Hack for iOS 9 Safari : pointerId has to be int so -1 if > max value\n const pointerId = evt.pointerId > 2147483647 ? -1 : evt.pointerId\n unfocus()\n editor.pointerDown(this.downSmartGuidePoint, evt.pointerType, pointerId)\n }\n } else {\n logger.trace(`${evt.type} event from another pointerid (${evt.pointerId})`, this.activePointerId)\n }\n }\n\n function pointerUpHandler (evt) { // Trigger a pointerUp\n mMaxDiffX = 0\n this.smartGuidePointerDown = false\n const smartGuideIds = ['smartguide', 'prompter-text-container', 'prompter-text', 'tag-icon', 'ellipsis']\n const scrollbarClasses = ['ps__rail-x', 'ps__thumb-x']\n // Check if pointer entered into any smartguide elements or scrollbar\n // Use case : when the pointer is entering the smartguide or scrollbar, a pointerout (or leave) is fired.\n // The related target is then the DOM element that was left.\n // We don't want this to cause editor.pointerUp because the stroke isn't finished.\n const pointerEnteredSmartGuide = evt.relatedTarget && (smartGuideIds.includes(evt.relatedTarget.className) || scrollbarClasses.includes(evt.relatedTarget.className))\n // Check if pointer didn't stay in the smartguide and pointer exited the smartguide or scrollbar\n // Use case : when the pointer is leaving the smartguide or scrollbar, a pointerout (or leave) is fired.\n // The related target is then the DOM element that was left (the smart guide)\n // We are entering again the editor\n // We don't want this to cause editor.pointerUp because the stroke isn't finished.\n const pointerExitedSmartGuide = evt.relatedTarget && evt.target && (smartGuideIds.includes(evt.target.className) || scrollbarClasses.includes(evt.target.className))\n // Check if pointer moved between words in smartguide\n // Same use case as pointerEnteredSmartGuide but for the words in the smartguide (each word is a span).\n const pointerMovedWords = evt.relatedTarget && evt.target && (evt.target.tagName === 'SPAN' || evt.relatedTarget.tagName === 'SPAN')\n if (pointerEnteredSmartGuide || pointerExitedSmartGuide || pointerMovedWords) {\n evt.stopPropagation()\n } else if (this.activePointerId !== undefined && this.activePointerId === evt.pointerId) { // Only considering the active pointer\n this.activePointerId = undefined // Managing the active pointer\n evt.stopPropagation()\n editor.pointerUp(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft))\n } else {\n logger.trace(`${evt.type} event from another pointerid (${evt.pointerId})`, this.activePointerId)\n }\n }\n\n const context = {\n options: editor.configuration.listenerOptions,\n listeners: [{\n types: ['pointerdown'],\n listener: pointerDownHandler\n }, {\n types: ['pointermove'],\n listener: pointerMoveHandler\n }, {\n types: ['pointerup', 'pointerout', 'pointerleave', 'pointercancel'],\n listener: pointerUpHandler\n }]\n }\n\n logger.debug('attaching listeners', context)\n context.listeners.forEach((item) => {\n item.types.forEach(type => element.addEventListener(type, item.listener, context.options))\n })\n\n element.addEventListener('touchmove', prevent)\n\n // FIXME investigate why this is needed for iOS devices\n document.documentElement.addEventListener('pointerdown', () => {})\n return context\n}\n\nexport function detach (element, context) {\n logger.debug('detaching listeners', context)\n context.listeners.forEach((item) => {\n item.types.forEach(type => element.removeEventListener(type, item.listener, context.options))\n })\n element.removeEventListener('touchmove', prevent)\n document.documentElement.removeEventListener('pointerdown', () => {})\n}\n","function _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n\n return arr2;\n}\n\nmodule.exports = _arrayLikeToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\n\nmodule.exports = _arrayWithoutHoles;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\n\nmodule.exports = _iterableToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayLikeToArray = require(\"./arrayLikeToArray.js\");\n\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\n\nmodule.exports = _unsupportedIterableToArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableSpread;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","var arrayWithoutHoles = require(\"./arrayWithoutHoles.js\");\n\nvar iterableToArray = require(\"./iterableToArray.js\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray.js\");\n\nvar nonIterableSpread = require(\"./nonIterableSpread.js\");\n\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\n\nmodule.exports = _toConsumableArray;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/**\n * Draw a stroke symbol\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Stroke to be drawn\n * @param {Stroker} stroker Stroker to use to render a stroke\n */\nexport function drawStroke (context, stroke, stroker) {\n if (stroker && (!stroke || stroke.pointerType !== 'ERASER')) {\n stroker.drawStroke(context, stroke)\n }\n}\n","import { rendererLogger as logger } from '../../../configuration/LoggerConfig'\n\n/**\n * @type {{table: String, shape: String, recognizedShape: String, ellipse: String, line: String}}\n */\nexport const ShapeSymbols = {\n table: 'table',\n shape: 'shape',\n recognizedShape: 'recognizedShape',\n ellipse: 'ellipse',\n line: 'line'\n}\n\nfunction phi (angle) {\n let returnedAngle = ((angle + Math.PI) % (Math.PI * 2)) - Math.PI\n if (returnedAngle < -Math.PI) {\n returnedAngle += Math.PI * 2\n }\n return returnedAngle\n}\n\nfunction drawEllipseArc (context, centerPoint, maxRadius, minRadius, orientation, startAngle, sweepAngle) {\n const angleStep = 0.02 // angle delta between interpolated\n\n let z1 = Math.cos(orientation)\n let z3 = Math.sin(orientation)\n let z2 = z1\n let z4 = z3\n z1 *= maxRadius\n z2 *= minRadius\n z3 *= maxRadius\n z4 *= minRadius\n\n const n = Math.floor(Math.abs(sweepAngle) / angleStep)\n\n const boundariesPoints = []\n\n context.save()\n try {\n context.beginPath()\n\n for (let i = 0; i <= n; i++) {\n const angle = startAngle + ((i / n) * sweepAngle) // points on the arc, in radian\n const alpha = Math.atan2(Math.sin(angle) / minRadius, Math.cos(angle) / maxRadius)\n\n const cosAlpha = Math.cos(alpha)\n const sinAlpha = Math.sin(alpha)\n\n // current point\n const x = (centerPoint.x + (z1 * cosAlpha)) - (z4 * sinAlpha)\n const y = (centerPoint.y + (z2 * sinAlpha)) + (z3 * cosAlpha)\n if (i === 0) {\n context.moveTo(x, y)\n } else {\n context.lineTo(x, y)\n }\n\n if (i === 0 || i === n) {\n boundariesPoints.push({ x, y })\n }\n }\n\n context.stroke()\n } finally {\n context.restore()\n }\n\n return boundariesPoints\n}\n\nfunction drawArrowHead (context, headPoint, angle, length) {\n const alpha = phi(angle + (Math.PI * (7 / 8)))\n const beta = phi(angle - (Math.PI * (7 / 8)))\n\n const contextReference = context\n contextReference.save()\n try {\n contextReference.fillStyle = contextReference.strokeStyle\n\n contextReference.moveTo(headPoint.x, headPoint.y)\n contextReference.beginPath()\n contextReference.lineTo(headPoint.x + (length * Math.cos(alpha)), headPoint.y + (length * Math.sin(alpha)))\n contextReference.lineTo(headPoint.x + (length * Math.cos(beta)), headPoint.y + (length * Math.sin(beta)))\n contextReference.lineTo(headPoint.x, headPoint.y)\n contextReference.fill()\n } finally {\n contextReference.restore()\n }\n}\n\nfunction drawShapeEllipse (context, shapeEllipse) {\n const points = drawEllipseArc(\n context,\n shapeEllipse.center,\n shapeEllipse.maxRadius,\n shapeEllipse.minRadius,\n shapeEllipse.orientation,\n shapeEllipse.startAngle,\n shapeEllipse.sweepAngle)\n\n if (shapeEllipse.beginDecoration && shapeEllipse.beginDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, points[0], shapeEllipse.beginTangentAngle, 12.0)\n }\n if (shapeEllipse.endDecoration && shapeEllipse.endDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, points[1], shapeEllipse.endTangentAngle, 12.0)\n }\n}\n\n/**\n * Draw a line\n * @param {Object} context Current rendering context\n * @param {{x: Number, y: Number}} p1 Origin point\n * @param {{x: Number, y: Number}} p2 Destination point\n */\nexport function drawLine (context, p1, p2) {\n context.save()\n try {\n context.beginPath()\n context.moveTo(p1.x, p1.y)\n context.lineTo(p2.x, p2.y)\n context.stroke()\n } finally {\n context.restore()\n }\n}\n\nfunction drawShapeLine (context, shapeLine) {\n drawLine(context, shapeLine.firstPoint, shapeLine.lastPoint)\n if (shapeLine.beginDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, shapeLine.firstPoint, shapeLine.beginTangentAngle, 12.0)\n }\n if (shapeLine.endDecoration === 'ARROW_HEAD') {\n drawArrowHead(context, shapeLine.lastPoint, shapeLine.endTangentAngle, 12.0)\n }\n}\n\n/**\n * Draw a shape symbol\n * @param {Object} context Current rendering context\n * @param {Object} symbol Symbol to draw\n */\nexport function drawShapeSymbol (context, symbol) {\n logger.debug(`draw ${symbol.type} symbol`)\n const contextReference = context\n contextReference.save()\n try {\n contextReference.lineWidth = symbol.width\n contextReference.strokeStyle = symbol.color\n\n if (symbol.elementType) {\n switch (symbol.elementType) {\n case ShapeSymbols.shape:\n drawShapeSymbol(contextReference, symbol.candidates[symbol.selectedCandidateIndex])\n break\n case ShapeSymbols.table:\n symbol.lines.forEach(line => drawShapeSymbol(contextReference, line))\n break\n case ShapeSymbols.line:\n drawLine(contextReference, symbol.data.p1, symbol.data.p2)\n break\n default:\n logger.error(`${symbol.elementType} not implemented`)\n break\n }\n } else {\n switch (symbol.type) {\n case ShapeSymbols.ellipse:\n drawShapeEllipse(contextReference, symbol)\n break\n case ShapeSymbols.line:\n drawShapeLine(contextReference, symbol)\n break\n case ShapeSymbols.recognizedShape:\n symbol.primitives.forEach(primitive => drawShapeSymbol(contextReference, primitive))\n break\n default:\n logger.error(`${symbol.type} not implemented`)\n break\n }\n }\n } finally {\n contextReference.restore()\n }\n}\n","import { rendererLogger as logger } from '../../../configuration/LoggerConfig'\nimport { drawLine } from './ShapeSymbolCanvasRenderer'\n\n/**\n * @type {{inputCharacter: String, char: String, string: String, textLine: String}}\n */\nexport const TextSymbols = {\n inputCharacter: 'inputCharacter',\n char: 'char',\n string: 'string',\n textLine: 'textLine'\n}\n\nfunction drawUnderline (context, underline, label, data) {\n const delta = data.width / label.length\n const p1 = {\n x: data.topLeftPoint.x + (underline.data.firstCharacter * delta),\n y: data.topLeftPoint.y + data.height\n }\n const p2 = {\n x: data.topLeftPoint.x + (underline.data.lastCharacter * delta),\n y: data.topLeftPoint.y + data.height\n }\n drawLine(context, p1, p2)\n}\n\nfunction drawText (context, label, data) {\n const contextReference = context\n contextReference.save()\n try {\n contextReference.font = `${data.textHeight}px serif`\n contextReference.textAlign = (data.justificationType === 'CENTER') ? 'center' : 'left'\n contextReference.textBaseline = 'bottom'\n contextReference.fillStyle = contextReference.strokeStyle\n contextReference.fillText(label, data.topLeftPoint.x, (data.topLeftPoint.y + data.height))\n } finally {\n contextReference.restore()\n }\n}\n\nfunction drawTextLine (context, textLine) {\n drawText(context, textLine.label, textLine.data)\n textLine.underlineList.forEach((underline) => {\n drawUnderline(context, underline, textLine.label, textLine.data)\n })\n}\n\n/**\n * Draw a text symbol\n * @param {Object} context Current rendering context\n * @param {Object} symbol Symbol to draw\n */\nexport function drawTextSymbol (context, symbol) {\n logger.debug(`draw ${symbol.type} symbol`)\n const contextReference = context\n contextReference.save()\n try {\n contextReference.lineWidth = symbol.width\n contextReference.strokeStyle = symbol.color\n\n if (symbol.elementType) {\n switch (symbol.elementType) {\n case TextSymbols.textLine:\n drawTextLine(contextReference, symbol)\n break\n default:\n logger.error(`${symbol.elementType} not implemented`)\n break\n }\n } else {\n switch (symbol.type) {\n case TextSymbols.textLine:\n drawTextLine(contextReference, symbol)\n break\n default:\n logger.error(`${symbol.type} not implemented`)\n }\n }\n } finally {\n contextReference.restore()\n }\n}\n","import { modelLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Stroke symbol\n * @typedef {Object} Stroke\n * @property {String} type=stroke Symbol type, 'stroke' for stroke\n * @property {String} pointerType=undefined Pointer type\n * @property {Number} pointerId=undefined Pointer id\n * @property {Array} x=[] X coordinates\n * @property {Array} y=[] Y coordinates\n * @property {Array} t=[] Timestamps matching x,y coordinates\n * @property {Array} p=[] Pressure\n * @property {Array} l=[] Length from origin\n * @property {Number} width=0 (for rendering) Pen/brush width\n * @property {String} color=undefined (for rendering) Pen/brush color\n */\n\n/**\n * pointerEvents symbol\n * @typedef {Object} pointerEvents\n * @property {String} type=pointerEvents Symbol type, 'pointerEvents' for pointerEvents\n * @property {Boolean} processGestures=False indicates if the gestures have to be processed\n * @property {Array} events=[] the events to process\n */\n\nfunction computeDistance (x, y, xArray, yArray, lastIndexPoint) {\n const distance = Math.sqrt(Math.pow((y - yArray[lastIndexPoint - 1]), 2) + Math.pow((x - xArray[lastIndexPoint - 1]), 2))\n return isNaN(distance) ? 0 : distance\n}\n\nfunction computeLength (x, y, xArray, yArray, lArray, lastIndexPoint) {\n const length = lArray[lastIndexPoint - 1] + computeDistance(x, y, xArray, yArray, lastIndexPoint)\n return isNaN(length) ? 0 : length\n}\n\nfunction computePressure (x, y, xArray, yArray, lArray, lastIndexPoint) {\n let ratio = 1.0\n const distance = computeDistance(x, y, xArray, yArray, lastIndexPoint)\n const length = computeLength(x, y, xArray, yArray, lArray, lastIndexPoint)\n\n if (length === 0) {\n ratio = 0.5\n } else if (distance === length) {\n ratio = 1.0\n } else if (distance < 10) {\n ratio = 0.2 + Math.pow(0.1 * distance, 0.4)\n } else if (distance > length - 10) {\n ratio = 0.2 + Math.pow(0.1 * (length - distance), 0.4)\n }\n const pressure = ratio * Math.max(0.1, 1.0 - (0.1 * Math.sqrt(distance)))\n return isNaN(parseFloat(pressure)) ? 0.5 : pressure\n}\n\nfunction filterPointByAcquisitionDelta (x, y, xArray, yArray, width) {\n const delta = (2 + (width / 4))\n let ret = false\n if (xArray.length === 0 || yArray.length === 0 || Math.abs(xArray[xArray.length - 1] - x) >= delta || Math.abs(yArray[yArray.length - 1] - y) >= delta) {\n ret = true\n }\n return ret\n}\n\n/**\n * Create a new stroke\n * @param {Object} properties Properties to be applied to the stroke.\n * @return {Stroke} New stroke with properties for quadratics draw\n */\nexport function createStrokeComponent (properties) {\n const defaultStroke = {\n type: 'stroke',\n x: [],\n y: [],\n t: [],\n p: [],\n l: [],\n width: 0\n }\n return Object.assign({}, defaultStroke, properties)\n}\n\n/**\n * Get a JSON copy of a stroke by filtering its properties\n * @param {Stroke} stroke Current stroke\n * @return {{x: Array, y: Array, t: Array}} Simplified stroke object\n */\nexport function toJSON (stroke) {\n return { x: stroke.x, y: stroke.y, t: stroke.t, pointerType: stroke.pointerType }\n}\n\n/**\n * Mutate a stroke by adding a point to it.\n * @param {Stroke} stroke Current stroke\n * @param {{x: Number, y: Number, t: Number}} point Point to add\n * @return {Stroke} Updated stroke\n */\nexport function addPoint (stroke, point) {\n const strokeReference = stroke\n if (filterPointByAcquisitionDelta(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.width)) {\n strokeReference.x.push(point.x)\n strokeReference.y.push(point.y)\n strokeReference.t.push(point.t)\n strokeReference.p.push(computePressure(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.l, strokeReference.x.length - 1))\n strokeReference.l.push(computeLength(point.x, point.y, strokeReference.x, strokeReference.y, strokeReference.l, strokeReference.x.length - 1))\n } else {\n logger.trace('ignore filtered point', point)\n }\n return strokeReference\n}\n\n/**\n * Slice a stroke and return the sliced part of it\n * @param {Stroke} stroke Current stroke\n * @param {Number} [start=0] Zero-based index at which to begin extraction\n * @param {Number} [end=length] Zero-based index at which to end extraction\n * @return {Stroke} Sliced stroke\n */\nexport function slice (stroke, start = 0, end = stroke.x.length) {\n const slicedStroke = createStrokeComponent({ color: stroke.color, width: stroke.width })\n for (let i = start; i < end; i++) {\n addPoint(slicedStroke, {\n x: stroke.x[i],\n y: stroke.y[i],\n t: stroke.t[i]\n })\n }\n return slicedStroke\n}\n\n/**\n * Extract point by index\n * @param {Stroke} stroke Current stroke\n * @param {Number} index Zero-based index\n * @return {{x: Number, y: Number, t: Number, p: Number, l: Number}} Point with properties for quadratics draw\n */\nexport function getPointByIndex (stroke, index) {\n let point\n if (index !== undefined && index >= 0 && index < stroke.x.length) {\n point = {\n x: stroke.x[index],\n y: stroke.y[index],\n t: stroke.t[index],\n p: stroke.p[index],\n l: stroke.l[index]\n }\n }\n return point\n}\n","function mergeBounds (boundsA, boundsB) {\n return {\n minX: Math.min(boundsA.minX, boundsB.minX),\n maxX: Math.max(boundsA.maxX, boundsB.maxX),\n minY: Math.min(boundsA.minY, boundsB.minY),\n maxY: Math.max(boundsA.maxY, boundsB.maxY)\n }\n}\n\nfunction getLineBounds (line) {\n return {\n minX: Math.min(line.firstPoint.x, line.lastPoint.x),\n maxX: Math.max(line.firstPoint.x, line.lastPoint.x),\n minY: Math.min(line.firstPoint.y, line.lastPoint.y),\n maxY: Math.max(line.firstPoint.y, line.lastPoint.y)\n }\n}\n\nfunction getEllipseBounds (ellipse) {\n const angleStep = 0.02 // angle delta between interpolated points on the arc, in radian\n\n let z1 = Math.cos(ellipse.orientation)\n let z3 = Math.sin(ellipse.orientation)\n let z2 = z1\n let z4 = z3\n z1 *= ellipse.maxRadius\n z2 *= ellipse.minRadius\n z3 *= ellipse.maxRadius\n z4 *= ellipse.minRadius\n\n const n = Math.abs(ellipse.sweepAngle) / angleStep\n\n const x = []\n const y = []\n\n for (let i = 0; i <= n; i++) {\n const angle = ellipse.startAngle + ((i / n) * ellipse.sweepAngle)\n const alpha = Math.atan2(Math.sin(angle) / ellipse.minRadius, Math.cos(angle) / ellipse.maxRadius)\n\n const cosAlpha = Math.cos(alpha)\n const sinAlpha = Math.sin(alpha)\n\n x.push(ellipse.center.x + ((z1 * cosAlpha) - (z4 * sinAlpha)))\n y.push(ellipse.center.y + ((z2 * sinAlpha) + (z3 * cosAlpha)))\n }\n\n return {\n minX: Math.min(...x),\n maxX: Math.max(...x),\n minY: Math.min(...y),\n maxY: Math.max(...y)\n }\n}\n\nfunction getTextLineBounds (textLine) {\n return {\n minX: textLine.data.topLeftPoint.x,\n maxX: textLine.data.topLeftPoint.x + textLine.data.width,\n minY: textLine.data.topLeftPoint.y,\n maxY: textLine.data.topLeftPoint.y + textLine.data.height\n }\n}\n\nfunction getClefBounds (clef) {\n return {\n minX: clef.boundingBox.x,\n maxX: clef.boundingBox.x + clef.boundingBox.width,\n minY: clef.boundingBox.y,\n maxY: clef.boundingBox.y + clef.boundingBox.height\n }\n}\n\nfunction getStrokeBounds (stroke) {\n return {\n minX: Math.min(...stroke.x),\n maxX: Math.max(...stroke.x),\n minY: Math.min(...stroke.y),\n maxY: Math.max(...stroke.y)\n }\n}\n\n/**\n * Get the box enclosing the given symbols\n * @param {Array} symbols Symbols to extract bounds from\n * @param {Bounds} [bounds] Starting bounds for recursion\n * @return {Bounds} Bounding box enclosing symbols\n */\nexport function getSymbolsBounds (symbols, bounds = { minX: Number.MAX_VALUE, maxX: Number.MIN_VALUE, minY: Number.MAX_VALUE, maxY: Number.MIN_VALUE }) {\n let boundsRef = bounds\n boundsRef = symbols\n .filter(symbol => symbol.type === 'stroke')\n .map(getStrokeBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'clef')\n .map(getClefBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'line')\n .map(getLineBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'ellipse')\n .map(getEllipseBounds)\n .reduce(mergeBounds, boundsRef)\n boundsRef = symbols\n .filter(symbol => symbol.type === 'textLine')\n .map(getTextLineBounds)\n .reduce(mergeBounds, boundsRef)\n return boundsRef\n}\n","import { modelLogger as logger } from '../configuration/LoggerConfig'\nimport * as StrokeComponent from './StrokeComponent'\nimport { getSymbolsBounds } from './Symbol'\n\n/**\n * Recognition positions\n * @typedef {Object} RecognitionPositions\n * @property {Number} [lastSentPosition=-1] Index of the last sent stroke.\n * @property {Number} [lastReceivedPosition=-1] Index of the last received stroke.\n * @property {Number} [lastRenderedPosition=-1] Last rendered recognized symbol position\n */\n\n/**\n * Raw results\n * @typedef {Object} RawResults\n * @property {Object} convert=undefined The convert result\n * @property {Object} exports=undefined The exports output as return by the recognition service.\n */\n\n/**\n * Editor model\n * @typedef {Object} Model\n * @property {Stroke} currentStroke=undefined Stroke in building process.\n * @property {Array} rawStrokes=[] List of captured strokes.\n * @property {Array} strokeGroups=[] Group of strokes with same pen style.\n * @property {RecognitionPositions} lastPositions Last recognition sent/received stroke indexes.\n * @property {Array} defaultSymbols=[] Default symbols, relative to the current recognition type.\n * @property {Array} recognizedSymbols=undefined Symbols to render (e.g. stroke, shape primitives, string, characters...).\n * @property {Object} exports=undefined Result of the export (e.g. mathml, latex, text...).\n * @property {RawResults} rawResults The recognition output as return by the recognition service.\n * @property {Number} creationTime Date of creation timestamp.\n * @property {Number} modificationTime=undefined Date of lastModification.\n */\n\n/**\n * Bounding box\n * @typedef {Object} Bounds\n * @property {Number} minX Minimal x coordinate\n * @property {Number} maxX Maximal x coordinate\n * @property {Number} minY Minimal y coordinate\n * @property {Number} maxY Maximal y coordinate\n */\n\n/**\n * Create a new model\n * @param {Configuration} [configuration] Parameters to use to populate default recognition symbols\n * @return {Model} New model\n */\nexport function createModel (configuration) {\n // see @typedef documentation on top\n return {\n currentStroke: undefined,\n rawStrokes: [],\n strokeGroups: [],\n lastPositions: {\n lastSentPosition: -1,\n lastReceivedPosition: -1,\n lastRenderedPosition: -1\n },\n defaultSymbols: [],\n recognizedSymbols: undefined,\n exports: undefined,\n rawResults: {\n convert: undefined,\n exports: undefined\n },\n creationTime: new Date().getTime(),\n modificationTime: undefined\n }\n}\n\n/**\n * Clear the model.\n * @param {Model} model Current model\n * @return {Model} Cleared model\n */\nexport function clearModel (model) {\n const modelReference = model\n modelReference.currentStroke = undefined\n modelReference.rawStrokes = []\n modelReference.strokeGroups = []\n modelReference.lastPositions.lastSentPosition = -1\n modelReference.lastPositions.lastReceivedPosition = -1\n modelReference.lastPositions.lastRenderedPosition = -1\n modelReference.recognizedSymbols = undefined\n modelReference.exports = undefined\n modelReference.rawResults.convert = undefined\n modelReference.rawResults.exports = undefined\n return modelReference\n}\n\n/**\n * Check if the model needs to be redrawn.\n * @param {Model} model Current model\n * @return {Boolean} True if the model needs to be redrawn, false otherwise\n */\nexport function needRedraw (model) {\n return model.recognizedSymbols ? (model.rawStrokes.length !== model.recognizedSymbols.filter(symbol => symbol.type === 'stroke').length) : false\n}\n\n/**\n * Mutate the model given in parameter by adding the new strokeToAdd.\n * @param {Model} model Current model\n * @param {Stroke} stroke Stroke to be added to pending ones\n * @return {Model} Updated model\n */\nexport function addStroke (model, stroke) {\n // We use a reference to the model. The purpose here is to update the pending stroke only.\n const modelReference = model\n logger.debug('addStroke', stroke)\n modelReference.rawStrokes.push(stroke)\n return modelReference\n}\n\n/**\n * Mutate the model given in parameter by adding the new strokeToAdd and the penstyle. Used for iink REST.\n * @param {Model} model Current model\n * @param {Stroke} stroke Stroke to be added to pending ones\n * @param {PenStyle} strokePenStyle\n * @return {Model} Updated model\n */\nexport function addStrokeToGroup (model, stroke, strokePenStyle) {\n // We use a reference to the model. The purpose here is to update the pending stroke only.\n const modelReference = model\n logger.debug('addStroke', stroke)\n const lastGroup = modelReference.strokeGroups.length - 1\n if (modelReference.strokeGroups[lastGroup] && modelReference.strokeGroups[lastGroup].penStyle === strokePenStyle) {\n modelReference.strokeGroups[lastGroup].strokes.push(stroke)\n } else {\n const newStrokeGroup = {\n penStyle: strokePenStyle,\n strokes: []\n }\n const strokeCopy = {}\n Object.assign(strokeCopy, stroke)\n newStrokeGroup.strokes.push(strokeCopy)\n modelReference.strokeGroups.push(newStrokeGroup)\n }\n return modelReference\n}\n\n/**\n * Get the strokes that needs to be recognized\n * @param {Model} model Current model\n * @param {Number} [position=lastReceived] Index from where to extract strokes\n * @return {Array} Pending strokes\n */\nexport function extractPendingStrokes (model, position = model.lastPositions.lastReceivedPosition + 1) {\n return model.rawStrokes.slice(position)\n}\n\n/**\n * Mutate the model by adding a point and close the current stroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to create current stroke\n * @param {Object} properties Properties to be applied to the current stroke\n * @param {Number} [dpi=96] The screen dpi resolution\n * @return {Model} Updated model\n */\nexport function initPendingStroke (model, point, properties, dpi = 96) {\n if (properties && properties['-myscript-pen-width']) {\n const pxWidth = (properties['-myscript-pen-width'] * dpi) / 25.4\n Object.assign(properties, { width: pxWidth / 2 }) // FIXME hack to get better render\n }\n const modelReference = model\n logger.trace('initPendingStroke', point)\n // Setting the current stroke to an empty one\n modelReference.currentStroke = StrokeComponent.createStrokeComponent(properties)\n modelReference.currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n return modelReference\n}\n\n/**\n * Mutate the model by adding a point to the current pending stroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to be append to the current stroke\n * @return {Model} Updated model\n */\nexport function appendToPendingStroke (model, point) {\n const modelReference = model\n if (modelReference.currentStroke) {\n logger.trace('appendToPendingStroke', point)\n modelReference.currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n }\n return modelReference\n}\n\n/**\n * Mutate the model by adding the new point on a initPendingStroke.\n * @param {Model} model Current model\n * @param {{x: Number, y: Number, t: Number}} point Captured point to be append to the current stroke\n * @param {PenStyle} penStyle\n * @return {Model} Updated model\n */\nexport function endPendingStroke (model, point, penStyle) {\n const modelReference = model\n if (modelReference.currentStroke) {\n logger.trace('endPendingStroke', point)\n const currentStroke = StrokeComponent.addPoint(modelReference.currentStroke, point)\n // Mutating pending strokes\n addStroke(modelReference, currentStroke)\n addStrokeToGroup(modelReference, currentStroke, penStyle)\n // Resetting the current stroke to an undefined one\n delete modelReference.currentStroke\n }\n return modelReference\n}\n\n/**\n * Get the bounds of the current model.\n * @param {Model} model Current model\n * @return {Bounds} Bounding box enclosing the current drawn model\n */\nexport function getBorderCoordinates (model) {\n let modelBounds = { minX: Number.MAX_VALUE, maxX: Number.MIN_VALUE, minY: Number.MAX_VALUE, maxY: Number.MIN_VALUE }\n\n // Default symbols\n if (model.defaultSymbols && model.defaultSymbols.length > 0) {\n modelBounds = getSymbolsBounds(model.defaultSymbols, modelBounds)\n }\n // Recognized symbols\n if (model.recognizedSymbols && model.recognizedSymbols.length > 0) {\n modelBounds = getSymbolsBounds(model.recognizedSymbols, modelBounds)\n // Pending strokes\n modelBounds = getSymbolsBounds(extractPendingStrokes(model), modelBounds)\n } else {\n modelBounds = getSymbolsBounds(model.rawStrokes, modelBounds)\n }\n return modelBounds\n}\n\n/**\n * Extract strokes from an ink range\n * @param {Model} model Current model\n * @param {Number} firstStroke First stroke index to extract\n * @param {Number} lastStroke Last stroke index to extract\n * @param {Number} firstPoint First point index to extract\n * @param {Number} lastPoint Last point index to extract\n * @return {Array} The extracted strokes\n */\nexport function extractStrokesFromInkRange (model, firstStroke, lastStroke, firstPoint, lastPoint) {\n return model.rawStrokes.slice(firstStroke, lastStroke + 1).map((stroke, index, slicedStrokes) => {\n if (slicedStrokes.length < 2) {\n return StrokeComponent.slice(stroke, firstPoint, lastPoint + 1)\n }\n if (index === 0) {\n return StrokeComponent.slice(stroke, firstPoint)\n }\n if (index === (slicedStrokes.length - 1)) {\n return StrokeComponent.slice(stroke, 0, lastPoint + 1)\n }\n return stroke\n })\n}\n\n/**\n * Update model lastSentPosition\n * @param {Model} model\n * @param {Number} [position]\n * @return {Model}\n */\nexport function updateModelSentPosition (model, position = model.rawStrokes.length - 1) {\n const modelReference = model\n modelReference.lastPositions.lastSentPosition = position\n return modelReference\n}\n\n/**\n * Update model lastReceivedPosition regarding to lastSentPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function updateModelReceivedPosition (model) {\n const modelReference = model\n modelReference.lastPositions.lastReceivedPosition = modelReference.lastPositions.lastSentPosition\n return modelReference\n}\n\n/**\n * Reset model lastReceivedPosition and lastSentPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function resetModelPositions (model) {\n const modelReference = model\n modelReference.lastPositions.lastSentPosition = -1\n modelReference.lastPositions.lastReceivedPosition = -1\n return modelReference\n}\n\n/**\n * Reset model lastRenderedPosition\n * @param {Model} model\n * @return {Model}\n */\nexport function resetModelRendererPosition (model) {\n const modelReference = model\n modelReference.lastPositions.lastRenderedPosition = -1\n return modelReference\n}\n\n/**\n * Update model lastRenderedPosition\n * @param {Model} model\n * @param {Number} [position]\n * @return {Model}\n */\nexport function updateModelRenderedPosition (model, position = model.recognizedSymbols ? model.recognizedSymbols.length - 1 : -1) {\n const modelReference = model\n modelReference.lastPositions.lastRenderedPosition = position\n return modelReference\n}\n\n/**\n * Get the symbols that needs to be rendered\n * @param {Model} model Current model\n * @param {Number} [position=lastRendered] Index from where to extract symbols\n * @return {Array}\n */\nexport function extractPendingRecognizedSymbols (model, position = model.lastPositions.lastRenderedPosition + 1) {\n return model.recognizedSymbols ? model.recognizedSymbols.slice(position) : []\n}\n\n/**\n * Clone model\n * @param {Model} model Current model\n * @return {Model} Clone of the current model\n */\nexport function cloneModel (model) {\n const clonedModel = Object.assign({}, model)\n // We clone the properties that need to be. Take care of arrays.\n clonedModel.defaultSymbols = [...model.defaultSymbols]\n clonedModel.currentStroke = model.currentStroke ? Object.assign({}, model.currentStroke) : undefined\n clonedModel.rawStrokes = [...model.rawStrokes]\n clonedModel.strokeGroups = JSON.parse(JSON.stringify(model.strokeGroups))\n clonedModel.lastPositions = Object.assign({}, model.lastPositions)\n clonedModel.exports = model.exports ? Object.assign({}, model.exports) : undefined\n clonedModel.rawResults = Object.assign({}, model.rawResults)\n clonedModel.recognizedSymbols = model.recognizedSymbols ? [...model.recognizedSymbols] : undefined\n return clonedModel\n}\n\n/**\n * Merge models\n * @param {...Model} models Models to merge (ordered)\n * @return {Model} Updated model\n */\nexport function mergeModels (...models) {\n return models.reduce((a, b) => {\n const modelRef = a\n modelRef.recognizedSymbols = b.recognizedSymbols\n modelRef.lastPositions.lastSentPosition = b.lastPositions.lastSentPosition\n modelRef.lastPositions.lastReceivedPosition = b.lastPositions.lastReceivedPosition\n modelRef.lastPositions.lastRenderedPosition = b.lastPositions.lastRenderedPosition\n modelRef.rawResults = b.rawResults\n modelRef.exports = b.exports\n return modelRef\n })\n}\n","import { rendererLogger as logger } from '../../configuration/LoggerConfig'\nimport { drawStroke } from './symbols/StrokeSymbolCanvasRenderer'\nimport { drawTextSymbol, TextSymbols } from './symbols/TextSymbolCanvasRenderer'\nimport { drawShapeSymbol, ShapeSymbols } from './symbols/ShapeSymbolCanvasRenderer'\nimport * as InkModel from '../../model/InkModel'\n\n/**\n * Renderer info\n * @typedef {Object} RendererInfo\n * @property {String} type Renderer type.\n * @property {String} apiVersion Supported api version.\n */\n\n/**\n * Default renderer\n * @typedef {Object} Renderer\n * @property {function} getInfo Get some information about this renderer\n * @property {function} attach Populate the DOM element to create rendering area.\n * @property {function} detach Remove rendering area from the DOM element.\n * @property {function} resize Explicitly resize the rendering area.\n * @property {function} drawCurrentStroke Draw the model currentStroke.\n * @property {function} drawModel Draw the model defaultSymbols and recognizedSymbols.\n */\n\n/**\n * Get info\n * @return {RendererInfo} Information about this renderer\n */\nexport function getInfo () {\n return {\n type: 'canvas'\n }\n}\n\nfunction getPixelRatio (canvas) {\n if (canvas) {\n const context = canvas.getContext('2d')\n // we are using a browser object\n // eslint-disable-next-line no-undef\n const devicePixelRatio = window.devicePixelRatio || 1\n const backingStoreRatio = context.webkitBackingStorePixelRatio ||\n context.mozBackingStorePixelRatio ||\n context.msBackingStorePixelRatio ||\n context.oBackingStorePixelRatio ||\n context.backingStorePixelRatio || 1\n return devicePixelRatio / backingStoreRatio\n }\n return 1\n}\n\nfunction detectPixelRatio (element) {\n // we are using a browser object\n // eslint-disable-next-line no-undef\n const tempCanvas = document.createElement('canvas')\n const canvasRatio = getPixelRatio(tempCanvas)\n // document.removeChild(tempCanvas);\n return canvasRatio\n}\n\nfunction createCanvas (element, type) {\n // eslint-disable-next-line no-undef\n const browserDocument = document\n const canvas = browserDocument.createElement('canvas')\n canvas.classList.add(type)\n canvas.classList.add('ms-canvas')\n element.appendChild(canvas)\n logger.debug('canvas created', canvas)\n return canvas\n}\n\nfunction resizeContent (context) {\n const elements = [context.renderingCanvas, context.capturingCanvas]\n elements.forEach((canvas) => {\n const domElement = canvas.parentNode\n const width = domElement.clientWidth < context.minWidth ? context.minWidth : domElement.clientWidth\n const height = domElement.clientHeight < context.minHeight ? context.minHeight : domElement.clientHeight\n /* eslint-disable no-param-reassign */\n canvas.width = width * context.pixelRatio\n canvas.height = height * context.pixelRatio\n canvas.style.width = `${width}px`\n canvas.style.height = `${height}px`\n /* eslint-enable no-param-reassign */\n canvas.getContext('2d').scale(context.pixelRatio, context.pixelRatio)\n logger.debug('canvas size changed', canvas)\n })\n return context\n}\n\n/**\n * Attach the renderer to the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Number} [minHeight=0] Minimal height of the editor\n * @param {Number} [minWidth=0] Minimal width of the editor\n * @return {Object} The renderer context to give as parameter when a draw model will be call\n */\nexport function attach (element, minHeight = 0, minWidth = 0) {\n logger.debug('attach renderer', element)\n const pixelRatio = detectPixelRatio(element)\n\n const renderingCanvas = createCanvas(element, 'ms-rendering-canvas')\n const capturingCanvas = createCanvas(element, 'ms-capture-canvas')\n\n const context = {\n pixelRatio,\n minHeight,\n minWidth,\n renderingCanvas,\n renderingCanvasContext: renderingCanvas.getContext('2d'),\n capturingCanvas,\n capturingCanvasContext: capturingCanvas.getContext('2d')\n }\n\n return resizeContent(context)\n}\n\n/**\n * Detach the renderer from the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Object} context Current rendering context\n */\nexport function detach (element, context) {\n logger.debug('detach renderer', element)\n element.removeChild(context.renderingCanvas)\n element.removeChild(context.capturingCanvas)\n}\n\n/**\n * Update the rendering context size\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function resize (context, model, stroker) {\n return this.drawModel(resizeContent(context), model, stroker)\n}\n\nfunction drawSymbol (context, symbol, stroker) {\n const type = symbol.elementType ? symbol.elementType : symbol.type\n logger.trace(`attempting to draw ${type} symbol`)\n if (type === 'stroke') {\n drawStroke(context, symbol, stroker)\n } else if (TextSymbols[type]) {\n drawTextSymbol(context, symbol)\n } else if (ShapeSymbols[type]) {\n drawShapeSymbol(context, symbol)\n } else {\n logger.warn(`impossible to draw ${type} symbol`)\n }\n}\n\n/**\n * Draw the current stroke from the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawCurrentStroke (context, model, stroker) {\n // Render the current stroke\n context.capturingCanvasContext.clearRect(0, 0, context.capturingCanvas.width, context.capturingCanvas.height)\n logger.trace('drawing current stroke ', model.currentStroke)\n drawStroke(context.capturingCanvasContext, model.currentStroke, stroker)\n return model\n}\n\n/**\n * Draw all symbols contained into the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawModel (context, model, stroker) {\n context.renderingCanvasContext.clearRect(0, 0, context.renderingCanvas.width, context.renderingCanvas.height)\n // Displaying the default symbols and pending strokes\n const symbols = [...model.defaultSymbols]\n // Displaying the recognition symbols or raw strokes\n if (model.recognizedSymbols) {\n symbols.push(...model.recognizedSymbols)\n symbols.push(...InkModel.extractPendingStrokes(model))\n } else {\n symbols.push(...model.rawStrokes)\n }\n symbols.forEach(symbol => drawSymbol(context.renderingCanvasContext, symbol, stroker))\n context.capturingCanvasContext.clearRect(0, 0, context.capturingCanvas.width, context.capturingCanvas.height)\n return model\n}\n","/** ===============================================================================================\n * Compute quadratics control points\n * ============================================================================================= */\n\n/**\n *\n * @param {{x: Number, y: Number, p: Number}} point\n * @param angle\n * @param width\n * @return {({x: number, y: *}|{x: *, y: number})}\n */\nexport function computeLinksPoints (point, angle, width) {\n const radius = point.p * width\n return [{\n x: (point.x - (Math.sin(angle) * radius)),\n y: (point.y + (Math.cos(angle) * radius))\n }, {\n x: (point.x + (Math.sin(angle) * radius)),\n y: (point.y - (Math.cos(angle) * radius))\n }]\n}\n\n/**\n *\n * @param {{x: Number, y: Number, p: Number}} point1\n * @param {{x: Number, y: Number, p: Number}} point2\n * @return {{x: Number, y: Number, p: Number}}\n */\nexport function computeMiddlePoint (point1, point2) {\n return {\n x: ((point2.x + point1.x) / 2),\n y: ((point2.y + point1.y) / 2),\n p: ((point2.p + point1.p) / 2)\n }\n}\n\n/**\n *\n * @param {{x: Number, y: Number}} begin\n * @param {{x: Number, y: Number}} end\n * @return {Number}\n */\nexport function computeAxeAngle (begin, end) {\n return Math.atan2(end.y - begin.y, end.x - begin.x)\n}\n","import * as StrokeComponent from '../../../model/StrokeComponent'\nimport { computeLinksPoints, computeMiddlePoint, computeAxeAngle } from '../../QuadraticUtils'\n\n/**\n * Stroker info\n * @typedef {Object} StrokerInfo\n * @property {String} type Renderer type.\n * @property {String} name Stroker name.\n * @property {String} apiVersion Supported api version.\n */\n\n/**\n * Define how a stroke should be drawn\n * @typedef {Object} Stroker\n * @property {function} getInfo Get some information about this stroker\n * @property {function} drawStroke Render a stroke on the current context.\n */\n\n/**\n * Get info\n * @return {StrokerInfo} Information about this stroker\n */\nexport function getInfo () {\n return {\n type: 'canvas',\n name: 'quadratic'\n }\n}\n\nfunction renderArc (context, center, radius) {\n context.arc(center.x, center.y, radius, 0, Math.PI * 2, true)\n}\n\nfunction renderLine (context, begin, end, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, end), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(begin, end), width)\n\n context.moveTo(linkPoints1[0].x, linkPoints1[0].y)\n context.lineTo(linkPoints2[0].x, linkPoints2[0].y)\n context.lineTo(linkPoints2[1].x, linkPoints2[1].y)\n context.lineTo(linkPoints1[1].x, linkPoints1[1].y)\n}\n\nfunction renderFinal (context, begin, end, width) {\n const ARCSPLIT = 6\n const angle = computeAxeAngle(begin, end)\n const linkPoints = computeLinksPoints(end, angle, width)\n context.moveTo(linkPoints[0].x, linkPoints[0].y)\n for (let i = 1; i <= ARCSPLIT; i++) {\n const newAngle = angle - ((i * Math.PI) / ARCSPLIT)\n context.lineTo(end.x - ((end.p * width) * Math.sin(newAngle)), end.y + (end.p * width * Math.cos(newAngle)))\n }\n}\n\nfunction renderQuadratic (context, begin, end, ctrl, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, ctrl), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(ctrl, end), width)\n const linkPoints3 = computeLinksPoints(ctrl, computeAxeAngle(begin, end), width)\n\n context.moveTo(linkPoints1[0].x, linkPoints1[0].y)\n context.quadraticCurveTo(linkPoints3[0].x, linkPoints3[0].y, linkPoints2[0].x, linkPoints2[0].y)\n context.lineTo(linkPoints2[1].x, linkPoints2[1].y)\n context.quadraticCurveTo(linkPoints3[1].x, linkPoints3[1].y, linkPoints1[1].x, linkPoints1[1].y)\n}\n\n/**\n * Draw a stroke on a canvas, using quadratics\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Current stroke to be drawn\n */\nexport function drawStroke (context, stroke) {\n const contextReference = context\n const length = stroke.x.length\n const width = stroke.width > 0 ? stroke.width : contextReference.lineWidth\n const color = stroke.color ? stroke.color : contextReference.strokeStyle\n const firstPoint = StrokeComponent.getPointByIndex(stroke, 0)\n const nbquadratics = length - 2\n\n contextReference.save()\n try {\n contextReference.beginPath()\n if (length < 3) {\n renderArc(contextReference, firstPoint, width * 0.6)\n } else {\n renderArc(contextReference, firstPoint, width * firstPoint.p)\n renderLine(contextReference, firstPoint, computeMiddlePoint(firstPoint, StrokeComponent.getPointByIndex(stroke, 1)), width)\n\n // Possibility to try this (the start looks better when the ink is large)\n // var first = computeMiddlePoint(stroke[0], stroke[1]);\n // contextReference.arc(first.x, first.y, width * first.p, 0, Math.PI * 2, true);\n\n for (let i = 0; i < nbquadratics; i++) {\n renderQuadratic(contextReference, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i), StrokeComponent.getPointByIndex(stroke, i + 1)), computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i + 1), StrokeComponent.getPointByIndex(stroke, i + 2)), StrokeComponent.getPointByIndex(stroke, i + 1), width)\n }\n renderLine(contextReference, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1)), StrokeComponent.getPointByIndex(stroke, length - 1), width)\n renderFinal(contextReference, StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1), width)\n }\n contextReference.closePath()\n if (color !== undefined) {\n contextReference.fillStyle = color\n contextReference.fill()\n }\n } finally {\n contextReference.restore()\n }\n}\n","export var xhtml = \"http://www.w3.org/1999/xhtml\";\n\nexport default {\n svg: \"http://www.w3.org/2000/svg\",\n xhtml: xhtml,\n xlink: \"http://www.w3.org/1999/xlink\",\n xml: \"http://www.w3.org/XML/1998/namespace\",\n xmlns: \"http://www.w3.org/2000/xmlns/\"\n};\n","import namespaces from \"./namespaces\";\n\nexport default function(name) {\n var prefix = name += \"\", i = prefix.indexOf(\":\");\n if (i >= 0 && (prefix = name.slice(0, i)) !== \"xmlns\") name = name.slice(i + 1);\n return namespaces.hasOwnProperty(prefix) ? {space: namespaces[prefix], local: name} : name;\n}\n","import namespace from \"./namespace\";\nimport {xhtml} from \"./namespaces\";\n\nfunction creatorInherit(name) {\n return function() {\n var document = this.ownerDocument,\n uri = this.namespaceURI;\n return uri === xhtml && document.documentElement.namespaceURI === xhtml\n ? document.createElement(name)\n : document.createElementNS(uri, name);\n };\n}\n\nfunction creatorFixed(fullname) {\n return function() {\n return this.ownerDocument.createElementNS(fullname.space, fullname.local);\n };\n}\n\nexport default function(name) {\n var fullname = namespace(name);\n return (fullname.local\n ? creatorFixed\n : creatorInherit)(fullname);\n}\n","function none() {}\n\nexport default function(selector) {\n return selector == null ? none : function() {\n return this.querySelector(selector);\n };\n}\n","function empty() {\n return [];\n}\n\nexport default function(selector) {\n return selector == null ? empty : function() {\n return this.querySelectorAll(selector);\n };\n}\n","export default function(update) {\n return new Array(update.length);\n}\n","import sparse from \"./sparse\";\nimport {Selection} from \"./index\";\n\nexport default function() {\n return new Selection(this._enter || this._groups.map(sparse), this._parents);\n}\n\nexport function EnterNode(parent, datum) {\n this.ownerDocument = parent.ownerDocument;\n this.namespaceURI = parent.namespaceURI;\n this._next = null;\n this._parent = parent;\n this.__data__ = datum;\n}\n\nEnterNode.prototype = {\n constructor: EnterNode,\n appendChild: function(child) { return this._parent.insertBefore(child, this._next); },\n insertBefore: function(child, next) { return this._parent.insertBefore(child, next); },\n querySelector: function(selector) { return this._parent.querySelector(selector); },\n querySelectorAll: function(selector) { return this._parent.querySelectorAll(selector); }\n};\n","import {Selection} from \"./index\";\nimport {EnterNode} from \"./enter\";\nimport constant from \"../constant\";\n\nvar keyPrefix = \"$\"; // Protect against keys like “__proto__”.\n\nfunction bindIndex(parent, group, enter, update, exit, data) {\n var i = 0,\n node,\n groupLength = group.length,\n dataLength = data.length;\n\n // Put any non-null nodes that fit into update.\n // Put any null nodes into enter.\n // Put any remaining data into enter.\n for (; i < dataLength; ++i) {\n if (node = group[i]) {\n node.__data__ = data[i];\n update[i] = node;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Put any non-null nodes that don’t fit into exit.\n for (; i < groupLength; ++i) {\n if (node = group[i]) {\n exit[i] = node;\n }\n }\n}\n\nfunction bindKey(parent, group, enter, update, exit, data, key) {\n var i,\n node,\n nodeByKeyValue = {},\n groupLength = group.length,\n dataLength = data.length,\n keyValues = new Array(groupLength),\n keyValue;\n\n // Compute the key for each node.\n // If multiple nodes have the same key, the duplicates are added to exit.\n for (i = 0; i < groupLength; ++i) {\n if (node = group[i]) {\n keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group);\n if (keyValue in nodeByKeyValue) {\n exit[i] = node;\n } else {\n nodeByKeyValue[keyValue] = node;\n }\n }\n }\n\n // Compute the key for each datum.\n // If there a node associated with this key, join and add it to update.\n // If there is not (or the key is a duplicate), add it to enter.\n for (i = 0; i < dataLength; ++i) {\n keyValue = keyPrefix + key.call(parent, data[i], i, data);\n if (node = nodeByKeyValue[keyValue]) {\n update[i] = node;\n node.__data__ = data[i];\n nodeByKeyValue[keyValue] = null;\n } else {\n enter[i] = new EnterNode(parent, data[i]);\n }\n }\n\n // Add any remaining nodes that were not bound to data to exit.\n for (i = 0; i < groupLength; ++i) {\n if ((node = group[i]) && (nodeByKeyValue[keyValues[i]] === node)) {\n exit[i] = node;\n }\n }\n}\n\nexport default function(value, key) {\n if (!value) {\n data = new Array(this.size()), j = -1;\n this.each(function(d) { data[++j] = d; });\n return data;\n }\n\n var bind = key ? bindKey : bindIndex,\n parents = this._parents,\n groups = this._groups;\n\n if (typeof value !== \"function\") value = constant(value);\n\n for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {\n var parent = parents[j],\n group = groups[j],\n groupLength = group.length,\n data = value.call(parent, parent && parent.__data__, j, parents),\n dataLength = data.length,\n enterGroup = enter[j] = new Array(dataLength),\n updateGroup = update[j] = new Array(dataLength),\n exitGroup = exit[j] = new Array(groupLength);\n\n bind(parent, group, enterGroup, updateGroup, exitGroup, data, key);\n\n // Now connect the enter nodes to their following update node, such that\n // appendChild can insert the materialized enter node before this node,\n // rather than at the end of the parent node.\n for (var i0 = 0, i1 = 0, previous, next; i0 < dataLength; ++i0) {\n if (previous = enterGroup[i0]) {\n if (i0 >= i1) i1 = i0 + 1;\n while (!(next = updateGroup[i1]) && ++i1 < dataLength);\n previous._next = next || null;\n }\n }\n }\n\n update = new Selection(update, parents);\n update._enter = enter;\n update._exit = exit;\n return update;\n}\n","import {Selection} from \"./index\";\n\nexport default function(compare) {\n if (!compare) compare = ascending;\n\n function compareNode(a, b) {\n return a && b ? compare(a.__data__, b.__data__) : !a - !b;\n }\n\n for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n sortgroup[i] = node;\n }\n }\n sortgroup.sort(compareNode);\n }\n\n return new Selection(sortgroups, this._parents).order();\n}\n\nfunction ascending(a, b) {\n return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;\n}\n","import namespace from \"../namespace\";\n\nfunction attrRemove(name) {\n return function() {\n this.removeAttribute(name);\n };\n}\n\nfunction attrRemoveNS(fullname) {\n return function() {\n this.removeAttributeNS(fullname.space, fullname.local);\n };\n}\n\nfunction attrConstant(name, value) {\n return function() {\n this.setAttribute(name, value);\n };\n}\n\nfunction attrConstantNS(fullname, value) {\n return function() {\n this.setAttributeNS(fullname.space, fullname.local, value);\n };\n}\n\nfunction attrFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttribute(name);\n else this.setAttribute(name, v);\n };\n}\n\nfunction attrFunctionNS(fullname, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.removeAttributeNS(fullname.space, fullname.local);\n else this.setAttributeNS(fullname.space, fullname.local, v);\n };\n}\n\nexport default function(name, value) {\n var fullname = namespace(name);\n\n if (arguments.length < 2) {\n var node = this.node();\n return fullname.local\n ? node.getAttributeNS(fullname.space, fullname.local)\n : node.getAttribute(fullname);\n }\n\n return this.each((value == null\n ? (fullname.local ? attrRemoveNS : attrRemove) : (typeof value === \"function\"\n ? (fullname.local ? attrFunctionNS : attrFunction)\n : (fullname.local ? attrConstantNS : attrConstant)))(fullname, value));\n}\n","export default function(node) {\n return (node.ownerDocument && node.ownerDocument.defaultView) // node is a Node\n || (node.document && node) // node is a Window\n || node.defaultView; // node is a Document\n}\n","import defaultView from \"../window\";\n\nfunction styleRemove(name) {\n return function() {\n this.style.removeProperty(name);\n };\n}\n\nfunction styleConstant(name, value, priority) {\n return function() {\n this.style.setProperty(name, value, priority);\n };\n}\n\nfunction styleFunction(name, value, priority) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) this.style.removeProperty(name);\n else this.style.setProperty(name, v, priority);\n };\n}\n\nexport default function(name, value, priority) {\n return arguments.length > 1\n ? this.each((value == null\n ? styleRemove : typeof value === \"function\"\n ? styleFunction\n : styleConstant)(name, value, priority == null ? \"\" : priority))\n : styleValue(this.node(), name);\n}\n\nexport function styleValue(node, name) {\n return node.style.getPropertyValue(name)\n || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);\n}\n","function propertyRemove(name) {\n return function() {\n delete this[name];\n };\n}\n\nfunction propertyConstant(name, value) {\n return function() {\n this[name] = value;\n };\n}\n\nfunction propertyFunction(name, value) {\n return function() {\n var v = value.apply(this, arguments);\n if (v == null) delete this[name];\n else this[name] = v;\n };\n}\n\nexport default function(name, value) {\n return arguments.length > 1\n ? this.each((value == null\n ? propertyRemove : typeof value === \"function\"\n ? propertyFunction\n : propertyConstant)(name, value))\n : this.node()[name];\n}\n","function classArray(string) {\n return string.trim().split(/^|\\s+/);\n}\n\nfunction classList(node) {\n return node.classList || new ClassList(node);\n}\n\nfunction ClassList(node) {\n this._node = node;\n this._names = classArray(node.getAttribute(\"class\") || \"\");\n}\n\nClassList.prototype = {\n add: function(name) {\n var i = this._names.indexOf(name);\n if (i < 0) {\n this._names.push(name);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n remove: function(name) {\n var i = this._names.indexOf(name);\n if (i >= 0) {\n this._names.splice(i, 1);\n this._node.setAttribute(\"class\", this._names.join(\" \"));\n }\n },\n contains: function(name) {\n return this._names.indexOf(name) >= 0;\n }\n};\n\nfunction classedAdd(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.add(names[i]);\n}\n\nfunction classedRemove(node, names) {\n var list = classList(node), i = -1, n = names.length;\n while (++i < n) list.remove(names[i]);\n}\n\nfunction classedTrue(names) {\n return function() {\n classedAdd(this, names);\n };\n}\n\nfunction classedFalse(names) {\n return function() {\n classedRemove(this, names);\n };\n}\n\nfunction classedFunction(names, value) {\n return function() {\n (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);\n };\n}\n\nexport default function(name, value) {\n var names = classArray(name + \"\");\n\n if (arguments.length < 2) {\n var list = classList(this.node()), i = -1, n = names.length;\n while (++i < n) if (!list.contains(names[i])) return false;\n return true;\n }\n\n return this.each((typeof value === \"function\"\n ? classedFunction : value\n ? classedTrue\n : classedFalse)(names, value));\n}\n","function textRemove() {\n this.textContent = \"\";\n}\n\nfunction textConstant(value) {\n return function() {\n this.textContent = value;\n };\n}\n\nfunction textFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.textContent = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? textRemove : (typeof value === \"function\"\n ? textFunction\n : textConstant)(value))\n : this.node().textContent;\n}\n","function htmlRemove() {\n this.innerHTML = \"\";\n}\n\nfunction htmlConstant(value) {\n return function() {\n this.innerHTML = value;\n };\n}\n\nfunction htmlFunction(value) {\n return function() {\n var v = value.apply(this, arguments);\n this.innerHTML = v == null ? \"\" : v;\n };\n}\n\nexport default function(value) {\n return arguments.length\n ? this.each(value == null\n ? htmlRemove : (typeof value === \"function\"\n ? htmlFunction\n : htmlConstant)(value))\n : this.node().innerHTML;\n}\n","function raise() {\n if (this.nextSibling) this.parentNode.appendChild(this);\n}\n\nexport default function() {\n return this.each(raise);\n}\n","function lower() {\n if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild);\n}\n\nexport default function() {\n return this.each(lower);\n}\n","import creator from \"../creator\";\nimport selector from \"../selector\";\n\nfunction constantNull() {\n return null;\n}\n\nexport default function(name, before) {\n var create = typeof name === \"function\" ? name : creator(name),\n select = before == null ? constantNull : typeof before === \"function\" ? before : selector(before);\n return this.select(function() {\n return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);\n });\n}\n","function remove() {\n var parent = this.parentNode;\n if (parent) parent.removeChild(this);\n}\n\nexport default function() {\n return this.each(remove);\n}\n","function selection_cloneShallow() {\n var clone = this.cloneNode(false), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nfunction selection_cloneDeep() {\n var clone = this.cloneNode(true), parent = this.parentNode;\n return parent ? parent.insertBefore(clone, this.nextSibling) : clone;\n}\n\nexport default function(deep) {\n return this.select(deep ? selection_cloneDeep : selection_cloneShallow);\n}\n","var filterEvents = {};\n\nexport var event = null;\n\nif (typeof document !== \"undefined\") {\n var element = document.documentElement;\n if (!(\"onmouseenter\" in element)) {\n filterEvents = {mouseenter: \"mouseover\", mouseleave: \"mouseout\"};\n }\n}\n\nfunction filterContextListener(listener, index, group) {\n listener = contextListener(listener, index, group);\n return function(event) {\n var related = event.relatedTarget;\n if (!related || (related !== this && !(related.compareDocumentPosition(this) & 8))) {\n listener.call(this, event);\n }\n };\n}\n\nfunction contextListener(listener, index, group) {\n return function(event1) {\n var event0 = event; // Events can be reentrant (e.g., focus).\n event = event1;\n try {\n listener.call(this, this.__data__, index, group);\n } finally {\n event = event0;\n }\n };\n}\n\nfunction parseTypenames(typenames) {\n return typenames.trim().split(/^|\\s+/).map(function(t) {\n var name = \"\", i = t.indexOf(\".\");\n if (i >= 0) name = t.slice(i + 1), t = t.slice(0, i);\n return {type: t, name: name};\n });\n}\n\nfunction onRemove(typename) {\n return function() {\n var on = this.__on;\n if (!on) return;\n for (var j = 0, i = -1, m = on.length, o; j < m; ++j) {\n if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n } else {\n on[++i] = o;\n }\n }\n if (++i) on.length = i;\n else delete this.__on;\n };\n}\n\nfunction onAdd(typename, value, capture) {\n var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;\n return function(d, i, group) {\n var on = this.__on, o, listener = wrap(value, i, group);\n if (on) for (var j = 0, m = on.length; j < m; ++j) {\n if ((o = on[j]).type === typename.type && o.name === typename.name) {\n this.removeEventListener(o.type, o.listener, o.capture);\n this.addEventListener(o.type, o.listener = listener, o.capture = capture);\n o.value = value;\n return;\n }\n }\n this.addEventListener(typename.type, listener, capture);\n o = {type: typename.type, name: typename.name, value: value, listener: listener, capture: capture};\n if (!on) this.__on = [o];\n else on.push(o);\n };\n}\n\nexport default function(typename, value, capture) {\n var typenames = parseTypenames(typename + \"\"), i, n = typenames.length, t;\n\n if (arguments.length < 2) {\n var on = this.node().__on;\n if (on) for (var j = 0, m = on.length, o; j < m; ++j) {\n for (i = 0, o = on[j]; i < n; ++i) {\n if ((t = typenames[i]).type === o.type && t.name === o.name) {\n return o.value;\n }\n }\n }\n return;\n }\n\n on = value ? onAdd : onRemove;\n if (capture == null) capture = false;\n for (i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));\n return this;\n}\n\nexport function customEvent(event1, listener, that, args) {\n var event0 = event;\n event1.sourceEvent = event;\n event = event1;\n try {\n return listener.apply(that, args);\n } finally {\n event = event0;\n }\n}\n","import defaultView from \"../window\";\n\nfunction dispatchEvent(node, type, params) {\n var window = defaultView(node),\n event = window.CustomEvent;\n\n if (typeof event === \"function\") {\n event = new event(type, params);\n } else {\n event = window.document.createEvent(\"Event\");\n if (params) event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail;\n else event.initEvent(type, false, false);\n }\n\n node.dispatchEvent(event);\n}\n\nfunction dispatchConstant(type, params) {\n return function() {\n return dispatchEvent(this, type, params);\n };\n}\n\nfunction dispatchFunction(type, params) {\n return function() {\n return dispatchEvent(this, type, params.apply(this, arguments));\n };\n}\n\nexport default function(type, params) {\n return this.each((typeof params === \"function\"\n ? dispatchFunction\n : dispatchConstant)(type, params));\n}\n","import selection_select from \"./select\";\nimport selection_selectAll from \"./selectAll\";\nimport selection_filter from \"./filter\";\nimport selection_data from \"./data\";\nimport selection_enter from \"./enter\";\nimport selection_exit from \"./exit\";\nimport selection_join from \"./join\";\nimport selection_merge from \"./merge\";\nimport selection_order from \"./order\";\nimport selection_sort from \"./sort\";\nimport selection_call from \"./call\";\nimport selection_nodes from \"./nodes\";\nimport selection_node from \"./node\";\nimport selection_size from \"./size\";\nimport selection_empty from \"./empty\";\nimport selection_each from \"./each\";\nimport selection_attr from \"./attr\";\nimport selection_style from \"./style\";\nimport selection_property from \"./property\";\nimport selection_classed from \"./classed\";\nimport selection_text from \"./text\";\nimport selection_html from \"./html\";\nimport selection_raise from \"./raise\";\nimport selection_lower from \"./lower\";\nimport selection_append from \"./append\";\nimport selection_insert from \"./insert\";\nimport selection_remove from \"./remove\";\nimport selection_clone from \"./clone\";\nimport selection_datum from \"./datum\";\nimport selection_on from \"./on\";\nimport selection_dispatch from \"./dispatch\";\n\nexport var root = [null];\n\nexport function Selection(groups, parents) {\n this._groups = groups;\n this._parents = parents;\n}\n\nfunction selection() {\n return new Selection([[document.documentElement]], root);\n}\n\nSelection.prototype = selection.prototype = {\n constructor: Selection,\n select: selection_select,\n selectAll: selection_selectAll,\n filter: selection_filter,\n data: selection_data,\n enter: selection_enter,\n exit: selection_exit,\n join: selection_join,\n merge: selection_merge,\n order: selection_order,\n sort: selection_sort,\n call: selection_call,\n nodes: selection_nodes,\n node: selection_node,\n size: selection_size,\n empty: selection_empty,\n each: selection_each,\n attr: selection_attr,\n style: selection_style,\n property: selection_property,\n classed: selection_classed,\n text: selection_text,\n html: selection_html,\n raise: selection_raise,\n lower: selection_lower,\n append: selection_append,\n insert: selection_insert,\n remove: selection_remove,\n clone: selection_clone,\n datum: selection_datum,\n on: selection_on,\n dispatch: selection_dispatch\n};\n\nexport default selection;\n","/**\n * Draw a stroke symbol\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Stroke to be drawn\n * @param {Stroker} stroker Stroker to use to render a stroke\n */\nexport function drawStroke (context, stroke, stroker) {\n if (stroker) {\n stroker.drawStroke(context, stroke)\n }\n}\n","import * as d3 from 'd3-selection'\nimport { rendererLogger as logger } from '../../configuration/LoggerConfig'\nimport { drawStroke } from './symbols/StrokeSymbolSVGRenderer'\nimport * as InkModel from '../../model/InkModel'\n\n/**\n * Get info\n * @return {RendererInfo} Information about this renderer\n */\nexport function getInfo () {\n return {\n type: 'svg'\n }\n}\n\n/**\n * Populate the dom element\n * @param {Element} element DOM element to attach the rendering elements\n * @return {Object} The renderer context to give as parameter when a draw model will be call\n */\nexport function attach (element) {\n const elementRef = element\n logger.debug('populate root element', elementRef)\n elementRef.style.fontSize = '10px'\n return d3.select(elementRef)\n}\n\n/**\n * Detach the renderer from the DOM element\n * @param {Element} element DOM element to attach the rendering elements\n * @param {Object} context Current rendering context\n */\nexport function detach (element, context) {\n logger.debug('detach renderer', element)\n context.select('svg').remove()\n}\n\n/**\n * Update the rendering context size\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @param {Number} minHeight Minimal height for resize\n * @param {Number} minWidth Minimal Width for resize\n * @return {Model}\n */\nexport function resize (context, model, stroker, minHeight, minWidth) {\n const rect = context.node().getBoundingClientRect()\n const svg = context.selectAll('svg')\n const width = rect.width < minWidth ? minWidth : rect.width\n const height = rect.height < minHeight ? minHeight : rect.height\n svg.attr('viewBox', `0 0 ${width}, ${height}`)\n svg.attr('width', `${width}px`)\n svg.attr('height', `${height}px`)\n logger.debug('svg viewBox changed', svg)\n return model\n}\n\n/**\n * Draw the current stroke from the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawCurrentStroke (context, model, stroker) {\n const modelRef = model\n // Add a pending id for pending strokes rendering\n modelRef.currentStroke.id = `pendingStroke-${model.rawStrokes.length}`\n // Render the current stroke\n logger.trace('drawing current stroke ', model.currentStroke)\n context.select(`#pendingStrokes #${modelRef.currentStroke.id}`).remove()\n drawStroke(context.select('#pendingStrokes').append('path').attr('id', model.currentStroke.id), model.currentStroke, stroker)\n return modelRef\n}\n\nfunction insertAdjacentSVG (element, position, html) {\n const container = element.ownerDocument.createElementNS('http://www.w3.org/2000/svg', '_')\n container.innerHTML = html\n\n switch (position.toLowerCase()) {\n case 'beforebegin':\n element.parentNode.insertBefore(container.firstChild, element)\n break\n case 'afterbegin':\n element.insertBefore(container.lastChild, element.firstChild)\n break\n case 'beforeend':\n element.appendChild(container.firstChild)\n break\n case 'afterend':\n element.parentNode.insertBefore(container.lastChild, element.nextSibling)\n break\n default:\n logger.warn('Invalid insertAdjacentHTML position')\n break\n }\n}\n\n/**\n * Draw all symbols contained into the model\n * @param {Object} context Current rendering context\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @return {Model}\n */\nexport function drawModel (context, model, stroker) {\n const drawSymbol = (symbol, symbolContext) => {\n logger.trace(`attempting to draw ${symbol.type} symbol`)\n if (symbol.type === 'stroke' && !symbolContext.select('id', symbol.id)) {\n drawStroke(symbolContext.append('path').attr('id', symbol.id), symbol, stroker)\n } else {\n logger.warn(`impossible to draw ${symbol.type} symbol`)\n }\n }\n\n const updateView = (patchUpdate) => {\n // We only add in the stack patch with updates\n patchUpdate.updates.forEach((update) => {\n try {\n const svgElementSelector = 'svg[data-layer=\"' + patchUpdate.layer + '\"]'\n switch (update.type) {\n case 'REPLACE_ALL': {\n context.select(svgElementSelector).remove()\n const parent = context.node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n }\n if (patchUpdate.layer === 'MODEL') {\n context.select(svgElementSelector).append('g').attr('id', 'pendingStrokes')\n }\n }\n break\n case 'REMOVE_ELEMENT': {\n if (update.id.includes('s') || update.id.includes('MODEL')) {\n context.select(`#${update.id}`).remove()\n } else {\n context.select(`#${update.id}`).attr('class', 'removed-stroke')\n context.select(`#${update.id}`).remove()\n }\n break\n }\n case 'REPLACE_ELEMENT': {\n const parent = context.select(`#${update.id}`).node().parentNode\n context.select(`#${update.id}`).remove()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'REMOVE_CHILD':\n context.select(`#${update.parentId} > *:nth-child(${update.index + 1})`).remove()\n break\n case 'APPEND_CHILD': {\n const parent = context.select(update.parentId ? `#${update.parentId}` : svgElementSelector).node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeEnd', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeEnd', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'INSERT_BEFORE': {\n const parent = context.select(`#${update.refId}`).node()\n if (parent.insertAdjacentHTML) {\n parent.insertAdjacentHTML('beforeBegin', update.svg)\n } else {\n insertAdjacentSVG(parent, 'beforeBegin', update.svg)\n context.node().insertAdjacentHTML('beforeEnd', context.select(svgElementSelector).remove().node().outerHTML)\n }\n }\n break\n case 'REMOVE_ATTRIBUTE':\n context.selectAll(update.id ? `#${update.id}` : 'svg').attr(update.name, null)\n break\n case 'SET_ATTRIBUTE': {\n // We ignore setAttributes on the svg element because we handle the resize elsewhere to prevent a blink effect\n // that occurs if we are waiting for the server to resize.\n if (update.id) {\n context.selectAll(`#${update.id}`).attr(update.name, update.value)\n }\n break\n }\n default:\n logger.debug(`unknown update ${update.type} action`)\n break\n }\n } catch (e) {\n logger.error(`Invalid update ${update.type}`, update)\n logger.error('Error on svg patch', e)\n }\n })\n }\n\n const pendingRecognizedSymbols = InkModel.extractPendingRecognizedSymbols(model)\n if (pendingRecognizedSymbols) {\n pendingRecognizedSymbols.forEach(patch => updateView(patch))\n InkModel.updateModelRenderedPosition(model)\n }\n\n const pendingStrokes = InkModel.extractPendingStrokes(model)\n if (pendingStrokes) {\n pendingStrokes.forEach(stroke => drawSymbol(stroke, context.select('#pendingStrokes')))\n }\n return model\n}\n","import {Selection} from \"./index\";\nimport selector from \"../selector\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selector(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), node, subnode, i = 0; i < n; ++i) {\n if ((node = group[i]) && (subnode = select.call(node, node.__data__, i, group))) {\n if (\"__data__\" in node) subnode.__data__ = node.__data__;\n subgroup[i] = subnode;\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","import {Selection} from \"./index\";\nimport selectorAll from \"../selectorAll\";\n\nexport default function(select) {\n if (typeof select !== \"function\") select = selectorAll(select);\n\n for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, node, i = 0; i < n; ++i) {\n if (node = group[i]) {\n subgroups.push(select.call(node, node.__data__, i, group));\n parents.push(node);\n }\n }\n }\n\n return new Selection(subgroups, parents);\n}\n","import {Selection} from \"./index\";\nimport matcher from \"../matcher\";\n\nexport default function(match) {\n if (typeof match !== \"function\") match = matcher(match);\n\n for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) {\n for (var group = groups[j], n = group.length, subgroup = subgroups[j] = [], node, i = 0; i < n; ++i) {\n if ((node = group[i]) && match.call(node, node.__data__, i, group)) {\n subgroup.push(node);\n }\n }\n }\n\n return new Selection(subgroups, this._parents);\n}\n","export default function(selector) {\n return function() {\n return this.matches(selector);\n };\n}\n","export default function(x) {\n return function() {\n return x;\n };\n}\n","import sparse from \"./sparse\";\nimport {Selection} from \"./index\";\n\nexport default function() {\n return new Selection(this._exit || this._groups.map(sparse), this._parents);\n}\n","export default function(onenter, onupdate, onexit) {\n var enter = this.enter(), update = this, exit = this.exit();\n enter = typeof onenter === \"function\" ? onenter(enter) : enter.append(onenter + \"\");\n if (onupdate != null) update = onupdate(update);\n if (onexit == null) exit.remove(); else onexit(exit);\n return enter && update ? enter.merge(update).order() : update;\n}\n","import {Selection} from \"./index\";\n\nexport default function(selection) {\n\n for (var groups0 = this._groups, groups1 = selection._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) {\n for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), node, i = 0; i < n; ++i) {\n if (node = group0[i] || group1[i]) {\n merge[i] = node;\n }\n }\n }\n\n for (; j < m0; ++j) {\n merges[j] = groups0[j];\n }\n\n return new Selection(merges, this._parents);\n}\n","export default function() {\n\n for (var groups = this._groups, j = -1, m = groups.length; ++j < m;) {\n for (var group = groups[j], i = group.length - 1, next = group[i], node; --i >= 0;) {\n if (node = group[i]) {\n if (next && node.compareDocumentPosition(next) ^ 4) next.parentNode.insertBefore(node, next);\n next = node;\n }\n }\n }\n\n return this;\n}\n","export default function() {\n var callback = arguments[0];\n arguments[0] = this;\n callback.apply(null, arguments);\n return this;\n}\n","export default function() {\n var nodes = new Array(this.size()), i = -1;\n this.each(function() { nodes[++i] = this; });\n return nodes;\n}\n","export default function() {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {\n var node = group[i];\n if (node) return node;\n }\n }\n\n return null;\n}\n","export default function() {\n var size = 0;\n this.each(function() { ++size; });\n return size;\n}\n","export default function() {\n return !this.node();\n}\n","export default function(callback) {\n\n for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) {\n for (var group = groups[j], i = 0, n = group.length, node; i < n; ++i) {\n if (node = group[i]) callback.call(node, node.__data__, i, group);\n }\n }\n\n return this;\n}\n","import creator from \"../creator\";\n\nexport default function(name) {\n var create = typeof name === \"function\" ? name : creator(name);\n return this.select(function() {\n return this.appendChild(create.apply(this, arguments));\n });\n}\n","export default function(value) {\n return arguments.length\n ? this.property(\"__data__\", value)\n : this.node().__data__;\n}\n","import {Selection, root} from \"./selection/index\";\n\nexport default function(selector) {\n return typeof selector === \"string\"\n ? new Selection([[document.querySelector(selector)]], [document.documentElement])\n : new Selection([[selector]], root);\n}\n","import * as StrokeComponent from '../../../model/StrokeComponent'\nimport { computeLinksPoints, computeMiddlePoint, computeAxeAngle } from '../../QuadraticUtils'\n\n/**\n * Get info\n * @return {StrokerInfo} Information about this stroker\n */\nexport function getInfo () {\n return {\n type: 'svg',\n name: 'quadratic'\n }\n}\n\nfunction renderArc (context, center, radius) {\n const svgPath = [\n `M ${center.x},${center.y}`,\n `m ${-radius},0`,\n `a ${radius},${radius} 0 1 0 ${radius * 2},0`,\n `a ${radius},${radius} 0 1 0 ${-(radius * 2)},0`\n ].join(' ')\n return svgPath\n}\n\nfunction renderLine (context, begin, end, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, end), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(begin, end), width)\n\n const svgPath = [\n `M ${linkPoints1[0].x},${linkPoints1[0].y}`,\n `L ${linkPoints2[0].x},${linkPoints2[0].y}`,\n `L ${linkPoints2[1].x},${linkPoints2[1].y}`,\n `L ${linkPoints1[1].x},${linkPoints1[1].y}`\n ].join(' ')\n return svgPath\n}\n\nfunction renderFinal (context, begin, end, width) {\n const ARCSPLIT = 6\n const angle = computeAxeAngle(begin, end)\n const linkPoints = computeLinksPoints(end, angle, width)\n\n const parts = [`M ${linkPoints[0].x},${linkPoints[0].y}`]\n for (let i = 1; i <= ARCSPLIT; i++) {\n const newAngle = angle - (i * (Math.PI / ARCSPLIT))\n parts.push(`L ${end.x - (end.p * width * Math.sin(newAngle))},${end.y + (end.p * width * Math.cos(newAngle))}`)\n }\n const svgPath = parts.join(' ')\n return svgPath\n}\n\nfunction renderQuadratic (context, begin, end, ctrl, width) {\n const linkPoints1 = computeLinksPoints(begin, computeAxeAngle(begin, ctrl), width)\n const linkPoints2 = computeLinksPoints(end, computeAxeAngle(ctrl, end), width)\n const linkPoints3 = computeLinksPoints(ctrl, computeAxeAngle(begin, end), width)\n\n const svgPath = [\n `M ${linkPoints1[0].x},${linkPoints1[0].y}`,\n `Q ${linkPoints3[0].x},${linkPoints3[0].y} ${linkPoints2[0].x},${linkPoints2[0].y}`,\n `L ${linkPoints2[1].x},${linkPoints2[1].y}`,\n `Q ${linkPoints3[1].x},${linkPoints3[1].y} ${linkPoints1[1].x},${linkPoints1[1].y}`\n ].join(' ')\n return svgPath\n}\n\n/**\n * Draw a stroke on a svg tag, using quadratics\n * @param {Object} context Current rendering context\n * @param {Stroke} stroke Current stroke to be drawn\n */\nexport function drawStroke (context, stroke) {\n const length = stroke.x.length\n const width = stroke.width\n const firstPoint = StrokeComponent.getPointByIndex(stroke, 0)\n const nbquadratics = length - 2\n\n const parts = []\n if (length < 3) {\n parts.push(renderArc(context, firstPoint, width * 0.6))\n } else {\n parts.push(renderArc(context, firstPoint, width * firstPoint.p))\n parts.push(renderLine(context, firstPoint, computeMiddlePoint(firstPoint, StrokeComponent.getPointByIndex(stroke, 1)), width))\n\n for (let i = 0; i < nbquadratics; i++) {\n parts.push(renderQuadratic(context, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i), StrokeComponent.getPointByIndex(stroke, i + 1)), computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, i + 1), StrokeComponent.getPointByIndex(stroke, i + 2)), StrokeComponent.getPointByIndex(stroke, i + 1), width))\n }\n parts.push(renderLine(context, computeMiddlePoint(StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1)), StrokeComponent.getPointByIndex(stroke, length - 1), width))\n parts.push(renderFinal(context, StrokeComponent.getPointByIndex(stroke, length - 2), StrokeComponent.getPointByIndex(stroke, length - 1), width))\n }\n const svgPath = parts.join(' ')\n\n context\n .attr('color', stroke.color)\n .style('fill', stroke.color)\n .style('stroke', 'transparent')\n .classed('pending-stroke', true)\n .attr('d', `${svgPath}Z`)\n}\n","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n Promise.resolve(value).then(_next, _throw);\n }\n}\n\nfunction _asyncToGenerator(fn) {\n return function () {\n var self = this,\n args = arguments;\n return new Promise(function (resolve, reject) {\n var gen = fn.apply(self, args);\n\n function _next(value) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value);\n }\n\n function _throw(err) {\n asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err);\n }\n\n _next(undefined);\n });\n };\n}\n\nmodule.exports = _asyncToGenerator;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function define(obj, key, value) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n return obj[key];\n }\n try {\n // IE 8 has a broken Object.defineProperty that only works on DOM objects.\n define({}, \"\");\n } catch (err) {\n define = function(obj, key, value) {\n return obj[key] = value;\n };\n }\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n define(IteratorPrototype, iteratorSymbol, function () {\n return this;\n });\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = GeneratorFunctionPrototype;\n define(Gp, \"constructor\", GeneratorFunctionPrototype);\n define(GeneratorFunctionPrototype, \"constructor\", GeneratorFunction);\n GeneratorFunction.displayName = define(\n GeneratorFunctionPrototype,\n toStringTagSymbol,\n \"GeneratorFunction\"\n );\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n define(prototype, method, function(arg) {\n return this._invoke(method, arg);\n });\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n define(genFun, toStringTagSymbol, \"GeneratorFunction\");\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator, PromiseImpl) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return PromiseImpl.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return PromiseImpl.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new PromiseImpl(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n define(AsyncIterator.prototype, asyncIteratorSymbol, function () {\n return this;\n });\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {\n if (PromiseImpl === void 0) PromiseImpl = Promise;\n\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList),\n PromiseImpl\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n define(Gp, toStringTagSymbol, \"Generator\");\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n define(Gp, iteratorSymbol, function() {\n return this;\n });\n\n define(Gp, \"toString\", function() {\n return \"[object Generator]\";\n });\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, in modern engines\n // we can explicitly access globalThis. In older engines we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n if (typeof globalThis === \"object\") {\n globalThis.regeneratorRuntime = runtime;\n } else {\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n }\n}\n","module.exports = require(\"regenerator-runtime\");\n","function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n module.exports = _typeof = function _typeof(obj) {\n return typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n } else {\n module.exports = _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n module.exports[\"default\"] = module.exports, module.exports.__esModule = true;\n }\n\n return _typeof(obj);\n}\n\nmodule.exports = _typeof;\nmodule.exports[\"default\"] = module.exports, module.exports.__esModule = true;",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t /*\n\t * Local polyfil of Object.create\n\t */\n\t var create = Object.create || (function () {\n\t function F() {};\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }())\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t var r = (function (m_w) {\n\t var m_w = m_w;\n\t var m_z = 0x3ade68b1;\n\t var mask = 0xffffffff;\n\n\t return function () {\n\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t var result = ((m_z << 0x10) + m_w) & mask;\n\t result /= 0x100000000;\n\t result += 0.5;\n\t return result * (Math.random() > .5 ? 1 : -1);\n\t }\n\t });\n\n\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t var _r = r((rcache || Math.random()) * 0x100000000);\n\n\t rcache = _r() * 0x3ade67b7;\n\t words.push((_r() * 0x100000000) | 0);\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t var processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.enc.Hex;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var X32WordArray = C_lib.WordArray;\n\n\t /**\n\t * x64 namespace.\n\t */\n\t var C_x64 = C.x64 = {};\n\n\t /**\n\t * A 64-bit word.\n\t */\n\t var X64Word = C_x64.Word = Base.extend({\n\t /**\n\t * Initializes a newly created 64-bit word.\n\t *\n\t * @param {number} high The high 32 bits.\n\t * @param {number} low The low 32 bits.\n\t *\n\t * @example\n\t *\n\t * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);\n\t */\n\t init: function (high, low) {\n\t this.high = high;\n\t this.low = low;\n\t }\n\n\t /**\n\t * Bitwise NOTs this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after negating.\n\t *\n\t * @example\n\t *\n\t * var negated = x64Word.not();\n\t */\n\t // not: function () {\n\t // var high = ~this.high;\n\t // var low = ~this.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ANDs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to AND with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ANDing.\n\t *\n\t * @example\n\t *\n\t * var anded = x64Word.and(anotherX64Word);\n\t */\n\t // and: function (word) {\n\t // var high = this.high & word.high;\n\t // var low = this.low & word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to OR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ORing.\n\t *\n\t * @example\n\t *\n\t * var ored = x64Word.or(anotherX64Word);\n\t */\n\t // or: function (word) {\n\t // var high = this.high | word.high;\n\t // var low = this.low | word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise XORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to XOR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after XORing.\n\t *\n\t * @example\n\t *\n\t * var xored = x64Word.xor(anotherX64Word);\n\t */\n\t // xor: function (word) {\n\t // var high = this.high ^ word.high;\n\t // var low = this.low ^ word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftL(25);\n\t */\n\t // shiftL: function (n) {\n\t // if (n < 32) {\n\t // var high = (this.high << n) | (this.low >>> (32 - n));\n\t // var low = this.low << n;\n\t // } else {\n\t // var high = this.low << (n - 32);\n\t // var low = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftR(7);\n\t */\n\t // shiftR: function (n) {\n\t // if (n < 32) {\n\t // var low = (this.low >>> n) | (this.high << (32 - n));\n\t // var high = this.high >>> n;\n\t // } else {\n\t // var low = this.high >>> (n - 32);\n\t // var high = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotL(25);\n\t */\n\t // rotL: function (n) {\n\t // return this.shiftL(n).or(this.shiftR(64 - n));\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotR(7);\n\t */\n\t // rotR: function (n) {\n\t // return this.shiftR(n).or(this.shiftL(64 - n));\n\t // },\n\n\t /**\n\t * Adds this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to add with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after adding.\n\t *\n\t * @example\n\t *\n\t * var added = x64Word.add(anotherX64Word);\n\t */\n\t // add: function (word) {\n\t // var low = (this.low + word.low) | 0;\n\t // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;\n\t // var high = (this.high + word.high + carry) | 0;\n\n\t // return X64Word.create(high, low);\n\t // }\n\t });\n\n\t /**\n\t * An array of 64-bit words.\n\t *\n\t * @property {Array} words The array of CryptoJS.x64.Word objects.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var X64WordArray = C_x64.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create();\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ]);\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ], 10);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 8;\n\t }\n\t },\n\n\t /**\n\t * Converts this 64-bit word array to a 32-bit word array.\n\t *\n\t * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.\n\t *\n\t * @example\n\t *\n\t * var x32WordArray = x64WordArray.toX32();\n\t */\n\t toX32: function () {\n\t // Shortcuts\n\t var x64Words = this.words;\n\t var x64WordsLength = x64Words.length;\n\n\t // Convert\n\t var x32Words = [];\n\t for (var i = 0; i < x64WordsLength; i++) {\n\t var x64Word = x64Words[i];\n\t x32Words.push(x64Word.high);\n\t x32Words.push(x64Word.low);\n\t }\n\n\t return X32WordArray.create(x32Words, this.sigBytes);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {X64WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = x64WordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\n\t // Clone \"words\" array\n\t var words = clone.words = this.words.slice(0);\n\n\t // Clone each X64Word object\n\t var wordsLength = words.length;\n\t for (var i = 0; i < wordsLength; i++) {\n\t words[i] = words[i].clone();\n\t }\n\n\t return clone;\n\t }\n\t });\n\t}());\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./x64-core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./x64-core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Hasher = C_lib.Hasher;\n\t var C_x64 = C.x64;\n\t var X64Word = C_x64.Word;\n\t var X64WordArray = C_x64.WordArray;\n\t var C_algo = C.algo;\n\n\t function X64Word_create() {\n\t return X64Word.create.apply(X64Word, arguments);\n\t }\n\n\t // Constants\n\t var K = [\n\t X64Word_create(0x428a2f98, 0xd728ae22), X64Word_create(0x71374491, 0x23ef65cd),\n\t X64Word_create(0xb5c0fbcf, 0xec4d3b2f), X64Word_create(0xe9b5dba5, 0x8189dbbc),\n\t X64Word_create(0x3956c25b, 0xf348b538), X64Word_create(0x59f111f1, 0xb605d019),\n\t X64Word_create(0x923f82a4, 0xaf194f9b), X64Word_create(0xab1c5ed5, 0xda6d8118),\n\t X64Word_create(0xd807aa98, 0xa3030242), X64Word_create(0x12835b01, 0x45706fbe),\n\t X64Word_create(0x243185be, 0x4ee4b28c), X64Word_create(0x550c7dc3, 0xd5ffb4e2),\n\t X64Word_create(0x72be5d74, 0xf27b896f), X64Word_create(0x80deb1fe, 0x3b1696b1),\n\t X64Word_create(0x9bdc06a7, 0x25c71235), X64Word_create(0xc19bf174, 0xcf692694),\n\t X64Word_create(0xe49b69c1, 0x9ef14ad2), X64Word_create(0xefbe4786, 0x384f25e3),\n\t X64Word_create(0x0fc19dc6, 0x8b8cd5b5), X64Word_create(0x240ca1cc, 0x77ac9c65),\n\t X64Word_create(0x2de92c6f, 0x592b0275), X64Word_create(0x4a7484aa, 0x6ea6e483),\n\t X64Word_create(0x5cb0a9dc, 0xbd41fbd4), X64Word_create(0x76f988da, 0x831153b5),\n\t X64Word_create(0x983e5152, 0xee66dfab), X64Word_create(0xa831c66d, 0x2db43210),\n\t X64Word_create(0xb00327c8, 0x98fb213f), X64Word_create(0xbf597fc7, 0xbeef0ee4),\n\t X64Word_create(0xc6e00bf3, 0x3da88fc2), X64Word_create(0xd5a79147, 0x930aa725),\n\t X64Word_create(0x06ca6351, 0xe003826f), X64Word_create(0x14292967, 0x0a0e6e70),\n\t X64Word_create(0x27b70a85, 0x46d22ffc), X64Word_create(0x2e1b2138, 0x5c26c926),\n\t X64Word_create(0x4d2c6dfc, 0x5ac42aed), X64Word_create(0x53380d13, 0x9d95b3df),\n\t X64Word_create(0x650a7354, 0x8baf63de), X64Word_create(0x766a0abb, 0x3c77b2a8),\n\t X64Word_create(0x81c2c92e, 0x47edaee6), X64Word_create(0x92722c85, 0x1482353b),\n\t X64Word_create(0xa2bfe8a1, 0x4cf10364), X64Word_create(0xa81a664b, 0xbc423001),\n\t X64Word_create(0xc24b8b70, 0xd0f89791), X64Word_create(0xc76c51a3, 0x0654be30),\n\t X64Word_create(0xd192e819, 0xd6ef5218), X64Word_create(0xd6990624, 0x5565a910),\n\t X64Word_create(0xf40e3585, 0x5771202a), X64Word_create(0x106aa070, 0x32bbd1b8),\n\t X64Word_create(0x19a4c116, 0xb8d2d0c8), X64Word_create(0x1e376c08, 0x5141ab53),\n\t X64Word_create(0x2748774c, 0xdf8eeb99), X64Word_create(0x34b0bcb5, 0xe19b48a8),\n\t X64Word_create(0x391c0cb3, 0xc5c95a63), X64Word_create(0x4ed8aa4a, 0xe3418acb),\n\t X64Word_create(0x5b9cca4f, 0x7763e373), X64Word_create(0x682e6ff3, 0xd6b2b8a3),\n\t X64Word_create(0x748f82ee, 0x5defb2fc), X64Word_create(0x78a5636f, 0x43172f60),\n\t X64Word_create(0x84c87814, 0xa1f0ab72), X64Word_create(0x8cc70208, 0x1a6439ec),\n\t X64Word_create(0x90befffa, 0x23631e28), X64Word_create(0xa4506ceb, 0xde82bde9),\n\t X64Word_create(0xbef9a3f7, 0xb2c67915), X64Word_create(0xc67178f2, 0xe372532b),\n\t X64Word_create(0xca273ece, 0xea26619c), X64Word_create(0xd186b8c7, 0x21c0c207),\n\t X64Word_create(0xeada7dd6, 0xcde0eb1e), X64Word_create(0xf57d4f7f, 0xee6ed178),\n\t X64Word_create(0x06f067aa, 0x72176fba), X64Word_create(0x0a637dc5, 0xa2c898a6),\n\t X64Word_create(0x113f9804, 0xbef90dae), X64Word_create(0x1b710b35, 0x131c471b),\n\t X64Word_create(0x28db77f5, 0x23047d84), X64Word_create(0x32caab7b, 0x40c72493),\n\t X64Word_create(0x3c9ebe0a, 0x15c9bebc), X64Word_create(0x431d67c4, 0x9c100d4c),\n\t X64Word_create(0x4cc5d4be, 0xcb3e42b6), X64Word_create(0x597f299c, 0xfc657e2a),\n\t X64Word_create(0x5fcb6fab, 0x3ad6faec), X64Word_create(0x6c44198c, 0x4a475817)\n\t ];\n\n\t // Reusable objects\n\t var W = [];\n\t (function () {\n\t for (var i = 0; i < 80; i++) {\n\t W[i] = X64Word_create();\n\t }\n\t }());\n\n\t /**\n\t * SHA-512 hash algorithm.\n\t */\n\t var SHA512 = C_algo.SHA512 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new X64WordArray.init([\n\t new X64Word.init(0x6a09e667, 0xf3bcc908), new X64Word.init(0xbb67ae85, 0x84caa73b),\n\t new X64Word.init(0x3c6ef372, 0xfe94f82b), new X64Word.init(0xa54ff53a, 0x5f1d36f1),\n\t new X64Word.init(0x510e527f, 0xade682d1), new X64Word.init(0x9b05688c, 0x2b3e6c1f),\n\t new X64Word.init(0x1f83d9ab, 0xfb41bd6b), new X64Word.init(0x5be0cd19, 0x137e2179)\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcuts\n\t var H = this._hash.words;\n\n\t var H0 = H[0];\n\t var H1 = H[1];\n\t var H2 = H[2];\n\t var H3 = H[3];\n\t var H4 = H[4];\n\t var H5 = H[5];\n\t var H6 = H[6];\n\t var H7 = H[7];\n\n\t var H0h = H0.high;\n\t var H0l = H0.low;\n\t var H1h = H1.high;\n\t var H1l = H1.low;\n\t var H2h = H2.high;\n\t var H2l = H2.low;\n\t var H3h = H3.high;\n\t var H3l = H3.low;\n\t var H4h = H4.high;\n\t var H4l = H4.low;\n\t var H5h = H5.high;\n\t var H5l = H5.low;\n\t var H6h = H6.high;\n\t var H6l = H6.low;\n\t var H7h = H7.high;\n\t var H7l = H7.low;\n\n\t // Working variables\n\t var ah = H0h;\n\t var al = H0l;\n\t var bh = H1h;\n\t var bl = H1l;\n\t var ch = H2h;\n\t var cl = H2l;\n\t var dh = H3h;\n\t var dl = H3l;\n\t var eh = H4h;\n\t var el = H4l;\n\t var fh = H5h;\n\t var fl = H5l;\n\t var gh = H6h;\n\t var gl = H6l;\n\t var hh = H7h;\n\t var hl = H7l;\n\n\t // Rounds\n\t for (var i = 0; i < 80; i++) {\n\t // Shortcut\n\t var Wi = W[i];\n\n\t // Extend message\n\t if (i < 16) {\n\t var Wih = Wi.high = M[offset + i * 2] | 0;\n\t var Wil = Wi.low = M[offset + i * 2 + 1] | 0;\n\t } else {\n\t // Gamma0\n\t var gamma0x = W[i - 15];\n\t var gamma0xh = gamma0x.high;\n\t var gamma0xl = gamma0x.low;\n\t var gamma0h = ((gamma0xh >>> 1) | (gamma0xl << 31)) ^ ((gamma0xh >>> 8) | (gamma0xl << 24)) ^ (gamma0xh >>> 7);\n\t var gamma0l = ((gamma0xl >>> 1) | (gamma0xh << 31)) ^ ((gamma0xl >>> 8) | (gamma0xh << 24)) ^ ((gamma0xl >>> 7) | (gamma0xh << 25));\n\n\t // Gamma1\n\t var gamma1x = W[i - 2];\n\t var gamma1xh = gamma1x.high;\n\t var gamma1xl = gamma1x.low;\n\t var gamma1h = ((gamma1xh >>> 19) | (gamma1xl << 13)) ^ ((gamma1xh << 3) | (gamma1xl >>> 29)) ^ (gamma1xh >>> 6);\n\t var gamma1l = ((gamma1xl >>> 19) | (gamma1xh << 13)) ^ ((gamma1xl << 3) | (gamma1xh >>> 29)) ^ ((gamma1xl >>> 6) | (gamma1xh << 26));\n\n\t // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n\t var Wi7 = W[i - 7];\n\t var Wi7h = Wi7.high;\n\t var Wi7l = Wi7.low;\n\n\t var Wi16 = W[i - 16];\n\t var Wi16h = Wi16.high;\n\t var Wi16l = Wi16.low;\n\n\t var Wil = gamma0l + Wi7l;\n\t var Wih = gamma0h + Wi7h + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0);\n\t var Wil = Wil + gamma1l;\n\t var Wih = Wih + gamma1h + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0);\n\t var Wil = Wil + Wi16l;\n\t var Wih = Wih + Wi16h + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0);\n\n\t Wi.high = Wih;\n\t Wi.low = Wil;\n\t }\n\n\t var chh = (eh & fh) ^ (~eh & gh);\n\t var chl = (el & fl) ^ (~el & gl);\n\t var majh = (ah & bh) ^ (ah & ch) ^ (bh & ch);\n\t var majl = (al & bl) ^ (al & cl) ^ (bl & cl);\n\n\t var sigma0h = ((ah >>> 28) | (al << 4)) ^ ((ah << 30) | (al >>> 2)) ^ ((ah << 25) | (al >>> 7));\n\t var sigma0l = ((al >>> 28) | (ah << 4)) ^ ((al << 30) | (ah >>> 2)) ^ ((al << 25) | (ah >>> 7));\n\t var sigma1h = ((eh >>> 14) | (el << 18)) ^ ((eh >>> 18) | (el << 14)) ^ ((eh << 23) | (el >>> 9));\n\t var sigma1l = ((el >>> 14) | (eh << 18)) ^ ((el >>> 18) | (eh << 14)) ^ ((el << 23) | (eh >>> 9));\n\n\t // t1 = h + sigma1 + ch + K[i] + W[i]\n\t var Ki = K[i];\n\t var Kih = Ki.high;\n\t var Kil = Ki.low;\n\n\t var t1l = hl + sigma1l;\n\t var t1h = hh + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0);\n\t var t1l = t1l + chl;\n\t var t1h = t1h + chh + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0);\n\t var t1l = t1l + Kil;\n\t var t1h = t1h + Kih + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0);\n\t var t1l = t1l + Wil;\n\t var t1h = t1h + Wih + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0);\n\n\t // t2 = sigma0 + maj\n\t var t2l = sigma0l + majl;\n\t var t2h = sigma0h + majh + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0);\n\n\t // Update working variables\n\t hh = gh;\n\t hl = gl;\n\t gh = fh;\n\t gl = fl;\n\t fh = eh;\n\t fl = el;\n\t el = (dl + t1l) | 0;\n\t eh = (dh + t1h + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0;\n\t dh = ch;\n\t dl = cl;\n\t ch = bh;\n\t cl = bl;\n\t bh = ah;\n\t bl = al;\n\t al = (t1l + t2l) | 0;\n\t ah = (t1h + t2h + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0;\n\t }\n\n\t // Intermediate hash value\n\t H0l = H0.low = (H0l + al);\n\t H0.high = (H0h + ah + ((H0l >>> 0) < (al >>> 0) ? 1 : 0));\n\t H1l = H1.low = (H1l + bl);\n\t H1.high = (H1h + bh + ((H1l >>> 0) < (bl >>> 0) ? 1 : 0));\n\t H2l = H2.low = (H2l + cl);\n\t H2.high = (H2h + ch + ((H2l >>> 0) < (cl >>> 0) ? 1 : 0));\n\t H3l = H3.low = (H3l + dl);\n\t H3.high = (H3h + dh + ((H3l >>> 0) < (dl >>> 0) ? 1 : 0));\n\t H4l = H4.low = (H4l + el);\n\t H4.high = (H4h + eh + ((H4l >>> 0) < (el >>> 0) ? 1 : 0));\n\t H5l = H5.low = (H5l + fl);\n\t H5.high = (H5h + fh + ((H5l >>> 0) < (fl >>> 0) ? 1 : 0));\n\t H6l = H6.low = (H6l + gl);\n\t H6.high = (H6h + gh + ((H6l >>> 0) < (gl >>> 0) ? 1 : 0));\n\t H7l = H7.low = (H7l + hl);\n\t H7.high = (H7h + hh + ((H7l >>> 0) < (hl >>> 0) ? 1 : 0));\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 30] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 128) >>> 10) << 5) + 31] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Convert hash to 32-bit word array before returning\n\t var hash = this._hash.toX32();\n\n\t // Return final computed hash\n\t return hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t },\n\n\t blockSize: 1024/32\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA512('message');\n\t * var hash = CryptoJS.SHA512(wordArray);\n\t */\n\t C.SHA512 = Hasher._createHelper(SHA512);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA512(message, key);\n\t */\n\t C.HmacSHA512 = Hasher._createHmacHelper(SHA512);\n\t}());\n\n\n\treturn CryptoJS.SHA512;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./x64-core\"), require(\"./sha512\"), require(\"./hmac\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./x64-core\", \"./sha512\", \"./hmac\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.HmacSHA512;\n\n}));","import Hex from 'crypto-js/enc-hex'\nimport HmacSHA512 from 'crypto-js/hmac-sha512'\nimport { recognizerLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Compute HMAC signature for server authentication\n *\n * @param {Object} input Input data to compute HMAC\n * @param {String} applicationKey Current applicationKey\n * @param {String} hmacKey Current hmacKey\n * @return {String} Signature\n */\nexport function computeHmac (input, applicationKey, hmacKey) {\n const jsonInput = (typeof input === 'object') ? JSON.stringify(input) : input\n logger.debug('The HmacSHA512 function is loaded', HmacSHA512)\n return new HmacSHA512(jsonInput, applicationKey + hmacKey).toString(Hex)\n}\n","/* eslint-disable no-unused-expressions */\nimport * as CryptoHelper from '../CryptoHelper'\n\n/**\n * Post request\n * @param {RecognizerContext} recognizerContext Recognizer context\n * @param {String} url URL\n * @param {Object} data Data to be sent\n * @param {String} apiVersion api version\n * @param {String} mimeType MimeType to be used\n * @return {Promise}\n */\nexport async function post (recognizerContext, url, data, apiVersion, mimeType) {\n const configuration = recognizerContext.editor.configuration\n const recognizerContextRef = recognizerContext\n if (recognizerContextRef) {\n recognizerContextRef.idle = true\n }\n try {\n const headers = new Headers()\n headers.append('Accept', 'application/json,' + mimeType)\n headers.append('applicationKey', configuration.recognitionParams.server.applicationKey)\n headers.append('hmac', CryptoHelper.computeHmac(JSON.stringify(data), configuration.recognitionParams.server.applicationKey, configuration.recognitionParams.server.hmacKey))\n headers.append('Content-Type', 'application/json')\n const reqInit = {\n method: 'POST',\n headers,\n credentials: 'include',\n body: JSON.stringify(data)\n }\n const request = new Request(url, reqInit)\n const response = await fetch(request)\n const contentType = response.headers.get('content-type')\n let result = ''\n switch (contentType) {\n case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':\n case 'image/png':\n case 'image/jpeg':\n result = await response.blob()\n break\n case 'application/json':\n result = await response.json()\n break\n case 'application/vnd.myscript.jiix':\n result = await response.clone().json().catch(async () => await response.text())\n break\n default:\n result = await response.text()\n break\n }\n return result\n } catch (error) {\n throw new Error({ msg: `Could not connect to ${url} connection error`, recoverable: false })\n }\n}\n","import { recognizerLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Recognition context\n * @typedef {Object} RecognitionContext\n * @property {Model} model\n * @property {Callback} callback\n */\n\n/**\n * Recognizer context\n * @typedef {Object} RecognizerContext\n * @property {Editor} editor Get a reference to the current editor\n * @property {Array} recognitionContexts=[]\n * @property {Promise} initPromise=undefined\n * @property {RecognitionPositions} lastPositions Last recognition sent/received stroke indexes.\n * @property {String} url=undefined\n * @property {WebSocket} websocket=undefined\n * @property {function} websocketCallback=undefined\n * @property {function} reconnect=undefined\n * @property {Number} currentReconnectionCount=0\n * @property {String} sessionId=undefined\n * @property {Number} contentPartCount=0\n * @property {String} currentPartId=undefined\n * @property {String} instanceId=undefined\n * @property {Boolean} canUndo=false\n * @property {Boolean} canRedo=false\n * @property {Boolean} isEmpty=false\n * @property {Array} supportedImportMimeTypes=[]\n * @property {Number} undoStackIndex=0\n * @property {Number} possibleUndoCount=0\n * @property {Boolean} idle=true\n * @property {Boolean} initialized=false\n */\n/**\n * Create a new recognizer context\n * @param {Editor} editor\n * @return {RecognizerContext} An object that contains all recognizer context\n */\nexport function createEmptyRecognizerContext (editor) {\n const id = Date.now()\n logger.info('Create empty recognizer context with ID: ' + id)\n return {\n id,\n editor,\n // websocket\n recognitionContexts: [],\n initPromise: undefined,\n lastPositions: {\n lastSentPosition: -1,\n lastReceivedPosition: -1\n },\n url: undefined,\n websocket: undefined,\n websocketCallback: undefined,\n reconnect: undefined,\n currentReconnectionCount: 0,\n sessionId: undefined,\n contentPartCount: 0,\n currentPartId: undefined,\n instanceId: undefined,\n canUndo: false,\n canRedo: false,\n isEmpty: undefined,\n supportedImportMimeTypes: [],\n undoStackIndex: 0,\n possibleUndoCount: 0,\n idle: true,\n initialized: false\n }\n}\n\n/**\n * Return true if a reset is required, false otherwise\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n * @return {Boolean}\n */\nexport function isResetRequired (recognizerContext, model) {\n if (recognizerContext.lastPositions) {\n return recognizerContext.lastPositions.lastSentPosition >= model.rawStrokes.length - 1\n }\n return false\n}\n\n/**\n * Update the recognition context positions\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {RecognitionPositions} positions Current recognition positions\n * @return {RecognizerContext}\n */\nexport function updateRecognitionPositions (recognizerContext, positions) {\n const recognizerContextRef = recognizerContext\n if (positions) {\n recognizerContextRef.lastPositions.lastSentPosition = positions.lastSentPosition\n recognizerContextRef.lastPositions.lastReceivedPosition = positions.lastReceivedPosition\n }\n if (recognizerContextRef.lastPositions.lastSentPosition === recognizerContextRef.lastPositions.lastReceivedPosition === -1) {\n delete recognizerContextRef.instanceId\n }\n return recognizerContextRef\n}\n\n/**\n * Set the recognition context\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {RecognitionContext} recognitionContext\n * @return {RecognizerContext}\n */\nexport function setRecognitionContext (recognizerContext, recognitionContext) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.recognitionContexts[0] = recognitionContext\n return recognizerContextRef\n}\n\n/**\n * Test if it is possible to reconnect\n * @param {RecognizerContext} recognizerContext\n * @return {Boolean} True if possible, false otherwise\n */\nexport function canReconnect (recognizerContext) {\n return recognizerContext.websocket.autoReconnect === true && recognizerContext.currentReconnectionCount <= recognizerContext.websocket.maxRetryCount\n}\n\n/**\n * Test if it should attempt immediate reconnect\n * @param {RecognizerContext} recognizerContext\n * @return {Boolean} True if should attempt reconnect, false otherwise\n */\nexport function shouldAttemptImmediateReconnect (recognizerContext) {\n const recognizerContextRef = recognizerContext\n return recognizerContextRef.websocket.autoReconnect === true && recognizerContextRef.currentReconnectionCount++ <= recognizerContextRef.websocket.maxRetryCount\n}\n\n/**\n * Lost connection message\n * @type {{type: string}}\n */\nexport const LOST_CONNEXION_MESSAGE = { type: 'LOST_CONNECTION' }\n\n/**\n * Explicit close message\n * @type {String}\n */\nexport const CLOSE_RECOGNIZER_MESSAGE = 'CLOSE_RECOGNIZER'\n","/*!\r\n * perfect-scrollbar v1.5.3\r\n * Copyright 2021 Hyunje Jun, MDBootstrap and Contributors\r\n * Licensed under MIT\r\n */\r\n\r\nfunction get(element) {\r\n return getComputedStyle(element);\r\n}\r\n\r\nfunction set(element, obj) {\r\n for (var key in obj) {\r\n var val = obj[key];\r\n if (typeof val === 'number') {\r\n val = val + \"px\";\r\n }\r\n element.style[key] = val;\r\n }\r\n return element;\r\n}\r\n\r\nfunction div(className) {\r\n var div = document.createElement('div');\r\n div.className = className;\r\n return div;\r\n}\r\n\r\nvar elMatches =\r\n typeof Element !== 'undefined' &&\r\n (Element.prototype.matches ||\r\n Element.prototype.webkitMatchesSelector ||\r\n Element.prototype.mozMatchesSelector ||\r\n Element.prototype.msMatchesSelector);\r\n\r\nfunction matches(element, query) {\r\n if (!elMatches) {\r\n throw new Error('No element matching method supported');\r\n }\r\n\r\n return elMatches.call(element, query);\r\n}\r\n\r\nfunction remove(element) {\r\n if (element.remove) {\r\n element.remove();\r\n } else {\r\n if (element.parentNode) {\r\n element.parentNode.removeChild(element);\r\n }\r\n }\r\n}\r\n\r\nfunction queryChildren(element, selector) {\r\n return Array.prototype.filter.call(element.children, function (child) { return matches(child, selector); }\r\n );\r\n}\r\n\r\nvar cls = {\r\n main: 'ps',\r\n rtl: 'ps__rtl',\r\n element: {\r\n thumb: function (x) { return (\"ps__thumb-\" + x); },\r\n rail: function (x) { return (\"ps__rail-\" + x); },\r\n consuming: 'ps__child--consume',\r\n },\r\n state: {\r\n focus: 'ps--focus',\r\n clicking: 'ps--clicking',\r\n active: function (x) { return (\"ps--active-\" + x); },\r\n scrolling: function (x) { return (\"ps--scrolling-\" + x); },\r\n },\r\n};\r\n\r\n/*\r\n * Helper methods\r\n */\r\nvar scrollingClassTimeout = { x: null, y: null };\r\n\r\nfunction addScrollingClass(i, x) {\r\n var classList = i.element.classList;\r\n var className = cls.state.scrolling(x);\r\n\r\n if (classList.contains(className)) {\r\n clearTimeout(scrollingClassTimeout[x]);\r\n } else {\r\n classList.add(className);\r\n }\r\n}\r\n\r\nfunction removeScrollingClass(i, x) {\r\n scrollingClassTimeout[x] = setTimeout(\r\n function () { return i.isAlive && i.element.classList.remove(cls.state.scrolling(x)); },\r\n i.settings.scrollingThreshold\r\n );\r\n}\r\n\r\nfunction setScrollingClassInstantly(i, x) {\r\n addScrollingClass(i, x);\r\n removeScrollingClass(i, x);\r\n}\r\n\r\nvar EventElement = function EventElement(element) {\r\n this.element = element;\r\n this.handlers = {};\r\n};\r\n\r\nvar prototypeAccessors = { isEmpty: { configurable: true } };\r\n\r\nEventElement.prototype.bind = function bind (eventName, handler) {\r\n if (typeof this.handlers[eventName] === 'undefined') {\r\n this.handlers[eventName] = [];\r\n }\r\n this.handlers[eventName].push(handler);\r\n this.element.addEventListener(eventName, handler, false);\r\n};\r\n\r\nEventElement.prototype.unbind = function unbind (eventName, target) {\r\n var this$1 = this;\r\n\r\n this.handlers[eventName] = this.handlers[eventName].filter(function (handler) {\r\n if (target && handler !== target) {\r\n return true;\r\n }\r\n this$1.element.removeEventListener(eventName, handler, false);\r\n return false;\r\n });\r\n};\r\n\r\nEventElement.prototype.unbindAll = function unbindAll () {\r\n for (var name in this.handlers) {\r\n this.unbind(name);\r\n }\r\n};\r\n\r\nprototypeAccessors.isEmpty.get = function () {\r\n var this$1 = this;\r\n\r\n return Object.keys(this.handlers).every(\r\n function (key) { return this$1.handlers[key].length === 0; }\r\n );\r\n};\r\n\r\nObject.defineProperties( EventElement.prototype, prototypeAccessors );\r\n\r\nvar EventManager = function EventManager() {\r\n this.eventElements = [];\r\n};\r\n\r\nEventManager.prototype.eventElement = function eventElement (element) {\r\n var ee = this.eventElements.filter(function (ee) { return ee.element === element; })[0];\r\n if (!ee) {\r\n ee = new EventElement(element);\r\n this.eventElements.push(ee);\r\n }\r\n return ee;\r\n};\r\n\r\nEventManager.prototype.bind = function bind (element, eventName, handler) {\r\n this.eventElement(element).bind(eventName, handler);\r\n};\r\n\r\nEventManager.prototype.unbind = function unbind (element, eventName, handler) {\r\n var ee = this.eventElement(element);\r\n ee.unbind(eventName, handler);\r\n\r\n if (ee.isEmpty) {\r\n // remove\r\n this.eventElements.splice(this.eventElements.indexOf(ee), 1);\r\n }\r\n};\r\n\r\nEventManager.prototype.unbindAll = function unbindAll () {\r\n this.eventElements.forEach(function (e) { return e.unbindAll(); });\r\n this.eventElements = [];\r\n};\r\n\r\nEventManager.prototype.once = function once (element, eventName, handler) {\r\n var ee = this.eventElement(element);\r\n var onceHandler = function (evt) {\r\n ee.unbind(eventName, onceHandler);\r\n handler(evt);\r\n };\r\n ee.bind(eventName, onceHandler);\r\n};\r\n\r\nfunction createEvent(name) {\r\n if (typeof window.CustomEvent === 'function') {\r\n return new CustomEvent(name);\r\n } else {\r\n var evt = document.createEvent('CustomEvent');\r\n evt.initCustomEvent(name, false, false, undefined);\r\n return evt;\r\n }\r\n}\r\n\r\nfunction processScrollDiff(\r\n i,\r\n axis,\r\n diff,\r\n useScrollingClass,\r\n forceFireReachEvent\r\n) {\r\n if ( useScrollingClass === void 0 ) useScrollingClass = true;\r\n if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;\r\n\r\n var fields;\r\n if (axis === 'top') {\r\n fields = [\r\n 'contentHeight',\r\n 'containerHeight',\r\n 'scrollTop',\r\n 'y',\r\n 'up',\r\n 'down' ];\r\n } else if (axis === 'left') {\r\n fields = [\r\n 'contentWidth',\r\n 'containerWidth',\r\n 'scrollLeft',\r\n 'x',\r\n 'left',\r\n 'right' ];\r\n } else {\r\n throw new Error('A proper axis should be provided');\r\n }\r\n\r\n processScrollDiff$1(i, diff, fields, useScrollingClass, forceFireReachEvent);\r\n}\r\n\r\nfunction processScrollDiff$1(\r\n i,\r\n diff,\r\n ref,\r\n useScrollingClass,\r\n forceFireReachEvent\r\n) {\r\n var contentHeight = ref[0];\r\n var containerHeight = ref[1];\r\n var scrollTop = ref[2];\r\n var y = ref[3];\r\n var up = ref[4];\r\n var down = ref[5];\r\n if ( useScrollingClass === void 0 ) useScrollingClass = true;\r\n if ( forceFireReachEvent === void 0 ) forceFireReachEvent = false;\r\n\r\n var element = i.element;\r\n\r\n // reset reach\r\n i.reach[y] = null;\r\n\r\n // 1 for subpixel rounding\r\n if (element[scrollTop] < 1) {\r\n i.reach[y] = 'start';\r\n }\r\n\r\n // 1 for subpixel rounding\r\n if (element[scrollTop] > i[contentHeight] - i[containerHeight] - 1) {\r\n i.reach[y] = 'end';\r\n }\r\n\r\n if (diff) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + y)));\r\n\r\n if (diff < 0) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + up)));\r\n } else if (diff > 0) {\r\n element.dispatchEvent(createEvent((\"ps-scroll-\" + down)));\r\n }\r\n\r\n if (useScrollingClass) {\r\n setScrollingClassInstantly(i, y);\r\n }\r\n }\r\n\r\n if (i.reach[y] && (diff || forceFireReachEvent)) {\r\n element.dispatchEvent(createEvent((\"ps-\" + y + \"-reach-\" + (i.reach[y]))));\r\n }\r\n}\r\n\r\nfunction toInt(x) {\r\n return parseInt(x, 10) || 0;\r\n}\r\n\r\nfunction isEditable(el) {\r\n return (\r\n matches(el, 'input,[contenteditable]') ||\r\n matches(el, 'select,[contenteditable]') ||\r\n matches(el, 'textarea,[contenteditable]') ||\r\n matches(el, 'button,[contenteditable]')\r\n );\r\n}\r\n\r\nfunction outerWidth(element) {\r\n var styles = get(element);\r\n return (\r\n toInt(styles.width) +\r\n toInt(styles.paddingLeft) +\r\n toInt(styles.paddingRight) +\r\n toInt(styles.borderLeftWidth) +\r\n toInt(styles.borderRightWidth)\r\n );\r\n}\r\n\r\nvar env = {\r\n isWebKit:\r\n typeof document !== 'undefined' &&\r\n 'WebkitAppearance' in document.documentElement.style,\r\n supportsTouch:\r\n typeof window !== 'undefined' &&\r\n ('ontouchstart' in window ||\r\n ('maxTouchPoints' in window.navigator &&\r\n window.navigator.maxTouchPoints > 0) ||\r\n (window.DocumentTouch && document instanceof window.DocumentTouch)),\r\n supportsIePointer:\r\n typeof navigator !== 'undefined' && navigator.msMaxTouchPoints,\r\n isChrome:\r\n typeof navigator !== 'undefined' &&\r\n /Chrome/i.test(navigator && navigator.userAgent),\r\n};\r\n\r\nfunction updateGeometry(i) {\r\n var element = i.element;\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n var rect = element.getBoundingClientRect();\r\n\r\n i.containerWidth = Math.round(rect.width);\r\n i.containerHeight = Math.round(rect.height);\r\n\r\n i.contentWidth = element.scrollWidth;\r\n i.contentHeight = element.scrollHeight;\r\n\r\n if (!element.contains(i.scrollbarXRail)) {\r\n // clean up and append\r\n queryChildren(element, cls.element.rail('x')).forEach(function (el) { return remove(el); }\r\n );\r\n element.appendChild(i.scrollbarXRail);\r\n }\r\n if (!element.contains(i.scrollbarYRail)) {\r\n // clean up and append\r\n queryChildren(element, cls.element.rail('y')).forEach(function (el) { return remove(el); }\r\n );\r\n element.appendChild(i.scrollbarYRail);\r\n }\r\n\r\n if (\r\n !i.settings.suppressScrollX &&\r\n i.containerWidth + i.settings.scrollXMarginOffset < i.contentWidth\r\n ) {\r\n i.scrollbarXActive = true;\r\n i.railXWidth = i.containerWidth - i.railXMarginWidth;\r\n i.railXRatio = i.containerWidth / i.railXWidth;\r\n i.scrollbarXWidth = getThumbSize(\r\n i,\r\n toInt((i.railXWidth * i.containerWidth) / i.contentWidth)\r\n );\r\n i.scrollbarXLeft = toInt(\r\n ((i.negativeScrollAdjustment + element.scrollLeft) *\r\n (i.railXWidth - i.scrollbarXWidth)) /\r\n (i.contentWidth - i.containerWidth)\r\n );\r\n } else {\r\n i.scrollbarXActive = false;\r\n }\r\n\r\n if (\r\n !i.settings.suppressScrollY &&\r\n i.containerHeight + i.settings.scrollYMarginOffset < i.contentHeight\r\n ) {\r\n i.scrollbarYActive = true;\r\n i.railYHeight = i.containerHeight - i.railYMarginHeight;\r\n i.railYRatio = i.containerHeight / i.railYHeight;\r\n i.scrollbarYHeight = getThumbSize(\r\n i,\r\n toInt((i.railYHeight * i.containerHeight) / i.contentHeight)\r\n );\r\n i.scrollbarYTop = toInt(\r\n (roundedScrollTop * (i.railYHeight - i.scrollbarYHeight)) /\r\n (i.contentHeight - i.containerHeight)\r\n );\r\n } else {\r\n i.scrollbarYActive = false;\r\n }\r\n\r\n if (i.scrollbarXLeft >= i.railXWidth - i.scrollbarXWidth) {\r\n i.scrollbarXLeft = i.railXWidth - i.scrollbarXWidth;\r\n }\r\n if (i.scrollbarYTop >= i.railYHeight - i.scrollbarYHeight) {\r\n i.scrollbarYTop = i.railYHeight - i.scrollbarYHeight;\r\n }\r\n\r\n updateCss(element, i);\r\n\r\n if (i.scrollbarXActive) {\r\n element.classList.add(cls.state.active('x'));\r\n } else {\r\n element.classList.remove(cls.state.active('x'));\r\n i.scrollbarXWidth = 0;\r\n i.scrollbarXLeft = 0;\r\n element.scrollLeft = i.isRtl === true ? i.contentWidth : 0;\r\n }\r\n if (i.scrollbarYActive) {\r\n element.classList.add(cls.state.active('y'));\r\n } else {\r\n element.classList.remove(cls.state.active('y'));\r\n i.scrollbarYHeight = 0;\r\n i.scrollbarYTop = 0;\r\n element.scrollTop = 0;\r\n }\r\n}\r\n\r\nfunction getThumbSize(i, thumbSize) {\r\n if (i.settings.minScrollbarLength) {\r\n thumbSize = Math.max(thumbSize, i.settings.minScrollbarLength);\r\n }\r\n if (i.settings.maxScrollbarLength) {\r\n thumbSize = Math.min(thumbSize, i.settings.maxScrollbarLength);\r\n }\r\n return thumbSize;\r\n}\r\n\r\nfunction updateCss(element, i) {\r\n var xRailOffset = { width: i.railXWidth };\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n\r\n if (i.isRtl) {\r\n xRailOffset.left =\r\n i.negativeScrollAdjustment +\r\n element.scrollLeft +\r\n i.containerWidth -\r\n i.contentWidth;\r\n } else {\r\n xRailOffset.left = element.scrollLeft;\r\n }\r\n if (i.isScrollbarXUsingBottom) {\r\n xRailOffset.bottom = i.scrollbarXBottom - roundedScrollTop;\r\n } else {\r\n xRailOffset.top = i.scrollbarXTop + roundedScrollTop;\r\n }\r\n set(i.scrollbarXRail, xRailOffset);\r\n\r\n var yRailOffset = { top: roundedScrollTop, height: i.railYHeight };\r\n if (i.isScrollbarYUsingRight) {\r\n if (i.isRtl) {\r\n yRailOffset.right =\r\n i.contentWidth -\r\n (i.negativeScrollAdjustment + element.scrollLeft) -\r\n i.scrollbarYRight -\r\n i.scrollbarYOuterWidth -\r\n 9;\r\n } else {\r\n yRailOffset.right = i.scrollbarYRight - element.scrollLeft;\r\n }\r\n } else {\r\n if (i.isRtl) {\r\n yRailOffset.left =\r\n i.negativeScrollAdjustment +\r\n element.scrollLeft +\r\n i.containerWidth * 2 -\r\n i.contentWidth -\r\n i.scrollbarYLeft -\r\n i.scrollbarYOuterWidth;\r\n } else {\r\n yRailOffset.left = i.scrollbarYLeft + element.scrollLeft;\r\n }\r\n }\r\n set(i.scrollbarYRail, yRailOffset);\r\n\r\n set(i.scrollbarX, {\r\n left: i.scrollbarXLeft,\r\n width: i.scrollbarXWidth - i.railBorderXWidth,\r\n });\r\n set(i.scrollbarY, {\r\n top: i.scrollbarYTop,\r\n height: i.scrollbarYHeight - i.railBorderYWidth,\r\n });\r\n}\r\n\r\nfunction clickRail(i) {\r\n var element = i.element;\r\n\r\n i.event.bind(i.scrollbarY, 'mousedown', function (e) { return e.stopPropagation(); });\r\n i.event.bind(i.scrollbarYRail, 'mousedown', function (e) {\r\n var positionTop =\r\n e.pageY -\r\n window.pageYOffset -\r\n i.scrollbarYRail.getBoundingClientRect().top;\r\n var direction = positionTop > i.scrollbarYTop ? 1 : -1;\r\n\r\n i.element.scrollTop += direction * i.containerHeight;\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n });\r\n\r\n i.event.bind(i.scrollbarX, 'mousedown', function (e) { return e.stopPropagation(); });\r\n i.event.bind(i.scrollbarXRail, 'mousedown', function (e) {\r\n var positionLeft =\r\n e.pageX -\r\n window.pageXOffset -\r\n i.scrollbarXRail.getBoundingClientRect().left;\r\n var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;\r\n\r\n i.element.scrollLeft += direction * i.containerWidth;\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n });\r\n}\r\n\r\nfunction dragThumb(i) {\r\n bindMouseScrollHandler(i, [\r\n 'containerWidth',\r\n 'contentWidth',\r\n 'pageX',\r\n 'railXWidth',\r\n 'scrollbarX',\r\n 'scrollbarXWidth',\r\n 'scrollLeft',\r\n 'x',\r\n 'scrollbarXRail' ]);\r\n bindMouseScrollHandler(i, [\r\n 'containerHeight',\r\n 'contentHeight',\r\n 'pageY',\r\n 'railYHeight',\r\n 'scrollbarY',\r\n 'scrollbarYHeight',\r\n 'scrollTop',\r\n 'y',\r\n 'scrollbarYRail' ]);\r\n}\r\n\r\nfunction bindMouseScrollHandler(\r\n i,\r\n ref\r\n) {\r\n var containerHeight = ref[0];\r\n var contentHeight = ref[1];\r\n var pageY = ref[2];\r\n var railYHeight = ref[3];\r\n var scrollbarY = ref[4];\r\n var scrollbarYHeight = ref[5];\r\n var scrollTop = ref[6];\r\n var y = ref[7];\r\n var scrollbarYRail = ref[8];\r\n\r\n var element = i.element;\r\n\r\n var startingScrollTop = null;\r\n var startingMousePageY = null;\r\n var scrollBy = null;\r\n\r\n function mouseMoveHandler(e) {\r\n if (e.touches && e.touches[0]) {\r\n e[pageY] = e.touches[0].pageY;\r\n }\r\n element[scrollTop] =\r\n startingScrollTop + scrollBy * (e[pageY] - startingMousePageY);\r\n addScrollingClass(i, y);\r\n updateGeometry(i);\r\n\r\n e.stopPropagation();\r\n if (e.type.startsWith('touch') && e.changedTouches.length > 1) {\r\n e.preventDefault();\r\n }\r\n }\r\n\r\n function mouseUpHandler() {\r\n removeScrollingClass(i, y);\r\n i[scrollbarYRail].classList.remove(cls.state.clicking);\r\n i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);\r\n }\r\n\r\n function bindMoves(e, touchMode) {\r\n startingScrollTop = element[scrollTop];\r\n if (touchMode && e.touches) {\r\n e[pageY] = e.touches[0].pageY;\r\n }\r\n startingMousePageY = e[pageY];\r\n scrollBy =\r\n (i[contentHeight] - i[containerHeight]) /\r\n (i[railYHeight] - i[scrollbarYHeight]);\r\n if (!touchMode) {\r\n i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);\r\n i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);\r\n e.preventDefault();\r\n } else {\r\n i.event.bind(i.ownerDocument, 'touchmove', mouseMoveHandler);\r\n }\r\n\r\n i[scrollbarYRail].classList.add(cls.state.clicking);\r\n\r\n e.stopPropagation();\r\n }\r\n\r\n i.event.bind(i[scrollbarY], 'mousedown', function (e) {\r\n bindMoves(e);\r\n });\r\n i.event.bind(i[scrollbarY], 'touchstart', function (e) {\r\n bindMoves(e, true);\r\n });\r\n}\r\n\r\nfunction keyboard(i) {\r\n var element = i.element;\r\n\r\n var elementHovered = function () { return matches(element, ':hover'); };\r\n var scrollbarFocused = function () { return matches(i.scrollbarX, ':focus') || matches(i.scrollbarY, ':focus'); };\r\n\r\n function shouldPreventDefault(deltaX, deltaY) {\r\n var scrollTop = Math.floor(element.scrollTop);\r\n if (deltaX === 0) {\r\n if (!i.scrollbarYActive) {\r\n return false;\r\n }\r\n if (\r\n (scrollTop === 0 && deltaY > 0) ||\r\n (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)\r\n ) {\r\n return !i.settings.wheelPropagation;\r\n }\r\n }\r\n\r\n var scrollLeft = element.scrollLeft;\r\n if (deltaY === 0) {\r\n if (!i.scrollbarXActive) {\r\n return false;\r\n }\r\n if (\r\n (scrollLeft === 0 && deltaX < 0) ||\r\n (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)\r\n ) {\r\n return !i.settings.wheelPropagation;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n i.event.bind(i.ownerDocument, 'keydown', function (e) {\r\n if (\r\n (e.isDefaultPrevented && e.isDefaultPrevented()) ||\r\n e.defaultPrevented\r\n ) {\r\n return;\r\n }\r\n\r\n if (!elementHovered() && !scrollbarFocused()) {\r\n return;\r\n }\r\n\r\n var activeElement = document.activeElement\r\n ? document.activeElement\r\n : i.ownerDocument.activeElement;\r\n if (activeElement) {\r\n if (activeElement.tagName === 'IFRAME') {\r\n activeElement = activeElement.contentDocument.activeElement;\r\n } else {\r\n // go deeper if element is a webcomponent\r\n while (activeElement.shadowRoot) {\r\n activeElement = activeElement.shadowRoot.activeElement;\r\n }\r\n }\r\n if (isEditable(activeElement)) {\r\n return;\r\n }\r\n }\r\n\r\n var deltaX = 0;\r\n var deltaY = 0;\r\n\r\n switch (e.which) {\r\n case 37: // left\r\n if (e.metaKey) {\r\n deltaX = -i.contentWidth;\r\n } else if (e.altKey) {\r\n deltaX = -i.containerWidth;\r\n } else {\r\n deltaX = -30;\r\n }\r\n break;\r\n case 38: // up\r\n if (e.metaKey) {\r\n deltaY = i.contentHeight;\r\n } else if (e.altKey) {\r\n deltaY = i.containerHeight;\r\n } else {\r\n deltaY = 30;\r\n }\r\n break;\r\n case 39: // right\r\n if (e.metaKey) {\r\n deltaX = i.contentWidth;\r\n } else if (e.altKey) {\r\n deltaX = i.containerWidth;\r\n } else {\r\n deltaX = 30;\r\n }\r\n break;\r\n case 40: // down\r\n if (e.metaKey) {\r\n deltaY = -i.contentHeight;\r\n } else if (e.altKey) {\r\n deltaY = -i.containerHeight;\r\n } else {\r\n deltaY = -30;\r\n }\r\n break;\r\n case 32: // space bar\r\n if (e.shiftKey) {\r\n deltaY = i.containerHeight;\r\n } else {\r\n deltaY = -i.containerHeight;\r\n }\r\n break;\r\n case 33: // page up\r\n deltaY = i.containerHeight;\r\n break;\r\n case 34: // page down\r\n deltaY = -i.containerHeight;\r\n break;\r\n case 36: // home\r\n deltaY = i.contentHeight;\r\n break;\r\n case 35: // end\r\n deltaY = -i.contentHeight;\r\n break;\r\n default:\r\n return;\r\n }\r\n\r\n if (i.settings.suppressScrollX && deltaX !== 0) {\r\n return;\r\n }\r\n if (i.settings.suppressScrollY && deltaY !== 0) {\r\n return;\r\n }\r\n\r\n element.scrollTop -= deltaY;\r\n element.scrollLeft += deltaX;\r\n updateGeometry(i);\r\n\r\n if (shouldPreventDefault(deltaX, deltaY)) {\r\n e.preventDefault();\r\n }\r\n });\r\n}\r\n\r\nfunction wheel(i) {\r\n var element = i.element;\r\n\r\n function shouldPreventDefault(deltaX, deltaY) {\r\n var roundedScrollTop = Math.floor(element.scrollTop);\r\n var isTop = element.scrollTop === 0;\r\n var isBottom =\r\n roundedScrollTop + element.offsetHeight === element.scrollHeight;\r\n var isLeft = element.scrollLeft === 0;\r\n var isRight =\r\n element.scrollLeft + element.offsetWidth === element.scrollWidth;\r\n\r\n var hitsBound;\r\n\r\n // pick axis with primary direction\r\n if (Math.abs(deltaY) > Math.abs(deltaX)) {\r\n hitsBound = isTop || isBottom;\r\n } else {\r\n hitsBound = isLeft || isRight;\r\n }\r\n\r\n return hitsBound ? !i.settings.wheelPropagation : true;\r\n }\r\n\r\n function getDeltaFromEvent(e) {\r\n var deltaX = e.deltaX;\r\n var deltaY = -1 * e.deltaY;\r\n\r\n if (typeof deltaX === 'undefined' || typeof deltaY === 'undefined') {\r\n // OS X Safari\r\n deltaX = (-1 * e.wheelDeltaX) / 6;\r\n deltaY = e.wheelDeltaY / 6;\r\n }\r\n\r\n if (e.deltaMode && e.deltaMode === 1) {\r\n // Firefox in deltaMode 1: Line scrolling\r\n deltaX *= 10;\r\n deltaY *= 10;\r\n }\r\n\r\n if (deltaX !== deltaX && deltaY !== deltaY /* NaN checks */) {\r\n // IE in some mouse drivers\r\n deltaX = 0;\r\n deltaY = e.wheelDelta;\r\n }\r\n\r\n if (e.shiftKey) {\r\n // reverse axis with shift key\r\n return [-deltaY, -deltaX];\r\n }\r\n return [deltaX, deltaY];\r\n }\r\n\r\n function shouldBeConsumedByChild(target, deltaX, deltaY) {\r\n // FIXME: this is a workaround for issue in FF and IE #571\n if (!env.isWebKit && element.querySelector('select:focus')) {\n return true;\n }\n\n if (!element.contains(target)) {\n return false;\n }\n\n var cursor = target;\n\n while (cursor && cursor !== element) {\n if (cursor.classList.contains(cls.element.consuming)) {\n return true;\n }\n\n var style = get(cursor);\n\n // if deltaY && vertical scrollable\n if (deltaY && style.overflowY.match(/(scroll|auto)/)) {\n var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;\n if (maxScrollTop > 0) {\n if (\n (cursor.scrollTop > 0 && deltaY < 0) ||\n (cursor.scrollTop < maxScrollTop && deltaY > 0)\n ) {\n return true;\n }\n }\n }\n // if deltaX && horizontal scrollable\n if (deltaX && style.overflowX.match(/(scroll|auto)/)) {\n var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth;\n if (maxScrollLeft > 0) {\n if (\n (cursor.scrollLeft > 0 && deltaX < 0) ||\n (cursor.scrollLeft < maxScrollLeft && deltaX > 0)\n ) {\n return true;\n }\n }\n }\n\n cursor = cursor.parentNode;\n }\n\n return false;\n }\n\n function mousewheelHandler(e) {\n var ref = getDeltaFromEvent(e);\n var deltaX = ref[0];\n var deltaY = ref[1];\n\n if (shouldBeConsumedByChild(e.target, deltaX, deltaY)) {\n return;\n }\n\n var shouldPrevent = false;\n if (!i.settings.useBothWheelAxes) {\n // deltaX will only be used for horizontal scrolling and deltaY will\n // only be used for vertical scrolling - this is the default\n element.scrollTop -= deltaY * i.settings.wheelSpeed;\n element.scrollLeft += deltaX * i.settings.wheelSpeed;\n } else if (i.scrollbarYActive && !i.scrollbarXActive) {\n // only vertical scrollbar is active and useBothWheelAxes option is\n // active, so let's scroll vertical bar using both mouse wheel axes\n if (deltaY) {\n element.scrollTop -= deltaY * i.settings.wheelSpeed;\n } else {\n element.scrollTop += deltaX * i.settings.wheelSpeed;\n }\n shouldPrevent = true;\n } else if (i.scrollbarXActive && !i.scrollbarYActive) {\n // useBothWheelAxes and only horizontal bar is active, so use both\n // wheel axes for horizontal bar\n if (deltaX) {\n element.scrollLeft += deltaX * i.settings.wheelSpeed;\n } else {\n element.scrollLeft -= deltaY * i.settings.wheelSpeed;\n }\n shouldPrevent = true;\n }\n\n updateGeometry(i);\n\n shouldPrevent = shouldPrevent || shouldPreventDefault(deltaX, deltaY);\n if (shouldPrevent && !e.ctrlKey) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n if (typeof window.onwheel !== 'undefined') {\n i.event.bind(element, 'wheel', mousewheelHandler);\n } else if (typeof window.onmousewheel !== 'undefined') {\n i.event.bind(element, 'mousewheel', mousewheelHandler);\n }\n}\n\nfunction touch(i) {\n if (!env.supportsTouch && !env.supportsIePointer) {\n return;\n }\n\n var element = i.element;\n\n function shouldPrevent(deltaX, deltaY) {\n var scrollTop = Math.floor(element.scrollTop);\n var scrollLeft = element.scrollLeft;\n var magnitudeX = Math.abs(deltaX);\n var magnitudeY = Math.abs(deltaY);\n\n if (magnitudeY > magnitudeX) {\n // user is perhaps trying to swipe up/down the page\n\n if (\n (deltaY < 0 && scrollTop === i.contentHeight - i.containerHeight) ||\n (deltaY > 0 && scrollTop === 0)\n ) {\n // set prevent for mobile Chrome refresh\n return window.scrollY === 0 && deltaY > 0 && env.isChrome;\n }\n } else if (magnitudeX > magnitudeY) {\n // user is perhaps trying to swipe left/right across the page\n\n if (\n (deltaX < 0 && scrollLeft === i.contentWidth - i.containerWidth) ||\n (deltaX > 0 && scrollLeft === 0)\n ) {\n return true;\n }\n }\n\n return true;\n }\n\n function applyTouchMove(differenceX, differenceY) {\n element.scrollTop -= differenceY;\n element.scrollLeft -= differenceX;\n\n updateGeometry(i);\n }\n\n var startOffset = {};\n var startTime = 0;\n var speed = {};\n var easingLoop = null;\n\n function getTouch(e) {\n if (e.targetTouches) {\n return e.targetTouches[0];\n } else {\n // Maybe IE pointer\n return e;\n }\n }\n\n function shouldHandle(e) {\n if (e.pointerType && e.pointerType === 'pen' && e.buttons === 0) {\n return false;\n }\n if (e.targetTouches && e.targetTouches.length === 1) {\n return true;\n }\n if (\n e.pointerType &&\n e.pointerType !== 'mouse' &&\n e.pointerType !== e.MSPOINTER_TYPE_MOUSE\n ) {\n return true;\n }\n return false;\n }\n\n function touchStart(e) {\n if (!shouldHandle(e)) {\n return;\n }\n\n var touch = getTouch(e);\n\n startOffset.pageX = touch.pageX;\n startOffset.pageY = touch.pageY;\n\n startTime = new Date().getTime();\n\n if (easingLoop !== null) {\n clearInterval(easingLoop);\n }\n }\n\n function shouldBeConsumedByChild(target, deltaX, deltaY) {\n if (!element.contains(target)) {\n return false;\n }\n\n var cursor = target;\n\n while (cursor && cursor !== element) {\n if (cursor.classList.contains(cls.element.consuming)) {\n return true;\n }\n\n var style = get(cursor);\n\n // if deltaY && vertical scrollable\n if (deltaY && style.overflowY.match(/(scroll|auto)/)) {\n var maxScrollTop = cursor.scrollHeight - cursor.clientHeight;\n if (maxScrollTop > 0) {\n if (\n (cursor.scrollTop > 0 && deltaY < 0) ||\n (cursor.scrollTop < maxScrollTop && deltaY > 0)\n ) {\n return true;\n }\n }\n }\n // if deltaX && horizontal scrollable\n if (deltaX && style.overflowX.match(/(scroll|auto)/)) {\n var maxScrollLeft = cursor.scrollWidth - cursor.clientWidth;\n if (maxScrollLeft > 0) {\n if (\n (cursor.scrollLeft > 0 && deltaX < 0) ||\n (cursor.scrollLeft < maxScrollLeft && deltaX > 0)\n ) {\n return true;\n }\n }\n }\n\n cursor = cursor.parentNode;\n }\n\n return false;\n }\n\n function touchMove(e) {\n if (shouldHandle(e)) {\n var touch = getTouch(e);\n\n var currentOffset = { pageX: touch.pageX, pageY: touch.pageY };\n\n var differenceX = currentOffset.pageX - startOffset.pageX;\n var differenceY = currentOffset.pageY - startOffset.pageY;\n\n if (shouldBeConsumedByChild(e.target, differenceX, differenceY)) {\n return;\n }\n\n applyTouchMove(differenceX, differenceY);\n startOffset = currentOffset;\n\n var currentTime = new Date().getTime();\n\n var timeGap = currentTime - startTime;\n if (timeGap > 0) {\n speed.x = differenceX / timeGap;\n speed.y = differenceY / timeGap;\n startTime = currentTime;\n }\n\n if (shouldPrevent(differenceX, differenceY)) {\n e.preventDefault();\n }\n }\n }\n function touchEnd() {\n if (i.settings.swipeEasing) {\n clearInterval(easingLoop);\n easingLoop = setInterval(function() {\n if (i.isInitialized) {\n clearInterval(easingLoop);\n return;\n }\n\n if (!speed.x && !speed.y) {\n clearInterval(easingLoop);\n return;\n }\n\n if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {\n clearInterval(easingLoop);\n return;\n }\n\n applyTouchMove(speed.x * 30, speed.y * 30);\n\n speed.x *= 0.8;\n speed.y *= 0.8;\n }, 10);\n }\n }\n\n if (env.supportsTouch) {\n i.event.bind(element, 'touchstart', touchStart);\n i.event.bind(element, 'touchmove', touchMove);\n i.event.bind(element, 'touchend', touchEnd);\n } else if (env.supportsIePointer) {\n if (window.PointerEvent) {\n i.event.bind(element, 'pointerdown', touchStart);\n i.event.bind(element, 'pointermove', touchMove);\n i.event.bind(element, 'pointerup', touchEnd);\n } else if (window.MSPointerEvent) {\n i.event.bind(element, 'MSPointerDown', touchStart);\n i.event.bind(element, 'MSPointerMove', touchMove);\n i.event.bind(element, 'MSPointerUp', touchEnd);\n }\n }\n}\n\nvar defaultSettings = function () { return ({\n handlers: ['click-rail', 'drag-thumb', 'keyboard', 'wheel', 'touch'],\n maxScrollbarLength: null,\n minScrollbarLength: null,\n scrollingThreshold: 1000,\n scrollXMarginOffset: 0,\n scrollYMarginOffset: 0,\n suppressScrollX: false,\n suppressScrollY: false,\n swipeEasing: true,\n useBothWheelAxes: false,\n wheelPropagation: true,\n wheelSpeed: 1,\n}); };\n\nvar handlers = {\n 'click-rail': clickRail,\n 'drag-thumb': dragThumb,\n keyboard: keyboard,\n wheel: wheel,\n touch: touch,\n};\n\nvar PerfectScrollbar = function PerfectScrollbar(element, userSettings) {\n var this$1 = this;\n if ( userSettings === void 0 ) userSettings = {};\n\n if (typeof element === 'string') {\n element = document.querySelector(element);\n }\n\n if (!element || !element.nodeName) {\n throw new Error('no element is specified to initialize PerfectScrollbar');\n }\n\n this.element = element;\n\n element.classList.add(cls.main);\n\n this.settings = defaultSettings();\n for (var key in userSettings) {\n this.settings[key] = userSettings[key];\n }\n\n this.containerWidth = null;\n this.containerHeight = null;\n this.contentWidth = null;\n this.contentHeight = null;\n\n var focus = function () { return element.classList.add(cls.state.focus); };\n var blur = function () { return element.classList.remove(cls.state.focus); };\n\n this.isRtl = get(element).direction === 'rtl';\n if (this.isRtl === true) {\n element.classList.add(cls.rtl);\n }\n this.isNegativeScroll = (function () {\n var originalScrollLeft = element.scrollLeft;\n var result = null;\n element.scrollLeft = -1;\n result = element.scrollLeft < 0;\n element.scrollLeft = originalScrollLeft;\n return result;\n })();\n this.negativeScrollAdjustment = this.isNegativeScroll\n ? element.scrollWidth - element.clientWidth\n : 0;\n this.event = new EventManager();\n this.ownerDocument = element.ownerDocument || document;\n\n this.scrollbarXRail = div(cls.element.rail('x'));\n element.appendChild(this.scrollbarXRail);\n this.scrollbarX = div(cls.element.thumb('x'));\n this.scrollbarXRail.appendChild(this.scrollbarX);\n this.scrollbarX.setAttribute('tabindex', 0);\n this.event.bind(this.scrollbarX, 'focus', focus);\n this.event.bind(this.scrollbarX, 'blur', blur);\n this.scrollbarXActive = null;\n this.scrollbarXWidth = null;\n this.scrollbarXLeft = null;\n var railXStyle = get(this.scrollbarXRail);\n this.scrollbarXBottom = parseInt(railXStyle.bottom, 10);\n if (isNaN(this.scrollbarXBottom)) {\n this.isScrollbarXUsingBottom = false;\n this.scrollbarXTop = toInt(railXStyle.top);\n } else {\n this.isScrollbarXUsingBottom = true;\n }\n this.railBorderXWidth =\n toInt(railXStyle.borderLeftWidth) + toInt(railXStyle.borderRightWidth);\n // Set rail to display:block to calculate margins\n set(this.scrollbarXRail, { display: 'block' });\n this.railXMarginWidth =\n toInt(railXStyle.marginLeft) + toInt(railXStyle.marginRight);\n set(this.scrollbarXRail, { display: '' });\n this.railXWidth = null;\n this.railXRatio = null;\n\n this.scrollbarYRail = div(cls.element.rail('y'));\n element.appendChild(this.scrollbarYRail);\n this.scrollbarY = div(cls.element.thumb('y'));\n this.scrollbarYRail.appendChild(this.scrollbarY);\n this.scrollbarY.setAttribute('tabindex', 0);\n this.event.bind(this.scrollbarY, 'focus', focus);\n this.event.bind(this.scrollbarY, 'blur', blur);\n this.scrollbarYActive = null;\n this.scrollbarYHeight = null;\n this.scrollbarYTop = null;\n var railYStyle = get(this.scrollbarYRail);\n this.scrollbarYRight = parseInt(railYStyle.right, 10);\n if (isNaN(this.scrollbarYRight)) {\n this.isScrollbarYUsingRight = false;\n this.scrollbarYLeft = toInt(railYStyle.left);\n } else {\n this.isScrollbarYUsingRight = true;\n }\n this.scrollbarYOuterWidth = this.isRtl ? outerWidth(this.scrollbarY) : null;\n this.railBorderYWidth =\n toInt(railYStyle.borderTopWidth) + toInt(railYStyle.borderBottomWidth);\n set(this.scrollbarYRail, { display: 'block' });\n this.railYMarginHeight =\n toInt(railYStyle.marginTop) + toInt(railYStyle.marginBottom);\n set(this.scrollbarYRail, { display: '' });\n this.railYHeight = null;\n this.railYRatio = null;\n\n this.reach = {\n x:\n element.scrollLeft <= 0\n ? 'start'\n : element.scrollLeft >= this.contentWidth - this.containerWidth\n ? 'end'\n : null,\n y:\n element.scrollTop <= 0\n ? 'start'\n : element.scrollTop >= this.contentHeight - this.containerHeight\n ? 'end'\n : null,\n };\n\n this.isAlive = true;\n\n this.settings.handlers.forEach(function (handlerName) { return handlers[handlerName](this$1); });\n\n this.lastScrollTop = Math.floor(element.scrollTop); // for onScroll only\n this.lastScrollLeft = element.scrollLeft; // for onScroll only\n this.event.bind(this.element, 'scroll', function (e) { return this$1.onScroll(e); });\n updateGeometry(this);\n};\n\nPerfectScrollbar.prototype.update = function update () {\n if (!this.isAlive) {\n return;\n }\n\n // Recalcuate negative scrollLeft adjustment\n this.negativeScrollAdjustment = this.isNegativeScroll\n ? this.element.scrollWidth - this.element.clientWidth\n : 0;\n\n // Recalculate rail margins\n set(this.scrollbarXRail, { display: 'block' });\n set(this.scrollbarYRail, { display: 'block' });\n this.railXMarginWidth =\n toInt(get(this.scrollbarXRail).marginLeft) +\n toInt(get(this.scrollbarXRail).marginRight);\n this.railYMarginHeight =\n toInt(get(this.scrollbarYRail).marginTop) +\n toInt(get(this.scrollbarYRail).marginBottom);\n\n // Hide scrollbars not to affect scrollWidth and scrollHeight\n set(this.scrollbarXRail, { display: 'none' });\n set(this.scrollbarYRail, { display: 'none' });\n\n updateGeometry(this);\n\n processScrollDiff(this, 'top', 0, false, true);\n processScrollDiff(this, 'left', 0, false, true);\n\n set(this.scrollbarXRail, { display: '' });\n set(this.scrollbarYRail, { display: '' });\n};\n\nPerfectScrollbar.prototype.onScroll = function onScroll (e) {\n if (!this.isAlive) {\n return;\n }\n\n updateGeometry(this);\n processScrollDiff(this, 'top', this.element.scrollTop - this.lastScrollTop);\n processScrollDiff(\n this,\n 'left',\n this.element.scrollLeft - this.lastScrollLeft\n );\n\n this.lastScrollTop = Math.floor(this.element.scrollTop);\n this.lastScrollLeft = this.element.scrollLeft;\n};\n\nPerfectScrollbar.prototype.destroy = function destroy () {\n if (!this.isAlive) {\n return;\n }\n\n this.event.unbindAll();\n remove(this.scrollbarX);\n remove(this.scrollbarY);\n remove(this.scrollbarXRail);\n remove(this.scrollbarYRail);\n this.removePsClasses();\n\n // unset elements\n this.element = null;\n this.scrollbarX = null;\n this.scrollbarY = null;\n this.scrollbarXRail = null;\n this.scrollbarYRail = null;\n\n this.isAlive = false;\n};\n\nPerfectScrollbar.prototype.removePsClasses = function removePsClasses () {\n this.element.className = this.element.className\n .split(' ')\n .filter(function (name) { return !name.match(/^ps([-_].+|)$/); })\n .join(' ');\n};\n\nexport default PerfectScrollbar;\n//# sourceMappingURL=perfect-scrollbar.esm.js.map\n","function select(element) {\n var selectedText;\n\n if (element.nodeName === 'SELECT') {\n element.focus();\n\n selectedText = element.value;\n }\n else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {\n var isReadOnly = element.hasAttribute('readonly');\n\n if (!isReadOnly) {\n element.setAttribute('readonly', '');\n }\n\n element.select();\n element.setSelectionRange(0, element.value.length);\n\n if (!isReadOnly) {\n element.removeAttribute('readonly');\n }\n\n selectedText = element.value;\n }\n else {\n if (element.hasAttribute('contenteditable')) {\n element.focus();\n }\n\n var selection = window.getSelection();\n var range = document.createRange();\n\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n\n selectedText = selection.toString();\n }\n\n return selectedText;\n}\n\nmodule.exports = select;\n","(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', 'select'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('select'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.select);\n global.clipboardAction = mod.exports;\n }\n})(this, function (module, _select) {\n 'use strict';\n\n var _select2 = _interopRequireDefault(_select);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n\n var ClipboardAction = function () {\n /**\n * @param {Object} options\n */\n function ClipboardAction(options) {\n _classCallCheck(this, ClipboardAction);\n\n this.resolveOptions(options);\n this.initSelection();\n }\n\n /**\n * Defines base properties passed from constructor.\n * @param {Object} options\n */\n\n\n _createClass(ClipboardAction, [{\n key: 'resolveOptions',\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.action = options.action;\n this.container = options.container;\n this.emitter = options.emitter;\n this.target = options.target;\n this.text = options.text;\n this.trigger = options.trigger;\n\n this.selectedText = '';\n }\n }, {\n key: 'initSelection',\n value: function initSelection() {\n if (this.text) {\n this.selectFake();\n } else if (this.target) {\n this.selectTarget();\n }\n }\n }, {\n key: 'selectFake',\n value: function selectFake() {\n var _this = this;\n\n var isRTL = document.documentElement.getAttribute('dir') == 'rtl';\n\n this.removeFake();\n\n this.fakeHandlerCallback = function () {\n return _this.removeFake();\n };\n this.fakeHandler = this.container.addEventListener('click', this.fakeHandlerCallback) || true;\n\n this.fakeElem = document.createElement('textarea');\n // Prevent zooming on iOS\n this.fakeElem.style.fontSize = '12pt';\n // Reset box model\n this.fakeElem.style.border = '0';\n this.fakeElem.style.padding = '0';\n this.fakeElem.style.margin = '0';\n // Move element out of screen horizontally\n this.fakeElem.style.position = 'absolute';\n this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';\n // Move element to the same position vertically\n var yPosition = window.pageYOffset || document.documentElement.scrollTop;\n this.fakeElem.style.top = yPosition + 'px';\n\n this.fakeElem.setAttribute('readonly', '');\n this.fakeElem.value = this.text;\n\n this.container.appendChild(this.fakeElem);\n\n this.selectedText = (0, _select2.default)(this.fakeElem);\n this.copyText();\n }\n }, {\n key: 'removeFake',\n value: function removeFake() {\n if (this.fakeHandler) {\n this.container.removeEventListener('click', this.fakeHandlerCallback);\n this.fakeHandler = null;\n this.fakeHandlerCallback = null;\n }\n\n if (this.fakeElem) {\n this.container.removeChild(this.fakeElem);\n this.fakeElem = null;\n }\n }\n }, {\n key: 'selectTarget',\n value: function selectTarget() {\n this.selectedText = (0, _select2.default)(this.target);\n this.copyText();\n }\n }, {\n key: 'copyText',\n value: function copyText() {\n var succeeded = void 0;\n\n try {\n succeeded = document.execCommand(this.action);\n } catch (err) {\n succeeded = false;\n }\n\n this.handleResult(succeeded);\n }\n }, {\n key: 'handleResult',\n value: function handleResult(succeeded) {\n this.emitter.emit(succeeded ? 'success' : 'error', {\n action: this.action,\n text: this.selectedText,\n trigger: this.trigger,\n clearSelection: this.clearSelection.bind(this)\n });\n }\n }, {\n key: 'clearSelection',\n value: function clearSelection() {\n if (this.trigger) {\n this.trigger.focus();\n }\n\n window.getSelection().removeAllRanges();\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.removeFake();\n }\n }, {\n key: 'action',\n set: function set() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';\n\n this._action = action;\n\n if (this._action !== 'copy' && this._action !== 'cut') {\n throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n }\n },\n get: function get() {\n return this._action;\n }\n }, {\n key: 'target',\n set: function set(target) {\n if (target !== undefined) {\n if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {\n if (this.action === 'copy' && target.hasAttribute('disabled')) {\n throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n }\n\n if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n }\n\n this._target = target;\n } else {\n throw new Error('Invalid \"target\" value, use a valid Element');\n }\n }\n },\n get: function get() {\n return this._target;\n }\n }]);\n\n return ClipboardAction;\n }();\n\n module.exports = ClipboardAction;\n});","function E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\n","/**\n * Check if argument is a HTML element.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.node = function(value) {\n return value !== undefined\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Check if argument is a list of HTML elements.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.nodeList = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return value !== undefined\n && (type === '[object NodeList]' || type === '[object HTMLCollection]')\n && ('length' in value)\n && (value.length === 0 || exports.node(value[0]));\n};\n\n/**\n * Check if argument is a string.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.string = function(value) {\n return typeof value === 'string'\n || value instanceof String;\n};\n\n/**\n * Check if argument is a function.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.fn = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return type === '[object Function]';\n};\n","var DOCUMENT_NODE_TYPE = 9;\n\n/**\n * A polyfill for Element.matches()\n */\nif (typeof Element !== 'undefined' && !Element.prototype.matches) {\n var proto = Element.prototype;\n\n proto.matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector;\n}\n\n/**\n * Finds the closest parent that matches a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @return {Function}\n */\nfunction closest (element, selector) {\n while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {\n if (typeof element.matches === 'function' &&\n element.matches(selector)) {\n return element;\n }\n element = element.parentNode;\n }\n}\n\nmodule.exports = closest;\n","var closest = require('./closest');\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction delegate(element, selector, type, callback, useCapture) {\n var listenerFn = listener.apply(this, arguments);\n\n element.addEventListener(type, listenerFn, useCapture);\n\n return {\n destroy: function() {\n element.removeEventListener(type, listenerFn, useCapture);\n }\n }\n}\n\n/**\n * Finds closest match and invokes callback.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Function}\n */\nfunction listener(element, selector, type, callback) {\n return function(e) {\n e.delegateTarget = closest(e.target, selector);\n\n if (e.delegateTarget) {\n callback.call(element, e);\n }\n }\n}\n\nmodule.exports = delegate;\n","var is = require('./is');\nvar delegate = require('delegate');\n\n/**\n * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n if (!target && !type && !callback) {\n throw new Error('Missing required arguments');\n }\n\n if (!is.string(type)) {\n throw new TypeError('Second argument must be a String');\n }\n\n if (!is.fn(callback)) {\n throw new TypeError('Third argument must be a Function');\n }\n\n if (is.node(target)) {\n return listenNode(target, type, callback);\n }\n else if (is.nodeList(target)) {\n return listenNodeList(target, type, callback);\n }\n else if (is.string(target)) {\n return listenSelector(target, type, callback);\n }\n else {\n throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n }\n}\n\n/**\n * Adds an event listener to a HTML element\n * and returns a remove listener function.\n *\n * @param {HTMLElement} node\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNode(node, type, callback) {\n node.addEventListener(type, callback);\n\n return {\n destroy: function() {\n node.removeEventListener(type, callback);\n }\n }\n}\n\n/**\n * Add an event listener to a list of HTML elements\n * and returns a remove listener function.\n *\n * @param {NodeList|HTMLCollection} nodeList\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNodeList(nodeList, type, callback) {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.addEventListener(type, callback);\n });\n\n return {\n destroy: function() {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.removeEventListener(type, callback);\n });\n }\n }\n}\n\n/**\n * Add an event listener to a selector\n * and returns a remove listener function.\n *\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenSelector(selector, type, callback) {\n return delegate(document.body, selector, type, callback);\n}\n\nmodule.exports = listen;\n","(function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(['module', './clipboard-action', 'tiny-emitter', 'good-listener'], factory);\n } else if (typeof exports !== \"undefined\") {\n factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);\n global.clipboard = mod.exports;\n }\n})(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {\n 'use strict';\n\n var _clipboardAction2 = _interopRequireDefault(_clipboardAction);\n\n var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);\n\n var _goodListener2 = _interopRequireDefault(_goodListener);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n\n var _createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n }();\n\n function _possibleConstructorReturn(self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n }\n\n function _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n }\n\n var Clipboard = function (_Emitter) {\n _inherits(Clipboard, _Emitter);\n\n /**\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n * @param {Object} options\n */\n function Clipboard(trigger, options) {\n _classCallCheck(this, Clipboard);\n\n var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));\n\n _this.resolveOptions(options);\n _this.listenClick(trigger);\n return _this;\n }\n\n /**\n * Defines if attributes would be resolved using internal setter functions\n * or custom functions that were passed in the constructor.\n * @param {Object} options\n */\n\n\n _createClass(Clipboard, [{\n key: 'resolveOptions',\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.action = typeof options.action === 'function' ? options.action : this.defaultAction;\n this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;\n this.text = typeof options.text === 'function' ? options.text : this.defaultText;\n this.container = _typeof(options.container) === 'object' ? options.container : document.body;\n }\n }, {\n key: 'listenClick',\n value: function listenClick(trigger) {\n var _this2 = this;\n\n this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {\n return _this2.onClick(e);\n });\n }\n }, {\n key: 'onClick',\n value: function onClick(e) {\n var trigger = e.delegateTarget || e.currentTarget;\n\n if (this.clipboardAction) {\n this.clipboardAction = null;\n }\n\n this.clipboardAction = new _clipboardAction2.default({\n action: this.action(trigger),\n target: this.target(trigger),\n text: this.text(trigger),\n container: this.container,\n trigger: trigger,\n emitter: this\n });\n }\n }, {\n key: 'defaultAction',\n value: function defaultAction(trigger) {\n return getAttributeValue('action', trigger);\n }\n }, {\n key: 'defaultTarget',\n value: function defaultTarget(trigger) {\n var selector = getAttributeValue('target', trigger);\n\n if (selector) {\n return document.querySelector(selector);\n }\n }\n }, {\n key: 'defaultText',\n value: function defaultText(trigger) {\n return getAttributeValue('text', trigger);\n }\n }, {\n key: 'destroy',\n value: function destroy() {\n this.listener.destroy();\n\n if (this.clipboardAction) {\n this.clipboardAction.destroy();\n this.clipboardAction = null;\n }\n }\n }], [{\n key: 'isSupported',\n value: function isSupported() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];\n\n var actions = typeof action === 'string' ? [action] : action;\n var support = !!document.queryCommandSupported;\n\n actions.forEach(function (action) {\n support = support && !!document.queryCommandSupported(action);\n });\n\n return support;\n }\n }]);\n\n return Clipboard;\n }(_tinyEmitter2.default);\n\n /**\n * Helper function to retrieve attribute value.\n * @param {String} suffix\n * @param {Element} element\n */\n function getAttributeValue(suffix, element) {\n var attribute = 'data-clipboard-' + suffix;\n\n if (!element.hasAttribute(attribute)) {\n return;\n }\n\n return element.getAttribute(attribute);\n }\n\n module.exports = Clipboard;\n});","import PerfectScrollbar from 'perfect-scrollbar'\nimport Clipboard from 'clipboard'\nimport Constants from '../configuration/Constants'\n\n/**\n * Smart guide\n * @typedef {Object} SmartGuide\n * @property {Editor} editor - A reference to the current editor.\n * @property {String} wordToChange - Word to change following a click on a word.\n * @property {String} lastWord - Keep the last word of the previous export to compare with the new and scroll if it's different.\n * @property {String} previousLabelExport - Keep the previous label export to know if we should repopulate the prompter text.\n * @property {PerfectScrollbar} perfectScrollbar - Perfect Scrollbar used to get gestures from smart guide using touch-action none anyway and get scrolling too.\n * @property {Object} elements - All the HTML elements of the smart guide.\n * @property {Number} smartGuideTimeOutId - Id of the setTimeOut from fade out animation to clear.\n * @property {String} randomString - Random string used in case of multiple smart guide.\n */\n\n/**\n * Create all the smart guide HTML elements.\n */\nfunction createHTMLElements (randomString) {\n /**\n * The smart guide element.\n * @type {HTMLDivElement}\n */\n const smartGuideElement = document.createElement('div')\n smartGuideElement.id = 'smartguide' + randomString\n smartGuideElement.classList.add('smartguide')\n\n /**\n * The prompter text element that contains the text to get the overflow working.\n * @type {HTMLDivElement}\n */\n const textElement = document.createElement('div')\n textElement.id = 'prompter-text' + randomString\n textElement.classList.add('prompter-text')\n textElement.setAttribute('touch-action', 'none')\n\n /**\n * The text container element that contains the text element.\n * @type {HTMLDivElement}\n */\n const textContainer = document.createElement('div')\n textContainer.id = 'prompter-text-container' + randomString\n textContainer.classList.add('prompter-text-container')\n textContainer.appendChild(textElement)\n\n /**\n * The actions menu represented by the ellipsis character.\n * @type {HTMLDivElement}\n */\n const ellipsisElement = document.createElement('div')\n ellipsisElement.id = 'ellipsis' + randomString\n ellipsisElement.classList.add('ellipsis')\n ellipsisElement.innerHTML = '...'\n\n /**\n * The tag element.\n * @type {HTMLDivElement}\n */\n const tagElement = document.createElement('div')\n tagElement.id = 'tag-icon' + randomString\n tagElement.classList.add('tag-icon')\n tagElement.innerHTML = '¶'\n\n /**\n * The candidates element that contains the candidates for a word.\n * @type {HTMLDivElement}\n */\n const candidatesElement = document.createElement('div')\n candidatesElement.id = 'candidates' + randomString\n candidatesElement.classList.add('candidates')\n\n /**\n * The menu element that contains the actions.\n * @type {HTMLDivElement}\n */\n const menuElement = document.createElement('div')\n menuElement.id = 'more-menu' + randomString\n menuElement.classList.add('more-menu')\n\n /**\n * The convert button from actions menu.\n * @type {HTMLButtonElement}\n */\n const convertElement = document.createElement('button')\n convertElement.classList.add('options-label-button')\n convertElement.id = 'convert' + randomString\n convertElement.innerHTML = 'Convert'\n\n /**\n * The copy button from actions menu.\n * @type {HTMLButtonElement}\n */\n const copyElement = document.createElement('button')\n copyElement.classList.add('options-label-button')\n copyElement.id = 'copy' + randomString\n copyElement.innerHTML = 'Copy'\n\n /**\n * The delete button from actions menu.\n * @type {HTMLButtonElement}\n */\n const deleteElement = document.createElement('button')\n deleteElement.classList.add('options-label-button')\n deleteElement.id = 'delete' + randomString\n deleteElement.innerHTML = 'Delete'\n\n return {\n smartGuideElement,\n textElement,\n textContainer,\n candidatesElement,\n menuElement,\n tagElement,\n ellipsisElement,\n convertElement,\n copyElement,\n deleteElement\n }\n}\n\n/**\n * Check if node is in shadow dom\n * @param {Node} node - A node element.\n * @returns {boolean} true if is in shadow dom, false otherwise.\n */\nfunction isInShadow (node) {\n let parent = (node && node.parentNode)\n while (parent) {\n if (parent.toString() === '[object ShadowRoot]') {\n return true\n }\n parent = parent.parentNode\n }\n return false\n}\n\n/**\n * Show the actions of the action menu.\n * @param {Event} evt - Event used to insert the option div using the event's target.\n * @param {Object} elements - All the elements of the smart guide.\n * @param {SmartGuide} smartGuide\n */\nfunction showActions (evt, elements) {\n const elementsRef = elements\n\n const insertActions = () => {\n elementsRef.menuElement.appendChild(elementsRef.convertElement)\n elementsRef.menuElement.appendChild(elementsRef.copyElement)\n elementsRef.menuElement.appendChild(elementsRef.deleteElement)\n\n const parent = evt.target.parentNode\n parent.insertBefore(elementsRef.menuElement, evt.target)\n }\n\n const positionActions = () => {\n // 48 to get the boundary of smart guide element.\n const left = evt.target.offsetLeft - 68\n elementsRef.menuElement.style.left = `${left}px`\n }\n\n const isMenuInDocument = document.contains(elementsRef.menuElement)\n if (!isInShadow(elementsRef.menuElement) && !isMenuInDocument) {\n elementsRef.menuElement.style.display = 'flex'\n positionActions()\n insertActions()\n } else if (elementsRef.menuElement.style.display === 'none') {\n positionActions()\n elementsRef.menuElement.style.display = 'flex'\n }\n}\n\n/**\n * Show the candidates of the clicked word.\n * @param {Event} evt - Event used to determine the clicked word.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction showCandidates (evt, editor, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n if (evt.target.id !== `prompter-text${smartGuide.randomString}`) {\n const id = evt.target.id.replace('word-', '').replace(smartGuide.randomString, '')\n const words = JSON.parse(editor.exports[Constants.Exports.JIIX]).words\n smartGuideRef.wordToChange = words[id]\n smartGuideRef.wordToChange.id = id\n elementsRef.candidatesElement.innerHTML = ''\n if (smartGuideRef.wordToChange && smartGuideRef.wordToChange.candidates) {\n elementsRef.candidatesElement.style.display = 'flex'\n smartGuideRef.wordToChange.candidates.forEach((word, index) => {\n if (smartGuideRef.wordToChange.label === word) {\n elementsRef.candidatesElement.innerHTML += `${word}`\n } else {\n elementsRef.candidatesElement.innerHTML += `${word}`\n }\n })\n // get the parent parent of word to insert just before smart guide, 48 to get the boundary of smart guide element.\n const top = 48\n const left = evt.target.getBoundingClientRect().left - 60\n elementsRef.candidatesElement.style.top = `${top}px`\n elementsRef.candidatesElement.style.left = `${left}px`\n\n const parent = evt.target.parentNode.parentNode.parentNode\n parent.insertBefore(elementsRef.candidatesElement, evt.target.parentNode.parentNode)\n }\n }\n}\n\n/**\n * Call the import_ function of the editor to import the modified Jiix with the new label.\n * @param {Event} evt - Event to determine the clicked candidate.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction clickCandidate (evt, editor, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n const candidate = evt.target.innerText\n\n if (candidate !== smartGuideRef.wordToChange.label && smartGuideRef.wordToChange.candidates.includes(candidate)) {\n const jiixToImport = JSON.parse(editor.exports[Constants.Exports.JIIX])\n jiixToImport.words[smartGuideRef.wordToChange.id].label = candidate\n // eslint-disable-next-line no-underscore-dangle\n editor.import_(JSON.stringify(jiixToImport), Constants.Exports.JIIX)\n }\n elementsRef.candidatesElement.style.display = 'none'\n}\n\n/**\n * Add the listeners to the smart guide elements.\n * @param {Editor} editor - A reference to the editor.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction addListeners (editor, smartGuide) {\n const elementsRef = smartGuide.elements\n\n elementsRef.textElement.addEventListener('click', evt => showCandidates(evt, editor, smartGuide))\n elementsRef.candidatesElement.addEventListener('click', evt => clickCandidate(evt, editor, smartGuide))\n elementsRef.ellipsisElement.addEventListener('click', evt => showActions(evt, elementsRef))\n elementsRef.copyElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n })\n elementsRef.convertElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n editor.convert()\n })\n elementsRef.deleteElement.addEventListener('click', () => {\n elementsRef.menuElement.style.display = 'none'\n editor.clear()\n })\n}\n\n/**\n * Call mutation observer to trigger fade out animation.\n * @param {number} [duration=10000] - the duration in milliseconds before calling the fade out animation.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction callFadeOutObserver (duration = 10000, smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n // eslint-disable-next-line no-undef\n const observer = new MutationObserver((mutations) => {\n mutations.forEach(() => {\n if (smartGuideRef.smartGuideTimeOutId) {\n clearTimeout(smartGuideRef.smartGuideTimeOutId)\n }\n if (elementsRef.candidatesElement.style.display === 'none' && elementsRef.menuElement.style.display === 'none') {\n smartGuideRef.smartGuideTimeOutId = setTimeout(() => {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }, duration)\n } else if (!document.contains(elementsRef.candidatesElement) && !document.contains(elementsRef.menuElement)) {\n smartGuideRef.smartGuideTimeOutId = setTimeout(() => {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }, duration)\n }\n })\n })\n observer.observe(elementsRef.smartGuideElement, { childList: true, subtree: true, attributes: true })\n}\n\n/**\n * Insert the smart guide HTML elements in the DOM.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n */\nfunction insertSmartGuide (smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const insertSmartGuideElement = (left, top) => {\n elementsRef.smartGuideElement.style.top = `${top}px`\n elementsRef.smartGuideElement.style.left = `${left}px`\n elementsRef.smartGuideElement.style.visibility = 'hidden'\n\n const parent = smartGuideRef.editor.domElement\n parent.insertBefore(elementsRef.smartGuideElement, smartGuideRef.editor.loader)\n }\n const insertTag = () => {\n elementsRef.smartGuideElement.appendChild(elementsRef.tagElement)\n }\n const insertTextContainer = (left, maxWidth) => {\n elementsRef.textContainer.style.left = `${left}px`\n\n // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px)\n elementsRef.textContainer.style.width = `${maxWidth}px`\n elementsRef.textContainer.style.maxWidth = `${maxWidth}px`\n\n elementsRef.smartGuideElement.appendChild(elementsRef.textContainer)\n }\n const insertEllipsis = (left) => {\n elementsRef.ellipsisElement.style.left = `${left}px`\n\n elementsRef.smartGuideElement.appendChild(elementsRef.ellipsisElement)\n }\n\n // FIXME Use value from contentChanged when available\n\n const mmToPixels = 3.779527559\n\n const marginTop = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.top * mmToPixels\n const marginLeft = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels\n\n // 12 is the space between line in mm\n const top = marginTop - (12 * mmToPixels)\n let left = marginLeft\n\n insertSmartGuideElement(left, top)\n insertTag()\n\n // 35 is the ellipsis element width\n const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left\n left = elementsRef.tagElement.offsetWidth\n insertTextContainer(left, maxWidthTextContainer)\n\n left += maxWidthTextContainer\n insertEllipsis(left)\n\n elementsRef.menuElement.style.display = 'none'\n elementsRef.menuElement.appendChild(elementsRef.convertElement)\n elementsRef.menuElement.appendChild(elementsRef.copyElement)\n elementsRef.menuElement.appendChild(elementsRef.deleteElement)\n elementsRef.smartGuideElement.appendChild(elementsRef.menuElement)\n\n elementsRef.candidatesElement.style.display = 'none'\n elementsRef.smartGuideElement.appendChild(elementsRef.candidatesElement)\n\n // 48px as set in css\n elementsRef.smartGuideElement.style.height = '48px'\n elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px`\n smartGuideRef.perfectScrollbar.update()\n}\n\n/**\n * Create a new smart guide\n * @param {Editor} editor - A reference to the editor.\n * @returns {SmartGuide} New smart guide\n */\nexport function createSmartGuide (editor) {\n const randomString = '-' + Math.random().toString(10).substring(2, 12)\n const elements = createHTMLElements(randomString)\n\n /**\n * Clipboard from clipboard.js used to get copy across all browsers.\n * @type {Clipboard}\n */\n // eslint-disable-next-line no-unused-vars\n const clipboard = new Clipboard(elements.copyElement)\n const perfectScrollbar = new PerfectScrollbar(elements.textContainer, { suppressScrollY: true, scrollXMarginOffset: 1 })\n\n const smartGuide = {\n editor,\n wordToChange: '',\n lastWord: '',\n previousLabelExport: ' ',\n perfectScrollbar,\n elements,\n smartGuideTimeOutId: 0,\n randomString\n }\n addListeners(editor, smartGuide)\n\n if (editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable) {\n callFadeOutObserver(editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration, smartGuide)\n }\n\n return smartGuide\n}\n\nexport function resize (smartGuide) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const mmToPixels = 3.779527559\n let left = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels\n\n const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left\n\n // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px)\n elementsRef.textContainer.style.width = `${maxWidthTextContainer}px`\n elementsRef.textContainer.style.maxWidth = `${maxWidthTextContainer}px`\n\n left = elementsRef.tagElement.offsetWidth\n left += maxWidthTextContainer\n elementsRef.ellipsisElement.style.left = `${left}px`\n\n elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px`\n smartGuideRef.perfectScrollbar.update()\n}\n\n/**\n * Launch the smartguide.\n * @param {SmartGuide} smartGuide - A reference to the smart guide.\n * @param {Object} exports - The export from the editor.\n */\nexport function launchSmartGuide (smartGuide, exports) {\n const smartGuideRef = smartGuide\n const elementsRef = smartGuide.elements\n\n const isSmartGuideInDocument = document.contains(elementsRef.smartGuideElement)\n\n if (!isInShadow(elementsRef.smartGuideElement) && !isSmartGuideInDocument) {\n insertSmartGuide(smartGuide)\n }\n\n const addAnimationToModifiedWord = (words) => {\n if (smartGuideRef.tempWords && smartGuideRef.tempWords.length === words.length) {\n const labelWordsArray = words.map(word => word.label)\n const tempLabelWordsArray = smartGuideRef.tempWords.map(word => word.label)\n const wordChangedId = labelWordsArray.indexOf(labelWordsArray.filter(a => tempLabelWordsArray.indexOf(a) === -1)[0])\n if (document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`) && wordChangedId > -1) {\n document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`).classList.add('modified-word')\n elementsRef.textContainer.scrollLeft = document.getElementById(`word-${wordChangedId}${smartGuide.randomString}`).offsetLeft - 10\n }\n }\n smartGuideRef.tempWords = JSON.parse(exports[Constants.Exports.JIIX]).words\n }\n\n const createWordSpan = (empty, index, word) => {\n const span = document.createElement('span')\n span.id = `word-${index}${smartGuide.randomString}`\n if (empty) {\n span.innerHTML = ' '\n } else {\n span.textContent = word.label\n }\n return span\n }\n\n // Possible optimisation ? Check if we can find a way to not repopulate the smartguide every time even if we now use Document fragment\n const populatePrompter = (words) => {\n elementsRef.textElement.innerHTML = ''\n // We use a DocumentFragment to reflow the DOM only one time as it is not part of the DOM\n const myFragment = document.createDocumentFragment()\n words.forEach((word, index) => {\n if (word.label === ' ' || word.label.includes('\\n')) {\n myFragment.appendChild(createWordSpan(true, index))\n } else if (index !== words.length - 1) {\n myFragment.appendChild(createWordSpan(false, index, word))\n } else {\n elementsRef.textElement.appendChild(myFragment)\n smartGuideRef.perfectScrollbar.update()\n if (smartGuideRef.lastWord === '') {\n smartGuideRef.lastWord = word\n }\n const span = createWordSpan(false, index, word)\n // This is used to scroll to last word if last word is modified\n if ((smartGuideRef.lastWord.candidates !== word.candidates) && (smartGuideRef.lastWord.label !== word.label)) {\n span.classList.add('added-word')\n elementsRef.textElement.appendChild(span)\n elementsRef.textContainer.scrollLeft = span.offsetLeft\n smartGuideRef.lastWord = word\n } else {\n elementsRef.textElement.appendChild(span)\n elementsRef.textContainer.scrollLeft = span.offsetLeft\n }\n }\n })\n }\n\n if (exports && JSON.parse(exports[Constants.Exports.JIIX]).words.length > 0) {\n elementsRef.smartGuideElement.classList.add('smartguide-in')\n elementsRef.smartGuideElement.classList.remove('smartguide-out')\n elementsRef.candidatesElement.style.display = 'none'\n elementsRef.menuElement.style.display = 'none'\n if (smartGuideRef.previousLabelExport && smartGuideRef.previousLabelExport !== JSON.parse(exports[Constants.Exports.JIIX]).label) {\n const words = JSON.parse(exports[Constants.Exports.JIIX]).words\n populatePrompter(words)\n addAnimationToModifiedWord(words)\n }\n smartGuideRef.previousLabelExport = JSON.parse(exports[Constants.Exports.JIIX]).label\n // This is required by clipboard.js to get the text to be copied.\n elementsRef.copyElement.setAttribute('data-clipboard-text', JSON.parse(exports[Constants.Exports.JIIX]).label)\n } else {\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n }\n\n return smartGuideRef\n}\n\nexport function reset (smartGuide) {\n const elementsRef = smartGuide.elements\n elementsRef.candidatesElement.innerHTML = ''\n elementsRef.smartGuideElement.classList.add('smartguide-out')\n elementsRef.smartGuideElement.classList.remove('smartguide-in')\n}\n","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nmodule.exports = _classCallCheck;","function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nmodule.exports = _createClass;","/**\n * Undo/redo context\n * @typedef {Object} UndoRedoContext\n * @property {Array} stack=[] List of processed models.\n * @property {Number} currentPosition=-1 Current model index into the stack.\n * @property {Number} maxSize Max size of the stack.\n * @property {Boolean} canUndo=false\n * @property {Boolean} canRedo=false\n */\n\n/**\n * Create a new undo/redo context\n * @param {Configuration} configuration Current configuration\n * @return {UndoRedoContext} New undo/redo context\n */\nexport function createUndoRedoContext (configuration) {\n return {\n stack: [],\n currentPosition: -1,\n maxSize: configuration.undoRedoMaxStackSize,\n canUndo: false,\n canRedo: false\n }\n}\n\n/**\n * Update the undo/redo state\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context\n * @return {UndoRedoContext} Updated undo/redo context\n */\nexport function updateUndoRedoState (undoRedoContext) {\n const undoRedoContextRef = undoRedoContext\n undoRedoContextRef.canUndo = undoRedoContext.currentPosition > 0\n undoRedoContextRef.canRedo = undoRedoContext.currentPosition < (undoRedoContext.stack.length - 1)\n return undoRedoContextRef\n}\n","import * as InkModel from '../model/InkModel'\nimport * as UndoRedoContext from '../model/UndoRedoContext'\nimport { modelLogger as logger } from '../configuration/LoggerConfig'\nimport Constants from '../configuration/Constants'\n\n/**\n * Undo/redo manager\n * @typedef {Object} UndoRedoManager\n * @property {function} updateModel Push the current model into the undo/redo context.\n * @property {function} undo Undo.\n * @property {function} redo Redo.\n * @property {function} clear Clear.\n */\n\n/**\n * Get current model in stack\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context\n * @param {Boolean} [clone=true] Whether or not to clone the model\n * @param {...String} types\n */\nexport function getModel (undoRedoContext, clone = true, ...types) {\n const model = undoRedoContext.stack[undoRedoContext.currentPosition]\n const val = {\n res: clone ? InkModel.cloneModel(model) : model,\n types\n }\n return Promise.resolve(val)\n}\n\n/**\n * Mutate the undoRedo stack by adding a new model to it.\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function updateModel (undoRedoContext, model) {\n // Used to update the model with the recognition result if relevant\n const modelIndex = undoRedoContext.stack.findIndex(item => (item.modificationTime === model.modificationTime) && (item.rawStrokes.length === model.rawStrokes.length))\n\n const modelReference = model\n modelReference.modificationTime = new Date().getTime()\n\n const types = []\n if (modelIndex > -1) {\n undoRedoContext.stack.splice(modelIndex, 1, InkModel.cloneModel(modelReference))\n logger.debug('model updated', modelReference)\n } else {\n const undoRedoContextReference = undoRedoContext\n undoRedoContextReference.currentPosition += 1\n undoRedoContextReference.stack = undoRedoContextReference.stack.slice(0, undoRedoContextReference.currentPosition)\n undoRedoContextReference.stack.push(InkModel.cloneModel(modelReference))\n if (undoRedoContextReference.stack.length > undoRedoContextReference.maxSize) {\n undoRedoContextReference.stack.shift()\n undoRedoContextReference.currentPosition--\n }\n logger.debug('model pushed', modelReference)\n types.push(Constants.EventType.CHANGED)\n }\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('undo/redo stack updated', undoRedoContext)\n return getModel(undoRedoContext, false, ...types)\n}\n\n/**\n * Undo\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function undo (undoRedoContext, model) {\n const undoRedoContextReference = undoRedoContext\n if (undoRedoContextReference.currentPosition > 0) {\n undoRedoContextReference.currentPosition -= 1\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('undo index', undoRedoContextReference.currentPosition)\n }\n return getModel(undoRedoContext, true, Constants.EventType.CHANGED, Constants.EventType.EXPORTED)\n}\n\n/**\n * Redo\n * @param {UndoRedoContext} undoRedoContext Current undo/redo context.\n * @param {Model} model Current model.\n */\nexport function redo (undoRedoContext, model) {\n const undoRedoContextReference = undoRedoContext\n if (undoRedoContextReference.currentPosition < undoRedoContextReference.stack.length - 1) {\n undoRedoContextReference.currentPosition += 1\n UndoRedoContext.updateUndoRedoState(undoRedoContext)\n logger.debug('redo index', undoRedoContextReference.currentPosition)\n }\n return getModel(undoRedoContext, true, Constants.EventType.CHANGED, Constants.EventType.EXPORTED)\n}\n","import { drawModel } from './CanvasRenderer'\nimport * as InkModel from '../../model/InkModel'\n\nfunction createCanvas (borderCoordinates, margin = 10) {\n // eslint-disable-next-line no-undef\n const browserDocument = document\n const canvas = browserDocument.createElement('canvas')\n canvas.width = Math.abs(borderCoordinates.maxX - borderCoordinates.minX) + (2 * margin)\n canvas.style.width = `${canvas.width}px`\n canvas.height = Math.abs(borderCoordinates.maxY - borderCoordinates.minY) + (2 * margin)\n canvas.style.height = `${canvas.height}px`\n return canvas\n}\n\n/**\n * Generate a PNG image data url from the model\n * @param {Model} model Current model\n * @param {Stroker} stroker Current stroker\n * @param {Number} [margin=10] Margins to apply around the image\n * @return {String} Image data string result\n */\nexport function getImage (model, stroker, margin = 10) {\n if (model.rawStrokes.length > 0) {\n const borderCoordinates = InkModel.getBorderCoordinates(model)\n\n const capturingCanvas = createCanvas(borderCoordinates, margin)\n const renderingCanvas = createCanvas(borderCoordinates, margin)\n const renderStructure = {\n renderingCanvas,\n renderingCanvasContext: renderingCanvas.getContext('2d'),\n capturingCanvas,\n capturingCanvasContext: capturingCanvas.getContext('2d')\n }\n // Change canvas origin\n renderStructure.renderingCanvasContext.translate(-borderCoordinates.minX + margin, -borderCoordinates.minY + margin)\n drawModel(renderStructure, model, stroker)\n return renderStructure.renderingCanvas.toDataURL('image/png')\n }\n return null\n}\n","/* eslint-disable no-undef */\nimport { editorLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\n\n/**\n * Function to copy past to inject ink during tutorial.\n * @param editorParam\n * @param strokes\n * @param delayBetweenStrokes\n * @param lastOneDelay\n */\nexport function inkImporter (editorParam, strokes, delayBetweenStrokes, lastOneDelay) {\n const editor = editorParam\n logger.debug('inkImporter start importing =>', strokes)\n const origGrabber = Object.assign({}, editor.behavior.grabber)\n origGrabber.detach = editor.behavior.grabber.detach\n editor.behavior.grabber = {}\n const actions = []\n strokes.forEach((stroke) => {\n if (stroke.convert) {\n actions.push({ action: 'convert', value: true })\n } else if (stroke.setDelay) {\n actions.push({ action: 'setDelay', value: stroke.setDelay })\n } else {\n if (stroke.color) {\n actions.push({ action: 'setColor', value: stroke.color })\n }\n stroke.X.forEach((x, idx) => {\n let action = 'move'\n if (idx === 0) {\n action = 'down'\n } else if (idx === (stroke.X.length - 1)) {\n action = 'up'\n }\n actions.push({ action, point: { x: stroke.X[idx], y: stroke.Y[idx] } })\n })\n }\n })\n logger.debug('Array of actions =>', actions)\n const play = (actionsArray, position, delay) => {\n if (position < actionsArray.length) {\n const currentAction = actionsArray[position]\n let nextDelay = delay\n if (currentAction.action === 'convert') {\n editor.convert()\n } else if (currentAction.action === 'setDelay') {\n nextDelay = currentAction.value\n } else if (currentAction.action === 'setColor') {\n editor.penStyle = {\n color: currentAction.value\n }\n } else {\n currentAction.point.t = new Date().getTime()\n if (currentAction.action === 'down') {\n editor.pointerDown(currentAction.point)\n } else if (currentAction.action === 'up') {\n editor.pointerUp(currentAction.point)\n } else if (currentAction.action === 'move') {\n editor.pointerMove(currentAction.point)\n }\n } if (lastOneDelay && position === actionsArray.map(x => x.action).lastIndexOf('down') - 1) {\n setTimeout(() => {\n play(actionsArray, position + 1, nextDelay)\n }, lastOneDelay)\n } else if (position === actionsArray.length - 1) {\n const event = new Event('drawEnded')\n document.dispatchEvent(event)\n editor.behavior.grabber = origGrabber\n } else {\n setTimeout(() => {\n play(actionsArray, position + 1, nextDelay)\n }, nextDelay)\n }\n }\n }\n play(actions, 0, delayBetweenStrokes)\n}\n\nexport function importStrokeGroups (editorParam, strokeGroups) {\n strokeGroups.forEach((group) => {\n group.strokes.forEach((strokeFromGroup) => {\n InkModel.addStroke(editorParam.model, strokeFromGroup)\n InkModel.addStrokeToGroup(editorParam.model, strokeFromGroup, group.penStyle)\n })\n })\n editorParam.renderer.drawModel(editorParam.rendererContext, editorParam.model, editorParam.stroker)\n}\n","/**\n * @typedef {Object} DestructuredPromise\n * @property {Promise} promise\n * @property {function} resolve\n * @property {function} reject\n */\n\n/**\n * destructurePromise\n * @returns {{resolve: *, reject: *, promise: Promise}}\n */\nexport function destructurePromise () {\n let resolveParam\n let rejectParam\n const initPromise = new Promise(\n (resolve, reject) => {\n resolveParam = resolve\n rejectParam = reject\n })\n return { promise: initPromise, resolve: resolveParam, reject: rejectParam }\n}\n\n/**\n * @param time\n * @return {{timer: *, promise: Promise}}\n */\nexport function delay (time) {\n let timer = null\n const promise = new Promise((resolve) => {\n timer = setTimeout(resolve, time)\n })\n return {\n promise,\n timer\n }\n}\n","/* eslint-disable no-underscore-dangle */\nimport style from './iink.css'\nimport { editorLogger as logger } from './configuration/LoggerConfig'\nimport * as DefaultBehaviors from './configuration/DefaultBehaviors'\nimport * as DefaultConfiguration from './configuration/DefaultConfiguration'\nimport * as DefaultStyles from './configuration/DefaultPenStyle'\nimport * as DefaultTheme from './configuration/DefaultTheme'\nimport * as InkModel from './model/InkModel'\nimport * as UndoRedoContext from './model/UndoRedoContext'\nimport * as UndoRedoManager from './model/UndoRedoManager'\nimport * as ImageRenderer from './renderer/canvas/ImageRenderer'\nimport * as RecognizerContext from './model/RecognizerContext'\nimport * as SmartGuide from './smartguide/SmartGuide'\nimport Constants from './configuration/Constants'\nimport * as eastereggs from './eastereggs/InkImporter'\nimport {\n handleError,\n handleSuccess,\n emitEvents,\n manageRecognizedModel\n} from './recognizer/RecognizerService'\nimport * as PromiseHelper from './util/PromiseHelper'\n\n/**\n * Check if a clear is required, and does it if it is\n * @param {Editor} editor\n * @param {Model} model Current model\n * @return {Promise<*>}\n */\nfunction manageResetState (editor, model) {\n // If strokes moved in the undo redo stack then a clear is mandatory before sending strokes.\n if (editor.recognizer.reset && !editor.isErasing && RecognizerContext.isResetRequired(editor.recognizerContext, model)) {\n return editor.recognizer.reset(editor.recognizerContext, model)\n }\n return null\n}\n\n/**\n * Check if the trigger in parameter is valid.\n * @param {Editor} editor\n * @param {String} type\n * @param {String} [trigger]\n * @return {Boolean}\n */\nfunction isTriggerValid (editor, type, trigger = editor.configuration.triggers[type]) {\n if (editor.recognizer &&\n editor.recognizer.getInfo().availableTriggers[type].includes(trigger)) {\n return true\n }\n logger.error(`${trigger} is not a valid trigger for ${type}`)\n return false\n}\n\n/**\n * Launch the recognition with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} [trigger]\n * @return {Promise}\n */\nasync function addStrokes (editor, model, trigger = editor.configuration.triggers.addStrokes) {\n if (editor.recognizer && editor.recognizer.addStrokes) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n // Firing addStrokes only if recognizer is configure to do it\n if (isTriggerValid(editor, 'addStrokes', trigger)) {\n const res = await manageResetState(editor, model)\n if (res) {\n return editor.recognizer.addStrokes(editor.recognizerContext, res)\n }\n return editor.recognizer.addStrokes(editor.recognizerContext, model)\n }\n }\n }\n return Promise.reject(new Error('Cannot addStrokes'))\n}\n\n/**\n * Launch ink import.\n * @param {Editor} editor\n * @param {Model} model\n * @param {PointerEvents} events\n * @return {Promise<*>}\n */\nasync function launchPointerEvents (editor, model, events) {\n if (editor.recognizer && editor.recognizer.pointerEvents) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.pointerEvents(editor.recognizerContext, model, events)\n }\n }\n return Promise.reject(new Error('Cannot launch pointerEvents'))\n}\n\n/**\n * Launch the recognition with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} [requestedMimeTypes]\n * @param {String} [trigger]\n */\nexport async function launchExport (editor, model, requestedMimeTypes, trigger = editor.configuration.triggers.exportContent) {\n if (editor.recognizer && editor.recognizer.export_) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n if (isTriggerValid(editor, 'exportContent', trigger)) {\n const editorRef = editor\n window.clearTimeout(editor.exportTimer)\n const timeout = trigger === Constants.Trigger.QUIET_PERIOD ? editor.configuration.triggerDelay : 0\n const delayer = PromiseHelper.delay(timeout)\n editorRef.exportTimer = delayer.timer\n await delayer.promise\n const res = await manageResetState(editor, model)\n if (res) {\n return editor.recognizer.export_(editor.recognizerContext, res, requestedMimeTypes)\n }\n return editor.recognizer.export_(editor.recognizerContext, model, requestedMimeTypes)\n }\n }\n }\n return Promise.reject(new Error('Cannot launch export'))\n}\n\n/**\n * Launch the import.\n * @param {Editor} editor\n * @param {Model} model\n * @param {Blob} data\n * @return {Promise<*>}\n */\nasync function launchImport (editor, model, data) {\n if (editor.recognizer && editor.recognizer.import_) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.import_(editor.recognizerContext, model, data)\n }\n }\n return Promise.reject(new Error('Cannot launch import'))\n}\n\n/**\n * Get the supported mimetypes for import.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchGetSupportedImportMimeTypes (editor, model) {\n if (editor.recognizer && editor.recognizer.getSupportedImportMimeTypes) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.getSupportedImportMimeTypes(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch getSupportedImportMimeTypes'))\n}\n\n/**\n * Launch the convert with all editor relative configuration and state.\n * @param {Editor} editor\n * @param {Model} model\n * @param {String} conversionState\n * @return {Promise<*>}\n */\nasync function launchConvert (editor, model, conversionState) {\n if (editor.recognizer && editor.recognizer.convert) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.convert(editor.recognizerContext, model, conversionState)\n }\n }\n return Promise.reject(new Error('Cannot launch convert'))\n}\n\n/**\n * Launch the configuration for the editor\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchConfig (editor, model) {\n if (editor.recognizer && editor.recognizer.sendConfiguration) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.sendConfiguration(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch config'))\n}\n\n/**\n * Launch the resize.\n * @param {Editor} editor\n * @param {Model} model\n */\nasync function launchResize (editor, model) {\n if (editor.recognizer && editor.recognizer.resize) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n const editorRef = editor\n window.clearTimeout(editor.resizeTimer)\n const delayer = PromiseHelper.delay(editor.configuration.resizeTriggerDelay)\n editorRef.resizeTimer = delayer.timer\n SmartGuide.resize(editor.smartGuide)\n await delayer.promise\n return editor.recognizer.resize(editor.recognizerContext, model, editor.domElement)\n }\n }\n return Promise.reject(new Error('Cannot launch resize'))\n}\n\n/**\n * Launch wait for idle\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchWaitForIdle (editor, model) {\n if (editor.recognizer && editor.recognizer.waitForIdle) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.waitForIdle(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch wait for idle'))\n}\n\n/**\n * Launch websocket close\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function launchClose (editor, model) {\n if (editor.recognizer && editor.recognizer.close) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.close(editor.recognizerContext, model)\n }\n }\n return Promise.reject(new Error('Cannot launch close'))\n}\n\n/**\n * Set pen style.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setPenStyle (editor, model) {\n if (editor.recognizer && editor.recognizer.setPenStyle) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setPenStyle(editor.recognizerContext, model, editor.penStyle)\n }\n return Promise.reject(new Error('Cannot set pentStyle'))\n }\n return null\n}\n\n/**\n * Set pen style.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setPenStyleClasses (editor, model) {\n if (editor.recognizer && editor.recognizer.setPenStyleClasses) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setPenStyleClasses(editor.recognizerContext, model, editor.penStyleClasses)\n }\n return Promise.reject(new Error('Cannot set penStyleClasses'))\n }\n return null\n}\n\n/**\n * Set theme.\n * @param {Editor} editor\n * @param {Model} model\n * @return {Promise<*>}\n */\nasync function setTheme (editor, model) {\n if (editor.recognizer && editor.recognizer.setTheme) {\n const init = await editor.recognizerContext.initPromise\n if (init) {\n return editor.recognizer.setTheme(editor.recognizerContext, model, editor.theme)\n }\n return Promise.reject(new Error('Cannot set theme'))\n }\n return null\n}\n\n/**\n * Editor\n */\nexport class Editor {\n /**\n * @param {Element} element DOM element to attach this editor\n * @param {Configuration} [configuration] Configuration to apply\n * @param {Theme} [theme] Custom theme to apply\n * @param {PenStyle} [penStyle] Custom style to apply\n * @param {Behaviors} [behaviors] Custom behaviors to apply\n */\n constructor (element, configuration, penStyle, theme, behaviors, globalClassCss) {\n globalClassCss = globalClassCss || 'ms-editor'\n\n const styleElement = document.createElement('style')\n styleElement.appendChild(document.createTextNode(''))\n element.appendChild(styleElement)\n\n const sheet = styleElement.sheet\n styleElement.textContent = style\n\n this.sheet = sheet\n /**\n * Inner reference to the DOM Element\n * @type {Element}\n */\n this.domElement = element\n this.domElement.classList.add(globalClassCss)\n\n // eslint-disable-next-line no-undef\n this.loader = document.createElement('div')\n this.loader.classList.add('loader')\n this.loader = this.domElement.appendChild(this.loader)\n\n // eslint-disable-next-line no-undef\n this.error = document.createElement('div')\n this.error.classList.add('error-msg')\n this.error = this.domElement.appendChild(this.error)\n\n /**\n * Launch export timer\n * @type {Number}\n */\n this.exportTimer = undefined\n\n /**\n * Launch resize timer\n * @type {Number}\n */\n this.resizeTimer = undefined\n\n /**\n * Notify delay timer\n * @type {Number}\n */\n this.notifyTimer = undefined\n\n /**\n * @private\n * @type {Behaviors}\n */\n this.innerBehaviors = DefaultBehaviors.overrideDefaultBehaviors(behaviors)\n this.configuration = configuration\n\n /**\n * Pen color used only for pending stroke\n * @type {string}\n */\n this.localTheme = ''\n\n this.theme = theme\n this.penStyle = penStyle\n this.penStyleClasses = ''\n\n // To override pointerType when ERASER\n this.isErasing = false\n\n this.domElement.editor = this\n }\n\n /**\n * Set the recognition parameters\n * WARNING : Need to fire a clear if user have already input some strokes.\n * @param {Configuration} configuration\n */\n set configuration (configuration) {\n this.loader.style.display = 'initial'\n this.error.style.display = 'none'\n /**\n * @private\n * @type {Configuration}\n */\n this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration)\n this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration)\n if (this.smartGuide) {\n SmartGuide.reset(this.smartGuide)\n } else {\n this.smartGuide = SmartGuide.createSmartGuide(this)\n }\n }\n\n /**\n * Get the current recognition parameters\n * @return {Configuration}\n */\n get configuration () {\n return this.innerConfiguration\n }\n\n /**\n * Set the pen style\n * @param {PenStyle} penStyle\n */\n set penStyle (penStyle) {\n /**\n * @private\n * @type {PenStyle}\n */\n this.innerPenStyle = DefaultStyles.overrideDefaultPenStyle(penStyle)\n this.localPenStyle = this.innerPenStyle\n setPenStyle(this, this.model)\n }\n\n /**\n * Get the pen style\n * @return {PenStyle}\n */\n get penStyle () {\n return this.innerPenStyle\n }\n\n /**\n * Set the pen style\n * @param {String} penStyleClasses\n */\n set penStyleClasses (penStyleClasses) {\n /**\n * @private\n * @type {String}\n */\n this.innerPenStyleClasses = penStyleClasses\n this.localPenStyle = this.theme[`.${this.innerPenStyleClasses}`]\n setPenStyleClasses(this, this.model)\n }\n\n /**\n * Get the pen style\n * @return {String}\n */\n get penStyleClasses () {\n return this.innerPenStyleClasses\n }\n\n /**\n * Set the theme\n * @param {Theme} theme\n */\n set theme (theme) {\n /**\n * @private\n * @type {Theme}\n */\n this.innerTheme = DefaultTheme.overrideDefaultTheme(theme)\n setTheme(this, this.model)\n }\n\n /**\n * Get the theme\n * @return {Theme}\n */\n get theme () {\n return this.innerTheme\n }\n\n /**\n * Get behaviors\n * @return {Behaviors}\n */\n get behaviors () {\n return this.innerBehaviors\n }\n\n /**\n * @private\n * @param {Behavior} behavior\n */\n set behavior (behavior) {\n if (behavior) {\n if (this.grabber) { // Remove event handlers to avoid multiplication (detach grabber)\n this.grabber.detach(this.domElement, this.grabberContext)\n }\n /**\n * @private\n * @type {Behavior}\n */\n this.innerBehavior = behavior\n this.renderer = this.innerBehavior.renderer\n this.recognizer = this.innerBehavior.recognizer\n /**\n * Current grabber context\n * @type {GrabberContext}\n */\n this.grabberContext = this.grabber.attach(this.domElement, this)\n }\n }\n\n /**\n * Get current behavior\n * @return {Behavior}\n */\n get behavior () {\n return this.innerBehavior\n }\n\n /**\n * Set the current recognizer\n * @private\n * @param {Recognizer} recognizer\n */\n set recognizer (recognizer) {\n this.undoRedoContext = UndoRedoContext.createUndoRedoContext(this.configuration)\n this.undoRedoManager = UndoRedoManager\n\n const initialize = (model, shouldSendTheme) => {\n /**\n * @private\n * @type {Recognizer}\n */\n this.innerRecognizer = recognizer\n if (this.innerRecognizer) {\n /**\n * Current recognition context\n * @type {RecognizerContext}\n */\n this.recognizerContext = RecognizerContext.createEmptyRecognizerContext(this)\n // FIXME: merge undo/redo manager with default recognizer\n if (this.innerRecognizer.undo && this.innerRecognizer.redo && this.innerRecognizer.clear) {\n this.undoRedoContext = this.recognizerContext\n this.undoRedoManager = this.innerRecognizer\n }\n\n this.innerRecognizer.init(this.recognizerContext, model)\n .then((values) => {\n logger.info('Recognizer initialized !')\n if (shouldSendTheme) {\n setTheme(this, this.model)\n setPenStyle(this, this.model)\n setPenStyleClasses(this, this.model)\n }\n this.loader.style.display = 'none'\n })\n .catch(err => handleError(this, err))\n }\n }\n\n if (recognizer) {\n if (this.innerRecognizer) {\n this.innerRecognizer.close(this.recognizerContext, this.model)\n .then((model) => {\n logger.info('Recognizer closed')\n handleSuccess(this, model)\n initialize(InkModel.clearModel(model), true)\n })\n .catch(err => handleError(this, err))\n } else {\n /**\n * Current model\n * @type {Model}\n */\n this.model = InkModel.createModel(this.configuration)\n\n // INFO: Recognizer needs model to be initialized\n initialize(this.model, false)\n }\n }\n }\n\n /**\n * Get current recognizer\n * @return {Recognizer}\n */\n get recognizer () {\n return this.innerRecognizer\n }\n\n /**\n * Set the current renderer\n * @private\n * @param {Renderer} renderer\n */\n set renderer (renderer) {\n if (renderer) {\n if (this.innerRenderer) {\n this.innerRenderer.detach(this.domElement, this.rendererContext)\n }\n\n /**\n * @private\n * @type {Renderer}\n */\n this.innerRenderer = renderer\n if (this.innerRenderer) {\n /**\n * Current rendering context\n * @type {Object}\n */\n this.rendererContext = this.innerRenderer.attach(this.domElement, this.configuration.renderingParams.minHeight, this.configuration.renderingParams.minWidth)\n }\n }\n }\n\n /**\n * Get current renderer\n * @return {Renderer}\n */\n get renderer () {\n return this.innerRenderer\n }\n\n /**\n * Get current grabber\n * @return {Grabber}\n */\n get grabber () {\n return this.behavior ? this.behavior.grabber : undefined\n }\n\n /**\n * Get current stroker\n * @return {Stroker}\n */\n get stroker () {\n return this.behavior ? this.behavior.stroker : undefined\n }\n\n /**\n * Get current events\n * @return {Array}\n */\n get emit () {\n return this.behavior ? this.behavior.events : undefined\n }\n\n /**\n * Get a PNG image data url from the data model\n * @return {String}\n */\n get png () {\n return ImageRenderer.getImage(this.model, this.stroker)\n }\n\n /**\n * True if initialized, false otherwise\n * @return {Boolean}\n */\n get initialized () {\n return this.recognizerContext ? this.recognizerContext.initialized : false\n }\n\n enableEraser () {\n this.isErasing = true\n this.domElement.classList.add('erasing')\n }\n\n disableEraser () {\n document.body.style.cursor = 'initial'\n this.isErasing = false\n this.domElement.classList.remove('erasing')\n }\n\n /**\n * Handle a pointer down\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n * @param {String} [pointerType=mouse] Current pointer type\n * @param {String} [pointerId] Current pointer id\n */\n pointerDown (point, pointerType = 'pen', pointerId) {\n logger.trace('Pointer down', point)\n window.clearTimeout(this.notifyTimer)\n window.clearTimeout(this.exportTimer)\n this.model = InkModel.initPendingStroke(this.model, point, Object.assign({ pointerType, pointerId }, this.theme.ink, this.localPenStyle))\n if (!this.isErasing) {\n this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)\n }\n // Currently no recognition on pointer down\n }\n\n /**\n * Handle a pointer move\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n */\n pointerMove (point) {\n logger.trace('Pointer move', point)\n this.model = InkModel.appendToPendingStroke(this.model, point)\n if (!this.isErasing) {\n this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker)\n }\n // Currently no recognition on pointer move\n }\n\n /**\n * Handle a pointer up\n * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates\n */\n pointerUp (point) {\n logger.trace('Pointer up', point)\n this.model = InkModel.endPendingStroke(this.model, point, this.penStyle)\n if (!this.isErasing) {\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n }\n\n if (this.recognizer.addStrokes) {\n addStrokes(this, this.model)\n } else {\n // Push model in undo redo manager\n handleSuccess(this, this.model)\n }\n }\n\n removeStroke (stroke) {\n this.model.strokeGroups.forEach((group) => {\n const stringStrokes = group.strokes.map(strokeFromGroup => JSON.stringify(strokeFromGroup))\n const strokeIndex = stringStrokes.indexOf(JSON.stringify(stroke))\n if (strokeIndex !== -1) {\n group.strokes.splice(strokeIndex, 1)\n }\n })\n const stringRawStrokes = this.model.rawStrokes.map(strokes => JSON.stringify(strokes))\n const strokeIndex = stringRawStrokes.indexOf(JSON.stringify(stroke))\n if (strokeIndex !== -1) {\n this.model.rawStrokes.splice(strokeIndex, 1)\n }\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n handleSuccess(this, this.model)\n if (!(this.configuration.triggers.exportContent === 'DEMAND')) {\n launchExport(this, this.model)\n }\n }\n\n /**\n * @Deprecated\n * @param rawStrokes\n * @param strokeGroups\n */\n reDraw (rawStrokes, strokeGroups) {\n rawStrokes.forEach((stroke) => {\n InkModel.addStroke(this.model, stroke)\n })\n strokeGroups.forEach((group) => {\n group.strokes.forEach((strokeFromGroup) => {\n InkModel.addStrokeToGroup(this.model, strokeFromGroup, group.penStyle)\n })\n })\n this.renderer.drawModel(this.rendererContext, this.model, this.stroker)\n handleSuccess(this, this.model)\n }\n\n /**\n * True if idle state\n * @return {Boolean}\n */\n get idle () {\n return this.recognizerContext.idle\n }\n\n /**\n * Wait for idle state.\n * @return {Promise<*>}\n */\n waitForIdle () {\n emitEvents(this, undefined, Constants.EventType.IDLE)\n return launchWaitForIdle(this, this.model)\n }\n\n /**\n * True if can undo, false otherwise.\n * @return {Boolean}\n */\n get canUndo () {\n return this.undoRedoContext.canUndo\n }\n\n /**\n * Undo the last action.\n * @return {Promise<*>}\n */\n async undo () {\n logger.debug('Undo current model', this.model)\n emitEvents(this, undefined, Constants.EventType.UNDO)\n const { res, types } = await this.undoRedoManager.undo(this.undoRedoContext, this.model)\n .catch(err => handleError(this, err))\n manageRecognizedModel(this, res, ...types)\n return res\n }\n\n /**\n * True if can redo, false otherwise.\n * @return {Boolean}\n */\n get canRedo () {\n return this.undoRedoContext.canRedo\n }\n\n /**\n * Redo the last action.\n * @return {Promise<*>}\n */\n async redo () {\n logger.debug('Redo current model', this.model)\n emitEvents(this, undefined, Constants.EventType.REDO)\n const { res, types } = await this.undoRedoManager.redo(this.undoRedoContext, this.model)\n .catch(err => handleError(this, err))\n manageRecognizedModel(this, res, ...types)\n return res\n }\n\n /**\n * True if empty, false otherwise\n * @return {boolean}\n */\n get isEmpty () {\n return this.recognizerContext.isEmpty\n }\n\n /**\n * True if can clear, false otherwise.\n * @return {Boolean}\n */\n get canClear () {\n return !this.isEmpty\n }\n\n /**\n * Clear the output and the recognition result.\n * @return {Promise<*>}\n */\n async clear () {\n if (this.canClear) {\n logger.debug('Clear current model', this.model)\n emitEvents(this, undefined, Constants.EventType.CLEAR)\n const { res, events } = await this.recognizer.clear(this.recognizerContext, this.model)\n .catch(error => handleError(this, error))\n handleSuccess(this, res, ...events)\n return res\n }\n return Promise.reject(new Error('Cannot launch clear'))\n }\n\n /**\n * True if can convert, false otherwise.\n * @return {Boolean}\n */\n get canConvert () {\n return !!(this.canUndo && this.canClear && this.recognizer && this.recognizer.convert)\n }\n\n /**\n * Convert the current content\n * @param {string} conversionState\n * @return {Promise<*>}\n */\n convert (conversionState = 'DIGITAL_EDIT') {\n if (this.canConvert) {\n emitEvents(this, undefined, Constants.EventType.CONVERT)\n return launchConvert(this, this.model, conversionState)\n }\n return Promise.reject(new Error('Cannot launch convert'))\n }\n\n /**\n * Set the guides for text\n * @param {Boolean} [enable]\n * @return {Promise<*|null>}\n */\n setGuides (enable = true) {\n this.configuration.recognitionParams.iink.text.guides.enable = enable\n return launchConfig(this, this.model)\n }\n\n /**\n * Return the position of the cursor identifying the current state in the internal iink undo/redo stack.\n * @returns {Number}\n */\n get possibleUndoCount () {\n return this.recognizerContext.possibleUndoCount\n }\n\n /**\n * The number of operations that it is currently possible to undo.\n * @returns {Number}\n */\n get undoStackIndex () {\n return this.recognizerContext.undoStackIndex\n }\n\n /**\n * True if can export, false otherwise.\n * @return {Boolean}\n */\n get canExport () {\n return this.canUndo && this.canClear && this.recognizer && this.recognizer.getInfo().availableTriggers.exportContent.includes(Constants.Trigger.DEMAND)\n }\n\n /**\n * Explicitly ask to perform an export. You have to listen to events to get the content as this function is non blocking and does not have a return type.\n * @param {Array} requestedMimeTypes Requested mime-types. Be sure to ask all the types required by the listeners of exported event.\n */\n export_ (requestedMimeTypes) {\n if (this.canExport) {\n emitEvents(this, undefined, Constants.EventType.EXPORT)\n return launchExport(this, this.model, requestedMimeTypes, Constants.Trigger.DEMAND)\n }\n return Promise.reject(new Error('Cannot launch export'))\n }\n\n /**\n * Import content.\n * @param {Blob|*} data Data to import\n * @param {String} [mimetype] Mimetype of the data, needed if data is not a Blob\n */\n import_ (data, mimetype) {\n emitEvents(this, undefined, Constants.EventType.IMPORT)\n return launchImport(this, this.model, !(data instanceof Blob) ? new Blob([data], { type: mimetype }) : data)\n }\n\n /**\n * Get supported import mime types\n * @return {Promise<*|null>}\n */\n getSupportedImportMimeTypes () {\n return launchGetSupportedImportMimeTypes(this, this.model)\n }\n\n /**\n * pointer events\n * @param {PointerEvents} events\n * @return {Promise<*|null>}\n */\n pointerEvents (events) {\n return launchPointerEvents(this, this.model, events)\n }\n\n /**\n * Get current state exports\n * @return {Object}\n */\n get exports () {\n return this.model ? this.model.exports : undefined\n }\n\n get supportedImportMimeTypes () {\n return this.recognizerContext.supportedImportMimeTypes\n }\n\n /**\n * Function to call when the dom element link to the current ink paper has been resize.\n */\n resize () {\n logger.debug('Resizing editor')\n this.renderer.resize(this.rendererContext, this.model, this.stroker, this.configuration.renderingParams.minHeight, this.configuration.renderingParams.minWidth)\n return launchResize(this, this.model)\n }\n\n /**\n * Detach event listeners from the DOM element created at editor creation.\n */\n unload () {\n if (this.grabber) { // Remove event handlers to avoid multiplication (detach grabber)\n this.grabber.detach(this.domElement, this.grabberContext)\n }\n if (this.innerRenderer) {\n this.innerRenderer.detach(this.domElement, this.rendererContext)\n }\n }\n\n /**\n * Close websocket connection\n * @return {Promise<*>}\n */\n close () {\n if (this.configuration.recognitionParams.protocol === Constants.Protocol.WEBSOCKET) {\n return launchClose(this, this.model)\n }\n return null\n }\n\n /**\n * Trigger the change callbacks (and by default send a change event).\n */\n forceChange () {\n emitEvents(this, undefined, Constants.EventType.CHANGED)\n }\n\n /* eslint-disable class-methods-use-this */\n /**\n * Get access to some easter egg features link ink injection. Use at your own risk (less tested and may be removed without notice).\n */\n get eastereggs () {\n return eastereggs\n }\n /* eslint-enable class-methods-use-this */\n}\n","import { editorLogger as logger } from './LoggerConfig'\nimport * as PointerEventGrabber from '../grabber/PointerEventGrabber'\nimport * as CanvasRenderer from '../renderer/canvas/CanvasRenderer'\nimport * as QuadraticCanvasStroker from '../renderer/canvas/stroker/QuadraticCanvasStroker'\nimport * as SVGRenderer from '../renderer/svg/SVGRenderer'\nimport * as QuadraticSVGStroker from '../renderer/svg/stroker/QuadraticSVGStroker'\nimport * as iinkRestRecognizer from '../recognizer/rest/iinkRestRecognizer'\nimport * as iinkWsRecognizer from '../recognizer/websocket/iinkWsRecognizer'\nimport emit from '../event/Event'\n\n/**\n * Current behavior\n * @typedef {Object} Behavior\n * @property {Grabber} grabber Grabber to capture strokes\n * @property {Stroker} stroker Stroker to draw stroke\n * @property {Renderer} renderer Renderer to draw on the editor\n * @property {Recognizer} recognizer Recognizer to call the recognition service\n * @property {Array} events Functions to handle model changes\n */\n\n/**\n * Set of behaviors to be used by the {@link Editor}\n * @typedef {Object} Behaviors\n * @property {Grabber} grabber Grabber to capture strokes\n * @property {Array} strokerList List of stroker to draw stroke\n * @property {Array} rendererList List of renderer to draw on the editor\n * @property {Array} recognizerList Recognizers to call the recognition service\n * @property {function} getBehaviorFromConfiguration Get the current behavior to use regarding the current configuration\n * @property {Array} events Functions to handle model changes\n */\n\n/**\n * Default behaviors\n * @type {Behaviors}\n */\nexport const defaultBehaviors = {\n grabber: PointerEventGrabber,\n strokerList: [QuadraticCanvasStroker, QuadraticSVGStroker],\n rendererList: [CanvasRenderer, SVGRenderer],\n recognizerList: [iinkRestRecognizer, iinkWsRecognizer],\n events: emit,\n getBehaviorFromConfiguration: (behaviors, configuration) => {\n const behavior = {}\n behavior.grabber = behaviors.grabber\n if (configuration) {\n if (configuration.recognitionParams.protocol === 'REST') {\n behavior.stroker = QuadraticCanvasStroker\n behavior.renderer = CanvasRenderer\n behavior.recognizer = iinkRestRecognizer\n } else {\n behavior.stroker = QuadraticSVGStroker\n behavior.renderer = SVGRenderer\n behavior.recognizer = iinkWsRecognizer\n }\n }\n behavior.events = behaviors.events\n return behavior\n }\n}\n\n/**\n * Generate behaviors\n * @param {Behaviors} behaviors Behaviors to be used\n * @return {Behaviors} Overridden behaviors\n */\nexport function overrideDefaultBehaviors (behaviors) {\n if (behaviors) {\n const currentBehaviors = {\n grabber: behaviors.grabber || defaultBehaviors.grabber,\n rendererList: behaviors.rendererList || defaultBehaviors.rendererList,\n strokerList: behaviors.strokerList || defaultBehaviors.strokerList,\n recognizerList: behaviors.recognizerList || defaultBehaviors.recognizerList,\n events: behaviors.events || defaultBehaviors.events,\n getBehaviorFromConfiguration: behaviors.getBehaviorFromConfiguration || defaultBehaviors.getBehaviorFromConfiguration\n }\n logger.debug('Override default behaviors', currentBehaviors)\n return currentBehaviors\n }\n return defaultBehaviors\n}\n\nexport default defaultBehaviors\n","import Constants from '../configuration/Constants'\nimport { recognizerLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\nimport * as SmartGuide from '../smartguide/SmartGuide'\nimport * as RecognizerContext from '../model/RecognizerContext'\nimport { launchExport } from '../Editor'\n\n/**\n * Emit events\n * @param {Editor} editor\n * @param {Object} data\n * @param {...String} types\n * @return {Model}\n */\nexport function emitEvents (editor, data, ...types) {\n const editorRef = editor\n types.forEach((type) => {\n switch (type) {\n case Constants.EventType.RENDERED:\n break // Internal use only\n case Constants.EventType.UNDO:\n case Constants.EventType.REDO:\n case Constants.EventType.CLEAR:\n case Constants.EventType.CONVERT:\n case Constants.EventType.EXPORT:\n editor.emit.call(editor.domElement, type)\n break\n case Constants.EventType.LOADED:\n case Constants.EventType.CHANGED:\n editor.emit.call(editor.domElement, type, {\n initialized: editor.initialized,\n canUndo: editor.canUndo,\n canRedo: editor.canRedo,\n canClear: editor.canClear,\n isEmpty: editor.isEmpty,\n possibleUndoCount: editor.possibleUndoCount,\n undoStackIndex: editor.undoStackIndex,\n canConvert: editor.canConvert,\n canExport: editor.canExport\n })\n break\n case Constants.EventType.EXPORTED:\n window.clearTimeout(editorRef.notifyTimer)\n editorRef.notifyTimer = window.setTimeout(() => {\n editor.emit.call(editor.domElement, type, {\n exports: editor.exports\n })\n }, editorRef.configuration.processDelay)\n break\n case Constants.EventType.SUPPORTED_IMPORT_MIMETYPES:\n editor.emit.call(editor.domElement, type, {\n mimeTypes: editor.supportedImportMimeTypes\n })\n break\n case Constants.EventType.ERROR:\n editor.emit.call(editor.domElement, type, data)\n break\n case Constants.EventType.IDLE:\n editor.emit.call(editor.domElement, type, {\n idle: editor.idle\n })\n break\n default:\n logger.debug(`No valid trigger configured for ${type}`)\n break\n }\n })\n}\n\n/**\n * Manage recognized model\n * @param {Editor} editor\n * @param {Model} model\n * @param {...String} types\n */\nexport function manageRecognizedModel (editor, model, ...types) {\n const editorRef = editor\n const modelRef = model\n logger.debug(`model changed callback on ${types} event(s)`, model)\n if (modelRef.creationTime === editor.model.creationTime) {\n // Merge recognized model if relevant and return current editor model\n if ((modelRef.rawStrokes.length === editor.model.rawStrokes.length) &&\n (modelRef.lastPositions.lastSentPosition >= editor.model.lastPositions.lastReceivedPosition)) {\n editorRef.model = InkModel.mergeModels(editorRef.model, modelRef)\n if (InkModel.needRedraw(editorRef.model) || types.includes(Constants.EventType.RENDERED)) {\n editor.renderer.drawModel(editor.rendererContext, editorRef.model, editor.stroker)\n }\n } else {\n editorRef.model = modelRef\n editor.renderer.drawModel(editor.rendererContext, editorRef.model, editor.stroker)\n }\n emitEvents(editor, undefined, ...types)\n }\n\n if (editor.configuration.recognitionParams.type === 'TEXT' &&\n editor.configuration.recognitionParams.protocol !== 'REST' &&\n editor.configuration.recognitionParams.iink.text.mimeTypes.includes(Constants.Exports.JIIX) &&\n editor.configuration.recognitionParams.iink.text.smartGuide) {\n // eslint-disable-next-line no-use-before-define\n editorRef.smartGuide = SmartGuide.launchSmartGuide(editor.smartGuide, modelRef.exports)\n }\n\n if ((InkModel.extractPendingStrokes(model).length > 0) &&\n (!editor.recognizer.addStrokes) && // FIXME: Ugly hack to avoid double export (addStrokes + export)\n (editor.configuration.triggers.exportContent !== Constants.Trigger.DEMAND)) {\n launchExport(editor, model)\n }\n}\n\n/**\n * Method called when server respond with an error\n * Use in catch on Promises\n * @param {Editor} editor\n * @param {Object} err\n * @param {...String} events\n */\nexport function handleError (editor, err, ...events) {\n const editorRef = editor\n if (err.type !== 'close') {\n logger.error('Error while firing the recognition', err.stack || err) // Handle any error from all above steps\n }\n if (\n // IInk error managment before refactor\n (err.message === 'Invalid application key.') || (err.message === 'Invalid HMAC') ||\n // CDK error managment\n (err.error &&\n err.error.result &&\n err.error.result.error &&\n (err.error.result.error === 'InvalidApplicationKeyException' || err.error.result.error === 'InvalidHMACSignatureException')) ||\n // IInk error managment after refactor\n (err.code && err.code === 'access.not.granted')) {\n editorRef.error.innerText = Constants.Error.WRONG_CREDENTIALS\n } else if (err.code && err.code === 'no.activity') {\n editorRef.error.innerText = Constants.Error.NO_ACTIVITY\n } else if (err.message === 'Session is too old. Max Session Duration Reached.' ||\n (err.code && err.code === 'session.too.old')) {\n editorRef.error.innerText = Constants.Error.TOO_OLD\n } else if ((err.code === 1006 || err.code === 1000) && editorRef.error.style.display === 'none') {\n editorRef.error.innerText = Constants.Error.NOT_REACHABLE\n }\n if ((editorRef.error.innerText === Constants.Error.TOO_OLD || err.reason === 'CLOSE_RECOGNIZER') && RecognizerContext.canReconnect(editor.recognizerContext)) {\n logger.info('Reconnection is available', err.stack || err)\n editorRef.error.style.display = 'none'\n } else {\n editorRef.loader.style.display = 'none'\n editorRef.error.style.display = 'initial'\n emitEvents(editor, err, Constants.EventType.ERROR, ...events)\n }\n}\n\n/**\n * Method called when server respond correctly to request or WS\n * Use in then on Promises\n * @param {Editor} editor\n * @param {Object} model\n * @param {...String} events\n */\nexport function handleSuccess (editor, model, ...events) {\n const editorRef = editor\n if (editor.undoRedoManager.updateModel) {\n editor.undoRedoManager.updateModel(editor.undoRedoContext, model)\n .then(({ res, types }) => {\n manageRecognizedModel(editorRef, res, ...[...events, ...types].filter((el, i, a) => i === a.indexOf(el)))\n })\n } else {\n if (editorRef.error.style.display === 'initial') {\n editorRef.error.style.display = 'none'\n }\n manageRecognizedModel(editorRef, model, ...events)\n }\n}\n","import { recognizerLogger as logger } from '../configuration/LoggerConfig'\nimport * as InkModel from '../model/InkModel'\nimport * as RecognizerContext from '../model/RecognizerContext'\nimport Constants from '../configuration/Constants'\nimport { handleSuccess } from './RecognizerService'\n\n/**\n * Triggers\n * @typedef {Object} Triggers\n * @property {Array} exportContent Supported triggers for exporting content.\n * @property {Array} [addStrokes] Supported triggers for adding strokes.\n */\n\n/**\n * Recognizer info\n * @typedef {Object} RecognizerInfo\n * @property {Array} types Supported recognition types (TEXT, MATH, SHAPE, MUSIC, ANALYZER).\n * @property {String} protocol Supported protocol (REST, WEBSOCKET).\n * @property {String} apiVersion Supported API version.\n * @property {Triggers} availableTriggers Supported triggers for this recognizer.\n */\n\n/**\n * Recognizer callback\n * @typedef {function} RecognizerCallback\n * @param {Object} [err] Error\n * @param {Model} [model] Result\n * @param {...String} [types] Result types\n */\n\n/**\n * Simple callback\n * @typedef {function} Callback\n * @param {Object} [err] Error\n * @param {Object} [res] Result\n */\n\n/**\n * Recognition service entry point\n * @typedef {Object} Recognizer\n * @property {function} getInfo Get information about the supported configuration (protocol, type, apiVersion, ...).\n * @property {function} init Initialize recognition.\n * @property {function} clear Clear server context. Currently nothing to do there.\n * @property {function} close Close and free all resources that will no longer be used by the recognizer.\n * @property {function} [undo] Undo Undo the last done action.\n * @property {function} [redo] Redo Redo the previously undone action.\n * @property {function} [resize] Resize.\n * @property {function} [pointerEvents] Pointer Events.\n * @property {function} [addStrokes] Add strokes.\n * @property {function} [export_] Export content.\n * @property {function} [import_] Import content.\n * @property {function} [convert] Convert.\n * @property {function} [waitForIdle] Wait for idle.\n * @property {function} [setPenStyle] Set pen style.\n * @property {function} [setPenStyleClasses] Set pen style classes.\n * @property {function} [setTheme] Set theme.\n */\n\n/**\n * Initialize recognition\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function init (recognizerContext, model) {\n const modelRef = InkModel.resetModelPositions(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n recognizerContextRef.initPromise = Promise.resolve(modelRef)\n return recognizerContextRef.initPromise\n .then((res) => {\n recognizerContextRef.initialized = true\n logger.debug('Updated recognizer context', recognizerContextRef)\n handleSuccess(recognizerContextRef.editor, res, Constants.EventType.LOADED)\n return res\n })\n}\n\n/**\n * Reset server context. Currently nothing to do there.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function reset (recognizerContext, model) {\n const modelRef = InkModel.resetModelPositions(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n delete recognizerContextRef.instanceId\n logger.debug('Updated recognizer context', recognizerContextRef)\n return Promise.resolve({\n res: modelRef\n })\n}\n\n/**\n * Clear server context. Currently nothing to do there.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function clear (recognizerContext, model) {\n const modelRef = InkModel.clearModel(model)\n logger.debug('Updated model', modelRef)\n const recognizerContextRef = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n delete recognizerContextRef.instanceId\n logger.debug('Updated recognizer context', recognizerContextRef)\n return Promise.resolve({\n err: undefined,\n res: modelRef,\n events: [Constants.EventType.CHANGED, Constants.EventType.EXPORTED, Constants.EventType.RENDERED]\n })\n}\n\n/**\n * Close and free all resources that will no longer be used by the recognizer.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @return {Promise}\n */\nexport function close (recognizerContext, model) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.initialized = false\n delete recognizerContextRef.instanceId\n return Promise.resolve(model)\n}\n","/* eslint-disable no-underscore-dangle */\nimport * as NetworkInterface from './networkInterface'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport Constants from '../../configuration/Constants'\nimport * as InkModel from '../../model/InkModel'\nimport * as StrokeComponent from '../../model/StrokeComponent'\nimport * as DefaultTheme from '../../configuration/DefaultTheme'\nimport * as DefaultPenStyle from '../../configuration/DefaultPenStyle'\nimport { handleError, handleSuccess } from '../RecognizerService'\n\nexport { init, close, clear, reset } from '../DefaultRecognizer'\n\n/**\n * Recognizer configuration\n * @type {RecognizerInfo}\n */\nexport const iinkRestConfiguration = {\n types: [Constants.RecognitionType.TEXT, Constants.RecognitionType.DIAGRAM, Constants.RecognitionType.MATH, Constants.RecognitionType.RAWCONTENT],\n protocol: Constants.Protocol.REST,\n availableTriggers: {\n exportContent: [\n Constants.Trigger.QUIET_PERIOD,\n Constants.Trigger.DEMAND\n ]\n }\n}\n\n/**\n * Get the configuration supported by this recognizer\n * @return {RecognizerInfo}\n */\nexport function getInfo () {\n return iinkRestConfiguration\n}\n\n/**\n * @param {String} suffixUrl\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n * @param {function} buildMessage\n * @param {String} conversionState\n * @param {String} mimeType\n * @return {Promise.} Promise that return an updated model as a result\n */\nexport function postMessage (suffixUrl, recognizerContext, model, buildMessage, conversionState = '', mimeType) {\n const configuration = recognizerContext.editor.configuration\n return NetworkInterface.post(recognizerContext, `${configuration.recognitionParams.server.scheme}://${configuration.recognitionParams.server.host}${suffixUrl}`, buildMessage(recognizerContext, model, conversionState), 'V4', mimeType)\n .then((response) => {\n logger.debug('iinkRestRecognizer success', response)\n const positions = recognizerContext.lastPositions\n positions.lastReceivedPosition = positions.lastSentPosition\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, positions)\n if (response.instanceId) {\n recognizerContextReference.instanceId = response.instanceId\n }\n return response\n })\n}\n\nfunction buildTextConf (configuration) {\n return {\n text: configuration.recognitionParams.iink.text,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildMathConf (configuration) {\n return {\n math: configuration.recognitionParams.iink.math,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildDiagramConf (configuration) {\n return {\n diagram: configuration.recognitionParams.iink.diagram,\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildRawContentConf (configuration) {\n return {\n 'raw-content': {\n recognition: configuration.recognitionParams.iink['raw-content'].recognition\n },\n lang: configuration.recognitionParams.iink.lang,\n export: configuration.recognitionParams.iink.export\n }\n}\n\nfunction buildData (recognizerContext, model, conversionState) {\n const configuration = recognizerContext.editor.configuration\n let dataConf\n\n if (configuration.recognitionParams.type === 'TEXT') {\n dataConf = buildTextConf(configuration)\n } else if (configuration.recognitionParams.type === 'MATH') {\n dataConf = buildMathConf(configuration)\n } else if (configuration.recognitionParams.type === 'DIAGRAM') {\n dataConf = buildDiagramConf(configuration)\n } else if (configuration.recognitionParams.type === 'Raw Content') {\n dataConf = buildRawContentConf(configuration)\n }\n\n const newStrokes = []\n model.strokeGroups.forEach((group) => {\n const newPenStyle = JSON.stringify(group.penStyle) === '{}' ? null : DefaultPenStyle.toCSS(group.penStyle)\n const newGroup = {\n penStyle: newPenStyle,\n strokes: group.strokes.map(stroke => StrokeComponent.toJSON(stroke))\n }\n newStrokes.push(newGroup)\n })\n\n const contentType = configuration.recognitionParams.type === 'Raw Content' ? 'Raw Content' : configuration.recognitionParams.type.charAt(0)\n .toUpperCase() + configuration.recognitionParams.type.slice(1)\n .toLowerCase()\n\n const data = {\n configuration: dataConf,\n xDPI: 96,\n yDPI: 96,\n contentType,\n theme: DefaultTheme.toCSS(recognizerContext.editor.theme),\n strokeGroups: newStrokes\n }\n\n if (recognizerContext.editor.domElement) {\n data.height = recognizerContext.editor.domElement.clientHeight\n data.width = recognizerContext.editor.domElement.clientWidth\n }\n\n if (conversionState) {\n data.conversionState = 'DIGITAL_EDIT'\n }\n\n InkModel.updateModelSentPosition(model)\n return data\n}\n\nfunction extractExports (configuration, mimeType, res) {\n const exports = {}\n exports[mimeType] = res\n return exports\n}\n\nfunction resultCallback (recognizerContext, model, configuration, res, mimeType) {\n logger.debug('iinkRestRecognizer result callback', model)\n const modelReference = InkModel.updateModelReceivedPosition(model)\n modelReference.rawResults.exports = res\n if (modelReference.exports) {\n Object.assign(modelReference.exports, extractExports(configuration, mimeType, res))\n } else {\n modelReference.exports = extractExports(configuration, mimeType, res)\n }\n logger.debug('iinkRestRecognizer model updated', modelReference)\n\n if (recognizerContext.editor.undoRedoManager) {\n handleSuccess(recognizerContext.editor, modelReference, Constants.EventType.EXPORTED, Constants.EventType.IDLE)\n }\n}\n\nfunction callPostMessage (recognizerContext, model, mimeType) {\n const configuration = recognizerContext.editor.configuration\n return postMessage('/api/v4.0/iink/batch', recognizerContext, model, buildData, configuration.restConversionState, mimeType)\n .then((res) => {\n resultCallback(recognizerContext, model, configuration, res, mimeType)\n return model\n })\n .catch((err) => {\n handleError(recognizerContext.editor, err)\n return err\n })\n}\n\n/**\n * Export content\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @param {Array} requestedMimeTypes\n */\nexport function export_ (recognizerContext, model, requestedMimeTypes) {\n const configuration = recognizerContext.editor.configuration\n if (requestedMimeTypes) {\n return Promise.all(requestedMimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'TEXT') {\n return Promise.all(configuration.recognitionParams.iink.text.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'DIAGRAM') {\n return Promise.all(configuration.recognitionParams.iink.diagram.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'MATH') {\n return Promise.all(configuration.recognitionParams.iink.math.mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n } else if (configuration.recognitionParams.type === 'Raw Content') {\n return Promise.all(configuration.recognitionParams.iink['raw-content'].mimeTypes.map(mimeType => callPostMessage(recognizerContext, model, mimeType)))\n }\n return Promise.reject(new Error('Export failed'))\n}\n\n/**\n * Ask for conversion using DIGITAL_EDIT\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n */\nexport function convert (recognizerContext, model) {\n const configuration = recognizerContext.editor.configuration\n postMessage('/api/v4.0/iink/batch', recognizerContext, model, buildData, 'DIGITAL_EDIT')\n .then(res => resultCallback(model, configuration, res))\n .catch(err => handleError(recognizerContext.editor, err))\n}\n\n/**\n * Resize\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function resize (recognizerContext, model) {\n if (model.strokeGroups.length) {\n export_(recognizerContext, model)\n }\n}\n","function _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nmodule.exports = _arrayWithHoles;","function _iterableToArrayLimit(arr, i) {\n if (typeof Symbol === \"undefined\" || !(Symbol.iterator in Object(arr))) return;\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nmodule.exports = _iterableToArrayLimit;","function _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\n\nmodule.exports = _nonIterableRest;","var arrayWithHoles = require(\"./arrayWithHoles\");\n\nvar iterableToArrayLimit = require(\"./iterableToArrayLimit\");\n\nvar unsupportedIterableToArray = require(\"./unsupportedIterableToArray\");\n\nvar nonIterableRest = require(\"./nonIterableRest\");\n\nfunction _slicedToArray(arr, i) {\n return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();\n}\n\nmodule.exports = _slicedToArray;","/*\n * UUID-js: A js library to generate and parse UUIDs, TimeUUIDs and generate\n * TimeUUID based on dates for range selections.\n * @see http://www.ietf.org/rfc/rfc4122.txt\n **/\n\nfunction UUIDjs() {\n};\n\nUUIDjs.maxFromBits = function(bits) {\n return Math.pow(2, bits);\n};\n\nUUIDjs.limitUI04 = UUIDjs.maxFromBits(4);\nUUIDjs.limitUI06 = UUIDjs.maxFromBits(6);\nUUIDjs.limitUI08 = UUIDjs.maxFromBits(8);\nUUIDjs.limitUI12 = UUIDjs.maxFromBits(12);\nUUIDjs.limitUI14 = UUIDjs.maxFromBits(14);\nUUIDjs.limitUI16 = UUIDjs.maxFromBits(16);\nUUIDjs.limitUI32 = UUIDjs.maxFromBits(32);\nUUIDjs.limitUI40 = UUIDjs.maxFromBits(40);\nUUIDjs.limitUI48 = UUIDjs.maxFromBits(48);\n\n// Returns a random integer between min and max\n// Using Math.round() will give you a non-uniform distribution!\n// @see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random\nfunction getRandomInt(min, max) {\n return Math.floor(Math.random() * (max - min + 1)) + min;\n}\n\nUUIDjs.randomUI04 = function() {\n return getRandomInt(0, UUIDjs.limitUI04-1);\n};\nUUIDjs.randomUI06 = function() {\n return getRandomInt(0, UUIDjs.limitUI06-1);\n};\nUUIDjs.randomUI08 = function() {\n return getRandomInt(0, UUIDjs.limitUI08-1);\n};\nUUIDjs.randomUI12 = function() {\n return getRandomInt(0, UUIDjs.limitUI12-1);\n};\nUUIDjs.randomUI14 = function() {\n return getRandomInt(0, UUIDjs.limitUI14-1);\n};\nUUIDjs.randomUI16 = function() {\n return getRandomInt(0, UUIDjs.limitUI16-1);\n};\nUUIDjs.randomUI32 = function() {\n return getRandomInt(0, UUIDjs.limitUI32-1);\n};\nUUIDjs.randomUI40 = function() {\n return (0 | Math.random() * (1 << 30)) + (0 | Math.random() * (1 << 40 - 30)) * (1 << 30);\n};\nUUIDjs.randomUI48 = function() {\n return (0 | Math.random() * (1 << 30)) + (0 | Math.random() * (1 << 48 - 30)) * (1 << 30);\n};\n\nUUIDjs.paddedString = function(string, length, z) {\n string = String(string);\n z = (!z) ? '0' : z;\n var i = length - string.length;\n for (; i > 0; i >>>= 1, z += z) {\n if (i & 1) {\n string = z + string;\n }\n }\n return string;\n};\n\nUUIDjs.prototype.fromParts = function(timeLow, timeMid, timeHiAndVersion, clockSeqHiAndReserved, clockSeqLow, node) {\n this.version = (timeHiAndVersion >> 12) & 0xF;\n this.hex = UUIDjs.paddedString(timeLow.toString(16), 8)\n + '-'\n + UUIDjs.paddedString(timeMid.toString(16), 4)\n + '-'\n + UUIDjs.paddedString(timeHiAndVersion.toString(16), 4)\n + '-'\n + UUIDjs.paddedString(clockSeqHiAndReserved.toString(16), 2)\n + UUIDjs.paddedString(clockSeqLow.toString(16), 2)\n + '-'\n + UUIDjs.paddedString(node.toString(16), 12);\n return this;\n};\n\nUUIDjs.prototype.toString = function() {\n return this.hex;\n};\nUUIDjs.prototype.toURN = function() {\n return 'urn:uuid:' + this.hex;\n};\n\nUUIDjs.prototype.toBytes = function() {\n var parts = this.hex.split('-');\n var ints = [];\n var intPos = 0;\n for (var i = 0; i < parts.length; i++) {\n for (var j = 0; j < parts[i].length; j+=2) {\n ints[intPos++] = parseInt(parts[i].substr(j, 2), 16);\n }\n }\n return ints;\n};\n\nUUIDjs.prototype.equals = function(uuid) {\n if (!(uuid instanceof UUID)) {\n return false;\n }\n if (this.hex !== uuid.hex) {\n return false;\n }\n return true;\n};\n\nUUIDjs.getTimeFieldValues = function(time) {\n var ts = time - Date.UTC(1582, 9, 15);\n var hm = ((ts / 0x100000000) * 10000) & 0xFFFFFFF;\n return { low: ((ts & 0xFFFFFFF) * 10000) % 0x100000000,\n mid: hm & 0xFFFF, hi: hm >>> 16, timestamp: ts };\n};\n\nUUIDjs._create4 = function() {\n return new UUIDjs().fromParts(\n UUIDjs.randomUI32(),\n UUIDjs.randomUI16(),\n 0x4000 | UUIDjs.randomUI12(),\n 0x80 | UUIDjs.randomUI06(),\n UUIDjs.randomUI08(),\n UUIDjs.randomUI48()\n );\n};\n\nUUIDjs._create1 = function() {\n var now = new Date().getTime();\n var sequence = UUIDjs.randomUI14();\n var node = (UUIDjs.randomUI08() | 1) * 0x10000000000 + UUIDjs.randomUI40();\n var tick = UUIDjs.randomUI04();\n var timestamp = 0;\n var timestampRatio = 1/4;\n\n if (now != timestamp) {\n if (now < timestamp) {\n sequence++;\n }\n timestamp = now;\n tick = UUIDjs.randomUI04();\n } else if (Math.random() < timestampRatio && tick < 9984) {\n tick += 1 + UUIDjs.randomUI04();\n } else {\n sequence++;\n }\n\n var tf = UUIDjs.getTimeFieldValues(timestamp);\n var tl = tf.low + tick;\n var thav = (tf.hi & 0xFFF) | 0x1000;\n\n sequence &= 0x3FFF;\n var cshar = (sequence >>> 8) | 0x80;\n var csl = sequence & 0xFF;\n\n return new UUIDjs().fromParts(tl, tf.mid, thav, cshar, csl, node);\n};\n\nUUIDjs.create = function(version) {\n version = version || 4;\n return this['_create' + version]();\n};\n\nUUIDjs.fromTime = function(time, last) {\n last = (!last) ? false : last;\n var tf = UUIDjs.getTimeFieldValues(time);\n var tl = tf.low;\n var thav = (tf.hi & 0xFFF) | 0x1000; // set version '0001'\n if (last === false) {\n return new UUIDjs().fromParts(tl, tf.mid, thav, 0, 0, 0);\n } else {\n return new UUIDjs().fromParts(tl, tf.mid, thav, 0x80 | UUIDjs.limitUI06, UUIDjs.limitUI08 - 1, UUIDjs.limitUI48 - 1);\n }\n};\n\nUUIDjs.firstFromTime = function(time) {\n return UUIDjs.fromTime(time, false);\n};\nUUIDjs.lastFromTime = function(time) {\n return UUIDjs.fromTime(time, true);\n};\n\nUUIDjs.fromURN = function(strId) {\n var r, p = /^(?:urn:uuid:|\\{)?([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})(?:\\})?$/i;\n if ((r = p.exec(strId))) {\n return new UUIDjs().fromParts(parseInt(r[1], 16), parseInt(r[2], 16),\n parseInt(r[3], 16), parseInt(r[4], 16),\n parseInt(r[5], 16), parseInt(r[6], 16));\n }\n return null;\n};\n\nUUIDjs.fromBytes = function(ints) {\n if (ints.length < 5) {\n return null;\n }\n var str = '';\n var pos = 0;\n var parts = [4, 2, 2, 2, 6];\n for (var i = 0; i < parts.length; i++) {\n for (var j = 0; j < parts[i]; j++) {\n var octet = ints[pos++].toString(16);\n if (octet.length == 1) {\n octet = '0' + octet;\n }\n str += octet;\n }\n if (parts[i] !== 6) {\n str += '-';\n }\n }\n return UUIDjs.fromURN(str);\n};\n\nUUIDjs.fromBinary = function(binary) {\n var ints = [];\n for (var i = 0; i < binary.length; i++) {\n ints[i] = binary.charCodeAt(i);\n if (ints[i] > 255 || ints[i] < 0) {\n throw new Error('Unexpected byte in binary data.');\n }\n }\n return UUIDjs.fromBytes(ints);\n};\n\n// Aliases to support legacy code. Do not use these when writing new code as\n// they may be removed in future versions!\nUUIDjs.new = function() {\n return this.create(4);\n};\nUUIDjs.newTS = function() {\n return this.create(1);\n};\n\nmodule.exports = UUIDjs;\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as RecognizerContext from '../../model/RecognizerContext'\n\nfunction infinitePing (websocket) {\n const websocketRef = websocket\n websocketRef.pingLostCount++\n if (websocketRef.pingLostCount > websocketRef.maxPingLost) {\n websocket.close(1000, 'PING_LOST')\n } else if (websocketRef.readyState <= 1) {\n setTimeout(() => {\n if (websocketRef.readyState <= 1) {\n websocketRef.send(JSON.stringify({ type: 'ping' }))\n infinitePing(websocketRef)\n }\n }, websocketRef.pingDelay)\n }\n}\n\n/**\n * Attach all socket attributes helping managing server connexion\n * @param {WebSocket} websocket Current WebSocket\n * @param {RecognizerContext} recognizerContext\n */\nfunction addWebsocketAttributes (websocket, recognizerContext) {\n const websocketConfiguration = recognizerContext.editor.configuration.recognitionParams.server.websocket\n const socket = websocket\n socket.start = new Date()\n socket.autoReconnect = websocketConfiguration.autoReconnect\n socket.maxRetryCount = websocketConfiguration.maxRetryCount\n socket.pingEnabled = websocketConfiguration.pingEnabled\n socket.pingDelay = websocketConfiguration.pingDelay\n socket.maxPingLost = websocketConfiguration.maxPingLostCount\n socket.pingLostCount = 0\n socket.recognizerContext = recognizerContext\n}\n\n/**\n * @param {RecognizerContext} recognizerContext Recognizer context\n * @return {WebSocket} Opened WebSocket\n */\nexport function openWebSocket (recognizerContext) {\n let socket\n try {\n // eslint-disable-next-line no-undef\n socket = new WebSocket(recognizerContext.url)\n } catch (error) {\n logger.error('Unable to open websocket, Check the host and your connectivity')\n }\n addWebsocketAttributes(socket, recognizerContext)\n if (socket.pingEnabled) {\n infinitePing(socket)\n }\n\n socket.onopen = (e) => {\n logger.trace('onOpen')\n recognizerContext.websocketCallback(e)\n }\n\n socket.onclose = (e) => {\n logger.trace('onClose', new Date() - socket.start)\n recognizerContext.websocketCallback(e)\n }\n\n socket.onerror = (e) => {\n logger.trace('onError')\n recognizerContext.websocketCallback(e)\n }\n\n socket.onmessage = (e) => {\n logger.trace('onMessage')\n socket.pingLostCount = 0\n const parsedMessage = JSON.parse(e.data)\n if (parsedMessage.type !== 'pong') {\n const callBackParam = {\n type: e.type,\n data: JSON.parse(e.data)\n }\n recognizerContext.websocketCallback(callBackParam)\n }\n }\n\n return socket\n}\n\n/**\n * Send data message\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Object} message Data message\n */\nexport function send (recognizerContext, message) {\n const recognizerContextRef = recognizerContext\n recognizerContextRef.idle = false\n\n const websocket = recognizerContextRef.websocket\n if (websocket.readyState === 1) {\n websocket.send(JSON.stringify(message))\n logger.debug(`${message.type} message sent`, message)\n } else {\n throw RecognizerContext.LOST_CONNEXION_MESSAGE\n }\n}\n\n/**\n * Close the websocket\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Number} code Exit code\n * @param {String} reason Exit reason\n */\nexport function close (recognizerContext, code, reason) {\n const websocket = recognizerContext.websocket\n if (websocket && websocket.readyState < 2) {\n websocket.close(code, reason)\n }\n}\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as CryptoHelper from '../CryptoHelper'\nimport * as NetworkWSInterface from './networkWSInterface'\n\nimport {\n buildNewContentPackageInput,\n buildRestoreIInkSessionInput,\n buildNewContentPart,\n buildOpenContentPart,\n buildConfiguration\n} from './iinkWsRecognizer'\n\n/**\n * A websocket dialog have this sequence :\n * ---------- Client ------------------------------------- Server ----------------------------------\n * init (send the new content package) ================>\n * <=========== hmacChallenge\n * answerToHmacChallenge (send the hmac) =========>\n * newPart (send the parameters ) ===============>\n * <=========== update\n * addStrokes (send the strokes ) ============>\n * <=========== update\n */\n\nfunction buildHmacMessage (configuration, message) {\n return {\n type: 'hmac',\n hmac: CryptoHelper.computeHmac(message.data.hmacChallenge, configuration.recognitionParams.server.applicationKey, configuration.recognitionParams.server.hmacKey)\n }\n}\n\n/**\n * This function bind the right behaviour when a message is receive by the websocket.\n * @param {DestructuredPromise} destructuredPromise\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @return {function} Callback to handle WebSocket results\n */\nexport function buildWebSocketCallback (recognizerContext) {\n return (message) => {\n const recognizerContextRef = recognizerContext\n // Handle websocket messages\n logger.trace(`${message.type} websocket callback`, message)\n const recognitionContext = recognizerContext.recognitionContexts[recognizerContext.recognitionContexts.length - 1]\n logger.debug('Current recognition context', recognitionContext)\n\n switch (message.type) {\n case 'open':\n if (recognizerContext.sessionId) {\n NetworkWSInterface.send(recognizerContext, buildRestoreIInkSessionInput(recognizerContext.editor.configuration, recognizerContext.editor.domElement, recognizerContext.sessionId))\n } else {\n NetworkWSInterface.send(recognizerContext, buildNewContentPackageInput(recognizerContext.editor.configuration, recognizerContext.editor.domElement))\n }\n break\n case 'message':\n logger.debug(`Receiving ${message.data.type} message`, message)\n switch (message.data.type) {\n case 'ack':\n if (message.data.hmacChallenge) {\n NetworkWSInterface.send(recognizerContext, buildHmacMessage(recognizerContext.editor.configuration, message))\n }\n if (message.data.iinkSessionId) {\n recognizerContextRef.sessionId = message.data.iinkSessionId\n }\n break\n case 'newPart':\n break\n case 'contentPackageDescription':\n recognizerContextRef.currentReconnectionCount = 0\n recognizerContextRef.contentPartCount = message.data.contentPartCount\n NetworkWSInterface.send(recognizerContext, buildConfiguration(recognizerContext.editor.configuration))\n if (recognizerContextRef.currentPartId) { // FIXME: Ugly hack to resolve init promise after opening part\n NetworkWSInterface.send(recognizerContext, buildOpenContentPart(recognizerContext.editor.configuration, recognizerContext.currentPartId))\n } else {\n NetworkWSInterface.send(recognizerContext, buildNewContentPart(recognizerContext.editor.configuration))\n }\n break\n case 'partChanged':\n if (message.data.partId) {\n recognizerContextRef.currentPartId = message.data.partId\n }\n recognizerContextRef.initialized = true\n if (recognitionContext.partChange) {\n recognitionContext.partChange.resolve([undefined, message.data])\n } else {\n recognitionContext.error(message)\n }\n break\n case 'contentChanged':\n if (message.data.canUndo !== undefined) {\n recognizerContextRef.canUndo = message.data.canUndo\n }\n if (message.data.canRedo !== undefined) {\n recognizerContextRef.canRedo = message.data.canRedo\n }\n if (message.data.empty !== undefined) {\n recognizerContextRef.isEmpty = message.data.empty\n }\n if (message.data.possibleUndoCount !== undefined) {\n recognizerContextRef.possibleUndoCount = message.data.possibleUndoCount\n }\n if (message.data.undoStackIndex !== undefined) {\n recognizerContextRef.undoStackIndex = message.data.undoStackIndex\n }\n recognitionContext.contentChange.resolve([undefined, message.data])\n break\n case 'exported':\n recognitionContext.response(undefined, message.data)\n break\n case 'svgPatch':\n recognitionContext.patch(undefined, message.data)\n break\n case 'supportedImportMimeTypes':\n recognizerContextRef.supportedImportMimeTypes = message.data.mimeTypes\n recognitionContext.response(undefined, message.data)\n break\n case 'fileChunkAck':\n recognitionContext.response(undefined, message.data)\n break\n case 'idle':\n recognizerContextRef.idle = true\n recognitionContext.patch(undefined, message.data)\n break\n case 'error':\n logger.debug('Error detected stopping all recognition', message)\n if (recognitionContext) {\n let func = () => {}\n if (recognitionContext.patch) {\n func = recognitionContext.patch\n } else if (recognitionContext.response) {\n func = recognitionContext.response\n }\n func(message.data)\n } else {\n recognitionContext.initPromise.reject(Object.assign({}, message.data, { recoverable: false }))\n }\n break\n default :\n logger.warn('This is something unexpected in current recognizer. Not the type of message we should have here.', message)\n }\n break\n case 'error':\n logger.debug('Error detected stopping all recognition', message)\n if (recognitionContext) {\n let func = () => {}\n if (recognitionContext.patch) {\n func = recognitionContext.patch\n } else if (recognitionContext.response) {\n func = recognitionContext.response\n }\n func(Object.assign({}, message, { recoverable: false }))\n } else {\n recognitionContext.initPromise.reject(Object.assign({}, message, { recoverable: false }))\n }\n break\n case 'close':\n logger.debug('Close detected stopping all recognition', message)\n recognizerContextRef.initialized = false\n if (message.reason === 'CLOSE_RECOGNIZER') {\n recognitionContext.initPromise.resolve(message)\n } else {\n if (recognitionContext) {\n recognitionContext.error(message)\n } else {\n recognitionContext.initPromise.reject(message)\n }\n }\n break\n default :\n logger.warn('This is something unexpected in current recognizer. Not the type of message we should have here.', message)\n }\n }\n}\n","import { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport * as NetworkWSInterface from './networkWSInterface'\nimport * as PromiseHelper from '../../util/PromiseHelper'\nimport * as InkModel from '../../model/InkModel'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport {\n responseCallback,\n setTheme,\n setPenStyle,\n setPenStyleClasses\n} from './iinkWsRecognizer'\n\nfunction buildUrl (configuration, suffixUrl) {\n const scheme = (configuration.recognitionParams.server.scheme === 'https') ? 'wss' : 'ws'\n return `${scheme}://${configuration.recognitionParams.server.host}${suffixUrl}`\n}\n\n/**\n * Build websocket function\n * @typedef {function} BuildWebSocketFunction\n * @param {DestructuredPromise} destructuredPromise\n * @param {RecognizerContext} recognizerContext\n * @return {Callback}\n */\n\n/**\n * Init the websocket recognizer.\n * Open the connexion and proceed to the hmac challenge.\n * @param {String} suffixUrl\n * @param {RecognizerContext} recognizerContext\n * @param {BuildWebSocketFunction} buildWebSocketCallback\n * @param {function} reconnect\n * @return {Promise} Fulfilled when the init phase is over.\n */\nexport function init (suffixUrl, recognizerContext, buildWebSocketCallback, reconnect) {\n const recognitionContext = recognizerContext.recognitionContexts[0]\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, recognitionContext.model.lastPositions)\n recognizerContextReference.url = buildUrl(recognizerContext.editor.configuration, suffixUrl)\n recognizerContextReference.reconnect = reconnect\n\n recognizerContextReference.initPromise = recognitionContext.initPromise.promise\n\n logger.debug('Opening the websocket for context ', recognizerContext)\n recognizerContextReference.websocketCallback = buildWebSocketCallback(recognizerContextReference)\n recognizerContextReference.websocket = NetworkWSInterface.openWebSocket(recognizerContextReference)\n return recognizerContextReference.initPromise\n}\n\nexport async function retry (func, recognizerContext, model, buildFunc, ...params) {\n if (RecognizerContext.shouldAttemptImmediateReconnect(recognizerContext) && recognizerContext.reconnect) {\n logger.info('Attempting a retry', recognizerContext.currentReconnectionCount)\n await recognizerContext.reconnect(recognizerContext, model)\n .catch((err) => {\n logger.error('Failed retry', err)\n retry(func, recognizerContext, model, buildFunc, ...params)\n })\n setTheme(recognizerContext, model, recognizerContext.editor.theme)\n setPenStyle(recognizerContext, model, recognizerContext.editor.penStyle)\n setPenStyleClasses(recognizerContext, model, recognizerContext.editor.penStyleClasses)\n\n return func(recognizerContext, model, buildFunc, ...params)\n } else {\n responseCallback(model, 'Unable to reconnect')\n }\n}\n\n/**\n * @param {RecognizerContext} recognizerContext\n * @param {function} buildMessage\n * @param {...Object} params\n * @return {Promise}\n */\nexport function sendMessage (recognizerContext, buildMessage, ...params) {\n return recognizerContext.initPromise\n .then(() => {\n logger.trace('Init was done. Sending message')\n const message = buildMessage(...params)\n if (message) {\n NetworkWSInterface.send(recognizerContext, message)\n const positions = recognizerContext.recognitionContexts[0].model.lastPositions\n if (positions) {\n RecognizerContext.updateRecognitionPositions(recognizerContext, positions)\n }\n } else {\n logger.warn('empty message')\n }\n })\n}\n\n/**\n * Do what is needed to clean the server context.\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n * @param {RecognizerCallback} callback\n */\nexport function clear (recognizerContext, model, callback) {\n const modelRef = InkModel.clearModel(model)\n const recognizerContextReference = RecognizerContext.updateRecognitionPositions(recognizerContext, modelRef.lastPositions)\n if (recognizerContextReference && recognizerContextReference.websocket) {\n // We have to send again all strokes after a clear.\n delete recognizerContextReference.instanceId\n try {\n NetworkWSInterface.send(recognizerContextReference, { type: 'reset' })\n } catch (sendFailedException) {\n // To force failure without breaking the flow\n // FIXME not working at all\n recognizerContextReference.websocketCallback(PromiseHelper.destructurePromise(), recognizerContextReference, model)\n }\n }\n // We do not keep track of the success of clear.\n callback(undefined, modelRef)\n}\n\n/**\n * Close and free all resources that will no longer be used by the recognizer.\n * @param {RecognizerContext} recognizerContext\n * @param {Model} model\n */\nexport function close (recognizerContext, model) {\n const initPromise = PromiseHelper.destructurePromise()\n const recognizerContextRef = recognizerContext\n const recognitionContext = {\n model,\n initPromise,\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n }\n\n return recognizerContext.initPromise\n .then(() => {\n recognizerContextRef.recognitionContexts[0] = recognitionContext\n return recognizerContextRef\n })\n .then((context) => {\n NetworkWSInterface.close(context, 1000, RecognizerContext.CLOSE_RECOGNIZER_MESSAGE)\n return recognitionContext.model\n })\n}\n","import uuid from 'uuid-js'\nimport { recognizerLogger as logger } from '../../configuration/LoggerConfig'\nimport Constants from '../../configuration/Constants'\nimport * as DefaultTheme from '../../configuration/DefaultTheme'\nimport * as DefaultPenStyle from '../../configuration/DefaultPenStyle'\nimport * as InkModel from '../../model/InkModel'\nimport * as RecognizerContext from '../../model/RecognizerContext'\nimport * as DefaultRecognizer from '../DefaultRecognizer'\nimport * as WsBuilder from './WsBuilder'\nimport * as WsRecognizerUtil from './WsRecognizerUtil'\nimport * as PromiseHelper from '../../util/PromiseHelper'\nimport { handleError, handleSuccess } from '../RecognizerService'\n\nexport { close } from './WsRecognizerUtil'\n\nfunction readBlob (blob) {\n const fileReader = new FileReader()\n return new Promise((resolve, reject) => {\n fileReader.onload = event => resolve(event.target.result)\n fileReader.onerror = () => reject(new Error(this))\n fileReader.readAsText(blob)\n })\n}\n\nfunction getDPI (element) {\n // const startDpi = 56;\n // for (let dpi = startDpi; dpi < 2000; dpi++) {\n // if (window.matchMedia(`(max-resolution: ${dpi}dpi)`).matches === true) {\n // return dpi;\n // }\n // }\n // return startDpi;\n return 96\n}\n\n/**\n * Recognizer configuration\n * @type {RecognizerInfo}\n */\nexport const IinkWsConfiguration = {\n types: [Constants.RecognitionType.MATH, Constants.RecognitionType.TEXT, Constants.RecognitionType.DIAGRAM, Constants.RecognitionType.NEBO],\n protocol: Constants.Protocol.WEBSOCKET,\n availableTriggers: {\n exportContent: [Constants.Trigger.POINTER_UP, Constants.Trigger.DEMAND],\n addStrokes: [Constants.Trigger.POINTER_UP]\n }\n}\n\n/**\n * Get the configuration supported by this recognizer\n * @return {RecognizerInfo}\n */\nexport function getInfo () {\n return IinkWsConfiguration\n}\n\nexport function buildNewContentPackageInput (configuration, element) {\n return {\n type: 'newContentPackage',\n applicationKey: configuration.recognitionParams.server.applicationKey,\n xDpi: getDPI(element),\n yDpi: getDPI(element),\n viewSizeHeight: element.clientHeight < configuration.renderingParams.minHeight ? configuration.renderingParams.minHeight : element.clientHeight,\n viewSizeWidth: element.clientWidth < configuration.renderingParams.minWidth ? configuration.renderingParams.minWidth : element.clientWidth\n }\n}\n\nexport function buildRestoreIInkSessionInput (configuration, element, sessionId) {\n return {\n type: 'restoreIInkSession',\n iinkSessionId: sessionId,\n applicationKey: configuration.recognitionParams.server.applicationKey,\n xDpi: getDPI(element),\n yDpi: getDPI(element),\n viewSizeHeight: element.clientHeight < configuration.renderingParams.minHeight ? configuration.renderingParams.minHeight : element.clientHeight,\n viewSizeWidth: element.clientWidth < configuration.renderingParams.minWidth ? configuration.renderingParams.minWidth : element.clientWidth\n }\n}\n\nexport function buildNewContentPart (configuration) {\n return {\n type: 'newContentPart',\n contentType: configuration.recognitionParams.type,\n mimeTypes: (configuration.triggers.exportContent !== Constants.Trigger.DEMAND)\n ? configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes : undefined\n }\n}\n\nexport function buildOpenContentPart (configuration, partId) {\n return {\n type: 'openContentPart',\n id: partId,\n mimeTypes: (configuration.triggers.exportContent !== Constants.Trigger.DEMAND)\n ? configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes : undefined\n }\n}\n\nexport function buildConfiguration (configuration) {\n return Object.assign({ type: 'configuration' }, configuration.recognitionParams.iink)\n}\n\nfunction buildAddStrokes (recognizerContext, model) {\n const strokes = InkModel.extractPendingStrokes(model, recognizerContext.lastPositions.lastSentPosition + 1)\n if (strokes.length > 0) {\n InkModel.updateModelSentPosition(model)\n return {\n type: 'addStrokes',\n strokes: strokes.map(stroke => Object.assign({}, {\n id: stroke.id,\n pointerType: stroke.pointerType,\n pointerId: stroke.pointerId,\n x: stroke.x,\n y: stroke.y,\n t: stroke.t,\n p: stroke.p\n }))\n }\n }\n return undefined\n}\n\nfunction buildUndo () {\n return {\n type: 'undo'\n }\n}\n\nfunction buildRedo () {\n return {\n type: 'redo'\n }\n}\n\nfunction buildClear () {\n return {\n type: 'clear'\n }\n}\n\nfunction buildConvert (state) {\n return {\n type: 'convert',\n conversionState: state\n }\n}\n\nfunction buildZoom (value) {\n return {\n type: 'zoom',\n zoom: value\n }\n}\n\nfunction buildResize (element, minHeight = 0, minWidth = 0) {\n return {\n type: 'changeViewSize',\n height: element.clientHeight < minHeight ? minHeight : element.clientHeight,\n width: element.clientWidth < minWidth ? minWidth : element.clientWidth\n }\n}\n\nfunction buildExport (configuration, partId, requestedMimeType) {\n let usedMimeType\n if (requestedMimeType && Object.keys(requestedMimeType).length !== 0) {\n usedMimeType = requestedMimeType\n } else {\n usedMimeType = configuration.recognitionParams.iink[`${configuration.recognitionParams.type.toLowerCase()}`].mimeTypes\n }\n\n return {\n type: 'export',\n partId,\n mimeTypes: usedMimeType\n }\n}\n\nfunction buildImportFile (id, mimetype) {\n return {\n type: 'importFile',\n importFileId: id,\n mimeType: mimetype\n }\n}\n\nfunction buildImportChunk (id, data, lastChunk) {\n return {\n type: 'fileChunk',\n importFileId: id,\n data,\n lastChunk\n }\n}\n\nfunction buildPointerEvents (events) {\n return Object.assign({ type: 'pointerEvents' }, events)\n}\n\nfunction buildWaitForIdle () {\n return {\n type: 'waitForIdle'\n }\n}\n\nfunction buildGetSupportedImportMimeTypes () {\n return {\n type: 'getSupportedImportMimeTypes'\n }\n}\n\nexport function buildSetPenStyle (penStyle) {\n return {\n type: 'setPenStyle',\n style: penStyle ? DefaultPenStyle.toCSS(penStyle) : ''\n }\n}\n\nexport function buildSetPenStyleClasses (penStyleClasses) {\n return {\n type: 'setPenStyleClasses',\n styleClasses: penStyleClasses\n }\n}\n\nexport function buildSetTheme (theme) {\n return {\n type: 'setTheme',\n theme: DefaultTheme.toCSS(theme)\n }\n}\n\nexport const responseCallback = (model, err, res, recognizerContext) => {\n const modelReference = InkModel.updateModelReceivedPosition(model)\n if (res) {\n let event = ''\n if (res.updates !== undefined) {\n if (modelReference.recognizedSymbols) {\n modelReference.recognizedSymbols.push(res)\n } else {\n modelReference.recognizedSymbols = [res]\n }\n event = Constants.EventType.RENDERED\n }\n if (res.exports !== undefined) {\n modelReference.rawResults.exports = res\n modelReference.exports = res.exports\n event = Constants.EventType.EXPORTED\n }\n\n if ((res.canUndo !== undefined) || (res.canRedo !== undefined)) {\n event = Constants.EventType.CHANGED\n }\n\n if (res.type === 'supportedImportMimeTypes') {\n event = Constants.EventType.SUPPORTED_IMPORT_MIMETYPES\n }\n\n if (res.type === 'partChanged') {\n event = Constants.EventType.LOADED\n }\n\n if (res.type === 'idle') {\n event = Constants.EventType.IDLE\n }\n\n if (res.type === 'close') {\n event = Constants.EventType.CHANGED\n }\n return handleSuccess(recognizerContext.editor, model, event)\n }\n return handleError(recognizerContext.editor, err)\n}\n\n/**\n * Initialize recognition\n * The init process is in multiple part :\n * - partChange\n * - contentChange\n * - initPromise: resolved only if partChange & contentChange resolved except for MATH recognition\n *\n * @param {RecognizerContext} recognizerContext Current recognizer context\n * @param {Model} model Current model\n */\nexport async function init (recognizerContext, model) {\n const contentChange = PromiseHelper.destructurePromise()\n const partChange = PromiseHelper.destructurePromise()\n const initPromise = PromiseHelper.destructurePromise()\n\n let recognizerContextRef\n let contentChanged = null\n\n if (recognizerContext.editor.innerConfiguration.recognitionParams.type === 'MATH' ||\n recognizerContext.editor.innerConfiguration.recognitionParams.type === 'DIAGRAM') {\n recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model: InkModel.updateModelSentPosition(model, model.lastPositions.lastReceivedPosition),\n partChange,\n initPromise,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n } else {\n recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model: InkModel.updateModelSentPosition(model, model.lastPositions.lastReceivedPosition),\n contentChange,\n partChange,\n response: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n initPromise,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n contentChanged = recognizerContextRef.recognitionContexts[0].contentChange.promise\n }\n\n WsRecognizerUtil.init('/api/v4.0/iink/document', recognizerContextRef, WsBuilder.buildWebSocketCallback, init)\n .catch(async (err) => {\n if (RecognizerContext.shouldAttemptImmediateReconnect(recognizerContext) && recognizerContext.reconnect) {\n logger.info('Attempting a reconnect', recognizerContext.currentReconnectionCount)\n await recognizerContext.reconnect(recognizerContext, model)\n } else {\n logger.error('Unable to reconnect', err)\n responseCallback(model, err, undefined, recognizerContext)\n }\n })\n\n const [errPartChanged, resPartChanged] = await recognizerContextRef.recognitionContexts[0].partChange.promise\n if (resPartChanged) {\n responseCallback(model, errPartChanged, resPartChanged, recognizerContext)\n if (contentChanged !== null) {\n const [errContentChanged, resContentChanged] = await contentChanged\n if (resContentChanged) {\n responseCallback(model, errContentChanged, resContentChanged, recognizerContext)\n }\n }\n recognizerContextRef.recognitionContexts[0].initPromise.resolve(true)\n }\n\n return recognizerContextRef.recognitionContexts[0].initPromise\n}\n\n/**\n *\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Function} buildFunction build the websocket message\n * @param {...Object} params spread parameters, will be passed to buildFunction\n * @private\n */\n// eslint-disable-next-line no-underscore-dangle\nasync function _prepareMessage (recognizerContext, model, buildFunction, ...params) {\n logger.info(`-- Prepare message for ${buildFunction.name} --`)\n const contentChange = PromiseHelper.destructurePromise()\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model,\n response: (err, res) => {\n const onDemand = recognizerContext.editor.configuration.triggers.exportContent === Constants.Trigger.DEMAND\n if (!onDemand || (onDemand && buildFunction.name === 'buildExport')) {\n responseCallback(model, err, res, recognizerContextRef)\n }\n },\n contentChange,\n patch: (err, res) => responseCallback(model, err, res, recognizerContextRef),\n error: (err, res) => responseCallback(model, err, res, recognizerContextRef)\n })\n WsRecognizerUtil.sendMessage(recognizerContextRef, buildFunction, ...params)\n .catch((err) => {\n logger.error(err)\n WsRecognizerUtil.retry(_prepareMessage, recognizerContext, model, buildFunction, ...params)\n })\n\n const contentChanged = await recognizerContextRef.recognitionContexts[0].contentChange.promise\n\n if (contentChanged) {\n responseCallback(model, contentChanged[0], contentChanged[1], recognizerContextRef)\n return {\n res: model,\n types: []\n }\n }\n\n return null\n}\n\n/**\n * Create a new content part\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function newContentPart (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildNewContentPart, recognizerContext.editor.configuration)\n}\n\n/**\n * Open the recognizer context content part\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function openContentPart (recognizerContext, model) {\n const params = [recognizerContext.editor.configuration, recognizerContext.currentPartId]\n return _prepareMessage(recognizerContext, model, buildOpenContentPart, params)\n}\n\n/**\n * Send the recognizer configuration\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function sendConfiguration (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildConfiguration, recognizerContext.editor.configuration)\n}\n\n/**\n * Pointer Events\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {PointerEvents} events to be imported\n */\nexport function pointerEvents (recognizerContext, model, events) {\n return _prepareMessage(recognizerContext, model, buildPointerEvents, events)\n}\n\n/**\n * Add strokes to the model\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function addStrokes (recognizerContext, model) {\n const params = [recognizerContext, model]\n return _prepareMessage(recognizerContext, model, buildAddStrokes, ...params)\n}\n\n/**\n * Undo last action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function undo (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildUndo)\n}\n\n/**\n * Redo last action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function redo (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildRedo)\n}\n\n/**\n * Clear action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport async function clear (recognizerContext, model) {\n const contentChange = PromiseHelper.destructurePromise()\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, {\n model,\n response: (err, res) => {\n if (recognizerContext.editor.configuration.triggers.exportContent !== Constants.Trigger.DEMAND) {\n responseCallback(model, err, res, recognizerContextRef)\n }\n },\n contentChange,\n // eslint-disable-next-line handle-callback-err\n patch: async (error, result) => {\n const { err, res } = await DefaultRecognizer.clear(recognizerContext, model)\n responseCallback(res, err, result, recognizerContextRef)\n }\n })\n WsRecognizerUtil.sendMessage(recognizerContextRef, buildClear)\n .catch(exception => WsRecognizerUtil.retry(clear, recognizerContext, model))\n\n const contentChanged = await recognizerContextRef.recognitionContexts[0].contentChange.promise\n\n if (contentChanged) {\n responseCallback(model, contentChanged[0], contentChanged[1], recognizerContextRef)\n return {\n err: undefined,\n res: recognizerContextRef.recognitionContexts[0].model,\n events: []\n }\n }\n\n return null\n}\n\n/**\n * Convert action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {String} conversionState Conversion State, by default DigitalEdit\n */\nexport function convert (recognizerContext, model, conversionState) {\n return _prepareMessage(recognizerContext, model, buildConvert, conversionState)\n}\n\n/**\n * Export action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Array} requestedMimeTypes\n */\n// eslint-disable-next-line no-underscore-dangle\nexport function export_ (recognizerContext, model, requestedMimeTypes) {\n const params = [recognizerContext.editor.configuration, recognizerContext.currentPartId, requestedMimeTypes]\n return _prepareMessage(recognizerContext, model, buildExport, ...params)\n}\n\n/**\n * Import action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Blob} data Import data\n */\n// eslint-disable-next-line no-underscore-dangle\nexport function import_ (recognizerContext, model, data) {\n const recognitionContext = {\n model,\n response: (err, res) => responseCallback(model, err, res, recognizerContext),\n importFileId: uuid.create(4).toString()\n }\n const recognizerContextRef = RecognizerContext.setRecognitionContext(recognizerContext, recognitionContext)\n\n const chunkSize = recognizerContext.editor.configuration.recognitionParams.server.websocket.fileChunkSize\n\n const messages = []\n for (let i = 0; i < data.size; i += chunkSize) {\n if (i === 0) {\n messages.push(_prepareMessage(recognizerContextRef, model, buildImportFile, recognitionContext.importFileId, data.type))\n }\n const blobPart = data.slice(i, chunkSize, data.type)\n readBlob(blobPart).then((res) => {\n const params = [recognitionContext.importFileId, res, i + chunkSize > data.size]\n messages.push(_prepareMessage(recognizerContextRef, model, buildImportChunk, ...params))\n })\n }\n\n return Promise.all(messages)\n}\n\n/**\n * Ask for the supported mimetypes\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function getSupportedImportMimeTypes (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildGetSupportedImportMimeTypes)\n}\n\n/**\n * WaitForIdle action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n */\nexport function waitForIdle (recognizerContext, model) {\n return _prepareMessage(recognizerContext, model, buildWaitForIdle)\n}\n\n/**\n * Resize\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Element} element Current element\n */\nexport function resize (recognizerContext, model, element) {\n const params = [element, recognizerContext.editor.configuration.renderingParams.minHeight, recognizerContext.editor.configuration.renderingParams.minWidth]\n return _prepareMessage(recognizerContext, model, buildResize, ...params)\n}\n\n/**\n * Zoom action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Number} value=10 Zoom value\n */\nexport function zoom (recognizerContext, model, value = 10) {\n return _prepareMessage(recognizerContext, model, buildZoom, value)\n}\n\n/**\n * SetPenStyle action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {PenStyle} penStyle Current penStyle\n */\nexport function setPenStyle (recognizerContext, model, penStyle) {\n return _prepareMessage(recognizerContext, model, buildSetPenStyle, penStyle)\n}\n\n/**\n * setPenStyleClasses action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {String} penStyleClasses Current penStyleClasses\n */\nexport function setPenStyleClasses (recognizerContext, model, penStyleClasses) {\n return _prepareMessage(recognizerContext, model, buildSetPenStyleClasses, penStyleClasses)\n}\n\n/**\n * SetTheme action\n * @param {RecognizerContext} recognizerContext Current recognition context\n * @param {Model} model Current model\n * @param {Theme} theme Current theme\n */\nexport function setTheme (recognizerContext, model, theme) {\n return _prepareMessage(recognizerContext, model, buildSetTheme, theme)\n}\n","import { eventLogger as logger } from '../configuration/LoggerConfig'\n\n/**\n * Emits an event when the editor state change\n * @param {String} type\n * @param {Object} data\n * @emits {Event}\n */\nexport default function emit (type, data) {\n logger.info(`emitting ${type} event`, data)\n // We are making usage of a browser provided class\n // eslint-disable-next-line no-undef\n this.dispatchEvent(new CustomEvent(type, Object.assign({ bubbles: true, composed: true }, data ? { detail: data } : undefined)))\n}\n","import { editorLogger as logger } from './configuration/LoggerConfig'\nimport { Editor } from './Editor'\n\n/**\n * Attach an Editor to a DOMElement\n * @param {Element} element DOM element to attach an editor\n * @param {Configuration} [configuration] Configuration to apply\n * @param {PenStyle} [penStyle] Pen style to apply\n * @param {Theme} [theme] Theme to apply\n * @param {Behaviors} [behaviors] Custom behaviors to apply\n * @param {String} [globalClassCSS] Replace global class css 'ms-editor' to customize style\n * @return {Editor} New editor\n */\nexport function register (element, configuration, penStyle, theme, behaviors, globalClassCSS) {\n logger.debug('Registering a new editor')\n return new Editor(element, configuration, penStyle, theme, behaviors, globalClassCSS)\n}\n\n/**\n * Return the list of available recognition languages\n * @param {Configuration} [configuration] Configuration to get the languages\n * @return {JSON} A list of available languages\n */\nexport async function getAvailableLanguageList (configuration) {\n try {\n if (configuration && configuration.recognitionParams &&\n configuration.recognitionParams.server && configuration.recognitionParams.server.host) {\n const serverConfig = configuration.recognitionParams.server\n const response = await fetch(`${serverConfig.scheme}://${serverConfig.host}/api/v4.0/iink/availableLanguageList`)\n if (response && response.ok) {\n return response.json()\n }\n } else {\n console.error('Cannot get languages ! Please check your configuration!')\n }\n } catch (error) {\n console.error(error)\n }\n}\n","import Constants from './configuration/Constants'\nimport LoggerConfig from './configuration/LoggerConfig'\nimport DefaultConfiguration from './configuration/DefaultConfiguration'\nimport DefaultPenStyle from './configuration/DefaultPenStyle'\nimport DefaultTheme from './configuration/DefaultTheme'\nimport DefaultBehaviors from './configuration/DefaultBehaviors'\nimport * as InkModel from './model/InkModel'\nimport { Editor } from './Editor'\nimport { register, getAvailableLanguageList } from './EditorFacade'\nimport * as RecognizerContext from './model/RecognizerContext'\n\nconst iink = {\n Constants,\n // Default instantiations\n DefaultConfiguration,\n DefaultBehaviors,\n DefaultPenStyle,\n DefaultTheme,\n // Helper functions\n register,\n getAvailableLanguageList,\n // Internals\n LoggerConfig,\n Editor,\n InkModel,\n RecognizerContext\n}\n\nexport {\n iink as default,\n Constants,\n // Default instantiations\n DefaultConfiguration,\n DefaultBehaviors,\n DefaultPenStyle,\n DefaultTheme,\n // Helper functions\n register,\n getAvailableLanguageList,\n // Internals\n LoggerConfig,\n Editor,\n InkModel,\n RecognizerContext\n}\n"],"names":["Constants","EventType","IDLE","CHANGED","IMPORTED","EXPORTED","CONVERTED","RENDERED","LOADED","UNDO","REDO","CLEAR","IMPORT","SUPPORTED_IMPORT_MIMETYPES","EXPORT","CONVERT","ERROR","RecognitionType","TEXT","MATH","DIAGRAM","RAWCONTENT","Protocol","WEBSOCKET","REST","ModelState","INITIALIZING","INITIALIZED","EXPORTING","PENDING","MODIFIED","Trigger","QUIET_PERIOD","POINTER_UP","DEMAND","Logger","EDITOR","MODEL","GRABBER","RENDERER","RECOGNIZER","EVENT","UTIL","SMARTGUIDE","LogLevel","TRACE","DEBUG","INFO","WARN","Languages","zh_CN","zh_HK","zh_TW","ko_KR","ja_JP","Error","NOT_REACHABLE","WRONG_CREDENTIALS","TOO_OLD","NO_ACTIVITY","Exports","JIIX","log","loglevel","root","definition","module","exports","this","noop","undefinedType","isIE","window","navigator","test","userAgent","logMethods","bindMethod","obj","methodName","method","bind","Function","prototype","call","e","apply","arguments","traceForIE","console","trace","realMethod","undefined","replaceLoggingMethods","level","loggerName","i","length","methodFactory","debug","enableLoggingWhenConsoleArrives","defaultMethodFactory","name","defaultLevel","factory","currentLevel","self","storageKey","getPersistedLevel","storedLevel","localStorage","ignore","cookie","document","location","indexOf","encodeURIComponent","exec","slice","levels","SILENT","getLevel","setLevel","persist","toUpperCase","persistLevelIfPossible","levelNum","levelName","setDefaultLevel","enableAll","disableAll","initialLevel","defaultLogger","_loggersByName","getLogger","TypeError","logger","_log","noConflict","getLoggers","editorLogger","modelLogger","grabberLogger","rendererLogger","recognizerLogger","eventLogger","HASH_UNDEFINED","MAX_SAFE_INTEGER","argsTag","funcTag","objectTag","reIsHostCtor","reIsUint","typedArrayTags","freeGlobal","global","Object","freeSelf","freeExports","nodeType","freeModule","moduleExports","freeProcess","process","nodeUtil","types","require","binding","nodeIsTypedArray","isTypedArray","func","thisArg","args","uid","arrayProto","Array","funcProto","objectProto","coreJsData","funcToString","toString","hasOwnProperty","maskSrcKey","keys","IE_PROTO","nativeObjectToString","objectCtorString","reIsNative","RegExp","replace","Buffer","Symbol","Uint8Array","allocUnsafe","getPrototype","overArg","transform","arg","getPrototypeOf","objectCreate","create","propertyIsEnumerable","splice","symToStringTag","toStringTag","defineProperty","getNative","nativeIsBuffer","isBuffer","nativeMax","Math","max","nativeNow","Date","now","Map","nativeCreate","baseCreate","object","proto","isObject","result","Hash","entries","index","clear","entry","set","ListCache","MapCache","Stack","data","__data__","size","arrayLikeKeys","value","inherited","isArr","isArray","isArg","isArguments","isBuff","isType","skipIndexes","baseTimes","n","iteratee","String","key","isIndex","push","assignMergeValue","eq","baseAssignValue","assignValue","objValue","assocIndexOf","array","configurable","enumerable","writable","hashClear","hashDelete","has","get","hashGet","hashHas","hashSet","listCacheClear","listCacheDelete","pop","listCacheGet","listCacheHas","listCacheSet","mapCacheClear","hash","map","string","mapCacheDelete","getMapData","mapCacheGet","mapCacheHas","mapCacheSet","stackClear","stackDelete","stackGet","stackHas","stackSet","pairs","LARGE_ARRAY_SIZE","baseFor","createBaseFor","fromRight","keysFunc","iterable","props","baseGetTag","getRawTag","isOwn","tag","unmasked","objectToString","baseIsArguments","isObjectLike","baseIsNative","isMasked","isFunction","toSource","baseKeysIn","nativeKeysIn","isProto","isPrototype","baseMerge","source","srcIndex","customizer","stack","srcValue","baseMergeDeep","mergeFunc","safeGet","stacked","newValue","isCommon","isTyped","isArrayLikeObject","isArrayLike","cloneBuffer","buffer","isDeep","constructor","copy","cloneTypedArray","typedArray","cloneArrayBuffer","arrayBuffer","byteLength","byteOffset","copyArray","isPlainObject","Ctor","toPlainObject","copyObject","isNew","keysIn","initCloneObject","baseRest","start","setToString","overRest","otherArgs","identity","isKeyable","type","getValue","shortOut","count","lastCalled","stamp","remaining","other","isLength","stubFalse","baseUnary","baseIsTypedArray","merge","createAssigner","assigner","sources","guard","isIterateeCall","defaultConfiguration","recognitionParams","protocol","server","scheme","host","applicationKey","hmacKey","useWindowLocation","websocket","pingEnabled","pingDelay","maxPingLostCount","autoReconnect","maxRetryCount","fileChunkSize","iink","alwaysConnected","lang","jiix","strokes","text","chars","words","renderer","math","mimeTypes","solver","enable","margin","bottom","left","right","top","eraser","guides","smartGuide","smartGuideFadeOut","duration","diagram","recognition","shape","listenerOptions","capture","passive","undoRedoMaxStackSize","xyFloatPrecision","timestampFloatPrecision","triggerDelay","processDelay","resizeTriggerDelay","triggers","exportContent","addStrokes","restConversionState","renderingParams","stroker","minHeight","minWidth","t","o","r","l","m","c","d","__esModule","default","p","s","iterator","toJSON","error","u","split","forEach","trim","substring","_trimSemiColon","toCSS","defaultPenStyle","parser","JsonCSS","penStyle","css","defaultTheme","ink","color","theme","floatPrecisionArray","roundFloat","oneFloat","requestedFloatPrecision","floatPrecision","round","extractPoint","event","domElement","configuration","offsetTop","offsetLeft","eventRef","changedTouches","rect","getBoundingClientRect","x","clientX","clientLeft","y","clientY","clientTop","prevent","preventDefault","attach","element","editor","mMaxDiffX","unfocus","getSelection","removeAllRanges","hideMenu","evt","moreMenuInDocument","querySelector","target","classList","contains","style","display","hideCandidates","candidatesInDocument","tagName","pointerDownHandler","pointerDownOnEditor","id","activePointerId","pointerId","button","buttons","stopPropagation","pointerType","isErasing","pointerDown","smartGuidePointerDown","downSmartGuidePoint","pointerMoveHandler","pointerMove","point","diffX","abs","diffY","pointerUpHandler","smartGuideIds","scrollbarClasses","pointerEnteredSmartGuide","relatedTarget","includes","className","pointerExitedSmartGuide","pointerMovedWords","pointerUp","context","options","listeners","listener","item","addEventListener","documentElement","detach","removeEventListener","_arrayLikeToArray","arr","len","arr2","_arrayWithoutHoles","arrayLikeToArray","_iterableToArray","iter","from","_unsupportedIterableToArray","minLen","_nonIterableSpread","_toConsumableArray","arrayWithoutHoles","iterableToArray","unsupportedIterableToArray","nonIterableSpread","drawStroke","stroke","ShapeSymbols","table","recognizedShape","ellipse","line","phi","angle","returnedAngle","PI","drawArrowHead","headPoint","alpha","beta","contextReference","save","fillStyle","strokeStyle","moveTo","beginPath","lineTo","cos","sin","fill","restore","drawShapeEllipse","shapeEllipse","points","drawEllipseArc","centerPoint","maxRadius","minRadius","orientation","startAngle","sweepAngle","z1","z3","z2","z4","floor","boundariesPoints","atan2","cosAlpha","sinAlpha","center","beginDecoration","beginTangentAngle","endDecoration","endTangentAngle","drawLine","p1","p2","drawShapeSymbol","symbol","lineWidth","width","elementType","candidates","selectedCandidateIndex","lines","drawShapeLine","shapeLine","firstPoint","lastPoint","primitives","primitive","TextSymbols","inputCharacter","textLine","drawTextLine","drawText","label","font","textHeight","textAlign","justificationType","textBaseline","fillText","topLeftPoint","height","underlineList","underline","drawUnderline","delta","firstCharacter","lastCharacter","computeDistance","xArray","yArray","lastIndexPoint","distance","sqrt","pow","isNaN","computeLength","lArray","createStrokeComponent","properties","assign","addPoint","strokeReference","filterPointByAcquisitionDelta","ret","computePressure","ratio","pressure","parseFloat","end","slicedStroke","getPointByIndex","mergeBounds","boundsA","boundsB","minX","min","maxX","minY","maxY","getLineBounds","getEllipseBounds","getTextLineBounds","getClefBounds","clef","boundingBox","getStrokeBounds","getSymbolsBounds","symbols","bounds","Number","MAX_VALUE","MIN_VALUE","boundsRef","filter","reduce","createModel","currentStroke","rawStrokes","strokeGroups","lastPositions","lastSentPosition","lastReceivedPosition","lastRenderedPosition","defaultSymbols","recognizedSymbols","rawResults","convert","creationTime","getTime","modificationTime","clearModel","model","modelReference","needRedraw","addStroke","addStrokeToGroup","strokePenStyle","lastGroup","newStrokeGroup","strokeCopy","extractPendingStrokes","position","initPendingStroke","dpi","pxWidth","StrokeComponent","appendToPendingStroke","endPendingStroke","getBorderCoordinates","modelBounds","updateModelSentPosition","updateModelReceivedPosition","resetModelPositions","updateModelRenderedPosition","extractPendingRecognizedSymbols","cloneModel","clonedModel","JSON","parse","stringify","mergeModels","models","a","b","modelRef","extractStrokesFromInkRange","firstStroke","lastStroke","slicedStrokes","resetModelRendererPosition","detectPixelRatio","getPixelRatio","canvas","getContext","devicePixelRatio","webkitBackingStorePixelRatio","mozBackingStorePixelRatio","msBackingStorePixelRatio","oBackingStorePixelRatio","backingStorePixelRatio","createElement","createCanvas","add","appendChild","resizeContent","renderingCanvas","capturingCanvas","parentNode","clientWidth","clientHeight","pixelRatio","scale","drawSymbol","drawTextSymbol","warn","drawModel","renderingCanvasContext","clearRect","InkModel","capturingCanvasContext","getInfo","removeChild","resize","drawCurrentStroke","computeLinksPoints","radius","computeMiddlePoint","point1","point2","computeAxeAngle","begin","renderArc","arc","renderLine","linkPoints1","linkPoints2","renderQuadratic","ctrl","linkPoints3","quadraticCurveTo","nbquadratics","renderFinal","linkPoints","newAngle","closePath","xhtml","svg","xlink","xml","xmlns","prefix","namespaces","space","local","creatorInherit","ownerDocument","uri","namespaceURI","createElementNS","creatorFixed","fullname","namespace","none","selector","empty","update","EnterNode","parent","datum","_next","_parent","child","insertBefore","next","querySelectorAll","bindIndex","group","enter","exit","node","groupLength","dataLength","bindKey","keyValue","nodeByKeyValue","keyValues","ascending","NaN","attrRemove","removeAttribute","attrRemoveNS","removeAttributeNS","attrConstant","setAttribute","attrConstantNS","setAttributeNS","attrFunction","v","attrFunctionNS","defaultView","styleRemove","removeProperty","styleConstant","priority","setProperty","styleFunction","styleValue","getPropertyValue","getComputedStyle","propertyRemove","propertyConstant","propertyFunction","classArray","ClassList","_node","_names","getAttribute","classedAdd","names","list","classedRemove","remove","classedTrue","classedFalse","classedFunction","textRemove","textContent","textConstant","textFunction","htmlRemove","innerHTML","htmlConstant","htmlFunction","raise","nextSibling","lower","previousSibling","firstChild","constantNull","selection_cloneShallow","clone","cloneNode","selection_cloneDeep","join","filterEvents","mouseenter","mouseleave","filterContextListener","contextListener","related","compareDocumentPosition","event1","parseTypenames","typenames","onRemove","typename","on","__on","j","onAdd","wrap","dispatchEvent","params","CustomEvent","createEvent","initEvent","bubbles","cancelable","detail","dispatchConstant","dispatchFunction","Selection","groups","parents","_groups","_parents","insertAdjacentSVG","html","container","toLowerCase","lastChild","selection","select","subgroups","subnode","subgroup","selectAll","selectorAll","match","matches","matcher","each","constant","enterGroup","updateGroup","previous","i0","i1","_enter","_exit","sparse","onenter","onupdate","onexit","append","order","groups0","groups1","m0","m1","merges","group0","group1","sort","compare","compareNode","sortgroups","sortgroup","callback","nodes","attr","getAttributeNS","property","classed","creator","insert","before","deep","dispatch","elementRef","fontSize","d3","pendingRecognizedSymbols","patch","updateView","patchUpdate","updates","svgElementSelector","layer","insertAdjacentHTML","outerHTML","parentId","refId","pendingStrokes","symbolContext","parts","svgPath","runtime","Op","hasOwn","$Symbol","iteratorSymbol","asyncIteratorSymbol","asyncIterator","toStringTagSymbol","innerFn","outerFn","tryLocsList","protoGenerator","Generator","generator","Context","_invoke","makeInvokeMethod","state","GenStateSuspendedStart","invoke","GenStateExecuting","GenStateCompleted","doneResult","delegate","delegateResult","maybeInvokeDelegate","ContinueSentinel","sent","_sent","dispatchException","abrupt","record","tryCatch","done","GenStateSuspendedYield","fn","err","GeneratorFunction","GeneratorFunctionPrototype","IteratorPrototype","getProto","NativeIteratorPrototype","values","Gp","defineIteratorMethods","AsyncIterator","PromiseImpl","previousPromise","enqueue","callInvokeWithMethodAndArg","resolve","reject","__await","then","unwrapped","info","resultName","nextLoc","pushTryEntry","locs","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","resetTryEntry","completion","reset","iteratorMethod","displayName","isGeneratorFunction","genFun","ctor","mark","setPrototypeOf","__proto__","awrap","async","Promise","reverse","skipTempReset","prev","charAt","stop","rootRecord","rval","exception","handle","loc","caught","hasCatch","hasFinally","finallyEntry","complete","finish","catch","thrown","delegateYield","regeneratorRuntime","accidentalStrictMode","asyncGeneratorStep","gen","_throw","_asyncToGenerator","_typeof","CryptoJS","F","subtype","C","C_lib","lib","Base","extend","overrides","mixIn","init","$super","instance","propertyName","WordArray","sigBytes","encoder","Hex","concat","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","thatByte","ceil","random","nBytes","rcache","m_w","m_z","mask","_r","C_enc","enc","hexChars","bite","hexStr","hexStrLength","parseInt","substr","Latin1","latin1Chars","fromCharCode","latin1Str","latin1StrLength","charCodeAt","Utf8","decodeURIComponent","escape","utf8Str","unescape","BufferedBlockAlgorithm","_data","_nDataBytes","_append","_process","doFlush","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","_minBufferSize","nBytesReady","offset","_doProcessBlock","processedWords","C_algo","Hasher","cfg","_doReset","messageUpdate","finalize","_doFinalize","_createHelper","hasher","message","_createHmacHelper","HMAC","algo","require$$0","X32WordArray","C_x64","x64","Word","high","low","toX32","x64Words","x64WordsLength","x32Words","x64Word","wordsLength","X64Word","X64WordArray","X64Word_create","K","W","SHA512","_hash","M","H","H0","H1","H2","H3","H4","H5","H6","H7","H0h","H0l","H1h","H1l","H2h","H2l","H3h","H3l","H4h","H4l","H5h","H5l","H6h","H6l","H7h","H7l","ah","al","bh","bl","ch","cl","dh","dl","eh","el","fh","fl","gh","gl","hh","hl","Wi","Wih","Wil","gamma0x","gamma0xh","gamma0xl","gamma0h","gamma0l","gamma1x","gamma1xh","gamma1xl","gamma1h","gamma1l","Wi7","Wi7h","Wi7l","Wi16","Wi16h","Wi16l","t1l","chh","chl","majh","majl","sigma0h","sigma0l","sigma1h","sigma1l","Ki","Kih","Kil","t1h","t2l","nBitsTotal","nBitsLeft","HmacSHA512","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","computeHmac","input","jsonInput","post","recognizerContext","url","apiVersion","mimeType","recognizerContextRef","idle","headers","Headers","CryptoHelper","reqInit","credentials","body","request","Request","fetch","response","contentType","blob","json","msg","recoverable","createEmptyRecognizerContext","recognitionContexts","initPromise","websocketCallback","reconnect","currentReconnectionCount","sessionId","contentPartCount","currentPartId","instanceId","canUndo","canRedo","isEmpty","supportedImportMimeTypes","undoStackIndex","possibleUndoCount","initialized","isResetRequired","updateRecognitionPositions","positions","setRecognitionContext","recognitionContext","canReconnect","shouldAttemptImmediateReconnect","LOST_CONNEXION_MESSAGE","CLOSE_RECOGNIZER_MESSAGE","val","div","elMatches","Element","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","query","queryChildren","children","cls","thumb","rail","consuming","focus","clicking","active","scrolling","scrollingClassTimeout","addScrollingClass","clearTimeout","removeScrollingClass","setTimeout","isAlive","settings","scrollingThreshold","EventElement","handlers","prototypeAccessors","eventName","handler","unbind","this$1","unbindAll","every","defineProperties","EventManager","eventElements","initCustomEvent","processScrollDiff","axis","diff","useScrollingClass","forceFireReachEvent","fields","processScrollDiff$1","ref","contentHeight","containerHeight","scrollTop","up","down","reach","setScrollingClassInstantly","toInt","eventElement","ee","once","onceHandler","env","isWebKit","supportsTouch","maxTouchPoints","DocumentTouch","supportsIePointer","msMaxTouchPoints","isChrome","updateGeometry","roundedScrollTop","containerWidth","contentWidth","scrollWidth","scrollHeight","scrollbarXRail","scrollbarYRail","suppressScrollX","scrollXMarginOffset","scrollbarXActive","railXWidth","railXMarginWidth","railXRatio","scrollbarXWidth","getThumbSize","scrollbarXLeft","negativeScrollAdjustment","scrollLeft","suppressScrollY","scrollYMarginOffset","scrollbarYActive","railYHeight","railYMarginHeight","railYRatio","scrollbarYHeight","scrollbarYTop","updateCss","xRailOffset","isRtl","isScrollbarXUsingBottom","scrollbarXBottom","scrollbarXTop","yRailOffset","isScrollbarYUsingRight","scrollbarYRight","scrollbarYOuterWidth","scrollbarYLeft","scrollbarX","railBorderXWidth","scrollbarY","railBorderYWidth","thumbSize","minScrollbarLength","maxScrollbarLength","bindMouseScrollHandler","pageY","startingScrollTop","startingMousePageY","scrollBy","mouseMoveHandler","touches","mouseUpHandler","bindMoves","touchMode","click-rail","clickRail","direction","pageYOffset","pageX","pageXOffset","drag-thumb","dragThumb","keyboard","isDefaultPrevented","defaultPrevented","activeElement","contentDocument","shadowRoot","isEditable","deltaX","deltaY","which","metaKey","altKey","shiftKey","shouldPreventDefault","wheelPropagation","wheel","mousewheelHandler","getDeltaFromEvent","wheelDeltaX","wheelDeltaY","deltaMode","wheelDelta","shouldBeConsumedByChild","cursor","overflowY","maxScrollTop","overflowX","maxScrollLeft","shouldPrevent","useBothWheelAxes","wheelSpeed","isTop","isBottom","offsetHeight","isLeft","isRight","offsetWidth","ctrlKey","onwheel","onmousewheel","touch","startOffset","startTime","speed","easingLoop","touchStart","touchMove","touchEnd","PointerEvent","MSPointerEvent","applyTouchMove","differenceX","differenceY","getTouch","targetTouches","shouldHandle","MSPOINTER_TYPE_MOUSE","clearInterval","currentOffset","currentTime","timeGap","magnitudeX","magnitudeY","scrollY","swipeEasing","setInterval","isInitialized","PerfectScrollbar","userSettings","nodeName","originalScrollLeft","blur","isNegativeScroll","railXStyle","borderLeftWidth","borderRightWidth","marginLeft","marginRight","railYStyle","outerWidth","styles","paddingLeft","paddingRight","borderTopWidth","borderBottomWidth","marginTop","marginBottom","handlerName","lastScrollTop","lastScrollLeft","onScroll","destroy","removePsClasses","selectedText","isReadOnly","hasAttribute","setSelectionRange","range","createRange","selectNodeContents","addRange","_select","_select2","_interopRequireDefault","_classCallCheck","Constructor","_createClass","descriptor","protoProps","staticProps","ClipboardAction","resolveOptions","initSelection","action","emitter","trigger","selectFake","selectTarget","_this","isRTL","removeFake","fakeHandlerCallback","fakeHandler","fakeElem","border","padding","yPosition","copyText","succeeded","execCommand","handleResult","emit","clearSelection","_action","_target","E","ctx","off","_","evtArr","evts","liveEvents","HTMLElement","matchesSelector","oMatchesSelector","closest","delegateTarget","useCapture","listenerFn","listen","is","listenNode","nodeList","listenNodeList","listenSelector","_clipboardAction","_tinyEmitter","_goodListener","_clipboardAction2","_tinyEmitter2","_goodListener2","_possibleConstructorReturn","ReferenceError","_inherits","subClass","superClass","Clipboard","_Emitter","listenClick","defaultAction","defaultTarget","defaultText","_this2","onClick","currentTarget","clipboardAction","getAttributeValue","isSupported","actions","support","queryCommandSupported","suffix","attribute","require$$1","require$$2","isInShadow","addListeners","elementsRef","elements","textElement","showCandidates","smartGuideRef","randomString","wordToChange","candidatesElement","word","clickCandidate","candidate","innerText","jiixToImport","import_","ellipsisElement","showActions","positionActions","menuElement","isMenuInDocument","insertActions","convertElement","copyElement","deleteElement","createSmartGuide","createHTMLElements","smartGuideElement","textContainer","tagElement","lastWord","previousLabelExport","perfectScrollbar","smartGuideTimeOutId","callFadeOutObserver","MutationObserver","mutations","observe","childList","subtree","attributes","maxWidthTextContainer","maxWidth","launchSmartGuide","isSmartGuideInDocument","insertSmartGuide","mmToPixels","insertSmartGuideElement","visibility","loader","insertTag","insertTextContainer","insertEllipsis","createWordSpan","span","populatePrompter","myFragment","createDocumentFragment","addAnimationToModifiedWord","tempWords","labelWordsArray","tempLabelWordsArray","wordChangedId","getElementById","_defineProperties","updateUndoRedoState","undoRedoContext","undoRedoContextRef","currentPosition","getModel","res","updateModel","modelIndex","findIndex","undoRedoContextReference","maxSize","shift","UndoRedoContext","undo","redo","borderCoordinates","browserDocument","inkImporter","editorParam","delayBetweenStrokes","lastOneDelay","origGrabber","behavior","grabber","setDelay","X","idx","Y","play","actionsArray","delay","currentAction","nextDelay","lastIndexOf","Event","importStrokeGroups","strokeFromGroup","rendererContext","destructurePromise","resolveParam","rejectParam","promise","time","timer","manageResetState","recognizer","RecognizerContext","isTriggerValid","availableTriggers","events","pointerEvents","launchExport","requestedMimeTypes","export_","editorRef","exportTimer","timeout","delayer","PromiseHelper","getSupportedImportMimeTypes","launchConvert","conversionState","launchConfig","sendConfiguration","resizeTimer","SmartGuide","waitForIdle","close","setPenStyle","setPenStyleClasses","penStyleClasses","setTheme","Editor","behaviors","globalClassCss","styleElement","createTextNode","sheet","notifyTimer","innerBehaviors","overrideDefaultBehaviors","currentBehaviors","defaultBehaviors","rendererList","strokerList","recognizerList","getBehaviorFromConfiguration","DefaultBehaviors","localTheme","localPenStyle","handleSuccess","strokeIndex","emitEvents","launchWaitForIdle","undoRedoManager","handleError","manageRecognizedModel","_this3","canClear","_this4","canConvert","canExport","mimetype","launchImport","Blob","launchGetSupportedImportMimeTypes","launchPointerEvents","launchResize","grabberContext","innerRenderer","launchClose","innerConfiguration","overrideDefaultConfiguration","currentConfiguration","confRef","DefaultConfiguration","innerPenStyle","overrideDefaultPenStyle","currentStyle","DefaultStyles","innerPenStyleClasses","innerTheme","overrideDefaultTheme","currentTheme","DefaultTheme","innerBehavior","createUndoRedoContext","UndoRedoManager","initialize","shouldSendTheme","_this5","innerRecognizer","getImage","renderStructure","translate","toDataURL","ImageRenderer","eastereggs","code","reason","iinkRestConfiguration","postMessage","suffixUrl","buildMessage","NetworkInterface","recognizerContextReference","buildData","dataConf","buildTextConf","buildMathConf","buildDiagramConf","buildRawContentConf","newStrokes","newGroup","DefaultPenStyle","xDPI","yDPI","extractExports","resultCallback","callPostMessage","all","_arrayWithHoles","_iterableToArrayLimit","_arr","_n","_d","_e","_s","_i","_nonIterableRest","_slicedToArray","arrayWithHoles","iterableToArrayLimit","nonIterableRest","UUIDjs","getRandomInt","maxFromBits","bits","limitUI04","limitUI06","limitUI08","limitUI12","limitUI14","limitUI16","limitUI32","limitUI40","limitUI48","randomUI04","randomUI06","randomUI08","randomUI12","randomUI14","randomUI16","randomUI32","randomUI40","randomUI48","paddedString","z","fromParts","timeLow","timeMid","timeHiAndVersion","clockSeqHiAndReserved","clockSeqLow","version","hex","toURN","toBytes","ints","intPos","equals","uuid","UUID","getTimeFieldValues","ts","UTC","hm","mid","hi","timestamp","_create4","_create1","sequence","tick","tf","tl","thav","cshar","csl","fromTime","last","firstFromTime","lastFromTime","fromURN","strId","fromBytes","str","pos","octet","fromBinary","binary","new","newTS","openWebSocket","socket","WebSocket","addWebsocketAttributes","websocketConfiguration","maxPingLost","pingLostCount","infinitePing","websocketRef","readyState","send","onopen","onclose","onerror","onmessage","callBackParam","buildWebSocketCallback","NetworkWSInterface","buildRestoreIInkSessionInput","buildNewContentPackageInput","hmacChallenge","buildHmacMessage","hmac","iinkSessionId","buildConfiguration","buildOpenContentPart","buildNewContentPart","partId","partChange","contentChange","buildUrl","retry","buildFunc","responseCallback","sendMessage","sendFailedException","IinkWsConfiguration","NEBO","xDpi","yDpi","viewSizeHeight","viewSizeWidth","buildAddStrokes","buildUndo","buildRedo","buildClear","buildConvert","buildZoom","zoom","buildResize","buildExport","requestedMimeType","buildImportFile","importFileId","buildImportChunk","lastChunk","buildPointerEvents","buildWaitForIdle","buildGetSupportedImportMimeTypes","buildSetPenStyle","buildSetPenStyleClasses","styleClasses","buildSetTheme","contentChanged","WsRecognizerUtil","WsBuilder","errPartChanged","resPartChanged","errContentChanged","resContentChanged","_prepareMessage","buildFunction","onDemand","DefaultRecognizer","newContentPart","openContentPart","chunkSize","messages","readBlob","fileReader","FileReader","onload","readAsText","PointerEventGrabber","QuadraticCanvasStroker","QuadraticSVGStroker","CanvasRenderer","SVGRenderer","iinkRestRecognizer","iinkWsRecognizer","composed","register","globalClassCSS","getAvailableLanguageList","serverConfig","ok","LoggerConfig"],"mappings":"sMAIMA,EAAY,CAChBC,UAAW,CACTC,KAAM,OACNC,QAAS,UACTC,SAAU,WACVC,SAAU,WACVC,UAAW,YACXC,SAAU,WACVC,OAAQ,SACRC,KAAM,OACNC,KAAM,OACNC,MAAO,QACPC,OAAQ,SACRC,2BAA4B,2BAC5BC,OAAQ,SACRC,QAAS,UACTC,MAAO,SAETC,gBAAiB,CACfC,KAAM,OACNC,KAAM,OACNC,QAAS,UACTC,WAAY,eAEdC,SAAU,CACRC,UAAW,YACXC,KAAM,QAERC,WAAY,CACVC,aAAc,eACdC,YAAa,cACbC,UAAW,YACXvB,SAAU,WACVwB,QAAS,UACTC,SAAU,WACVd,MAAO,SAETe,QAAS,CACPC,aAAc,eACdC,WAAY,aACZC,OAAQ,UAEVC,OAAQ,CACNC,OAAQ,SACRC,MAAO,QACPC,QAAS,UACTC,SAAU,WACVC,WAAY,aACZC,MAAO,QACPC,KAAM,OACNC,WAAY,cAEdC,SAAU,CACRC,MAAO,QACPC,MAAO,QACPC,KAAM,OACNC,KAAM,OACNhC,MAAO,SAETiC,UAAW,CACTC,MAAO,mBACPC,MAAO,mBACPC,MAAO,mBACPC,MAAO,mBACPC,MAAO,2BACE,aAEXC,MAAO,CACLC,cAAe,sFACfC,kBAAmB,oGACnBC,QAAS,oDACTC,YAAa,sCAEfC,QAAS,CACPC,KAAM,uXCvEJC,GAAMC,qCCDX,SAAUC,EAAMC,GAI4BC,EAAOC,QAC5CD,UAAiBD,IAEjBD,EAAKF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EACAy+B,kBAAAA"} \ No newline at end of file diff --git a/docs/Editor.html b/docs/Editor.html index 67cdd11b..661cc0ed 100644 --- a/docs/Editor.html +++ b/docs/Editor.html @@ -407,7 +407,7 @@

behaviorSource:
@@ -471,7 +471,7 @@

behaviorsSource:
@@ -535,7 +535,7 @@

canClearSource:
@@ -599,7 +599,7 @@

canConvert<
Source:
@@ -663,7 +663,7 @@

canExportSource:
@@ -727,7 +727,7 @@

canRedoSource:
@@ -791,7 +791,7 @@

canUndoSource:
@@ -856,7 +856,7 @@

configur
Source:
@@ -920,7 +920,7 @@

configur
Source:
@@ -984,7 +984,7 @@

domElement<
Source:
@@ -1058,7 +1058,7 @@

eastereggs<
Source:
@@ -1122,7 +1122,7 @@

emitSource:
@@ -1186,7 +1186,7 @@

exportsSource:
@@ -1250,7 +1250,7 @@

exportTime
Source:
@@ -1324,7 +1324,7 @@

grabberSource:
@@ -1388,7 +1388,7 @@

grabber
Source:
@@ -1462,7 +1462,7 @@

idleSource:
@@ -1526,7 +1526,7 @@

initialize
Source:
@@ -1590,7 +1590,7 @@

isEmptySource:
@@ -1654,7 +1654,7 @@

localTheme<
Source:
@@ -1728,7 +1728,7 @@

modelSource:
@@ -1802,7 +1802,7 @@

notifyTime
Source:
@@ -1876,7 +1876,7 @@

penStyleSource:
@@ -1940,7 +1940,7 @@

penStyleSource:
@@ -2004,7 +2004,7 @@

penSty
Source:
@@ -2068,7 +2068,7 @@

penSty
Source:
@@ -2132,7 +2132,7 @@

pngSource:
@@ -2196,7 +2196,7 @@

poss
Source:
@@ -2260,7 +2260,7 @@

recognizer<
Source:
@@ -2324,7 +2324,7 @@

rendererSource:
@@ -2388,7 +2388,7 @@

render
Source:
@@ -2462,7 +2462,7 @@

resizeTime
Source:
@@ -2536,7 +2536,7 @@

strokerSource:
@@ -2600,7 +2600,7 @@

themeSource:
@@ -2664,7 +2664,7 @@

themeSource:
@@ -2728,7 +2728,7 @@

undoSta
Source:
@@ -2802,7 +2802,7 @@

(async) clearSource:
@@ -2906,7 +2906,7 @@

closeSource:
@@ -3010,7 +3010,7 @@

convertSource:
@@ -3174,7 +3174,7 @@

export_Source:
@@ -3309,7 +3309,7 @@

forceChang
Source:
@@ -3392,7 +3392,7 @@

<
Source:
@@ -3496,7 +3496,7 @@

import_Source:
@@ -3680,7 +3680,7 @@

pointerDow
Source:
@@ -3913,7 +3913,7 @@

pointerE
Source:
@@ -4069,7 +4069,7 @@

pointerMov
Source:
@@ -4204,7 +4204,7 @@

pointerUpSource:
@@ -4339,7 +4339,7 @@

(async) redoSource:
@@ -4441,7 +4441,7 @@

reDrawSource:
@@ -4592,7 +4592,7 @@

resizeSource:
@@ -4675,7 +4675,7 @@

setGuidesSource:
@@ -4851,7 +4851,7 @@

(async) undoSource:
@@ -4955,7 +4955,7 @@

unloadSource:
@@ -5038,7 +5038,7 @@

waitForIdl
Source:
@@ -5111,7 +5111,7 @@

Returns:

- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:48 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/Editor.js.html b/docs/Editor.js.html index 16910647..6b3c9470 100644 --- a/docs/Editor.js.html +++ b/docs/Editor.js.html @@ -70,7 +70,7 @@

Editor.js

*/ function manageResetState (editor, model) { // If strokes moved in the undo redo stack then a clear is mandatory before sending strokes. - if (editor.recognizer.reset && RecognizerContext.isResetRequired(editor.recognizerContext, model)) { + if (editor.recognizer.reset && !editor.isErasing && RecognizerContext.isResetRequired(editor.recognizerContext, model)) { return editor.recognizer.reset(editor.recognizerContext, model) } return null @@ -343,7 +343,9 @@

Editor.js

* @param {PenStyle} [penStyle] Custom style to apply * @param {Behaviors} [behaviors] Custom behaviors to apply */ - constructor (element, configuration, penStyle, theme, behaviors) { + constructor (element, configuration, penStyle, theme, behaviors, globalClassCss) { + globalClassCss = globalClassCss || 'ms-editor' + const styleElement = document.createElement('style') styleElement.appendChild(document.createTextNode('')) element.appendChild(styleElement) @@ -357,7 +359,7 @@

Editor.js

* @type {Element} */ this.domElement = element - this.domElement.classList.add('ms-editor') + this.domElement.classList.add(globalClassCss) // eslint-disable-next-line no-undef this.loader = document.createElement('div') @@ -393,7 +395,6 @@

Editor.js

*/ this.innerBehaviors = DefaultBehaviors.overrideDefaultBehaviors(behaviors) this.configuration = configuration - this.smartGuide = SmartGuide.createSmartGuide(this) /** * Pen color used only for pending stroke @@ -405,6 +406,9 @@

Editor.js

this.penStyle = penStyle this.penStyleClasses = '' + // To override pointerType when ERASER + this.isErasing = false + this.domElement.editor = this } @@ -416,28 +420,17 @@

Editor.js

set configuration (configuration) { this.loader.style.display = 'initial' this.error.style.display = 'none' - - /** - * Update function call when some configuration property is updated - * @param {string} value - */ - const update = (value) => { - const defaultLang = !Object.keys(Constants.Languages).includes(value) - this.theme['.text']['font-family'] = defaultLang ? Constants.Languages.default : Constants.Languages[value] - this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration) - } - - const watcher = { - update, - prop: 'lang' - } - /** * @private * @type {Configuration} */ - this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration, watcher) + this.innerConfiguration = DefaultConfiguration.overrideDefaultConfiguration(configuration) this.behavior = this.behaviors.getBehaviorFromConfiguration(this.behaviors, this.innerConfiguration) + if (this.smartGuide) { + SmartGuide.reset(this.smartGuide) + } else { + this.smartGuide = SmartGuide.createSmartGuide(this) + } } /** @@ -698,6 +691,17 @@

Editor.js

return this.recognizerContext ? this.recognizerContext.initialized : false } + enableEraser () { + this.isErasing = true + this.domElement.classList.add('erasing') + } + + disableEraser () { + document.body.style.cursor = 'initial' + this.isErasing = false + this.domElement.classList.remove('erasing') + } + /** * Handle a pointer down * @param {{x: Number, y: Number, t: Number}} point Captured point coordinates @@ -709,7 +713,9 @@

Editor.js

window.clearTimeout(this.notifyTimer) window.clearTimeout(this.exportTimer) this.model = InkModel.initPendingStroke(this.model, point, Object.assign({ pointerType, pointerId }, this.theme.ink, this.localPenStyle)) - this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker) + if (!this.isErasing) { + this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker) + } // Currently no recognition on pointer down } @@ -720,7 +726,9 @@

Editor.js

pointerMove (point) { logger.trace('Pointer move', point) this.model = InkModel.appendToPendingStroke(this.model, point) - this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker) + if (!this.isErasing) { + this.renderer.drawCurrentStroke(this.rendererContext, this.model, this.stroker) + } // Currently no recognition on pointer move } @@ -731,7 +739,9 @@

Editor.js

pointerUp (point) { logger.trace('Pointer up', point) this.model = InkModel.endPendingStroke(this.model, point, this.penStyle) - this.renderer.drawModel(this.rendererContext, this.model, this.stroker) + if (!this.isErasing) { + this.renderer.drawModel(this.rendererContext, this.model, this.stroker) + } if (this.recognizer.addStrokes) { addStrokes(this, this.model) @@ -1036,7 +1046,7 @@

Editor.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/EditorFacade.js.html b/docs/EditorFacade.js.html index 98f4e39c..9ed0d86a 100644 --- a/docs/EditorFacade.js.html +++ b/docs/EditorFacade.js.html @@ -49,11 +49,12 @@

EditorFacade.js

* @param {PenStyle} [penStyle] Pen style to apply * @param {Theme} [theme] Theme to apply * @param {Behaviors} [behaviors] Custom behaviors to apply + * @param {String} [globalClassCSS] Replace global class css 'ms-editor' to customize style * @return {Editor} New editor */ -export function register (element, configuration, penStyle, theme, behaviors) { +export function register (element, configuration, penStyle, theme, behaviors, globalClassCSS) { logger.debug('Registering a new editor') - return new Editor(element, configuration, penStyle, theme, behaviors) + return new Editor(element, configuration, penStyle, theme, behaviors, globalClassCSS) } /** @@ -89,7 +90,7 @@

EditorFacade.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_Constants.js.html b/docs/configuration_Constants.js.html index b3b549f8..af87aae5 100644 --- a/docs/configuration_Constants.js.html +++ b/docs/configuration_Constants.js.html @@ -113,7 +113,8 @@

configuration/Constants.js

Error: { NOT_REACHABLE: 'MyScript recognition server is not reachable. Please reload once you are connected.', WRONG_CREDENTIALS: 'Application credentials are invalid. Please check or regenerate your application key and hmackey.', - TOO_OLD: 'Session is too old. Max Session Duration Reached.' + TOO_OLD: 'Session is too old. Max Session Duration Reached.', + NO_ACTIVITY: 'Session closed due to no activity.' }, Exports: { JIIX: 'application/vnd.myscript.jiix' @@ -132,7 +133,7 @@

configuration/Constants.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_DefaultBehaviors.js.html b/docs/configuration_DefaultBehaviors.js.html index 7ede7d3a..7d1ecac6 100644 --- a/docs/configuration_DefaultBehaviors.js.html +++ b/docs/configuration_DefaultBehaviors.js.html @@ -133,7 +133,7 @@

configuration/DefaultBehaviors.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_DefaultConfiguration.js.html b/docs/configuration_DefaultConfiguration.js.html index 9cc5b163..cb29f1ab 100644 --- a/docs/configuration_DefaultConfiguration.js.html +++ b/docs/configuration_DefaultConfiguration.js.html @@ -99,6 +99,9 @@

configuration/DefaultConfiguration.js

left: 15, right: 15, top: 10 + }, + eraser: { + 'erase-precisely': false } }, text: { @@ -115,6 +118,9 @@

configuration/DefaultConfiguration.js

top: 20, left: 10, right: 10 + }, + eraser: { + 'erase-precisely': false } }, diagram: { @@ -160,15 +166,13 @@

configuration/DefaultConfiguration.js

} } -const isProxy = Symbol('isProxy') - /** * Generate parameters * @param {Configuration} configuration Configuration to be used * @param {Object} watcher: { update: function, prop: string} function to call when 'prop' is updated * @return {Configuration} Overridden configuration */ -export function overrideDefaultConfiguration (configuration, watcher) { +export function overrideDefaultConfiguration (configuration) { const confRef = configuration let currentConfiguration if (confRef && confRef.recognitionParams.server && confRef.recognitionParams.server.useWindowLocation) { @@ -180,25 +184,7 @@

configuration/DefaultConfiguration.js

} logger.debug('Override default configuration', currentConfiguration) - const handler = { - get: function (target, key) { - // Nested objects are Proxy too - if (key !== isProxy && typeof target[key] === 'object' && target[key] !== null) { - return new Proxy(target[key], handler) - } else { - return target[key] - } - }, - set: function (obj, prop, value) { - if (prop === watcher.prop) { - watcher.update(value) - } - obj[prop] = value - return true - } - } - - return new Proxy(currentConfiguration, handler) + return currentConfiguration } export default defaultConfiguration @@ -214,7 +200,7 @@

configuration/DefaultConfiguration.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_DefaultPenStyle.js.html b/docs/configuration_DefaultPenStyle.js.html index 2e4eebe7..78065d20 100644 --- a/docs/configuration_DefaultPenStyle.js.html +++ b/docs/configuration_DefaultPenStyle.js.html @@ -91,7 +91,7 @@

configuration/DefaultPenStyle.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_DefaultTheme.js.html b/docs/configuration_DefaultTheme.js.html index 7e7d3b83..0a2ad003 100644 --- a/docs/configuration_DefaultTheme.js.html +++ b/docs/configuration_DefaultTheme.js.html @@ -125,7 +125,7 @@

configuration/DefaultTheme.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/configuration_LoggerConfig.js.html b/docs/configuration_LoggerConfig.js.html index 3977d51a..e117c894 100644 --- a/docs/configuration_LoggerConfig.js.html +++ b/docs/configuration_LoggerConfig.js.html @@ -123,7 +123,7 @@

configuration/LoggerConfig.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/eastereggs_InkImporter.js.html b/docs/eastereggs_InkImporter.js.html index ba255757..73c4cb3b 100644 --- a/docs/eastereggs_InkImporter.js.html +++ b/docs/eastereggs_InkImporter.js.html @@ -138,7 +138,7 @@

eastereggs/InkImporter.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/event_Event.js.html b/docs/event_Event.js.html index 328bb54c..10b7bc56 100644 --- a/docs/event_Event.js.html +++ b/docs/event_Event.js.html @@ -65,7 +65,7 @@

event/Event.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/global.html b/docs/global.html index e3028848..876a7842 100644 --- a/docs/global.html +++ b/docs/global.html @@ -7648,7 +7648,7 @@

creat
Source:
@@ -12469,7 +12469,7 @@

Source:
@@ -14700,7 +14700,7 @@

handleSu
Source:
@@ -16175,7 +16175,7 @@

inser
Source:
@@ -20180,7 +20180,7 @@

Source:
@@ -21698,7 +21698,7 @@
Parameters:
-

register(element, configurationopt, penStyleopt, themeopt, behaviorsopt) → {Editor}

+

register(element, configurationopt, penStyleopt, themeopt, behaviorsopt, globalClassCSSopt) → {Editor}

@@ -21741,7 +21741,7 @@

registerSource:
@@ -21962,6 +21962,42 @@
Parameters:
+ + + + globalClassCSS + + + + + +String + + + + + + + + + <optional>
+ + + + + + + + + + + + Replace global class css 'ms-editor' to customize style + + + + + @@ -35584,7 +35620,7 @@
Type:

- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:48 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/grabber_PointerEventGrabber.js.html b/docs/grabber_PointerEventGrabber.js.html index 5c0e78fa..992003f3 100644 --- a/docs/grabber_PointerEventGrabber.js.html +++ b/docs/grabber_PointerEventGrabber.js.html @@ -147,7 +147,11 @@

grabber/PointerEventGrabber.js

const pointerId = evt.pointerId > 2147483647 ? -1 : evt.pointerId unfocus() evt.stopPropagation() - editor.pointerDown(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft), evt.pointerType, pointerId) + let pointerType = evt.pointerType + if (editor.isErasing) { + pointerType = 'ERASER' + } + editor.pointerDown(extractPoint(evt, element, editor.configuration, offsetTop, offsetLeft), pointerType, pointerId) } } else if (evt.target.classList.contains('ellipsis') || evt.target.classList.contains('tag-icon')) { hideMenu(evt) @@ -260,7 +264,7 @@

grabber/PointerEventGrabber.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/index.html b/docs/index.html index 4d76f7a5..e1d3de58 100644 --- a/docs/index.html +++ b/docs/index.html @@ -249,7 +249,7 @@

License


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:48 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_InkModel.js.html b/docs/model_InkModel.js.html index aa0b628b..e865eeef 100644 --- a/docs/model_InkModel.js.html +++ b/docs/model_InkModel.js.html @@ -410,7 +410,7 @@

model/InkModel.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_RecognizerContext.js.html b/docs/model_RecognizerContext.js.html index da7591ed..4d492fd3 100644 --- a/docs/model_RecognizerContext.js.html +++ b/docs/model_RecognizerContext.js.html @@ -196,7 +196,7 @@

model/RecognizerContext.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_StrokeComponent.js.html b/docs/model_StrokeComponent.js.html index 044be49b..34b1decc 100644 --- a/docs/model_StrokeComponent.js.html +++ b/docs/model_StrokeComponent.js.html @@ -125,7 +125,7 @@

model/StrokeComponent.js

* @return {{x: Array<Number>, y: Array<Number>, t: Array<Number>}} Simplified stroke object */ export function toJSON (stroke) { - return { x: stroke.x, y: stroke.y, t: stroke.t } + return { x: stroke.x, y: stroke.y, t: stroke.t, pointerType: stroke.pointerType } } /** @@ -198,7 +198,7 @@

model/StrokeComponent.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_Symbol.js.html b/docs/model_Symbol.js.html index 8b559ce1..fd1493f9 100644 --- a/docs/model_Symbol.js.html +++ b/docs/model_Symbol.js.html @@ -162,7 +162,7 @@

model/Symbol.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_UndoRedoContext.js.html b/docs/model_UndoRedoContext.js.html index c717c51e..976a3509 100644 --- a/docs/model_UndoRedoContext.js.html +++ b/docs/model_UndoRedoContext.js.html @@ -87,7 +87,7 @@

model/UndoRedoContext.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/model_UndoRedoManager.js.html b/docs/model_UndoRedoManager.js.html index ee730e46..a7bebbf1 100644 --- a/docs/model_UndoRedoManager.js.html +++ b/docs/model_UndoRedoManager.js.html @@ -142,7 +142,7 @@

model/UndoRedoManager.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_CryptoHelper.js.html b/docs/recognizer_CryptoHelper.js.html index b569a593..94d1f88e 100644 --- a/docs/recognizer_CryptoHelper.js.html +++ b/docs/recognizer_CryptoHelper.js.html @@ -68,7 +68,7 @@

recognizer/CryptoHelper.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_DefaultRecognizer.js.html b/docs/recognizer_DefaultRecognizer.js.html index b7e4dc02..cbbf151f 100644 --- a/docs/recognizer_DefaultRecognizer.js.html +++ b/docs/recognizer_DefaultRecognizer.js.html @@ -177,7 +177,7 @@

recognizer/DefaultRecognizer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_RecognizerService.js.html b/docs/recognizer_RecognizerService.js.html index 8f9d8af8..36ee99d2 100644 --- a/docs/recognizer_RecognizerService.js.html +++ b/docs/recognizer_RecognizerService.js.html @@ -171,6 +171,8 @@

recognizer/RecognizerService.js

// IInk error managment after refactor (err.code && err.code === 'access.not.granted')) { editorRef.error.innerText = Constants.Error.WRONG_CREDENTIALS + } else if (err.code && err.code === 'no.activity') { + editorRef.error.innerText = Constants.Error.NO_ACTIVITY } else if (err.message === 'Session is too old. Max Session Duration Reached.' || (err.code && err.code === 'session.too.old')) { editorRef.error.innerText = Constants.Error.TOO_OLD @@ -220,7 +222,7 @@

recognizer/RecognizerService.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_rest_iinkRestRecognizer.js.html b/docs/recognizer_rest_iinkRestRecognizer.js.html index 48723c0c..653dc4bf 100644 --- a/docs/recognizer_rest_iinkRestRecognizer.js.html +++ b/docs/recognizer_rest_iinkRestRecognizer.js.html @@ -274,7 +274,7 @@

recognizer/rest/iinkRestRecognizer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_rest_networkInterface.js.html b/docs/recognizer_rest_networkInterface.js.html index 69587d88..331ceeed 100644 --- a/docs/recognizer_rest_networkInterface.js.html +++ b/docs/recognizer_rest_networkInterface.js.html @@ -106,7 +106,7 @@

recognizer/rest/networkInterface.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_websocket_WsBuilder.js.html b/docs/recognizer_websocket_WsBuilder.js.html index 4919f847..f3cd6330 100644 --- a/docs/recognizer_websocket_WsBuilder.js.html +++ b/docs/recognizer_websocket_WsBuilder.js.html @@ -196,10 +196,14 @@

recognizer/websocket/WsBuilder.js

case 'close': logger.debug('Close detected stopping all recognition', message) recognizerContextRef.initialized = false - if (recognitionContext) { - recognitionContext.error(message) + if (message.reason === 'CLOSE_RECOGNIZER') { + recognitionContext.initPromise.resolve(message) } else { - recognitionContext.initPromise.reject(message) + if (recognitionContext) { + recognitionContext.error(message) + } else { + recognitionContext.initPromise.reject(message) + } } break default : @@ -219,7 +223,7 @@

recognizer/websocket/WsBuilder.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_websocket_WsRecognizerUtil.js.html b/docs/recognizer_websocket_WsRecognizerUtil.js.html index 9bced757..ac0b22a6 100644 --- a/docs/recognizer_websocket_WsRecognizerUtil.js.html +++ b/docs/recognizer_websocket_WsRecognizerUtil.js.html @@ -188,7 +188,7 @@

recognizer/websocket/WsRecognizerUtil.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_websocket_iinkWsRecognizer.js.html b/docs/recognizer_websocket_iinkWsRecognizer.js.html index c2eb9163..b9377b70 100644 --- a/docs/recognizer_websocket_iinkWsRecognizer.js.html +++ b/docs/recognizer_websocket_iinkWsRecognizer.js.html @@ -658,7 +658,7 @@

recognizer/websocket/iinkWsRecognizer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/recognizer_websocket_networkWSInterface.js.html b/docs/recognizer_websocket_networkWSInterface.js.html index b22c21c7..20d87a03 100644 --- a/docs/recognizer_websocket_networkWSInterface.js.html +++ b/docs/recognizer_websocket_networkWSInterface.js.html @@ -165,7 +165,7 @@

recognizer/websocket/networkWSInterface.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_QuadraticUtils.js.html b/docs/renderer_QuadraticUtils.js.html index f668a160..c4244b53 100644 --- a/docs/renderer_QuadraticUtils.js.html +++ b/docs/renderer_QuadraticUtils.js.html @@ -96,7 +96,7 @@

renderer/QuadraticUtils.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_CanvasRenderer.js.html b/docs/renderer_canvas_CanvasRenderer.js.html index 9c138728..5bb17d0b 100644 --- a/docs/renderer_canvas_CanvasRenderer.js.html +++ b/docs/renderer_canvas_CanvasRenderer.js.html @@ -239,7 +239,7 @@

renderer/canvas/CanvasRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_ImageRenderer.js.html b/docs/renderer_canvas_ImageRenderer.js.html index fc141e23..8f4fd0ac 100644 --- a/docs/renderer_canvas_ImageRenderer.js.html +++ b/docs/renderer_canvas_ImageRenderer.js.html @@ -91,7 +91,7 @@

renderer/canvas/ImageRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_stroker_QuadraticCanvasStroker.js.html b/docs/renderer_canvas_stroker_QuadraticCanvasStroker.js.html index a5885f9d..55c32c52 100644 --- a/docs/renderer_canvas_stroker_QuadraticCanvasStroker.js.html +++ b/docs/renderer_canvas_stroker_QuadraticCanvasStroker.js.html @@ -157,7 +157,7 @@

renderer/canvas/stroker/QuadraticCanvasStroker.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_symbols_MathSymbolCanvasRenderer.js.html b/docs/renderer_canvas_symbols_MathSymbolCanvasRenderer.js.html index 2063d76f..0c5d6c35 100644 --- a/docs/renderer_canvas_symbols_MathSymbolCanvasRenderer.js.html +++ b/docs/renderer_canvas_symbols_MathSymbolCanvasRenderer.js.html @@ -103,7 +103,7 @@

renderer/canvas/symbols/MathSymbolCanvasRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_symbols_ShapeSymbolCanvasRenderer.js.html b/docs/renderer_canvas_symbols_ShapeSymbolCanvasRenderer.js.html index 9336f9d1..931ab84f 100644 --- a/docs/renderer_canvas_symbols_ShapeSymbolCanvasRenderer.js.html +++ b/docs/renderer_canvas_symbols_ShapeSymbolCanvasRenderer.js.html @@ -235,7 +235,7 @@

renderer/canvas/symbols/ShapeSymbolCanvasRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_symbols_StrokeSymbolCanvasRenderer.js.html b/docs/renderer_canvas_symbols_StrokeSymbolCanvasRenderer.js.html index d54ecb57..a3b72388 100644 --- a/docs/renderer_canvas_symbols_StrokeSymbolCanvasRenderer.js.html +++ b/docs/renderer_canvas_symbols_StrokeSymbolCanvasRenderer.js.html @@ -46,7 +46,7 @@

renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js

renderer/canvas/symbols/StrokeSymbolCanvasRenderer.js

- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_canvas_symbols_TextSymbolCanvasRenderer.js.html b/docs/renderer_canvas_symbols_TextSymbolCanvasRenderer.js.html index 1a81c5ca..be8462cc 100644 --- a/docs/renderer_canvas_symbols_TextSymbolCanvasRenderer.js.html +++ b/docs/renderer_canvas_symbols_TextSymbolCanvasRenderer.js.html @@ -133,7 +133,7 @@

renderer/canvas/symbols/TextSymbolCanvasRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_svg_SVGRenderer.js.html b/docs/renderer_svg_SVGRenderer.js.html index c301c916..c6565130 100644 --- a/docs/renderer_svg_SVGRenderer.js.html +++ b/docs/renderer_svg_SVGRenderer.js.html @@ -263,7 +263,7 @@

renderer/svg/SVGRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_svg_stroker_QuadraticSVGStroker.js.html b/docs/renderer_svg_stroker_QuadraticSVGStroker.js.html index 1fded524..f465c202 100644 --- a/docs/renderer_svg_stroker_QuadraticSVGStroker.js.html +++ b/docs/renderer_svg_stroker_QuadraticSVGStroker.js.html @@ -149,7 +149,7 @@

renderer/svg/stroker/QuadraticSVGStroker.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/renderer_svg_symbols_StrokeSymbolSVGRenderer.js.html b/docs/renderer_svg_symbols_StrokeSymbolSVGRenderer.js.html index 368dc8aa..f7e539e6 100644 --- a/docs/renderer_svg_symbols_StrokeSymbolSVGRenderer.js.html +++ b/docs/renderer_svg_symbols_StrokeSymbolSVGRenderer.js.html @@ -62,7 +62,7 @@

renderer/svg/symbols/StrokeSymbolSVGRenderer.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/smartguide_SmartGuide.js.html b/docs/smartguide_SmartGuide.js.html index 38203e20..73130bfd 100644 --- a/docs/smartguide_SmartGuide.js.html +++ b/docs/smartguide_SmartGuide.js.html @@ -323,68 +323,11 @@

smartguide/SmartGuide.js

observer.observe(elementsRef.smartGuideElement, { childList: true, subtree: true, attributes: true }) } -/** - * Create a new smart guide - * @param {Editor} editor - A reference to the editor. - * @returns {SmartGuide} New smart guide - */ -export function createSmartGuide (editor) { - const randomString = '-' + Math.random().toString(10).substring(2, 12) - const elements = createHTMLElements(randomString) - - /** - * Clipboard from clipboard.js used to get copy across all browsers. - * @type {Clipboard} - */ - // eslint-disable-next-line no-unused-vars - const clipboard = new Clipboard(elements.copyElement) - const perfectScrollbar = new PerfectScrollbar(elements.textContainer, { suppressScrollY: true, scrollXMarginOffset: 1 }) - - const smartGuide = { - editor, - wordToChange: '', - lastWord: '', - previousLabelExport: ' ', - perfectScrollbar, - elements, - smartGuideTimeOutId: 0, - randomString - } - addListeners(editor, smartGuide) - - if (editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable) { - callFadeOutObserver(editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration, smartGuide) - } - - return smartGuide -} - -export function resize (smartGuide) { - const smartGuideRef = smartGuide - const elementsRef = smartGuide.elements - - const mmToPixels = 3.779527559 - let left = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels - - const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left - - // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px) - elementsRef.textContainer.style.width = `${maxWidthTextContainer}px` - elementsRef.textContainer.style.maxWidth = `${maxWidthTextContainer}px` - - left = elementsRef.tagElement.offsetWidth - left += maxWidthTextContainer - elementsRef.ellipsisElement.style.left = `${left}px` - - elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px` - smartGuideRef.perfectScrollbar.update() -} - /** * Insert the smart guide HTML elements in the DOM. * @param {SmartGuide} smartGuide - A reference to the smart guide. */ -export function insertSmartGuide (smartGuide) { +function insertSmartGuide (smartGuide) { const smartGuideRef = smartGuide const elementsRef = smartGuide.elements @@ -451,6 +394,63 @@

smartguide/SmartGuide.js

smartGuideRef.perfectScrollbar.update() } +/** + * Create a new smart guide + * @param {Editor} editor - A reference to the editor. + * @returns {SmartGuide} New smart guide + */ +export function createSmartGuide (editor) { + const randomString = '-' + Math.random().toString(10).substring(2, 12) + const elements = createHTMLElements(randomString) + + /** + * Clipboard from clipboard.js used to get copy across all browsers. + * @type {Clipboard} + */ + // eslint-disable-next-line no-unused-vars + const clipboard = new Clipboard(elements.copyElement) + const perfectScrollbar = new PerfectScrollbar(elements.textContainer, { suppressScrollY: true, scrollXMarginOffset: 1 }) + + const smartGuide = { + editor, + wordToChange: '', + lastWord: '', + previousLabelExport: ' ', + perfectScrollbar, + elements, + smartGuideTimeOutId: 0, + randomString + } + addListeners(editor, smartGuide) + + if (editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.enable) { + callFadeOutObserver(editor.configuration.recognitionParams.iink.text.smartGuideFadeOut.duration, smartGuide) + } + + return smartGuide +} + +export function resize (smartGuide) { + const smartGuideRef = smartGuide + const elementsRef = smartGuide.elements + + const mmToPixels = 3.779527559 + let left = smartGuideRef.editor.configuration.recognitionParams.iink.text.margin.left * mmToPixels + + const maxWidthTextContainer = smartGuideRef.editor.domElement.clientWidth - left - elementsRef.tagElement.offsetWidth - 35 - left + + // Assign a max width to the smartguide based on the editor width, the left position and a small margin for the ellipsis (48px) + elementsRef.textContainer.style.width = `${maxWidthTextContainer}px` + elementsRef.textContainer.style.maxWidth = `${maxWidthTextContainer}px` + + left = elementsRef.tagElement.offsetWidth + left += maxWidthTextContainer + elementsRef.ellipsisElement.style.left = `${left}px` + + elementsRef.smartGuideElement.style.width = `${elementsRef.tagElement.offsetWidth + elementsRef.textContainer.offsetWidth + elementsRef.ellipsisElement.offsetWidth}px` + smartGuideRef.perfectScrollbar.update() +} + /** * Launch the smartguide. * @param {SmartGuide} smartGuide - A reference to the smart guide. @@ -541,6 +541,13 @@

smartguide/SmartGuide.js

return smartGuideRef } + +export function reset (smartGuide) { + const elementsRef = smartGuide.elements + elementsRef.candidatesElement.innerHTML = '' + elementsRef.smartGuideElement.classList.add('smartguide-out') + elementsRef.smartGuideElement.classList.remove('smartguide-in') +} @@ -553,7 +560,7 @@

smartguide/SmartGuide.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/docs/util_PromiseHelper.js.html b/docs/util_PromiseHelper.js.html index 7568dec1..3e4ea279 100644 --- a/docs/util_PromiseHelper.js.html +++ b/docs/util_PromiseHelper.js.html @@ -87,7 +87,7 @@

util/PromiseHelper.js


- Generated by JSDoc 3.6.6 on Wed Nov 04 2020 13:49:47 GMT+0100 (Central European Standard Time) using the Minami theme. + Generated by JSDoc 3.6.7 on Tue Dec 14 2021 10:34:28 GMT+0100 (Central European Standard Time) using the Minami theme.
diff --git a/package-lock.json b/package-lock.json index 64e54616..ba4eaf39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "iink-js", - "version": "1.4.5", + "version": "1.5.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "iink-js", - "version": "1.4.5", + "version": "1.5.1", "license": "Apache-2.0", "dependencies": { "@babel/runtime": "^7.9.2", @@ -15083,24 +15083,28 @@ "dependencies": { "abbrev": { "version": "1.1.1", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "bundled": true, "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "bundled": true, "dev": true, "optional": true }, "aproba": { "version": "1.2.0", + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", "bundled": true, "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.5", + "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "bundled": true, "dev": true, "optional": true, @@ -15111,12 +15115,14 @@ }, "balanced-match": { "version": "1.0.0", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "bundled": true, "dev": true, "optional": true }, "brace-expansion": { "version": "1.1.11", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "bundled": true, "dev": true, "optional": true, @@ -15127,36 +15133,42 @@ }, "chownr": { "version": "1.1.4", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "bundled": true, "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "bundled": true, "dev": true, "optional": true }, "concat-map": { "version": "0.0.1", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "bundled": true, "dev": true, "optional": true }, "console-control-strings": { "version": "1.1.0", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "bundled": true, "dev": true, "optional": true }, "core-util-is": { "version": "1.0.2", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "bundled": true, "dev": true, "optional": true }, "debug": { "version": "3.2.6", + "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", "bundled": true, "dev": true, "optional": true, @@ -15166,24 +15178,28 @@ }, "deep-extend": { "version": "0.6.0", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "bundled": true, "dev": true, "optional": true }, "delegates": { "version": "1.0.0", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "bundled": true, "dev": true, "optional": true }, "detect-libc": { "version": "1.0.3", + "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", "bundled": true, "dev": true, "optional": true }, "fs-minipass": { "version": "1.2.7", + "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", "bundled": true, "dev": true, "optional": true, @@ -15193,12 +15209,14 @@ }, "fs.realpath": { "version": "1.0.0", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "bundled": true, "dev": true, "optional": true }, "gauge": { "version": "2.7.4", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "bundled": true, "dev": true, "optional": true, @@ -15215,6 +15233,7 @@ }, "glob": { "version": "7.1.6", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "bundled": true, "dev": true, "optional": true, @@ -15229,12 +15248,14 @@ }, "has-unicode": { "version": "2.0.1", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "bundled": true, "dev": true, "optional": true }, "iconv-lite": { "version": "0.4.24", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "bundled": true, "dev": true, "optional": true, @@ -15244,6 +15265,7 @@ }, "ignore-walk": { "version": "3.0.3", + "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", "bundled": true, "dev": true, "optional": true, @@ -15253,6 +15275,7 @@ }, "inflight": { "version": "1.0.6", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "bundled": true, "dev": true, "optional": true, @@ -15263,18 +15286,21 @@ }, "inherits": { "version": "2.0.4", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "bundled": true, "dev": true, "optional": true }, "ini": { "version": "1.3.5", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", "bundled": true, "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "bundled": true, "dev": true, "optional": true, @@ -15284,12 +15310,14 @@ }, "isarray": { "version": "1.0.0", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "bundled": true, "dev": true, "optional": true }, "minimatch": { "version": "3.0.4", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "bundled": true, "dev": true, "optional": true, @@ -15299,12 +15327,14 @@ }, "minimist": { "version": "1.2.5", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "bundled": true, "dev": true, "optional": true }, "minipass": { "version": "2.9.0", + "integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==", "bundled": true, "dev": true, "optional": true, @@ -15315,6 +15345,7 @@ }, "minizlib": { "version": "1.3.3", + "integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==", "bundled": true, "dev": true, "optional": true, @@ -15324,6 +15355,7 @@ }, "mkdirp": { "version": "0.5.3", + "integrity": "sha512-P+2gwrFqx8lhew375MQHHeTlY8AuOJSrGf0R5ddkEndUkmwpgUob/vQuBD1V22/Cw1/lJr4x+EjllSezBThzBg==", "bundled": true, "dev": true, "optional": true, @@ -15333,12 +15365,14 @@ }, "ms": { "version": "2.1.2", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "bundled": true, "dev": true, "optional": true }, "needle": { "version": "2.3.3", + "integrity": "sha512-EkY0GeSq87rWp1hoq/sH/wnTWgFVhYlnIkbJ0YJFfRgEFlz2RraCjBpFQ+vrEgEdp0ThfyHADmkChEhcb7PKyw==", "bundled": true, "dev": true, "optional": true, @@ -15350,6 +15384,7 @@ }, "node-pre-gyp": { "version": "0.14.0", + "integrity": "sha512-+CvDC7ZttU/sSt9rFjix/P05iS43qHCOOGzcr3Ry99bXG7VX953+vFyEuph/tfqoYu8dttBkE86JSKBO2OzcxA==", "bundled": true, "dev": true, "optional": true, @@ -15368,6 +15403,7 @@ }, "nopt": { "version": "4.0.3", + "integrity": "sha512-CvaGwVMztSMJLOeXPrez7fyfObdZqNUK1cPAEzLHrTybIua9pMdmmPR5YwtfNftIOMv3DPUhFaxsZMNTQO20Kg==", "bundled": true, "dev": true, "optional": true, @@ -15378,6 +15414,7 @@ }, "npm-bundled": { "version": "1.1.1", + "integrity": "sha512-gqkfgGePhTpAEgUsGEgcq1rqPXA+tv/aVBlgEzfXwA1yiUJF7xtEt3CtVwOjNYQOVknDk0F20w58Fnm3EtG0fA==", "bundled": true, "dev": true, "optional": true, @@ -15387,12 +15424,14 @@ }, "npm-normalize-package-bin": { "version": "1.0.1", + "integrity": "sha512-EPfafl6JL5/rU+ot6P3gRSCpPDW5VmIzX959Ob1+ySFUuuYHWHekXpwdUZcKP5C+DS4GEtdJluwBjnsNDl+fSA==", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { "version": "1.4.8", + "integrity": "sha512-5+AZgwru5IevF5ZdnFglB5wNlHG1AOOuw28WhUq8/8emhBmLv6jX5by4WJCh7lW0uSYZYS6DXqIsyZVIXRZU9A==", "bundled": true, "dev": true, "optional": true, @@ -15404,6 +15443,7 @@ }, "npmlog": { "version": "4.1.2", + "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "bundled": true, "dev": true, "optional": true, @@ -15416,18 +15456,21 @@ }, "number-is-nan": { "version": "1.0.1", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "bundled": true, "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "bundled": true, "dev": true, "optional": true }, "once": { "version": "1.4.0", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "bundled": true, "dev": true, "optional": true, @@ -15437,18 +15480,21 @@ }, "os-homedir": { "version": "1.0.2", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "bundled": true, "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "bundled": true, "dev": true, "optional": true }, "osenv": { "version": "0.1.5", + "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", "bundled": true, "dev": true, "optional": true, @@ -15459,18 +15505,21 @@ }, "path-is-absolute": { "version": "1.0.1", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "bundled": true, "dev": true, "optional": true }, "process-nextick-args": { "version": "2.0.1", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "bundled": true, "dev": true, "optional": true }, "rc": { "version": "1.2.8", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "bundled": true, "dev": true, "optional": true, @@ -15483,6 +15532,7 @@ }, "readable-stream": { "version": "2.3.7", + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "bundled": true, "dev": true, "optional": true, @@ -15498,6 +15548,7 @@ }, "rimraf": { "version": "2.7.1", + "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", "bundled": true, "dev": true, "optional": true, @@ -15507,42 +15558,49 @@ }, "safe-buffer": { "version": "5.1.2", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "bundled": true, "dev": true, "optional": true }, "safer-buffer": { "version": "2.1.2", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "bundled": true, "dev": true, "optional": true }, "sax": { "version": "1.2.4", + "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "bundled": true, "dev": true, "optional": true }, "semver": { "version": "5.7.1", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", "bundled": true, "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "bundled": true, "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "bundled": true, "dev": true, "optional": true }, "string_decoder": { "version": "1.1.1", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "bundled": true, "dev": true, "optional": true, @@ -15552,6 +15610,7 @@ }, "string-width": { "version": "1.0.2", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "bundled": true, "dev": true, "optional": true, @@ -15563,6 +15622,7 @@ }, "strip-ansi": { "version": "3.0.1", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "bundled": true, "dev": true, "optional": true, @@ -15572,12 +15632,14 @@ }, "strip-json-comments": { "version": "2.0.1", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "bundled": true, "dev": true, "optional": true }, "tar": { "version": "4.4.13", + "integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==", "bundled": true, "dev": true, "optional": true, @@ -15593,12 +15655,14 @@ }, "util-deprecate": { "version": "1.0.2", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "bundled": true, "dev": true, "optional": true }, "wide-align": { "version": "1.1.3", + "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "bundled": true, "dev": true, "optional": true, @@ -15608,12 +15672,14 @@ }, "wrappy": { "version": "1.0.2", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "bundled": true, "dev": true, "optional": true }, "yallist": { "version": "3.1.1", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "bundled": true, "dev": true, "optional": true diff --git a/package.json b/package.json index 09994673..ec082e24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iink-js", - "version": "1.4.5", + "version": "1.5.1", "main": "dist/iink.min.js", "module": "dist/iink.esm.js", "description": "iinkJS is the fastest way to integrate handwriting panel and recognition in your webapp",