-
Notifications
You must be signed in to change notification settings - Fork 5
/
colorblind.js
117 lines (117 loc) · 51.4 KB
/
colorblind.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
var that=this;function __skpm_run(key,context){that.context=context;var exports=function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/colorblind.js")}({"./node_modules/@skpm/timers/immediate.js":
/*!************************************************!*\
!*** ./node_modules/@skpm/timers/immediate.js ***!
\************************************************/
/*! no static exports found */function(e,t,n){var i=n(/*! ./timeout */"./node_modules/@skpm/timers/timeout.js");e.exports={setImmediate:function(e,t,n,o,r,s,a,l,u,c,d){return i.setTimeout(e,0,t,n,o,r,s,a,l,u,c,d)},clearImmediate:function(e){return i.clearTimeout(e)}}},"./node_modules/@skpm/timers/interval.js":
/*!***********************************************!*\
!*** ./node_modules/@skpm/timers/interval.js ***!
\***********************************************/
/*! no static exports found */function(e,t,n){var i,o,r=[];n(/*! ./test-if-fiber */"./node_modules/@skpm/timers/test-if-fiber.js")()?(i=function(e,t,n,i,o,s,a,l,u,c,d,f){var h=r.length;return r.push(coscript.scheduleWithRepeatingInterval_jsFunction((t||0)/1e3,function(){e(n,i,o,s,a,l,u,c,d,f)})),h},o=function(e){var t=r[e];t&&(t.cancel(),r[e]=void 0)}):(i=function(e,t,n,i,o,s,a,l,u,c,d,f){coscript.shouldKeepAround=!0;var h=r.length;return r.push(!0),function m(){coscript.scheduleWithInterval_jsFunction((t||0)/1e3,function(){r[h]&&(e(n,i,o,s,a,l,u,c,d,f),m())})}(),h},o=function(e){r[e]=!1,r.every(function(e){return!e})&&(coscript.shouldKeepAround=!1)}),e.exports={setInterval:i,clearInterval:o}},"./node_modules/@skpm/timers/test-if-fiber.js":
/*!****************************************************!*\
!*** ./node_modules/@skpm/timers/test-if-fiber.js ***!
\****************************************************/
/*! no static exports found */function(e,t){e.exports=function(){return"undefined"!=typeof coscript&&coscript.createFiber}},"./node_modules/@skpm/timers/timeout.js":
/*!**********************************************!*\
!*** ./node_modules/@skpm/timers/timeout.js ***!
\**********************************************/
/*! no static exports found */function(e,t,n){var i,o,r=[];if(n(/*! ./test-if-fiber */"./node_modules/@skpm/timers/test-if-fiber.js")()){r=[];i=function(e,t,n,i,o,s,a,l,u,c,d,f){var h=r.length;return r.push(coscript.scheduleWithInterval_jsFunction((t||0)/1e3,function(){e(n,i,o,s,a,l,u,c,d,f)})),h},o=function(e){var t=r[e];t&&(t.cancel(),r[e]=void 0)}}else i=function(e,t,n,i,s,a,l,u,c,d,f,h){coscript.shouldKeepAround=!0;var m=r.length;return r.push(!0),coscript.scheduleWithInterval_jsFunction((t||0)/1e3,function(){r[m]&&e(n,i,s,a,l,u,c,d,f,h),o(m),r.every(function(e){return!e})&&(coscript.shouldKeepAround=!1)}),m},o=function(e){r[e]=!1};e.exports={setTimeout:i,clearTimeout:o}},"./node_modules/mocha-js-delegate/index.js":
/*!*************************************************!*\
!*** ./node_modules/mocha-js-delegate/index.js ***!
\*************************************************/
/*! no static exports found */function(module,exports){module.exports=function MochaDelegate(definition,superclass){var uniqueClassName="MochaJSDelegate_DynamicClass_"+NSUUID.UUID().UUIDString(),delegateClassDesc=MOClassDescription.allocateDescriptionForClassWithName_superclass_(uniqueClassName,superclass||NSObject),handlers={},ivars={};function setHandlerForSelector(selectorString,func){var handlerHasBeenSet=selectorString in handlers,selector=NSSelectorFromString(selectorString);if(handlers[selectorString]=func,!handlerHasBeenSet){for(var args=[],regex=/:/g;regex.exec(selectorString);)args.push("arg"+args.length);var dynamicFunction=eval("(function ("+args.join(", ")+") { return handlers[selectorString].apply(this, arguments); })");delegateClassDesc.addInstanceMethodWithSelector_function(selector,dynamicFunction)}}function setIvar(e,t){var n=e in handlers;if(ivars[e]=t,!n){delegateClassDesc.addInstanceVariableWithName_typeEncoding(e,"@");var i=MOPropertyDescription.new();i.name=e,i.typeEncoding="@",i.weak=!0,i.ivarName=e,delegateClassDesc.addProperty(i)}}this.getClass=function(){return NSClassFromString(uniqueClassName)},this.getClassInstance=function(e){var t=NSClassFromString(uniqueClassName).new();return Object.keys(ivars).forEach(function(e){t[e]=ivars[e]}),Object.keys(e||{}).forEach(function(n){t[n]=e[n]}),t},this.new=this.getClassInstance,"object"==typeof definition&&Object.keys(definition).forEach(function(e){"function"==typeof definition[e]?setHandlerForSelector(e,definition[e]):setIvar(e,definition[e])}),delegateClassDesc.registerClass()}},"./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */function(e,t,n){(function(t,n){var i,o,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(i===t)return t(e,0);if((i===s||!i)&&t)return i=t,t(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof t?t:s}catch(e){i=s}try{o="function"==typeof n?n:a}catch(e){o=a}}();var u,c=[],d=!1,f=-1;function h(){d&&u&&(d=!1,u.length?c=u.concat(c):f=-1,c.length&&m())}function m(){if(!d){var e=l(h);d=!0;for(var t=c.length;t;){for(u=c,c=[];++f<t;)u&&u[f].run();f=-1,t=c.length}u=null,d=!1,function(e){if(o===n)return n(e);if((o===a||!o)&&n)return o=n,n(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function g(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];c.push(new p(e,t)),1!==c.length||d||l(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=g,r.addListener=g,r.once=g,r.off=g,r.removeListener=g,r.removeAllListeners=g,r.emit=g,r.prependListener=g,r.prependOnceListener=g,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}}).call(this,n(/*! ./node_modules/@skpm/timers/timeout.js */"./node_modules/@skpm/timers/timeout.js").setTimeout,n(/*! ./node_modules/@skpm/timers/timeout.js */"./node_modules/@skpm/timers/timeout.js").clearTimeout)},"./node_modules/promise-polyfill/lib/index.js":
/*!****************************************************!*\
!*** ./node_modules/promise-polyfill/lib/index.js ***!
\****************************************************/
/*! no static exports found */function(e,t,n){"use strict";(function(t,n){var i=t;function o(){}function r(e){if(!(this instanceof r))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function s(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,r._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var i;try{i=n(e._value)}catch(e){return void l(t.promise,e)}a(t.promise,i)}else(1===e._state?a:l)(t.promise,e._value)})):e._deferreds.push(t)}function a(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof r)return e._state=3,e._value=t,void u(e);if("function"==typeof n)return void c(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,u(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&r._immediateFn(function(){e._handled||r._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)s(e,e._deferreds[t]);e._deferreds=null}function c(e,t){var n=!1;try{e(function(e){n||(n=!0,a(t,e))},function(e){n||(n=!0,l(t,e))})}catch(e){if(n)return;n=!0,l(t,e)}}r.prototype.catch=function(e){return this.then(null,e)},r.prototype.then=function(e,t){var n=new this.constructor(o);return s(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},r.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})},r.all=function(e){return new r(function(t,n){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(e);if(0===i.length)return t([]);var o=i.length;function r(e,s){try{if(s&&("object"==typeof s||"function"==typeof s)){var a=s.then;if("function"==typeof a)return void a.call(s,function(t){r(e,t)},n)}i[e]=s,0==--o&&t(i)}catch(e){n(e)}}for(var s=0;s<i.length;s++)r(s,i[s])})},r.resolve=function(e){return e&&"object"==typeof e&&e.constructor===r?e:new r(function(t){t(e)})},r.reject=function(e){return new r(function(t,n){n(e)})},r.race=function(e){return new r(function(t,n){for(var i=0,o=e.length;i<o;i++)e[i].then(t,n)})},r._immediateFn="function"==typeof n&&function(e){n(e)}||function(e){i(e,0)},r._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},e.exports=r}).call(this,n(/*! ./node_modules/@skpm/timers/timeout.js */"./node_modules/@skpm/timers/timeout.js").setTimeout,n(/*! ./node_modules/@skpm/timers/immediate.js */"./node_modules/@skpm/timers/immediate.js").setImmediate)},"./node_modules/safe-buffer/index.js":
/*!*******************************************!*\
!*** ./node_modules/safe-buffer/index.js ***!
\*******************************************/
/*! no static exports found */function(e,t,n){var i=n(/*! buffer */"buffer"),o=i.Buffer;function r(e,t){for(var n in e)t[n]=e[n]}function s(e,t,n){return o(e,t,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=i:(r(i,t),t.Buffer=s),r(o,s),s.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return o(e,t,n)},s.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=o(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},s.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return o(e)},s.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i.SlowBuffer(e)}},"./node_modules/sketch-module-web-view/lib/browser-api.js":
/*!****************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/browser-api.js ***!
\****************************************************************/
/*! no static exports found */function(e,t){e.exports=function(e,t,n){function i(n){e.isVisible()&&(n?(NSApplication.sharedApplication().activateIgnoringOtherApps(!0),t.makeKeyAndOrderFront(null)):(t.orderBack(null),NSApp.mainWindow().makeKeyAndOrderFront(null)))}e._panel=t,e._webview=n,e._destroyed=!1,e.destroy=function(){return t.close()},e.close=function(){if(t.delegate().utils&&t.delegate().utils.parentWindow){var n=!0;return e.emit("close",{get defaultPrevented(){return!n},preventDefault:function(){n=!1}}),void(n&&t.delegate().utils.parentWindow.endSheet(t))}e.isClosable()&&t.performClose(null)},e.focus=i.bind(this,!0),e.blur=i.bind(this,!1),e.isFocused=function(){return t.isKeyWindow()},e.isDestroyed=function(){return e._destroyed},e.show=function(){return NSApp.activateIgnoringOtherApps(!0),t.delegate().utils&&t.delegate().utils.parentWindow?t.delegate().utils.parentWindow.beginSheet_completionHandler(t,__mocha__.createBlock_function("v16@?0q8",function(){e.emit("closed")})):t.makeKeyAndOrderFront(null)},e.showInactive=function(){return t.orderFrontRegardless()},e.hide=function(){return t.orderOut(null)},e.isVisible=function(){return t.isVisible()},e.isModal=function(){return!1},e.maximize=function(){e.isMaximized()||t.zoom(null)},e.unmaximize=function(){e.isMaximized()&&t.zoom(null)},e.isMaximized=function(){if(0!=(t.styleMask()&NSResizableWindowMask))return t.isZoomed();var e=NSScreen.mainScreen().visibleFrame(),n=t.frame();return e.origin.x==n.origin.x&&e.origin.y==n.origin.y&&e.size.width==n.size.width&&e.size.height==n.size.height},e.minimize=function(){return t.miniaturize(null)},e.restore=function(){return t.deminiaturize(null)},e.isMinimized=function(){return t.isMiniaturized()},e.setFullScreen=function(n){n!==e.isFullscreen()&&t.toggleFullScreen(null)},e.isFullscreen=function(){return t.styleMask()&NSFullScreenWindowMask},e.setAspectRatio=function(e){e>0?t.setAspectRatio(NSMakeSize(e,1)):t.setResizeIncrements(NSMakeSize(1,1))},e.setBounds=function(n,i){if(!n)return;if(e.isFullscreen())return;const o=Object.assign(e.getBounds(),n);var r=NSMakeRect(o.x,0,o.width,o.height),s=NSScreen.screens().firstObject();r.origin.y=NSHeight(s.frame())-o.y,t.setFrame_display_animate(r,!0,i)},e.getBounds=function(){const e=t.frame();var n=NSScreen.screens().firstObject().frame();return{x:e.origin.x,y:Math.round(NSHeight(n)-e.origin.y),width:e.size.width,height:e.size.height}},e.setContentBounds=function(t,n){e.setBounds(t,n)},e.getContentBounds=function(){return e.getBounds()},e.setSize=function(t,n,i){return e.setBounds({width:t,height:n},i)},e.getSize=function(){var t=e.getBounds();return[t.width,t.height]},e.setContentSize=function(t,n,i){return e.setContentBounds({width:t,height:n},i)},e.getContentSize=function(){var t=e.getContentBounds();return[t.width,t.height]},e.setMinimumSize=function(e,n){const i=CGSizeMake(e,n);t.setContentMinSize(i)},e.getMinimumSize=function(){const e=t.contentMinSize();return[e.width,e.height]},e.setMaximumSize=function(e,n){const i=CGSizeMake(e,n);t.setContentMaxSize(i)},e.getMaximumSize=function(){const e=t.contentMaxSize();return[e.width,e.height]},e.setResizable=function(t){return e._setStyleMask(t,NSResizableWindowMask)},e.isResizable=function(){return t.styleMask()&NSResizableWindowMask},e.setMovable=function(e){return t.setMovable(e)},e.isMovable=function(){return t.isMovable()},e.setMinimizable=function(t){return e._setStyleMask(t,NSMiniaturizableWindowMask)},e.isMinimizable=function(){return t.styleMask()&NSMiniaturizableWindowMask},e.setMaximizable=function(e){t.standardWindowButton(NSWindowZoomButton)&&t.standardWindowButton(NSWindowZoomButton).setEnabled(e)},e.isMaximizable=function(){return t.standardWindowButton(NSWindowZoomButton)&&t.standardWindowButton(NSWindowZoomButton).isEnabled()},e.setFullScreenable=function(t){e._setCollectionBehavior(t,NSWindowCollectionBehaviorFullScreenPrimary),e._setCollectionBehavior(!t,NSWindowCollectionBehaviorFullScreenAuxiliary)},e.isFullScreenable=function(){return t.collectionBehavior()&NSWindowCollectionBehaviorFullScreenPrimary},e.setClosable=function(t){e._setStyleMask(t,NSClosableWindowMask)},e.isClosable=function(){return t.styleMask()&NSClosableWindowMask},e.setAlwaysOnTop=function(e,n,i){var o=NSNormalWindowLevel,r=CGWindowLevelForKey(kCGMaximumWindowLevelKey),s=CGWindowLevelForKey(kCGMinimumWindowLevelKey);e&&(o="normal"===n?NSNormalWindowLevel:"torn-off-menu"===n?NSTornOffMenuWindowLevel:"modal-panel"===n?NSModalPanelWindowLevel:"main-menu"===n?NSMainMenuWindowLevel:"status"===n?NSStatusWindowLevel:"pop-up-menu"===n?NSPopUpMenuWindowLevel:"screen-saver"===n?NSScreenSaverWindowLevel:"dock"===n?NSDockWindowLevel:NSFloatingWindowLevel);var a=o+(i||0);if(!(a>=s&&a<=r))throw new Error("relativeLevel must be between "+s+" and "+r);t.setLevel(a)},e.isAlwaysOnTop=function(){return t.level()!==NSNormalWindowLevel},e.moveTop=function(){return t.orderFrontRegardless()},e.center=function(){t.center()},e.setPosition=function(t,n,i){return e.setBounds({x:t,y:n},i)},e.getPosition=function(){var t=e.getBounds();return[t.x,t.y]},e.setTitle=function(e){t.setTitle(e)},e.getTitle=function(){return String(t.title())};var o=0;e.flashFrame=function(e){e?o=NSApp.requestUserAttention(NSInformationalRequest):(NSApp.cancelUserAttentionRequest(o),o=0)},e.getNativeWindowHandle=function(){return t},e.getNativeWebViewHandle=function(){return n},e.loadURL=function(e){if(/^(?!https?|file).*\.html?$/.test(e)&&"undefined"!=typeof __command&&__command.pluginBundle()&&(e="file://"+__command.pluginBundle().urlForResourceNamed(e).path()),/^file:\/\/.*\.html?$/.test(e))return e=(e=NSString.alloc().initWithString(e)).stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLQueryAllowedCharacterSet()),void n.loadFileURL_allowingReadAccessToURL(NSURL.URLWithString(e),NSURL.URLWithString("file:///"));const t=NSURL.URLWithString(e),i=NSURLRequest.requestWithURL(t);n.loadRequest(i)},e.reload=function(){n.reload()},e.setHasShadow=function(e){return t.setHasShadow(e)},e.hasShadow=function(){return t.hasShadow()},e.setOpacity=function(e){return t.setAlphaValue(e)},e.getOpacity=function(){return t.alphaValue()},e.setVisibleOnAllWorkspaces=function(t){return e._setCollectionBehavior(t,NSWindowCollectionBehaviorCanJoinAllSpaces)},e.isVisibleOnAllWorkspaces=function(){return t.collectionBehavior()&NSWindowCollectionBehaviorCanJoinAllSpaces},e.setIgnoreMouseEvents=function(e){return t.setIgnoresMouseEvents(e)},e.setContentProtection=function(e){t.setSharingType(e?NSWindowSharingNone:NSWindowSharingReadOnly)},e.setAutoHideCursor=function(e){t.setDisableAutoHideCursor(e)},e.setVibrancy=function(n){var i=e._vibrantView;if(!n){if(null==i)return;return i.removeFromSuperview(),void t.setVibrantView(null)}if(null==i){var o=t.contentView();i=NSVisualEffectView.alloc().initWithFrame(o.bounds()),e._vibrantView=i,i.setAutoresizingMask(NSViewWidthSizable|NSViewHeightSizable),i.setBlendingMode(NSVisualEffectBlendingModeBehindWindow),i.setState(NSVisualEffectStateActive),i.setFrame(o.bounds()),o.addSubview_positioned_relativeTo(i,NSWindowBelow,null)}var r=NSVisualEffectMaterialLight;"appearance-based"===n?r=NSVisualEffectMaterialAppearanceBased:"light"===n?r=NSVisualEffectMaterialLight:"dark"===n?r=NSVisualEffectMaterialDark:"titlebar"===n?r=NSVisualEffectMaterialTitlebar:"selection"===n?r=NSVisualEffectMaterialSelection:"menu"===n?r=NSVisualEffectMaterialMenu:"popover"===n?r=NSVisualEffectMaterialPopover:"sidebar"===n?r=NSVisualEffectMaterialSidebar:"medium-light"===n?r=NSVisualEffectMaterialMediumLight:"ultra-dark"===n&&(r=NSVisualEffectMaterialUltraDark),i.setMaterial(r)},e._setBackgroundColor=function(e){var i=function(e){if(!e||"#"!==e[0]){if(e&&"function"==typeof e.isKindOfClass&&e.isKindOfClass(NSColor))return e;throw new Error("Incorrect color formating. It should be an hex color: #RRGGBBAA")}var t,n=e.substr(1);if(3===n.length?n+="F":6===n.length&&(n+="FF"),4===n.length)for(var i=0;i<4;i+=1)t+=n[i],t+=n[i];else{if(8!==n.length)return NSColor.whiteColor();t=n}var o=parseInt(t.slice(0,2),16),r=parseInt(t.slice(2,4),16),s=parseInt(t.slice(4,6),16),a=parseInt(t.slice(6,8),16);return NSColor.colorWithSRGBRed_green_blue_alpha(o,r,s,a)}(e);n.setValue_forKey(!1,"drawsBackground"),t.backgroundColor=i},e._invalidate=function(){t.flushWindow(),t.contentView().setNeedsDisplay(!0)},e._setStyleMask=function(n,i){var o=e.isMaximizable();n?t.setStyleMask(t.styleMask()|i):t.setStyleMask(t.styleMask()&~i),e.setMaximizable(o)},e._setCollectionBehavior=function(n,i){var o=e.isMaximizable();n?t.setCollectionBehavior(t.collectionBehavior()|i):t.setCollectionBehavior(t.collectionBehavior()&~i),e.setMaximizable(o)},e._showWindowButton=function(e){var n=t.standardWindowButton(e);n.superview().addSubview_positioned_relative(n,NSWindowAbove,null)}}},"./node_modules/sketch-module-web-view/lib/constants.js":
/*!**************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/constants.js ***!
\**************************************************************/
/*! no static exports found */function(e,t){e.exports={JS_BRIDGE:"__skpm_sketchBridge",START_MOVING_WINDOW:"__skpm_startMovingWindow",EXECUTE_JAVASCRIPT:"__skpm_executeJS",EXECUTE_JAVASCRIPT_SUCCESS:"__skpm_executeJS_success_",EXECUTE_JAVASCRIPT_ERROR:"__skpm_executeJS_error_"}},"./node_modules/sketch-module-web-view/lib/dispatch-first-click.js":
/*!*************************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/dispatch-first-click.js ***!
\*************************************************************************/
/*! no static exports found */function(e,t){e.exports=function(e,t){var n=e.convertPoint_fromView(t.locationInWindow(),null);return"var el = document.elementFromPoint("+n.x+", "+n.y+'); if (el && ["text", "textarea", "date", "datetime-local", "email", "number", "month", "password", "search", "tel", "time", "url", "week" ].indexOf(el.type) >= 0 && el.focus) {el.focus();} else if (el) {el.dispatchEvent(new Event("click", {bubbles: true}))}'}},"./node_modules/sketch-module-web-view/lib/execute-javascript.js":
/*!***********************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/execute-javascript.js ***!
\***********************************************************************/
/*! no static exports found */function(e,t,n){(function(t){var i=n(/*! ./constants */"./node_modules/sketch-module-web-view/lib/constants.js");e.exports=function(n,o){return function r(s,a,l){"function"==typeof a&&(l=a,a=!1);var u=coscript.createFiber();return n.navigationDelegate().state&&0==n.navigationDelegate().state.wasReady?new t(function(e,t){o.once("ready-to-show",function(){r(s,a,l).then(e).catch(t),u.cleanup()})}):new t(function(t,r){var a=Math.random();o.webContents.on(i.EXECUTE_JAVASCRIPT_SUCCESS+a,function(e){try{l&&l(null,e),t(e)}catch(e){r(e)}u.cleanup()}),o.webContents.on(i.EXECUTE_JAVASCRIPT_ERROR+a,function(e){try{l?(l(e),t()):r(e)}catch(e){r(e)}u.cleanup()}),n.evaluateJavaScript_completionHandler(e.exports.wrapScript(s,a),null)})}},e.exports.wrapScript=function(e,t){return"window."+i.EXECUTE_JAVASCRIPT+"("+t+", "+JSON.stringify(e)+")"},e.exports.injectScript=function(e){var t="window."+i.EXECUTE_JAVASCRIPT+' = function(id, script) { try { var res = eval(script); if (res && typeof res.then === "function" && typeof res.catch === "function") { res.then(function (res2) { window.postMessage("'+i.EXECUTE_JAVASCRIPT_SUCCESS+'" + id, res2); }) .catch(function (err) { window.postMessage("'+i.EXECUTE_JAVASCRIPT_ERROR+'" + id, err); }) } else { window.postMessage("'+i.EXECUTE_JAVASCRIPT_SUCCESS+'" + id, res); } } catch (err) { window.postMessage("'+i.EXECUTE_JAVASCRIPT_ERROR+'" + id, err); }}',n=WKUserScript.alloc().initWithSource_injectionTime_forMainFrameOnly(t,0,!0);e.configuration().userContentController().addUserScript(n)}}).call(this,n(/*! ./node_modules/promise-polyfill/lib/index.js */"./node_modules/promise-polyfill/lib/index.js"))},"./node_modules/sketch-module-web-view/lib/fitSubview.js":
/*!***************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/fitSubview.js ***!
\***************************************************************/
/*! no static exports found */function(e,t){function n(e,t,n,i){n.addConstraint(NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant(t,e,NSLayoutRelationEqual,n,e,1,i))}e.exports=function(e,t,i){i=i||[],e.setTranslatesAutoresizingMaskIntoConstraints(!1),n(NSLayoutAttributeLeft,e,t,i[0]||0),n(NSLayoutAttributeTop,e,t,i[1]||0),n(NSLayoutAttributeRight,e,t,i[2]||0),n(NSLayoutAttributeBottom,e,t,i[3]||0)}},"./node_modules/sketch-module-web-view/lib/index.js":
/*!**********************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/index.js ***!
\**********************************************************/
/*! no static exports found */function(e,t,n){var i=n(/*! events */"events"),o=n(/*! ./browser-api */"./node_modules/sketch-module-web-view/lib/browser-api.js"),r=n(/*! ./webview-api */"./node_modules/sketch-module-web-view/lib/webview-api.js"),s=n(/*! ./fitSubview */"./node_modules/sketch-module-web-view/lib/fitSubview.js"),a=n(/*! ./dispatch-first-click */"./node_modules/sketch-module-web-view/lib/dispatch-first-click.js"),l=n(/*! ./inject-client-messaging */"./node_modules/sketch-module-web-view/lib/inject-client-messaging.js"),u=n(/*! ./movable-area */"./node_modules/sketch-module-web-view/lib/movable-area.js"),c=n(/*! ./execute-javascript */"./node_modules/sketch-module-web-view/lib/execute-javascript.js"),d=n(/*! ./set-delegates */"./node_modules/sketch-module-web-view/lib/set-delegates.js");function f(e){var t=(e=e||{}).identifier||NSUUID.UUID().UUIDString(),n=NSThread.mainThread().threadDictionary(),h=f.fromId(t);if(h)return h;var m=new i;if(m.id=t,e.modal&&!e.parent)throw new Error("A modal needs to have a parent.");var p=coscript.createFiber(),g=e.width||800,w=e.height||600,v=NSScreen.screens().firstObject().frame(),S=NSMakeRect(void 0!==e.x?e.x:Math.round((NSWidth(v)-g)/2),void 0!==e.y?NSHeight(v)-e.y:Math.round((NSHeight(v)-w)/2),g,w);e.titleBarStyle&&"default"!==e.titleBarStyle&&(e.frame=!1);var b="textured"!==e.windowType,y=NSTitledWindowMask;!1!==e.minimizable&&(y|=NSMiniaturizableWindowMask),!1!==e.closable&&(y|=NSClosableWindowMask),!1!==e.resizable&&(y|=NSResizableWindowMask),b&&!e.transparent&&!1!==e.frame||(y|=NSTexturedBackgroundWindowMask);var _=NSPanel.alloc().initWithContentRect_styleMask_backing_defer(S,y,NSBackingStoreBuffered,!0),N=WKWebViewConfiguration.alloc().init(),k=WKWebView.alloc().initWithFrame_configuration(CGRectMake(0,0,e.width||800,e.height||600),N);if(l(k),k.setAutoresizingMask(NSViewWidthSizable|NSViewHeightSizable),o(m,_,k),r(m,_,k),d(m,_,k,e),"desktop"===e.windowType&&(_.setLevel(kCGDesktopWindowLevel-1),_.setCollectionBehavior(NSWindowCollectionBehaviorCanJoinAllSpaces|NSWindowCollectionBehaviorStationary|NSWindowCollectionBehaviorIgnoresCycle)),void 0===e.minWidth&&void 0===e.minHeight||m.setMinimumSize(e.minWidth||0,e.minHeight||0),void 0===e.maxWidth&&void 0===e.maxHeight||m.setMaximumSize(e.maxWidth||1e4,e.maxHeight||1e4),e.transparent||!1===e.frame){_.titlebarAppearsTransparent=!0,_.titleVisibility=NSWindowTitleHidden,_.setOpaque(0),_.isMovableByWindowBackground=!0;var C=NSToolbar.alloc().initWithIdentifier("titlebarStylingToolbar");C.setShowsBaselineSeparator(!1),_.setToolbar(C)}if("hiddenInset"===e.titleBarStyle){var M=NSToolbar.alloc().initWithIdentifier("titlebarStylingToolbar");M.setShowsBaselineSeparator(!1),_.setToolbar(M)}!1!==e.frame&&e.useContentSize||m.setSize(g,w),e.center&&m.center(),e.alwaysOnTop&&m.setAlwaysOnTop(!0),e.fullscreen&&m.setFullScreen(!0),m.setFullScreenable(!!e.fullscreenable);const x=e.title||("undefined"!=typeof __command&&__command.pluginBundle()?__command.pluginBundle().name():void 0);x&&m.setTitle(x);var W=e.backgroundColor;e.transparent&&(W=NSColor.clearColor()),!W&&!1===e.frame&&e.vibrancy&&(W=NSColor.clearColor()),m._setBackgroundColor(W||NSColor.windowBackgroundColor()),!1===e.hasShadow&&m.setHasShadow(!1),void 0!==e.opacity&&m.setOpacity(e.opacity),e.webPreferences=e.webPreferences||{},k.configuration().preferences().setValue_forKey(!1!==e.webPreferences.devTools,"developerExtrasEnabled"),k.configuration().preferences().setValue_forKey(!1!==e.webPreferences.javascript,"javaScriptEnabled"),k.configuration().preferences().setValue_forKey(!!e.webPreferences.plugins,"plugInsEnabled"),k.configuration().preferences().setValue_forKey(e.webPreferences.minimumFontSize||0,"minimumFontSize"),e.webPreferences.zoomFactor&&k.setMagnification(e.webPreferences.zoomFactor);var E=_.contentView();return!1!==e.frame?(k.setFrame(E.bounds()),E.addSubview(k)):(E.setAutoresizingMask(NSViewWidthSizable|NSViewHeightSizable),s(E,E.superview()),k.setFrame(E.bounds()),E.addSubview(k),_.standardWindowButton(NSWindowFullScreenButton)&&_.standardWindowButton(NSWindowFullScreenButton).setHidden(!0),e.titleBarStyle&&"default"!==e.titleBarStyle||(_.standardWindowButton(NSWindowZoomButton).setHidden(!0),_.standardWindowButton(NSWindowMiniaturizeButton).setHidden(!0),_.standardWindowButton(NSWindowCloseButton).setHidden(!0),_.standardWindowButton(NSWindowZoomButton).setEnabled(!1))),e.vibrancy&&m.setVibrancy(e.vibrancy),m.setMaximizable(!1!==e.maximizable),_.setHidesOnDeactivate(!1!==e.hidesOnDeactivate),e.remembersWindowFrame&&(_.setFrameAutosaveName(t),_.setFrameUsingName_force(_.frameAutosaveName(),!1)),e.acceptsFirstMouse&&m.on("focus",function(e){e.type()===NSEventTypeLeftMouseDown&&m.webContents.executeJavaScript(a(k,e)).catch(()=>{})}),c.injectScript(k),u.injectScript(k),u.setupHandler(m),!1!==e.show&&m.show(),m.on("closed",function(){m._destroyed=!0,n.removeObjectForKey(t),p.cleanup()}),n[t]=_,p.onCleanup(function(){m._destroyed||m.destroy()}),m}f.fromId=function(e){var t=NSThread.mainThread().threadDictionary();if(t[e])return f.fromPanel(t[e],e)},f.fromPanel=function(e,t){var n=new i;if(n.id=t,!e||!e.contentView)throw new Error("needs to pass an NSPanel");for(var s=null,a=e.contentView().subviews(),l=0;l<a.length;l+=1)s||a[l].isKindOfClass(WKInspectorWKWebView)||!a[l].isKindOfClass(WKWebView)||(s=a[l]);if(!s)throw new Error("The panel needs to have a webview");return o(n,e,s),r(n,e,s),n},e.exports=f},"./node_modules/sketch-module-web-view/lib/inject-client-messaging.js":
/*!****************************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/inject-client-messaging.js ***!
\****************************************************************************/
/*! no static exports found */function(e,t,n){var i=n(/*! ./constants */"./node_modules/sketch-module-web-view/lib/constants.js");e.exports=function(e){var t="window.originalPostMessage = window.postMessage;window.postMessage = function(actionName) {if (!actionName) {throw new Error('missing action name')}window.webkit.messageHandlers."+i.JS_BRIDGE+".postMessage(JSON.stringify([].slice.call(arguments)));}",n=WKUserScript.alloc().initWithSource_injectionTime_forMainFrameOnly(t,0,!0);e.configuration().userContentController().addUserScript(n)}},"./node_modules/sketch-module-web-view/lib/movable-area.js":
/*!*****************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/movable-area.js ***!
\*****************************************************************/
/*! no static exports found */function(e,t,n){(function(t,i){var o=n(/*! ./constants */"./node_modules/sketch-module-web-view/lib/constants.js");e.exports.injectScript=function(e){var t='(function () {document.addEventListener(\'mousedown\', onMouseDown);function shouldDrag(target) { if (!target || (target.dataset || {}).appRegion === "no-drag") { return false } if ((target.dataset || {}).appRegion === "drag") { return true } return shouldDrag(target.parentElement)};function onMouseDown(e) {console.log(e); if (e.button !== 0 || !shouldDrag(e.target)) { return } window.postMessage("'+o.START_MOVING_WINDOW+'");};})()',n=WKUserScript.alloc().initWithSource_injectionTime_forMainFrameOnly(t,0,!0);e.configuration().userContentController().addUserScript(n)},e.exports.setupHandler=function(e){var n=null,r=null,s=null;function a(){if(!r||1!==NSEvent.pressedMouseButtons())return t(s),n=null,void(r=null);var i=NSEvent.mouseLocation();e.setPosition(r.x+(i.x-n.x),r.y+(n.y-i.y),!1)}e.webContents.on(o.START_MOVING_WINDOW,function(){n=NSEvent.mouseLocation();var t=e.getPosition();r={x:t[0],y:t[1]},s=i(a,1e3/60)})}}).call(this,n(/*! ./node_modules/@skpm/timers/interval.js */"./node_modules/@skpm/timers/interval.js").clearInterval,n(/*! ./node_modules/@skpm/timers/interval.js */"./node_modules/@skpm/timers/interval.js").setInterval)},"./node_modules/sketch-module-web-view/lib/parseWebArguments.js":
/*!**********************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/parseWebArguments.js ***!
\**********************************************************************/
/*! no static exports found */function(e,t){e.exports=function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t&&t.constructor&&t.constructor===Array&&0!=t.length?t:null}},"./node_modules/sketch-module-web-view/lib/set-delegates.js":
/*!******************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/set-delegates.js ***!
\******************************************************************/
/*! no static exports found */function(e,t,n){(function(t){var i,o,r,s=n(/*! mocha-js-delegate */"./node_modules/mocha-js-delegate/index.js"),a=n(/*! ./parseWebArguments */"./node_modules/sketch-module-web-view/lib/parseWebArguments.js"),l=n(/*! ./constants */"./node_modules/sketch-module-web-view/lib/constants.js");e.exports=function(e,n,u,c){i||(i=new s({utils:null,panel:null,"windowDidResize:":function(){this.utils.emit("resize")},"windowDidMiniaturize:":function(){this.utils.emit("minimize")},"windowDidDeminiaturize:":function(){this.utils.emit("restore")},"windowDidEnterFullScreen:":function(){this.utils.emit("enter-full-screen")},"windowDidExitFullScreen:":function(){this.utils.emit("leave-full-screen")},"windowDidMove:":function(){this.utils.emit("move"),this.utils.emit("moved")},"windowShouldClose:":function(){var e=1;return this.utils.emit("close",{get defaultPrevented(){return!e},preventDefault:function(){e=0}}),e},"windowWillClose:":function(){this.utils.emit("closed")},"windowDidBecomeKey:":function(){this.utils.emit("focus",this.panel.currentEvent())},"windowDidResignKey:":function(){this.utils.emit("blur")}})),o||(o=new s({state:{wasReady:0},utils:null,"webView:didCommitNavigation:":function(e){this.utils.emit("will-navigate",{},String(String(e.URL())))},"webView:didStartProvisionalNavigation:":function(){this.utils.emit("did-start-navigation"),this.utils.emit("did-start-loading")},"webView:didReceiveServerRedirectForProvisionalNavigation:":function(){this.utils.emit("did-get-redirect-request")},"webView:didFailProvisionalNavigation:withError:":function(e,t,n){this.utils.emit("did-fail-load",n)},"webView:didFinishNavigation:":function(){0==this.state.wasReady&&(this.state.wasReady=1,this.utils.emitBrowserEvent("ready-to-show")),this.utils.emit("did-navigate"),this.utils.emit("did-frame-navigate"),this.utils.emit("did-stop-loading"),this.utils.emit("did-finish-load"),this.utils.emit("did-frame-finish-load")},"webViewWebContentProcessDidTerminate:":function(){this.utils.emit("dom-ready")}})),r||(r=new s({utils:null,"userContentController:didReceiveScriptMessage:":function(e,t){var n=this.utils.parseWebArguments(String(t.body()));n&&n[0]&&"string"==typeof n[0]&&(n[0]=String(n[0]),this.utils.emit.apply(this,n))}}));var d=o.new({utils:{setTitle:e.setTitle.bind(e),emitBrowserEvent(){try{e.emit.apply(e,arguments)}catch(e){if(void 0===t||!t.listenerCount||!t.listenerCount("uncaughtException"))throw console.error(e),e;t.emit("uncaughtException",e,"uncaughtException")}},emit(){try{e.webContents.emit.apply(e.webContents,arguments)}catch(e){if(void 0===t||!t.listenerCount||!t.listenerCount("uncaughtException"))throw console.error(e),e;t.emit("uncaughtException",e,"uncaughtException")}}},state:{wasReady:0}});u.setNavigationDelegate(d);var f=r.new({utils:{emit(){try{e.webContents.emit.apply(e.webContents,arguments)}catch(e){if(void 0===t||!t.listenerCount||!t.listenerCount("uncaughtException"))throw console.error(e),e;t.emit("uncaughtException",e,"uncaughtException")}},parseWebArguments:a}});u.configuration().userContentController().addScriptMessageHandler_name(f,l.JS_BRIDGE);var h,m={emit(){try{e.emit.apply(e,arguments)}catch(e){if(void 0===t||!t.listenerCount||!t.listenerCount("uncaughtException"))throw console.error(e),e;t.emit("uncaughtException",e,"uncaughtException")}}};c.modal&&((h="Document"===c.parent.type?c.parent.sketchObject:c.parent)&&"MSDocumentData"===String(h.class())&&(h=h.delegate()),m.parentWindow=h.windowForSheet());var p=i.new({utils:m,panel:n});n.setDelegate(p)}}).call(this,n(/*! ./../../process/browser.js */"./node_modules/process/browser.js"))},"./node_modules/sketch-module-web-view/lib/webview-api.js":
/*!****************************************************************!*\
!*** ./node_modules/sketch-module-web-view/lib/webview-api.js ***!
\****************************************************************/
/*! no static exports found */function(e,t,n){var i=n(/*! events */"events"),o=n(/*! ./execute-javascript */"./node_modules/sketch-module-web-view/lib/execute-javascript.js");e.exports=function(e,t,n){var r=new i;r.loadURL=e.loadURL,r.loadFile=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.downloadURL=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.getURL=function(){return String(n.url())},r.getTitle=function(){return String(n.title())},r.isDestroyed=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.focus=e.focus,r.isFocused=e.isFocused,r.isLoading=function(){return!!n.loading()},r.isLoadingMainFrame=function(){return!!n.loading()},r.isWaitingForResponse=function(){return!n.loading()},r.stop=function(){n.stopLoading()},r.reload=function(){n.reload()},r.reloadIgnoringCache=function(){n.reloadFromOrigin()},r.canGoBack=function(){return!!n.canGoBack()},r.canGoForward=function(){return!!n.canGoForward()},r.canGoToOffset=function(e){return!!n.backForwardList().itemAtIndex(e)},r.clearHistory=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.goBack=function(){n.goBack()},r.goForward=function(){n.goForward()},r.goToIndex=function(e){var t=n.backForwardList(),i=t.backList(),o=i.count();if(o>e)n.loadRequest(NSURLRequest.requestWithURL(i[e]));else{var r=t.forwardList();if(!(r.count()>e-o))throw new Error("Cannot go to index "+e);n.loadRequest(NSURLRequest.requestWithURL(r[e-o]))}},r.goToOffset=function(e){if(!r.canGoToOffset(e))throw new Error("Cannot go to offset "+e);n.loadRequest(NSURLRequest.requestWithURL(n.backForwardList().itemAtIndex(e)))},r.isCrashed=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.setUserAgent=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.getUserAgent=function(){const e=n.customUserAgent();return e?String(e):void 0},r.insertCSS=function(e){var t="var style = document.createElement('style'); style.innerHTML = "+e.replace(/"/,'\\"')+"; document.head.appendChild(style);",i=WKUserScript.alloc().initWithSource_injectionTime_forMainFrameOnly(t,0,!0);n.configuration().userContentController().addUserScript(i)},r.insertJS=function(e){var t=WKUserScript.alloc().initWithSource_injectionTime_forMainFrameOnly(e,0,!0);n.configuration().userContentController().addUserScript(t)},r.executeJavaScript=o(n,e),r.setIgnoreMenuShortcuts=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.setAudioMuted=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.isAudioMuted=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.setZoomFactor=function(e){n.setMagnification_centeredAtPoint(e,CGPointMake(0,0))},r.getZoomFactor=function(e){e(Number(n.magnification()))},r.setZoomLevel=function(e){r.setZoomFactor(Math.pow(1.2,e))},r.getZoomLevel=function(e){e(Math.log(Number(n.magnification()))/Math.log(1.2))},r.setVisualZoomLevelLimits=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.setLayoutZoomLevelLimits=function(){console.warn("Not implemented yet, please open a PR on https://github.com/skpm/sketch-module-web-view :)")},r.send=function(){const e="window.postMessage({isSketchMessage: true,origin: '"+String(__command.identifier())+"',args: "+JSON.stringify([].slice.call(arguments))+'}, "*")';n.evaluateJavaScript_completionHandler(e,null)},r.getNativeWebview=function(){return n},e.webContents=r}},"./node_modules/string_decoder/lib/string_decoder.js":
/*!***********************************************************!*\
!*** ./node_modules/string_decoder/lib/string_decoder.js ***!
\***********************************************************/
/*! no static exports found */function(e,t,n){"use strict";var i=n(/*! safe-buffer */"./node_modules/safe-buffer/index.js").Buffer,o=i.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(i.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=l,this.end=u,t=4;break;case"utf8":this.fillLast=a,t=4;break;case"base64":this.text=c,this.end=d,t=3;break;default:return this.write=f,void(this.end=h)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(t)}function s(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function a(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function l(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function u(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function d(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function f(e){return e.toString(this.encoding)}function h(e){return e&&e.length?this.write(e):""}t.StringDecoder=r,r.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},r.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},r.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var o=s(t[i]);if(o>=0)return o>0&&(e.lastNeed=o-1),o;if(--i<n||-2===o)return 0;if((o=s(t[i]))>=0)return o>0&&(e.lastNeed=o-2),o;if(--i<n||-2===o)return 0;if((o=s(t[i]))>=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},r.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},"./resources/ui.html":
/*!***************************!*\
!*** ./resources/ui.html ***!
\***************************/
/*! no static exports found */function(e,t){e.exports="file://"+context.plugin.urlForResourceNamed("_webpack_resources/382e82375e9410380a7dc4f1a8818864.html").path()},"./src/__utils/subscription.js":
/*!*************************************!*\
!*** ./src/__utils/subscription.js ***!
\*************************************/
/*! exports provided: getLicenseKey, getVerificationNumber, isUserSubscribed, hasVerificationLapsed, setVerificationStatus */function(e,t,n){"use strict";n.r(t),n.d(t,"getLicenseKey",function(){return r}),n.d(t,"getVerificationNumber",function(){return s}),n.d(t,"isUserSubscribed",function(){return a}),n.d(t,"hasVerificationLapsed",function(){return l}),n.d(t,"setVerificationStatus",function(){return u});var i=n(/*! sketch/settings */"sketch/settings"),o=n.n(i);function r(){return o.a.settingForKey("com.stark.license-key")}function s(){return o.a.settingForKey("com.stark.verification")}function a(e){return null!==e&&""!==e&&void 0!==e&&"expired"!==o.a.settingForKey("com.stark.subscription-status")}function l(e){return e<(new Date).getMonth()}function u(e,t){o.a.setSettingForKey("com.stark.subscription-status",e),t&&o.a.setSettingForKey("com.stark.verification",(new Date).getMonth())}},"./src/colorblind.js":
/*!***************************!*\
!*** ./src/colorblind.js ***!
\***************************/
/*! exports provided: default */function(e,t,n){"use strict";n.r(t);var i=n(/*! sketch */"sketch"),o=n.n(i),r=(n(/*! sketch/dom */"sketch/dom"),n(/*! sketch/settings */"sketch/settings")),s=n.n(r),a=n(/*! sketch-module-web-view */"./node_modules/sketch-module-web-view/lib/index.js"),l=n.n(a),u=n(/*! sketch/ui */"sketch/ui"),c=n.n(u);n(/*! ./__utils/subscription */"./src/__utils/subscription.js"),n(/*! string_decoder */"./node_modules/string_decoder/lib/string_decoder.js").StringDecoder;function d(e){var t=[];return e.selectedPage.layers.forEach(function(e){("Artboard"===e.type||"SymbolMaster"===e.type)&&t.push({id:e.id,name:e.name})}),t.reverse()}function f(e){return o.a.export(e,{scales:"2",formats:"png",output:!1})}t.default=function(e){var t=s.a.settingForKey("com.stark.mixpanel-unique-id");t||(t=generateMixpanelId(),s.a.setSettingForKey("com.stark.mixpanel-unique-id",t));var i=o.a.getSelectedDocument(),r=d(i),a=function(e){var t="";e.selectedLayers.layers.forEach(function(e){t=e.sketchObject.parentArtboard()}),t=t?t.objectID():"stark_none";return t}(i);if("stark_none"===a&&i.selectedLayers.layers.length>0)c.a.message("The colorblind simulation can only be run on artboards.");else if(r.length>0){var u=new l.a({identifier:"stark.colorblind",frame:!1,height:668,width:610,resizable:!1,alwaysOnTop:!0,backgroundColor:"#FFF"}),h=u.webContents;h.on("did-finish-load",function(e){var t={artboardNames:d(o.a.getSelectedDocument()),subscription:{licenseKey:s.a.settingForKey("com.stark.license-key"),status:s.a.settingForKey("com.stark.subscription-status"),email:s.a.settingForKey("com.stark.email"),frequency:s.a.settingForKey("com.stark.frequency"),verificationDate:s.a.settingForKey("com.stark.verification")}};h.executeJavaScript("prepareFirstLoad('Show Colorblind Simulation', '".concat(JSON.stringify(t),"')")).catch(console.error)}),h.on("colorblindDialogMounted",function(){var e="stark_none"!==a?a:r[0].id,n=i.getLayerWithID(e),o=f(n),l=new Uint8Array(o.buffer),u=[n.frame.width,n.frame.height],c={artboardNames:r,sizeData:u,subscription:{licenseKey:s.a.settingForKey("com.stark.license-key"),status:s.a.settingForKey("com.stark.subscription-status"),email:s.a.settingForKey("com.stark.email"),frequency:s.a.settingForKey("com.stark.frequency"),verificationDate:s.a.settingForKey("com.stark.verification")}};h.executeJavaScript("prepareFirstLoad('Show Colorblind Simulation', '".concat(JSON.stringify(c),"', '").concat(l,"')")).catch(console.error),h.executeJavaScript("handleMixpanelEvent('Opened Plugin', '".concat(JSON.stringify({distinct_id:t,eventDetailsPrimary:"Colorblind Simulation"}),"')")).catch(console.error)}),h.on("artboardChanged",function(e){var n=JSON.parse(e),o=i.getLayerWithID(n.artboardToSim),r=f(o),s=new Uint8Array(r.buffer),a={sizeData:[o.frame.width,o.frame.height]};h.executeJavaScript("handleArtboardChange('Handle Artboard Changed', '".concat(JSON.stringify(a),"', '").concat(s,"')")).catch(console.error),h.executeJavaScript("handleMixpanelEvent('Artboard Changed', '".concat(JSON.stringify({distinct_id:t,eventDetailsPrimary:"Current Simulation: ".concat(n.colorblindType)}),"')")).catch(console.error)}),h.on("zoomChanged",function(e){var n=JSON.parse(e);h.executeJavaScript("handleMixpanelEvent('Zoom Changed', '".concat(JSON.stringify({distinct_id:t,eventDetailsPrimary:n.zoomValue,eventDetailsSecondary:"Current Simulation: ".concat(n.colorblindType)}),"')")).catch(console.error)}),h.on("colorblindTypeChanged",function(e){var n=JSON.parse(e);h.executeJavaScript("handleMixpanelEvent('Colorblind Type Changed', '".concat(JSON.stringify({distinct_id:t,eventDetailsPrimary:n.colorblindTypeValue}),"')")).catch(console.error)}),h.on("cancelButtonClicked",function(){u.close()}),h.on("purchaseButtonClicked",function(){h.executeJavaScript("handleMixpanelEvent('Upgrade Clicked', '".concat(JSON.stringify({distinct_id:t,eventDetailsPrimary:"On Colorblind Simulation Screen"}),"')")).catch(console.error),NSWorkspace.sharedWorkspace().openURL(NSURL.URLWithString("http://getstark.co/pricing"))}),h.on("activateButtonClicked",function(e){s.a.setSettingForKey("com.stark.license-key",e.licenseKey),s.a.setSettingForKey("com.stark.subscription-status",e.status),s.a.setSettingForKey("com.stark.email",e.email),s.a.setSettingForKey("com.stark.frequency",e.frequency),s.a.setSettingForKey("com.stark.verification",(new Date).getMonth())}),u.loadURL(n(/*! ../resources/ui.html */"./resources/ui.html"))}else c.a.message("You need at least one artboard to run the colorblind simulation.")}},buffer:
/*!*************************!*\
!*** external "buffer" ***!
\*************************/
/*! no static exports found */function(e,t){e.exports=require("buffer")},events:
/*!*************************!*\
!*** external "events" ***!
\*************************/
/*! no static exports found */function(e,t){e.exports=require("events")},sketch:
/*!*************************!*\
!*** external "sketch" ***!
\*************************/
/*! no static exports found */function(e,t){e.exports=require("sketch")},"sketch/dom":
/*!*****************************!*\
!*** external "sketch/dom" ***!
\*****************************/
/*! no static exports found */function(e,t){e.exports=require("sketch/dom")},"sketch/settings":
/*!**********************************!*\
!*** external "sketch/settings" ***!
\**********************************/
/*! no static exports found */function(e,t){e.exports=require("sketch/settings")},"sketch/ui":
/*!****************************!*\
!*** external "sketch/ui" ***!
\****************************/
/*! no static exports found */function(e,t){e.exports=require("sketch/ui")}});"default"===key&&"function"==typeof exports?exports(context):exports[key](context)}that.onRun=__skpm_run.bind(this,"default");