-
-
Notifications
You must be signed in to change notification settings - Fork 162
/
Copy pathmain.js
10 lines (10 loc) · 44.2 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=5)}([function(t,e){t.exports={ARTBOARD_TYPE:"Artboard",LAYER_TYPE:"Layer",INTERACTIONS:{NONE:"none",GO_TO_ARTBOARD:"goToArtboard",GO_BACK:"goBack",OVERLAY:"overlay"},DOCUMENT_NO_EXIST_ERROR:"Document does not exist",NETWORK_ERROR:"TypeError: Network request failed",PNG_FORMAT:"png",JPG_FORMAT:"jpg"}},function(t,e){t.exports=require("application")},function(t,e,n){const{DOCUMENT_NO_EXIST_ERROR:r,JPG_FORMAT:o}=n(0),s=({documentId:t})=>fetch("https://sl-api.maze.design/adobexd/prototype/"+t,{headers:{"Content-Type":"application/json"}}).then(t=>{if(200===t.status)return t;throw Error(r)}).then(t=>t.json());t.exports={getSignedUrl:({documentId:t,screenId:e,format:n})=>{const r={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({documentId:t,screenId:e,format:n})};return fetch("https://sl-api.maze.design/adobexd/signurl/"+t,r).then(t=>t.json()).catch(t=>console.log(t))},uploadFileToS3:(t,e,n="png")=>{const r=n===o?"image/jpg":"image/png";return new Promise((n,o)=>{const s={method:"PUT",body:e,headers:{"Content-Type":r}};fetch(t.signedRequest,s).then(e=>{e.ok||o(Error(`${e.status}: ${e.statusText}`)),n(t.url)})})},doesPrototypeExists:({documentId:t})=>s({documentId:t}).then(t=>({exists:!0,updatedAt:t.updatedAt})).catch(t=>{if(t.message===r)return{exists:!1,updatedAt:null};throw new Error(t)}),getProtoTypeData:s}},function(t,e,n){const{PNG_FORMAT:r,JPG_FORMAT:o}=n(0),{addInteractionsToDataExport:s,getInteractionsForNodes:i}=n(9),a=n(10),h=({folder:t,application:e,format:n})=>async s=>{const i=n===o?o:r,a=n===o?e.RenditionType.JPG:e.RenditionType.PNG,h=`${s.guid}.${i}`,c={node:s,outputFile:await t.createFile(h,{overwrite:!0}),type:a,scale:2};return n===o&&(c.quality=75),c};t.exports={exportRenders:async({folder:t,application:e,root:n})=>{const{screens:c,fixedNodes:u,staticNodes:l}=a({root:n}),f=i(l),d=s({interactions:f,screens:c}),p=h({folder:t,application:e,format:o}),y=h({folder:t,application:e,format:r}),m=await Promise.all(l.map(p)),g=await e.createRenditions(m);u.forEach(t=>{t.visible=!0});const v=await Promise.all(u.map(y));return{prototypeData:d,renders:[...g,...v.length?await e.createRenditions(v):[]]}},getAdobeMazeLink:t=>"adobexd/mip/"+t}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){const r=n(1),o=n(6),s=n(7),i=n(8),a=n(2),h=n(3),{NETWORK_ERROR:c}=n(0),u=n(11);let l=null;async function f(){let t=null;const e=r.activeDocument.guid,n=h.getAdobeMazeLink(e);function i(t){o.copyText(t||n)}function f(t){const e=s(t).fromNow();l.querySelector("#syncedLabel").textContent=e}function d(e){t&&clearInterval(t),f(e),t=setInterval(()=>{f(e)},5e3)}function p(t,e){const n=l.querySelector("#error-label"),o=t.target;o.disabled=!0,r.editDocument((t,r)=>u(null,r).then(({link:t,updatedAt:r})=>{e&&e(t),d(r),n.classList.add("hide")}).catch(t=>{console.log(t),n.classList.remove("hide")}).finally(()=>{o.disabled=!1}))}return l=document.createElement("div"),l.innerHTML='<style>\n .break {\n flex-wrap: wrap;\n }\n .input {\n margin: 0;\n width: 100%;\n flex: 1 1 auto;\n }\n .label {\n display: block;\n font-size: 10px;\n margin: 0 6px 10px;\n font-weight: 600;\n }\n .label--centered {\n text-align: center;\n }\n .label-content {\n display: block;\n margin: 0 6px;\n color: #8E8F8E;\n }\n .section {\n margin-bottom: 10px;\n font-size: 10px;\n }\n .explanation {\n line-height: 12px;\n }\n .show {\n display: block;\n }\n .hide {\n display: none;\n }\n .centered-content {\n display: flex;\n justify-content: center;\n width: 100%;\n }\n .form-button {\n min-width: 180px;\n }\n </style>\n <div id="loadingState"><p>Loading...</p></div>\n <div class="hide" id="initialState">\n <div class="section">\n <p class="explanation">To generate a link to the prototype, synchronize all screens with Maze. After that, you will be able to access the generated link to the prototype here.</p>\n <div class="centered-content">\n <button class="form-button" id="syncMaze" type="submit" uxp-variant="cta">Sync screens with Maze</button> \n </div>\n </div>\n </div>\n <div id="syncedState" class="hide">\n <div class="section">\n <span class="label">Prototype link</span>\n <input class="input" readonly type="text" id="documentIdLink" />\n <div class="centered-content">\n <button class="form-button" id="copyLink" uxp-variant="cta">Copy prototype link</button>\n </div>\n </div>\n <div class="section">\n <span class="label">Last synced</span>\n <span id="syncedLabel" class="label-content"></span>\n </div>\n <div class="centered-content">\n <button class="form-button" id="reSyncMaze" type="submit" uxp-variant="cta">Resync screens with Maze</button>\n </div>\n </div>\n <span id="error-label" class="error-label label label--centered hide">There was an error, please try again.</span>\n <span id="error-label-network" class="error-label label label--centered hide">There was an error, please check your network connection.</span>\n ',a.doesPrototypeExists({documentId:e}).then(({exists:t,updatedAt:e})=>{const r=l.querySelector("#documentIdLink");t?(l.querySelector("#syncedState").classList.remove("hide"),d(e)):l.querySelector("#initialState").classList.remove("hide"),r.value=n}).catch(t=>{!function({network:t,general:e}){if(l.querySelectorAll(".error-label").forEach(t=>t.classList.add("hide")),t){l.querySelector("#error-label-network").classList.remove("hide")}if(e){l.querySelector("#error-label").classList.remove("hide")}}({network:t.message===c})}).finally(()=>{l.querySelector("#loadingState").classList.add("hide")}),l.querySelector("#syncMaze").addEventListener("click",(function(t){p(t,t=>{l.querySelector("#syncedState").classList.remove("hide"),l.querySelector("#initialState").classList.add("hide"),i(t)})})),l.querySelector("#reSyncMaze").addEventListener("click",(function(t){p(t)})),l.querySelector("#copyLink").addEventListener("click",(function(t){t.preventDefault(),t.target.textContent="Copied!",setTimeout(()=>{t.target.textContent="Copy prototype link"},1e3),i()})),l}s.extend(i),t.exports={panels:{exportProtoType:{show:async function(t){if(l)return;const e=await f();t.node.appendChild(e)}}}}},function(t,e){t.exports=require("clipboard")},function(t,e,n){t.exports=function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",o="day",s="week",i="month",a="quarter",h="year",c=/^(\d{4})-?(\d{1,2})?-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,u=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,l=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},f={s:l,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),o=n%60;return(e<=0?"+":"-")+l(r,2,"0")+":"+l(o,2,"0")},m:function(t,e){var n=12*(e.year()-t.year())+(e.month()-t.month()),r=t.clone().add(n,i),o=e-r<0,s=t.clone().add(n+(o?-1:1),i);return Number(-(n+(e-r)/(o?r-s:s-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(c){return{M:i,y:h,w:s,d:o,D:"date",h:r,m:n,s:e,ms:t,Q:a}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},d={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p="en",y={};y[p]=d;var m=function(t){return t instanceof _},g=function(t,e,n){var r;if(!t)return p;if("string"==typeof t)y[t]&&(r=t),e&&(y[t]=e,r=t);else{var o=t.name;y[o]=t,r=o}return!n&&r&&(p=r),r||!n&&p},v=function(t,e){if(m(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=f;b.l=g,b.i=m,b.w=function(t,e){return v(t,{locale:e.$L,utc:e.$u,$offset:e.$offset})};var _=function(){function l(t){this.$L=this.$L||g(t.locale,null,!0),this.parse(t)}var f=l.prototype;return f.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(c);if(r){var o=r[2]-1||0;return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}}return new Date(e)}(t),this.init()},f.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},f.$utils=function(){return b},f.isValid=function(){return!("Invalid Date"===this.$d.toString())},f.isSame=function(t,e){var n=v(t);return this.startOf(e)<=n&&n<=this.endOf(e)},f.isAfter=function(t,e){return v(t)<this.startOf(e)},f.isBefore=function(t,e){return this.endOf(e)<v(t)},f.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},f.year=function(t){return this.$g(t,"$y",h)},f.month=function(t){return this.$g(t,"$M",i)},f.day=function(t){return this.$g(t,"$W",o)},f.date=function(t){return this.$g(t,"$D","date")},f.hour=function(t){return this.$g(t,"$H",r)},f.minute=function(t){return this.$g(t,"$m",n)},f.second=function(t){return this.$g(t,"$s",e)},f.millisecond=function(e){return this.$g(e,"$ms",t)},f.unix=function(){return Math.floor(this.valueOf()/1e3)},f.valueOf=function(){return this.$d.getTime()},f.startOf=function(t,a){var c=this,u=!!b.u(a)||a,l=b.p(t),f=function(t,e){var n=b.w(c.$u?Date.UTC(c.$y,e,t):new Date(c.$y,e,t),c);return u?n:n.endOf(o)},d=function(t,e){return b.w(c.toDate()[t].apply(c.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(e)),c)},p=this.$W,y=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(l){case h:return u?f(1,0):f(31,11);case i:return u?f(1,y):f(0,y+1);case s:var v=this.$locale().weekStart||0,_=(p<v?p+7:p)-v;return f(u?m-_:m+(6-_),y);case o:case"date":return d(g+"Hours",0);case r:return d(g+"Minutes",1);case n:return d(g+"Seconds",2);case e:return d(g+"Milliseconds",3);default:return this.clone()}},f.endOf=function(t){return this.startOf(t,!1)},f.$set=function(s,a){var c,u=b.p(s),l="set"+(this.$u?"UTC":""),f=(c={},c.day=l+"Date",c.date=l+"Date",c[i]=l+"Month",c[h]=l+"FullYear",c[r]=l+"Hours",c[n]=l+"Minutes",c[e]=l+"Seconds",c[t]=l+"Milliseconds",c)[u],d=u===o?this.$D+(a-this.$W):a;if(u===i||u===h){var p=this.clone().set("date",1);p.$d[f](d),p.init(),this.$d=p.set("date",Math.min(this.$D,p.daysInMonth())).$d}else f&&this.$d[f](d);return this.init(),this},f.set=function(t,e){return this.clone().$set(t,e)},f.get=function(t){return this[b.p(t)]()},f.add=function(t,a){var c,u=this;t=Number(t);var l=b.p(a),f=function(e){var n=v(u);return b.w(n.date(n.date()+Math.round(e*t)),u)};if(l===i)return this.set(i,this.$M+t);if(l===h)return this.set(h,this.$y+t);if(l===o)return f(1);if(l===s)return f(7);var d=(c={},c[n]=6e4,c[r]=36e5,c[e]=1e3,c)[l]||1,p=this.$d.getTime()+t*d;return b.w(p,this)},f.subtract=function(t,e){return this.add(-1*t,e)},f.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",r=b.z(this),o=this.$locale(),s=this.$H,i=this.$m,a=this.$M,h=o.weekdays,c=o.months,l=function(t,r,o,s){return t&&(t[r]||t(e,n))||o[r].substr(0,s)},f=function(t){return b.s(s%12||12,t,"0")},d=o.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},p={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:b.s(a+1,2,"0"),MMM:l(o.monthsShort,a,c,3),MMMM:l(c,a),D:this.$D,DD:b.s(this.$D,2,"0"),d:String(this.$W),dd:l(o.weekdaysMin,this.$W,h,2),ddd:l(o.weekdaysShort,this.$W,h,3),dddd:h[this.$W],H:String(s),HH:b.s(s,2,"0"),h:f(1),hh:f(2),a:d(s,i,!0),A:d(s,i,!1),m:String(i),mm:b.s(i,2,"0"),s:String(this.$s),ss:b.s(this.$s,2,"0"),SSS:b.s(this.$ms,3,"0"),Z:r};return n.replace(u,(function(t,e){return e||p[t]||r.replace(":","")}))},f.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},f.diff=function(t,o,c){var u,l=b.p(o),f=v(t),d=6e4*(f.utcOffset()-this.utcOffset()),p=this-f,y=b.m(this,f);return y=(u={},u[h]=y/12,u[i]=y,u[a]=y/3,u[s]=(p-d)/6048e5,u.day=(p-d)/864e5,u[r]=p/36e5,u[n]=p/6e4,u[e]=p/1e3,u)[l]||p,c?y:b.a(y)},f.daysInMonth=function(){return this.endOf(i).$D},f.$locale=function(){return y[this.$L]},f.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=g(t,e,!0);return r&&(n.$L=r),n},f.clone=function(){return b.w(this.$d,this)},f.toDate=function(){return new Date(this.valueOf())},f.toJSON=function(){return this.isValid()?this.toISOString():null},f.toISOString=function(){return this.$d.toISOString()},f.toString=function(){return this.$d.toUTCString()},l}();return v.prototype=_.prototype,v.extend=function(t,e){return t(e,_,v),v},v.locale=g,v.isDayjs=m,v.unix=function(t){return v(1e3*t)},v.en=y[p],v.Ls=y,v}()},function(t,e,n){t.exports=function(){"use strict";return function(t,e,n){t=t||{};var r=e.prototype,o={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};n.en.relativeTime=o;var s=function(e,r,s,i){for(var a,h,c,u=s.$locale().relativeTime||o,l=t.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],f=l.length,d=0;d<f;d+=1){var p=l[d];p.d&&(a=i?n(e).diff(s,p.d,!0):s.diff(e,p.d,!0));var y=(t.rounding||Math.round)(Math.abs(a));if(c=a>0,y<=p.r||!p.r){y<=1&&d>0&&(p=l[d-1]);var m=u[p.l];h="string"==typeof m?m.replace("%d",y):m(y,r,p.l,c);break}}return r?h:(c?u.future:u.past).replace("%s",h)};r.to=function(t,e){return s(t,e,this,!0)},r.from=function(t,e){return s(t,e,this)};var i=function(t){return t.$u?n.utc():n()};r.toNow=function(t){return this.to(i(this),t)},r.fromNow=function(t){return this.from(i(this),t)}}}()},function(t,e,n){const{ARTBOARD_TYPE:r,LAYER_TYPE:o,INTERACTIONS:s}=n(0),i=["goToArtboard","goBack","overlay"],a=["tap","time"],h=t=>t.constructor.name===r,c=(t,e=[])=>(t.triggeredInteractions.length&&e.push({triggerNode:t,interactions:t.triggeredInteractions}),t.children&&t.children.forEach(t=>c(t,e)),e),u=t=>{if(t.action.type!==s.GO_TO_ARTBOARD)return"none";const{fromSide:e}=t.action.transition;switch(e){case"L":return"fromRight";case"R":return"fromLeft";case"B":return"fromBottom";case"T":return"fromTop";default:return"none"}},l=t=>{switch(t.type){case s.GO_BACK:return"none";case s.OVERLAY:return t.overlay.guid;default:return t.destination.guid}},f=({parentNode:t,node:e,interactions:n})=>{if(!n.length||!e.parent)return null;const r=n[n.length-1],{action:o,trigger:c}=r;if(!(({action:t,trigger:e})=>i.includes(t)&&a.includes(e))({action:o.type,trigger:c.type}))return null;const{type:f,preserveScrollPosition:d,overlayTopLeft:p}=o,y={animationType:u(r),type:f,id:e.guid,isBackAction:f===s.GO_BACK,destinationArtboardId:l(o),overlayPosition:p,isOverlay:"overlay"===o.type,preserveScrollPosition:d};"time"===f&&(y.delay=c.delay);const m=(({parentNode:t,node:e})=>{const n=t.boundsInParent,r=e.boundsInParent,o=h(t)?t.globalBounds.x:n.x,s=h(t)?t.globalBounds.y:n.y,i=h(t)?e.globalBounds.x:r.x,a=h(t)?e.globalBounds.y:r.y;return{x:Math.round(i-o),y:Math.round(a-s),width:Math.round(r.width),height:Math.round(r.height)}})({parentNode:t,node:e});return{id:e.guid,name:e.name,boundingRect:m,triggerType:c.type,transition:o.transition,flow:y}};const d=t=>{const{name:e}=t.constructor,n=e===r?r:o,s=e!==r?function t(e,n){const{parent:r={constructor:{}}}=e,{name:o}=r.constructor;return o===n?r.guid:t(r,n)}(t,r):null;return{id:t.guid,name:t.name,type:n,artBoard:s}};t.exports={addInteractionsToDataExport:({screens:t,interactions:e})=>{const n=[...t];return e.forEach(t=>{try{const e=function t(e){const{name:n}=e.constructor;return e.fixedWhenScrolling||n===r?e:t(e.parent)}(t.triggerNode),o=d(e),s=f({parentNode:e,node:t.triggerNode,interactions:t.interactions});if(s){console.log(`hotspot for ${t.triggerNode.name}, parent: ${o.name}`);const e=o.type===r?o.id:o.artBoard,i=n.findIndex(t=>t.id===e);if(s.id===e)return void n[i].interactions.push(s);if(o.type===r)-1!==i&&n[i].hotspots.push(s);else{const t=n[i].layers.findIndex(t=>t.id===o.id);-1!==t&&n[i].layers[t].hotspots.push(s)}}}catch(e){console.error(e),console.log("error",{name:t.triggerNode.name,guid:t.triggerNode.guid,constructor:t.triggerNode.constructor.name})}}),n},getInteractionsForNodes:t=>{let e=[];return t.forEach(t=>{e=e.concat(c(t))}),e}}},function(t,e,n){const{ARTBOARD_TYPE:r,LAYER_TYPE:o}=n(0),s=t=>t&&t.constructor.name===r,i=t=>{const e=t.globalBounds.height,n=t.globalBounds.width;return{__typename:r,uuid:t.guid,id:t.guid,name:t.name,height:e,width:n,viewport:{height:t.viewportHeight||e,width:n},hotspots:[],layers:[],hash:"",imageUrl:"",interactions:[]}},a=t=>({__typename:o,id:t.guid,imageUrl:"",name:t.name,boundingRect:t.boundsInParent,hotspots:[],hash:""});t.exports=({root:t})=>{const e=[],n=[],r=[];for(let o=0;o<t.children.length;o+=1){const h=t.children.at(o);if(!s(h))continue;const c=i(h);h.children.forEach(t=>{t.fixedWhenScrolling&&(c.layers.push(a(t)),n.push(t),t.visible=!1)}),r.push(h),e.push(c)}return{screens:e,fixedNodes:n,staticNodes:r}}},function(t,e,n){const{storage:r}=n(12),o=n(1),s=n(13),i=n(20),a=n(2),h=n(3),{PNG_FORMAT:c,JPG_FORMAT:u}=n(0),l=({url:t,version:e})=>{const n=s.parse(t,!0);return n.query.v?t:(n.query.v=e,s.format(n))};t.exports=async(t,e)=>{const n=r.localFileSystem,s=o.activeDocument.guid,f=await a.getProtoTypeData({documentId:s}).catch(()=>({screens:[]})),d=f.screens.reduce((t,e)=>{const n=e.layers.map(t=>({id:t.id,hash:t.hash,imageUrl:t.imageUrl}));return[...t,{id:e.id,hash:e.hash,imageUrl:e.imageUrl},...n]},[]);const p=(y=d,({assetId:t,hash:e})=>{const n=y.find(e=>e.id===t);return!n||n.hash!==e});var y;const m=await n.getTemporaryFolder(),{prototypeData:g,renders:v}=await h.exportRenders({folder:m,application:o,root:e}),b=v.map(async t=>{const{name:e,format:n}=(o=t.outputFile.name).includes("."+u)?{name:o.replace("."+u,""),format:u}:{name:o.replace("."+c,""),format:c};var o;const h=await t.outputFile.read({format:r.formats.binary}),f=i(h);if(!p({assetId:e,hash:f})){console.log(`assetId: ${t.outputFile.name} is the same, skipping`);const n=d.find(t=>t.id===e);return n.imageUrl=l({url:n.imageUrl,version:f}),n}const y=await a.getSignedUrl({documentId:s,screenId:e,format:n});return a.uploadFileToS3(y,h,n).then(n=>(console.log(`assetId: ${t.outputFile.name} changed, resyncing`),{imageUrl:l({url:n,version:f}),id:e,hash:f})).catch(t=>{console.log(t)})});(await Promise.all(b)).forEach(t=>{const e=g.findIndex(e=>e.id===t.id);-1!==e?(g[e].imageUrl=t.imageUrl,g[e].hash=t.hash,console.log("ARTBOARD",t.id,g[e].name)):g.forEach((e,n)=>{if(e.layers.length){const e=g[n].layers.findIndex(e=>e.id===t.id);-1!==e&&(g[n].layers[e].imageUrl=t.imageUrl,g[n].layers[e].hash=t.hash,console.log("ASSET",t.id,g[n].layers[e].name))}})});const _=await a.getSignedUrl({documentId:s}),A=Date.now(),S={id:o.activeDocument.guid,name:o.activeDocument.name,prototypeProvider:"ADOBE_XD",screens:g,updatedAt:A},R={method:"PUT",body:JSON.stringify(S)};return await fetch(_.signedRequest,R),console.log("SYNC_COMPLETED"),console.log("Document ID",S.id),console.log("Document name",S.name),console.log("Adobe XD version",o.version),{link:h.getAdobeMazeLink(s),updatedAt:A}}},function(t,e){t.exports=require("uxp")},function(t,e,n){"use strict";var r=n(14),o=n(16);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=b,e.resolve=function(t,e){return b(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},e.format=function(t){o.isString(t)&&(t=b(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var i=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,h=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),u=["'"].concat(c),l=["%","/","?",";","#"].concat(u),f=["/","?","#"],d=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},m={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},v=n(17);function b(t,e,n){if(t&&o.isObject(t)&&t instanceof s)return t;var r=new s;return r.parse(t,e,n),r}s.prototype.parse=function(t,e,n){if(!o.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s<t.indexOf("#")?"?":"#",c=t.split(a);c[0]=c[0].replace(/\\/g,"/");var b=t=c.join(a);if(b=b.trim(),!n&&1===t.split("#").length){var _=h.exec(b);if(_)return this.path=b,this.href=b,this.pathname=_[1],_[2]?(this.search=_[2],this.query=e?v.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var A=i.exec(b);if(A){var S=(A=A[0]).toLowerCase();this.protocol=S,b=b.substr(A.length)}if(n||A||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var R="//"===b.substr(0,2);!R||A&&m[A]||(b=b.substr(2),this.slashes=!0)}if(!m[A]&&(R||A&&!g[A])){for(var E,w,O=-1,x=0;x<f.length;x++){-1!==(T=b.indexOf(f[x]))&&(-1===O||T<O)&&(O=T)}-1!==(w=-1===O?b.lastIndexOf("@"):b.lastIndexOf("@",O))&&(E=b.slice(0,w),b=b.slice(w+1),this.auth=decodeURIComponent(E)),O=-1;for(x=0;x<l.length;x++){var T;-1!==(T=b.indexOf(l[x]))&&(-1===O||T<O)&&(O=T)}-1===O&&(O=b.length),this.host=b.slice(0,O),b=b.slice(O),this.parseHost(),this.hostname=this.hostname||"";var M="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!M)for(var C=this.hostname.split(/\./),H=(x=0,C.length);x<H;x++){var D=C[x];if(D&&!D.match(d)){for(var $="",I=0,N=D.length;I<N;I++)D.charCodeAt(I)>127?$+="x":$+=D[I];if(!$.match(d)){var k=C.slice(0,x),B=C.slice(x+1),U=D.match(p);U&&(k.push(U[1]),B.unshift(U[2])),B.length&&(b="/"+B.join(".")+b),this.hostname=k.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),M||(this.hostname=r.toASCII(this.hostname));var F=this.port?":"+this.port:"",j=this.hostname||"";this.host=j+F,this.href+=this.host,M&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!y[S])for(x=0,H=u.length;x<H;x++){var P=u[x];if(-1!==b.indexOf(P)){var L=encodeURIComponent(P);L===P&&(L=escape(P)),b=b.split(P).join(L)}}var q=b.indexOf("#");-1!==q&&(this.hash=b.substr(q),b=b.slice(0,q));var X=b.indexOf("?");if(-1!==X?(this.search=b.substr(X),this.query=b.substr(X+1),e&&(this.query=v.parse(this.query)),b=b.slice(0,X)):e&&(this.search="",this.query={}),b&&(this.pathname=b),g[S]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){F=this.pathname||"";var Y=this.search||"";this.path=F+Y}return this.href=this.format(),this},s.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",s=!1,i="";this.host?s=t+this.host:this.hostname&&(s=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(i=v.stringify(this.query));var a=this.search||i&&"?"+i||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||g[e])&&!1!==s?(s="//"+(s||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):s||(s=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),e+s+(n=n.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+r},s.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},s.prototype.resolveObject=function(t){if(o.isString(t)){var e=new s;e.parse(t,!1,!0),t=e}for(var n=new s,r=Object.keys(this),i=0;i<r.length;i++){var a=r[i];n[a]=this[a]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var h=Object.keys(t),c=0;c<h.length;c++){var u=h[c];"protocol"!==u&&(n[u]=t[u])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!g[t.protocol]){for(var l=Object.keys(t),f=0;f<l.length;f++){var d=l[f];n[d]=t[d]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||m[t.protocol])n.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),n.pathname=p.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var y=n.pathname||"",v=n.search||"";n.path=y+v}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),_=t.host||t.pathname&&"/"===t.pathname.charAt(0),A=_||b||n.host&&t.pathname,S=A,R=n.pathname&&n.pathname.split("/")||[],E=(p=t.pathname&&t.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(E&&(n.hostname="",n.port=null,n.host&&(""===R[0]?R[0]=n.host:R.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),A=A&&(""===p[0]||""===R[0])),_)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,R=p;else if(p.length)R||(R=[]),R.pop(),R=R.concat(p),n.search=t.search,n.query=t.query;else if(!o.isNullOrUndefined(t.search)){if(E)n.hostname=n.host=R.shift(),(M=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=M.shift(),n.host=n.hostname=M.shift());return n.search=t.search,n.query=t.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!R.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var w=R.slice(-1)[0],O=(n.host||t.host||R.length>1)&&("."===w||".."===w)||""===w,x=0,T=R.length;T>=0;T--)"."===(w=R[T])?R.splice(T,1):".."===w?(R.splice(T,1),x++):x&&(R.splice(T,1),x--);if(!A&&!S)for(;x--;x)R.unshift("..");!A||""===R[0]||R[0]&&"/"===R[0].charAt(0)||R.unshift(""),O&&"/"!==R.join("/").substr(-1)&&R.push("");var M,C=""===R[0]||R[0]&&"/"===R[0].charAt(0);E&&(n.hostname=n.host=C?"":R.length?R.shift():"",(M=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=M.shift(),n.host=n.hostname=M.shift()));return(A=A||n.host&&R.length)&&!C&&R.unshift(""),R.length?n.pathname=R.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},function(t,e,n){(function(t,r){var o;/*! https://mths.be/punycode v1.4.1 by @mathias */!function(s){e&&e.nodeType,t&&t.nodeType;var i="object"==typeof r&&r;i.global!==i&&i.window!==i&&i.self;var a,h=2147483647,c=/^xn--/,u=/[^\x20-\x7E]/,l=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,p=String.fromCharCode;function y(t){throw new RangeError(f[t])}function m(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function g(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+m((t=t.replace(l,".")).split("."),e).join(".")}function v(t){for(var e,n,r=[],o=0,s=t.length;o<s;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<s?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function b(t){return m(t,(function(t){var e="";return t>65535&&(e+=p((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=p(t)})).join("")}function _(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function A(t,e,n){var r=0;for(t=n?d(t/700):t>>1,t+=d(t/e);t>455;r+=36)t=d(t/35);return d(r+36*t/(t+38))}function S(t){var e,n,r,o,s,i,a,c,u,l,f,p=[],m=t.length,g=0,v=128,_=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&y("not-basic"),p.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<m;){for(s=g,i=1,a=36;o>=m&&y("invalid-input"),((c=(f=t.charCodeAt(o++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:36)>=36||c>d((h-g)/i))&&y("overflow"),g+=c*i,!(c<(u=a<=_?1:a>=_+26?26:a-_));a+=36)i>d(h/(l=36-u))&&y("overflow"),i*=l;_=A(g-s,e=p.length+1,0==s),d(g/e)>h-v&&y("overflow"),v+=d(g/e),g%=e,p.splice(g++,0,v)}return b(p)}function R(t){var e,n,r,o,s,i,a,c,u,l,f,m,g,b,S,R=[];for(m=(t=v(t)).length,e=128,n=0,s=72,i=0;i<m;++i)(f=t[i])<128&&R.push(p(f));for(r=o=R.length,o&&R.push("-");r<m;){for(a=h,i=0;i<m;++i)(f=t[i])>=e&&f<a&&(a=f);for(a-e>d((h-n)/(g=r+1))&&y("overflow"),n+=(a-e)*g,e=a,i=0;i<m;++i)if((f=t[i])<e&&++n>h&&y("overflow"),f==e){for(c=n,u=36;!(c<(l=u<=s?1:u>=s+26?26:u-s));u+=36)S=c-l,b=36-l,R.push(p(_(l+S%b,0))),c=d(S/b);R.push(p(_(c,0))),s=A(n,g,r==o),n=0,++r}++n,++e}return R.join("")}a={version:"1.4.1",ucs2:{decode:v,encode:b},decode:S,encode:R,toASCII:function(t){return g(t,(function(t){return u.test(t)?"xn--"+R(t):t}))},toUnicode:function(t){return g(t,(function(t){return c.test(t)?S(t.slice(4).toLowerCase()):t}))}},void 0===(o=function(){return a}.call(e,n,e,t))||(t.exports=o)}()}).call(this,n(15)(t),n(4))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e,n){"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},function(t,e,n){"use strict";e.decode=e.parse=n(18),e.encode=e.stringify=n(19)},function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,e,n,s){e=e||"&",n=n||"=";var i={};if("string"!=typeof t||0===t.length)return i;var a=/\+/g;t=t.split(e);var h=1e3;s&&"number"==typeof s.maxKeys&&(h=s.maxKeys);var c=t.length;h>0&&c>h&&(c=h);for(var u=0;u<c;++u){var l,f,d,p,y=t[u].replace(a,"%20"),m=y.indexOf(n);m>=0?(l=y.substr(0,m),f=y.substr(m+1)):(l=y,f=""),d=decodeURIComponent(l),p=decodeURIComponent(f),r(i,d)?o(i[d])?i[d].push(p):i[d]=[i[d],p]:i[d]=p}return i};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},function(t,e,n){"use strict";var r=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,e,n,a){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?s(i(t),(function(i){var a=encodeURIComponent(r(i))+n;return o(t[i])?s(t[i],(function(t){return a+encodeURIComponent(r(t))})).join(e):a+encodeURIComponent(r(t[i]))})).join(e):a?encodeURIComponent(r(a))+n+encodeURIComponent(r(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var i=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;
/**
* [js-md5]{@link https://github.com/emn178/js-md5}
*
* @namespace md5
* @version 0.7.3
* @author Chen, Yi-Cyuan [[email protected]]
* @copyright Chen, Yi-Cyuan 2014-2017
* @license MIT
*/!function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(22),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(t){return"object"==typeof t&&t.buffer&&t.buffer.constructor===ArrayBuffer});var createOutputMethod=function(t){return function(e){return new Md5(!0).update(e)[t]()}},createMethod=function(){var t=createOutputMethod("hex");NODE_JS&&(t=nodeWrap(t)),t.create=function(){return new Md5},t.update=function(e){return t.create().update(e)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n)}return t},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(t){if("string"==typeof t)return crypto.createHash("md5").update(t,"utf8").digest("hex");if(null==t)throw ERROR;return t.constructor===ArrayBuffer&&(t=new Uint8Array(t)),Array.isArray(t)||ArrayBuffer.isView(t)||t.constructor===Buffer?crypto.createHash("md5").update(new Buffer(t)).digest("hex"):method(t)};return nodeMethod};function Md5(t){if(t)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(t){if(!this.finalized){var e,n=typeof t;if("string"!==n){if("object"!==n)throw ERROR;if(null===t)throw ERROR;if(ARRAY_BUFFER&&t.constructor===ArrayBuffer)t=new Uint8Array(t);else if(!(Array.isArray(t)||ARRAY_BUFFER&&ArrayBuffer.isView(t)))throw ERROR;e=!0}for(var r,o,s=0,i=t.length,a=this.blocks,h=this.buffer8;s<i;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(ARRAY_BUFFER)for(o=this.start;s<i&&o<64;++s)h[o++]=t[s];else for(o=this.start;s<i&&o<64;++s)a[o>>2]|=t[s]<<SHIFT[3&o++];else if(ARRAY_BUFFER)for(o=this.start;s<i&&o<64;++s)(r=t.charCodeAt(s))<128?h[o++]=r:r<2048?(h[o++]=192|r>>6,h[o++]=128|63&r):r<55296||r>=57344?(h[o++]=224|r>>12,h[o++]=128|r>>6&63,h[o++]=128|63&r):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),h[o++]=240|r>>18,h[o++]=128|r>>12&63,h[o++]=128|r>>6&63,h[o++]=128|63&r);else for(o=this.start;s<i&&o<64;++s)(r=t.charCodeAt(s))<128?a[o>>2]|=r<<SHIFT[3&o++]:r<2048?(a[o>>2]|=(192|r>>6)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<SHIFT[3&o++],a[o>>2]|=(128|r>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++s)),a[o>>2]|=(240|r>>18)<<SHIFT[3&o++],a[o>>2]|=(128|r>>12&63)<<SHIFT[3&o++],a[o>>2]|=(128|r>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=EXTRA[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,t[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var t,e,n,r,o,s,i=this.blocks;this.first?e=((e=((t=((t=i[0]-680876937)<<7|t>>>25)-271733879<<0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&t)+i[1]-117830708)<<12|r>>>20)+t<<0)&(-271733879^t))+i[2]-1126478375)<<17|n>>>15)+r<<0)&(r^t))+i[3]-1316259209)<<22|e>>>10)+n<<0:(t=this.h0,e=this.h1,n=this.h2,e=((e+=((t=((t+=((r=this.h3)^e&(n^r))+i[0]-680876936)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+i[1]-389564586)<<12|r>>>20)+t<<0)&(t^e))+i[2]+606105819)<<17|n>>>15)+r<<0)&(r^t))+i[3]-1044525330)<<22|e>>>10)+n<<0),e=((e+=((t=((t+=(r^e&(n^r))+i[4]-176418897)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+i[5]+1200080426)<<12|r>>>20)+t<<0)&(t^e))+i[6]-1473231341)<<17|n>>>15)+r<<0)&(r^t))+i[7]-45705983)<<22|e>>>10)+n<<0,e=((e+=((t=((t+=(r^e&(n^r))+i[8]+1770035416)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+i[9]-1958414417)<<12|r>>>20)+t<<0)&(t^e))+i[10]-42063)<<17|n>>>15)+r<<0)&(r^t))+i[11]-1990404162)<<22|e>>>10)+n<<0,e=((e+=((t=((t+=(r^e&(n^r))+i[12]+1804603682)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+i[13]-40341101)<<12|r>>>20)+t<<0)&(t^e))+i[14]-1502002290)<<17|n>>>15)+r<<0)&(r^t))+i[15]+1236535329)<<22|e>>>10)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+i[1]-165796510)<<5|t>>>27)+e<<0)^e))+i[6]-1069501632)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+i[11]+643717713)<<14|n>>>18)+r<<0)^r))+i[0]-373897302)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+i[5]-701558691)<<5|t>>>27)+e<<0)^e))+i[10]+38016083)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+i[15]-660478335)<<14|n>>>18)+r<<0)^r))+i[4]-405537848)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+i[9]+568446438)<<5|t>>>27)+e<<0)^e))+i[14]-1019803690)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+i[3]-187363961)<<14|n>>>18)+r<<0)^r))+i[8]+1163531501)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+i[13]-1444681467)<<5|t>>>27)+e<<0)^e))+i[2]-51403784)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+i[7]+1735328473)<<14|n>>>18)+r<<0)^r))+i[12]-1926607734)<<20|e>>>12)+n<<0,e=((e+=((s=(r=((r+=((o=e^n)^(t=((t+=(o^r)+i[5]-378558)<<4|t>>>28)+e<<0))+i[8]-2022574463)<<11|r>>>21)+t<<0)^t)^(n=((n+=(s^e)+i[11]+1839030562)<<16|n>>>16)+r<<0))+i[14]-35309556)<<23|e>>>9)+n<<0,e=((e+=((s=(r=((r+=((o=e^n)^(t=((t+=(o^r)+i[1]-1530992060)<<4|t>>>28)+e<<0))+i[4]+1272893353)<<11|r>>>21)+t<<0)^t)^(n=((n+=(s^e)+i[7]-155497632)<<16|n>>>16)+r<<0))+i[10]-1094730640)<<23|e>>>9)+n<<0,e=((e+=((s=(r=((r+=((o=e^n)^(t=((t+=(o^r)+i[13]+681279174)<<4|t>>>28)+e<<0))+i[0]-358537222)<<11|r>>>21)+t<<0)^t)^(n=((n+=(s^e)+i[3]-722521979)<<16|n>>>16)+r<<0))+i[6]+76029189)<<23|e>>>9)+n<<0,e=((e+=((s=(r=((r+=((o=e^n)^(t=((t+=(o^r)+i[9]-640364487)<<4|t>>>28)+e<<0))+i[12]-421815835)<<11|r>>>21)+t<<0)^t)^(n=((n+=(s^e)+i[15]+530742520)<<16|n>>>16)+r<<0))+i[2]-995338651)<<23|e>>>9)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+i[0]-198630844)<<6|t>>>26)+e<<0)|~n))+i[7]+1126891415)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+i[14]-1416354905)<<15|n>>>17)+r<<0)|~t))+i[5]-57434055)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+i[12]+1700485571)<<6|t>>>26)+e<<0)|~n))+i[3]-1894986606)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+i[10]-1051523)<<15|n>>>17)+r<<0)|~t))+i[1]-2054922799)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+i[8]+1873313359)<<6|t>>>26)+e<<0)|~n))+i[15]-30611744)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+i[6]-1560198380)<<15|n>>>17)+r<<0)|~t))+i[13]+1309151649)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+i[4]-145523070)<<6|t>>>26)+e<<0)|~n))+i[11]-1120210379)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+i[2]+718787259)<<15|n>>>17)+r<<0)|~t))+i[9]-343485551)<<21|e>>>11)+n<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var t,e,n,r="",o=this.array(),s=0;s<15;)t=o[s++],e=o[s++],n=o[s++],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[63&(t<<4|e>>>4)]+BASE64_ENCODE_CHAR[63&(e<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return t=o[s],r+=BASE64_ENCODE_CHAR[t>>>2]+BASE64_ENCODE_CHAR[t<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))}()}).call(this,__webpack_require__(21),__webpack_require__(4))},function(t,e){var n,r,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(t){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(t){r=i}}();var h,c=[],u=!1,l=-1;function f(){u&&h&&(u=!1,h.length?c=h.concat(c):l=-1,c.length&&d())}function d(){if(!u){var t=a(f);u=!0;for(var e=c.length;e;){for(h=c,c=[];++l<e;)h&&h[l].run();l=-1,e=c.length}h=null,u=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function y(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||u||a(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e){(function(e){t.exports=e}).call(this,{})}]);