1function resizeCanvasIfNeeded(pipelineState){var targetCanvas=pipelineState.targetCanvas,width=targetCanvas.width,height=targetCanvas.height,dWidth=pipelineState.destinationWidth,dHeight=pipelineState.destinationHeight;(width!==dWidth||height!==dHeight)&&(targetCanvas.width=dWidth,targetCanvas.height=dHeight)}function copyGLTo2DDrawImage(gl,pipelineState){var glCanvas=gl.canvas,targetCanvas=pipelineState.targetCanvas,ctx=targetCanvas.getContext("2d"),sourceY;ctx.translate(0,targetCanvas.height);ctx.scale(1,-1);sourceY=glCanvas.height-targetCanvas.height;ctx.drawImage(glCanvas,0,sourceY,targetCanvas.width,targetCanvas.height,0,0,targetCanvas.width,targetCanvas.height)}function copyGLTo2DPutImageData(gl,pipelineState){var targetCanvas=pipelineState.targetCanvas,ctx=targetCanvas.getContext("2d"),dWidth=pipelineState.destinationWidth,dHeight=pipelineState.destinationHeight,numBytes=dWidth*dHeight*4,u8=new Uint8Array(this.imageBuffer,0,numBytes),u8Clamped=new Uint8ClampedArray(this.imageBuffer,0,numBytes),imgData;gl.readPixels(0,0,dWidth,dHeight,gl.RGBA,gl.UNSIGNED_BYTE,u8);imgData=new ImageData(u8Clamped,dWidth,dHeight);ctx.putImageData(imgData,0,0)}function IpadRedirection(){if(Estore.Shared.checkIsIpadOrNot()){const params=new Proxy(new URLSearchParams(window.location.search),{get:(searchParams,prop)=>searchParams.get(prop)});let landingPage,fabrictype,hash,tid,designId="",tweakOptionValueId="",designtools="";landingPage="design";typeof params.open=="undefined"||params.open==null?hash="":typeof params.open!="undefined"&¶ms.open!=null&¶ms.open!=""?hash="#"+params.open+"":(landingPage="preview",hash="");typeof params.designtool!="undefined"&¶ms.designtool!==null&&(designtools=params.designtool);fabrictype=typeof params.fabrictype!="undefined"&¶ms.fabrictype!=null&¶ms.fabrictype!=""?"?fabrictype"+params.fabrictype:"";let pathName=window.location.pathname.toLowerCase();pathName.indexOf("estore/design/duplicate")!==-1&&presets.duplicateDesignTemplateId?(landingPage="options",has="",designId=(fabrictype===""?"?":"&")+"designid="+presets.duplicateDesignTemplateId):pathName.indexOf("estore/design/editdesign")!==-1?pathName.indexOf("tweakoption")!==-1?(landingPage="tweakoption",has="",tweakOptionValueId=(fabrictype||designId?"&":"?")+"tweakOptionValueId="+presets.tweakOptionValueId):(landingPage="edit",has=""):pathName.indexOf("estore/design/createdesign")!==-1?(landingPage="options",has=""):pathName.indexOf("estore/design/")!==-1&&presets.Mode.toLowerCase()=="customerbuyingproduct"&&(landingPage=designtools!=null&&designtools!=""?"design":"options",has="");tid=typeof params.tid!="undefined"&¶ms.tid!=null&¶ms.tid!=""?"/"+params.tid:typeof presets!="undefined"&&presets.tid!=null&&presets.tid!=""?"/"+presets.tid:"";let mode="";presets.Mode!=undefined&&presets.Mode!=null&&presets.Mode!=""&&(mode=presets.Mode);let orderid="";
1if(presets.orderId!=undefined&&presets.orderId!=null&&presets.orderId!=""&&(orderid=presets.orderId),!CheckFromMyStore()){let url=window.origin+"/estore/mobile/"+landingPage+"/"+presets.productId+tid+fabrictype+designId+tweakOptionValueId;mode!=""&&(url+=url.lastIndexOf("?")>0?"&":"?",url+="previewmode="+mode);orderid!=""&&(url+=url.lastIndexOf("?")>0?"&":"?",url+="orderid="+orderid);designtools!=null&&designtools!=""&&(url+=url.lastIndexOf("?")>0?"&":"?",url+="designtool="+designtools);url+=hash;window.location.replace(url)}}}function CheckFromMyStore(){let arrayOfUrls=["estore/design/cmseditorderItem",],pathName=window.location.pathname.toLowerCase();if(typeof pathName!="undefined"&&pathName!=null&&pathName!="")for(var i=0;i<arrayOfUrls.length;i++)if(pathName.toLowerCase().indexOf(arrayOfUrls[i])!==-1)return!0;return!1}function getTitle(ele){let titleEle=$(ele.target).closest(".DdlStyleOpt");if(titleEle){let tData=titleEle.attr("data-opt-name");if(tData)return tData}}var JSON,fabric,Utils,Preview,__extends,Estore,IntroHandler,isMobile,Website,pushToDatalayer,pushCreationStudioToGTM,pushAdvanceStudioToGTM,PushGAFaceliftWarning,pushEStoreDesignPreviewToGTM;JSON||(JSON={}),function(){"use strict";function f(n){return n<10?"0"+n:n}function quote(string){return escapable.lastIndex=0,escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];
1return typeof c=="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];value&&typeof value=="object"&&typeof value.toJSON=="function"&&(value=value.toJSON(key));typeof rep=="function"&&(value=rep.call(holder,key,value));switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value)return"null";if(gap+=indent,partial=[],Object.prototype.toString.apply(value)==="[object Array]"){for(length=value.length,i=0;i<length;i+=1)partial[i]=str(i,value)||"null";return v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]",gap=mind,v}if(rep&&typeof rep=="object")for(length=rep.length,i=0;i<length;i+=1)typeof rep[i]=="string"&&(k=rep[i],v=str(k,value),v&&partial.push(quote(k)+(gap?": ":":")+v));else for(k in value)Object.prototype.hasOwnProperty.call(value,k)&&(v=str(k,value),v&&partial.push(quote(k)+(gap?": ":":")+v));return v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}",gap=mind,v}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(value,replacer,space){var i;if(gap="",indent="",typeof space=="number")for(i=0;i<space;i+=1)indent+=" ";else typeof space=="string"&&(indent=space);if(rep=replacer,replacer&&typeof replacer!="function"&&(typeof replacer!="object"||typeof replacer.length!="number"))throw new Error("JSON.stringify");return str("",{"":value})});typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value=="object")for(k in value)Object.prototype.hasOwnProperty.call(value,k)&&(v=walk(value,k),v!==undefined?value[k]=v:delete value[k]);return reviver.call(holder,key,value)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCo
1deAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),typeof reviver=="function"?walk({"":j},""):j;throw new SyntaxError("JSON.parse");})}(),function(){var root=this,previousUnderscore=root._,breaker={},ArrayProto=Array.prototype,ObjProto=Object.prototype,FuncProto=Function.prototype,push=ArrayProto.push,slice=ArrayProto.slice,concat=ArrayProto.concat,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,nativeForEach=ArrayProto.forEach,nativeMap=ArrayProto.map,nativeReduce=ArrayProto.reduce,nativeReduceRight=ArrayProto.reduceRight,nativeFilter=ArrayProto.filter,nativeEvery=ArrayProto.every,nativeSome=ArrayProto.some,nativeIndexOf=ArrayProto.indexOf,nativeLastIndexOf=ArrayProto.lastIndexOf,nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeBind=FuncProto.bind,_=function(obj){if(obj instanceof _)return obj;if(!(this instanceof _))return new _(obj);this._wrapped=obj},each,reduceError,any,lookupIterator,group,flatten,ctor,eq,entityMap,entityRegexes,idCounter,result;typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=_),exports._=_):root._=_;_.VERSION="1.4.3";each=_.each=_.forEach=function(obj,iterator,context){var i,l,key;if(obj!=null)if(nativeForEach&&obj.forEach===nativeForEach)obj.forEach(iterator,context);else if(obj.length===+obj.length){for(i=0,l=obj.length;i<l;i++)if(iterator.call(context,obj[i],i,obj)===breaker)return}else for(key in obj)if(_.has(obj,key)&&iterator.call(context,obj[key],key,obj)===breaker)return};_.map=_.collect=function(obj,iterator,context){var results=[];return obj==null?results:nativeMap&&obj.map===nativeMap?obj.map(iterator,context):(each(obj,function(value,index,list){results[results.length]=iterator.call(context,value,index,list)}),results)};reduceError="Reduce of empty array with no initial value";_.reduce=_.foldl=_.inject=function(obj,iterator,memo,context){var initial=arguments.length>2;if(obj==null&&(obj=[]),nativeReduce&&obj.reduce===nativeReduce)return context&&(iterator=_.bind(iterator,context)),initial?obj.reduce(iterator,memo):obj.reduce(iterator);if(each(obj,function(value,index,list){initial?memo=iterator.call(context,memo,value,index,list):(memo=value,initial=!0)}),!initial)throw new TypeError(reduceError);return memo};_.reduceRight=_.foldr=function(obj,iterator,memo,context){var initial=arguments.length>2,length,keys;if(obj==null&&(obj=[]),nativeReduceRight&&obj.reduceRight===nativeReduceRight)return context&&(iterator=_.bind(iterator,context)),initial?obj.reduceRight(iterator,memo):obj.reduceRight(iterator);if(length=obj.length,length!==+length&&(keys=_.keys(obj),length=keys.length),each(obj,function(value,index,list){index=keys?keys[--length]:--length;initial?memo=iterator.call(context,memo,obj[index],index,list):(memo=obj[index],initial=!0)}),!initial)throw new TypeError(reduceError);return memo};_.find=_.detect=function(obj,iterator,context){var result;return any(obj,function(value,index,list){if(iterator.call(context,value,index,list))return result=value,!0}),result};_.filter=_.select=function(obj,iterator,context){var results=[];return obj==null?results:nativeFilter&&obj.filter===nativeFilter?obj.filter(iterator,context):(each(obj,function(value,index,list){iterator.call(context,value,index,list)&&(results[results.length]=value)}),results)};_.reject=function(obj,iterator,context){return _.filter(obj,function(value,index,list){return!iterator.call(context,value,index,list)},context)};_.every=_.all=function(obj,iterator,context){iterator||(iterator=_.identity);var result=!0;return obj==null?result:nativeEvery&&obj.every===nativeEvery?obj.every(iterator,context):(each(obj,function(value,index,list){if(!(result=result&&iterator.call(context,value,index,list)))return breaker}),!!result)};any=_.some=_.any=function(obj,iterator,context){iterator||(iterator=_.identity);var result=!1;return obj==null?result:nativeSome&&obj.some===nativeSome?obj.some(iterator,context):(each(obj,function(value,index,list){if(result||(result=iterator.call(context,value,index,list)))return breaker}),!!result)};_.contains=_.include=function(obj,target){return obj==null?!1:nativeIndexOf&&obj.indexOf===nativeIndexOf?obj.indexOf(target)!=-1:any(obj,function(value){return value===target})};_.invoke=function(obj,method){var args=slice.call(arguments,2);return _.map(obj,function(value){return(_.isFunction(method)?method:value[method]).apply(value,args)})};_.pluck=function(obj,key){return _.map(obj,function(value){return value[key]})};_.where=function(obj,attrs){return _.isEmpty(attrs)?[]:_.filter(obj,function(value){for(var key in attrs)if(attrs[key]!==value[key])return!1;return!0})};_.max=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0]&&obj.length<65535)return Math.max.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return-Infinity;var result={computed:-Infinity,value:-Infinity};return each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed>=result.computed&&(result={value:value,computed:computed})}),result.value};_.min=function(obj,iterator,context){if(!iterator&&_.isArray(obj)&&obj[0]===+obj[0]&&obj.length<65535)return Math.min.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return Infinity;var result={computed:Infinity,value:Infinity};return each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed<result.computed&&(result={value:value,computed:computed})}),result.value};_.shuffle=function(obj){var rand,index=0,shuffled=[];return each(obj,function(value){rand=_.random(index++);shuffled[index-1]=shuffled[rand];shuffled[rand]=value}),shuffled};lookupIterator=function(value){return _.isFunction(value)?value:function(obj){return obj[value]}};_.sortBy=function(obj,value,context){var iterator=lookupIterator(value);return _.pluck(_.map(obj,function(value,index,list){return{value:value,index:index,criteria:iterator.call(context,value,index,list)}}).sort(function(left,right){var a=left.criteria,b=right.criteria;if(a!==b){if(a>b||a===void 0)return 1;if(a<b||b===void 0)return-1}return left.index<right.index?-1:1}),"value")};group=function(obj,value,context,behavior){var result={},iterator=lookupIterator(value||_.identity);return each(obj,function(value,index){var key=iterator.call(context,value,index,obj);behavior(result,key,value)}),result};_.groupBy=function(obj,value,context){return group(obj,value,context,function(result,key,value){(_.has(result,key)?result[key]:result[key]=[]).push(value)})};_.countBy=function(obj,value,context){return group(obj,value,context,function(result,key){_.has(result,key)||(result[key]=0);result[key]++})};_.sortedIndex=function(array,obj,iterator,context){var mid;iterator=iterator==null?_.identity:lookupIterator(iterator);for(var value=iterator.call(context,obj),low=0,high=array.length;low<high;)mid=low+high>>>1,iterator.call(context,array[mid])<value?low=mid+1:high=mid;return low};_.toArray=function(obj){return obj?_.isArray(obj)?slice.call(obj):obj.length===+obj.length?_.map(obj,_.identity):_.values(obj):[]};_.size=function(obj){return obj==null?0:obj.length===+obj.length?obj.length:_.keys(obj).length};_.first=_.head=_.take=function(array,n,guard){if(array!=null)return n!=null&&!guard?slice.call(array,0,n):array[0]};_.initial=function(array,n,guard){return slice.call(array,0,array.length-(n==null||guard?1:n))};_.last=function(array,n,guard){if(array!=null)return n==null||guard?array[array.length-1]:slice.call(array,Math.max(array.length-n,0))};_.rest=_.tail=_.drop=function(array,n,guard){return slice.call(array,n==null||guard?1:n)};_.compact=function(array){return _.filter(array,_.identity)};flatten=function(input,shallow,output){return each(input,function(value){_.isArray(value)?shallow?push.apply(output,value):flatten(value,shallow,output):output.push(value)}),output};_.flatten=function(array,shallow){return flatten(array,shallow,[])};_.without=function(array){return _.difference(array,slice.call(arguments,1
1))};_.uniq=_.unique=function(array,isSorted,iterator,context){_.isFunction(isSorted)&&(context=iterator,iterator=isSorted,isSorted=!1);var initial=iterator?_.map(array,iterator,context):array,results=[],seen=[];return each(initial,function(value,index){(isSorted?index&&seen[seen.length-1]===value:_.contains(seen,value))||(seen.push(value),results.push(array[index]))}),results};_.union=function(){return _.uniq(concat.apply(ArrayProto,arguments))};_.intersection=function(array){var rest=slice.call(arguments,1);return _.filter(_.uniq(array),function(item){return _.every(rest,function(other){return _.indexOf(other,item)>=0})})};_.difference=function(array){var rest=concat.apply(ArrayProto,slice.call(arguments,1));return _.filter(array,function(value){return!_.contains(rest,value)})};_.zip=function(){for(var args=slice.call(arguments),length=_.max(_.pluck(args,"length")),results=new Array(length),i=0;i<length;i++)results[i]=_.pluck(args,""+i);return results};_.object=function(list,values){var result,i,l;if(list==null)return{};for(result={},i=0,l=list.length;i<l;i++)values?result[list[i]]=values[i]:result[list[i][0]]=list[i][1];return result};_.indexOf=function(array,item,isSorted){if(array==null)return-1;var i=0,l=array.length;if(isSorted)if(typeof isSorted=="number")i=isSorted<0?Math.max(0,l+isSorted):isSorted;else return i=_.sortedIndex(array,item),array[i]===item?i:-1;if(nativeIndexOf&&array.indexOf===nativeIndexOf)return array.indexOf(item,isSorted);for(;i<l;i++)if(array[i]===item)return i;return-1};_.lastIndexOf=function(array,item,from){var hasIndex,i;if(array==null)return-1;if(hasIndex=from!=null,nativeLastIndexOf&&array.lastIndexOf===nativeLastIndexOf)return hasIndex?array.lastIndexOf(item,from):array.lastIndexOf(item);for(i=hasIndex?from:array.length;i--;)if(array[i]===item)return i;return-1};_.range=function(start,stop,step){arguments.length<=1&&(stop=start||0,start=0);step=arguments[2]||1;for(var len=Math.max(Math.ceil((stop-start)/step),0),idx=0,range=new Array(len);idx<len;)range[idx++]=start,start+=step;return range};ctor=function(){};_.bind=function(func,context){var args,bound;if(func.bind===nativeBind&&nativeBind)return nativeBind.apply(func,slice.call(arguments,1));if(!_.isFunction(func))throw new TypeError;return args=slice.call(arguments,2),bound=function(){var self,result;return(this instanceof bound)?(ctor.prototype=func.prototype,self=new ctor,ctor.prototype=null,result=func.apply(self,args.concat(slice.call(arguments))),Object(result)===result)?result:self:func.apply(context,args.concat(slice.call(arguments)))}};_.bindAll=function(obj){var funcs=slice.call(arguments,1);return funcs.length==0&&(funcs=_.functions(obj)),each(funcs,function(f){obj[f]=_.bind(obj[f],obj)}),obj};_.memoize=function(func,hasher){var memo={};return hasher||(hasher=_.identity),function(){var key=hasher.apply(this,arguments);return _.has(memo,key)?memo[key]:memo[key]=func.apply(this,arguments)}};_.delay=function(func,wait){var args=slice.call(arguments,2);return setTimeout(function(){return func.apply(null,args)},wait)};_.defer=function(func){return _.delay.apply(_,[func,1].concat(slice.call(arguments,1)))};_.throttle=function(func,wait){var context,args,timeout,result,previous=0,later=function(){previous=new Date;timeout=null;result=func.apply(context,args)};return function(){var now=new Date,remaining=wait-(now-previous);return context=this,args=arguments,remaining<=0?(clearTimeout(timeout),timeout=null,previous=now,result=func.apply(context,args)):timeout||(timeout=setTimeout(later,remaining)),result}};_.debounce=function(func,wait,immediate){var timeout,result;return function(){var context=this,args=arguments,later=function(){timeout=null;immediate||(result=func.apply(context,args))},callNow=immediate&&!timeout;return clearTimeout(timeout),timeout=setTimeout(later,wait),callNow&&(result=func.apply(context,args)),result}};_.once=function(func){var ran=!1,memo;return function(){return ran?memo:(ran=!0,memo=func.apply(this,arguments),func=null,memo)}};_.wrap=function(func,wrapper){return function(){var args=[func];return push.apply(args,arguments),wrapper.apply(this,args)}};_.compose=function(){var funcs=arguments;return function(){for(var args=arguments,i=funcs.length-1;i>=0;i--)args=[funcs[i].apply(this,args)];return args[0]}};_.after=function(times,func){return times<=0?func():function(){if(--times<1)return func.apply(this,arguments)}};_.keys=nativeKeys||function(obj){var keys,key;if(obj!==Object(obj))throw new TypeError("Invalid object");keys=[];for(key in obj)_.has(obj,key)&&(keys[keys.length]=key);return keys};_.values=function(obj){var values=[];for(var key in obj)_.has(obj,key)&&values.push(obj[key]);return values};_.pairs=function(obj){var pairs=[];for(var key in obj)_.has(obj,key)&&pairs.push([key,obj[key]]);return pairs};_.invert=function(obj){var result={};for(var key in obj)_.has(obj,key)&&(result[obj[key]]=key);return result};_.functions=_.methods=function(obj){var names=[];for(var key in obj)_.isFunction(obj[key])&&names.push(key);return names.sort()};
1_.extend=function(obj){return each(slice.call(arguments,1),function(source){if(source)for(var prop in source)obj[prop]=source[prop]}),obj};_.pick=function(obj){var copy={},keys=concat.apply(ArrayProto,slice.call(arguments,1));return each(keys,function(key){key in obj&&(copy[key]=obj[key])}),copy};_.omit=function(obj){var copy={},keys=concat.apply(ArrayProto,slice.call(arguments,1));for(var key in obj)_.contains(keys,key)||(copy[key]=obj[key]);return copy};_.defaults=function(obj){return each(slice.call(arguments,1),function(source){if(source)for(var prop in source)obj[prop]==null&&(obj[prop]=source[prop])}),obj};_.clone=function(obj){return _.isObject(obj)?_.isArray(obj)?obj.slice():_.extend({},obj):obj};_.tap=function(obj,interceptor){return interceptor(obj),obj};eq=function(a,b,aStack,bStack){var className,length,size,result,aCtor,bCtor,key;if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a instanceof _&&(a=a._wrapped),b instanceof _&&(b=b._wrapped),className=toString.call(a),className!=toString.call(b))return!1;switch(className){case"[object String]":return a==String(b);case"[object Number]":return a!=+a?b!=+b:a==0?1/a==1/b:a==+b;case"[object Date]":case"[object Boolean]":return+a==+b;case"[object RegExp]":return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase}if(typeof a!="object"||typeof b!="object")return!1;for(length=aStack.length;length--;)if(aStack[length]==a)return bStack[length]==b;if(aStack.push(a),bStack.push(b),size=0,result=!0,className=="[object Array]"){if(size=a.length,result=size==b.length,result)while(size--)if(!(result=eq(a[size],b[size],aStack,bStack)))break}else{if(aCtor=a.constructor,bCtor=b.constructor,aCtor!==bCtor&&!(_.isFunction(aCtor)&&aCtor instanceof aCtor&&_.isFunction(bCtor)&&bCtor instanceof bCtor))return!1;for(key in a)if(_.has(a,key)&&(size++,!(result=_.has(b,key)&&eq(a[key],b[key],aStack,bStack))))break;if(result){for(key in b)if(_.has(b,key)&&!size--)break;result=!size}}return aStack.pop(),bStack.pop(),result};_.isEqual=function(a,b){return eq(a,b,[],[])};_.isEmpty=function(obj){if(obj==null)return!0;if(_.isArray(obj)||_.isString(obj))return obj.length===0;for(var key in obj)if(_.has(obj,key))return!1;return!0};_.isElement=function(obj){return!!(obj&&obj.nodeType===1)};_.isArray=nativeIsArray||function(obj){return toString.call(obj)=="[object Array]"};_.isObject=function(obj){return obj===Object(obj)};each(["Arguments","Function","String","Number","Date","RegExp"],function(name){_["is"+name]=function(obj){return toString.call(obj)=="[object "+name+"]"}});_.isArguments(arguments)||(_.isArguments=function(obj){return!!(obj&&_.has(obj,"callee"))});typeof/./!="function"&&(_.isFunction=function(obj){return typeof obj=="function"});_.isFinite=function(obj){return isFinite(obj)&&!isNaN(parseFloat(obj))};_.isNaN=function(obj){return _.isNumber(obj)&&obj!=+obj};_.isBoolean=function(obj){return obj===!0||obj===!1||toString.call(obj)=="[object Boolean]"};_.isNull=function(obj){return obj===null};_.isUndefined=function(obj){return obj===void 0};_.has=function(obj,key){return hasOwnProperty.call(obj,key)};_.noConflict=function(){return root._=previousUnderscore,this};_.identity=function(value){return value};_.times=function(n,iterator,context){for(var accum=Array(n),i=0;i<n;i++)accum[i]=iterator.call(context,i);return accum};_.random=function(min,max){return max==null&&(max=min,min=0),min+(0|Math.random()*(max-min+1))};entityMap={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};entityMap.unescape=_.invert(entityMap.escape);entityRegexes={escape:new RegExp("["+_.keys(entityMap.escape).join("")+"]","g"),unescape:new RegExp("("+_.keys(entityMap.unescape).join("|")+")","g")};_.each(["escape","unescape"],function(method){_[method]=function(string){return string==null?"":(""+string).replace(entityRegexes[method],function(match){return entityMap[method][match]})}});_.result=function(object,property){if(object==null)return null;var value=object[property];return _.isFunction(value)?value.call(object):value};_.mixin=function(obj){each(_.functions(obj),function(name){var func=_[name]=obj[name];_.prototype[name]=function(){var args=[this._wrapped];return push.apply(args,arguments),result.call(this,func.apply(_,args))}})};idCounter=0;_.uniqueId=function(prefix){var id=""+ ++idCounter;return prefix?prefix+id:id};_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var noMatch=/(.)^/,escapes={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},escaper=/\\|'|\r|\n|\t|\u2028|\u2029/g;_.template=function(text,data,settings){var render,template;settings=_.defaults({},settings,_.templateSettings);var matcher=new RegExp([(settings.escape||noMatch).source,(settings.interpolate||noMatch).source,(settings.evaluate||noMatch).source].join("|")+"|$","g"),index=0,source="__p+='";text.replace(matcher,function(match,escape,interpolate,evaluate,offset){return source+=text.slice(index,offset).replace(escaper,function(match){return"\\"+escapes[match]}),escape&&(source+="'+\n((__t=("+escape+"))==null?'':_.escape(__t))+\n'"),interpolate&&(source+="'+\n((__t=("+interpolate+"))==null?'':__t)+\n'"),evaluate&&(source+="';\n"+evaluate+"\n__p+='"),index=offset+match.length,match});source+="';\n";settings.variable||(source="with(obj||{}){\n"+source+"}\n");source="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+source+"return __p;\n";try{render=new Function(settings.variable||"obj","_",source)}catch(e){e.source=source;throw e;}return data?render(data,_):(template=function(data){return render.call(this,data,_)},template.source="function("+(settings.variable||"obj")+"){\n"+source+"}",template)};_.chain=function(obj){return _(obj).chain()};result=function(obj){return this._chain?_(obj).chain():obj};_.mixin(_);each(["pop","push","reverse","shift","sort","splice","unshift"],function(name){var method=ArrayProto[name];_.prototype[name]=function(){var obj=this._wrapped;return method.apply(obj,arguments),(name=="shift"||name=="splice")&&obj.length===0&&delete obj[0],result.call(this,obj)}});each(["concat","join","slice"],function(name){var method=ArrayProto[name];_.prototype[name]=function(){return result.call(this,method.apply(this._wrapped,arguments))}});_.extend(_.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this); 2/*! 3 * Flickity PACKAGED v2.2.1 4 * Touch, responsive, flickable carousels 5 * 6 * Licensed GPLv3 for open source use 7 * or Flickity Commercial License for commercial use 8 * 9 * https://flickity.metafizzy.co 10 * Copyright 2015-2019 Metafizzy 11 */ 12!function(e,i){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("jquery")):e.jQueryBridget=i(e,e.jQuery)}(window,function(t,e){"use strict";function s(h,s,c){(c=c||e||t.jQuery)&&(s.prototype.option||(s.prototype.option=function(t){c.isPlainObject(t)&&(this.options=c.extend(!0,this.options,t))}),c.fn[h]=function(t){return"string"==typeof t?function(t,o,r){var a,l="$()."+h+'("'+o+'")';return t.each(function(t,e){var i=c.data(e,h),n,s;i?(n=i[o],n&&"_"!=o.charAt(0)?(s=n.apply(i,r),a=void 0===a?s:a):d(l+" is not a valid method")):d(h+" not initialized. Cannot call methods, i.e. "+l)}),void 0!==a?a:t}
12(this,t,i.call(arguments,1)):(function(t,n){t.each(function(t,e){var i=c.data(e,h);i?(i.option(n),i._init()):(i=new s(e,n),c.data(e,h,i))})}(this,t),this)},o(c))}function o(t){!t||t&&t.bridget||(t.bridget=s)}var i=Array.prototype.slice,n=t.console,d=void 0===n?function(){}:function(t){n.error(t)};return o(e||t.jQuery),s}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t],n;if(i&&i.length)return n=i.indexOf(e),-1!=n&&i.splice(n,1),this},e.emitEvent=function(t,e){var i=this._events&&this._events[t],n,s,o;if(i&&i.length){for(i=i.slice(0),e=e||[],n=this._onceEvents&&this._onceEvents[t],s=0;s<i.length;s++)o=i[s],n&&n[o]&&(this.off(t,o),delete n[o]),o.apply(this,e);return this}},e.allOff=function(){delete this._events;delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function m(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}function E(t){var e=getComputedStyle(t);return e||i("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function x(t){var e,i,n,s,v;if(function(){var t,e,i;C||(C=!0,t=document.createElement("div"),t.style.width="200px",t.style.padding="1px 2px 3px 4px",t.style.borderStyle="solid",t.style.borderWidth="1px 2px 3px 4px",t.style.boxSizing="border-box",e=document.body||document.documentElement,e.appendChild(t),i=E(t),S=200==Math.round(m(i.width)),x.isBoxSizeOuter=S,e.removeChild(t))}(),"string"==typeof t&&(t=document.querySelector(t)),t&&"object"==typeof t&&t.nodeType){if(e=E(t),"none"==e.display)return function(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e<b;e++)t[y[e]]=0;return t}();for(i={},i.width=t.offsetWidth,i.height=t.offsetHeight,n=i.isBorderBox="border-box"==e.boxSizing,s=0;s<b;s++){var o=y[s],r=e[o],a=parseFloat(r);i[o]=isNaN(a)?0:a}var l=i.paddingLeft+i.paddingRight,h=i.paddingTop+i.paddingBottom,c=i.marginLeft+i.marginRight,d=i.marginTop+i.marginBottom,u=i.borderLeftWidth+i.borderRightWidth,f=i.borderTopWidth+i.borderBottomWidth,p=n&&S,g=m(e.width);return!1!==g&&(i.width=g+(p?0:l+u)),v=m(e.height),!1!==v&&(i.height=v+(p?0:h+f)),i.innerWidth=i.width-(l+u),i.innerHeight=i.height-(h+f),i.outerWidth=i.width+c,i.outerHeight=i.height+d,i}}var i="undefined"==typeof console?function(){}:function(t){console.error(t)},y=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],b=y.length,S,C=!1;return x}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var i=function(){var t=window.Element.prototype,e,i,n;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(e=["webkit","moz","ms","o"],i=0;i<e.length;i++)if(n=e[i]+"MatchesSelector",t[n])return n}();return function(t,e){return t[i](e)}}),function(e,i){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["de
12sandro-matches-selector/matches-selector"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("desandro-matches-selector")):e.fizzyUIUtils=i(e,e.matchesSelector)}(window,function(h,o){var c={extend:function(t,e){for(var i in e)t[i]=e[i];return t},modulo:function(t,e){return(t%e+e)%e}},e=Array.prototype.slice,d;return c.makeArray=function(t){return Array.isArray(t)?t:null==t?[]:"object"==typeof t&&"number"==typeof t.length?e.call(t):[t]},c.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},c.getParent=function(t,e){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,o(t,e))return t},c.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},c.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},c.filterFindElements=function(t,n){t=c.makeArray(t);var s=[];return t.forEach(function(t){if(t instanceof HTMLElement)if(n){o(t,n)&&s.push(t);for(var e=t.querySelectorAll(n),i=0;i<e.length;i++)s.push(e[i])}else s.push(t)}),s},c.debounceMethod=function(t,e,n){n=n||100;var s=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o],e,i;clearTimeout(t);e=arguments;i=this;this[o]=setTimeout(function(){s.apply(i,e);delete i[o]},n)}},c.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},c.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()},d=h.console,c.htmlInit=function(a,l){c.docReady(function(){var t=c.toDashed(l),s="data-"+t,e=document.querySelectorAll("["+s+"]"),i=document.querySelectorAll(".js-"+t),n=c.makeArray(e).concat(c.makeArray(i)),o=s+"-options",r=h.jQuery;n.forEach(function(e){var t,i=e.getAttribute(s)||e.getAttribute(o),n;try{t=i&&JSON.parse(i)}catch(t){return void(d&&d.error("Error parsing "+s+" on "+e.className+": "+t))}n=new a(e,t);r&&r.data(e,l,n)})})},c}),function(e,i){"function"==typeof define&&define.amd?define("flickity/js/cell",["get-size/get-size"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("get-size")):(e.Flickity=e.Flickity||{},e.Flickity.Cell=i(e,e.getSize))}(window,function(t,e){function i(t,e){this.element=t;this.parent=e;this.create()}var n=i.prototype;return n.create=function(){this.element.style.position="absolute";this.element.setAttribute("aria-hidden","true");this.x=0;this.shift=0},n.destroy=function(){this.unselect();this.element.style.position="";var t=this.parent.originSide;this.element.style[t]=""},n.getSize=function(){this.size=e(this.element)},n.setPosition=function(t){this.x=t;this.updateTarget();this.renderPosition(t)},n.updateTarget=n.setDefaultTarget=function(){var t="left"==this.parent.originSide?"marginLeft":"marginRight";this.target=this.x+this.size[t]+this.size.width*this.parent.cellAlign},n.renderPosition=function(t){var e=this.parent.originSide;this.element.style[e]=this.parent.getPositionValue(t)},n.select=function(){this.element.classList.add("is-selected");this.element.removeAttribute("aria-hidden")},n.unselect=function(){this.element.classList.remove("is-selected");this.element.setAttribute("aria-hidden","true")},n.wrapShift=function(t){this.shift=t;this.renderPosition(this.x+this.parent.slideableWidth*t)},n.remove=function(){this.element.parentNode.removeChild(this.element)},i}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/slide",e):"object"==typeof module&&module.exports?module.exports=e():(t.Flickity=t.Flickity||{},t.Flickity.Slide=e())}(window,function(){"use strict";function t(t){this.parent=t;this.isOriginLeft="left"==t.originSide;this.cells=[];this.outerWidth=0;this.height=0}var e=t.prototype;return e.addCell=function(t){if(this.cells.push(t),this.outerWidth+=t.size.outerWidth,this.height=Math.max(t.size.outerHeight,this.height),1==this.cells.length){this.x=t.x;var e=this.isOriginLeft?"marginLeft":"marginRight";this.firstMargin=t.size[e]}},e.updateTarget=function(){var t=this.isOriginLeft?"marginRight":"marginLeft",e=this.getLastCell(),i=e?e.size[t]:0,n=this.outerWidth-(this.firstMargin+i);this.target=this.x+this.firstMargin+n*this.parent.cellAlign},e.getLastCell=function(){return this.cells[this.cells.length-1]}
12,e.select=function(){this.cells.forEach(function(t){t.select()})},e.unselect=function(){this.cells.forEach(function(t){t.unselect()})},e.getCellElements=function(){return this.cells.map(function(t){return t.element})},t}),function(e,i){"function"==typeof define&&define.amd?define("flickity/js/animate",["fizzy-ui-utils/utils"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("fizzy-ui-utils")):(e.Flickity=e.Flickity||{},e.Flickity.animatePrototype=i(e,e.fizzyUIUtils))}(window,function(t,e){return{startAnimation:function(){this.isAnimating||(this.isAnimating=!0,this.restingFrames=0,this.animate())},animate:function(){var t,e;this.applyDragForce();this.applySelectedAttraction();t=this.x;(this.integratePhysics(),this.positionSlider(),this.settle(t),this.isAnimating)&&(e=this,requestAnimationFrame(function(){e.animate()}))},positionSlider:function(){var t=this.x;this.options.wrapAround&&1<this.cells.length&&(t=e.modulo(t,this.slideableWidth),t-=this.slideableWidth,this.shiftWrapCells(t));this.setTranslateX(t,this.isAnimating);this.dispatchScrollEvent()},setTranslateX:function(t,e){t+=this.cursorPosition;t=this.options.rightToLeft?-t:t;var i=this.getPositionValue(t);this.slider.style.transform=e?"translate3d("+i+",0,0)":"translateX("+i+")"},dispatchScrollEvent:function(){var t=this.slides[0],e,i;t&&(e=-this.x-t.target,i=e/this.slidesWidth,this.dispatchEvent("scroll",null,[i,e]))},positionSliderAtSelected:function(){this.cells.length&&(this.x=-this.selectedSlide.target,this.velocity=0,this.positionSlider())},getPositionValue:function(t){return this.options.percentPosition?.01*Math.round(t/this.size.innerWidth*1e4)+"%":Math.round(t)+"px"},settle:function(t){this.isPointerDown||Math.round(100*this.x)!=Math.round(100*t)||this.restingFrames++;2<this.restingFrames&&(this.isAnimating=!1,delete this.isFreeScrolling,this.positionSlider(),this.dispatchEvent("settle",null,[this.selectedIndex]))},shiftWrapCells:function(t){var e=this.cursorPosition+t,i;this._shiftCells(this.beforeShiftCells,e,-1);i=this.size.innerWidth-(t+this.slideableWidth+this.cursorPosition);this._shiftCells(this.afterShiftCells,i,1)},_shiftCells:function(t,e,i){for(var s,o,n=0;n<t.length;n++)s=t[n],o=0<e?i:0,s.wrapShift(o),e-=s.size.outerWidth},_unshiftCells:function(t){if(t&&t.length)for(var e=0;e<t.length;e++)t[e].wrapShift(0)},integratePhysics:function(){this.x+=this.velocity;this.velocity*=this.getFrictionFactor()},applyForce:function(t){this.velocity+=t},getFrictionFactor:function(){return 1-this.options[this.isFreeScrolling?"freeScrollFriction":"friction"]},getRestingPosition:function(){return this.x+this.velocity/(1-this.getFrictionFactor())},applyDragForce:function(){if(this.isDraggable&&this.isPointerDown){var t=this.dragX-this.x-this.velocity;this.applyForce(t)}},applySelectedAttraction:function(){if(!(this.isDraggable&&this.isPointerDown)&&!this.isFreeScrolling&&this.slides.length){var t=(-1*this.selectedSlide.target-this.x)*this.options.selectedAttraction;this.applyForce(t)}}}}),function(r,a){if("function"==typeof define&&define.amd)define("flickity/js/flickity",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./cell","./slide","./animate"],function(t,e,i,n,s,o){return a(r,t,e,i,n,s,o)});else if("object"==typeof module&&module.exports)module.exports=a(r,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./cell"),require("./sli
12de"),require("./animate"));else{var t=r.Flickity;r.Flickity=a(r,r.EvEmitter,r.getSize,r.fizzyUIUtils,t.Cell,t.Slide,t.animatePrototype)}}(window,function(n,t,e,a,i,r,s){function c(t,e){for(t=a.makeArray(t);t.length;)e.appendChild(t.shift())}function f(t,e){var i=a.getQueryElement(t),n;if(i){if(this.element=i,this.element.flickityGUID)return n=u[this.element.flickityGUID],n.option(e),n;l&&(this.$element=l(this.element));this.options=a.extend({},this.constructor.defaults);this.option(e);this._create()}else h&&h.error("Bad element for Flickity: "+(i||t))}var l=n.jQuery,o=n.getComputedStyle,h=n.console,d=0,u={},p,g;return f.defaults={accessibility:!0,cellAlign:"center",freeScrollFriction:.075,friction:.28,namespaceJQueryEvents:!0,percentPosition:!0,resize:!0,selectedAttraction:.025,setGallerySize:!0},f.createMethods=[],p=f.prototype,a.extend(p,t.prototype),p._create=function(){var t=this.guid=++d,e,i;for(e in this.element.flickityGUID=t,(u[t]=this).selectedIndex=0,this.restingFrames=0,this.x=0,this.velocity=0,this.originSide=this.options.rightToLeft?"right":"left",this.viewport=document.createElement("div"),this.viewport.className="flickity-viewport",this._createSlider(),(this.options.resize||this.options.watchCSS)&&n.addEventListener("resize",this),this.options.on){i=this.options.on[e];this.on(e,i)}f.createMethods.forEach(function(t){this[t]()},this);this.options.watchCSS?this.watchCSS():this.activate()},p.option=function(t){a.extend(this.options,t)},p.activate=function(){this.isActive||(this.isActive=!0,this.element.classList.add("flickity-enabled"),this.options.rightToLeft&&this.element.classList.add("flickity-rtl"),this.getSize(),c(this._filterFindCellElements(this.element.children),this.slider),this.viewport.appendChild(this.slider),this.element.appendChild(this.viewport),this.reloadCells(),this.options.accessibility&&(this.element.tabIndex=0,this.element.addEventListener("keydown",this)),this.emitEvent("activate"),this.selectInitialIndex(),this.isInitActivated=!0,this.dispatchEvent("ready"))},p._createSlider=function(){var t=document.createElement("div");t.className="flickity-slider";t.style[this.originSide]=0;this.slider=t},p._filterFindCellElements=function(t){return a.filterFindElements(t,this.options.cellSelector)},p.reloadCells=function(){this.cells=this._makeCells(this.slider.children);this.positionCells();this._getWrapShiftCells();this.setGallerySize()},p._makeCells=function(t){return this._filterFindCellElements(t).map(function(t){return new i(t,this)},this)},p.getLastCell=function(){return this.cells[this.cells.length-1]},p.getLastSlide=function(){return this.slides[this.slides.length-1]},p.positionCells=function(){this._sizeCells(this.cells);this._positionCells(0)},p._positionCells=function(t){var e,i,n,s,o;for(t=t||0,this.maxCellHeight=t&&this.maxCellHeight||0,e=0,0<t&&(i=this.cells[t-1],e=i.x+i.size.outerWidth),n=this.cells.length,s=t;s<n;s++)o=this.cells[s],o.setPosition(e),e+=o.size.outerWidth,this.maxCellHeight=Math.max(o.size.outerHeight,this.maxCellHeight);this.slideableWidth=e;this.updateSlides();this._containSlides();this.slidesWidth=n?this.getLastSlide().target-this.slides[0].target:0},p._sizeCells=function(t){t.forEach(function(t){t.getSize()})},p.updateSlides=function(){var n,s,o;(this.slides=[],this.cells.length)&&(n=new r(this),this.slides.push(n),s="left"==this.originSide?"marginRight":"marginLeft",o=this._getCanCellFit(),this.cells.forEach(function(t,e){if(n.cells.length){var i=n.outerWidth-n.firstMargin+(t.size.outerWidth-t.size[s]);o.call(this,e,i)||(n.updateTarget(),n=new r(this),this.slides.push(n));n.addCell(t)}else n.addCell(t)},this),n.updateTarget(),this.updateSelectedSlide())},p._getCanCellFit=function(){var t=this.options.groupCells,e,i,n;return t?"number"==typeof t?(e=parseInt(t,10),function(t){return t%e!=0}):(i="string"==typeof t&&t.match(/^(\d+)%$/),n=i?parseInt(i[1],10)/100:1,function(t,e){return e<=(this.size.innerWidth+1)*n}):function(){return!1}},p._init=p.reposition=function(){this.positionCells();this.positionSliderAtSelected()},p.getSize=function(){this.size=e(this.element);this.setCellAlign();this.cursorPosition=this.size.innerWidth*this.cellAlign},g={center:{left:.5,right:.5},left:{left:0,right:1},right:{right:0,left:1}},p.setCellAlign=function(){var t=g[this.options.cellAlign];this.cellAlign=t?t[this.originSide]:this.options.cellAlign},p.setGallerySize=function(){if(this.options.setGallerySize){var t=this.options.adaptiveHeight&&this.selectedSlide?this.selectedSlide.height:this.maxCellHeight;this.viewport.style.height=t+"px"}},p._getWrapShiftCells=function(){if(this.options.wrapAround){this._unshiftCells(this.beforeShiftCells);this._unshiftCells(this.afterShiftCells);var t=this.cursorPosition,e=this.cells.length-1;this.beforeShiftCells=this._getGapCells(t,e,-1);
12t=this.size.innerWidth-this.cursorPosition;this.afterShiftCells=this._getGapCells(t,0,1)}},p._getGapCells=function(t,e,i){for(var s,n=[];0<t;){if(s=this.cells[e],!s)break;n.push(s);e+=i;t-=s.size.outerWidth}return n},p._containSlides=function(){if(this.options.contain&&!this.options.wrapAround&&this.cells.length){var t=this.options.rightToLeft,e=t?"marginRight":"marginLeft",i=t?"marginLeft":"marginRight",n=this.slideableWidth-this.getLastCell().size[i],s=n<this.size.innerWidth,o=this.cursorPosition+this.cells[0].size[e],r=n-this.size.innerWidth*(1-this.cellAlign);this.slides.forEach(function(t){s?t.target=n*this.cellAlign:(t.target=Math.max(t.target,o),t.target=Math.min(t.target,r))},this)}},p.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i,s,o;(this.emitEvent(t,n),l&&this.$element)&&(s=t+=this.options.namespaceJQueryEvents?".flickity":"",e&&(o=l.Event(e),o.type=t,s=o),this.$element.trigger(s,i))},p.select=function(t,e,i){if(this.isActive&&(t=parseInt(t,10),this._wrapSelect(t),(this.options.wrapAround||e)&&(t=a.modulo(t,this.slides.length)),this.slides[t])){var n=this.selectedIndex;this.selectedIndex=t;this.updateSelectedSlide();i?this.positionSliderAtSelected():this.startAnimation();this.options.adaptiveHeight&&this.setGallerySize();this.dispatchEvent("select",null,[t]);t!=n&&this.dispatchEvent("change",null,[t]);this.dispatchEvent("cellSelect")}},p._wrapSelect=function(t){var e=this.slides.length;if(!(this.options.wrapAround&&1<e))return t;var i=a.modulo(t,e),n=Math.abs(i-this.selectedIndex),s=Math.abs(i+e-this.selectedIndex),o=Math.abs(i-e-this.selectedIndex);!this.isDragSelect&&s<n?t+=e:!this.isDragSelect&&o<n&&(t-=e);t<0?this.x-=this.slideableWidth:e<=t&&(this.x+=this.slideableWidth)},p.previous=function(t,e){this.select(this.selectedIndex-1,t,e)},p.next=function(t,e){this.select(this.selectedIndex+1,t,e)},p.updateSelectedSlide=function(){var t=this.slides[this.selectedIndex];t&&(this.unselectSelectedSlide(),(this.selectedSlide=t).select(),this.selectedCells=t.cells,this.selectedElements=t.getCellElements(),this.selectedCell=t.cells[0],this.selectedElement=this.selectedElements[0])},p.unselectSelectedSlide=function(){this.selectedSlide&&this.selectedSlide.unselect()},p.selectInitialIndex=function(){var t=this.options.initialIndex,e;if(this.isInitActivated)this.select(this.selectedIndex,!1,!0);else{if(t&&"string"==typeof t&&this.queryCell(t))return void this.selectCell(t,!1,!0);e=0;t&&this.slides[t]&&(e=t);this.select(e,!1,!0)}},p.selectCell=function(t,e,i){var n=this.queryCell(t),s;n&&(s=this.getCellSlideIndex(n),this.select(s,e,i))},p.getCellSlideIndex=function(t){for(var e=0;e<this.slides.length;e++)if(-1!=this.slides[e].cells.indexOf(t))return e},p.getCell=function(t){for(var i,e=0;e<this.cells.length;e++)if(i=this.cells[e],i.element==t)return i},p.getCells=function(t){t=a.makeArray(t);var i=[];return t.forEach(function(t){var e=this.getCell(t);e&&i.push(e)},this),i},p.getCellElements=function(){return this.cells.map(function(t){return t.element})},p.getParentCell=function(t){var e=this.getCell(t);return e||(t=a.getParent(t,".flickity-slider > *"),this.getCell(t))},p.getAdjacentCellElements=function(t,e){var i,n,s,o,r;if(!t)return this.selectedSlide.getCellElements();if(e=void 0===e?this.selectedIndex:e,i=this.slides.length,i<=1+2*t)return this.getCellElements();for(n=[],s=e-t;s<=e+t;s++)o=this.options.wrapAround?a.modulo(s,i):s,r=this.slides[o],r&&(n=n.concat(r.getCellElements()));return n},p.queryCell=function(t){if("number"==typeof t)return this.cells[t];if("string"==typeof t){if(t.match(/^[#\.]?[\d\/]/))return;t=this.element.querySelector(t)}return this.getCell(t)},p.uiChange=function(){this.emitEvent("uiChange")},p.childUIPointerDown=function(t){"touchstart"!=t.type&&t.preventDefault();this.focus()},p.onresize=function(){this.watchCSS();this.resize()},a.debounceMethod(f,"onresize",150),p.resize=function(){if(this.isActive){this.getSize();this.options.wrapAround&&(this.x=a.modulo(this.x,this.slideableWidth));this.positionCells();this._getWrapShiftCells();this.setGallerySize();this.emitEvent("resize");var t=this.selectedElements&&this.selectedElements[0];this.selectCell(t,!1,!0)}},p.watchCSS=function(){this.options.watchCSS&&(-1!=o(this.element,":after").content.indexOf("flickity")?this.activate():this.deactivate())},p.onkeydown=function(t){var e=document.activeElement&&document.activeElement!=this.element,i;this.options.accessibility&&!e&&(i=f.keyboardHandlers[t.keyCode],i&&i.call(this))},f.keyboardHandlers={37:function(){var t=this.options.rightToLeft?"next":"previous";this.uiChange();this[t]()},39:function(){var t=this.options.rightToLeft?"previous":"next";this.uiChange();this[t]()}},p.focus=function(){var t=n.pageYOffset;this.element.focus({preventScroll:!0});n.pageYOffset!=t&&n.scrollTo(n.pageXOffset,t)},p.deactivate=function(){this.isActive&&(this.element.classList.remove("flickity-enabled"),this.element.classList.remove("flickity-rtl"),this.unselectSelectedSlide(),this.cells.forEac
12h(function(t){t.destroy()}),this.element.removeChild(this.viewport),c(this.slider.children,this.element),this.options.accessibility&&(this.element.removeAttribute("tabIndex"),this.element.removeEventListener("keydown",this)),this.isActive=!1,this.emitEvent("deactivate"))},p.destroy=function(){this.deactivate();n.removeEventListener("resize",this);this.allOff();this.emitEvent("destroy");l&&this.$element&&l.removeData(this.element,"flickity");delete this.element.flickityGUID;delete u[this.guid]},a.extend(p,s),f.data=function(t){var e=(t=a.getQueryElement(t))&&t.flickityGUID;return e&&u[e]},a.htmlInit(f,"flickity"),l&&l.bridget&&l.bridget("flickity",f),f.setJQuery=function(t){l=t},f.Cell=i,f.Slide=r,f}),function(e,i){"function"==typeof define&&define.amd?define("unipointer/unipointer",["ev-emitter/ev-emitter"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("ev-emitter")):e.Unipointer=i(e,e.EvEmitter)}(window,function(s,t){function e(){}var i=e.prototype=Object.create(t.prototype),n;return i.bindStartEvent=function(t){this._bindStartEvent(t,!0)},i.unbindStartEvent=function(t){this._bindStartEvent(t,!1)},i._bindStartEvent=function(t,e){var i=(e=void 0===e||e)?"addEventListener":"removeEventListener",n="mousedown";s.PointerEvent?n="pointerdown":"ontouchstart"in s&&(n="touchstart");t[i](n,this)},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.getTouch=function(t){for(var i,e=0;e<t.length;e++)if(i=t[e],i.identifier==this.pointerIdentifier)return i},i.onmousedown=function(t){var e=t.button;e&&0!==e&&1!==e||this._pointerDown(t,t)},i.ontouchstart=function(t){this._pointerDown(t,t.changedTouches[0])},i.onpointerdown=function(t){this._pointerDown(t,t)},i._pointerDown=function(t,e){t.button||this.isPointerDown||(this.isPointerDown=!0,this.pointerIdentifier=void 0!==e.pointerId?e.pointerId:e.identifier,this.pointerDown(t,e))},i.pointerDown=function(t,e){this._bindPostStartEvents(t);this.emitEvent("pointerDown",[t,e])},n={mousedown:["mousemove","mouseup"],touchstart:["touchmove","touchend","touchcancel"],pointerdown:["pointermove","pointerup","pointercancel"]},i._bindPostStartEvents=function(t){if(t){var e=n[t.type];e.forEach(function(t){s.addEventListener(t,this)},this);this._boundPointerEvents=e}},i._unbindPostStartEvents=function(){this._boundPointerEvents&&(this._boundPointerEvents.forEach(function(t){s.removeEventListener(t,this)},this),delete this._boundPointerEvents)},i.onmousemove=function(t){this._pointerMove(t,t)},i.onpointermove=function(t){t.pointerId==this.pointerIdentifier&&this._pointerMove(t,t)},i.ontouchmove=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerMove(t,e)},i._pointerMove=function(t,e){this.pointerMove(t,e)},i.pointerMove=function(t,e){this.emitEvent("pointerMove",[t,e])},i.onmouseup=function(t){this._pointerUp(t,t)},i.onpointerup=function(t){t.pointerId==this.pointerIdentifier&&this._pointerUp(t,t)},i.ontouchend=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerUp(t,e)},i._pointerUp=function(t,e){this._pointerDone();this.pointerUp(t,e)},i.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e])},i._pointerDone=function(){this._pointerReset();this._unbindPostStartEvents();this.pointerDone()},i._pointerReset=function(){this.isPointerDown=!1;delete this.pointerIdentifier},i.pointerDone=function(){},i.onpointercancel=function(t){t.pointerId==this.pointerIdentifier&&this._pointerCancel(t,t)},i.ontouchcancel=function(t){var e=this.getTouch(t.changedTouches);e&&this._pointerCancel(t,e)},i._pointerCancel=function(t,e){this._pointerDone();this.pointerCancel(t,e)},i.pointerCancel=function(t,e){this.emitEvent("pointerCancel",[t,e])},e.getPointerPoint=function(t){return{x:t.pageX,y:t.pageY}},e}),function(e,i){"function"==typeof define&&define.amd?define("unidragger/unidragger",["unipointer/unipointer"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("unipointer")):e.Unidragger=i(e,e.Unipointer)}(window,function(o,t){function e(){}var i=e.prototype=Object.create(t.prototype),s,r;return i.bindHandles=function(){this._bindHandles(!0)},i.unbindHandles=function(){this._bindHandles(!1)},i._bindHandles=function(t){for(var s,e=(t=void 0===t||t)?"addEventListener":"removeEventListener",i=t?this._touchActionValue:"",n=0;n<this.handles.length;n++)s=this.handles[n],this._bindStartEvent(s,t),s[e]("click",this),o.PointerEvent&&(s.style.touchAction=i)},i._touchActionValue="none",i.pointerDown=function(t,e){this.okayPointerDown(t)&&(this.pointerDownPointer=e,t.preventDefault(),this.pointerDownBlur(),this._bindPostStartEvents(t),this.emitEvent("pointerDown",[t,e]))},s={TEXTAREA:!0,INPUT:!0,SELECT:!0,OPTION:!0},r={radio:!0,checkbox:!0,button:!0,submit:!0,image:!0,file:!0},i.okayPointerDown=function(t){var e=s[t.target.nodeName],i=r[t.target.type],n=!e||i;
12return n||this._pointerReset(),n},i.pointerDownBlur=function(){var t=document.activeElement;t&&t.blur&&t!=document.body&&t.blur()},i.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.emitEvent("pointerMove",[t,e,i]);this._dragMove(t,e,i)},i._dragPointerMove=function(t,e){var i={x:e.pageX-this.pointerDownPointer.pageX,y:e.pageY-this.pointerDownPointer.pageY};return!this.isDragging&&this.hasDragStarted(i)&&this._dragStart(t,e),i},i.hasDragStarted=function(t){return 3<Math.abs(t.x)||3<Math.abs(t.y)},i.pointerUp=function(t,e){this.emitEvent("pointerUp",[t,e]);this._dragPointerUp(t,e)},i._dragPointerUp=function(t,e){this.isDragging?this._dragEnd(t,e):this._staticClick(t,e)},i._dragStart=function(t,e){this.isDragging=!0;this.isPreventingClicks=!0;this.dragStart(t,e)},i.dragStart=function(t,e){this.emitEvent("dragStart",[t,e])},i._dragMove=function(t,e,i){this.isDragging&&this.dragMove(t,e,i)},i.dragMove=function(t,e,i){t.preventDefault();this.emitEvent("dragMove",[t,e,i])},i._dragEnd=function(t,e){this.isDragging=!1;
12setTimeout(function(){delete this.isPreventingClicks}.bind(this));this.dragEnd(t,e)},i.dragEnd=function(t,e){this.emitEvent("dragEnd",[t,e])},i.onclick=function(t){this.isPreventingClicks&&t.preventDefault()},i._staticClick=function(t,e){this.isIgnoringMouseUp&&"mouseup"==t.type||(this.staticClick(t,e),"mouseup"!=t.type&&(this.isIgnoringMouseUp=!0,setTimeout(function(){delete this.isIgnoringMouseUp}.bind(this),400)))},i.staticClick=function(t,e){this.emitEvent("staticClick",[t,e])},e.getPointerPoint=t.getPointerPoint,e}),function(n,s){"function"==typeof define&&define.amd?define("flickity/js/drag",["./flickity","unidragger/unidragger","fizzy-ui-utils/utils"],function(t,e,i){return s(n,t,e,i)}):"object"==typeof module&&module.exports?module.exports=s(n,require("./flickity"),require("unidragger"),require("fizzy-ui-utils")):n.Flickity=s(n,n.Flickity,n.Unidragger,n.fizzyUIUtils)}(window,function(i,t,e,a){function l(){return{x:i.pageXOffset,y:i.pageYOffset}}var n,s,o,r;return a.extend(t.defaults,{draggable:">1",dragThreshold:3}),t.createMethods.push("_createDrag"),n=t.prototype,a.extend(n,e.prototype),n._touchActionValue="pan-y",s="createTouch"in document,o=!1,n._createDrag=function(){this.on("activate",this.onActivateDrag);this.on("uiChange",this._uiChangeDrag);this.on("deactivate",this.onDeactivateDrag);this.on("cellChange",this.updateDraggable);s&&!o&&(i.addEventListener("touchmove",function(){}),o=!0)},n.onActivateDrag=function(){this.handles=[this.viewport];this.bindHandles();this.updateDraggable()},n.onDeactivateDrag=function(){this.unbindHandles();this.element.classList.remove("is-draggable")},n.updateDraggable=function(){this.isDraggable=">1"==this.options.draggable?1<this.slides.length:this.options.draggable;this.isDraggable?this.element.classList.add("is-draggable"):this.element.classList.remove("is-draggable")},n.bindDrag=function(){this.options.draggable=!0;this.updateDraggable()},n.unbindDrag=function(){this.options.draggable=!1;this.updateDraggable()},n._uiChangeDrag=function(){delete this.isFreeScrolling},n.pointerDown=function(t,e){this.isDraggable?this.okayPointerDown(t)&&(this._pointerDownPreventDefault(t),this.pointerDownFocus(t),document.activeElement!=this.element&&this.pointerDownBlur(),this.dragX=this.x,this.viewport.classList.add("is-pointer-down"),this.pointerDownScroll=l(),i.addEventListener("scroll",this),this._pointerDownDefault(t,e)):this._pointerDownDefault(t,e)},n._pointerDownDefault=function(t,e){this.pointerDownPointer={pageX:e.pageX,pageY:e.pageY};this._bindPostStartEvents(t);this.dispatchEvent("pointerDown",t,[e])},r={INPUT:!0,TEXTAREA:!0,SELECT:!0},n.pointerDownFocus=function(t){r[t.target.nodeName]||this.focus()},n._pointerDownPreventDefault=function(t){var e="touchstart"==t.type,i="touch"==t.pointerType,n=r[t.target.nodeName];e||i||n||t.preventDefault()},n.hasDragStarted=function(t){return Math.abs(t.x)>this.options.dragThreshold},n.pointerUp=function(t,e){delete this.isTouchScrolling;this.viewport.classList.remove("is-pointer-down");this.dispatchEvent("pointerUp",t,[e]);this._dragPointerUp(t,e)},n.pointerDone=function(){i.removeEventListener("scroll",this);delete this.pointerDownScroll},n.dragStart=function(t,e){this.isDraggable&&(this.dragStartPosition=this.x,this.startAnimation(),i.removeEventListener("scroll",this),this.dispatchEvent("dragStart",t,[e]))},n.pointerMove=function(t,e){var i=this._dragPointerMove(t,e);this.dispatchEvent("pointerMove",t,[e,i]);this._dragMove(t,e,i)},n.dragMove=function(t,e,i){var n,s,o,r;this.isDraggable&&(t.preventDefault(),this.previousDragX=this.dragX,n=this.options.rightToLeft?-1:1,this.options.wrapAround&&(i.x=i.x%this.slideableWidth),s=this.dragStartPosition+i.x*n,!this.options.wrapAround&&this.slides.length&&(o=Math.max(-this.slides[0].target,this.dragStartPosition),s=o<s?.5*(s+o):s,r=Math.min(-this.getLastSlide().target,this.dragStartPosition),s=s<r?.5*(s+r):s),this.dragX=s,this.dragMoveTime=new Date,this.dispatchEvent("dragMove",t,[e,i]))},n.dragEnd=function(t,e){var i,n;this.isDraggable&&(this.options.freeScroll&&(this.isFreeScrolling=!0),i=this.dragEndRestingSelect(),this.options.freeScroll&&!this.options.wrapAround?(n=this.getRestingPosition(),this.isFreeScrolling=-n>this.slides[0].target&&-n<this.getLastSlide().target):this.options.freeScroll||i!=this.selectedIndex||(i+=this.dragEndBoostSelect()),delete this.previousDragX,this.isDragSelect=this.options.wrapAround,this.select(i),delete this.isDragSelect,this.dispatchEvent("dragEnd",t,[e]))},n.dragEndRestingSelect=function(){var t=this.getRestingPosition(),e=Math.abs(this.getSlideDistance(-t,this.selectedIndex)),i=this._getClosestResting(t,e,1),n=this._getClosestResting(t,e,-1);return i.distance<n.distance?i.index:n.index}
12,n._getClosestResting=function(t,e,i){for(var n=this.selectedIndex,s=1/0,o=this.options.contain&&!this.options.wrapAround?function(t,e){return t<=e}:function(t,e){return t<e};o(e,s)&&(n+=i,s=e,null!==(e=this.getSlideDistance(-t,n)));)e=Math.abs(e);return{distance:s,index:n-i}},n.getSlideDistance=function(t,e){var i=this.slides.length,n=this.options.wrapAround&&1<i,s=n?a.modulo(e,i):e,o=this.slides[s],r;return o?(r=n?this.slideableWidth*Math.floor(e/i):0,t-(o.target+r)):null},n.dragEndBoostSelect=function(){if(void 0===this.previousDragX||!this.dragMoveTime||100<new Date-this.dragMoveTime)return 0;var t=this.getSlideDistance(-this.dragX,this.selectedIndex),e=this.previousDragX-this.dragX;return 0<t&&0<e?1:t<0&&e<0?-1:0},n.staticClick=function(t,e){var i=this.getParentCell(t.target),n=i&&i.element,s=i&&this.cells.indexOf(i);this.dispatchEvent("staticClick",t,[e,n,s])},n.onscroll=function(){var t=l(),e=this.pointerDownScroll.x-t.x,i=this.pointerDownScroll.y-t.y;(3<Math.abs(e)||3<Math.abs(i))&&this._pointerDone()},t}),function(n,s){"function"==typeof define&&define.amd?define("flickity/js/prev-next-button",["./flickity","unipointer/unipointer","fizzy-ui-utils/utils"],function(t,e,i){return s(n,t,e,i)}):"object"==typeof module&&module.exports?module.exports=s(n,require("./flickity"),require("unipointer"),require("fizzy-ui-utils")):s(n,n.Flickity,n.Unipointer,n.fizzyUIUtils)}(window,function(t,e,i,n){"use strict";function o(t,e){this.direction=t;this.parent=e;this._create()}var s="http://www.w3.org/2000/svg",r;return(o.prototype=Object.create(i.prototype))._create=function(){var t,e,i;this.isEnabled=!0;this.isPrevious=-1==this.direction;t=this.parent.options.rightToLeft?1:-1;this.isLeft=this.direction==t;e=this.element=document.createElement("button");e.className="flickity-button flickity-prev-next-button";e.className+=this.isPrevious?" previous":" next";e.setAttribute("type","button");this.disable();e.setAttribute("aria-label",this.isPrevious?"Previous":"Next");i=this.createSVG();e.appendChild(i);this.parent.on("select",this.update.bind(this));this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))},o.prototype.activate=function(){this.bindStartEvent(this.element);this.element.addEventListener("click",this);this.parent.element.appendChild(this.element)},o.prototype.deactivate=function(){this.parent.element.removeChild(this.element);this.unbindStartEvent(this.element);this.element.removeEventListener("click",this)},o.prototype.createSVG=function(){var t=document.createElementNS(s,"svg"),e,i;return t.setAttribute("class","flickity-button-icon"),t.setAttribute("viewBox","0 0 100 100"),e=document.createElementNS(s,"path"),i=function(t){return"string"!=typeof t?"M "+t.x0+",50 L "+t.x1+","+(t.y1+50)+" L "+t.x2+","+(t.y2+50)+" L "+t.x3+",50 L "+t.x2+","+(50-t.y2)+" L "+t.x1+","+(50-t.y1)+" Z":t}(this.parent.options.arrowShape),e.setAttribute("d",i),e.setAttribute("class","arrow"),this.isLeft||e.setAttribute("transform","translate(100, 100) rotate(180) "),t.appendChild(e),t},o.prototype.handleEvent=n.handleEvent,o.prototype.onclick=function(){if(this.isEnabled){this.parent.uiChange();var t=this.isPrevious?"previous":"next";this.parent[t]()}},o.prototype.enable=function(){this.isEnabled||(this.element.disabled=!1,this.isEnabled=!0)},o.prototype.disable=function(){this.isEnabled&&(this.element.disabled=!0,this.isEnabled=!1)},o.prototype.update=function(){var t=this.parent.slides,e,i;this.parent.options.wrapAround&&1<t.length?this.enable():(e=t.length?t.length-1:0,i=this.isPrevious?0:e,this[this.parent.selectedIndex==i?"disable":"enable"]())},o.prototype.destroy=function(){this.deactivate();this.allOff()},n.extend(e.defaults,{prevNextButtons:!0,arrowShape:{x0:10,x1:60,y1:50,x2:70,y2:40,x3:30}}),e.createMethods.push("_createPrevNextButtons"),r=e.prototype,r._createPrevNextButtons=function(){this.options.prevNextButtons&&(this.prevButton=new o(-1,this),this.nextButton=new o(1,this),this.on("activate",this.activatePrevNextButtons))},r.activatePrevNextButtons=function(){this.prevButton.activate();this.nextButton.activate();this.on("deactivate",this.deactivatePrevNextButtons)},r.deactivatePrevNextButtons=function(){this.prevButton.deactivate();this.nextButton.deactivate();this.off("deactivate",this.deactivatePrevNextButtons)},e.PrevNextButton=o,e}),function(n,s){"function"==typeof define&&define.amd?define("flickity/js/page-dots",["./flickity","unipointer/unipointer","fizzy-ui-utils/utils"],function(t,e,
12i){return s(n,t,e,i)}):"object"==typeof module&&module.exports?module.exports=s(n,require("./flickity"),require("unipointer"),require("fizzy-ui-utils")):s(n,n.Flickity,n.Unipointer,n.fizzyUIUtils)}(window,function(t,e,i,n){function s(t){this.parent=t;this._create()}(s.prototype=Object.create(i.prototype))._create=function(){this.holder=document.createElement("ol");this.holder.className="flickity-page-dots";this.dots=[];this.handleClick=this.onClick.bind(this);this.on("pointerDown",this.parent.childUIPointerDown.bind(this.parent))};s.prototype.activate=function(){this.setDots();this.holder.addEventListener("click",this.handleClick);this.bindStartEvent(this.holder);this.parent.element.appendChild(this.holder)};s.prototype.deactivate=function(){this.holder.removeEventListener("click",this.handleClick);this.unbindStartEvent(this.holder);this.parent.element.removeChild(this.holder)};s.prototype.setDots=function(){var t=this.parent.slides.length-this.dots.length;0<t?this.addDots(t):t<0&&this.removeDots(-t)};s.prototype.addDots=function(t){for(var r,e=document.createDocumentFragment(),i=[],n=this.dots.length,s=n+t,o=n;o<s;o++)r=document.createElement("li"),r.className="dot",r.setAttribute("aria-label","Page dot "+(o+1)),e.appendChild(r),i.push(r);this.holder.appendChild(e);this.dots=this.dots.concat(i)};s.prototype.removeDots=function(t){this.dots.splice(this.dots.length-t,t).forEach(function(t){this.holder.removeChild(t)},this)};s.prototype.updateSelected=function(){this.selectedDot&&(this.selectedDot.className="dot",this.selectedDot.removeAttribute("aria-current"));this.dots.length&&(this.selectedDot=this.dots[this.parent.selectedIndex],this.selectedDot.className="dot is-selected",this.selectedDot.setAttribute("aria-current","step"))};s.prototype.onTap=s.prototype.onClick=function(t){var e=t.target,i;"LI"==e.nodeName&&(this.parent.uiChange(),i=this.dots.indexOf(e),this.parent.select(i))};s.prototype.destroy=function(){this.deactivate();this.allOff()};e.PageDots=s;n.extend(e.defaults,{pageDots:!0});e.createMethods.push("_createPageDots");var o=e.prototype;return o._createPageDots=function(){this.options.pageDots&&(this.pageDots=new s(this),this.on("activate",this.activatePageDots),this.on("select",this.updateSelectedPageDots),this.on("cellChange",this.updatePageDots),this.on("resize",this.updatePageDots),this.on("deactivate",this.deactivatePageDots))},o.activatePageDots=function(){this.pageDots.activate()},o.updateSelectedPageDots=function(){this.pageDots.updateSelected()},o.updatePageDots=function(){this.pageDots.setDots()},o.deactivatePageDots=function(){this.pageDots.deactivate()},e.PageDots=s,e}),function(t,n){"function"==typeof define&&define.amd?define("flickity/js/player",["ev-emitter/ev-emitter","fizzy-ui-utils/utils","./flickity"],function(t,e,i){return n(t,e,i)}):"object"==typeof module&&module.exports?module.exports=n(require("ev-emitter"),require("fizzy-ui-utils"),require("./flickity")):n(t.EvEmitter,t.fizzyUIUtils,t.Flickity)}(window,function(t,e,i){function n(t){this.parent=t;this.state="stopped";this.onVisibilityChange=this.visibilityChange.bind(this);this.onVisibilityPlay=this.visibilityPlay.bind(this)}(n.prototype=Object.create(t.prototype)).play=function(){"playing"!=this.state&&(document.hidden?document.addEventListener("visibilitychange",this.onVisibilityPlay):(this.state="playing",document.addEventListener("visibilitychange",this.onVisibilityChange),this.tick()))};n.prototype.tick=function(){var t,e;"playing"==this.state&&(t=this.parent.options.autoPlay,t="number"==typeof t?t:3e3,e=this,this.clear(),this.timeout=setTimeout(function(){e.parent.next(!0);e.tick()},t))};n.prototype.stop=function(){this.state="stopped";this.clear();document.removeEventListener("visibilitychange",this.onVisibilityChange)};n.prototype.clear=function(){clearTimeout(this.timeout)};n.prototype.pause=function(){"playing"==this.state&&(this.state="paused",this.clear())};n.prototype.unpause=function(){"paused"==this.state&&this.play()};n.prototype.visibilityChange=function(){this[document.hidden?"pause":"unpause"]()};n.prototype.visibilityPlay=function(){this.play();document.removeEventListener("visibilitychange",this.onVisibilityPlay)};e.extend(i.defaults,{pauseAutoPlayOnHover:!0});i.createMethods.push("_createPlayer");var s=i.prototype;return s._createPlayer=function(){this.player=new n(this);this.on("activate",this.activatePlayer);this.on("uiChange",this.stopPlayer);this.on("pointerDown",this.stopPlayer);this.on("deactivate",this.deactivatePlayer)},s.activatePlayer=function(){this.options.autoPlay&&(this.player.play(),this.element.addEventListener("mouseenter",this))},s.playPlayer=function(){this.player.play()},s.stopPlayer=function(){this.player.stop()},s.pausePlayer=function(){this.player.pause()},s.unpausePlayer=function(){this.player.unpause()},s.deactivatePlayer=function(){this.player.stop();this.element.removeEventListener("mouseenter",this)},s.onmouseenter=function(){this.options.pauseAutoPlayOnHover&&(this.player.pause(),this.element.addEventListener("mouseleave",this))},s.onmouseleave=function(){this.player.unpause();this.element.removeEventListener("mouseleave",this)},i.Player=n,i}),function(i,n){"function"==typeof define&&define.amd?define("flickity/js/add-remove-cell",["./flickity","fizzy-ui-utils/utils"],function(t,e){return n(i,t,e)}):"object"==typeof module&&module.exports?module.exports=n(i,require("./flickity"),require("fizzy-ui-utils")):n(i,i.Flickity,i.fizzyUIUtils)}(window,function(t,e,n){var i=e.prototype;return i.insert=function(t,e){var i=this._makeCells(t),n,s,o,r,a;i&&i.length&&(n=this.cells.length,e=void 0===e?n:e,s=function(t){var e=document.createDocumentFragment();return t.forEach(function(t){e.appendChild(t.element)}),e}(i),o=e==n,o?this.slider.appendChild(s):(r=this.cells[e].element,this.slider.insertBefore(s,r)),0===e?this.cells=i.concat(this.cells):o?this.cells=this.cells.concat(i):(a=this.cells.splice(e,n-e),this.cells=this.cells.concat(i).c
12oncat(a)),this._sizeCells(i),this.cellChange(e,!0))},i.append=function(t){this.insert(t,this.cells.length)},i.prepend=function(t){this.insert(t,0)},i.remove=function(t){var e=this.getCells(t),i;e&&e.length&&(i=this.cells.length-1,e.forEach(function(t){t.remove();var e=this.cells.indexOf(t);i=Math.min(e,i);n.removeFrom(this.cells,t)},this),this.cellChange(i,!0))},i.cellSizeChange=function(t){var e=this.getCell(t),i;e&&(e.getSize(),i=this.cells.indexOf(e),this.cellChange(i))},i.cellChange=function(t,e){var i=this.selectedElement,n;this._positionCells(t);this._getWrapShiftCells();this.setGallerySize();n=this.getCell(i);n&&(this.selectedIndex=this.getCellSlideIndex(n));this.selectedIndex=Math.min(this.slides.length-1,this.selectedIndex);this.emitEvent("cellChange",[t]);this.select(this.selectedIndex);e&&this.positionSliderAtSelected()},e}),function(i,n){"function"==typeof define&&define.amd?define("flickity/js/lazyload",["./flickity","fizzy-ui-utils/utils"],function(t,e){return n(i,t,e)}):"object"==typeof module&&module.exports?module.exports=n(i,require("./flickity"),require("fizzy-ui-utils")):n(i,i.Flickity,i.fizzyUIUtils)}(window,function(t,e,o){"use strict";function s(t,e){this.img=t;this.flickity=e;this.load()}e.createMethods.push("_createLazyload");var i=e.prototype;return i._createLazyload=function(){this.on("select",this.lazyLoad)},i.lazyLoad=function(){var t=this.options.lazyLoad;if(t){var e="number"==typeof t?t:0,i=this.getAdjacentCellElements(e),n=[];i.forEach(function(t){var e=function(t){var s;if("IMG"==t.nodeName){var e=t.getAttribute("data-flickity-lazyload"),i=t.getAttribute("data-flickity-lazyload-src"),n=t.getAttribute("data-flickity-lazyload-srcset");if(e||i||n)return[t]}return s=t.querySelectorAll("img[data-flickity-lazyload], img[data-flickity-lazyload-src], img[data-flickity-lazyload-srcset]"),o.makeArray(s)}(t);n=n.concat(e)});n.forEach(function(t){new s(t,this)},this)}},s.prototype.handleEvent=o.handleEvent,s.prototype.load=function(){this.img.addEventListener("load",this);this.img.addEventListener("error",this);var t=this.img.getAttribute("data-flickity-lazyload")||this.img.getAttribute("data-flickity-lazyload-src"),e=this.img.getAttribute("data-flickity-lazyload-srcset");this.img.src=t;e&&this.img.setAttribute("srcset",e);this.img.removeAttribute("data-flickity-lazyload");this.img.removeAttribute("data-flickity-lazyload-src");this.img.removeAttribute("data-flickity-lazyload-srcset")},s.prototype.onload=function(t){this.complete(t,"flickity-lazyloaded")},s.prototype.onerror=function(t){this.complete(t,"flickity-lazyerror")},s.prototype.complete=function(t,e){this.img.removeEventListener("load",this);this.img.removeEventListener("error",this);var i=this.flickity.getParentCell(this.img),n=i&&i.element;this.flickity.cellSizeChange(n);this.img.classList.add(e);this.flickity.dispatchEvent("lazyLoad",t,n)},e.LazyLoader=s,e}),function(t,e){"function"==typeof define&&define.amd?define("flickity/js/index",["./flickity","./drag","./prev-next-button","./page-dots","./player","./add-remove-cell","./lazyload"],e):"object"==typeof module&&module.exports&&(module.exports=e(require("./flickity"),require("./drag"),require("./prev-next-button"),require("./page-dots"),require("./player"),require("./add-remove-cell"),require("./lazyload")))}(window,function(t){return t}),function(t,e){"function"==typeof define&&define.amd?define("flickity-as-nav-for/as-nav-for",["flickity/js/index","fizzy-ui-utils/utils"],e):"object"==typeof module&&module.exports?module.exports=e(require("flickity"),require("fizzy-ui-utils")):t.Flickity=e(t.Flickity,t.fizzyUIUtils)}(window,function(n,s){n.createMethods.push("_createAsNavFor");var t=n.prototype;return t._createAsNavFor=function(){var t,e;this.on("activate",this.activateAsNavFor);this.on("deactivate",this.deactivateAsNavFor);this.on("destroy",this.destroyAsNavFor);t=this.options.asNavFor;t&&(e=this,setTimeout(function(){e.setNavCompanion(t)}))},t.setNavCompanion=function(t){var e,i;t=s.getQueryElement(t);e=n.data(t);e&&e!=this&&(this.navCompanion=e,i=this,this.onNavCompanionSelect=function(){i.navCompanionSelect()},e.on("select",this.onNavCompanionSelect),this.on("staticClick",this.onNavStaticClick),this.navCompanionSelect(!0))},t.navCompanionSelect=function(t){var e=this.navCompanion&&this.navCompanion.selectedCells,r;if(e){var i=e[0],n=this.navCompanion.cells.indexOf(i),s=n+e.length-1,o=Math.floor(function(t,e,
12i){return(e-t)*i+t}(n,s,this.navCompanion.cellAlign));(this.selectCell(o,!1,t),this.removeNavSelectedElements(),o>=this.cells.length)||(r=this.cells.slice(n,1+s),this.navSelectedElements=r.map(function(t){return t.element}),this.changeNavSelectedClass("add"))}},t.changeNavSelectedClass=function(e){this.navSelectedElements.forEach(function(t){t.classList[e]("is-nav-selected")})},t.activateAsNavFor=function(){this.navCompanionSelect(!0)},t.removeNavSelectedElements=function(){this.navSelectedElements&&(this.changeNavSelectedClass("remove"),delete this.navSelectedElements)},t.onNavStaticClick=function(t,e,i,n){"number"==typeof n&&this.navCompanion.selectCell(n)},t.deactivateAsNavFor=function(){this.removeNavSelectedElements()},t.destroyAsNavFor=function(){this.navCompanion&&(this.navCompanion.off("select",this.onNavCompanionSelect),this.off("staticClick",this.onNavStaticClick),delete this.navCompanion)},n}),function(e,i){"use strict";"function"==typeof define&&define.amd?define("imagesloaded/imagesloaded",["ev-emitter/ev-emitter"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("ev-emitter")):e.imagesLoaded=i(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function r(t,e){for(var i in e)t[i]=e[i];return t}function l(t,e,i){if(!(this instanceof l))return new l(t,e,i);var n=t;"string"==typeof t&&(n=document.querySelectorAll(t));n?(this.elements=function(t){return Array.isArray(t)?t:"object"==typeof t&&"number"==typeof t.length?a.call(t):[t]}(n),this.options=r({},this.options),"function"==typeof e?i=e:r(this.options,e),i&&this.on("always",i),this.getImages(),s&&(this.jqDeferred=new s.Deferred),setTimeout(this.check.bind(this))):o.error("Bad element for imagesLoaded "+(n||t))}function i(t){this.img=t}function n(t,e){this.url=t;this.element=e;this.img=new Image}var s=e.jQuery,o=e.console,a=Array.prototype.slice,h;return(l.prototype=Object.create(t.prototype)).options={},l.prototype.getImages=function(){this.images=[];this.elements.forEach(this.addElementImages,this)},l.prototype.addElementImages=function(t){var e,i,n,s,o,r;if("IMG"==t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t),e=t.nodeType,e&&h[e]){for(i=t.querySelectorAll("img"),n=0;n<i.length;n++)s=i[n],this.addImage(s);if("string"==typeof this.options.background)for(o=t.querySelectorAll(this.options.background),n=0;n<o.length;n++)r=o[n],this.addElementBackgroundImages(r)}},h={1:!0,9:!0,11:!0},l.prototype.addElementBackgroundImages=function(t){var e=getComputedStyle(t),i,n,s;if(e)for(i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(e.backgroundImage);null!==n;)s=n&&n[2],s&&this.addBackground(s,t),n=i.exec(e.backgroundImage)},l.prototype.addImage=function(t){var e=new i(t);this.images.push(e)},l.prototype.addBackground=function(t,e){var i=new n(t,e);this.images.push(i)},l.prototype.check=function(){function e(t,e,i){setTimeout(function(){n.progress(t,e,i)})}var n=this;this.progressedCount=0;this.hasAnyBroken=!1;this.images.length?this.images.forEach(function(t){t.once("progress",e);t.check()}):this.complete()},l.prototype.progress=function(t,e,i){this.progressedCount++;this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded;this.emitEvent("progress",[this,t,e]);this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t);this.progressedCount==this.images.length&&this.complete();this.options.debug&&o&&o.log("progress: "+i,t,e)},l.prototype.complete=function(){var t=this.hasAnyBroken?"fail":"done",e;(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred)&&(e=this.hasAnyBroken?"reject":"resolve",this.jqDeferred[e](this))},(i.prototype=Object.create(t.prototype)).check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.src)},i.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWi
12dth},i.prototype.confirm=function(t,e){this.isLoaded=t;this.emitEvent("progress",[this,this.img,e])},i.prototype.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.prototype.onload=function(){this.confirm(!0,"onload");this.unbindEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror");this.unbindEvents()},i.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this);this.proxyImage.removeEventListener("error",this);this.img.removeEventListener("load",this);this.img.removeEventListener("error",this)},(n.prototype=Object.create(i.prototype)).check=function(){this.img.addEventListener("load",this);this.img.addEventListener("error",this);this.img.src=this.url;this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},n.prototype.unbindEvents=function(){this.img.removeEventListener("load",this);this.img.removeEventListener("error",this)},n.prototype.confirm=function(t,e){this.isLoaded=t;this.emitEvent("progress",[this,this.element,e])},l.makeJQueryPlugin=function(t){(t=t||e.jQuery)&&((s=t).fn.imagesLoaded=function(t,e){return new l(this,t,e).jqDeferred.promise(s(this))})},l.makeJQueryPlugin(),l}),function(i,n){"function"==typeof define&&define.amd?define(["flickity/js/index","imagesloaded/imagesloaded"],function(t,e){return n(i,t,e)}):"object"==typeof module&&module.exports?module.exports=n(i,require("flickity"),require("imagesloaded")):i.Flickity=n(i,i.Flickity,i.imagesLoaded)}(window,function(t,e,i){"use strict";e.createMethods.push("_createImagesLoaded");var n=e.prototype;return n._createImagesLoaded=function(){this.on("activate",this.imagesLoaded)},n.imagesLoaded=function(){if(this.options.imagesLoaded){var n=this;i(this.slider).on("progress",function(t,e){var i=n.getParentCell(e.img);n.cellSizeChange(i&&i.element);n.options.freeScroll||n.positionSliderAtSelected()})}},e}),function($){$.capilaliseFirstLetter=function(str){return str.charAt(0).toUpperCase()+str.slice(1)};$.htmlEncode=function(value){return value?$("<div/>").text(value.replace(new RegExp("\n","g"),"#NL#")).html().replace(new RegExp("#NL#","g"),"\n"):""};$.htmlDecode=function(value){return value?$("<div/>").html(value.replace(new RegExp("\n","g"),"#NL#")).text().replace(new RegExp("#NL#","g"),"\n"):""};$.normaliseId=function(id){return id.toString().replace(/\W/gi,"-")};$.fn.outerHTML=function(){return $("<div>").append(this.eq(0).clone()).html()};$.hex=function(x){return("0"+parseInt(x).toString(16)).slice(-2)};$.downloadURL=function(url){var hiddenIFrameID="hiddenDownloader",iframe=document.getElementById(hiddenIFrameID);iframe===null&&(iframe=document.createElement("iframe"),iframe.id=hiddenIFrameID,iframe.style.display="none",document.body.appendChild(iframe));iframe.src=url};$.fn.bindWithDelay=function(type,data,fn,timeout,throttle){return $.isFunction(data)&&(throttle=timeout,timeout=fn,fn=data,data=undefined),fn.guid=fn.guid||$.guid&&$.guid++,this.each(function(){function cb(){var e=$.extend(!0,{},arguments[0]),ctx=this,throttler=function(){wait=null;fn.apply(ctx,[e])};throttle||(clearTimeout(wait),wait=null);wait||(wait=setTimeout(throttler,timeout))}var wait=null;cb.guid=fn.guid;$(this).bind(type,data,cb)})};$.fn.disableRel=function(){var rel=this.attr("rel");this.data("rel",rel);this.removeAttr("rel")};$.fn.enableRel=function(){var dataRel=this.data("rel");dataRel&&this.attr("rel",dataRel)};$.fn.removeTrailingZeros=function(){var val=parseFloat(parseFloat(this.val()||0).toFixed(2)).toString();this.val(val)};$.getQuerystring=function(queryName){for(var name,value,querystring=location.search.replace("?","").split("&"),queryValue=null,i=0;i<querystring.length;i++)if(name=querystring[i].split("=")[0],value=querystring[i].split("=")[1],name.toLowerCase()==queryName.toLowerCase()){queryValue=value;break}return queryValue};String.prototype.bool=function(){return/^true$/i.test(this)};String.prototype.IsImage=function(){return"image,montage,collage".indexOf(this)!=-1};String.prototype.format=function(){for(var s=this,i=arguments.length;i--;)s=s.replace(new RegExp("\\{"+i+"\\}","gm"),arguments[i]);return s};String.prototype.clean=function(){return this.replace(/\s/g,"").toLowerCase()};$.NewGuid=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=Math.random()*16|0,v=c=="x"?r:r&3|8;return v.toString(16)})};$.nextVersion=function(){return Math.floor(Math.random()*100000001)};$.expr[":"].ContainsIgnoreCase=function(a,i,m){return $(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0};$.browserIE876=function(){return $.browser.msie!=null&&$.browser.version.substr(0,3)<parseFloat("9.0")};$.getBrowserNameAndVersion=function(){return $.browser?JSON.stringify($.browser):"browser not found"};$.deepCopy=function(obj){return jQuery.extend(!0,{},obj)};$.firstBy=function(){function extend(f){return f.thenBy=tb,f}function tb(y){var x=this;return extend(function(a,b){return x(a,b)||y(a,b)})}return extend}();window.getComputedStyle||(window.getComputedStyle=function(el){return this.el=el,this.getPropertyValue=function(prop){var re=/(\-([a-z]){1})/g;return prop=="float"&&(prop="styleFloat"),re.test(prop)&&(prop=prop.replace(re,function(){return arguments[2].toUpperCase()})),el.currentStyle[prop]?el.currentStyle[prop]:null},this});window.__extends=window.__extends||function(d,b){function __(){this.constructor=d}__.prototype=b.prototype;d.prototype=new __}}(jQuery),function(factory){"use strict";typeof define=="function"&&define.amd?define(["jquery"],factory):typeof exports=="object"&&typeof module=="object"?module.exports=factory(require("jquery")):factory(jQuery)}(function($,undefined){"use strict";function paletteTemplate(p,color,className,opts){for(var current,tiny,c,formattedString,swatchStyle,html=[],i=0;i<p.length;i++)current=p[i],current?(tiny=tinycolor(current),c=tiny.toHsl().l<.5?"sp-thumb-el sp-thumb-dark":"sp-thumb-el sp-thumb-light",c+=tinycolor.equals(color,current)?" sp-thumb-active":"",formattedString=tiny.toString(opts.preferredFormat||"rgb"),swatchStyle=rgbaSupport?"background-color:"+tiny.toRgbString():"filter:"+tiny.toFilter(),html.push('<span title="'+formattedString+'" data-color="'+tiny.toRgbString()+'" class="'+c+'"><span class="sp-thumb-inner" style="'+swatchStyle+';"><\/span><\/span>')):html.push('<span class="sp-thumb-el sp-clear-display" ><span class="sp-clear-palette-only" style="background-color: transparent;"><\/span><\/span>');return"<div class='sp-cf "+className+"'>"+html.join("")+"<\/div>"}function hideAll(){for(var i=0;i<spectrums.length;i++)spectrums[i]&&spectrums[i].hide()}
12function instanceOptions(o,callbackContext){o.locale=o.locale||window.navigator.language;o.locale&&(o.locale=o.locale.split("-")[0].toLowerCase());o.locale!="en"&&$.spectrum.localization[o.locale]&&(o=$.extend({},$.spectrum.localization[o.locale],o));var opts=$.extend({},defaultOpts,o);return opts.callbacks={move:bind(opts.move,callbackContext),change:bind(opts.change,callbackContext),show:bind(opts.show,callbackContext),hide:bind(opts.hide,callbackContext),beforeShow:bind(opts.beforeShow,callbackContext)},opts}function spectrum(element,o){function applyOptions(){var i,j,rgb;if(opts.showPaletteOnly&&(opts.showPalette=!0),toggleButton.text(opts.showPaletteOnly?opts.togglePaletteMoreText:opts.togglePaletteLessText),opts.palette){for(palette=opts.palette.slice(0),paletteArray=$.isArray(palette[0])?palette:[palette],paletteLookup={},i=0;i<paletteArray.length;i++)for(j=0;j<paletteArray[i].length;j++)rgb=tinycolor(paletteArray[i][j]).toRgbString(),paletteLookup[rgb]=!0;opts.showPaletteOnly&&!initialColor&&(initialColor=palette[0][0]===""?palette[0][0]:Object.keys(paletteLookup)[0])}container.toggleClass("sp-flat",flat);container.toggleClass("sp-input-disabled",!opts.showInput);container.toggleClass("sp-alpha-enabled",opts.showAlpha);container.toggleClass("sp-clear-enabled",allowEmpty);container.toggleClass("sp-buttons-disabled",!opts.showButtons);container.toggleClass("sp-palette-buttons-disabled",!opts.togglePaletteOnly);container.toggleClass("sp-palette-disabled",!opts.showPalette);container.toggleClass("sp-palette-only",opts.showPaletteOnly);container.toggleClass("sp-initial-disabled",!opts.showInitial);container.addClass(opts.className).addClass(opts.containerClassName);reflow()}function initialize(){function paletteElementClick(e){return e.data&&e.data.ignore?(set($(e.target).closest(".sp-thumb-el").data("color")),move()):(set($(e.target).closest(".sp-thumb-el").data("color")),move(),opts.hideAfterPaletteSelect?(updateOriginalInput(!0),hide()):updateOriginalInput()),!1}var addOn,appendTo,paletteEvent;IE&&container.find("*:not(input)").attr("unselectable","on");applyOptions();originalInputContainer=$('<span class="sp-original-input-container"><\/span>');["margin"].forEach(function(cssProp){originalInputContainer.css(cssProp,boundElement.css(cssProp))});boundElement.css("display")=="block"&&originalInputContainer.css("display","flex");shouldReplace?boundElement.after(replacer).hide():type=="text"?(originalInputContainer.addClass("sp-colorize-container"),boundElement.addClass("spectrum sp-colorize").wrap(originalInputContainer)):type=="component"&&(boundElement.addClass("spectrum").wrap(originalInputContainer),addOn=$("<div class='sp-colorize-container sp-add-on'><div class='sp-colorize'><\/div> <\/div>"),addOn.width(boundElement.outerHeight()+"px").css("border-radius",boundElement.css("border-radius")).css("border",boundElement.css("border")),boundElement.addClass("with-add-on").before(addOn));colorizeElement=boundElement.parent().find(".sp-colorize");colorizeElementInitialColor=colorizeElement.css("color");colorizeElementInitialBackground=colorizeElement.css("background-color");allowEmpty||clearButton.hide();flat?boundElement.after(container).hide():(appendTo=opts.appendTo==="parent"?boundElement.parent():$(opts.appendTo),appendTo.length!==1&&(appendTo=$("body")),appendTo.append(container));updateSelectionPaletteFromStorage();offsetElement.on("click.spectrum touchstart.spectrum",function(e){disabled||show();e.stopPropagation();$(e.target).is("input")||e.preventDefault()});(boundElement.is(":disabled")||opts.disabled===!0)&&disable();container.click(stopPropagation);[textInput,boundElement].forEach(function(input){input.change(function(){setFromTextInput(input.val())});input.on("paste",function(){setTimeout(function(){setFromTextInput(input.val())},1)});input.keydown(function(e){e.keyCode==13&&(setFromTextInput($(input).val()),input==boundElement&&hide())})});cancelButton.text(opts.cancelText);cancelButton.on("click.spectrum",function(e){e.stopPropagation();e.preventDefault();revert();hide()});if(window.EyeDropper)eyeDropperButton.on("click.spectrum",function(e){e.stopPropagation();e.preventDefault();window.pushCreationStudioToGTM("Eyedropper: Click");setColorByEyeDropper()});else eyeDropperButton.remove(),slider.height("85%");clearButton.attr("title",opts.clearText);clearButton.on("click.spectrum",function(e){e.stopPropagation();e.preventDefault();isEmpty=!0;move();flat&&updateOriginalInput(!0)});chooseButton.text(opts.chooseText);chooseButton.on("click.spectrum",function(e){e.stopPropagation();e.preventDefault();IE&&textInput.is(":focus")&&textInput.trigger("change");isValid()&&(updateOriginalInput(!0),hide())});toggleButton.text(opts.showPaletteOnly?opts.togglePaletteMoreText:opts.togglePaletteLessText);toggleButton.on("click.spectrum",function(e){e.stopPropagation();e.preventDefault();opts.showPaletteOnly=!opts.showPaletteOnly;opts.showPaletteOnly||flat||container.css("left","-="+(pickerContainer.outerWidth(!0)+5));applyOptions()});draggable(alphaSlider,function(dragX,dragY,e){currentAlpha=dragX/alphaWidth;isEmpty=!1;e.shiftKey&&(currentAlpha=Math.round(currentAlpha*10)/10);move()},dragStart,dragStop);draggable(slider,function(dragX,dragY){currentHue=parseFloat(dragY/slideHeight);isEmpty=!1;opts.showAlpha||(currentAlpha=1);move()},dragStart,dragStop);draggable(dragger,function(dragX,dragY,e){var setSaturation,setValue;if(e.shiftKey){if(!shiftMovementDirection){var oldDragX=currentSaturation*dragWidth,oldDragY=dragHeight-currentValue*dragHeight,furtherFromX=Math.abs(dragX-oldDragX)>Math.abs(dragY-oldDragY);shiftMovementDirection=furtherFromX?"x":"y"}}else shiftMovementDirection=null;setSaturation=!shiftMovementDirection||shiftMovementDirection==="x";setValue=!shiftMovementDirection||shiftMovementDirection==="y";setSaturation&&(currentSaturation=parseFloat(dragX/dragWidth));setValue&&(currentValue=parseFloat((dragHeight-dragY)/dragHeight));isEmpty=!1;opts.showAlpha||(currentAlpha=1);move()},dragStart,dragStop);initialColor?(set(initialColor),updateUI(),currentPreferredFormat=tinycolor(initialColor).format||opts.preferredFormat,addColorToSelectionPalette(initialColor)):initialColor===""?(set(initialColor),updateUI()):updateUI();flat&&show();paletteEvent=IE?"mousedown.spectrum":"click.spectrum touchstart.spectrum";paletteContainer.on(paletteEvent,".sp-thumb-el",paletteElementClick);initialColorContainer.on(paletteEvent,".sp-thumb-el:nth-child(1)",{ignore:!0},paletteElementClick)}function updateSelectionPaletteFromStorage(){if(localStorageKey){try{var localStorage=window.localStorage,oldPalette=localStorage[localStorageKey].split(",#");oldPalette.length>1&&(delete localStorage[localStorageKey],$.each(oldPalette,function(i,c){addColorToSelectionPalette(c)}))}catch(e){}try{selectionPalette=window.localStorage[localStorageKey].split(";")}catch(e){}}}function addColorToSelectionPalette(color){if(showSelectionPalette){var rgb=tinycolor(color).toRgbString();if(!paletteLookup[rgb]&&$.inArray(rgb,selectionPalette)===-1)for(selectionPalette.push(rgb);selectionPalette.length>maxSelectionSize;)selectionPalette.shift();if(localStorageKey)try{window.localStorage[localStorageKey]=selectionPalette.join(";")}catch(e){}}}function getUniqueSelectionPalette(){var unique=[],i,rgb;if(opts.showPalette)for(i=0;i<selectionPalette.length;i++)rgb=tinycolor(selectionPalette[i]).toRgbString(),paletteLookup[rgb]||unique.push(selectionPalette[i]);return unique.reverse().slice(0,opts.maxSelectionSize)}function drawPalette(){var currentColor=get(),html=$.map(paletteArray,function(palette,i){return paletteTemplate(palette,currentColor,"sp-palette-row sp-palette-row-"+i,opts)});updateSelectionPaletteFromStorage();selectionPalette&&html.push(paletteTemplate(getUniqueSelectionPalette(),currentColor,"sp-palette-row sp-palette-row-selection",opts));paletteContainer.html(html.join(""))}function drawInitial(){if(opts.showInitial){var initial=colorOnShow,current=get();initialColorContainer.html(paletteTemplate([initial,current],current,"sp-palette-row-initial",opts))}}function dragStart(){(dragHeight<=0||dragWidth<=0||slideHeight<=0)&&reflow();isDragging=!0;container.addClass(draggingClass);shiftMovementDirection=null;boundElement.trigger("dragstart.spectrum",[get()])}function dragStop(){isDragging=!1;container.removeClass(draggingClass);boundElement.trigger("dragstop.spectrum",[get()])}function setFromTextInput(value){if(abortNextInputChange){abortNextInputChange=!1;return}if((value===null||value==="")&&allowEmpty)set(null),move(),updateOriginalInput();else{var tiny=tinycolor(value);
12tiny.isValid()?(set(tiny),move(),updateOriginalInput()):textInput.addClass("sp-validation-error")}}function toggle(){visible?hide():show()}function show(){var event=$.Event("beforeShow.spectrum");if(visible){reflow();return}if(boundElement.trigger(event,[get()]),callbacks.beforeShow(get())!==!1&&!event.isDefaultPrevented()){hideAll();visible=!0;$(doc).on("keydown.spectrum",onkeydown);$(doc).on("click.spectrum",clickout);$(window).on("resize.spectrum",resize);replacer.addClass("sp-active");container.removeClass("sp-hidden");reflow();updateUI();colorOnShow=get();drawInitial();callbacks.show(colorOnShow);boundElement.trigger("show.spectrum",[colorOnShow])}}function onkeydown(e){e.keyCode===27&&hide()}function clickout(e){e.button!=2&&(isDragging||(clickoutFiresChange?updateOriginalInput(!0):revert(),hide()))}function hide(){visible&&!flat&&(visible=!1,$(doc).off("keydown.spectrum",onkeydown),$(doc).off("click.spectrum",clickout),$(window).off("resize.spectrum",resize),replacer.removeClass("sp-active"),container.addClass("sp-hidden"),callbacks.hide(get()),boundElement.trigger("hide.spectrum",[get()]))}function revert(){set(colorOnShow,!0);updateOriginalInput(!0)}function set(color,ignoreFormatChange){if(tinycolor.equals(color,get())){updateUI();return}var newColor,newHsv;(!color||color===undefined)&&allowEmpty?isEmpty=!0:(isEmpty=!1,newColor=tinycolor(color),newHsv=newColor.toHsv(),currentHue=newHsv.h%360/360,currentSaturation=newHsv.s,currentValue=newHsv.v,currentAlpha=newHsv.a);updateUI();newColor&&newColor.isValid()&&!ignoreFormatChange&&(currentPreferredFormat=opts.preferredFormat||newColor.getFormat())}function get(opts){return(opts=opts||{},allowEmpty&&isEmpty)?null:tinycolor.fromRatio({h:currentHue,s:currentSaturation,v:currentValue,a:Math.round(currentAlpha*1e3)/1e3},{format:opts.format||currentPreferredFormat})}function isValid(){return!textInput.hasClass("sp-validation-error")}function move(){updateUI();callbacks.move(get());boundElement.trigger("move.spectrum",[get()])}function updateUI(){var flatColor,format,realColor,displayColor,realHex,realRgb,rgb,realAlpha,gradient,color,textColor;textInput.removeClass("sp-validation-error");updateHelperLocations();flatColor=tinycolor.fromRatio({h:currentHue,s:1,v:1});dragger.css("background-color",flatColor.toHexString());format=currentPreferredFormat;currentAlpha<1&&!(currentAlpha===0&&format==="name")&&(format==="hex"||format==="hex3"||format==="hex6"||format==="name")&&(format="rgb");realColor=get({format:format});displayColor="";previewElement.removeClass("sp-clear-display");previewElement.css("background-color","transparent");!realColor&&allowEmpty?previewElement.addClass("sp-clear-display"):(realHex=realColor.toHexString(),realRgb=realColor.toRgbString(),rgbaSupport||realColor.alpha===1?previewElement.css("background-color",realRgb):(previewElement.css("background-color","transparent"),previewElement.css("filter",realColor.toFilter())),opts.showAlpha&&(rgb=realColor.toRgb(),rgb.a=0,realAlpha=tinycolor(rgb).toRgbString(),gradient="linear-gradient(left, "+realAlpha+", "+realHex+")",IE?alphaSliderInner.css("filter",tinycolor(realAlpha).toFilter({gradientType:1},realHex)):(alphaSliderInner.css("background","-webkit-"+gradient),alphaSliderInner.css("background","-moz-"+gradient),alphaSliderInner.css("background","-ms-"+gradient),alphaSliderInner.css("background","linear-gradient(to right, "+realAlpha+", "+realHex+")"))),displayColor=realColor.toString(format));opts.showInput&&textInput.val(displayColor);boundElement.val(displayColor);(opts.type=="text"||opts.type=="component")&&(color=realColor,color&&colorizeElement?(textColor=color.isLight()||color.getAlpha()<.4?"black":"white",colorizeElement.css("background-color",color.toRgbString()).css("color",textColor)):colorizeElement.css("background-color",colorizeElementInitialBackground).css("color",colorizeElementInitialColor));opts.showPalette&&drawPalette();drawInitial()}function updateHelperLocations(){var s=currentSaturation,v=currentValue,dragX,dragY,alphaX,slideY;allowEmpty&&isEmpty?(alphaSlideHelper.hide(),slideHelper.hide(),dragHelper.hide()):(alphaSlideHelper.show(),slideHelper.show(),dragHelper.show(),dragX=s*dragWidth,dragY=dragHeight-v*dragHeight,dragX=Math.max(-dragHelperHe
12ight,Math.min(dragWidth-dragHelperHeight,dragX-dragHelperHeight)),dragY=Math.max(-dragHelperHeight,Math.min(dragHeight-dragHelperHeight,dragY-dragHelperHeight)),dragHelper.css({top:dragY+"px",left:dragX+"px"}),alphaX=currentAlpha*alphaWidth,alphaSlideHelper.css({left:alphaX-alphaSlideHelperWidth/2+"px"}),slideY=currentHue*slideHeight,slideHelper.css({top:slideY-slideHelperHeight+"px"}))}function updateOriginalInput(fireCallback){var color=get(),displayColor="",hasChanged=!tinycolor.equals(color,colorOnShow);color&&(displayColor=color.toString(currentPreferredFormat),addColorToSelectionPalette(color));fireCallback&&hasChanged&&(callbacks.change(color),abortNextInputChange=!0,boundElement.trigger("change",[color]))}function reflow(){visible&&(dragWidth=dragger.width(),dragHeight=dragger.height(),dragHelperHeight=dragHelper.height(),slideWidth=slider.width(),slideHeight=slider.height(),slideHelperHeight=slideHelper.height(),alphaWidth=alphaSlider.width(),alphaSlideHelperWidth=alphaSlideHelper.width(),flat||(container.css("position","absolute"),opts.offset?container.offset(opts.offset):container.offset(getOffset(container,offsetElement))),updateHelperLocations(),opts.showPalette&&drawPalette(),boundElement.trigger("reflow.spectrum"))}function destroy(){boundElement.show().removeClass("spectrum with-add-on sp-colorize");offsetElement.off("click.spectrum touchstart.spectrum");container.remove();replacer.remove();colorizeElement&&colorizeElement.css("background-color",colorizeElementInitialBackground).css("color",colorizeElementInitialColor);var originalInputContainer=boundElement.closest(".sp-original-input-container");originalInputContainer.length>0&&originalInputContainer.after(boundElement).remove();spectrums[spect.id]=null}function option(optionName,optionValue){if(optionName===undefined)return $.extend({},opts);if(optionValue===undefined)return opts[optionName];opts[optionName]=optionValue;optionName==="preferredFormat"&&(currentPreferredFormat=opts.preferredFormat);applyOptions()}function enable(){disabled=!1;boundElement.attr("disabled",!1);offsetElement.removeClass("sp-disabled")}function disable(){hide();disabled=!0;boundElement.attr("disabled",!0);offsetElement.addClass("sp-disabled")}function setOffset(coord){opts.offset=coord;reflow()}function setColorByEyeDropper(){const eyeDropper=new EyeDropper;eyeDropper.open().then(result=>{const color=result.sRGBHex;set(color);window.pushCreationStudioToGTM("Eyedropper: Colour selected: "+color)}).catch(error=>{error.name!=="AbortError"&&console.log(error)})}var opts=instanceOptions(o,element),type=opts.type,flat=type=="flat",showSelectionPalette=opts.showSelectionPalette,localStorageKey=opts.localStorageKey,theme=opts.theme,callbacks=opts.callbacks,resize=throttle(reflow,10),visible=!1,isDragging=!1,dragWidth=0,dragHeight=0,dragHelperHeight=0,slideHeight=0,slideWidth=0,alphaWidth=0,alphaSlideHelperWidth=0,slideHelperHeight=0,currentHue=0,currentSaturation=0,currentValue=0,currentAlpha=1,palette=[],paletteArray=[],paletteLookup={},selectionPalette=opts.selectionPalette.slice(0),maxSelectionSize=opts.maxSelectionSize,draggingClass="sp-dragging",abortNextInputChange=!1,shiftMovementDirection=null,doc=element.ownerDocument,body=doc.body,boundElement=$(element),disabled=!1,container=$(markup,doc).addClass(theme),pickerContainer=container.find(".sp-picker-container"),dragger=container.find(".sp-color"),dragHelper=container.find(".sp-dragger"),slider=container.find(".sp-hue"),slideHelper=container.find(".sp-slider"),alphaSliderInner=container.find(".sp-alpha-inner"),alphaSlider=container.find(".sp-alpha"),alphaSlideHelper=container.find(".sp-alpha-handle"),textInput=container.find(".sp-input"),paletteContainer=container.find(".sp-palette"),initialColorContainer=container.find(".sp-initial"),cancelButton=container.find(".sp-cancel"),eyeDropperButton=container.find(".sp-eye-dropper"),clearButton=container.find(".sp-clear"),chooseButton=container.find(".sp-choose"),toggleButton=container.find(".sp-palette-toggle"),isInput=boundElement.is("input"),isInputTypeColor=isInput&&boundElement.attr("type")==="color"&&inputTypeColorSupport(),shouldReplace=isInput&&type=="color",replacer=shouldReplace?$(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName):$([]),offsetElement=shouldReplace?replacer:boundElement,previewElement=replacer.find(".sp-preview-inner"),initialColor=opts.color||isInput&&boundElement.val(),colorOnShow=!1,currentPreferredFormat=opts.preferredFormat,clickoutFiresChange=!opts.showButtons||opts.clickoutFiresChange,isEmpty=!initialColor,allowEmpty=opts.allowEmpty,originalInputContainer=null,colorizeElement=null,colorizeElementInitialColor=null,colorizeElementInitialBackgroun
12d=null,thisId=boundElement.attr("id"),label,spect;if(thisId!==undefined&&thisId.length>0&&(label=$('label[for="'+thisId+'"]'),label.length))label.on("click",function(e){return e.preventDefault(),boundElement.spectrum("show"),!1});return initialize(),spect={show:show,hide:hide,toggle:toggle,reflow:reflow,option:option,enable:enable,disable:disable,offset:setOffset,set:function(c){set(c);updateOriginalInput()},get:get,destroy:destroy,container:container},spect.id=spectrums.push(spect)-1,spect}function getOffset(picker,input){var extraY=0,dpWidth=picker.outerWidth(),dpHeight=picker.outerHeight(),inputHeight=input.outerHeight(),doc=picker[0].ownerDocument,docElem=doc.documentElement,viewWidth=docElem.clientWidth+$(doc).scrollLeft(),viewHeight=docElem.clientHeight+$(doc).scrollTop(),offset=input.offset(),offsetLeft=offset.left,offsetTop=offset.top;return offsetTop+=inputHeight,offsetLeft-=Math.min(offsetLeft,offsetLeft+dpWidth>viewWidth&&viewWidth>dpWidth?Math.abs(offsetLeft+dpWidth-viewWidth):0),offsetTop-=Math.min(offsetTop,offsetTop+dpHeight>viewHeight&&viewHeight>dpHeight?Math.abs(dpHeight+inputHeight-extraY):extraY),{top:offsetTop,bottom:offset.bottom,left:offsetLeft,right:offset.right,width:offset.width,height:offset.height}}function noop(){}function stopPropagation(e){e.stopPropagation()}function bind(func,obj){var slice=Array.prototype.slice,args=slice.call(arguments,2);return function(){return func.apply(obj,args.concat(slice.call(arguments)))}}function draggable(element,onmove,onstart,onstop){function prevent(e){e.stopPropagation&&e.stopPropagation();e.preventDefault&&e.preventDefault();e.returnValue=!1}function move(e){if(dragging){if(IE&&doc.documentMode<9&&!e.button)return stop();var t0=e.originalEvent&&e.originalEvent.touches&&e.originalEvent.touches[0],pageX=t0&&t0.pageX||e.pageX,pageY=t0&&t0.pageY||e.pageY,dragX=Math.max(0,Math.min(pageX-offset.left,maxWidth)),dragY=Math.max(0,Math.min(pageY-offset.top,maxHeight));hasTouch&&prevent(e);onmove.apply(element,[dragX,dragY,e])}}function start(e){var rightclick=e.which?e.which==3:e.button==2;if(!rightclick&&!dragging&&onstart.apply(element,arguments)!==!1){dragging=!0;maxHeight=$(element).height();maxWidth=$(element).width();offset=$(element).offset();$(doc).on(duringDragEvents);$(doc.body).addClass("sp-dragging");move(e);prevent(e)}}function stop(){dragging&&($(doc).off(duringDragEvents),$(doc.body).removeClass("sp-dragging"),setTimeout(function(){onstop.apply(element,arguments)},0));dragging=!1}onmove=onmove||function(){};onstart=onstart||function(){};onstop=onstop||function(){};var doc=document,dragging=!1,offset={},maxHeight=0,maxWidth=0,hasTouch="ontouchstart"in window,duringDragEvents={};duringDragEvents.selectstart=prevent;duringDragEvents.dragstart=prevent;duringDragEvents["touchmove mousemove"]=move;duringDragEvents["touchend mouseup"]=stop;$(element).on("touchstart mousedown",start)}function throttle(func,wait,debounce){var timeout;return function(){var context=this,args=arguments,throttler=function(){timeout=null;func.apply(context,args)};debounce&&clearTimeout(timeout);(debounce||!timeout)&&(timeout=setTimeout(throttler,wait))}}function inputTypeColorSupport(){return $.fn.spectrum.inputTypeColorSupport()}var defaultOpts={beforeShow:noop,move:noop,change:noop,show:noop,hide:noop,color:!1,flat:!1,type:"",showInput:!1,allowEmpty:!0,showButtons:!0,clickoutFiresChange:!0,showInitial:!1,showPalette:!0,showPaletteOnly:!1,hideAfterPaletteSelect:!1,togglePaletteOnly:!1,showSelectionPalette:!0,localStorageKey:!1,appendTo:"body",maxSelectionSize:8,locale:"en",cancelText:"cancel",chooseText:"choose",togglePaletteMoreText:"more",togglePaletteLessText:"less",clearText:"Clear Color Selection",noColorSelectedText:"No Color Selected",preferredFormat:"name",className:"",containerClassName:"",replacerClassName:"",showAlpha:!0,theme:"sp-light",palette:[["#000000","#444444","#5b5b5b","#999999","#bcbcbc","#eeeeee","#f3f6f4","#ffffff"],["#f44336","#744700","#ce7e00","#8fce00","#2986cc","#16537e","#6a329f","#c90076"],["#f4cccc","#fce5cd","#fff2cc","#d9ead3","#d0e0e3","#cfe2f3","#d9d2e9","#ead1dc"],["#ea9999","#f9cb9c","#ffe599","#b6d7a8","#a2c4c9","#9fc5e8","#b4a7d6","#d5a6bd"],["#e06666","#f6b26b","#ffd966","#93c47d","#76a5af","#6fa8dc","#8e7cc3","#c27ba0"],["#cc0000","#e69138","#f1c232","#6aa84f","#45818e","#3d85c6","#674ea7","#a64d79"],["#990000","#b45f06","#bf9000","#38761d","#134f5c","#0b5394","#351c75","#741b47"],["#660000","#783f04","#7f6000","#274e13","#0c343d","#073763","#20124d","#4c1130"]],selectionPalette:[],disabled:!1,offset:null},spectrums=[],IE=!!/msie/i.exec(window.navigator.userAgent),rgbaSupport=function(){function contains(str,substr){return!!~(""+str).indexOf(substr)}var elem=document.createElement("div"),style=elem.style;return style.cssText="background-color:rgba(0,0,0,.5)",contains(style.backgroundColor,"rgba")||contains(style.backgroundColor,"hsla")}(),replaceInput="<div class='sp-replacer'><div class='sp-preview'><div class='sp-preview-inner'><\/div><\/div><div class='sp-dd'>▼<\/div><\/div>",markup=function(){var gradientFix="",i;if(IE)for(i=1;i<=6;i++)gradientFix+="<div class='sp-"+i+"'><\/div>";return["<div class='sp-container sp-hidden'>","<div class='sp-palette-container'>","<div class='sp-palette sp-thumb sp-cf'><\/div>","<div class='sp-palette-button-container sp-cf'>","<button type='button' class='sp-palette-toggle'><\/button>
12","<\/div>","<\/div>","<div class='sp-picker-container'>","<div class='sp-top sp-cf'>","<div class='sp-fill'><\/div>","<div class='sp-top-inner'>","<div class='sp-color'>","<div class='sp-sat'>","<div class='sp-val'>","<div class='sp-dragger'><\/div>","<\/div>","<\/div>","<\/div>","<div class='sp-clear sp-clear-display'>","<\/div>","<div class='sp-hue'>","<div class='sp-slider'><\/div>",gradientFix,"<\/div>","<a class='sp-eye-dropper'><svg xmlns = 'http://www.w3.org/2000/svg' style = 'width: 17px; height: 17px;' fill = '#000000' viewBox = '0 0 256 256'><path d='M224,67.3a35.79,35.79,0,0,0-11.26-25.66c-14-13.28-36.72-12.78-50.62,1.13L142.8,62.2a24,24,0,0,0-33.14.77l-9,9a16,16,0,0,0,0,22.64l2,2.06-51,51a39.75,39.75,0,0,0-10.53,38l-8,18.41A13.68,13.68,0,0,0,36,219.3a15.92,15.92,0,0,0,17.71,3.35L71.23,215a39.89,39.89,0,0,0,37.06-10.75l51-51,2.06,2.06a16,16,0,0,0,22.62,0l9-9a24,24,0,0,0,.74-33.18l19.75-19.87A35.75,35.75,0,0,0,224,67.3ZM97,193a24,24,0,0,1-24,6,8,8,0,0,0-5.55.31l-18.1,7.91L57,189.41a8,8,0,0,0,.25-5.75A23.88,23.88,0,0,1,63,159l51-51,33.94,34ZM202.13,82l-25.37,25.52a8,8,0,0,0,0,11.3l4.89,4.89a8,8,0,0,1,0,11.32l-9,9L112,83.26l9-9a8,8,0,0,1,11.31,0l4.89,4.89a8,8,0,0,0,11.33,0l24.94-25.09c7.81-7.82,20.5-8.18,28.29-.81a20,20,0,0,1,.39,28.7Z'><\/path><\/svg><\/a>","<\/div>","<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'><\/div><\/div><\/div>","<\/div>","<div class='sp-input-container sp-cf'>","<input class='sp-input' type='text' spellcheck='false' />","<\/div>","<div class='sp-initial sp-thumb sp-cf'><\/div>","<div class='sp-button-container sp-cf'>","<button class='sp-cancel' href='#'><\/button>","<button type='button' class='sp-choose'><\/button>","<\/div>","<\/div>","<\/div>"].join("")}(),dataID="spectrum.id";$.fn.spectrum=function(opts){if(typeof opts=="string"){var returnValue=this,args=Array.prototype.slice.call(arguments,1);return this.each(function(){var spect=spectrums[$(this).data(dataID)],method;if(spect){if(method=spect[opts],!method)throw new Error("Spectrum: no such method: '"+opts+"'");opts=="get"?returnValue=spect.get():opts=="container"?returnValue=spect.container:opts=="option"?returnValue=spect.option.apply(spect,args):opts=="destroy"?(spect.destroy(),$(this).removeData(dataID)):method.apply(spect,args)}}),returnValue}return this.spectrum("destroy").each(function(){var options=$.extend({},$(this).data(),opts),spect;options.type=$(this).is("input")?options.flat||options.type=="flat"?"flat":$(this).attr("type")=="color"?"color":options.type||"component":"noInput";spect=spectrum(this,options);$(this).data(dataID,spect.id)})};$.fn.spectrum.load=!0;$.fn.spectrum.loadOpts={};$.fn.spectrum.draggable=draggable;$.fn.spectrum.defaults=defaultOpts;$.fn.spectrum.inputTypeColorSupport=function inputTypeColorSupport(){if(typeof inputTypeColorSupport._cachedResult=="undefined"){var colorInput=$("<input type='color'/>")[0];inputTypeColorSupport._cachedResult=colorInput.type==="color"&&colorInput.value!==""}return inputTypeColorSupport._cachedResult};$.spectrum={};$.spectrum.localization={};$.spectrum.palettes={};$.fn.spectrum.processNativeColorInputs=function(){var colorInputs=$("input[type=color]");colorInputs.length&&!inputTypeColorSupport()&&colorInputs.spectrum({preferredFormat:"hex6"})},function(){function inputToRGB(color){var rgb={r:0,g:0,b:0},a=1,ok=!1,format=!1;return typeof color=="string"&&(color=stringInputToObject(color)),typeof color=="object"&&(color.hasOwnProperty("r")&&color.hasOwnProperty("g")&&color.hasOwnProperty("b")?(rgb=rgbToRgb(color.r,color.g,color.b),ok=!0,format=String(color.r).substr(-1)==="%"?"prgb":"rgb"):color.hasOwnProperty("h")&&color.hasOwnProperty("s")&&color.hasOwnProperty("v")?(color.s=convertToPercentage(color.s),color.v=convertToPercentage(color.v),rgb=hsvToRgb(color.h,color.s,color.v),ok=!0,format="hsv"):color.hasOwnProperty("h")&&color.hasOwnProperty("s")&&color.hasOwnProperty("l")&&(color.s=convertToPercentage(color.s),color.l=convertToPercentage(color.l),rgb=hslToRgb(color.h,color.s,color.l),ok=!0,format="hsl"),color.hasOwnProperty("a")&&(a=color.a)),a=boundAlpha(a),{ok:ok,format:color.format||format,r:mathMin(255,mathMax(rgb.r,0)),g:mathMin(255,mathMax(rgb.g,0)),b:mathMin(255,mathMax(rgb.b,0)),a:a}}function rgbToRgb(r,g,b){return{r:bound01(r,255)*255,g:bound01(g,255)*255,b:bound01(b,255)*255}}function rgbToHsl(r,g,b){var d;r=bound01(r,255);g=bound01(g,255);b=bound01(b,255);var max=mathMax(r,g,b),min=mathMin(r,g,b),h,s,l=(max+min)/2;if(max==min)h=s=0;else{d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4}h/=6}return{h:h,s:s,l:l}}function hslToRgb(h,s,l){function hue2rgb(p,q,t){return(t<0&&(t+=1),t>1&&(t-=1),t<1/6)?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p}var r,g,b,q,p;return h=bound01(h,360),s=bound01(s,100),l=bound01(l,100),s===0?r=g=b=l:(q=l<.5?l*(1+s):l+s-l*s,p=2*l-q,r=hue2rgb(p,q,h+1/3),g=hue2rgb(p,q,h),b=hue2rgb(p,q,h-1/3)),{r:r*255,g:g*255,b:b*255}}function rgbToHsv(r,g,b){r=bound01(r,255);g=bound01(g,255);b=bound01(b,255);var max=mathMax(r,g,b),min=mathMin(r,g,b),h,s,v=max,d=max-min;if(s=max===0?0:d/max,max==min)h=0;else{switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4}h/=6}return{h:h,s:s,v:v}}function hsvToRgb(h,s,v){h=bound01(h,360)*6;s=bound01(s,100);v=bound01(v,100);var i=math.floor(h),f=h-i,p=v*(1-s),q=v*(1-f*s),t=v*(1-(1-f)*s),mod=i%6,r=[v,q,p,p,t,v][mod],g=[t,v,v,q,p,p][mod],b=[p,p,t,v,v,q][mod];return{r:r*255,g:g*255,b:b*255}}function rgbToHex(r,g,b,allow3Char){var hex=[pad2(mathRound(r).toString(16)),pad2(mathRound(g).toString(16)),pad2(mathRound(b).toString(16))];return allow3Char&&hex[0].charAt(0)==hex[0].charAt(1)&&hex[1].charAt(0)==hex[1].charAt(1)&&hex[2].charAt(0)==hex[2].charAt(1)?hex[0].charAt(0)+hex[1].charAt(0)+hex[2].charAt(0):hex.join("")}function rgbaToHex(r,g,b,a){var hex=[pad2(convertDecimalToHex(a)),pad2(mathRound(r).toString(16)),pad2(mathRound(g).toString(16)),pad2(mathRound(b).toString(16))];return hex.join("")}function desaturate(color,amount){amount=amount===0?0:amount||10;var hsl=tinycolor(color).toHsl();return hsl.s-=amount/100,hsl.s=clamp01(hsl.s),tinycolor(hsl)}function saturate(color,amount){amount=amount===0?0:amount||10;var hsl=tinycolor(color).toHsl();return hsl.s+=amount/100,hsl.s=clamp01(hsl.s),tinycolor(hsl)}function greyscale(color){return tinycolor(color).desaturate(100)}function lighten(color,amount){amount=amount===0?0:amount||10;var hsl=tinycolor(color).toHsl();return hsl.l+=amount/100,hsl.l=clamp01(hsl.l),tinycolor(hsl)}function brighten(color,amount){amount=amount===0?0:amount||10;var rgb=tinycolor(color).toRgb();return rgb.r=mathMax(0,mathMin(255,rgb.r-mathRound(255*-(amount/100)))),rgb.g=mathMax(0,mathMin(255,rgb.g-mathRound(255*-(amount/100)))),rgb.b=mathMax(0,mathMin(255,rgb.b-mathRound(255*-(amount/100)))),tinycolor(rgb)}function darken(color,amount){amount=amount===0?0:amount||10;var hsl=tinycolor(color).toHsl();return hsl.l-=amount/100,hsl.l=clamp01(hsl.l),tinycolor(hsl)}function spin(color,amount){var hsl=tinycolor(color).toHsl(),hue=(mathRound(hsl.h)+amount)%360;return hsl.h=hue<0?360+hue:hue,tinycolor(hsl)}function complement(color){var hsl=tinycolor(color).toHsl();return hsl.h=(hsl.h+180)%360,tinycolor(hsl)}function triad(color){var hsl=tinycolor(color).toHsl(),h=hsl.h;return[tinycolor(color),tinycolor({h:(h+120)%360,s:hsl.s,l:hsl.l}),tinycolor({h:(h+240)%360,s:hsl.s,l:hsl.l})]}function tetrad(color){var hsl=tinycolor(color).toHsl(),h=hsl.h;return[tinycolor(color),tinycolor({h:(h+90)%360,s:hsl.s,l:hsl.l}),tinycolor({h:(h+180)%360,s:hsl.s,l:hsl.l}),tinycolor({h:(h+270)%360,s:hsl.s,l:hsl.l})]}function splitcomplement(color){var hsl=tinycolor(color).toHsl(),h=hsl.h;return[tinycolor(color),tinycolor({h:(h+72)%360,s:hsl.s,l:hsl.l}),tinycolor({h:(h+216)%360,s:hsl.s,l:hsl.l})]}function analogous(color,results,slices){results=results||6;slices=slices||30;var hsl=tinycolor(color).toHsl(),part=360/slices,ret=[tinycolor(color)];for(hsl.h=(hsl.h-(part*results>>
121)+720)%360;--results;)hsl.h=(hsl.h+part)%360,ret.push(tinycolor(hsl));return ret}function monochromatic(color,results){results=results||6;for(var hsv=tinycolor(color).toHsv(),h=hsv.h,s=hsv.s,v=hsv.v,ret=[],modification=1/results;results--;)ret.push(tinycolor({h:h,s:s,v:v})),v=(v+modification)%1;return ret}function flip(o){var flipped={};for(var i in o)o.hasOwnProperty(i)&&(flipped[o[i]]=i);return flipped}function boundAlpha(a){return a=parseFloat(a),(isNaN(a)||a<0||a>1)&&(a=1),a}function bound01(n,max){isOnePointZero(n)&&(n="100%");var processPercent=isPercentage(n);return(n=mathMin(max,mathMax(0,parseFloat(n))),processPercent&&(n=parseInt(n*max,10)/100),math.abs(n-max)<1e-6)?1:n%max/parseFloat(max)}function clamp01(val){return mathMin(1,mathMax(0,val))}function parseIntFromHex(val){return parseInt(val,16)}function isOnePointZero(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function isPercentage(n){return typeof n=="string"&&n.indexOf("%")!=-1}function pad2(c){return c.length==1?"0"+c:""+c}function convertToPercentage(n){return n<=1&&(n=n*100+"%"),n}function convertDecimalToHex(d){return Math.round(parseFloat(d)*255).toString(16)}function convertHexToDecimal(h){return parseIntFromHex(h)/255}function stringInputToObject(color){var named,match;if(color=color.replace(trimLeft,"").replace(trimRight,"").toLowerCase(),named=!1,names[color])color=names[color],named=!0;else if(color=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};return(match=matchers.rgb.exec(color))?{r:match[1],g:match[2],b:match[3]}:(match=matchers.rgba.exec(color))?{r:match[1],g:match[2],b:match[3],a:match[4]}:(match=matchers.hsl.exec(color))?{h:match[1],s:match[2],l:match[3]}:(match=matchers.hsla.exec(color))?{h:match[1],s:match[2],l:match[3],a:match[4]}:(match=matchers.hsv.exec(color))?{h:match[1],s:match[2],v:match[3]}:(match=matchers.hsva.exec(color))?{h:match[1],s:match[2],v:match[3],a:match[4]}:(match=matchers.hex8.exec(color))?{a:convertHexToDecimal(match[1]),r:parseIntFromHex(match[2]),g:parseIntFromHex(match[3]),b:parseIntFromHex(match[4]),format:named?"name":"hex8"}:(match=matchers.hex6.exec(color))?{r:parseIntFromHex(match[1]),g:parseIntFromHex(match[2]),b:parseIntFromHex(match[3]),format:named?"name":"hex"}:(match=matchers.hex3.exec(color))?{r:parseIntFromHex(match[1]+""+match[1]),g:parseIntFromHex(match[2]+""+match[2]),b:parseIntFromHex(match[3]+""+match[3]),format:named?"name":"hex"}:!1}var trimLeft=/^[\s,#]+/,trimRight=/\s+$/,tinyCounter=0,math=Math,mathRound=math.round,mathMin=math.min,mathMax=math.max,mathRandom=math.random,tinycolor=function(color,opts){if(color=color?color:"",opts=opts||{},color instanceof tinycolor)return color;if(!(this instanceof tinycolor))return new tinycolor(color,opts);var rgb=inputToRGB(color);this._originalInput=color;this._r=rgb.r;this._g=rgb.g;this._b=rgb.b;this._a=rgb.a;this._roundA=mathRound(1e3*this._a)/1e3;this._format=opts.format||rgb.format;this._gradientType=opts.gradientType;this._r<1&&(this._r=mathRound(this._r));this._g<1&&(this._g=mathRound(this._g));this._b<1&&(this._b=mathRound(this._b));this._ok=rgb.ok;this._tc_id=tinyCounter++},names,hexNames,matchers;tinycolor.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var rgb=this.toRgb();return(rgb.r*299+rgb.g*587+rgb.b*114)/1e3},setAlpha:function(value){return this._a=boundAlpha(value),this._roundA=mathRound(1e3*this._a)/1e3,this},toHsv:function(){var hsv=rgbToHsv(this._r,this._g,this._b);return{h:hsv.h*360,s:hsv.s,v:hsv.v,a:this._a}},toHsvString:function(){var hsv=rgbToHsv(this._r,this._g,this._b),h=mathRound(hsv.h*360),s=mathRound(hsv.s*100),v=mathRound(hsv.v*100);return this._a==1?"hsv("+h+", "+s+"%, "+v+"%)":"hsva("+h+", "+s+"%, "+v+"%, "+this._roundA+")"},toHsl:function(){var hsl=rgbToHsl(this._r,this._g,this._b);return{h:hsl.h*360,s:hsl.s,l:hsl.l,a:this._a}},toHslString:function(){var hsl=rgbToHsl(this._r,this._g,this._b),h=mathRound(hsl.h*360),s=mathRound(hsl.s*100),l=mathRound(hsl.l*100);return this._a==1?"hsl("+h+", "+s+"%, "+l+"%)":"hsla("+h+", "+s+"%, "+l+"%, "+this._roundA+")"},toHex:function(allow3Char){return rgbToHex(this._r,this._g,this._b,allow3Char)},toHexString:function(allow3Char){return"#"+this.toHex(allow3Char)},toHex8:function(){return rgbaToHex(this._r,this._g,this._b,this._a)},toHex8String:function(){return"#"+this.toHex8()},toRgb:function(){return{r:mathRound(this._r),g:mathRound(this._g),b:mathRound(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+mathRound(this._r)+", "+mathRound(this._g)+", "+mathRound(this._b)+")":"rgba("+mathRound(this._r)+", "+mathRound(this._g)+", "+mathRound(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:mathRound(bound01(this._r,255)*100)+"%",g:mathRound(bound01(this._g,255)*100)+"%",b:mathRound(bound01(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+mathRound(bound01(this._r,255)*100)+"%, "+mathRound(bound01(this._g,255)*100)+"%, "+mathRound(bound01(this._b,255)*100)+"%)":"rgba("+mathRound(bound01(this._r,255)*100)+"%, "+mathRound(bound01(this._g,255)*100)+"%, "+mathRound(bound01(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:hexNames[rgbToHex(this._r,this._g,this._b,!0)]||!1},toFilter:function(secondColor){var hex8String="#"+rgbaToHex(this._r,this._g,this._b,this._a),secondHex8String=hex8String,gradientType=this._gradientType?"GradientType = 1, ":"",s;return secondColor&&(s=tinycolor(secondColor),secondHex8String=s.toHex8String()),"progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"},toString:function(format){var formatSet=!!format;format=format||this._format;var formattedString=!1,hasAlpha=this._a<1&&this._a>=0,needsAlphaFormat=!formatSet&&hasAlpha&&(format==="hex"||format==="hex6"||format==="hex3"||format==="name");return needsAlphaFormat?format==="name"&&this._a===0?this.toName():this.toRgbString():(format==="rgb"&&(formattedString=this.toRgbString()),format==="prgb"&&(formattedString=this.toPercentageRgbString()),(format==="hex"||format==="hex6")&&(formattedString=this.toHexString()),format==="hex3"&&(formattedString=this.toHexString(!0)),format==="hex8"&&(formattedString=this.toHex8String()),format==="name"&&(formattedString=this.toName()),format==="hsl"&&(formattedString=this.toHslString()),format==="hsv"&&(formattedString=this.toHsvString()),formattedString||this.toHexString())},_applyModification:function(fn,args){var color=fn.apply(null,[this].concat([].slice.call(args)));return this._r=color._r,this._g=color._g,this._b=color._b,this.setAlpha(color._a),this},lighten:function(){return this._applyModification(lighten,arguments)},brighten:function(){return this._applyModification(brighten,arguments)},darken:function(){return this._applyModification(darken,arguments)},desaturate:function(){return this._applyModification(desaturate,arguments)},saturate:function(){return this._applyModification(saturate,arguments)},greyscale:function(){return this._applyModification(greyscale,arguments)},spin:function(){return this._applyModification(spin,arguments)},_applyCombination:function(fn,args){return fn.apply(null,[this].concat([].slice.call(args)))},analogous:function(){return this._applyCombination(analogous,arguments)},complement:function(){return this._applyCombination(complement,arguments)},monochromatic:function(){return this._applyCombination(monochromatic,arguments)},splitcomplement:function(){return this._applyCombination(splitcomplement,arguments)},triad:function(){return this._applyCombination(triad,arguments)},tetrad:function(){return this._applyCombination(tetrad,arguments)}};tinycolor.fromRatio=function(color,opts){var newColor,i;if(typeof color=="object"){newColor={};for(i in color)color.hasOwnProperty(i)&&(newColor[i]=i==="a"?color[i]:convertToPercentage(color[i]));color=newColor}return tinycolor(color,opts)};tinycolor.equals=function(color1,color2){return!color1||!color2?!1:tinycolor(color1).toRgbString()==tinycolor(color2).toRgbString()};tinycolor.random=function(){return tinycolor.fromRatio({r:mathRandom(),g:mathRandom(),b:mathRandom()})};tinycolor.mix=function(color1,color2,amount){var w2,rgba;amount=amount===0?0:amount||50;var rgb1=tinycolor(color1).toRgb(),rgb2=tinycolor(color2).toRgb(),p=amount/100,w=p*2-1,a=rgb2.a-rgb1.a,w1;return w1=w*a==-1?w:(w+a)/(1+w*a),w1=(w1+1)/2,w2=1-w1,rgba={r:rgb2.r*w1+rgb1.r*w2,g:rgb2.g*w1+rgb1.g*w2,b:rgb2.b*w1+rgb1.b*w2,a:rgb2.a*p+rgb1.a*(1-p)},tinycolor(rgba)};tinycolor.readability=function(color1,color2){var c1=tinycolor(color1),c2=tinycolor(color2),rgb1=c1.toRgb(),rgb2=c2.toRgb(),brightnessA=c1.getBrightness(),brightnessB=c2.getBrightness(),colorDiff=Math.max(rgb1.r,rgb2.r)-Math.min(rgb1.r,rgb2.r)+Math.max(rgb1.g,rgb2.g)-Math.min(rgb1.g,rgb2.g)+Math.max(rgb1.b,rgb2.b)-Math.min(rgb1.b,rgb2.b);return{brightness:Math.abs(brightnessA-brightnessB),color:colorDiff}};tinycolor.isReadable=function(color1,color2){var readability=tinycolor.readability(color1,color2);return readability.brightness>125&&readability.color>500};tinycolor.mostReadable=function(baseColor,colorList){for(var bestColor=null,bestScore=0,bestIsReadable=!1,i=0;i<colorList.length;i++){var readability=tinycolor.readability(baseColor,colorList[i]),readable=readability.brightness>125&&readability.color>500,score=3*(readability.brightness/125)+readability.color/500;(readable&&!bestIsReadable||readable&&bestIsReadable&&score>bestScore||!readable&&!bestIsReadable&&score>bestScore)&&(bestIsReadable=readable,bestScore=score,bestColor=tinycolor(colorList[i]))}return bestColor};names=tinycolor.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
120",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};hexNames=tinycolor.hexNames=flip(names);matchers=function(){var CSS_UNIT="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",PERMISSIVE_MATCH3="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?",PERMISSIVE_MATCH4="[\\s|\\(]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")[,|\\s]+("+CSS_UNIT+")\\s*\\)?";return{rgb:new RegExp("rgb"+PERMISSIVE_MATCH3),rgba:new RegExp("rgba"+PERMISSIVE_MATCH4),hsl:new RegExp("hsl"+PERMISSIVE_MATCH3),hsla:new RegExp("hsla"+PERMISSIVE_MATCH4),hsv:new RegExp("hsv"+PERMISSIVE_MATCH3),hsva:new RegExp("hsva"
12+PERMISSIVE_MATCH4),hex3:/^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex8:/^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();window.tinycolor=tinycolor}();$(function(){$.fn.spectrum.load&&$.fn.spectrum.processNativeColorInputs()})}),function($){var localization=$.spectrum.localization.ar={cancelText:"Ø¥ÙØºØ§Ø¡",chooseText:"إختار",clearText:"إرجاع Ø§ÙØ£ÙÙØ§Ù عÙÙ Ù
ا ÙØ§Ùت",noColorSelectedText:"ÙÙ
تختار Ø£Ù ÙÙÙ",togglePaletteMoreText:"Ø£ÙØ«Ø±",togglePaletteLessText:"Ø£ÙÙ"}}(jQuery),function($){var localization=$.spectrum.localization.ca={cancelText:"Cancel·lar",chooseText:"Escollir",clearText:"Esborrar color seleccionat",noColorSelectedText:"Cap color seleccionat",togglePaletteMoreText:"Més",togglePaletteLessText:"Menys"}}(jQuery),function($){var localization=$.spectrum.localization.cs={cancelText:"zruÅ¡it",chooseText:"vybrat",clearText:"Resetovat výbÄr barev",noColorSelectedText:"Žádná barva nebyla vybrána",togglePaletteMoreText:"vÃce",togglePaletteLessText:"ménÄ"}}(jQuery),function($){var localization=$.spectrum.localization.de={cancelText:"Abbrechen",chooseText:"Wählen",clearText:"Farbauswahl zurücksetzen",noColorSelectedText:"Keine Farbe ausgewählt",togglePaletteMoreText:"Mehr",togglePaletteLessText:"Weniger"}}(jQuery),function($){var localization=$.spectrum.localization.dk={cancelText:"annuller",chooseText:"Vælg"}}(jQuery),function($){var localization=$.spectrum.localization.es={cancelText:"Cancelar",chooseText:"Elegir",clearText:"Borrar color seleccionado",noColorSelectedText:"Ningún color seleccionado",togglePaletteMoreText:"Más",togglePaletteLessText:"Menos"}}(jQuery),function($){var localization=$.spectrum.localization.et={cancelText:"Katkesta",chooseText:"Vali",clearText:"Tühista värvivalik",noColorSelectedText:"Ãhtki värvi pole valitud",togglePaletteMoreText:"Rohkem",togglePaletteLessText:"Vähem"}}(jQuery),function($){var localization=$.spectrum.localization.fa={cancelText:"ÙØºÙ",chooseText:"Ø§ÙØªØ®Ø§Ø¨",clearText:"ØªÙØ¸ÛÙ
Ù
جدد رÙÚ¯",noColorSelectedText:"ÙÛÚ Ø±ÙÚ¯Û Ø§ÙØªØ®Ø§Ø¨ ÙØ´Ø¯Ù است!",togglePaletteMoreText:"Ø¨ÛØ´ØªØ±",togglePaletteLessText:"Ú©Ù
تر"}}(jQuery),function($){var localization=$.spectrum.localization.fi={cancelText:"Kumoa",chooseText:"Valitse"}}(jQuery),function($){var localization=$.spectrum.localization.fr={cancelText:"Annuler",chooseText:"Valider",clearText:"Effacer couleur sélectionnée",noColorSelectedText:"Aucune couleur sélectionnée",togglePaletteMoreText:"Plus",togglePaletteLessText:"Moins"}}(jQuery),function($){var localization=$.spectrum.localization.gr={cancelText:"ÎκÏÏÏÏη",chooseText:"ÎÏιλογή",clearText:"ÎαθαÏιÏμÏÏ ÎµÏιλεγμÎνοÏ
ÏÏÏμαÏοÏ",noColorSelectedText:"Îεν ÎÏει εÏιλεÏθεί κάÏοιο ÏÏÏμα",togglePaletteMoreText:"ΠεÏιÏÏÏÏεÏα",togglePaletteLessText:"ÎιγÏÏεÏα"}}(jQuery),function($){var localization=$.spectrum.localization.he={cancelText:"××× ×××ר×",chooseText:"××ר צ××¢",clearText:"×פס ×××ר×",noColorSelectedText:"×× × ××ר צ××¢",togglePaletteMoreText:"×¢×× ×¦××¢××",togglePaletteLessText:"פ××ת צ××¢××"}}(jQuery),function($){var localization=$.spectrum.localization.hr={cancelText:"Odustani",chooseText:"Odaberi",clearText:"PoniÅ¡ti odabir",noColorSelectedText:"Niti jedna boja nije odabrana",togglePaletteMoreText:"ViÅ¡e",togglePaletteLessText:"Manje"}}(jQuery),function($){var localization=$.spectrum.localization.hu={cancelText:"Mégsem",chooseText:"Mentés",clearText:"A szÃnválasztás visszaállÃtása",noColorSelectedText:"Nincs szÃn kijelölve",togglePaletteMoreText:"Több",togglePaletteLessText:"Kevesebb"}}(jQuery),function($){var localization=$.spectrum.localization.id={cancelText:"Batal",chooseText:"Pilih",clearText:"Hapus Pilihan Warna",noColorSelectedText:"Warna Tidak Dipilih",togglePaletteMoreText:"tambah",togglePaletteLessText:"kurangi"}}(jQuery),function($){var localization=$.spectrum.localization.it={cancelText:"annulla",chooseText:"scegli",clearText:"Annulla selezione colore",noColorSelectedText:"Nessun colore selezionato"}}(jQuery),function($){var localization=$.spectrum.localization.ja={cancelText:"䏿¢",chooseText:"鏿"}}(jQuery),function($){var localization=$.spectrum.localization.ko={cancelText:"ì·¨ì",chooseText:"ì í",clearText:"ì í ì´ê¸°í",noColorSelectedText:"ì íë ìì ìì",togglePaletteMoreText:"ë보기",togglePaletteLessText:"ì¤ì´ê¸°"}}(jQuery),function($){var localization=$.spectrum.localization.lt={cancelText:"AtÅ¡aukti",chooseText:"Pasirinkti",clearText:"IÅ¡valyti pasirinkimÄ
",noColorSelectedText:"Spalva nepasirinkta",togglePaletteMoreText:"Daugiau",togglePaletteLessText:"Mažiau"}}(jQuery),function($){var localization=$.spectrum.localization["nb-no"]={cancelText:"Avbryte",chooseText:"Velg",clearText:"Tilbakestill",noColorSelectedText:"Farge er ikke valgt",togglePaletteMoreText:"Mer",togglePaletteLessText:"Mindre"}}(jQuery),function($){var localization=$.spectrum.localization["nl-nl"]={cancelText:"Annuleer",chooseText:"Kies",clearText:"Wis kleur selectie",togglePaletteMoreText:"Meer",togglePaletteLessText:"Minder"}}(jQuery),function($){var localization=$.spectrum.localization.pl={cancelText:"Anuluj",chooseText:"Wybierz",clearText:"UsuÅ wybór koloru",noColorSelectedText:"Nie wybrano koloru",togglePaletteMoreText:"WiÄcej",togglePaletteLessText:"Mniej"}}(jQuery),function($){var localization=$.spectrum.localization["pt-br"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor selecionada",noColorSelectedText:"Nenhuma cor selecionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"}}(jQuery),function($){var localization=$.spectrum.localization["pt-pt"]={cancelText:"Cancelar",chooseText:"Escolher",clearText:"Limpar cor seleccionad
12a",noColorSelectedText:"Nenhuma cor seleccionada",togglePaletteMoreText:"Mais",togglePaletteLessText:"Menos"}}(jQuery),function($){var localization=$.spectrum.localization.ru={cancelText:"ÐÑмена",chooseText:"ÐÑбÑаÑÑ",clearText:"СбÑоÑиÑÑ",noColorSelectedText:"Ð¦Ð²ÐµÑ Ð½Ðµ вÑбÑан",togglePaletteMoreText:"ÐÑÑ",togglePaletteLessText:"СкÑÑÑÑ"}}(jQuery),function($){var localization=$.spectrum.localization.sv={cancelText:"Avbryt",chooseText:"Välj"}}(jQuery),function($){var localization=$.spectrum.localization.tr={cancelText:"iptal",chooseText:"tamam"}}(jQuery),function($){var localization=$.spectrum.localization["zh-cn"]={cancelText:"åæ¶",chooseText:"éæ©",clearText:"æ¸ é¤",togglePaletteMoreText:"æ´å¤é项",togglePaletteLessText:"éè",noColorSelectedText:"å°æªéæ©ä»»ä½é¢è²"}}(jQuery),function($){var localization=$.spectrum.localization["zh-tw"]={cancelText:"åæ¶",chooseText:"鏿",clearText:"æ¸ é¤",togglePaletteMoreText:"æ´å¤é¸é ",togglePaletteLessText:"é±è",noColorSelectedText:"å°æªé¸æä»»ä½é¡è²"}}(jQuery);isMobile=/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase());isMobile?($(".js-icon-down-dir").click(function(){$(".stage-top__menu-popup").toggle()}),$(".js-bleedinfo-openmenu").click(function(e){$(e.target).parents(".stage-top__bleedStitch-popup").length<=0&&$(".stage-top__bleedStitch-popup").toggle()}),$("#stage-wrapper").click(function(e){var target=$(e.target);target.parent(".stage-top__bleed").length<=0&&target.parents(".stage-top__bleedStitch-popup").length<=0&&$(".stage-top__bleedStitch-popup").hide()})):($(".js-yourdesign-openmenu").hover(function(){clearTimeout(this.timer);$(".stage-top__menu-popup").show();$(".stage-top__bleedStitch-popup").hide();$(".stage-top__stitch-popup").hide()},function(){this.timer=setTimeout(function(){$(".stage-top__menu-popup").fadeOut(100)},400)}),$(".js-bleedinfo-openmenu").hover(function(){clearTimeout(this.timer);$(".js-bleedinfo-openmenu").find(".stage-top__bleedStitch-popup").show();$(".stage-top__menu-popup").hide()},function(){this.timer=setTimeout(function(){$(".js-bleedinfo-openmenu").find(".stage-top__bleedStitch-popup").fadeOut(10)},40)}));$(".stage-top__menu-popup").find(".mobile-only-close-popup").click(function(){$(".stage-top__menu-popup").hide()});$(".js-stitchinfo-openmenu").hover(function(){clearTimeout(this.timer);$(".js-stitchinfo-openmenu").find(".stage-top__bleedStitch-popup").show();$(".stage-top__menu-popup").hide()},function(){this.timer=setTimeout(function(){$(".js-stitchinfo-openmenu").find(".stage-top__bleedStitch-popup").fadeOut(10)},40)}); 13/*! Fabric.js Copyright 2008-2015, Printio (Juriy Zaytsev, Maxim Chernyak) */ 14fabric=fabric||{version:"2.3.6"};typeof exports!="undefined"?exports.fabric=fabric:typeof define=="function"&&define.amd&&define([],function(){return fabric});typeof document!="undefined"&&typeof window!="undefined"?(fabric.document=document,fabric.window=window):(fabric.document=require("jsdom").jsdom(decodeURIComponent("%3C!DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E"),{features:{FetchExternalResources:["img"]}}),fabric.jsdomImplForWrapper=require("jsdom/lib/jsdom/living/generated/utils").implForWrapper,fabric.nodeCanvas=require("jsdom/lib/jsdom/utils").Canvas,fabric.window=fabric.document.defaultView,DOMParser=require("xmldom").DOMParser);fabric.isTouchSupported="ontouchstart"in fabric.window;fabric.isLikelyNode=typeof Buffer!="undefined"&&typeof window=="undefined";fabric.SHARED_ATTRIBUTES=["display","transform","fill","fill-opacity","fill-rule","opacity","stroke","stroke-dasharray","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","id","paint-order","instantiated_by_use"];fabric.DPI=96;fabric.reNum="(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:e[-+]?\\d+)?)";fabric.fontPaths={};fabric.iMatrix=[1,0,0,1,0,0];fabric.canvasModule="canvas";fabric.perfLimitSizeTotal=2097152;fabric.maxCacheSideLimit=4096;fabric.minCacheSideLimit=256;fabric.charWidthsCache={};fabric.textureSize=2048;fabric.enableGLFiltering=!0;fabric.devicePixelRatio=fabric.window.devicePixelRatio||fabric.window.webkitDevicePixelRatio||fabric.window.mozDevicePixelRatio||1;fabric.browserShadowBlurConstant=1;fabric.arcToSegmentsCache={};fabric.boundsOfCurveCache={};fabric.cachesBoundsOfCurve=!0;fabric.initFilterBackend=function(){return fabric.enableGLFiltering&&fabric.isWebglSupported&&fabric.isWebglSupported(fabric.textureSize)?(console.log("max texture size: "+fabric.maxTextureSize),new fabric.WebglFilterBackend({tileSize:fabric.textureSize})):fabric.Canvas2dFilterBackend?new fabric.Canvas2dFilterBackend:void 0};typeof document!="undefined"&&typeof window!="undefined"&&(window.fabric=fabric),function(){function _removeEventListener(eventName,handler){if(this.__eventListeners[eventName]){var eventListener=this.__eventListeners[eventName];handler?eventListener[eventListener.indexOf(handler)]=!1:fabric.util.array.fill(eventListener,!1)}}function observe(eventName,handler){if(this.__eventListeners||(this.__eventListeners={}),arguments.length===1)for(var prop in eventName)this.on(prop,eventName[prop]);else this.__eventListeners[eventName]||(this.__eventListeners[eventName]=[]),this.__eventListeners[eventName].push(handler);return this}function stopObserving(eventName,handler){if(this.__eventListeners){if(arguments.length===0)for(eventName in this.__eventListeners)_removeEventListener.call(this,eventName);else if(arguments.length===1&&typeof arguments[0]=="object")for(var prop in eventName)_removeEventListener.call(this,prop,eventName[prop]);else _removeEventListener.call(this,eventName,handler);return this}}function fire(eventName,options){var listenersForEvent,i,len;if(this.__eventListeners&&(listenersForEvent=this.__eventListeners[eventName],listenersForEvent)){for(i=0,len=listenersForEvent.length;i<len;i++)listenersForEvent[i]&&listenersForEvent[i].call(this,options||{});return this.__eventListeners[eventName]=listenersForEvent.filter(function(value){return value!==!1}),this}}fabric.Observable={observe:observe,stopObserving:stopObserving,fire:fire,on:observe,off:stopObserving,trigger:fire}}();fabric.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var i=0,length=arguments.length;i<length;i++)this._onObjectAdded(arguments[i]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(object,index,nonSplicing){var objects=this._objects;return nonSplicing?objects[index]=object:objects.splice(index,0,object),this._onObjectAdded&&this._onObjectAdded(object),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var objects=this._objects,index,somethingRemoved=!1,i=0,length=arguments.length;i<length;i++)index=objects.indexOf(arguments[i]),index!==-1&&(somethingRemoved=!0,objects.splice(index,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[i]));return this.renderOnAddRemove&&somethingRemoved&&this.requestRenderAll(),this}
14,forEachObject:function(callback,context){for(var objects=this.getObjects(),i=0,len=objects.length;i<len;i++)callback.call(context,objects[i],i,objects);return this},getObjects:function(type){return typeof type=="undefined"?this._objects.concat():this._objects.filter(function(o){return o.type===type})},item:function(index){return this._objects[index]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(object){return this._objects.indexOf(object)>-1},complexity:function(){return this._objects.reduce(function(memo,current){return memo+(current.complexity?current.complexity():0)},0)}};fabric.CommonMethods={_setOptions:function(options){for(var prop in options)this.set(prop,options[prop])},_initGradient:function(filler,property){!filler||!filler.colorStops||filler instanceof fabric.Gradient||this.set(property,new fabric.Gradient(filler))},_initPattern:function(filler,property,callback){!filler||!filler.source||filler instanceof fabric.Pattern?callback&&callback():this.set(property,new fabric.Pattern(filler,callback))},_initClipping:function(options){if(options.clipTo&&typeof options.clipTo=="string"){var functionBody=fabric.util.getFunctionBody(options.clipTo);typeof functionBody!="undefined"&&(this.clipTo=new Function("ctx",functionBody))}},_setObject:function(obj){for(var prop in obj)this._set(prop,obj[prop])},set:function(key,value){return typeof key=="object"?this._setObject(key):typeof value=="function"&&key!=="clipTo"?this._set(key,value(this.get(key))):this._set(key,value),this},_set:function(key,value){this[key]=value},toggle:function(property){var value=this.get(property);return typeof value=="boolean"&&this.set(property,!value),this},get:function(property){return this[property]}},function(global){var sqrt=Math.sqrt,atan2=Math.atan2,pow=Math.pow,abs=Math.abs,PiBy180=Math.PI/180,PiBy2=Math.PI/2;fabric.util={cos:function(angle){if(angle===0)return 1;angle<0&&(angle=-angle);var angleSlice=angle/PiBy2;switch(angleSlice){case 1:case 3:return 0;case 2:return-1}return Math.cos(angle)},sin:function(angle){if(angle===0)return 0;var angleSlice=angle/PiBy2,sign=1;angle<0&&(sign=-1);switch(angleSlice){case 1:return sign;case 2:return 0;case 3:return-sign}return Math.sin(angle)},removeFromArray:function(array,value){var idx=array.indexOf(value);return idx!==-1&&array.splice(idx,1),array},getRandomInt:function(min,max){return Math.floor(Math.random()*(max-min+1))+min},degreesToRadians:function(degrees){return degrees*PiBy180},radiansToDegrees:function(radians){return radians/PiBy180},rotatePoint:function(point,origin,radians){point.subtractEquals(origin);var v=fabric.util.rotateVector(point,radians);return new fabric.Point(v.x,v.y).addEquals(origin)},rotateVector:function(vector,radians){var sin=fabric.util.sin(radians),cos=fabric.util.cos(radians),rx=vector.x*cos-vector.y*sin,ry=vector.x*sin+vector.y*cos;return{x:rx,y:ry}},transformPoint:function(p,t,ignoreOffset){return ignoreOffset?new fabric.Point(t[0]*p.x+t[2]*p.y,t[1]*p.x+t[3]*p.y):new fabric.Point(t[0]*p.x+t[2]*p.y+t[4],t[1]*p.x+t[3]*p.y+t[5])},makeBoundingBoxFromPoints:function(points){var xPoints=[points[0].x,points[1].x,points[2].x,points[3].x],minX=fabric.util.array.min(xPoints),maxX=fabric.util.array.max(xPoints),width=maxX-minX,yPoints=[points[0].y,points[1].y,points[2].y,points[3].y],minY=fabric.util.array.min(yPoints),maxY=fabric.util.array.max(yPoints),height=maxY-minY;return{left:minX,top:minY,width:width,height:height}},invertTransform:function(t){var a=1/(t[0]*t[3]-t[1]*t[2]),r=[a*t[3],-a*t[1],-a*t[2],a*t[0]],o=fabric.util.transformPoint({x:t[4],y:t[5]},r,!0);return r[4]=-o.x,r[5]=-o.y,r},toFixed:function(number,fractionDigits){return parseFloat(Number(number).toFixed(fractionDigits))},parseUnit:function(value,fontSize){var unit=/\D{0,2}$/.exec(value),number=parseFloat(value);fontSize||(fontSize=fabric.Text.DEFAULT_SVG_FONT_SIZE);switch(unit[0]){case"mm":return number*fabric.DPI/25.4;case"cm":return number*fabric.DPI/2.54;case"in":return number*fabric.DPI;case"pt":return number*fabric.DPI/72;case"pc":return number*fabric.DPI/6;case"em":return number*fontSize;default:return number}},falseFunction:function(){return!1},getKlass:function(type,namespace){return type=fabric.util.string.camelize(type.charAt(0).toUpperCase()+type.slice(1)),fabric.util.resolveNamespace(namespace)[type]},getSvgAttributes:function(type){var attributes=["instantiated_by_use","style","id","class"];switch(type){case"linearGradient":attributes=attributes.concat(["x1","y1","x2","y2","gradientUnits","gradientTransform"]);break;case"radialGradient":attributes=attributes.concat(["gradientUnits","gradientTransform","cx","cy","r","fx","fy","fr"]);break;case"stop":attributes=attributes.concat(["offset","stop-color","stop-opacity"])}return attributes},resolveNamespace:function(namespace){if(!namespace)return fabric;for(var parts=namespace.split("."),len=parts.length,obj=global||fabric.window,i=0;i<len;++i)obj=obj[parts[i]];return obj},loadImage:function(url,callback,context,crossOrigin){if(!url){callback&&callback.call(context,url);return}var img=fabric.util.createImage(),onLoadCallback=function(){callback&&callback.call(context,img);img=img.onload=img.onerror=null};img.onload=onLoadCallback;img.onerror=function(){fabric.log("Error loading "+img.src);callback&&callback.call(context,null,!0);img=img.onload=img.onerror=null};url.indexOf("data")!==0&&crossOrigin&&(img.crossOrigin=crossOrigin);url.substring(0,14)==="data:image/svg"&&(img.onload=null,fabric.util.loadImageInDom(img,onLoadCallback));img.src=url},loadImageInDom:function(img,onLoadCallback){var div=fabric.document.createElement("div");div.style.width=div.style.height="1px";div.style.left=div.style.top="-100%";div.style.position="absolute";div.appendChild(img);fabric.document.querySelector("body").appendChild(div);img.onload=function(){onLoadCallback();div.parentNode.removeChild(div);div=null}}
14,enlivenObjects:function(objects,callback,namespace,reviver){function onLoaded(){++numLoadedObjects===numTotalObjects&&callback&&callback(enlivenedObjects)}objects=objects||[];var enlivenedObjects=[],numLoadedObjects=0,numTotalObjects=objects.length;if(!numTotalObjects){callback&&callback(enlivenedObjects);return}objects.forEach(function(o,index){if(!o||!o.type){onLoaded();return}var klass=fabric.util.getKlass(o.type,namespace);klass.fromObject(o,function(obj,error){error||(enlivenedObjects[index]=obj);reviver&&reviver(o,obj,error);onLoaded()})})},enlivenPatterns:function(patterns,callback){function onLoaded(){++numLoadedPatterns===numPatterns&&callback&&callback(enlivenedPatterns)}patterns=patterns||[];var enlivenedPatterns=[],numLoadedPatterns=0,numPatterns=patterns.length;if(!numPatterns){callback&&callback(enlivenedPatterns);return}patterns.forEach(function(p,index){p&&p.source?new fabric.Pattern(p,function(pattern){enlivenedPatterns[index]=pattern;onLoaded()}):(enlivenedPatterns[index]=p,onLoaded())})},groupSVGElements:function(elements,options,path){var object;return elements.length===1?elements[0]:(options&&(options.width&&options.height?options.centerPoint={x:options.width/2,y:options.height/2}:(delete options.width,delete options.height)),object=new fabric.Group(elements,options),typeof path!="undefined"&&(object.sourcePath=path),object)},populateWithProperties:function(source,destination,properties){if(properties&&Object.prototype.toString.call(properties)==="[object Array]")for(var i=0,len=properties.length;i<len;i++)properties[i]in source&&(destination[properties[i]]=source[properties[i]])},drawDashedLine:function(ctx,x,y,x2,y2,da){var dx=x2-x,dy=y2-y,len=sqrt(dx*dx+dy*dy),rot=atan2(dy,dx),dc=da.length,di=0,draw=!0;for(ctx.save(),ctx.translate(x,y),ctx.moveTo(0,0),ctx.rotate(rot),x=0;len>x;)x+=da[di++%dc],x>len&&(x=len),ctx[draw?"lineTo":"moveTo"](x,0),draw=!draw;ctx.restore()},createCanvasElement:function(){return fabric.document.createElement("canvas")},createImage:function(){return fabric.document.createElement("img")},clipContext:function(receiver,ctx){ctx.save();ctx.beginPath();receiver.clipTo(ctx);ctx.clip()},multiplyTransformMatrices:function(a,b,is2x2){return[a[0]*b[0]+a[2]*b[1],a[1]*b[0]+a[3]*b[1],a[0]*b[2]+a[2]*b[3],a[1]*b[2]+a[3]*b[3],is2x2?0:a[0]*b[4]+a[2]*b[5]+a[4],is2x2?0:a[1]*b[4]+a[3]*b[5]+a[5]]},qrDecompose:function(a){var angle=atan2(a[1],a[0]),denom=pow(a[0],2)+pow(a[1],2),scaleX=sqrt(denom),scaleY=(a[0]*a[3]-a[2]*a[1])/scaleX,skewX=atan2(a[0]*a[2]+a[1]*a[3],denom);return{angle:angle/PiBy180,scaleX:scaleX,scaleY:scaleY,skewX:skewX/PiBy180,skewY:0,translateX:a[4],translateY:a[5]}},customTransformMatrix:function(scaleX,scaleY,skewX){var skewMatrixX=[1,0,abs(Math.tan(skewX*PiBy180)),1],scaleMatrix=[abs(scaleX),0,0,abs(scaleY)];return fabric.util.multiplyTransformMatrices(scaleMatrix,skewMatrixX,!0)},resetObjectTransform:function(target){target.scaleX=1;target.scaleY=1;target.skewX=0;target.skewY=0;target.flipX=!1;target.flipY=!1;target.rotate(0)},saveObjectTransform:function(target){return{scaleX:target.scaleX,scaleY:target.scaleY,skewX:target.skewX,skewY:target.skewY,angle:target.angle,left:target.left,flipX:target.flipX,flipY:target.flipY,top:target.top}},getFunctionBody:function(fn){return(String(fn).match(/function[^{]*\{([\s\S]*)\}/)||{})[1]},isTransparent:function(ctx,x,y,tolerance){tolerance>0&&(x>tolerance?x-=tolerance:x=0,y>tolerance?y-=tolerance:y=0);for(var _isTransparent=!0,temp,imageData=ctx.getImageData(x,y,tolerance*2||1,tolerance*2||1),l=imageData.data.length,i=3;i<l;i+=4)if(temp=imageData.data[i],_isTransparent=temp<=0,_isTransparent===!1)break;return imageData=null,_isTransparent},parsePreserveAspectRatioAttribute:function(attribute){var meetOrSlice="meet",alignX="Mid",alignY="Mid",aspectRatioAttrs=attribute.split(" "),align;return aspectRatioAttrs&&aspectRatioAttrs.length&&(meetOrSlice=aspectRatioAttrs.pop(),meetOrSlice!=="meet"&&meetOrSlice!=="slice"?(align=meetOrSlice,meetOrSlice="meet"):aspectRatioAttrs.length&&(align=aspectRatioAttrs.pop())),alignX=align!=="none"?align.slice(1,4):"none",alignY=align!=="none"?align.slice(5,8):"none",{meetOrSlice:meetOrSlice,alignX:alignX,alignY:alignY}},clearFabricFontCache:function(fontFamily){fontFamily=(fontFamily||"").toLowerCase();fontFamily?fabric.charWidthsCache[fontFamily]&&delete fabric.charWidthsCache[fontFamily]:fabric.charWidthsCache={}},limitDimsByArea:function(ar,maximumArea){var roughWidth=Math.sqrt(maximumArea*ar),perfLimitSizeY=Math.floor(maximumArea/roughWidth);return{x:Math.floor(roughWidth),y:perfLimitSizeY}},capValue:function(min,value,max){return Math.max(min,Math.min(value,max))},findScaleToFit:function(source,destination){return Math.min(destination.width/source.width,destination.height/source.height)},findScaleToCover:function(source,destination){return Math.max(destination.width/source.width,destination.height/source.height)}}}(typeof exports!="undefined"?exports:this),function(){function arcToSegments(toX,toY,rx,ry,large,sweep,rotateX){var argsString=_join.call(arguments),s,i;if(fabric.arcToSegmentsCache[argsString])return fabric.arcToSegmentsCache[argsString];var PI=Math.PI,th=rotateX*PI/180,sinTh=fabric.util.sin(th),cosTh=fabric.util.cos(th),fromX=0,fromY=0;rx=Math.abs(rx);ry=Math.abs(ry);var px=-cosTh*toX*.5-sinTh*toY*.5,py=-cosTh*toY*.5+sinTh*toX*.5,rx2=rx*rx,ry2=ry*ry,py2=py*py,px2=px*px,pl=rx2*ry2-rx2*py2-ry2*px2,root=0;pl<0?(s=Math.sqrt(1-pl/(rx2*ry2)),rx*=s,ry*=s):root=(large===sweep?-1:1)*Math.sqrt(pl/(rx2*py2+ry2*px2));var cx=root*rx*py/ry,cy=-root*ry*px/rx,cx1=cosTh*cx-sinTh*cy+toX*.5,cy1=sinTh*cx+cosTh*cy+toY*.5,mTheta=calcVectorAngle(1,0,(px-cx)/rx,(py-cy)/ry),dtheta=calcVectorAngle((px-cx)/rx,(py-cy)/ry,(-px-cx)/rx,(-py-cy)/ry);sweep===0&&dtheta>0?dtheta-=2*PI:sweep===1&&dtheta<0&&(dtheta+=2*PI);var segments=Math.ceil(Math.abs(dtheta/PI*2)),result=[],mDelta=dtheta/segments,mT=8/3*Math.sin(mDelta/4)*Math.sin(mDelta/4)/Math.sin(mDelta/2),th3=mTheta+mDelta;for(i=0;i<segments;i++)result[i]=segmentToBezier(mTheta,th3,cosTh,sinTh,rx,ry,cx1,cy1,mT,fromX,fromY),fromX=result[i][4],fromY=result[i][5],mTheta=th3,th3+=mDelta;return fabric.arcToSegmentsCache[argsString]=result,result}function segmentToBezier(th2,th3,cosTh,sinTh,rx,ry,cx1,cy1,mT,fromX,fromY){var costh2=fabric.util.cos(th2),sinth2=fabric.util.sin(th2),costh3=fabric.util.cos(th3),sinth3=fabric.util.sin(th3),toX=cosTh*rx*costh3-sinTh*ry*sinth3+cx1,toY=sinTh*rx*costh3+cosTh*ry*sinth3+cy1,cp1X=fromX+mT*(-cosTh*rx*sinth2-sinTh*ry*costh2),cp1Y=fromY+mT*(-sinTh*rx*sinth2+cosTh*ry*costh2),cp2X=toX+mT*(cosTh*rx*sinth3+sinTh*ry*costh3),cp2Y=toY+mT*(sinTh*rx*sinth3-cosTh*ry*costh3);return[cp1X,cp1Y,cp2X,cp2Y,toX,toY]}
14function calcVectorAngle(ux,uy,vx,vy){var ta=Math.atan2(uy,ux),tb=Math.atan2(vy,vx);return tb>=ta?tb-ta:2*Math.PI-(ta-tb)}function getBoundsOfCurve(x0,y0,x1,y1,x2,y2,x3,y3){var argsString,i,x,y,j,jlen,mt,result;if(fabric.cachesBoundsOfCurve&&(argsString=_join.call(arguments),fabric.boundsOfCurveCache[argsString]))return fabric.boundsOfCurveCache[argsString];var sqrt=Math.sqrt,min=Math.min,max=Math.max,abs=Math.abs,tvalues=[],bounds=[[],[]],a,b,c,t,t1,t2,b2ac,sqrtb2ac;for(b=6*x0-12*x1+6*x2,a=-3*x0+9*x1-9*x2+3*x3,c=3*x1-3*x0,i=0;i<2;++i){if(i>0&&(b=6*y0-12*y1+6*y2,a=-3*y0+9*y1-9*y2+3*y3,c=3*y1-3*y0),abs(a)<1e-12){if(abs(b)<1e-12)continue;t=-c/b;0<t&&t<1&&tvalues.push(t);continue}(b2ac=b*b-4*c*a,b2ac<0)||(sqrtb2ac=sqrt(b2ac),t1=(-b+sqrtb2ac)/(2*a),0<t1&&t1<1&&tvalues.push(t1),t2=(-b-sqrtb2ac)/(2*a),0<t2&&t2<1&&tvalues.push(t2))}for(j=tvalues.length,jlen=j;j--;)t=tvalues[j],mt=1-t,x=mt*mt*mt*x0+3*mt*mt*t*x1+3*mt*t*t*x2+t*t*t*x3,bounds[0][j]=x,y=mt*mt*mt*y0+3*mt*mt*t*y1+3*mt*t*t*y2+t*t*t*y3,bounds[1][j]=y;return bounds[0][jlen]=x0,bounds[1][jlen]=y0,bounds[0][jlen+1]=x3,bounds[1][jlen+1]=y3,result=[{x:min.apply(null,bounds[0]),y:min.apply(null,bounds[1])},{x:max.apply(null,bounds[0]),y:max.apply(null,bounds[1])}],fabric.cachesBoundsOfCurve&&(fabric.boundsOfCurveCache[argsString]=result),result}var _join=Array.prototype.join;fabric.util.drawArc=function(ctx,fx,fy,coords){for(var rx=coords[0],ry=coords[1],rot=coords[2],large=coords[3],sweep=coords[4],tx=coords[5],ty=coords[6],segs=[[],[],[],[]],segsNorm=arcToSegments(tx-fx,ty-fy,rx,ry,large,sweep,rot),i=0,len=segsNorm.length;i<len;i++)segs[i][0]=segsNorm[i][0]+fx,segs[i][1]=segsNorm[i][1]+fy,segs[i][2]=segsNorm[i][2]+fx,segs[i][3]=segsNorm[i][3]+fy,segs[i][4]=segsNorm[i][4]+fx,segs[i][5]=segsNorm[i][5]+fy,ctx.bezierCurveTo.apply(ctx,segs[i])};fabric.util.getBoundsOfArc=function(fx,fy,rx,ry,rot,large,sweep,tx,ty){for(var fromX=0,fromY=0,bound,bounds=[],segs=arcToSegments(tx-fx,ty-fy,rx,ry,large,sweep,rot),i=0,len=segs.length;i<len;i++)bound=getBoundsOfCurve(fromX,fromY,segs[i][0],segs[i][1],segs[i][2],segs[i][3],segs[i][4],segs[i][5]),bounds.push({x:bound[0].x+fx,y:bound[0].y+fy}),bounds.push({x:bound[1].x+fx,y:bound[1].y+fy}),fromX=segs[i][4],fromY=segs[i][5];return bounds};fabric.util.getBoundsOfCurve=getBoundsOfCurve}(),function(){function invoke(array,method){for(var args=slice.call(arguments,2),result=[],i=0,len=array.length;i<len;i++)result[i]=args.length?array[i][method].apply(array[i],args):array[i][method].call(array[i]);return result}function max(array,byProperty){return find(array,byProperty,function(value1,value2){return value1>=value2})}function min(array,byProperty){return find(array,byProperty,function(value1,value2){return value1<value2})}function fill(array,value){for(var k=array.length;k--;)array[k]=value;return array}function find(array,byProperty,condition){if(array&&array.length!==0){var i=array.length-1,result=byProperty?array[i][byProperty]:array[i];if(byProperty)while(i--)condition(array[i][byProperty],result)&&(result=array[i][byProperty]);else while(i--)condition(array[i],result)&&(result=array[i]);return result}}var slice=Array.prototype.slice;fabric.util.array={fill:fill,invoke:invoke,min:min,max:max}}(),function(){function extend(destination,source,deep){var i,len,property;if(deep)if(!fabric.isLikelyNode&&source instanceof Element)destination=source;else if(source instanceof Array)for(destination=[],i=0,len=source.length;i<len;i++)destination[i]=extend({},source[i],deep);else if(source&&typeof source=="object")for(property in source)source.hasOwnProperty(property)&&(destination[property]=extend({},source[property],deep));else destination=source;else for(property in source)destination[property]=source[property];return destination}function clone(object,deep){return extend({},object,deep)}fabric.util.object={extend:extend,clone:clone};fabric.util.object.extend(fabric.util,fabric.Observable)}(),function(){function camelize(string){return string.replace(/-+(.)?/g,function(match,character){return character?character.toUpperCase():""})}function capitalize(string,firstLetterOnly){return string.charAt(0).toUpperCase()+(firstLetterOnly?string.slice(1):string.slice(1).toLowerCase())}function escapeXml(string){return string.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function graphemeSplit(textstring){var i=0,chr,graphemes=[];
14for(i=0,chr;i<textstring.length;i++)(chr=getWholeChar(textstring,i))!==!1&&graphemes.push(chr);return graphemes}function getWholeChar(str,i){var code=str.charCodeAt(i),next,prev;if(isNaN(code))return"";if(code<55296||code>57343)return str.charAt(i);if(55296<=code&&code<=56319){if(str.length<=i+1)throw"High surrogate without following low surrogate";if(next=str.charCodeAt(i+1),56320>next||next>57343)throw"High surrogate without following low surrogate";return str.charAt(i)+str.charAt(i+1)}if(i===0)throw"Low surrogate without preceding high surrogate";if(prev=str.charCodeAt(i-1),55296>prev||prev>56319)throw"Low surrogate without preceding high surrogate";return!1}fabric.util.string={camelize:camelize,capitalize:capitalize,escapeXml:escapeXml,graphemeSplit:graphemeSplit}}(),function(){function Subclass(){}function callSuper(methodName){for(var parentMethod=null,_this=this,superClassMethod;_this.constructor.superclass;){if(superClassMethod=_this.constructor.superclass.prototype[methodName],_this[methodName]!==superClassMethod){parentMethod=superClassMethod;break}_this=_this.constructor.superclass.prototype}return parentMethod?arguments.length>1?parentMethod.apply(this,slice.call(arguments,1)):parentMethod.call(this):console.log("tried to callSuper "+methodName+", method not found in prototype chain",this)}function createClass(){function klass(){this.initialize.apply(this,arguments)}var parent=null,properties=slice.call(arguments,0),i,length;for(typeof properties[0]=="function"&&(parent=properties.shift()),klass.superclass=parent,klass.subclasses=[],parent&&(Subclass.prototype=parent.prototype,klass.prototype=new Subclass,parent.subclasses.push(klass)),i=0,length=properties.length;i<length;i++)addMethods(klass,properties[i],parent);return klass.prototype.initialize||(klass.prototype.initialize=emptyFunction),klass.prototype.constructor=klass,klass.prototype.callSuper=callSuper,klass}var slice=Array.prototype.slice,emptyFunction=function(){},IS_DONTENUM_BUGGY=function(){for(var p in{toString:1})if(p==="toString")return!1;return!0}(),addMethods=function(klass,source,parent){for(var property in source)klass.prototype[property]=property in klass.prototype&&typeof klass.prototype[property]=="function"&&(source[property]+"").indexOf("callSuper")>-1?function(property){return function(){var superclass=this.constructor.superclass,returnValue;return this.constructor.superclass=parent,returnValue=source[property].apply(this,arguments),this.constructor.superclass=superclass,property!=="initialize"?returnValue:void 0}}(property):source[property],IS_DONTENUM_BUGGY&&(source.toString!==Object.prototype.toString&&(klass.prototype.toString=source.toString),source.valueOf!==Object.prototype.valueOf&&(klass.prototype.valueOf=source.valueOf))};fabric.util.createClass=createClass}(),function(){function areHostMethods(object){for(var methodNames=Array.prototype.slice.call(arguments,1),t,len=methodNames.length,i=0;i<len;i++)if(t=typeof object[methodNames[i]],!/^(?:function|object|unknown)$/.test(t))return!1;return!0}function createListener(uid,handler){return{handler:handler,wrappedHandler:createWrappedHandler(uid,handler)}}function createWrappedHandler(uid,handler){return function(e){handler.call(getElement(uid),e||fabric.window.event)}}function createDispatcher(uid,eventName){return function(e){var handlersForEvent,i,len;if(handlers[uid]&&handlers[uid][eventName])for(handlersForEvent=handlers[uid][eventName],i=0,len=handlersForEvent.length;i<len;i++)handlersForEvent[i].call(this,e||fabric.window.event)}}function getPointer(event){event||(event=fabric.window.event);var element=event.target||(typeof event.srcElement!==unknown?event.srcElement:null),scroll=fabric.util.getScrollLeftTop(element);return{x:pointerX(event)+scroll.left,y:pointerY(event)+scroll.top}}function _getPointer(event,pageProp,clientProp){var touchProp=event.type==="touchend"?"changedTouches":"touches",pointer,eventTouchProp=event[touchProp];return eventTouchProp&&eventTouchProp[0]&&(pointer=eventTouchProp[0][clientProp]),typeof pointer=="undefined"&&(pointer=event[clientProp]),pointer}var unknown="unknown",getElement,setElement,getUniqueId=function(){var uid=0;return function(element){return element.__uniqueID||(element.__uniqueID="uniqueID__"+uid++)}}(),pointerX,pointerY;(function(){var elements={};getElement=function(uid){return elements[uid]};setElement=function(uid,element){elements[uid]=element}})();var shouldUseAddListenerRemoveListener=areHostMethods(fabric.document.documentElement,"addEventListener","removeEventListener")&&areHostMethods(fabric.window,"addEventListener","removeEventListener"),shouldUseAttachEventDetachEvent=areHostMethods(fabric.document.documentElement,"attachEvent","detachEvent")&&areHostMethods(fabric.window,"attachEvent","detachEvent"),listeners={},handlers={},addListener,removeListener;shouldUseAddListenerRemoveListener?(addListener=function(element,eventName,handler,options){element&&element.addEventListener(eventName,handler,shouldUseAttachEventDetachEvent?!1:options)},removeListener=function(element,eventName,handler,options){element&&element.removeEventListener(eventName,handler,shouldUseAttachEventDetachEvent?!1:options)}):shouldUseAttachEventDetachEvent?(addListener=function(element,eventName,handler){var uid,listener;element&&(uid=getUniqueId(element),setElement(uid,element),listeners[uid]||(listeners[uid]={}),listeners[uid][eventName]||(listeners[uid][eventName]=[]),listener=createListener(uid,handler),listeners[uid][eventName].push(listener),element.attachEvent("on"+eventName,listener.wrappedHandler))},removeListener=function(element,eventName,handler){var uid,listener,i,len;if(element&&(uid=getUniqueId(element),listeners[uid]&&listeners[uid][eventName]))for(i=0,len=listeners[uid][eventName].length;i<len;i++)listener=listeners[uid][eventName][i],listener&&listener.handler===handler&&(element.detachEvent("on"+eventName,listener.wrappedHandler),listeners[uid][eventName][i]=null)}):(addListener=function(element,eventName,handler){var uid,existingHandler;element&&(uid=getUniqueId(element),handlers[uid]||(handlers[uid]={}),handlers[uid][eventName]||(handlers[uid][eventName]=[],existingHandler=element["on"+eventName],existingHandler&&handlers[uid][eventName].push(existingHandler),element["on"+eventName]=createDispatcher(uid,eventName)),handlers[uid][eventName].push(handler))},removeListener=function(element,eventName,handler){var uid,handlersForEvent,i,len;if(element&&(uid=getUniqueId(element),handlers[uid]&&handlers[uid][eventName]))for(handlersForEvent=handlers[uid][eventName],i=0,len=handlersForEvent.length;i<len;i++)handlersForEvent[i]===handler&&handlersForEvent.splice(i,1)});fabric.util.addListener=addListener;fabric.util.removeListener=removeListener;pointerX=function(event){return event.clientX};pointerY=function(event){return event.clientY};fabric.isTouchSupported&&(pointerX=function(event){return _getPointer(event,"pageX","clientX")},pointerY=function(event){return _getPointer(event,"pageY","clientY")});fabric.util.getPointer=getPointer}(),function(){function setStyle(element,styles){var elementStyle=element.style,property,normalizedProperty;if(!elementStyle)return element;if(typeof styles=="string")return element.style.cssText+=";"+styles,styles.indexOf("opacity")>-1?setOpacity(element,styles.match(/opacity:\s*(\d?\.?\d*)/)[1]):element;for(property in styles)property==="opacity"?setOpacity(element,styles[property]):(normalizedProperty=property==="float"||property==="cssFloat"?typeof elementStyle.styleFloat=="undefined"?"cssFloat":"styleFloat":property,elementStyle[normalizedProperty]=styles[property]);return element}var parseEl=fabric.document.createElement("div"),supportsOpacity=typeof parseEl.style.opacity=="string",supportsFilters=typeof parseEl.style.filter=="string",reOpacity=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,setOpacity=function(element){return element};supportsOpacity?setOpacity=function(element,value){return element.style.opacity=value,element}
14:supportsFilters&&(setOpacity=function(element,value){var es=element.style;return element.currentStyle&&!element.currentStyle.hasLayout&&(es.zoom=1),reOpacity.test(es.filter)?(value=value>=.9999?"":"alpha(opacity="+value*100+")",es.filter=es.filter.replace(reOpacity,value)):es.filter+=" alpha(opacity="+value*100+")",element});fabric.util.setStyle=setStyle}(),function(){function getById(id){return typeof id=="string"?fabric.document.getElementById(id):id}function makeElement(tagName,attributes){var el=fabric.document.createElement(tagName);for(var prop in attributes)prop==="class"?el.className=attributes[prop]:prop==="for"?el.htmlFor=attributes[prop]:el.setAttribute(prop,attributes[prop]);return el}function addClass(element,className){element&&(" "+element.className+" ").indexOf(" "+className+" ")===-1&&(element.className+=(element.className?" ":"")+className)}function wrapElement(element,wrapper,attributes){return typeof wrapper=="string"&&(wrapper=makeElement(wrapper,attributes)),element.parentNode&&element.parentNode.replaceChild(wrapper,element),wrapper.appendChild(element),wrapper}function getScrollLeftTop(element){for(var left=0,top=0,docElement=fabric.document.documentElement,body=fabric.document.body||{scrollLeft:0,scrollTop:0};element&&(element.parentNode||element.host);)if(element=element.parentNode||element.host,element===fabric.document?(left=body.scrollLeft||docElement.scrollLeft||0,top=body.scrollTop||docElement.scrollTop||0):(left+=element.scrollLeft||0,top+=element.scrollTop||0),element.nodeType===1&&element.style.position==="fixed")break;return{left:left,top:top}}function getElementOffset(element){var docElem,doc=element&&element.ownerDocument,box={left:0,top:0},offset={left:0,top:0},scrollLeftTop,offsetAttributes={borderLeftWidth:"left",borderTopWidth:"top",paddingLeft:"left",paddingTop:"top"},attr;if(!doc)return offset;for(attr in offsetAttributes)offset[offsetAttributes[attr]]+=parseInt(getElementStyle(element,attr),10)||0;return docElem=doc.documentElement,typeof element.getBoundingClientRect!="undefined"&&(box=element.getBoundingClientRect()),scrollLeftTop=getScrollLeftTop(element),{left:box.left+scrollLeftTop.left-(docElem.clientLeft||0)+offset.left,top:box.top+scrollLeftTop.top-(docElem.clientTop||0)+offset.top}}function getNodeCanvas(element){var impl=fabric.jsdomImplForWrapper(element);return impl._canvas||impl._image}function cleanUpJsdomNode(element){if(fabric.isLikelyNode){var impl=fabric.jsdomImplForWrapper(element);impl&&(impl._image=null,impl._canvas=null,impl._currentSrc=null,impl._attributes=null,impl._classList=null)}}var _slice=Array.prototype.slice,sliceCanConvertNodelists,toArray=function(arrayLike){return _slice.call(arrayLike,0)},getElementStyle;try{sliceCanConvertNodelists=toArray(fabric.document.childNodes)instanceof Array}catch(err){}sliceCanConvertNodelists||(toArray=function(arrayLike){for(var arr=new Array(arrayLike.length),i=arrayLike.length;i--;)arr[i]=arrayLike[i];return arr});getElementStyle=fabric.document.defaultView&&fabric.document.defaultView.getComputedStyle?function(element,attr){var style=fabric.document.defaultView.getComputedStyle(element,null);return style?style[attr]:undefined}:function(element,attr){var value=element.style[attr];return!value&&element.currentStyle&&(value=element.currentStyle[attr]),value},function(){function makeElementUnselectable(element){return typeof element.onselectstart!="undefined"&&(element.onselectstart=fabric.util.falseFunction),selectProp?element.style[selectProp]="none":typeof element.unselectable=="string"&&(element.unselectable="on"),element}function makeElementSelectable(element){return typeof element.onselectstart!="undefined"&&(element.onselectstart=null),selectProp?element.style[selectProp]="":typeof element.unselectable=="string"&&(element.unselectable=""),element}var style=fabric.document.documentElement.style,selectProp="userSelect"in style?"userSelect":"MozUserSelect"in style?"MozUserSelect":"WebkitUserSelect"in style?"WebkitUserSelect":"KhtmlUserSelect"in style?"KhtmlUserSelect":"";fabric.util.makeElementUnselectable=makeElementUnselectable;fabric.util.makeElementSelectable=makeElementSelectable}(),function(){function getScript(url,callback){var headEl=fabric.document.getElementsByTagName("head")[0],scriptEl=fabric.document.createElement("script"),loading=!0;scriptEl.onload=scriptEl.onreadystatechange=function(e){if(loading){if(typeof this.readyState=="string"&&this.readyState!=="loaded"&&this.readyState!=="complete")return;loading=!1;callback(e||fabric.window.event);scriptEl=scriptEl.onload=scriptEl.onreadystatechange=null}};scriptEl.src=url;headEl.appendChild(scriptEl)}fabric.util.getScript=getScript}();fabric.util.getById=getById;fabric.util.toArray=toArray;fabric.util.makeElement=makeElement;fabric.util.addClass=addClass;fabric.util.wrapElement=wrapElement;fabric.util.getScrollLeftTop=getScrollLeftTop;fabric.util.getElementOffset=getElementOffset;fabric.util.getElementStyle=getElementStyle;fabric.util.getNodeCanvas=getNodeCanvas;fabric.util.cleanUpJsdomNode=cleanUpJsdomNode}(),function(){function addParamToUrl(url,param){return url+(/\?/.test(url)?"&":"?")+p
14aram}function emptyFn(){}function request(url,options){options||(options={});var method=options.method?options.method.toUpperCase():"GET",onComplete=options.onComplete||function(){},xhr=makeXHR(),body=options.body||options.parameters;return xhr.onreadystatechange=function(){xhr.readyState===4&&(onComplete(xhr),xhr.onreadystatechange=emptyFn)},method==="GET"&&(body=null,typeof options.parameters=="string"&&(url=addParamToUrl(url,options.parameters))),xhr.open(method,url,!0),(method==="POST"||method==="PUT")&&xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),xhr.send(body),xhr}var makeXHR=function(){for(var req,factories=[function(){return new fabric.window.XMLHttpRequest},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Msxml2.XMLHTTP.3.0")}],i=factories.length;i--;)try{if(req=factories[i](),req)return factories[i]}catch(err){}}();fabric.util.request=request}();fabric.log=function(){};fabric.warn=function(){};typeof console!="undefined"&&["log","warn"].forEach(function(methodName){typeof console[methodName]!="undefined"&&typeof console[methodName].apply=="function"&&(fabric[methodName]=function(){return console[methodName].apply(console,arguments)})}),function(){function noop(){return!1}function animate(options){requestAnimFrame(function(timestamp){options||(options={});var start=timestamp||+new Date,duration=options.duration||500,finish=start+duration,time,onChange=options.onChange||noop,abort=options.abort||noop,onComplete=options.onComplete||noop,easing=options.easing||function(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b},startValue="startValue"in options?options.startValue:0,endValue="endValue"in options?options.endValue:100,byValue=options.byValue||endValue-startValue;options.onStart&&options.onStart(),function tick(ticktime){if(abort()){onComplete(endValue,1,1);return}time=ticktime||+new Date;var currentTime=time>finish?duration:time-start,timePerc=currentTime/duration,current=easing(currentTime,startValue,byValue,duration),valuePerc=Math.abs((current-startValue)/byValue);if(onChange(current,valuePerc,timePerc),time>finish){options.onComplete&&options.onComplete();return}requestAnimFrame(tick)}(start)})}function requestAnimFrame(){return _requestAnimFrame.apply(fabric.window,arguments)}function cancelAnimFrame(){return _cancelAnimFrame.apply(fabric.window,arguments)}var _requestAnimFrame=fabric.window.requestAnimationFrame||fabric.window.webkitRequestAnimationFrame||fabric.window.mozRequestAnimationFrame||fabric.window.oRequestAnimationFrame||fabric.window.msRequestAnimationFrame||function(callback){return fabric.window.setTimeout(callback,1e3/60)},_cancelAnimFrame=fabric.window.cancelAnimationFrame||fabric.window.clearTimeout;fabric.util.animate=animate;fabric.util.requestAnimFrame=requestAnimFrame;fabric.util.cancelAnimFrame=cancelAnimFrame}(),function(){function calculateColor(begin,end,pos){var color="rgba("+parseInt(begin[0]+pos*(end[0]-begin[0]),10)+","+parseInt(begin[1]+pos*(end[1]-begin[1]),10)+","+parseInt(begin[2]+pos*(end[2]-begin[2]),10);return color+=","+(begin&&end?parseFloat(begin[3]+pos*(end[3]-begin[3])):1),color+")"}function animateColor(fromColor,toColor,duration,options){var startColor=new fabric.Color(fromColor).getSource(),endColor=new fabric.Color(toColor).getSource();options=options||{};fabric.util.animate(fabric.util.object.extend(options,{duration:duration||500,startValue:startColor,endValue:endColor,byValue:endColor,easing:function(currentTime,startValue,byValue,duration){var posValue=options.colorEasing?options.colorEasing(currentTime,duration):1-Math.cos(currentTime/duration*(Math.PI/2));return calculateColor(startValue,byValue,posValue)}}))}fabric.util.animateColor=animateColor}(),function(){function normalize(a,c,p,s){return a<Math.abs(c)?(a=c,s=p/4):s=c===0&&a===0?p/(2*Math.PI)*Math.asin(1):p/(2*Math.PI)*Math.asin(c/a),{a:a,c:c,p:p,s:s}}function elastic(opts,t,d){return opts.a*Math.pow(2,10*(t-=1))*Math.sin((t*d-opts.s)*2*Math.PI/opts.p)}function easeOutCubic(t,b,c,d){return c*((t=t/d-1)*t*t+1)+b}function easeInOutCubic(t,b,c,d){return(t/=d/2,t<1)?c/2*t*t*t+b:c/2*((t-=2)*t*t+2)+b}function easeInQuart(t,b,c,d){return c*(t/=d)*t*t*t+b}function easeOutQuart(t,b,c,d){return-c*((t=t/d-1)*t*t*t-1)+b}function easeInOutQuart(t,b,c,d){return(t/=d/2,t<1)?c/2*t*t*t*t+b:-c/2*((t-=2)*t*t*t-2)+b}function easeInQuint(t,b,c,d){return c*(t/=d)*t*t*t*t+b}function easeOutQuint(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b}function easeInOutQuint(t,b,c,d){return(t/=d/2,t<1)?c/2*t*t*t*t*t+b:c/2*((t-=2)*t*t*t*t+2)+b}function easeInSine(t,b,c,d){return-c*Math.cos(t/d*(Math.PI/2))+c+b}function easeOutSine(t,b,c,d){return c*Math.sin(t/d*(Math.PI/2))+b}function easeInOutSine(t,b,c,d){return-c/2*(Math.cos(Math.PI*t/d)-1)+b}function easeInExpo(t,b,c,d){return t===0?b:c*Math.pow(2,10*(t/d-1))+b}function easeOutExpo(t,b,c,d){return t===d?b+c:c*(-Math.pow(2,-10*t/d)+1)+b}function easeInOutExpo(t,b,c,d){return t===0?b:t===d?b+c:(t/=d/2,t<1)?c/2*Math.pow(2,10*(t-1))+b:c/2*(-Math.pow(2,-10*--t)+2)+b}function easeInCirc(t,b,c,d){return-c*(Math.sqrt(1-(t/=d)*t)-1)+b}function easeOutCirc(t,b,c,d){return c*Math.sqrt(1-(t=t/d-1)*t)+b}function easeInOutCirc(t,b,c,d){return(t/=d/2,t<1)?-c/2*(Math.sqrt(1-t*t)-1)+b:c/2*(Math.sqrt(1-(t-=2)*t)+1)+b}function easeInElastic(t,b,c,d){var p=0,a=c,opts;return t===0?b:(t/=d,t===1)?b+c:(p||(p=d*.3),opts=normalize(a,c,p,1.70158),-elastic(opts,t,d)+b)}function easeOutElastic(t,b,c,d){var p=0,a=c,opts;return t===0?b:(t/=d,t===1)?b+c:(p||(p=d*.3),opts=normalize(a,c,p,1.70158),opts.a*Math.pow(2,-10*t)*Math.sin((t*d-opts.s)*2*Math.PI/opts.p)+opts.c+b)}function easeInOutElastic(t,b,c,d){var p=0,a=c,opts;return t===0?b:(t/=d/2,t===2)?b+c:(p||(p=d*.3*1.5),opts=normalize(a,c,p,1.70158),t<1)?-.5*elastic(opts,t,d)+b:opts.a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-opts.s)*2*Math.PI/opts.p)*.5+opts.c+b}function easeInBack(t,b,c,d,s){return s===undefined&&(s=1.70158),c*(t/=d)*t*((s+1)*t-s)+b}function easeOutBack(t,b,c,d,s){return s===undefined&&(s=1.70158),c*((t=t/d-1)*t*((s+1)*t+s)+1)+b}function easeInOutBack(t,b,c,d,s){return(s===undefined&&(s=1.70158),t/=d/2,t<1)?c/2*t*t*(((s*=1.525)+1)*t-s)+b:c/2*((t-=2)*t*(((s*=1.525)+1)*t+s)+2)+b}function easeInBounce(t,b,c,d){return c-easeOutBounce(d-t,0,c,d)+b}function easeOutBounce(t,b,c,d){return(t/=d)<1/2.75?c*7.5625*t*t+b:t<2/2.75?c*(7.5625*(t-=1.5/2.75)*t+.75)+b:t<2.5/2.75?c*(7.5625*(t-=2.25/2.75)*t+.9375)+b:c*(7.5625*(t-=2.625/2.75)*t+.984375)+b}function easeInOutBounce(t,b,c,d){return t<d/2?easeInBounce(t*2,0,c,d)*.5+b:easeOutBounce(t*2-d,0,c,d)*.5+c*.5+b}fabric.util.ease={easeInQuad:function(t,b,c,d){return c*(t/=d)*t+b},easeOutQuad:function(t,b,c,d){return-c*(t/=d)*(t-2)+b},easeInOutQuad:function(t,b,c,d){return(t/=d/2,t<1)?c/2*t*t+b:-c/2*(--t*(t-2)-1)+b},easeInCubic:function(t,b,c,d){return c*(t/=d)*t*t+b},easeOutCubic:easeOutCubic,easeInOutCubic:easeInOutCubic,easeInQuart:easeInQuart,easeOutQuart:easeOutQuart,easeInOutQuart:easeInOutQuart,easeInQuint:easeInQuint,easeOutQuint:easeOutQuint,easeInOutQuint:easeInOutQuint,easeInSine:easeInSine,easeOutSine:easeOutSine,easeInOutSine:easeInOutSine,easeInExpo:easeInExpo,easeOutExpo:easeOutExpo,easeInOutExpo:easeInOutExpo,easeInCirc:easeInCirc,easeOutCirc:easeOutCirc,easeInOutCirc:easeInOutCirc,easeInElastic:easeInElastic,easeOutElastic:easeOutElastic,easeInOutElastic:easeInOutElastic,easeInBack:easeInBack,easeOutBack:easeOutBack,easeInOutBack:easeInOutBack,easeInBounce:easeInBounce,easeOutBounce:easeOutBounce,easeInOutBounce:easeInOutBounce}}(),function(global){"use strict";function normalizeAttr(attr){return attr in attributesMap?attributesMap[attr]:attr}function normalizeValue(attr,value,parentAttributes,fontSize){var isArray=Object.prototype.toString.call(value)==="[object Array]",parsed;if((attr==="fill"||attr==="stroke")&&value==="none")value="";else if(attr==="strokeDashArray")value=value==="none"?null:value.replace(/,/g," ").split(/\s+/).map(function(n){return parseFloat(n)});else if(attr==="transformMatrix")value=parentAttributes&&parentAttributes.transformMatrix?multiplyTransformMatrices(parentAttributes.transformMatrix,fabric.parseTransformAttribute(value)):fabric.parseTransformAttribute(value);else if(attr==="visible")value=value!=="none"&&value!=="hidden",parentAttributes&&parentAttributes.visible===!1&&(value=!1);else if(attr==="opacity")value=parseFloat(value),parentAttributes&&typeof parentAttributes.opacity!="undefined"&&(value*=parentAttributes.opacity);
14else if(attr==="textAnchor")value=value==="start"?"left":value==="end"?"right":"center";else if(attr==="charSpacing")parsed=parseUnit(value,fontSize)/fontSize*1e3;else if(attr==="paintFirst"){var fillIndex=value.indexOf("fill"),strokeIndex=value.indexOf("stroke"),value="fill";fillIndex>-1&&strokeIndex>-1&&strokeIndex<fillIndex?value="stroke":fillIndex===-1&&strokeIndex>-1&&(value="stroke")}else parsed=isArray?value.map(parseUnit):parseUnit(value,fontSize);return!isArray&&isNaN(parsed)?value:parsed}function getSvgRegex(arr){return new RegExp("^("+arr.join("|")+")\\b","i")}function _setStrokeFillOpacity(attributes){var attr,color;for(attr in colorAttributes)if(typeof attributes[colorAttributes[attr]]!="undefined"&&attributes[attr]!==""){if(typeof attributes[attr]=="undefined"){if(!fabric.Object.prototype[attr])continue;attributes[attr]=fabric.Object.prototype[attr]}attributes[attr].indexOf("url(")!==0&&(color=new fabric.Color(attributes[attr]),attributes[attr]=color.setAlpha(toFixed(color.getAlpha()*attributes[colorAttributes[attr]],2)).toRgba())}return attributes}function _getMultipleNodes(doc,nodeNames){for(var nodeName,nodeArray=[],nodeList,i=0,len=nodeNames.length;i<len;i++)nodeName=nodeNames[i],nodeList=doc.getElementsByTagName(nodeName),nodeArray=nodeArray.concat(Array.prototype.slice.call(nodeList));return nodeArray}function parseStyleString(style,oStyle){var attr,value;style.replace(/;\s*$/,"").split(";").forEach(function(chunk){var pair=chunk.split(":");attr=pair[0].trim().toLowerCase();value=pair[1].trim();oStyle[attr]=value})}function parseStyleObject(style,oStyle){var attr,value;for(var prop in style)typeof style[prop]!="undefined"&&(attr=prop.toLowerCase(),value=style[prop],oStyle[attr]=value)}function getGlobalStylesForElement(element,svgUid){var styles={},rule,property;for(rule in fabric.cssRules[svgUid])if(elementMatchesRule(element,rule.split(" ")))for(property in fabric.cssRules[svgUid][rule])styles[property]=fabric.cssRules[svgUid][rule][property];return styles}function elementMatchesRule(element,selectors){var firstMatching,parentMatching=!0;return firstMatching=selectorMatches(element,selectors.pop()),firstMatching&&selectors.length&&(parentMatching=doesSomeParentMatch(element,selectors)),firstMatching&&parentMatching&&selectors.length===0}function doesSomeParentMatch(element,selectors){for(var selector,parentMatching=!0;element.parentNode&&element.parentNode.nodeType===1&&selectors.length;)parentMatching&&(selector=selectors.pop()),element=element.parentNode,parentMatching=selectorMatches(element,selector);return selectors.length===0}function selectorMatches(element,selector){var nodeName=element.nodeName,classNames=element.getAttribute("class"),id=element.getAttribute("id"),matcher,i;if(matcher=new RegExp("^"+nodeName,"i"),selector=selector.replace(matcher,""),id&&selector.length&&(matcher=new RegExp("#"+id+"(?![a-zA-Z\\-]+)","i"),selector=selector.replace(matcher,"")),classNames&&selector.length)for(classNames=classNames.split(" "),i=classNames.length;i--;)matcher=new RegExp("\\."+classNames[i]+"(?![a-zA-Z\\-]+)","i"),selector=selector.replace(matcher,"");return selector.length===0}function elementById(doc,id){var el,node,i,len,nodelist;if(doc.getElementById&&(el=doc.getElementById(id)),el)return el;for(nodelist=doc.getElementsByTagName("*"),i=0,len=nodelist.length;i<len;i++)if(node=nodelist[i],id===node.getAttribute("id"))return node}function parseUseDirectives(doc){for(var nodelist=_getMultipleNodes(doc,["use","svg:use"]),i=0,el3;nodelist.length&&i<nodelist.length;){var el=nodelist[i],xlink=(el.getAttribute("xlink:href")||el.getAttribute("href")).substr(1),x=el.getAttribute("x")||0,y=el.getAttribute("y")||0,el2=elementById(doc,xlink).cloneNode(!0),currentTrans=(el2.getAttribute("transform")||"")+" translate("+x+", "+y+")",parentNode,oldLength=nodelist.length,attr,j,attrs,len;if(applyViewboxTransform(el2),/^svg$/i.test(el2.nodeName)){for(el3=el2.ownerDocument.createElement("g"),j=0,attrs=el2.attributes,len=attrs.length;j<len;j++)attr=attrs.item(j),el3.setAttribute(attr.nodeName,attr.nodeValue);while(el2.firstChild)el3.appendChild(el2.firstChild);el2=el3}for(j=0,attrs=el.attributes,len=attrs.length;j<len;j++)(attr=attrs.item(j),attr.nodeName!=="x"&&attr.nodeName!=="y"&&attr.nodeName!=="xlink:href"&&attr.nodeName!=="href")&&(attr.nodeName==="transform"?currentTrans=attr.nodeValue+" "+currentTrans:el2.setAttribute(attr.nodeName,attr.nodeValue));el2.setAttribute("transform",currentTrans);el2.setAttribute("instantiated_by_use","1");el2.removeAttribute("id");parentNode=el.parentNode;parentNode.replaceChild(el2,el);nodelist.length===oldLength&&i++}}function applyViewboxTransform(element){var viewBoxAttr=element.getAttribute("viewBox"),scaleX=1,scaleY=1,minX=0,minY=0,viewBoxWidth,viewBoxHeight,matrix,el,widthAttr=element.getAttribute("width"),heightAttr=element.getAttribute("height"),x=element.getAttribute("x")||0,y=element.getAttribute("y")||0,preserveAspectRatio=element.getAttribute("preserveAspectRatio")||"",missingViewBox=!viewBoxAttr||!fabric.svgViewBoxElementsRegEx.test(element.nodeName)||!(viewBoxAttr=viewBoxAttr.match(reViewBoxAttrValue)),missingDimAttr=!widthAttr||!heightAttr||widthAttr==="100%"||heightAttr==="100%",toBeParsed=missingViewBox&&missingDimAttr,parsedDim={},translateMatrix="",widthDiff=0,heightDiff=0;if(parsedDim.width=0,parsedDim.height=0,parsedDim.toBeParsed=toBeParsed,toBeParsed)return parsedDim;if(missingViewBox)return parsedDim.width=parseUnit(widthAttr),parsedDim.height=parseUnit(heightAttr),parsedDim;if(minX=-parseFloat(viewBoxAttr[1]),minY=-parseFloat(viewBoxAttr[2]),viewB
14oxWidth=parseFloat(viewBoxAttr[3]),viewBoxHeight=parseFloat(viewBoxAttr[4]),missingDimAttr?(parsedDim.width=viewBoxWidth,parsedDim.height=viewBoxHeight):(parsedDim.width=parseUnit(widthAttr),parsedDim.height=parseUnit(heightAttr),scaleX=parsedDim.width/viewBoxWidth,scaleY=parsedDim.height/viewBoxHeight),preserveAspectRatio=fabric.util.parsePreserveAspectRatioAttribute(preserveAspectRatio),preserveAspectRatio.alignX!=="none"&&(preserveAspectRatio.meetOrSlice==="meet"&&(scaleY=scaleX=scaleX>scaleY?scaleY:scaleX),preserveAspectRatio.meetOrSlice==="slice"&&(scaleY=scaleX=scaleX>scaleY?scaleX:scaleY),widthDiff=parsedDim.width-viewBoxWidth*scaleX,heightDiff=parsedDim.height-viewBoxHeight*scaleX,preserveAspectRatio.alignX==="Mid"&&(widthDiff/=2),preserveAspectRatio.alignY==="Mid"&&(heightDiff/=2),preserveAspectRatio.alignX==="Min"&&(widthDiff=0),preserveAspectRatio.alignY==="Min"&&(heightDiff=0)),scaleX===1&&scaleY===1&&minX===0&&minY===0&&x===0&&y===0)return parsedDim;if((x||y)&&(translateMatrix=" translate("+parseUnit(x)+" "+parseUnit(y)+") "),matrix=translateMatrix+" matrix("+scaleX+" 0 0 "+scaleY+" "+(minX*scaleX+widthDiff)+" "+(minY*scaleY+heightDiff)+") ",element.nodeName==="svg"){for(el=element.ownerDocument.createElement("g");element.firstChild;)el.appendChild(element.firstChild);element.appendChild(el)}else el=element,matrix=el.getAttribute("transform")+matrix;return el.setAttribute("transform",matrix),parsedDim}function hasAncestorWithNodeName(element,nodeName){while(element&&(element=element.parentNode))if(element.nodeName&&nodeName.test(element.nodeName.replace("svg:",""))&&!element.getAttribute("instantiated_by_use"))return!0;return!1}var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,clone=fabric.util.object.clone,toFixed=fabric.util.toFixed,parseUnit=fabric.util.parseUnit,multiplyTransformMatrices=fabric.util.multiplyTransformMatrices,attributesMap={cx:"left",x:"left",r:"radius",cy:"top",y:"top",display:"visible",visibility:"visible",transform:"transformMatrix","fill-opacity":"fillOpacity","fill-rule":"fillRule","font-family":"fontFamily","font-size":"fontSize","font-style":"fontStyle","font-weight":"fontWeight","letter-spacing":"charSpacing","paint-order":"paintFirst","stroke-dasharray":"strokeDashArray","stroke-linecap":"strokeLineCap","stroke-linejoin":"strokeLineJoin","stroke-miterlimit":"strokeMiterLimit","stroke-opacity":"strokeOpacity","stroke-width":"strokeWidth","text-decoration":"textDecoration","text-anchor":"textAnchor",opacity:"opacity"},colorAttributes={stroke:"strokeOpacity",fill:"fillOpacity"},reViewBoxAttrValue,reFontDeclaration;fabric.svgValidTagNamesRegEx=getSvgRegex(["path","circle","polygon","polyline","ellipse","rect","line","image","text","linearGradient","radialGradient","stop"]);fabric.svgViewBoxElementsRegEx=getSvgRegex(["symbol","image","marker","pattern","view","svg"]);fabric.svgInvalidAncestorsRegEx=getSvgRegex(["pattern","defs","symbol","metadata","clipPath","mask","desc"]);fabric.svgValidParentsRegEx=getSvgRegex(["symbol","g","a","svg"]);fabric.cssRules={};fabric.gradientDefs={};fabric.parseTransformAttribute=function(){function rotateMatrix(matrix,args){var cos=fabric.util.cos(args[0]),sin=fabric.util.sin(args[0]),x=0,y=0;args.length===3&&(x=args[1],y=args[2]);matrix[0]=cos;matrix[1]=sin;matrix[2]=-sin;matrix[3]=cos;matrix[4]=x-(cos*x-sin*y);matrix[5]=y-(sin*x+cos*y)}function scaleMatrix(matrix,args){var multiplierX=args[0],multiplierY=args.length===2?args[1]:args[0];matrix[0]=multiplierX;matrix[3]=multiplierY}function skewMatrix(matrix,args,pos){matrix[pos]=Math.tan(fabric.util.degreesToRadians(args[0]))}function translateMatrix(matrix,args){matrix[4]=args[0];args.length===2&&(matrix[5]=args[1])}var iMatrix=[1,0,0,1,0,0],number=fabric.reNum,commaWsp="(?:\\s+,?\\s*|,\\s*)",skewX="(?:(skewX)\\s*\\(\\s*("+number+")\\s*\\))",skewY="(?:(skewY)\\s*\\(\\s*("+number+")\\s*\\))",rotate="(?:(rotate)\\s*\\(\\s*("+number+")(?:"+commaWsp+"("+number+")"+commaWsp+"("+number+"))?\\s*\\))",scale="(?:(scale)\\s*\\(\\s*("+number+")(?:"+commaWsp+"("+number+"))?\\s*\\))",translate="(?:(translate)\\s*\\(\\s*("+number+")(?:"+commaWsp+"("+number+"))?\\s*\\))",matrix="(?:(matrix)\\s*\\(\\s*("+number+")"+commaWsp+"("+number+")"+commaWsp+"("+number+")"+commaWsp+"("+number+")"+commaWsp+"("+number+")"+commaWsp+"("+number+")\\s*\\))",transform="(?:"+matrix+"|"+translate+"|"+scale+"|"+rotate+"|"+skewX+"|"+skewY+")",transforms="(?:"+transform+"
14(?:"+commaWsp+"*"+transform+")*)",transformList="^\\s*(?:"+transforms+"?)\\s*$",reTransformList=new RegExp(transformList),reTransform=new RegExp(transform,"g");return function(attributeValue){var matrix=iMatrix.concat(),matrices=[],combinedMatrix;if(!attributeValue||attributeValue&&!reTransformList.test(attributeValue))return matrix;for(attributeValue.replace(reTransform,function(match){var m=new RegExp(transform).exec(match).filter(function(match){return!!match}),operation=m[1],args=m.slice(2).map(parseFloat);switch(operation){case"translate":translateMatrix(matrix,args);break;case"rotate":args[0]=fabric.util.degreesToRadians(args[0]);rotateMatrix(matrix,args);break;case"scale":scaleMatrix(matrix,args);break;case"skewX":skewMatrix(matrix,args,2);break;case"skewY":skewMatrix(matrix,args,1);break;case"matrix":matrix=args}matrices.push(matrix.concat());matrix=iMatrix.concat()}),combinedMatrix=matrices[0];matrices.length>1;)matrices.shift(),combinedMatrix=fabric.util.multiplyTransformMatrices(combinedMatrix,matrices[0]);return combinedMatrix}}();reViewBoxAttrValue=new RegExp("^\\s*("+fabric.reNum+"+)\\s*,?\\s*("+fabric.reNum+"+)\\s*,?\\s*("+fabric.reNum+"+)\\s*,?\\s*("+fabric.reNum+"+)\\s*$");fabric.parseSVGDocument=function(doc,callback,reviver,parsingOptions){var arr,elements;if(doc){parseUseDirectives(doc);var svgUid=fabric.Object.__uid++,i,len,options=applyViewboxTransform(doc),descendants=fabric.util.toArray(doc.getElementsByTagName("*"));if(options.crossOrigin=parsingOptions&&parsingOptions.crossOrigin,options.svgUid=svgUid,descendants.length===0&&fabric.isLikelyNode){for(descendants=doc.selectNodes('//*[name(.)!="svg"]'),arr=[],i=0,len=descendants.length;i<len;i++)arr[i]=descendants[i];descendants=arr}if(elements=descendants.filter(function(el){return applyViewboxTransform(el),fabric.svgValidTagNamesRegEx.test(el.nodeName.replace("svg:",""))&&!hasAncestorWithNodeName(el,fabric.svgInvalidAncestorsRegEx)}),!elements||elements&&!elements.length){callback&&callback([],{});return}fabric.gradientDefs[svgUid]=fabric.getGradientDefs(doc);fabric.cssRules[svgUid]=fabric.getCSSRules(doc);fabric.parseElements(elements,function(instances,elements){callback&&callback(instances,options,elements,descendants)},clone(options),reviver,parsingOptions)}};reFontDeclaration=new RegExp("(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*("+fabric.reNum+"(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|"+fabric.reNum+"))?\\s+(.*)");extend(fabric,{parseFontDeclaration:function(value,oStyle){var match=value.match(reFontDeclaration);if(match){var fontStyle=match[1],fontWeight=match[3],fontSize=match[4],lineHeight=match[5],fontFamily=match[6];fontStyle&&(oStyle.fontStyle=fontStyle);fontWeight&&(oStyle.fontWeight=isNaN(parseFloat(fontWeight))?fontWeight:parseFloat(fontWeight));fontSize&&(oStyle.fontSize=parseUnit(fontSize));fontFamily&&(oStyle.fontFamily=fontFamily);lineHeight&&(oStyle.lineHeight=lineHeight==="normal"?1:lineHeight)}},getGradientDefs:function(doc){for(var elList=_getMultipleNodes(doc,["linearGradient","radialGradient","svg:linearGradient","svg:radialGradient"]),el,j=0,id,xlink,gradientDefs={},idsToXlinkMap={},el2,j=elList.length;j--;)el=elList[j],xlink=el.getAttribute("xlink:href"),id=el.getAttribute("id"),xlink&&(idsToXlinkMap[id]=xlink.substr(1)),gradientDefs[id]=el;for(id in idsToXlinkMap)for(el2=gradientDefs[idsToXlinkMap[id]].cloneNode(!0),el=gradientDefs[id];el2.firstChild;)el.appendChild(el2.firstChild);return gradientDefs},parseAttributes:function(element,attributes,svgUid){var value,parentAttributes,fontSize,ownAttributes,normalizedAttr,normalizedValue,normalizedStyle,attr,mergedAttrs;if(element){parentAttributes={};typeof svgUid=="undefined"&&(svgUid=element.getAttribute("svgUid"));element.parentNode&&fabric.svgValidParentsRegEx.test(element.parentNode.nodeName)&&(parentAttributes=fabric.parseAttributes(element.parentNode,attributes,svgUid));fontSize=parentAttributes&&parentAttributes.fontSize||element.getAttribute("font-size")||fabric.Text.DEFAULT_SVG_FONT_SIZE;ownAttributes=attributes.reduce(function(memo,attr){return value=element.getAttribute(attr),value&&(memo[attr]=value),memo},{});ownAttributes=extend(ownAttributes,extend(getGlobalStylesForElement(element,svgUid),fabric.parseStyleAttribute(element)));normalizedStyle={};for(attr in ownAttributes)normalizedAttr=normalizeAttr(attr),normalizedValue=normalizeValue(normalizedAttr,ownAttributes[attr],parentAttributes,fontSize),normalizedStyle[normalizedAttr]=normalizedValue;return normalizedStyle&&normalizedStyle.font&&fabric.parseFontDeclaration(normalizedStyle.font,normalizedStyle),mergedAttrs=extend(parentAttributes,normalizedStyle),fabric.svgValidParentsRegEx.test(element.nodeName)?mergedAttrs:_setStrokeFillOpacity(mergedAttrs)}},parseElements:function(elements,callback,options,reviver,parsingOptions){new fabric.ElementsParser(elements,callback,options,reviver,parsingOptions).parse()},parseStyleAttribute:function(element){var oStyle={},style=element.getAttribute("style");
14return style?(typeof style=="string"?parseStyleString(style,oStyle):parseStyleObject(style,oStyle),oStyle):oStyle},parsePointsAttribute:function(points){if(!points)return null;points=points.replace(/,/g," ").trim();points=points.split(/\s+/);for(var parsedPoints=[],i=0,len=points.length;i<len;i+=2)parsedPoints.push({x:parseFloat(points[i]),y:parseFloat(points[i+1])});return parsedPoints},getCSSRules:function(doc){for(var styles=doc.getElementsByTagName("style"),allRules={},rules,styleContents,i=0,len=styles.length;i<len;i++)(styleContents=styles[i].textContent||styles[i].text,styleContents=styleContents.replace(/\/\*[\s\S]*?\*\//g,""),styleContents.trim()!=="")&&(rules=styleContents.match(/[^{]*\{[\s\S]*?\}/g),rules=rules.map(function(rule){return rule.trim()}),rules.forEach(function(rule){var match=rule.match(/([\s\S]*?)\s*\{([^}]*)\}/),ruleObj={},declaration=match[2].trim(),propertyValuePairs=declaration.replace(/;$/,"").split(/\s*;\s*/);for(i=0,len=propertyValuePairs.length;i<len;i++){var pair=propertyValuePairs[i].split(/\s*:\s*/),property=pair[0],value=pair[1];ruleObj[property]=value}rule=match[1];rule.split(",").forEach(function(_rule){(_rule=_rule.replace(/^svg/i,"").trim(),_rule!=="")&&(allRules[_rule]?fabric.util.object.extend(allRules[_rule],ruleObj):allRules[_rule]=fabric.util.object.clone(ruleObj))})}));return allRules},loadSVGFromURL:function(url,callback,reviver,options){function onComplete(r){var xml=r.responseXML;xml&&!xml.documentElement&&fabric.window.ActiveXObject&&r.responseText&&(xml=new ActiveXObject("Microsoft.XMLDOM"),xml.async="false",xml.loadXML(r.responseText.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));xml&&xml.documentElement||callback&&callback(null);fabric.parseSVGDocument(xml.documentElement,function(results,_options,elements,allElements){callback&&callback(results,_options,elements,allElements)},reviver,options)}url=url.replace(/^\n\s*/,"").trim();new fabric.util.request(url,{method:"get",onComplete:onComplete})},loadSVGFromString:function(string,callback,reviver,options){var doc,parser;string=string.trim();typeof DOMParser!="undefined"?(parser=new DOMParser,parser&&parser.parseFromString&&(doc=parser.parseFromString(string,"text/xml"))):fabric.window.ActiveXObject&&(doc=new ActiveXObject("Microsoft.XMLDOM"),doc.async="false",doc.loadXML(string.replace(/<!DOCTYPE[\s\S]*?(\[[\s\S]*\])*?>/i,"")));fabric.parseSVGDocument(doc.documentElement,function(results,_options,elements,allElements){callback(results,_options,elements,allElements)},reviver,options)}})}(typeof exports!="undefined"?exports:this);fabric.ElementsParser=function(elements,callback,options,reviver,parsingOptions){this.elements=elements;this.callback=callback;this.options=options;this.reviver=reviver;this.svgUid=options&&options.svgUid||0;this.parsingOptions=parsingOptions;this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g};fabric.ElementsParser.prototype.parse=function(){this.instances=new Array(this.elements.length);this.numElements=this.elements.length;this.createObjects()};fabric.ElementsParser.prototype.createObjects=function(){for(var i=0,len=this.elements.length;i<len;i++)this.elements[i].setAttribute("svgUid",this.svgUid),function(_obj,i){setTimeout(function(){_obj.createObject(_obj.elements[i],i)},0)}(this,i)};fabric.ElementsParser.prototype.createObject=function(el,index){var klass=fabric[fabric.util.string.capitalize(el.tagName.replace("svg:",""))];if(klass&&klass.fromElement)try{this._createObject(klass,el,index)}catch(err){fabric.log(err)}else this.checkIfDone()};fabric.ElementsParser.prototype._createObject=function(klass,el,index){klass.fromElement(el,this.createCallback(index,el),this.options)};fabric.ElementsParser.prototype.createCallback=function(index,el){var _this=this;return function(obj){var _options;_this.resolveGradient(obj,"fill");_this.resolveGradient(obj,"stroke");obj instanceof fabric.Image&&(_options=obj.parsePreserveAspectRatioAttribute(el));obj._removeTransformMatrix(_options);_this.reviver&&_this.reviver(el,obj);_this.instances[index]=obj;_this.checkIfDone()}};fabric.ElementsParser.prototype.resolveGradient=function(obj,property){var instanceFillValue=obj[property],gradientId;/^url\(/.test(instanceFillValue)&&(gradientId=this.regexUrl.exec(instanceFillValue)[1],this.regexUrl.lastIndex=0,fabric.gradientDefs[this.svgUid][gradientId]&&obj.set(property,fabric.Gradient.fromElement(fabric.gradientDefs[this.svgUid][gradientId],obj)))};fabric.ElementsParser.prototype.checkIfDone=function(){--this.numElements==0&&(this.instances=this.instances.filter(function(el){return el!=null}),this.callback(this.instances,this.elements))},function(global){"use strict";function Point(x,y){this.x=x;this.y=y}var fabric=global.fabric||(global.fabric={});if(fabric.Point){fabric.warn("fabric.Point is already defined");return}fabric.Point=Point;Point.prototype={type:"point",constructor:Point,add:function(that){return new Point(this.x+that.x,this.y+that.y)},addEquals:function(that){return this.x+=that.x,this.y+=that.y,this},scalarAdd:function(scalar){return new Point(this.x+scalar,this.y+scalar)},scalarAddEquals:function(scalar){return this.x+=scalar,this.y+=scalar,this},subtract:function(that){return new Point(this.x-that.x,this.y-that.y)},subtractEquals:function(that){return this.x-=that.x,this.y-=that.y,this},scalarSubtract:function(scalar){return new Point(this.x-scalar,this.y-scalar)},scalarSubtractEquals:function(scalar){return this.x-=scalar,this.y-=scalar,this},multiply:function(scalar){return new Point(this.x*scalar,this.y*scalar)},multiplyEquals:function(scalar){return this.x*=scalar,this.y*=scalar,this},divide:function(scalar){return new Point(this.x/scalar,this.y/scalar)},divideEquals:function(scalar){return this.x/=scalar,this.y/=scalar,this},eq:function(that){return this.x===that.x&&this.y===that.y},lt:function(that){return this.x<that.x&&this.y<that.y},lte:function(that){return this.x<=that.x&&this.y<=that.y},gt:function(that){return this.x>that.x&&this.y>that.y},gte:function(that){return this.x>=that.x&&this.y>=that.y},lerp:function(that,t){return typeof t=="undefined"&&(t=.5),t=Math.max(Math.min(1,t),0),new Point(this.x+(that.x-this.x)*t,this.y+(that.y-this.y)*t)},distanceFrom:function(that){var dx=this.x-that.x,dy=this.y-that.y;return Math.sqrt(dx*dx+dy*dy)},midPointFrom:function(that){return this.lerp(that)},min:function(that){return new Point(Math.min(this.x,that.x),Math.min(this.y,that.y))},max:function(that){return new Point(Math.max(this.x,that.x),Math.max(this.y,that.y))},toString:function(){return this.x+","+this.y},setXY:function(x,y){return this.x=x,this.y=y,this},setX:function(x){return this.x=x,this},setY:function(y){return this.y=y,this},setFromPoint:function(that){return this.x=that.x,this.y=that.y,this},swap:function(that){var x=this.x,y=this.y;this.x=that.x;this.y=that.y;that.x=x;that.y=y},clone:function(){return new Point(this.x,this.y)}}}(typeof exports!="undefined"?exports:this),function(global){"use strict";function Intersection(status){this.status=status;this.points=[]}var fabric=global.fabric||(global.fabric={});if(fabric.Intersection){fabric.warn("fabric.Intersection is already defined");return}fabric.Intersection=Intersection;fabric.Intersection.prototype={constructor:Intersection,appendPoint:function(point){return this.points.push(point),this},appendPoints:function(points){return this.points=this.points.concat(points),this}};fabric.Intersection.intersectLineLine=function(a1,a2,b1,b2){var result,uaT=(b2.x-b1.x)*(a1.y-b1.y)-(b2.y-b1.y)*(a1.x-b1.x),ubT=(a2.x-a1.x)*(a1.y-b1.y)-(a2.y-a1.y)*(a1.x-b1.x),uB=(b2.y-b1.y)*(a2.x-a1.x)-(b2.x-b1.x)*(a2.y-a1.y),ua,ub;return uB!==0?(ua=uaT/uB,ub=ubT/uB,0<=ua&&ua<=1&&0<=ub&&ub<=1?(result=new Intersection("Intersection"),result.appendPoint(new fabric.Point(a1.x+ua*(a2.x-a1.x),a1.y+ua*(a2.y-a1.y)))):result=new Intersection):result=uaT===0||ubT===0?new Intersection("Coincident"):new Intersection("Parallel"),result};fabric.Intersection.intersectLinePolygon=function(a1,a2,points){for(var result=new Intersection,length=points.length,b1,b2,inter,i=0;i<length;i++)b1=points[i],b2=points[(i+1)%length],inter=Intersection.intersectLineLine(a1,a2,b1,b2),result.appendPoints(inter.points);return result.points.length>0&&(result.status="Intersection"),result};fabric.Intersection.intersectPolygonPolygon=function(points1,points2){for(var result=new Intersection,length=points1.length,i=0;i<length;i++){var a1=points1[i],a2=points1[(i+1)%length],inter=Intersection.intersectLinePolygon(a1,a2,points2);result.appendPoints(inter.points)}return result.points.length>0&&(result.status="Intersection"),result};fabric.Intersection.intersectPolygonRectangle=function(points,r1,r2){var min=r1.min(r2),max=r1.max(r2),topRight=new fabric.Point(max.x,min.y),bottomLeft=new fabric.Point(min.x,max.y),inter1=Intersection.intersectLinePolygon(min,topRight,points),inter2=Intersection.intersectLinePolygon(topRight,max,points),inter3=Intersection.intersectLinePolygon(max,bottomLeft,points),inter4=Intersection.intersectLinePolygon(bottomLeft,min,points),result=new Intersection;return result.appendPoints(inter1.points),result.appendPoints(inter2.points),result.appendPoints(inter3.points),result.appendPoints(inter4.points),result.points.length>0&&(result.status="Intersection"),result}}(typeof exports!="undefined"?exports:this),function(global){"use strict";function Color(color){color?this._tryParsingColor(color):this.setSource([0,0,0,1])}function hue2rgb(p,q,t){return(t<0&&(t+=1),t>1&&(t-=1),t<1/6)?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p}var fabric=global.fabric||(global.fabric={});if(fabric.Color){fabric.warn("fabric.Color is already defined.");return}fabric.Color=Color;fabric.Color.prototype={_tryParsingColor:function(color){var source;color in Color.colorNameMap&&(color=Color.colorNameMap[color]);color==="transparent"&&(source=[255,255,255,0]);source||(source=Color.sourceFromHex(color));source||(source=Color.sourceFromRgb(color));source||(source=Color.sourceFromHsl(color));source||(source=[0,0,0,1]);source&&this.setSource(source)},_rgbToHsl:function(r,g,b){var h,s,l,max,min,d;if(r/=255,g/=255,b/=255,max=fabric.util.array.max([r,g,b]),min=fabric.util.array.min([r,g,b]),l=(max+min)/2,max===min)h=s=0;else{d=max-min;s=l>.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4}h/=6}return[Math.round(h*360),Math.round(s*100),Math.round(l*100)]},getSource:function(){return this._source},setSource:function(source){this._source=source},toRgb:function(){var source=this.getSource();return"rgb("+source[0]+","+source[1]+","+source[2]+")"},toRgba:function(){var source=this.getSource();return"rgba("+source[0]+","+source[1]+","+source[2]+","+source[3]+")"},toHsl:function(){var source=this.getSource(),hsl=this._rgbToHsl(source[0],source[1],source[2]);return"hsl("+hsl[0]+","+hsl[1]+"%,"+hsl[2]+"%)"}
14,toHsla:function(){var source=this.getSource(),hsl=this._rgbToHsl(source[0],source[1],source[2]);return"hsla("+hsl[0]+","+hsl[1]+"%,"+hsl[2]+"%,"+source[3]+")"},toHex:function(){var source=this.getSource(),r,g,b;return r=source[0].toString(16),r=r.length===1?"0"+r:r,g=source[1].toString(16),g=g.length===1?"0"+g:g,b=source[2].toString(16),b=b.length===1?"0"+b:b,r.toUpperCase()+g.toUpperCase()+b.toUpperCase()},toHexa:function(){var source=this.getSource(),a;return a=Math.round(source[3]*255),a=a.toString(16),a=a.length===1?"0"+a:a,this.toHex()+a.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(alpha){var source=this.getSource();return source[3]=alpha,this.setSource(source),this},toGrayscale:function(){var source=this.getSource(),average=parseInt((source[0]*.3+source[1]*.59+source[2]*.11).toFixed(0),10),currentAlpha=source[3];return this.setSource([average,average,average,currentAlpha]),this},toBlackWhite:function(threshold){var source=this.getSource(),average=(source[0]*.3+source[1]*.59+source[2]*.11).toFixed(0),currentAlpha=source[3];return threshold=threshold||127,average=Number(average)<Number(threshold)?0:255,this.setSource([average,average,average,currentAlpha]),this},overlayWith:function(otherColor){otherColor instanceof Color||(otherColor=new Color(otherColor));for(var result=[],alpha=this.getAlpha(),otherAlpha=.5,source=this.getSource(),otherSource=otherColor.getSource(),i=0;i<3;i++)result.push(Math.round(source[i]*(1-otherAlpha)+otherSource[i]*otherAlpha));return result[3]=alpha,this.setSource(result),this}};fabric.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i;fabric.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i;fabric.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i;fabric.Color.colorNameMap={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgrey:"#A9A9A9",darkgreen:"#006400",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgrey:"#D3D3D3",lightgreen:"#90EE90",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",rebeccapurple:"#663399",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"};fabric.Color.fromRgb=function(color){return Color.fromSource(Color.sourceFromRgb(color))};fabric.Color.sourceFromRgb=function(color){var match=color.match(Color.reRGBa);if(match){var r=parseInt(match[1],10)/(/%$/.test(match[1])?100:1)*(/%$/.test(match[1])?255:1),g=parseInt(match[2],10)/(/%$/.test(match[2])?100:1)*(/%$/.test(match[2])?255:1),b=parseInt(match[3],10)/(/%$/.test(match[3])?100:1)*(/%$/.test(match[3])?255:1);return[parseInt(r,10),parseInt(g,10),parseInt(b,10),match[4]?parseFloat(match[4]):1]}};fabric.Color.fromRgba=Color.fromRgb;fabric.Color.fromHsl=function(color){return Color.fromSource(Color.sourceFromHsl(color))};fabric.Color.sourceFromHsl=function(color){var match=color.match(Color.reHSLa),q,p;if(match){var h=(parseFloat(match[1])%360+360)%360/360,s=parseFloat(match[2])/(/%$/.test(match[2])?100:1),l=parseFloat(match[3])/(/%$/.test(match[3])?100:1),r,g,b;return s===0?r=g=b=l:(q=l<=.5?l*(s+1):l+s-l*s,p=l*2-q,r=hue2rgb(p,q,h+1/3),g=hue2rgb(p,q,h),b=hue2rgb(p,q,h-1/3)),[Math.round(r*255),Math.round(g*255),Math.round(b*255),match[4]?parseFloat(match[4]):1]}};fabric.Color.fromHsla=Color.fromHsl;fabric.Color.fromHex=function(color){return Color.fromSource(Color.sourceFromHex(color))};fabric.Color.sourceFromHex=function(color){if(color.match(Color.reHex)){var value=color.slice(color.indexOf("#")+1),isShortNotation=value.length===3||value.length===4,isRGBa=value.length===8||value.length===4,r=isShortNotation?value.charAt(0)+value.charAt(0):value.substring(0,2),g=isShortNotation?value.charAt(1)+value.charAt(1):value.substring(2,4),b=isShortNotation?value.charAt(2)+value.charAt(2):value.substring(4,6),a=isRGBa?isShortNotation?value.charAt(3)+value.charAt(3):value.substring(6,8):"FF";return[parseInt(r,16),parseInt(g,16),parseInt(b,16),parseFloat((parseInt(a,16)/255).toFixed(2))]}};fabric.Color.fromSource=function(source){var oColor=new Color;return oColor.setSource(source),oColor}}(typeof exports!="undefined"?exports:this),function(){function getColorStop(el){var style=el.getAttribute("style"),offset=el.getAttribute("offset")||0,color,colorAlpha,opacity,i,keyValuePairs;if(offset=parseFloat(offset)/(/%$/.test(offset)?100:1),offset=offset<0?0:offset>1?1:offset,style)for(keyValuePairs=style.split(/\s*;\s*/),keyValuePairs[keyValuePairs.length-1]===""&&keyValuePairs.pop(),i=keyValuePairs.length;i--;){var split=keyValuePairs[i].split(/\s*:\s*/),key=split[0].trim(),value=split[1].trim();key==="stop-color"?color=value:key==="stop-opacity"&&(opacity=value)}return color||(color=el.getAttribute("stop-color")||"rgb(0,0,0)"),opacity||(opacity=el.getAttribute("stop-opacity")),color=new fabric.Color(color),colorAlpha=color.getAlpha(),opacity=isNaN(parseFloat(opacity))?1:parseFloat(opacity),opacity*=colorAlpha,{offset:offset,color:color.toRgb(),opacity:opacity}}function getLinearCoords(el){return{x1:el.getAttribute("x1")||0,y1:el.getAttribute("y1")||0,x2:el.getAttribute("x2")||"100%",y2:el.getAttribute("y2")||0}}function getRadialCoords(el){return{x1:el.getAttribute("fx")||el.getAttribute("cx")||"50%",y1:el.getAttribute("fy")||el.getAttribute("cy")||"50%",r1:0,x2:el.getAttribute("cx")||"50%",y2:el.getAttribute("cy")||"50%",r2:el.getAttribute("r")||"50%"}}
14function _convertPercentUnitsToValues(object,options,gradientUnits){var propValue,addFactor=0,multFactor=1,ellipseMatrix="",prop,scaleFactor;for(prop in options)options[prop]==="Infinity"?options[prop]=1:options[prop]==="-Infinity"&&(options[prop]=0),propValue=parseFloat(options[prop],10),multFactor=typeof options[prop]=="string"&&/^(\d+\.\d+)%|(\d+)%$/.test(options[prop])?.01:1,prop==="x1"||prop==="x2"||prop==="r2"?(multFactor*=gradientUnits==="objectBoundingBox"?object.width:1,addFactor=gradientUnits==="objectBoundingBox"?object.left||0:0):(prop==="y1"||prop==="y2")&&(multFactor*=gradientUnits==="objectBoundingBox"?object.height:1,addFactor=gradientUnits==="objectBoundingBox"?object.top||0:0),options[prop]=propValue*multFactor+addFactor;return object.type==="ellipse"&&options.r2!==null&&gradientUnits==="objectBoundingBox"&&object.rx!==object.ry&&(scaleFactor=object.ry/object.rx,ellipseMatrix=" scale(1, "+scaleFactor+")",options.y1&&(options.y1/=scaleFactor),options.y2&&(options.y2/=scaleFactor)),ellipseMatrix}var clone=fabric.util.object.clone;fabric.Gradient=fabric.util.createClass({offsetX:0,offsetY:0,initialize:function(options){options||(options={});var coords={};this.id=fabric.Object.__uid++;this.type=options.type||"linear";coords={x1:options.coords.x1||0,y1:options.coords.y1||0,x2:options.coords.x2||0,y2:options.coords.y2||0};this.type==="radial"&&(coords.r1=options.coords.r1||0,coords.r2=options.coords.r2||0);this.coords=coords;this.colorStops=options.colorStops.slice();options.gradientTransform&&(this.gradientTransform=options.gradientTransform);this.offsetX=options.offsetX||this.offsetX;this.offsetY=options.offsetY||this.offsetY},addColorStop:function(colorStops){var position,color;for(position in colorStops)color=new fabric.Color(colorStops[position]),this.colorStops.push({offset:parseFloat(position),color:color.toRgb(),opacity:color.getAlpha()});return this},toObject:function(propertiesToInclude){var object={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return fabric.util.populateWithProperties(this,object,propertiesToInclude),object},toSVG:function(object){var coords=clone(this.coords,!0),i,len,markup,commonAttributes,colorStops=clone(this.colorStops,!0),needsSwap=coords.r1>coords.r2,offsetX=object.width/2,offsetY=object.height/2,prop,minRadius,maxRadius,percentageShift,colorStop;colorStops.sort(function(a,b){return a.offset-b.offset});object.type==="path"&&(offsetX-=object.pathOffset.x,offsetY-=object.pathOffset.y);for(prop in coords)prop==="x1"||prop==="x2"?coords[prop]+=this.offsetX-offsetX:(prop==="y1"||prop==="y2")&&(coords[prop]+=this.offsetY-offsetY);if(commonAttributes='id="SVGID_'+this.id+'" gradientUnits="userSpaceOnUse"',this.gradientTransform&&(commonAttributes+=' gradientTransform="matrix('+this.gradientTransform.join(" ")+')" '),this.type==="linear"?markup=["<linearGradient ",commonAttributes,' x1="',coords.x1,'" y1="',coords.y1,'" x2="',coords.x2,'" y2="',coords.y2,'">\n']:this.type==="radial"&&(markup=["<radialGradient ",commonAttributes,' cx="',needsSwap?coords.x1:coords.x2,'" cy="',needsSwap?coords.y1:coords.y2,'" r="',needsSwap?coords.r1:coords.r2,'" fx="',needsSwap?coords.x2:coords.x1,'" fy="',needsSwap?coords.y2:coords.y1,'">\n']),this.type==="radial"){if(needsSwap)for(colorStops=colorStops.concat(),colorStops.reverse(),i=0,len=colorStops.length;i<len;i++)colorStops[i].offset=1-colorStops[i].offset;if(minRadius=Math.min(coords.r1,coords.r2),minRadius>0)for(maxRadius=Math.max(coords.r1,coords.r2),percentageShift=minRadius/maxRadius,i=0,len=colorStops.length;i<len;i++)colorStops[i].offset+=percentageShift*(1-colorStops[i].offset)}for(i=0,len=colorStops.length;i<len;i++)colorStop=colorStops[i],markup.push("<stop ",'offset="',colorStop.offset*100+"%",'" style="stop-color:',colorStop.color,typeof colorStop.opacity!="undefined"?";stop-opacity: "+colorStop.opacity:";",'"/>\n');return markup.push(this.type==="linear"?"<\/linearGradient>\n":"<\/radialGradient>\n"),markup.join("")},toLive:function(ctx){var gradient,coords=fabric.util.object.clone(this.coords),i,len;
14if(this.type){for(this.type==="linear"?gradient=ctx.createLinearGradient(coords.x1,coords.y1,coords.x2,coords.y2):this.type==="radial"&&(gradient=ctx.createRadialGradient(coords.x1,coords.y1,coords.r1,coords.x2,coords.y2,coords.r2)),i=0,len=this.colorStops.length;i<len;i++){var color=this.colorStops[i].color,opacity=this.colorStops[i].opacity,offset=this.colorStops[i].offset;typeof opacity!="undefined"&&(color=new fabric.Color(color).setAlpha(opacity).toRgba());gradient.addColorStop(offset,color)}return gradient}}});fabric.util.object.extend(fabric.Gradient,{fromElement:function(el,instance){var colorStopEls=el.getElementsByTagName("stop"),type,gradientUnits=el.getAttribute("gradientUnits")||"objectBoundingBox",gradientTransform=el.getAttribute("gradientTransform"),colorStops=[],coords,ellipseMatrix,i,gradient;for(type=el.nodeName==="linearGradient"||el.nodeName==="LINEARGRADIENT"?"linear":"radial",type==="linear"?coords=getLinearCoords(el):type==="radial"&&(coords=getRadialCoords(el)),i=colorStopEls.length;i--;)colorStops.push(getColorStop(colorStopEls[i]));return ellipseMatrix=_convertPercentUnitsToValues(instance,coords,gradientUnits),gradient=new fabric.Gradient({type:type,coords:coords,colorStops:colorStops,offsetX:-instance.left,offsetY:-instance.top}),(gradientTransform||ellipseMatrix!=="")&&(gradient.gradientTransform=fabric.parseTransformAttribute((gradientTransform||"")+ellipseMatrix)),gradient},forObject:function(obj,options){return options||(options={}),_convertPercentUnitsToValues(obj,options.coords,"userSpaceOnUse"),new fabric.Gradient(options)}})}(),function(){"use strict";var toFixed=fabric.util.toFixed;fabric.Pattern=fabric.util.createClass({repeat:"repeat",offsetX:0,offsetY:0,crossOrigin:"",patternTransform:null,initialize:function(options,callback){if(options||(options={}),this.id=fabric.Object.__uid++,this.setOptions(options),!options.source||options.source&&typeof options.source!="string"){callback&&callback(this);return}if(typeof fabric.util.getFunctionBody(options.source)!="undefined")this.source=new Function(fabric.util.getFunctionBody(options.source)),callback&&callback(this);else{var _this=this;this.source=fabric.util.createImage();fabric.util.loadImage(options.source,function(img){_this.source=img;callback&&callback(_this)},null,this.crossOrigin)}},toObject:function(propertiesToInclude){var NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS,source,object;return typeof this.source=="function"?source=String(this.source):typeof this.source.src=="string"?source=this.source.src:typeof this.source=="object"&&this.source.toDataURL&&(source=this.source.toDataURL()),object={type:"pattern",source:source,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:toFixed(this.offsetX,NUM_FRACTION_DIGITS),offsetY:toFixed(this.offsetY,NUM_FRACTION_DIGITS),patternTransform:this.patternTransform?this.patternTransform.concat():null},fabric.util.populateWithProperties(this,object,propertiesToInclude),object},toSVG:function(object){var patternSource=typeof this.source=="function"?this.source():this.source,patternWidth=patternSource.width/object.width,patternHeight=patternSource.height/object.height,patternOffsetX=this.offsetX/object.width,patternOffsetY=this.offsetY/object.height,patternImgSrc="";return(this.repeat==="repeat-x"||this.repeat==="no-repeat")&&(patternHeight=1,patternOffsetY&&(patternHeight+=Math.abs(patternOffsetY))),(this.repeat==="repeat-y"||this.repeat==="no-repeat")&&(patternWidth=1,patternOffsetX&&(patternWidth+=Math.abs(patternOffsetX))),patternSource.src?patternImgSrc=patternSource.src:patternSource.toDataURL&&(patternImgSrc=patternSource.toDataURL()),'<pattern id="SVGID_'+this.id+'" x="'+patternOffsetX+'" y="'+patternOffsetY+'" width="'+patternWidth+'" height="'+patternHeight+'">\n<image x="0" y="0" width="'+patternSource.width+'" height="'+patternSource.height+'" xlink:href="'+patternImgSrc+'"><\/image>\n<\/pattern>\n'},setOptions:function(options){for(var prop in options)this[prop]=options[prop]},toLive:function(ctx){var source=typeof this.source=="function"?this.source():this.source;return source?typeof source.src!="undefined"&&(!source.complete||source.naturalWi
14dth===0||source.naturalHeight===0)?"":ctx.createPattern(source,this.repeat):""}})}(),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),toFixed=fabric.util.toFixed;if(fabric.Shadow){fabric.warn("fabric.Shadow is already defined.");return}fabric.Shadow=fabric.util.createClass({color:"rgb(0,0,0)",blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,initialize:function(options){typeof options=="string"&&(options=this._parseShadow(options));for(var prop in options)this[prop]=options[prop];this.id=fabric.Object.__uid++},_parseShadow:function(shadow){var shadowStr=shadow.trim(),offsetsAndBlur=fabric.Shadow.reOffsetsAndBlur.exec(shadowStr)||[],color=shadowStr.replace(fabric.Shadow.reOffsetsAndBlur,"")||"rgb(0,0,0)";return{color:color.trim(),offsetX:parseInt(offsetsAndBlur[1],10)||0,offsetY:parseInt(offsetsAndBlur[2],10)||0,blur:parseInt(offsetsAndBlur[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join("px ")},toSVG:function(object){var fBoxX=40,fBoxY=40,NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS,offset=fabric.util.rotateVector({x:this.offsetX,y:this.offsetY},fabric.util.degreesToRadians(-object.angle)),BLUR_BOX=20,color=new fabric.Color(this.color);return object.width&&object.height&&(fBoxX=toFixed((Math.abs(offset.x)+this.blur)/object.width,NUM_FRACTION_DIGITS)*100+BLUR_BOX,fBoxY=toFixed((Math.abs(offset.y)+this.blur)/object.height,NUM_FRACTION_DIGITS)*100+BLUR_BOX),object.flipX&&(offset.x*=-1),object.flipY&&(offset.y*=-1),'<filter id="SVGID_'+this.id+'" y="-'+fBoxY+'%" height="'+(100+2*fBoxY)+'%" x="-'+fBoxX+'%" width="'+(100+2*fBoxX)+'%" >\n\t<feGaussianBlur in="SourceAlpha" stdDeviation="'+toFixed(this.blur?this.blur/2:0,NUM_FRACTION_DIGITS)+'"><\/feGaussianBlur>\n\t<feOffset dx="'+toFixed(offset.x,NUM_FRACTION_DIGITS)+'" dy="'+toFixed(offset.y,NUM_FRACTION_DIGITS)+'" result="oBlur" ><\/feOffset>\n\t<feFlood flood-color="'+color.toRgb()+'" flood-opacity="'+color.getAlpha()+'"/>\n\t<feComposite in2="oBlur" operator="in" />\n\t<feMerge>\n\t\t<feMergeNode><\/feMergeNode>\n\t\t<feMergeNode in="SourceGraphic"><\/feMergeNode>\n\t<\/feMerge>\n<\/filter>\n'},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke};var obj={},proto=fabric.Shadow.prototype;return["color","blur","offsetX","offsetY","affectStroke"].forEach(function(prop){this[prop]!==proto[prop]&&(obj[prop]=this[prop])},this),obj}});fabric.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:px)?(?:\s?|$))?(-?\d+(?:px)?(?:\s?|$))?(\d+(?:px)?)?(?:\s?|$)(?:$|\s)/}(typeof exports!="undefined"?exports:this),function(){"use strict";if(fabric.StaticCanvas){fabric.warn("fabric.StaticCanvas is already defined.");return}var extend=fabric.util.object.extend,getElementOffset=fabric.util.getElementOffset,removeFromArray=fabric.util.removeFromArray,toFixed=fabric.util.toFixed,transformPoint=fabric.util.transformPoint,invertTransform=fabric.util.invertTransform,CANVAS_INIT_ERROR=new Error("Could not initialize `canvas` element");fabric.StaticCanvas=fabric.util.createClass(fabric.CommonMethods,{initialize:function(el,options){options||(options={});this.renderAndResetBound=this.renderAndReset.bind(this);this.requestRenderAllBound=this.requestRenderAll.bind(this);this._initStatic(el,options)},backgroundColor:"",backgroundImage:null,overlayColor:"",overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,clipTo:null,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:fabric.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,onBeforeScaleRotate:function(){},enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,_initStatic:function(el,options){var cb=this.requestRenderAllBound;this._objects=[];this._createLowerCanvas(el);this._initOptions(options);this._setImageSmoothing();this.interactive||this._initRetinaScaling();options.overlayImage&&this.setOverlayImage(options.overlayImage,cb);options.backgroundImage&&this.setBackgroundImage(options.backgroundImage,cb);
14options.backgroundColor&&this.setBackgroundColor(options.backgroundColor,cb);options.overlayColor&&this.setOverlayColor(options.overlayColor,cb);this.calcOffset()},_isRetinaScaling:function(){return fabric.devicePixelRatio!==1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?fabric.devicePixelRatio:1},_initRetinaScaling:function(){this._isRetinaScaling()&&(this.lowerCanvasEl.setAttribute("width",this.width*fabric.devicePixelRatio),this.lowerCanvasEl.setAttribute("height",this.height*fabric.devicePixelRatio),this.contextContainer.scale(fabric.devicePixelRatio,fabric.devicePixelRatio))},calcOffset:function(){return this._offset=getElementOffset(this.lowerCanvasEl),this},setOverlayImage:function(image,callback,options){return this.__setBgOverlayImage("overlayImage",image,callback,options)},setBackgroundImage:function(image,callback,options){return this.__setBgOverlayImage("backgroundImage",image,callback,options)},setOverlayColor:function(overlayColor,callback){return this.__setBgOverlayColor("overlayColor",overlayColor,callback)},setBackgroundColor:function(backgroundColor,callback){return this.__setBgOverlayColor("backgroundColor",backgroundColor,callback)},_setImageSmoothing:function(){var ctx=this.getContext();ctx.imageSmoothingEnabled=ctx.imageSmoothingEnabled||ctx.webkitImageSmoothingEnabled||ctx.mozImageSmoothingEnabled||ctx.msImageSmoothingEnabled||ctx.oImageSmoothingEnabled;ctx.imageSmoothingEnabled=this.imageSmoothingEnabled},__setBgOverlayImage:function(property,image,callback,options){return typeof image=="string"?fabric.util.loadImage(image,function(img){img&&(this[property]=new fabric.Image(img,options));callback&&callback(img)},this,options&&options.crossOrigin):(options&&image.setOptions(options),this[property]=image,callback&&callback(image)),this},__setBgOverlayColor:function(property,color,callback){return this[property]=color,this._initGradient(color,property),this._initPattern(color,property,callback),this},_createCanvasElement:function(){var element=fabric.util.createCanvasElement();if(!element)throw CANVAS_INIT_ERROR;if(element.style||(element.style={}),typeof element.getContext=="undefined")throw CANVAS_INIT_ERROR;return element},_initOptions:function(options){(this._setOptions(options),this.width=this.width||parseInt(this.lowerCanvasEl.width,10)||0,this.height=this.height||parseInt(this.lowerCanvasEl.height,10)||0,this.lowerCanvasEl.style)&&(this.lowerCanvasEl.width=this.width,this.lowerCanvasEl.height=this.height,this.lowerCanvasEl.style.width=this.width+"px",this.lowerCanvasEl.style.height=this.height+"px",this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(canvasEl){this.lowerCanvasEl=canvasEl&&canvasEl.getContext?canvasEl:fabric.util.getById(canvasEl)||this._createCanvasElement();fabric.util.addClass(this.lowerCanvasEl,"lower-canvas");this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl);this.contextContainer=this.lowerCanvasEl.getContext("2d")},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(value,options){return this.setDimensions({width:value},options)},setHeight:function(value,options){return this.setDimensions({height:value},options)},setDimensions:function(dimensions,options){var cssValue,prop;options=options||{};for(prop in dimensions)cssValue=dimensions[prop],options.cssOnly||(this._setBackstoreDimension(prop,dimensions[prop]),cssValue+="px",this.hasLostContext=!0),options.backstoreOnly||this._setCssDimension(prop,cssValue);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(),this._initRetinaScaling(),this._setImageSmoothing(),this.calcOffset(),options.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(prop,value){return this.lowerCanvasEl[prop]=value,this.upperCanvasEl&&(this.upperCanvasEl[prop]=value),this.cacheCanvasEl&&(this.cacheCanvasEl[prop]=value),this[prop]=value,this},_setCssDimension:function(prop,value){return this.lowerCanvasEl.style[prop]=value,this.upperCanvasEl&&(this.upperCanvasEl.style[prop]=value),this.wrapperEl&&(this.wrapperEl.style[prop]=value),this},getZoom:function(){return this.viewportTransform[0]}
14,setViewportTransform:function(vpt){var activeObject=this._activeObject,object,ignoreVpt=!1,skipAbsolute=!0,i,len;for(this.viewportTransform=vpt,i=0,len=this._objects.length;i<len;i++)object=this._objects[i],object.group||object.setCoords(ignoreVpt,skipAbsolute);return activeObject&&activeObject.type==="activeSelection"&&activeObject.setCoords(ignoreVpt,skipAbsolute),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(point,value){var before=point,vpt=this.viewportTransform.slice(0),after;return point=transformPoint(point,invertTransform(this.viewportTransform)),vpt[0]=value,vpt[3]=value,after=transformPoint(point,vpt),vpt[4]+=before.x-after.x,vpt[5]+=before.y-after.y,this.setViewportTransform(vpt)},setZoom:function(value){return this.zoomToPoint(new fabric.Point(0,0),value),this},absolutePan:function(point){var vpt=this.viewportTransform.slice(0);return vpt[4]=-point.x,vpt[5]=-point.y,this.setViewportTransform(vpt)},relativePan:function(point){return this.absolutePan(new fabric.Point(-point.x-this.viewportTransform[4],-point.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(obj){this.stateful&&obj.setupState();obj._set("canvas",this);obj.setCoords();this.fire("object:added",{target:obj});obj.fire("added")},_onObjectRemoved:function(obj){this.fire("object:removed",{target:obj});obj.fire("removed");delete obj.canvas},clearContext:function(ctx){return ctx.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this._objects.length=0,this.backgroundImage=null,this.overlayImage=null,this.backgroundColor="",this.overlayColor="",this._hasITextHandlers&&(this.off("mouse:up",this._mouseUpITextHandler),this._iTextInstances=null,this._hasITextHandlers=!1),this.clearContext(this.contextContainer),this.fire("canvas:cleared"),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var canvasToDrawOn=this.contextContainer;return this.renderCanvas(canvasToDrawOn,this._objects),this},renderAndReset:function(){this.isRendering=0;this.renderAll()},requestRenderAll:function(){return this.isRendering||(this.isRendering=fabric.util.requestAnimFrame(this.renderAndResetBound)),this},calcViewportBoundaries:function(){var points={},width=this.width,height=this.height,iVpt=invertTransform(this.viewportTransform);return points.tl=transformPoint({x:0,y:0},iVpt),points.br=transformPoint({x:width,y:height},iVpt),points.tr=new fabric.Point(points.br.x,points.tl.y),points.bl=new fabric.Point(points.tl.x,points.br.y),this.vptCoords=points,points},cancelRequestedRender:function(){this.isRendering&&(fabric.util.cancelAnimFrame(this.isRendering),this.isRendering=0)},renderCanvas:function(ctx,objects){var v=this.viewportTransform;this.cancelRequestedRender();this.calcViewportBoundaries();this.clearContext(ctx);this.fire("before:render");this.clipTo&&fabric.util.clipContext(this,ctx);this._renderBackground(ctx);ctx.save();ctx.transform(v[0],v[1],v[2],v[3],v[4],v[5]);this._renderObjects(ctx,objects);ctx.restore();!this.controlsAboveOverlay&&this.interactive&&this.drawControls(ctx);this.clipTo&&ctx.restore();this._renderOverlay(ctx);this.controlsAboveOverlay&&this.interactive&&this.drawControls(ctx);this.fire("after:render")},_renderObjects:function(ctx,objects){for(var i=0,len=objects.length;i<len;++i)objects[i]&&objects[i].render(ctx)},_renderBackgroundOrOverlay:function(ctx,property){var object=this[property+"Color"],v;object&&(ctx.fillStyle=object.toLive?object.toLive(ctx,this):object,ctx.fillRect(object.offsetX||0,object.offsetY||0,this.width,this.height));object=this[property+"Image"];object&&(this[property+"Vpt"]&&(v=this.viewportTransform,ctx.save(),ctx.transform(v[0],v[1],v[2],v[3],v[4],v[5])),object.render(ctx),this[property+"Vpt"]&&ctx.restore())},_renderBackground:function(ctx){this._renderBackgroundOrOverlay(ctx,"background")},_renderOverlay:function(ctx){this._renderBackgroundOrOverlay(ctx,"overlay")},getCenter:function(){return{top:this.height/2,left:this.width/2}},centerObjectH:function(object){return this._centerObject(object,new fabric.Point(this.getCenter().left,object.getCenterPoint().y))},centerObjectV:function(object){return this._centerObject(object,new fabric.Point(object.getCenterPoint().x,this.getCenter().top))},centerObject:function(object){var center=this.getCenter();return this._centerObject(object,new fabric.Point(center.left,center.top))},viewportCenterObject:function(object){var vpCenter=this.getVpCenter();return this._centerObject(object,vpCenter)},viewportCenterObjectH:function(object){var vpCenter=this.getVpCenter();return this._centerObject(object,new fabric.Point(vpCenter.x,object.getCenterPoint().y)),this},viewportCenterObjectV:function(object){var vpCenter=this.getVpCenter();return this._centerObject(object,new fabric.Point(object.getCenterPoint().x,vpCenter.y))},getVpCenter:function(){var center=this.getCenter(),iVpt=invertTransform(this.viewportTransform);return transformPoint({x:center.left,y:center.top},iVpt)},_centerObject:function(object,center){return object.setPositionByOrigin(center,"center","center"),object.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(propertiesToInclude){return this.toDatalessObject(propertiesToInclude)},toObject:function(propertiesToInclude){return this._toObjectMethod("toObject",propertiesToInclude)},toDatalessObject:function(propertiesToInclude){return this._toObjectMethod("toDatalessObject",propertiesToInclude)},_toObjectMethod:function(methodName,propertiesToInclude){var data={version:fabric.version,objects:this._toObjects(methodName,propertiesToInclude)};return extend(data,this.__serializeBgOverlay(methodName,propertiesToInclude)),fabric.util.populateWithProperties(this,data,propertiesToInclude),data},_toObjects:function(methodName,propertiesToInclude){return this._objects.filter(function(object){return!object.excludeFromExport}).map(function(instance){return this._toObject(instance,methodName,propertiesToInclude)},this)},_toObject:function(instance,methodName,propertiesToInclude){var originalValue,object;return this.includeDefaultValues||(originalValue=instance.includeDefaultValues,instance.includeDefaultValues=!1),object=instance[methodName](propertiesToInclude),this.includeDefaultValues||(instance.includeDefaultValues=originalValue),object},__serializeBgOverlay:function(methodName,propertiesToInclude){var data={},bgImage=this.backgroundImage,overlay=this.overlayImage;return this.backgroundColor&&(data.background=this.backgroundColor.toObject?this.backgroundColor.toObject(propertiesToInclude):this.backgroundColor),this.overlayColor&&(data.overlay=this.overlayColor.toObject?this.overlayColor.toObject(propertiesToInclude):this.overlayColor),bgImage&&!bgImage.excludeFromExport&&(data.backgroundImage=this._toObject(bgImage,methodName,propertiesToInclude)),overlay&&!overlay.excludeFromExport&&(data.overlayImage=this._toObject(overlay,methodName,propertiesToInclude)),data},svgViewportTransformation:!0,toSVG:function(options,reviver){options||(options={});var markup=[];return this._setSVGPreamble(markup,options),this._setSVGHeader(markup,options),this._setSVGBgOverlayColor(markup,"backgroundColor"),this._setSVGBgOverlayImage(markup,"backgroundImage",reviver),this._setSVGObjects(markup,reviver),this._setSVGBgOverlayColor(markup,"overlayColor"),this._setSVGBgOverlayImage(markup,"overlayImage",reviver),markup.push("<\/svg>"),markup.join("")},_setSVGPreamble:function(markup,options){options.suppressPreamble||markup.push('<?xml version="1.0" encoding="',options.encoding||"UTF-8",'" standalone="no" ?>\n','<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" ','"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')},_setSVGHeader:function(markup,options){var width=options.width||this.width,height=options.height||this.height,vpt,viewBox='viewB
14ox="0 0 '+this.width+" "+this.height+'" ',NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS;options.viewBox?viewBox='viewBox="'+options.viewBox.x+" "+options.viewBox.y+" "+options.viewBox.width+" "+options.viewBox.height+'" ':this.svgViewportTransformation&&(vpt=this.viewportTransform,viewBox='viewBox="'+toFixed(-vpt[4]/vpt[0],NUM_FRACTION_DIGITS)+" "+toFixed(-vpt[5]/vpt[3],NUM_FRACTION_DIGITS)+" "+toFixed(this.width/vpt[0],NUM_FRACTION_DIGITS)+" "+toFixed(this.height/vpt[3],NUM_FRACTION_DIGITS)+'" ');markup.push("<svg ",'xmlns="http://www.w3.org/2000/svg" ','xmlns:xlink="http://www.w3.org/1999/xlink" ','version="1.1" ','width="',width,'" ','height="',height,'" ',viewBox,'xml:space="preserve">\n',"<desc>Created with Fabric.js ",fabric.version,"<\/desc>\n","<defs>\n",this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),"<\/defs>\n")},createSVGRefElementsMarkup:function(){var _this=this,markup=["backgroundColor","overlayColor"].map(function(prop){var fill=_this[prop];if(fill&&fill.toLive)return fill.toSVG(_this,!1)});return markup.join("")},createSVGFontFacesMarkup:function(){for(var markup="",fontList={},obj,fontFamily,style,row,rowIndex,_char,charIndex,fontPaths=fabric.fontPaths,objects=this._objects,j,i=0,len=objects.length;i<len;i++)if((obj=objects[i],fontFamily=obj.fontFamily,obj.type.indexOf("text")!==-1&&!fontList[fontFamily]&&fontPaths[fontFamily])&&(fontList[fontFamily]=!0,obj.styles)){style=obj.styles;for(rowIndex in style){row=style[rowIndex];for(charIndex in row)_char=row[charIndex],fontFamily=_char.fontFamily,!fontList[fontFamily]&&fontPaths[fontFamily]&&(fontList[fontFamily]=!0)}}for(j in fontList)markup+=["\t\t@font-face {\n","\t\t\tfont-family: '",j,"';\n","\t\t\tsrc: url('",fontPaths[j],"');\n","\t\t}\n"].join("");return markup&&(markup=['\t<style type="text/css">',"<![CDATA[\n",markup,"]\]>","<\/style>\n"].join("")),markup},_setSVGObjects:function(markup,reviver){for(var instance,objects=this._objects,i=0,len=objects.length;i<len;i++)(instance=objects[i],instance.excludeFromExport)||this._setSVGObject(markup,instance,reviver)},_setSVGObject:function(markup,instance,reviver){markup.push(instance.toSVG(reviver))},_setSVGBgOverlayImage:function(markup,property,reviver){this[property]&&!this[property].excludeFromExport&&this[property].toSVG&&markup.push(this[property].toSVG(reviver))},_setSVGBgOverlayColor:function(markup,property){var filler=this[property],vpt=this.viewportTransform,finalWidth=this.width/vpt[0],finalHeight=this.height/vpt[3],repeat;filler&&(filler.toLive?(repeat=filler.repeat,markup.push('<rect transform="translate(',finalWidth/2,",",finalHeight/2,')"',' x="',filler.offsetX-finalWidth/2,'" y="',filler.offsetY-finalHeight/2,'" ','width="',repeat==="repeat-y"||repeat==="no-repeat"?filler.source.width:finalWidth,'" height="',repeat==="repeat-x"||repeat==="no-repeat"?filler.source.height:finalHeight,'" fill="url(#SVGID_'+filler.id+')"',"><\/rect>\n")):markup.push('<rect x="0" y="0" width="100%" height="100%" ','fill="',this[property],'"',"><\/rect>\n"))},sendToBack:function(object){if(!object)return this;var activeSelection=this._activeObject,i,obj,objs;if(object===activeSelection&&object.type==="activeSelection")for(objs=activeSelection._objects,i=objs.length;i--;)obj=objs[i],removeFromArray(this._objects,obj),this._objects.unshift(obj);else removeFromArray(this._objects,object),this._objects.unshift(object);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(object){if(!object)return this;var activeSelection=this._activeObject,i,obj,objs;if(object===activeSelection&&object.type==="activeSelection")for(objs=activeSelection._objects,i=0;i<objs.length;i++)obj=objs[i],removeFromArray(this._objects,obj),this._objects.push(obj);else removeFromArray(this._objects,object),this._objects.push(object);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(object,intersecting){if(!object)return this;var activeSelection=this._activeObject,i,obj,idx,newIdx,objs,objsMoved=0;if(object===activeSelection&&object.type==="activeSelection")for(objs=activeSelection._objects,i=0;i<objs.length;i++)obj=objs[i],idx=this._objects.indexOf(obj),idx>0+objsMoved&&(newIdx=idx-1,removeFromArray(this._objects,obj),this._objects.splice(newIdx,0,obj)),objsMoved++;else idx=this._objects.indexOf(object),idx!==0&&(newIdx=this._findNewLowerIndex(object,idx,intersecting),removeFromArray(this._objects,object),this._objects.splice(newIdx,0,object));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(object,idx,intersecting){var newIdx,i,isIntersecting;if(intersecting){for(newIdx=idx,i=idx-1;i>=0;--i)if(isIntersecting=object.intersectsWithObject(this._objects[i])||object.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(object),isIntersecting){newIdx=i;break}}else newIdx=idx-1;return newIdx},bringForward:function(object,intersecting){if(!object)return this;var activeSelection=this._activeObject,i,obj,idx,newIdx,objs,objsMoved=0;if(object===activeSelection&&object.type==="activeSelection")for(objs=activeSelection._objects,i=objs.length;i--;)obj=objs[i],idx=this._objects.indexOf(obj),idx<this._objects.length-1-objsMoved&&(newIdx=idx+1,removeFromArray(this._objects,obj),this._objects.splice(newIdx,0,obj)),objsMoved++;else idx=this._objects.indexOf(object),idx!==this._objects.length-1&&(newIdx=this._findNewUpperIndex(object,idx,intersecting),removeFromArray(this._objects,object),this._objects.splice(newIdx,0,object));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(object,idx,intersecting){var newIdx,i,len,isIntersecting;if(intersecting){for(newIdx=idx,i=idx+1,len=this._objects.length;i<len;++i)if(isIntersecting=object.intersectsWithObject(this._objects[i])||object.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(object),isIntersecting){newIdx=i;break}}else newIdx=idx+1;return newIdx},moveTo:function(object,index){return removeFromArray(this._objects,object),this._objects.splice(index,0,object),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&(fabric.util.cancelAnimFrame
14(this.isRendering),this.isRendering=0),this.forEachObject(function(object){object.dispose&&object.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,fabric.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=undefined,this},toString:function(){return"#<fabric.Canvas ("+this.complexity()+"): { objects: "+this._objects.length+" }>"}});extend(fabric.StaticCanvas.prototype,fabric.Observable);extend(fabric.StaticCanvas.prototype,fabric.Collection);extend(fabric.StaticCanvas.prototype,fabric.DataURLExporter);extend(fabric.StaticCanvas,{EMPTY_JSON:'{"objects": [], "background": "white"}',supports:function(methodName){var el=fabric.util.createCanvasElement(),ctx;if(!el||!el.getContext||(ctx=el.getContext("2d"),!ctx))return null;switch(methodName){case"getImageData":return typeof ctx.getImageData!="undefined";case"setLineDash":return typeof ctx.setLineDash!="undefined";case"toDataURL":return typeof el.toDataURL!="undefined";case"toDataURLWithQuality":try{return el.toDataURL("image/jpeg",0),!0}catch(e){}return!1;default:return null}}});fabric.StaticCanvas.prototype.toJSON=fabric.StaticCanvas.prototype.toObject;fabric.isLikelyNode&&(fabric.StaticCanvas.prototype.createPNGStream=function(){var impl=fabric.util.getNodeCanvas(this.lowerCanvasEl);return impl&&impl.createPNGStream()},fabric.StaticCanvas.prototype.createJPEGStream=function(opts){var impl=fabric.util.getNodeCanvas(this.lowerCanvasEl);return impl&&impl.createJPEGStream(opts)})}();fabric.BaseBrush=fabric.util.createClass({color:"rgb(0, 0, 0)",width:1,shadow:null,strokeLineCap:"round",strokeLineJoin:"round",strokeMiterLimit:10,strokeDashArray:null,setShadow:function(options){return this.shadow=new fabric.Shadow(options),this},_setBrushStyles:function(){var ctx=this.canvas.contextTop;ctx.strokeStyle=this.color;ctx.lineWidth=this.width;ctx.lineCap=this.strokeLineCap;ctx.miterLimit=this.strokeMiterLimit;ctx.lineJoin=this.strokeLineJoin;fabric.StaticCanvas.supports("setLineDash")&&ctx.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(ctx){var v=this.canvas.viewportTransform;ctx.save();ctx.transform(v[0],v[1],v[2],v[3],v[4],v[5])},_setShadow:function(){if(this.shadow){var ctx=this.canvas.contextTop,zoom=this.canvas.getZoom();ctx.shadowColor=this.shadow.color;ctx.shadowBlur=this.shadow.blur*zoom;ctx.shadowOffsetX=this.shadow.offsetX*zoom;ctx.shadowOffsetY=this.shadow.offsetY*zoom}},_resetShadow:function(){var ctx=this.canvas.contextTop;ctx.shadowColor="";ctx.shadowBlur=ctx.shadowOffsetX=ctx.shadowOffsetY=0}}),function(){fabric.PencilBrush=fabric.util.createClass(fabric.BaseBrush,{initialize:function(canvas){this.canvas=canvas;this._points=[]},_drawSegment:function(ctx,p1,p2){var midPoint=p1.midPointFrom(p2);return ctx.quadraticCurveTo(p1.x,p1.y,midPoint.x,midPoint.y),midPoint},onMouseDown:function(pointer){this._prepareForDrawing(pointer);this._captureDrawingPath(pointer);this._render()},onMouseMove:function(pointer){if(this._captureDrawingPath(pointer)&&this._points.length>1)if(this.needsFullRender)this.canvas.clearContext(this.canvas.contextTop),this._render();else{var points=this._points,length=points.length,ctx=this.canvas.contextTop;this._saveAndTransform(ctx);this.oldEnd&&(ctx.beginPath(),ctx.moveTo(this.oldEnd.x,this.oldEnd.y));this.oldEnd=this._drawSegment(ctx,points[length-2],points[length-1],!0);ctx.stroke();ctx.restore()}},onMouseUp:function(){this.oldEnd=undefined;this._finalizeAndAddPath()},_prepareForDrawing:function(pointer){var p=new fabric.Point(pointer.x,pointer.y);this._reset();this._addPoint(p);this.canvas.contextTop.moveTo(p.x,p.y)},_addPoint:function(point){return this._points.length>1&&point.eq(this._points[this._points.length-1])?!1:(this._points.push(point),!0)},_reset:function(){this._points.length=0;this._setBrushStyles();var color=new fabric.Color(this.color);this.needsFullRender=color.getAlpha()<1;this._setShadow()},_captureDrawingPath:function(pointer){var pointerPoint=new fabric.Point(pointer.x,pointer.y);return this._addPoint(pointerPoint)},_render:function(){var ctx=this.canvas.contextTop,i,len,p1=this._points[0],p2=this._points[1],width;for(this._saveAndTransform(ctx),ctx.beginPath(),this._points.length===2&&p1.x===p2.x&&p1.y===p2.y&&(width=this.width/1e3,p1=new fabric.Point(p1.x,p1.y),p2=new fabric.Point(p2.x,p2.y),p1.x-=width,p2.x+=width),ctx.moveTo(p1.x,p1.y),i=1,len=this._points.length;i<len;i++)this._drawSegment(ctx,p1,p2),p1=this._points[i],p2=this._points[i+1];ctx.lineTo(p1.x,p1.y);ctx.stroke();
14ctx.restore()},convertPointsToSVGPath:function(points){var path=[],i,width=this.width/1e3,p1=new fabric.Point(points[0].x,points[0].y),p2=new fabric.Point(points[1].x,points[1].y),len=points.length,multSignX=1,multSignY=1,manyPoints=len>2,midPoint;for(manyPoints&&(multSignX=points[2].x<p2.x?-1:points[2].x===p2.x?0:1,multSignY=points[2].y<p2.y?-1:points[2].y===p2.y?0:1),path.push("M ",p1.x-multSignX*width," ",p1.y-multSignY*width," "),i=1;i<len;i++)p1.eq(p2)||(midPoint=p1.midPointFrom(p2),path.push("Q ",p1.x," ",p1.y," ",midPoint.x," ",midPoint.y," ")),p1=points[i],i+1<points.length&&(p2=points[i+1]);return manyPoints&&(multSignX=p1.x>points[i-2].x?1:p1.x===points[i-2].x?0:-1,multSignY=p1.y>points[i-2].y?1:p1.y===points[i-2].y?0:-1),path.push("L ",p1.x+multSignX*width," ",p1.y+multSignY*width),path},createPath:function(pathData){var path=new fabric.Path(pathData,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray}),position=new fabric.Point(path.left+path.width/2,path.top+path.height/2);return position=path.translateToGivenOrigin(position,"center","center",path.originX,path.originY),path.top=position.y,path.left=position.x,this.shadow&&(this.shadow.affectStroke=!0,path.setShadow(this.shadow)),path},_finalizeAndAddPath:function(){var ctx=this.canvas.contextTop,pathData,path;if(ctx.closePath(),pathData=this.convertPointsToSVGPath(this._points).join(""),pathData==="M 0 0 Q 0 0 0 0 L 0 0"){this.canvas.requestRenderAll();return}path=this.createPath(pathData);this.canvas.clearContext(this.canvas.contextTop);this.canvas.add(path);this.canvas.renderAll();path.setCoords();this._resetShadow();this.canvas.fire("path:created",{path:path})}})}();fabric.CircleBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,initialize:function(canvas){this.canvas=canvas;this.points=[]},drawDot:function(pointer){var point=this.addPoint(pointer),ctx=this.canvas.contextTop;this._saveAndTransform(ctx);ctx.fillStyle=point.fill;ctx.beginPath();ctx.arc(point.x,point.y,point.radius,0,Math.PI*2,!1);ctx.closePath();ctx.fill();ctx.restore()},onMouseDown:function(pointer){this.points.length=0;this.canvas.clearContext(this.canvas.contextTop);this._setShadow();this.drawDot(pointer)},_render:function(){var ctx=this.canvas.contextTop,i,len,points=this.points,point;for(this._saveAndTransform(ctx),i=0,len=points.length;i<len;i++)point=points[i],ctx.fillStyle=point.fill,ctx.beginPath(),ctx.arc(point.x,point.y,point.radius,0,Math.PI*2,!1),ctx.closePath(),ctx.fill();ctx.restore()},onMouseMove:function(pointer){this.drawDot(pointer)},onMouseUp:function(){var originalRenderOnAddRemove=this.canvas.renderOnAddRemove,i,len,circles,point,circle,group;for(this.canvas.renderOnAddRemove=!1,circles=[],i=0,len=this.points.length;i<len;i++)point=this.points[i],circle=new fabric.Circle({radius:point.radius,left:point.x,top:point.y,originX:"center",originY:"center",fill:point.fill}),this.shadow&&circle.setShadow(this.shadow),circles.push(circle);group=new fabric.Group(circles);group.canvas=this.canvas;this.canvas.add(group);this.canvas.fire("path:created",{path:group});this.canvas.clearContext(this.canvas.contextTop);this._resetShadow();this.canvas.renderOnAddRemove=originalRenderOnAddRemove;this.canvas.requestRenderAll()},addPoint:function(pointer){var pointerPoint=new fabric.Point(pointer.x,pointer.y),circleRadius=fabric.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,circleColor=new fabric.Color(this.color).setAlpha(fabric.util.getRandomInt(0,100)/100).toRgba();return pointerPoint.radius=circleRadius,pointerPoint.fill=circleColor,this.points.push(pointerPoint),pointerPoint}});fabric.SprayBrush=fabric.util.createClass(fabric.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(canvas){this.canvas=canvas;this.sprayChunks=[]},onMouseDown:function(pointer){this.sprayChunks.length=0;this.canvas.clearContext(this.canvas.contextTop);this._setShadow();this.addSprayChunk(pointer);this.render(this.sprayChunkPoints)},onMouseMove:function(pointer){this.addSprayChunk(pointer);this.render(this.sprayChunkPoints)},onMouseUp:function(){var originalRenderOnAddRemove=this.canvas.renderOnAddRemove,rects,i,ilen,sprayChunk,j,jlen,rect,group;for(this.canvas.renderOnAddRemove=!1,rects=[],i=0,ilen=this.sprayChunks.length;i<ilen;i++)for(sprayChunk=this.sprayChunks[i],j=0,jlen=sprayChunk.length;j<jlen;j++)rect=new fabric.Rect({width:sprayChunk[j].width,height:sprayChunk[j].width,left:sprayChunk[j].x+1,top:sprayChunk[j].y+1,originX:"center",originY:"center",fill:this.color}),rects.push(rect);this.optimizeOverlapping&&(rects=this._getOptimizedRects(rects));group=new fabric.Group(rects);this.shadow&&group.setShadow(this.shadow);this.canvas.add(group);this.canvas.fire("path:created",{path:group});this.canvas.clearContext(this.canvas.contextTop);this._resetShadow();this.canvas.renderOnAddRemove=originalRenderOnAddRemove;this.canvas.requestRenderAll()},_getOptimizedRects:function(rects){for(var uniqueRects={},key,uniqueRectsArray,i=0,len=rects.length;i<len;i++)key=rects[i].left+""+rects[i].top,uniqueRects[key]||(uniqueRects[key]=rects[i]);uniqueRectsArray=[];for(key in uniqueRects)uniqueRectsArray.push(uniqueRects[key]);return uniqueRectsArray},render:function(sprayChunk){var ctx=this.canvas.contextTop,i,len,point;for(ctx.fillStyle=this.color,this._saveAndTransform(ctx),i=0,len=sprayChunk.length;i<len;i++)point=sprayChunk[i],typeof point.opacity!="undefined"&&(ctx.globalAlpha=point.opacity),ctx.fillRect(point.x,point.y,point.width,point.width);
14ctx.restore()},_render:function(){var ctx=this.canvas.contextTop,i,ilen;for(ctx.fillStyle=this.color,this._saveAndTransform(ctx),i=0,ilen=this.sprayChunks.length;i<ilen;i++)this.render(this.sprayChunks[i]);ctx.restore()},addSprayChunk:function(pointer){var x,y,width,radius,i,point;for(this.sprayChunkPoints=[],radius=this.width/2,i=0;i<this.density;i++)x=fabric.util.getRandomInt(pointer.x-radius,pointer.x+radius),y=fabric.util.getRandomInt(pointer.y-radius,pointer.y+radius),width=this.dotWidthVariance?fabric.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth,point=new fabric.Point(x,y),point.width=width,this.randomOpacity&&(point.opacity=fabric.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(point);this.sprayChunks.push(this.sprayChunkPoints)}});fabric.PatternBrush=fabric.util.createClass(fabric.PencilBrush,{getPatternSrc:function(){var dotWidth=20,patternCanvas=fabric.util.createCanvasElement(),patternCtx=patternCanvas.getContext("2d");return patternCanvas.width=patternCanvas.height=dotWidth+5,patternCtx.fillStyle=this.color,patternCtx.beginPath(),patternCtx.arc(dotWidth/2,dotWidth/2,dotWidth/2,0,Math.PI*2,!1),patternCtx.closePath(),patternCtx.fill(),patternCanvas},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace("this.color",'"'+this.color+'"')},getPattern:function(){return this.canvas.contextTop.createPattern(this.source||this.getPatternSrc(),"repeat")},_setBrushStyles:function(){this.callSuper("_setBrushStyles");this.canvas.contextTop.strokeStyle=this.getPattern()},createPath:function(pathData){var path=this.callSuper("createPath",pathData),topLeft=path._getLeftTopCoords().scalarAdd(path.strokeWidth/2);return path.stroke=new fabric.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-topLeft.x,offsetY:-topLeft.y}),path}}),function(){var getPointer=fabric.util.getPointer,degreesToRadians=fabric.util.degreesToRadians,radiansToDegrees=fabric.util.radiansToDegrees,atan2=Math.atan2,abs=Math.abs,supportLineDash=fabric.StaticCanvas.supports("setLineDash"),STROKE_OFFSET=.5,prop;fabric.Canvas=fabric.util.createClass(fabric.StaticCanvas,{initialize:function(el,options){options||(options={});this.renderAndResetBound=this.renderAndReset.bind(this);this.requestRenderAllBound=this.requestRenderAll.bind(this);this._initStatic(el,options);this._initInteractive();this._createCacheCanvas()},uniScaleTransform:!1,uniScaleKey:"shiftKey",centeredScaling:!1,centeredRotation:!1,centeredKey:"altKey",altActionKey:"shiftKey",interactive:!0,selection:!0,selectionKey:"shiftKey",altSelectionKey:null,selectionColor:"rgba(100, 100, 255, 0.3)",selectionDashArray:[],selectionBorderColor:"rgba(255, 255, 255, 0.3)",selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:"move",moveCursor:"move",defaultCursor:"default",freeDrawingCursor:"crosshair",rotationCursor:"crosshair",notAllowedCursor:"not-allowed",containerClass:"canvas-container",perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,_initInteractive:function(){this._currentTransform=null;this._groupSelector=null;this._initWrapperElement();this._createUpperCanvas();this._initEventListeners();this._initRetinaScaling();this.freeDrawingBrush=fabric.PencilBrush&&new fabric.PencilBrush(this);this.calcOffset()},_chooseObjectsToRender:function(){var activeObjects=this.getActiveObjects(),object,objsToRender,activeGroupObjects,i,length;if(activeObjects.length>0&&!this.preserveObjectStacking){for(objsToRender=[],activeGroupObjects=[],i=0,length=this._objects.length;i<length;i++)object=this._objects[i],activeObjects.indexOf(object)===-1?objsToRender.push(object):activeGroupObjects.push(object);activeObjects.length>1&&(this._activeObject._objects=activeGroupObjects);objsToRender.push.apply(objsToRender,activeGroupObjects)}else objsToRender=this._objects;return objsToRender},renderAll:function(){!this.contextTopDirty||this._groupSelector||this.isDrawingMode||(this.clearContext(this.contextTop),this.contextTopDirty=!1);this.hasLostContext&&this.renderTopLayer(this.contextTop);var canvasToDrawOn=this.contextContainer;return this.renderCanvas(canvasToDrawOn,this._chooseObjectsToRender()),this},renderTopLayer:function(ctx){this.isDrawingMode&&this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._render();this.selection&&this._groupSelector&&this._drawSelection(ctx)},renderTop:function(){var ctx=this.contextTop;return this.clearContext(ctx),this.renderTopLayer(ctx),this.fire("after:render"),this.contextTopDirty=!0,this},_resetCurrentTransform:function(){var t=this._currentTransform;t.target.set({scaleX:t.original.scaleX,scaleY:t.original.scaleY,skewX:t.original.skewX,skewY:t.original.skewY,left:t.original.left,top:t.original.top});this._shouldCenterTransform(t.target)?(t.originX!=="center"&&(t.mouseXSign=t.originX==="right"?-1:1),t.originY!=="center"&&(t.mouseYSign=t.originY==="bottom"?-1:1),t.originX="center",t.originY="center"):(t.originX=t.original.originX,t.originY=t.original.originY)},containsPoint:function(e,target,point){var pointer=point||this.getPointer(e,!0),xy;return xy=target.group&&target.group===this._activeObject&&target.group.type==="activeSelection"?this._normalizePointer(target.group,pointer):{x:pointer.x,y:p
14ointer.y},target.containsPoint(xy)||target._findTargetCorner(pointer)},_normalizePointer:function(object,pointer){var m=object.calcTransformMatrix(),invertedM=fabric.util.invertTransform(m),vptPointer=this.restorePointerVpt(pointer);return fabric.util.transformPoint(vptPointer,invertedM)},isTargetTransparent:function(target,x,y){var isTransparent;if(target.shouldCache()&&target._cacheCanvas){var normalizedPointer=this._normalizePointer(target,{x:x,y:y}),targetRelativeX=target.cacheTranslationX+normalizedPointer.x*target.zoomX,targetRelativeY=target.cacheTranslationY+normalizedPointer.y*target.zoomY,isTransparent=fabric.util.isTransparent(target._cacheContext,targetRelativeX,targetRelativeY,this.targetFindTolerance);return isTransparent}var ctx=this.contextCache,originalColor=target.selectionBackgroundColor,v=this.viewportTransform;return target.selectionBackgroundColor="",this.clearContext(ctx),ctx.save(),ctx.transform(v[0],v[1],v[2],v[3],v[4],v[5]),target.render(ctx),ctx.restore(),target===this._activeObject&&target._renderControls(ctx,{hasBorders:!1,transparentCorners:!1},{hasBorders:!1}),target.selectionBackgroundColor=originalColor,fabric.util.isTransparent(ctx,x,y,this.targetFindTolerance)},_isSelectionKeyPressed:function(e){return Object.prototype.toString.call(this.selectionKey)==="[object Array]"?!!this.selectionKey.find(function(key){return e[key]===!0}):e[this.selectionKey]},_shouldClearSelection:function(e,target){var activeObjects=this.getActiveObjects(),activeObject=this._activeObject;return!target||target&&activeObject&&activeObjects.length>1&&activeObjects.indexOf(target)===-1&&activeObject!==target&&!this._isSelectionKeyPressed(e)||target&&!target.evented||target&&!target.selectable&&activeObject&&activeObject!==target},_shouldCenterTransform:function(target){if(target){var t=this._currentTransform,centerTransform;return t.action==="scale"||t.action==="scaleX"||t.action==="scaleY"?centerTransform=this.centeredScaling||target.centeredScaling:t.action==="rotate"&&(centerTransform=this.centeredRotation||target.centeredRotation),centerTransform?!t.altKey:t.altKey}},_getOriginFromCorner:function(target,corner){var origin={x:target.originX,y:target.originY};return corner==="ml"||corner==="tl"||corner==="bl"?origin.x="right":(corner==="mr"||corner==="tr"||corner==="br")&&(origin.x="left"),corner==="tl"||corner==="mt"||corner==="tr"?origin.y="bottom":(corner==="bl"||corner==="mb"||corner==="br")&&(origin.y="top"),origin},_getActionFromCorner:function(target,corner,e){if(!corner)return"drag";switch(corner){case"mtr":return"rotate";case"ml":case"mr":return e[this.altActionKey]?"skewY":"scaleX";case"mt":case"mb":return e[this.altActionKey]?"skewX":"scaleY";default:return"scale"}},_setupCurrentTransform:function(e,target){if(target){var pointer=this.getPointer(e),corner=target._findTargetCorner(this.getPointer(e,!0)),action=this._getActionFromCorner(target,corner,e),origin=this._getOriginFromCorner(target,corner);this._currentTransform={target:target,action:action,corner:corner,scaleX:target.scaleX,scaleY:target.scaleY,skewX:target.skewX,skewY:target.skewY,offsetX:pointer.x-target.left,offsetY:pointer.y-target.top,originX:origin.x,originY:origin.y,ex:pointer.x,ey:pointer.y,lastX:pointer.x,lastY:pointer.y,theta:degreesToRadians(target.angle),width:target.width*target.scaleX,mouseXSign:1,mouseYSign:1,shiftKey:e.shiftKey,altKey:e[this.centeredKey],original:fabric.util.saveObjectTransform(target)};this._currentTransform.original.originX=origin.x;this._currentTransform.original.originY=origin.y;this._resetCurrentTransform();this._beforeTransform(e)}},_translateObject:function(x,y){var transform=this._currentTransform,target=transform.target,newLeft=x-transform.offsetX,newTop=y-transform.offsetY,moveX=!target.get("lockMovementX")&&target.left!==newLeft,moveY=!target.get("lockMovementY")&&target.top!==newTop;return moveX&&target.set("left",newLeft),moveY&&target.set("top",newTop),moveX||moveY},_changeSkewTransformOrigin:function(mouseMove,t,by){var property="originX",origins={0:"center"},skew=t.target.skewX,originA="left",originB="right",corner=t.corner==="mt"||t.corner==="ml"?1:-1,flipSign=1;mouseMove=mouseMove>0?1:-1;by==="y"&&(skew=t.target.skewY,originA="top",originB="bottom",property="originY");origins[-1]=originA;origins[1]=originB;t.target.flipX&&(flipSign*=-1);t.target.flipY&&(flipSign*=-1);skew===0?(t.skewSign=-corner*mouseMove*flipSign,t[property]=origins[-mouseMove]):(skew=skew>0?1:-1,t.skewSign=skew,t[property]=origins[skew*corner*flipSign])},_skewObject:function(x,y,by){var t=this._currentTransform,target=t.target,skewed=!1,lockSkewingX=target.get("lockSkewingX"),lockSkewingY=target.get("lockSkewingY");
14if(lockSkewingX&&by==="x"||lockSkewingY&&by==="y")return!1;var center=target.getCenterPoint(),actualMouseByCenter=target.toLocalPoint(new fabric.Point(x,y),"center","center")[by],lastMouseByCenter=target.toLocalPoint(new fabric.Point(t.lastX,t.lastY),"center","center")[by],actualMouseByOrigin,constraintPosition,dim=target._getTransformedDimensions();return this._changeSkewTransformOrigin(actualMouseByCenter-lastMouseByCenter,t,by),actualMouseByOrigin=target.toLocalPoint(new fabric.Point(x,y),t.originX,t.originY)[by],constraintPosition=target.translateToOriginPoint(center,t.originX,t.originY),skewed=this._setObjectSkew(actualMouseByOrigin,t,by,dim),t.lastX=x,t.lastY=y,target.setPositionByOrigin(constraintPosition,t.originX,t.originY),skewed},_setObjectSkew:function(localMouse,transform,by,_dim){var target=transform.target,newValue,skewed=!1,skewSign=transform.skewSign,newDim,dimNoSkew,otherBy,_otherBy,_by,newDimMouse,skewX,skewY;return by==="x"?(otherBy="y",_otherBy="Y",_by="X",skewX=0,skewY=target.skewY):(otherBy="x",_otherBy="X",_by="Y",skewX=target.skewX,skewY=0),dimNoSkew=target._getTransformedDimensions(skewX,skewY),newDimMouse=2*Math.abs(localMouse)-dimNoSkew[by],newDimMouse<=2?newValue=0:(newValue=skewSign*Math.atan(newDimMouse/target["scale"+_by]/(dimNoSkew[otherBy]/target["scale"+_otherBy])),newValue=fabric.util.radiansToDegrees(newValue)),skewed=target["skew"+_by]!==newValue,target.set("skew"+_by,newValue),target["skew"+_otherBy]!==0&&(newDim=target._getTransformedDimensions(),newValue=_dim[otherBy]/newDim[otherBy]*target["scale"+_otherBy],target.set("scale"+_otherBy,newValue)),skewed},_scaleObject:function(x,y,by){var t=this._currentTransform,target=t.target,lockScalingX=target.lockScalingX,lockScalingY=target.lockScalingY,lockScalingFlip=target.lockScalingFlip;if(lockScalingX&&lockScalingY)return!1;var constraintPosition=target.translateToOriginPoint(target.getCenterPoint(),t.originX,t.originY),localMouse=target.toLocalPoint(new fabric.Point(x,y),t.originX,t.originY),dim=target._getTransformedDimensions(),scaled=!1;return this._setLocalMouse(localMouse,t),scaled=this._setObjectScale(localMouse,t,lockScalingX,lockScalingY,by,lockScalingFlip,dim),target.setPositionByOrigin(constraintPosition,t.originX,t.originY),scaled},_setObjectScale:function(localMouse,transform,lockScalingX,lockScalingY,by,lockScalingFlip,_dim){var target=transform.target,forbidScalingX=!1,forbidScalingY=!1,scaled=!1,changeX,changeY,scaleX,scaleY;return scaleX=localMouse.x*target.scaleX/_dim.x,scaleY=localMouse.y*target.scaleY/_dim.y,changeX=target.scaleX!==scaleX,changeY=target.scaleY!==scaleY,lockScalingFlip&&scaleX<=0&&scaleX<target.scaleX&&(forbidScalingX=!0,localMouse.x=0),lockScalingFlip&&scaleY<=0&&scaleY<target.scaleY&&(forbidScalingY=!0,localMouse.y=0),by!=="equally"||lockScalingX||lockScalingY?by?by!=="x"||target.get("lockUniScaling")?by!=="y"||target.get("lockUniScaling")||forbidScalingY||lockScalingY||target.set("scaleY",scaleY)&&(scaled=scaled||changeY):forbidScalingX||lockScalingX||target.set("scaleX",scaleX)&&(scaled=scaled||changeX):(forbidScalingX||lockScalingX||target.set("scaleX",scaleX)&&(scaled=scaled||changeX),forbidScalingY||lockScalingY||target.set("scaleY",scaleY)&&(scaled=scaled||changeY)):scaled=this._scaleObjectEqually(localMouse,target,transform,_dim),transform.newScaleX=scaleX,transform.newScaleY=scaleY,forbidScalingX||forbidScalingY||this._flipObject(transform,by),scaled},_scaleObjectEqually:function(localMouse,target,transform,_dim){var dist=localMouse.y+localMouse.x,lastDist=_dim.y*transform.original.scaleY/target.scaleY+_dim.x*transform.original.scaleX/target.scaleX,scaled,signX=localMouse.x<0?-1:1,signY=localMouse.y<0?-1:1;return transform.newScaleX=signX*Math.abs(transform.original.scaleX*dist/lastDist),transform.newScaleY=signY*Math.abs(transform.original.scaleY*dist/lastDist),scaled=transform.newScaleX!==target.scaleX||transform.newScaleY!==target.scaleY,target.set("scaleX",transform.newScaleX),target.set("scaleY",transform.newScaleY),scaled},_flipObject:function(transform,by){transform.newScaleX<0&&by!=="y"&&(transform.originX==="left"?transform.originX="right":transform.originX==="right"&&(transform.originX="left"));transform.newScaleY<0&&by!=="x"&&(transform.originY==="top"?transform.originY="bottom":transform.originY==="bottom"&&(transform.originY="top"))},_setLocalMouse:function(localMouse,t){var target=t.target,zoom=this.getZoom(),padding=target.padding/zoom;t.originX==="right"?localMouse.x*=-1:t.originX==="center"&&(localMouse.x*=t.mouseXSign*2,localMouse.x<0&&(t.mouseXSign=-t.mouseXSign));t.originY==="bottom"?localMouse.y*=-1:t.originY==="center"&&(localMouse.y*=t.mouseYSign*2,localMouse.y<0&&(t.mouseYSign=-t.mouseYSign));abs(localMouse.x)>padding?localMouse.x<0?localMouse.x+=padding:localMouse.x-=padding:localMouse.x=0;abs(localMouse.y)>padding?localMouse.y<0?localMouse.y+=padding:localMouse.y-=padding:localMouse.y=0},_rotateObject:function(x,y){var t=this._currentTransform,target=t.target,constraintPosition=target.translateToOriginPoint(target.getCenterPoint(),t.originX,t.originY);if(target.lockRotation)return!1;var lastAngle=atan2(t.ey-constraintPosition.y,t.ex-constraintPosition.x),curAngle=atan2(y-constraintPosition.y,x-constraintPosition.x),angle=radiansToDegrees(curAngle-lastAngle+t.theta),hasRotated=!0;if(target.snapAngle>0){var snapAngle=target.snapAngle,snapThreshold=target.snapThreshold||snapAngle,rightAngleLocked=Math.ceil(angle/snapAngle)*snapAngle,leftAngleLocked=Math.floor(angle/snapAngle)*snapAngle;Math.abs(angle-leftAngleLocked)<snapThreshold?angle=leftAngleLocked:Math.abs(angle-rightAngleLocked)<snapThreshold&&(angle=rightAngleLocked)}return angle<0&&(angle=360+angle),angle%=360,target.angle===angle?hasRotated=!1:(target.angle=angle,target.setPositionByOrigin(constraintPosition,t.originX,t.originY)),hasRotated}
14,setCursor:function(value){this.upperCanvasEl.style.cursor=value},_drawSelection:function(ctx){var groupSelector=this._groupSelector,left=groupSelector.left,top=groupSelector.top,aleft=abs(left),atop=abs(top),px,py;(this.selectionColor&&(ctx.fillStyle=this.selectionColor,ctx.fillRect(groupSelector.ex-(left>0?0:-left),groupSelector.ey-(top>0?0:-top),aleft,atop)),this.selectionLineWidth&&this.selectionBorderColor)&&(ctx.lineWidth=this.selectionLineWidth,ctx.strokeStyle=this.selectionBorderColor,this.selectionDashArray.length>1&&!supportLineDash?(px=groupSelector.ex+STROKE_OFFSET-(left>0?0:aleft),py=groupSelector.ey+STROKE_OFFSET-(top>0?0:atop),ctx.beginPath(),fabric.util.drawDashedLine(ctx,px,py,px+aleft,py,this.selectionDashArray),fabric.util.drawDashedLine(ctx,px,py+atop-1,px+aleft,py+atop-1,this.selectionDashArray),fabric.util.drawDashedLine(ctx,px,py,px,py+atop,this.selectionDashArray),fabric.util.drawDashedLine(ctx,px+aleft-1,py,px+aleft-1,py+atop,this.selectionDashArray),ctx.closePath(),ctx.stroke()):(fabric.Object.prototype._setLineDash.call(this,ctx,this.selectionDashArray),ctx.strokeRect(groupSelector.ex+STROKE_OFFSET-(left>0?0:aleft),groupSelector.ey+STROKE_OFFSET-(top>0?0:atop),aleft,atop)))},findTarget:function(e,skipGroup){var target;if(!this.skipTargetFind){var pointer=this.getPointer(e,!0),activeObject=this._activeObject,aObjects=this.getActiveObjects(),activeTarget,activeTargetSubs;if((this.targets=[],aObjects.length>1&&!skipGroup&&activeObject===this._searchPossibleTargets([activeObject],pointer))||aObjects.length===1&&activeObject._findTargetCorner(pointer))return activeObject;if(aObjects.length===1&&activeObject===this._searchPossibleTargets([activeObject],pointer))if(this.preserveObjectStacking)activeTarget=activeObject,activeTargetSubs=this.targets,this.targets=[];else return activeObject;return target=this._searchPossibleTargets(this._objects,pointer),e[this.altSelectionKey]&&target&&activeTarget&&target!==activeTarget&&(target=activeTarget,this.targets=activeTargetSubs),target}},_checkTarget:function(pointer,obj){if(obj&&obj.visible&&obj.evented&&this.containsPoint(null,obj,pointer))if((this.perPixelTargetFind||obj.perPixelTargetFind)&&!obj.isEditing){var isTransparent=this.isTargetTransparent
14(obj,pointer.x,pointer.y);if(!isTransparent)return!0}else return!0},_searchPossibleTargets:function(objects,pointer){for(var target,i=objects.length,normalizedPointer,subTarget;i--;)if(this._checkTarget(pointer,objects[i])){target=objects[i];target.subTargetCheck&&target instanceof fabric.Group&&(normalizedPointer=this._normalizePointer(target,pointer),subTarget=this._searchPossibleTargets(target._objects,normalizedPointer),subTarget&&this.targets.push(subTarget));break}return target},restorePointerVpt:function(pointer){return fabric.util.transformPoint(pointer,fabric.util.invertTransform(this.viewportTransform))},getPointer:function(e,ignoreZoom){if(this._absolutePointer&&!ignoreZoom)return this._absolutePointer;if(this._pointer&&ignoreZoom)return this._pointer;var pointer=getPointer(e),upperCanvasEl=this.upperCanvasEl,bounds=upperCanvasEl.getBoundingClientRect(),boundsWidth=bounds.width||0,boundsHeight=bounds.height||0,cssScale;return boundsWidth&&boundsHeight||("top"in bounds&&"bottom"in bounds&&(boundsHeight=Math.abs(bounds.top-bounds.bottom)),"right"in bounds&&"left"in bounds&&(boundsWidth=Math.abs(bounds.right-bounds.left))),this.calcOffset(),pointer.x=pointer.x-this._offset.left,pointer.y=pointer.y-this._offset.top,ignoreZoom||(pointer=this.restorePointerVpt(pointer)),cssScale=boundsWidth===0||boundsHeight===0?{width:1,height:1}:{width:upperCanvasEl.width/boundsWidth,height:upperCanvasEl.height/boundsHeight},{x:pointer.x*cssScale.width,y:pointer.y*cssScale.height}},_createUpperCanvas:function(){var lowerCanvasClass=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,"");this.upperCanvasEl?this.upperCanvasEl.className="":this.upperCanvasEl=this._createCanvasElement();fabric.util.addClass(this.upperCanvasEl,"upper-canvas "+lowerCanvasClass);this.wrapperEl.appendChild(this.upperCanvasEl);this._copyCanvasStyle(this.lowerCanvasEl,this.upperCanvasEl);this._applyCanvasStyle(this.upperCanvasEl);this.contextTop=this.upperCanvasEl.getContext("2d")},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement();this.cacheCanvasEl.setAttribute("width",this.width);this.cacheCanvasEl.setAttribute("height",this.height);this.contextCache=this.cacheCanvasEl.getContext("2d")},_initWrapperElement:function(){this.wrapperEl=fabric.util.wrapElement(this.lowerCanvasEl,"div",{"class":this.containerClass});fabric.util.setStyle(this.wrapperEl,{width:this.width+"px",height:this.height+"px",position:"relative"});fabric.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(element){var width=this.width||element.width,height=this.height||element.height;fabric.util.setStyle(element,{position:"absolute",width:width+"px",height:height+"px",left:0,top:0,"touch-action":this.allowTouchScrolling?"manipulation":"none"});element.width=width;element.height=height;fabric.util.makeElementUnselectable(element)},_copyCanvasStyle:function(fromEl,toEl){toEl.style.cssText=fromEl.style.cssText},getSelectionContext:function(){return this.contextTop}
14,getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var active=this._activeObject;return active?active.type==="activeSelection"&&active._objects?active._objects.slice(0):[active]:[]},_onObjectRemoved:function(obj){obj===this._activeObject&&(this.fire("before:selection:cleared",{target:obj}),this._discardActiveObject(),this.fire("selection:cleared",{target:obj}),obj.fire("deselected"));this._hoveredTarget===obj&&(this._hoveredTarget=null);this.callSuper("_onObjectRemoved",obj)},_fireSelectionEvents:function(oldObjects,e){var somethingChanged=!1,objects=this.getActiveObjects(),added=[],removed=[],opt={e:e};oldObjects.forEach(function(oldObject){objects.indexOf(oldObject)===-1&&(somethingChanged=!0,oldObject.fire("deselected",opt),removed.push(oldObject))});objects.forEach(function(object){oldObjects.indexOf(object)===-1&&(somethingChanged=!0,object.fire("selected",opt),added.push(object))});oldObjects.length>0&&objects.length>0?(opt.selected=added,opt.deselected=removed,opt.updated=added[0]||removed[0],opt.target=this._activeObject,somethingChanged&&this.fire("selection:updated",opt)):objects.length>0?(objects.length===1&&(opt.target=added[0],this.fire("object:selected",opt)),opt.selected=added,opt.target=this._activeObject,this.fire("selection:created",opt)):oldObjects.length>0&&(opt.deselected=removed,this.fire("selection:cleared",opt))},setActiveObject:function(object,e){var currentActives=this.getActiveObjects();return this._setActiveObject(object,e),this._fireSelectionEvents(currentActives,e),this},_setActiveObject:function(object,e){return this._activeObject===object?!1:this._discardActiveObject(e,object)?object.onSelect({e:e})?!1:(this._activeObject=object,!0):!1},_discardActiveObject:function(e,object){var obj=this._activeObject;if(obj){if(obj.onDeselect({e:e,object:object}))return!1;this._activeObject=null}return!0},discardActiveObject:function(e){var currentActives=this.getActiveObjects();return currentActives.length&&this.fire("before:selection:cleared",{target:currentActives[0],e:e}),this._discardActiveObject(e),this._fireSelectionEvents(currentActives,e),this},dispose:function(){var wrapper=this.wrapperEl;return this.removeListeners(),wrapper.removeChild(this.upperCanvasEl),wrapper.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,["upperCanvasEl","cacheCanvasEl"].forEach(function(element){fabric.util.cleanUpJsdomNode(this[element]);this[element]=undefined}.bind(this)),wrapper.parentNode&&wrapper.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,fabric.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper("clear")},drawControls:function(ctx){var activeObject=this._activeObject;activeObject&&activeObject._renderControls(ctx)},_toObject:function(instance,methodName,propertiesToInclude){var originalProperties=this._realizeGroupTransformOnObject(instance),object=this.callSuper("_toObject",instance,methodName,propertiesToInclude);return this._unwindGroupTransformOnObject(instance,originalProperties),object},_realizeGroupTransformOnObject:function(instance){if(instance.group&&instance.group.type==="activeSelection"&&this._activeObject===instance.group){var originalValues={};return["angle","flipX","flipY","left","scaleX","scaleY","skewX","skewY","top"].forEach(function(prop){originalValues[prop]=instance[prop]}),this._activeObject.realizeTransform(instance),originalValues}return null},_unwindGroupTransformOnObject:function(instance,originalValues){originalValues&&instance.set(originalValues)},_setSVGObject:function(markup,instance,reviver){var originalProperties=this._realizeGroupTransformOnObject(instance);this.callSuper("_setSVGObject",markup,instance,reviver);this._unwindGroupTransformOnObject(instance,originalProperties)},setViewportTransform:function(vpt){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop();fabric.StaticCanvas.prototype.setViewportTransform.call(this,vpt)}});for(prop in fabric.StaticCanvas)prop!=="prototype"&&(fabric.Canvas[prop]=fabric.StaticCanvas[prop]);fabric.isTouchSupported&&(fabric.Canvas.prototype._setCursorFromEvent=function(){})}(),function(){function checkClick(e,value){return"which"in e?e.which===value:e.button===value-1}var cursorOffset={mt:0,tr:1,mr:2,br:3,mb:4,bl:5,ml:6,tl:7},addListener=fabric.util.addListener,removeListener=fabric.util.removeListener,RIGHT_CLICK=3,MIDDLE_CLICK=2,LEFT_CLICK=1,addEventOptions={passive:!1};fabric.util.object.extend(fabric.Canvas.prototype,{cursorMap:["n-resize","ne-resize","e-resize","se-resize","s-resize","sw-resize","w-resize","nw-resize"],_initEventListeners:function(){this.removeListeners();this._bindEvents();this.addOrRemove(addListener,"add")},addOrRemove:function(functor,eventjsFunctor){functor(fabric.window,"resize",this._onResize);functor(this.upperCanvasEl,"mousedown",this._onMouseDown);functor(this.upperCanvasEl,"mousemove",this._onMouseMove,addEventOptions);functor(this.upperCanvasEl,"mouseout",this._onMouseOut);functor(this.upperCanvasEl,"mouseenter",this._onMouseEnter);functor(this.upperCanvasEl,"wheel",this._onMouseWheel);functor(this.upperCanvasEl,"contextmenu",this._onContextMenu);functor(this.upperCanvasEl,"dblclick",this._onDoubleClick);functor(this.upperCanvasEl,"touchstart",this._onMouseDown,addEventOptions);functor(this.upperCanvasEl,"touchmove",this._onMouseMove,addEventOptions);functor(this.upperCanvasEl,"dragover",this._onDragOver);functor(this.upperCanvasEl,"dragenter",this._onDragEnter);functor(this.upperCanvasEl,"dragleave",this._onDragLeave);functor(this.upperCanvasEl,"drop",this._onDrop);typeof eventjs!="undefined"&&eventjsFunctor in eventjs&&(eventjs[eventjsFunctor](this.upperCanvasEl,"gesture",this._onGesture),eventjs[eventjsFunctor](this.upperCanvasEl,"drag",this._onDrag),eventjs[eventjsFunctor](this.upperCanvasEl,"orientation",this._onOrientationChange),eventjs[eventjsFunctor](this.upperCanvasEl,"shake",this._onShake),eventjs[eventjsFunctor](this.upperCanvasEl,"longpress",this._onLongPress))},removeListeners:function(){this.addOrRemove(removeListener,"remove");removeListener(fabric.document,"mouseup",this._onMouseUp);removeListener(fabric.document,"touchend",this._onMouseUp,addEventOptions);removeListener(fabric.document,"mousemove",this._onMouseMove,addEventOptions);removeListener(fabric.document,"touchmove",this._onMouseMove,addEventOptions)},_bindEvents:function(){this.eventsBound||(this._onMouseDown=this._onMouseDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,"dragenter"),this._onDragLeave=this._simpleEventHandler.bind(this,"dragleave"),this._onDrop=this._simpleEventHandler.bind(this,"drop"),this.eventsBound=!0)},_onGesture:function(e,self){this.__onTransformGesture&&this.__onTransformGesture(e,self)},_onDrag:function(e,self){this.__onDrag&&this.__onDrag(e,self)},_onMouseWheel:function(e){this.__onMouseWheel(e)},_onMouseOut:function(e){var target=this._hoveredTarget;this.fire("mouse:out",{target:target,e:e});this._hoveredTarget=null;target&&target.fire("mouseout",{e:e});
14this._iTextInstances&&this._iTextInstances.forEach(function(obj){obj.isEditing&&obj.hiddenTextarea.focus()})},_onMouseEnter:function(e){this.findTarget(e)||(this.fire("mouse:over",{target:null,e:e}),this._hoveredTarget=null)},_onOrientationChange:function(e,self){this.__onOrientationChange&&this.__onOrientationChange(e,self)},_onShake:function(e,self){this.__onShake&&this.__onShake(e,self)},_onLongPress:function(e,self){this.__onLongPress&&this.__onLongPress(e,self)},_onDragOver:function(e){e.preventDefault();var target=this._simpleEventHandler("dragover",e);this._fireEnterLeaveEvents(target,e)},_onContextMenu:function(e){return this.stopContextMenu&&(e.stopPropagation(),e.preventDefault()),!1},_onDoubleClick:function(e){this._cacheTransformEventData(e);this._handleEvent(e,"dblclick");this._resetTransformEventData(e)},_onMouseDown:function(e){this.__onMouseDown(e);this._resetTransformEventData();addListener(fabric.document,"touchend",this._onMouseUp,addEventOptions);addListener(fabric.document,"touchmove",this._onMouseMove,addEventOptions);removeListener(this.upperCanvasEl,"mousemove",this._onMouseMove,addEventOptions);removeListener(this.upperCanvasEl,"touchmove",this._onMouseMove,addEventOptions);e.type==="touchstart"?removeListener(this.upperCanvasEl,"mousedown",this._onMouseDown):(addListener(fabric.document,"mouseup",this._onMouseUp),addListener(fabric.document,"mousemove",this._onMouseMove,addEventOptions))},_onMouseUp:function(e){if(this.__onMouseUp(e),this._resetTransformEventData(),removeListener(fabric.document,"mouseup",this._onMouseUp),removeListener(fabric.document,"touchend",this._onMouseUp,addEventOptions),removeListener(fabric.document,"mousemove",this._onMouseMove,addEventOptions),removeListener(fabric.document,"touchmove",this._onMouseMove,addEventOptions),addListener(this.upperCanvasEl,"mousemove",this._onMouseMove,addEventOptions),addListener(this.upperCanvasEl,"touchmove",this._onMouseMove,addEventOptions),e.type==="touchend"){var _this=this;setTimeout(function(){addListener(_this.upperCanvasEl,"mousedown",_this._onMouseDown)},400)}},_onMouseMove:function(e){!this.allowTouchScrolling&&e.preventDefault&&e.preventDefault();this.__onMouseMove(e)},_onResize:function(){this.calcOffset()},_shouldRender:function(target,pointer){var activeObject=this._activeObject;return activeObject&&activeObject.isEditing&&target===activeObject?!1:!!(target&&(target.isMoving||target!==activeObject)||!target&&!!activeObject||!target&&!activeObject&&!this._groupSelector||pointer&&this._previousPointer&&this.selection&&(pointer.x!==this._previousPointer.x||pointer.y!==this._previousPointer.y))},__onMouseUp:function(e){var target,transform=this._currentTransform,groupSelector=this._groupSelector,isClick=!groupSelector||groupSelector.left===0&&groupSelector.top===0,shouldRender;if(this._cacheTransformEventData(e),target=this._target,this._handleEvent(e,"up:before"),checkClick(e,RIGHT_CLICK)){this.fireRightClick&&this._handleEvent(e,"up",RIGHT_CLICK,isClick);return}if(checkClick(e,MIDDLE_CLICK)){this.fireMiddleClick&&this._handleEvent(e,"up",MIDDLE_CLICK,isClick);this._resetTransformEventData();return}if(this.isDrawingMode&&this._isCurrentlyDrawing){this._onMouseUpInDrawingMode(e);return}transform&&this._finalizeCurrentTransform(e);shouldRender=this._shouldRender(target,this._absolutePointer);(target||!isClick)&&this._maybeGroupObjects(e);target&&(target.isMoving=!1);this._setCursorFromEvent(e,target);this._handleEvent(e,"up",LEFT_CLICK,isClick);this._groupSelector=null;this._currentTransform=null;target&&(target.__corner=0);shouldRender&&this.requestRenderAll()},_simpleEventHandler:function(eventType,e){var target=this.findTarget(e),targets=this.targets,options={e:e,target:target,subTargets:targets},i;if(this.fire(eventType,options),target&&target.fire(eventType,options),!targets)return target;for(i=0;i<targets.length;i++)targets[i].fire(eventType,options);return target},_handleEvent:function(e,eventType,button,isClick){var target=this._target,targets=this.targets||[],options={e:e,target:target,subTargets:targets,button:button||LEFT_CLICK,isClick:isClick||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform},i;for(this.fire("mouse:"+eventType,options),target&&target.fire("mouse"+eventType,options),i=0;i<targets.length;i++)targets[i].fire("mouse"+eventType,options)},_finalizeCurrentTransform:function(e){var transform=this._currentTransform,target=transform.target,eventName,options={e:e,target:target,transform:transform};target._scaling&&(target._scaling=!1);target.setCoords();(transform.actionPerformed||this.stateful&&target.hasStateChanged())&&(transform.actionPerformed&&(eventName=this._addEventOptions(options,transform),this._fire(eventName,options)),this._fire("modified",options))},_addEventOptions:function(options,transform){var eventName,by;switch(transform.action){case"scaleX":eventName="scaled";by="x";break;case"scaleY":eventName="scaled";by="y";break;case"skewX":eventName="skewed";by="x";break;case"skewY":eventName="skewed";by="y";break;case"scale":eventName="scaled";by="equally";break;case"rotate":eventName="rotated";break;case"drag":eventName="moved"}return options.by=by,eventName},_onMouseDownInDrawingMode:function(e){this._isCurrentlyDrawing=!0;this.getActiveObject()&&this.discardActiveObject(e).requestRenderAll();this.clipTo&&fabric.util.clipContext(this,this.contextTop);var pointer=this.getPointer(e);this.freeDrawingBrush.onMouseDown(pointer);this._handleEvent(e,"down")},_onMouseMoveInDrawingMode:function(e){if(this._isCurrentlyDrawing){var pointer=this.getPointer(e);this.freeDrawingBrush.onMouseMove(pointer)}this.setCursor(this.freeDrawingCursor);this._handleEvent(e,"move")},_onMouseUpInDrawingMode:function(e){this._isCurrentlyDrawing=!1;
14this.clipTo&&this.contextTop.restore();this.freeDrawingBrush.onMouseUp();this._handleEvent(e,"up")},__onMouseDown:function(e){var target,pointer,shouldRender,shouldGroup;if(this._cacheTransformEventData(e),this._handleEvent(e,"down:before"),target=this._target,checkClick(e,RIGHT_CLICK)){this.fireRightClick&&this._handleEvent(e,"down",RIGHT_CLICK);return}if(checkClick(e,MIDDLE_CLICK)){this.fireMiddleClick&&this._handleEvent(e,"down",MIDDLE_CLICK);return}if(this.isDrawingMode){this._onMouseDownInDrawingMode(e);return}this._currentTransform||(pointer=this._pointer,this._previousPointer=pointer,shouldRender=this._shouldRender(target,pointer),shouldGroup=this._shouldGroup(e,target),this._shouldClearSelection(e,target)?this.discardActiveObject(e):shouldGroup&&(this._handleGrouping(e,target),target=this._activeObject),!this.selection||target&&(target.selectable||target.isEditing||target===this._activeObject)||(this._groupSelector={ex:pointer.x,ey:pointer.y,top:0,left:0}),target&&(target.selectable&&this.setActiveObject(target,e),target===this._activeObject&&(target.__corner||!shouldGroup)&&this._setupCurrentTransform(e,target)),this._handleEvent(e,"down"),shouldRender&&this.requestRenderAll())},_resetTransformEventData:function(){this._target=null;this._pointer=null;this._absolutePointer=null},_cacheTransformEventData:function(e){this._resetTransformEventData();this._pointer=this.getPointer(e,!0);this._absolutePointer=this.restorePointerVpt(this._pointer);this._target=this._currentTransform?this._currentTransform.target:this.findTarget(e)||null},_beforeTransform:function(e){var t=this._currentTransform;if(this.stateful&&t.target.saveState(),this.fire("before:transform",{e:e,transform:t}),t.corner)this.onBeforeScaleRotate(t.target)},__onMouseMove:function(e){var target,pointer,groupSelector;if(this._handleEvent(e,"move:before"),this._cacheTransformEventData(e),this.isDrawingMode){this._onMouseMoveInDrawingMode(e);return}typeof e.touches!="undefined"&&e.touches.length>1||(groupSelector=this._groupSelector,groupSelector?(pointer=this._pointer,groupSelector.left=pointer.x-groupSelector.ex,groupSelector.top=pointer.y-groupSelector.ey,this.renderTop()):this._currentTransform?this._transformObject(e):(target=this.findTarget(e)||null,this._setCursorFromEvent(e,target),this._fireOverOutEvents(target,e)),this._handleEvent(e,"move"),this._resetTransformEventData())},_fireOverOutEvents:function(target,e){this.fireSynteticInOutEvents(target,e,{targetName:"_hoveredTarget",canvasEvtOut:"mouse:out",evtOut:"mouseout",canvasEvtIn:"mouse:over",evtIn:"mouseover"})},_fireEnterLeaveEvents:function(target,e){this.fireSynteticInOutEvents(target,e,{targetName:"_draggedoverTarget",evtOut:"dragleave",evtIn:"dragenter"})},fireSynteticInOutEvents:function(target,e,config){var inOpt,outOpt,oldTarget=this[config.targetName],outFires,inFires,targetChanged=oldTarget!==target,canvasEvtIn=config.canvasEvtIn,canvasEvtOut=config.canvasEvtOut;targetChanged&&(inOpt={e:e,target:target,previousTarget:oldTarget},outOpt={e:e,target:oldTarget,nextTarget:target},this[config.targetName]=target);inFires=target&&targetChanged;outFires=oldTarget&&targetChanged;outFires&&(canvasEvtOut&&this.fire(canvasEvtOut,outOpt),oldTarget.fire(config.evtOut,outOpt));inFires&&(canvasEvtIn&&this.fire(canvasEvtIn,inOpt),target.fire(config.evtIn,inOpt))},__onMouseWheel:function(e){this._cacheTransformEventData(e);this._handleEvent(e,"wheel");this._resetTransformEventData()},_transformObject:function(e){var pointer=this.getPointer(e),transform=this._currentTransform;transform.reset=!1;transform.target.isMoving=!0;transform.shiftKey=e.shiftKey;transform.altKey=e[this.centeredKey];this._beforeScaleTransform(e,transform);this._performTransformAction(e,transform,pointer);transform.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(e,transform,pointer){var x=pointer.x,y=pointer.y,action=transform.action,actionPerformed=!1,options={target:transform.target,e:e,transform:transform,pointer:pointer};action==="rotate"?(actionPerformed=this._rotateObject(x,y))&&this._fire("rotating",options):action==="scale"?(actionPerformed=this._onScale(e,transform,x,y))&&this._fire("scaling",options):action==="scaleX"?(actionPerformed=this._scaleObject(x,y,"x"))&&this._fire("scaling",options):action==="scaleY"?(actionPerformed=this._scaleObject(x,y,"
14y"))&&this._fire("scaling",options):action==="skewX"?(actionPerformed=this._skewObject(x,y,"x"))&&this._fire("skewing",options):action==="skewY"?(actionPerformed=this._skewObject(x,y,"y"))&&this._fire("skewing",options):(actionPerformed=this._translateObject(x,y),actionPerformed&&(this._fire("moving",options),this.setCursor(options.target.moveCursor||this.moveCursor)));transform.actionPerformed=transform.actionPerformed||actionPerformed},_fire:function(eventName,options){this.fire("object:"+eventName,options);options.target.fire(eventName,options)},_beforeScaleTransform:function(e,transform){if(transform.action==="scale"||transform.action==="scaleX"||transform.action==="scaleY"){var centerTransform=this._shouldCenterTransform(transform.target);(centerTransform&&(transform.originX!=="center"||transform.originY!=="center")||!centerTransform&&transform.originX==="center"&&transform.originY==="center")&&(this._resetCurrentTransform(),transform.reset=!0)}},_onScale:function(e,transform,x,y){return this._isUniscalePossible(e,transform.target)?(transform.currentAction="scale",this._scaleObject(x,y)):(transform.reset||transform.currentAction!=="scale"||this._resetCurrentTransform(),transform.currentAction="scaleEqually",this._scaleObject(x,y,"equally"))},_isUniscalePossible:function(e,target){return(e[this.uniScaleKey]||this.uniScaleTransform)&&!target.get("lockUniScaling")},_setCursorFromEvent:function(e,target){if(!target)return this.setCursor(this.defaultCursor),!1;var hoverCursor=target.hoverCursor||this.hoverCursor,activeSelection=this._activeObject&&this._activeObject.type==="activeSelection"?this._activeObject:null,corner=(!activeSelection||!activeSelection.contains(target))&&target._findTargetCorner(this.getPointer(e,!0));corner?this.setCursor(this.getCornerCursor(corner,target,e)):this.setCursor(hoverCursor)},getCornerCursor:function(corner,target,e){return this.actionIsDisabled(corner,target,e)?this.notAllowedCursor:corner in cursorOffset?this._getRotatedCornerCursor(corner,target,e):corner==="mtr"&&target.hasRotatingPoint?this.rotationCursor:this.defaultCursor},actionIsDisabled:function(corner,target,e){return corner==="mt"||corner==="mb"?e[this.altActionKey]?target.lockSkewingX:target.lockScalingY:corner==="ml"||corner==="mr"?e[this.altActionKey]?target.lockSkewingY:target.lockScalingX:corner==="mtr"?target.lockRotation:this._isUniscalePossible(e,target)?target.lockScalingX&&target.lockScalingY:target.lockScalingX||target.lockScalingY},_getRotatedCornerCursor:function(corner,target,e){var n=Math.round(target.angle%360/45);return n<0&&(n+=8),n+=cursorOffset[corner],e[this.altActionKey]&&cursorOffset[corner]%2==0&&(n+=2),n%=8,this.cursorMap[n]}})}(),function(){var min=Math.min,max=Math.max;fabric.util.object.extend(fabric.Canvas.prototype,{_shouldGroup:function(e,target){var activeObject=this._activeObject;return activeObject&&this._isSelectionKeyPressed(e)&&target&&target.selectable&&this.selection&&(activeObject!==target||activeObject.type==="activeSelection")},_handleGrouping:function(e,target){var activeObject=this._activeObject;activeObject.__corner||(target!==activeObject||(target=this.findTarget(e,!0),target))&&(activeObject&&activeObject.type==="activeSelection"?this._updateActiveSelection(target,e):this._createActiveSelection(target,e))},_updateActiveSelection:function(target,e){var activeSelection=this._activeObject,currentActiveObjects=activeSelection._objects.slice(0);activeSelection.contains(target)?(activeSelection.removeWithUpdate(target),this._hoveredTarget=target,activeSelection.size()===1&&this._setActiveObject(activeSelection.item(0),e)):(activeSelection.addWithUpdate(target),this._hoveredTarget=activeSelection);this._fireSelectionEvents(currentActiveObjects,e)},_createActiveSelection:function(target,e){var currentActives=this.getActiveObjects(),group=this._createGroup(target);this._hoveredTarget=group;this._setActiveObject(group,e);this._fireSelectionEvents(currentActives,e)},_createGroup:function(target){var objects=this._objects,isActiveLower=objects.indexOf(this._activeObject)<objects.indexOf(target),groupObjects=isActiveLower?[this._activeObject,target]:[target,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new fabric.ActiveSelection(groupObjects,{canvas:this})},_groupSelectedObjects:function(e){var group=this._collectObjects(),aGroup;group.length===1?this.setActiveObject(group[0],e):group.length>1&&(aGroup=new fabric.ActiveSelection(group.reverse(),{canvas:this}),this.setActiveObject(aGroup,e))},_collectObjects:function(){for(var group=[],currentObject,x1=this._groupSelector.ex,y1=this._groupSelector.ey,x2=x1+this._groupSelector.left,y2=y1+this._groupSelector.top,selectionX1Y1=new fabric.Point(min(x1,x2),min(y1,y2)),selectionX2Y2=new fabric.Point(max(x1,x2),max(y1,y2)),allowIntersect=!this.selectionFullyContained,isClick=x1===x2&&y1===y2,i=this._objects.length;i--;)if((currentObject=this._objects[i],currentObject&¤tObject.selectable&¤tObject.visible)&&(allowIntersect&¤tObject.intersectsWithRect(selectionX1Y1,selectionX2Y2)||currentObject.isContainedWithinRect(selectionX1Y1,selectionX2Y2)||allowIntersect&¤tObject.containsPoint(selectionX1Y1)||allowIntersect&¤tObject.containsPoint(selectionX2Y2))&&(group.push(currentObject),isClick))break;return group},_maybeGroupObjects:function(e){this.selection&&this._groupSelector&&this._groupSelectedObjects(e);this.setCursor(this.defaultCursor);this._groupSelector=null}})}(),function(){var supportQuality=fabric.StaticCanvas.supports("toDataURLWithQuality");fabric.util.object.extend(fabric.StaticCanvas.prototype,{toDataURL:function(options){options||(options={});var format=options.format||"png",quality=options.quality||1,multiplier=(options.multiplier||1)*(options.enableRetinaScaling?1:1/this.getRetinaScaling()),cropping={left:options.left||0,top:options.top||0,width:options.width||0,height:options.height||0};return this.__toDataURLWithMultiplier(format,quality,cropping,multiplier)},__toDataURLWithMultiplier:function(format,quality,cropping,multiplier){var origWidth=this.width,origHeight=this.height,scaledWidth=(cropping.width||this.width)*multiplier,scaledHeight=(cropping.height||this.height)*multiplier,zoom=this.getZoom(),newZoom=zoom*multiplier,vp=this.viewportTransform,translateX=(vp[4]-cropping.left)*multiplier,translateY=(vp[5]-cropping.top)*multiplier,newVp=[newZo
14om,0,0,newZoom,translateX,translateY],originalInteractive=this.interactive,originalSkipOffScreen=this.skipOffscreen,needsResize=origWidth!==scaledWidth||origHeight!==scaledHeight,data;return this.viewportTransform=newVp,this.skipOffscreen=!1,this.interactive=!1,needsResize&&this.setDimensions({width:scaledWidth,height:scaledHeight},{backstoreOnly:!0}),this.renderAll(),data=this.__toDataURL(format,quality,cropping),this.interactive=originalInteractive,this.skipOffscreen=originalSkipOffScreen,this.viewportTransform=vp,needsResize&&this.setDimensions({width:origWidth,height:origHeight},{backstoreOnly:!0}),this.renderAll(),data},__toDataURL:function(format,quality){var canvasEl=this.contextContainer.canvas;return format==="jpg"&&(format="jpeg"),supportQuality?canvasEl.toDataURL("image/"+format,quality):canvasEl.toDataURL("image/"+format)}})}();fabric.util.object.extend(fabric.StaticCanvas.prototype,{loadFromDatalessJSON:function(json,callback,reviver){return this.loadFromJSON(json,callback,reviver)},loadFromJSON:function(json,callback,reviver){if(json){var serialized=typeof json=="string"?JSON.parse(json):fabric.util.object.clone(json),_this=this,renderOnAddRemove=this.renderOnAddRemove;return this.renderOnAddRemove=!1,this._enlivenObjects(serialized.objects,function(enlivenedObjects){_this.clear();_this._setBgOverlay(serialized,function(){enlivenedObjects.forEach(function(obj,index){_this.insertAt(obj,index)});_this.renderOnAddRemove=renderOnAddRemove;delete serialized.objects;delete serialized.backgroundImage;delete serialized.overlayImage;delete serialized.background;delete serialized.overlay;_this._setOptions(serialized);_this.renderAll();callback&&callback()})},reviver),this}},_setBgOverlay:function(serialized,callback){var loaded={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1},cbIfLoaded;if(!serialized.backgroundImage&&!serialized.overlayImage&&!serialized.background&&!serialized.overlay){callback&&callback();return}cbIfLoaded=function(){loaded.backgroundImage&&loaded.overlayImage&&loaded.backgroundColor&&loaded.overlayColor&&callback&&callback()};this.__setBgOverlay("backgroundImage",serialized.backgroundImage,loaded,cbIfLoaded);this.__setBgOverlay("overlayImage",serialized.overlayImage,loaded,cbIfLoaded);this.__setBgOverlay("backgroundColor",serialized.background,loaded,cbIfLoaded);this.__setBgOverlay("overlayColor",serialized.overlay,loaded,cbIfLoaded)},__setBgOverlay:function(property,value,loaded,callback){var _this=this;if(!value){loaded[property]=!0;callback&&callback();return}property==="backgroundImage"||property==="overlayImage"?fabric.util.enlivenObjects([value],function(enlivedObject){_this[property]=enlivedObject[0];loaded[property]=!0;callback&&callback()}):this["set"+fabric.util.string.capitalize(property,!0)](value,function(){loaded[property]=!0;callback&&callback()})},_enlivenObjects:function(objects,callback,reviver){if(!objects||objects.length===0){callback&&callback([]);return}fabric.util.enlivenObjects(objects,function(enlivenedObjects){callback&&callback(enlivenedObjects)},null,reviver)},_toDataURL:function(format,callback){this.clone(function(clone){callback(clone.toDataURL(format))})},_toDataURLWithMultiplier:function(format,multiplier,callback){this.clone(function(clone){callback(clone.toDataURLWithMultiplier(format,multiplier))})},clone:function(callback,properties){var data=JSON.stringify(this.toJSON(properties));this.cloneWithoutData(function(clone){clone.loadFromJSON(data,function(){callback&&callback(clone)})})},cloneWithoutData:function(callback){var el=fabric.util.createCanvasElement(),clone;el.width=this.width;el.height=this.height;clone=new fabric.Canvas(el);clone.clipTo=this.clipTo;this.backgroundImage?(clone.setBackgroundImage(this.backgroundImage.src,function(){clone.renderAll();callback&&callback(clone)}),clone.backgroundImageOpacity=this.backgroundImageOpacity,clone.backgroundImageStretch=this.backgroundImageStretch):callback&&callback(clone)}}),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,clone=fabric.util.object.clone,toFixed=fabric.util.toFixed,capitalize=fabric.util.string.capitalize,degreesToRadians=fabric.util.degreesToRadians,supportsLineDash=fabric.StaticCanvas.supports("setLineDash"),objectCaching=!fabric.isLikelyNode,ALIASING_LIMIT=2;fabric.Object||(fabric.Object=fabric.util.createClass(fabric.CommonMethods,{type:"object",originX:"left",originY:"top",top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,transparentCorners:!0,hoverCurs
14or:null,moveCursor:null,padding:0,borderColor:"rgba(102,153,255,0.75)",borderDashArray:null,cornerColor:"rgba(102,153,255,0.5)",cornerStrokeColor:null,cornerStyle:"rect",cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:"rgb(0,0,0)",fillRule:"nonzero",globalCompositeOperation:"source-over",backgroundColor:"",selectionBackgroundColor:"",stroke:null,strokeWidth:1,strokeDashArray:null,strokeLineCap:"butt",strokeLineJoin:"miter",strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,transformMatrix:null,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,hasRotatingPoint:!0,rotatingPointOffset:40,perPixelTargetFind:!1,includeDefaultValues:!0,clipTo:null,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockUniScaling:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:objectCaching,statefullCache:!1,noScaleCache:!0,dirty:!0,__corner:0,paintFirst:"fill",stateProperties:"top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow clipTo visible backgroundColor skewX skewY fillRule paintFirst".split(" "),cacheProperties:"fill stroke strokeWidth strokeDashArray width height paintFirst strokeLineCap strokeLineJoin strokeMiterLimit backgroundColor".split(" "),initialize:function(options){options&&this.setOptions(options)},_createCacheCanvas:function(){this._cacheProperties={};this._cacheCanvas=fabric.util.createCanvasElement();this._cacheContext=this._cacheCanvas.getContext("2d");this._updateCacheCanvas();this.dirty=!0},_limitCacheSize:function(dims){var perfLimitSizeTotal=fabric.perfLimitSizeTotal,width=dims.width,height=dims.height,max=fabric.maxCacheSideLimit,min=fabric.minCacheSideLimit;if(width<=max&&height<=max&&width*height<=perfLimitSizeTotal)return width<min&&(dims.width=min),height<min&&(dims.height=min),dims;var ar=width/height,limitedDims=fabric.util.limitDimsByArea(ar,perfLimitSizeTotal),capValue=fabric.util.capValue,x=capValue(min,limitedDims.x,max),y=capValue(min,limitedDims.y,max);return width>x&&(dims.zoomX/=width/x,dims.width=x,dims.capped=!0),height>y&&(dims.zoomY/=height/y,dims.height=y,dims.capped=!0),dims},_getCacheCanvasDimensions:function(){var objectScale=this.getTotalObjectScaling(),dim=this._getNonTransformedDimensions(),zoomX=objectScale.scaleX,zoomY=objectScale.scaleY,width=dim.x*zoomX,height=dim.y*zoomY;return{width:width+ALIASING_LIMIT,height:height+ALIASING_LIMIT,zoomX:zoomX,zoomY:zoomY,x:dim.x,y:dim.y}},_updateCacheCanvas:function(){var target,action;if(this.noScaleCache&&this.canvas&&this.canvas._currentTransform&&(target=this.canvas._currentTransform.target,action=this.canvas._currentTransform.action,this===target&&action.slice&&action.slice(0,5)==="scale"))return!1;var canvas=this._cacheCanvas,dims=this._limitCacheSize(this._getCacheCanvasDimensions()),minCacheSize=fabric.minCacheSideLimit,width=dims.width,height=dims.height,drawingWidth,drawingHeight,zoomX=dims.zoomX,zoomY=dims.zoomY,dimensionsChanged=width!==this.cacheWidth||height!==this.cacheHeight,zoomChanged=this.zoomX!==zoomX||this.zoomY!==zoomY,shouldRedraw=dimensionsChanged||zoomChanged,additionalWidth=0,additionalHeight=0,shouldResizeCanvas=!1;if(dimensionsChanged){var canvasWidth=this._cacheCanvas.width,canvasHeight=this._cacheCanvas.height,sizeGrowing=width>canvasWidth||height>canvasHeight,sizeShrinking=(width<canvasWidth*.9||height<canvasHeight*.9)&&canvasWidth>minCacheSize&&canvasHeight>minCacheSize;shouldResizeCanvas=sizeGrowing||sizeShrinking;sizeGrowing&&!dims.capped&&(width>minCacheSize||height>minCacheSize)&&(additionalWidth=width*.1,additionalHeight=height*.1)}return shouldRedraw?(shouldResizeCanvas?(canvas.width=Math.ceil(width+additionalWidth),canvas.height=Math.ceil(height+additionalHeight)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,canvas.width,canvas.height)),drawingWidth=dims.x*zoomX/2,drawingHeight=dims.y*zoomY/2,this.cacheTranslationX=Math.round(canvas.width/2-drawingWidth)+drawingWidth,this.cacheTranslationY=Math.round(canvas.height/2-drawingHeight)+drawingHeight,this.cacheWidth=width,this.cacheHeight=height,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(zoomX,zoomY),this.zoomX=zoomX,this.zoomY=zoomY,!0):!1},setOptions:function(options){this._setOptions(options);this._initGradient(options.fill,"fill");this._initGradient(options.stroke,"stroke");this._initClipping(options);this._initPattern(options.fill,"fill");this._initPattern(options.stroke,"stroke")},transform:function(ctx){var m;m=this.group&&!this.group._transformDone?this.calcTransformMatrix():this.calcOwnMatrix();ctx.transform(m[0],m[1],m[2],m[3],m[4],m[5])},toObject:function(propertiesToInclude){var NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS,object={type:this.t
14ype,version:fabric.version,originX:this.originX,originY:this.originY,left:toFixed(this.left,NUM_FRACTION_DIGITS),top:toFixed(this.top,NUM_FRACTION_DIGITS),width:toFixed(this.width,NUM_FRACTION_DIGITS),height:toFixed(this.height,NUM_FRACTION_DIGITS),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:toFixed(this.strokeWidth,NUM_FRACTION_DIGITS),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeLineJoin:this.strokeLineJoin,strokeMiterLimit:toFixed(this.strokeMiterLimit,NUM_FRACTION_DIGITS),scaleX:toFixed(this.scaleX,NUM_FRACTION_DIGITS),scaleY:toFixed(this.scaleY,NUM_FRACTION_DIGITS),angle:toFixed(this.angle,NUM_FRACTION_DIGITS),flipX:this.flipX,flipY:this.flipY,opacity:toFixed(this.opacity,NUM_FRACTION_DIGITS),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,clipTo:this.clipTo&&String(this.clipTo),backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,transformMatrix:this.transformMatrix?this.transformMatrix.concat():null,skewX:toFixed(this.skewX,NUM_FRACTION_DIGITS),skewY:toFixed(this.skewY,NUM_FRACTION_DIGITS)};return fabric.util.populateWithProperties(this,object,propertiesToInclude),this.includeDefaultValues||(object=this._removeDefaultValues(object)),object},toDatalessObject:function(propertiesToInclude){return this.toObject(propertiesToInclude)},_removeDefaultValues:function(object){var prototype=fabric.util.getKlass(object.type).prototype,stateProperties=prototype.stateProperties;return stateProperties.forEach(function(prop){object[prop]===prototype[prop]&&delete object[prop];var isArray=Object.prototype.toString.call(object[prop])==="[object Array]"&&Object.prototype.toString.call(prototype[prop])==="[object Array]";isArray&&object[prop].length===0&&prototype[prop].length===0&&delete object[prop]}),object},toString:function(){return"#<fabric."+capitalize(this.type)+">"},getObjectScaling:function(){var scaleX=this.scaleX,scaleY=this.scaleY,scaling;return this.group&&(scaling=this.group.getObjectScaling(),scaleX*=scaling.scaleX,scaleY*=scaling.scaleY),{scaleX:scaleX,scaleY:scaleY}},getTotalObjectScaling:function(){var scale=this.getObjectScaling(),scaleX=scale.scaleX,scaleY=scale.scaleY,zoom,retina;return this.canvas&&(zoom=this.canvas.getZoom(),retina=this.canvas.getRetinaScaling(),scaleX*=zoom*retina,scaleY*=zoom*retina),{scaleX:scaleX,scaleY:scaleY}},getObjectOpacity:function(){var opacity=this.opacity;return this.group&&(opacity*=this.group.getObjectOpacity()),opacity},_set:function(key,value){var shouldConstrainValue=key==="scaleX"||key==="scaleY",isChanged=this[key]!==value,groupNeedsUpdate=!1;return shouldConstrainValue&&(value=this._constrainScale(value)),key==="scaleX"&&value<0?(this.flipX=!this.flipX,value*=-1):key==="scaleY"&&value<0?(this.flipY=!this.flipY,value*=-1):key!=="shadow"||!value||value instanceof fabric.Shadow?key==="dirty"&&this.group&&this.group.set("dirty",value):value=new fabric.Shadow(value),this[key]=value,isChanged&&(groupNeedsUpdate=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(key)>-1?(this.dirty=!0,groupNeedsUpdate&&this.group.set("dirty",!0)):groupNeedsUpdate&&this.stateProperties.indexOf(key)>-1&&this.group.set("dirty",!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:fabric.iMatrix.concat()},isNotVisible:function(){return this.opacity===0||this.width===0&&this.height===0||!this.visible},render:function(ctx){this.isNotVisible()||(!this.canvas||!this.canvas.skipOffscreen||this.group||this.isOnScreen())&&(ctx.save(),this._setupCompositeOperation(ctx),this.drawSelectionBackground(ctx),this.transform(ctx),this._setOpacity(ctx),this._setShadow(ctx,this),this.transformMatrix&&ctx.transform.apply(ctx,this.transformMatrix),this.clipTo&&fabric.util.clipContext(this,ctx),this.shouldCache()?(this._cacheCanvas||this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:"cacheProperties"}),this.drawObject(this._cacheContext),this.dirty=!1),this.drawCacheOnCanvas(ctx)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(ctx),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:"cacheProperties"}
14)),this.clipTo&&ctx.restore(),ctx.restore())},_removeCacheCanvas:function(){this._cacheCanvas=null;this.cacheWidth=0;this.cacheHeight=0},needsItsOwnCache:function(){return this.paintFirst==="stroke"&&typeof this.shadow=="object"?!0:!1},shouldCache:function(){return this.ownCaching=this.objectCaching&&(!this.group||this.needsItsOwnCache()||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(this.shadow.offsetX!==0||this.shadow.offsetY!==0)},drawObject:function(ctx){this._renderBackground(ctx);this._setStrokeStyles(ctx,this);this._setFillStyles(ctx,this);this._render(ctx)},drawCacheOnCanvas:function(ctx){ctx.scale(1/this.zoomX,1/this.zoomY);ctx.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(skipCanvas){if(this.isNotVisible())return!1;if(this._cacheCanvas&&!skipCanvas&&this._updateCacheCanvas())return!0;if(this.dirty||this.statefullCache&&this.hasStateChanged("cacheProperties")){if(this._cacheCanvas&&!skipCanvas){var width=this.cacheWidth/this.zoomX,height=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-width/2,-height/2,width,height)}return!0}return!1},_renderBackground:function(ctx){if(this.backgroundColor){var dim=this._getNonTransformedDimensions();ctx.fillStyle=this.backgroundColor;ctx.fillRect(-dim.x/2,-dim.y/2,dim.x,dim.y);this._removeShadow(ctx)}},_setOpacity:function(ctx){this.group&&!this.group._transformDone?ctx.globalAlpha=this.getObjectOpacity():ctx.globalAlpha*=this.opacity},_setStrokeStyles:function(ctx,decl){decl.stroke&&(ctx.lineWidth=decl.strokeWidth,ctx.lineCap=decl.strokeLineCap,ctx.lineJoin=decl.strokeLineJoin,ctx.miterLimit=decl.strokeMiterLimit,ctx.strokeStyle=decl.stroke.toLive?decl.stroke.toLive(ctx,this):decl.stroke)},_setFillStyles:function(ctx,decl){decl.fill&&(ctx.fillStyle=decl.fill.toLive?decl.fill.toLive(ctx,this):decl.fill)},_setLineDash:function(ctx,dashArray,alternative){dashArray&&(1&dashArray.length&&dashArray.push.apply(dashArray,dashArray),supportsLineDash?ctx.setLineDash(dashArray):alternative&&alternative(ctx))},_renderControls:function(ctx,styleOverride){var vpt=this.getViewportTransform(),matrix=this.calcTransformMatrix(),options,drawBorders,drawControls;styleOverride=styleOverride||{};drawBorders=typeof styleOverride.hasBorders!="undefined"?styleOverride.hasBorders:this.hasBorders;drawControls=typeof styleOverride.hasControls!="undefined"?styleOverride.hasControls:this.hasControls;matrix=fabric.util.multiplyTransformMatrices(vpt,matrix);options=fabric.util.qrDecompose(matrix);ctx.save();ctx.translate(options.translateX,options.translateY);ctx.lineWidth=1*this.borderScaleFactor;this.group||(ctx.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1);styleOverride.forActiveSelection?(ctx.rotate(degreesToRadians(options.angle)),drawBorders&&this.drawBordersInGroup(ctx,options,styleOverride)):(ctx.rotate(degreesToRadians(this.angle)),drawBorders&&this.drawBorders(ctx,styleOverride));drawControls&&this.drawControls(ctx,styleOverride);ctx.restore()},_setShadow:function(ctx){if(this.shadow){var multX=this.canvas&&this.canvas.viewportTransform[0]||1,multY=this.canvas&&this.canvas.viewportTransform[3]||1,scaling=this.getObjectScaling();this.canvas&&this.canvas._isRetinaScaling()&&(multX*=fabric.devicePixelRatio,multY*=fabric.devicePixelRatio);ctx.shadowColor=this.shadow.color;ctx.shadowBlur=this.shadow.blur*fabric.browserShadowBlurConstant*(multX+multY)*(scaling.scaleX+scaling.scaleY)/4;ctx.shadowOffsetX=this.shadow.offsetX*multX*scaling.scaleX;ctx.shadowOffsetY=this.shadow.offsetY*multY*scaling.scaleY}},_removeShadow:function(ctx){this.shadow&&(ctx.shadowColor="",ctx.shadowBlur=ctx.shadowOffsetX=ctx.shadowOffsetY=0)},_applyPatternGradientTransform:function(ctx,filler){if(!filler||!filler.toLive)return{offsetX:0,offsetY:0};var t=filler.gradientTransform||filler.patternTransform,offsetX=-this.width/2+filler.offsetX||0,offsetY=-this.height/2+filler.offsetY||0;return ctx.translate(offsetX,offsetY),t&&ctx.transform(t[0],t[1],t[2],t[3],t[4],t[5]),{offsetX:offsetX,offsetY:offsetY}},_renderPaintInOrder:function(ctx){this.paintFirst==="stroke"?(this._renderStroke(ctx),this._renderFill(ctx)):(this._renderFill(ctx),this._renderStroke(ctx))},_renderFill:function(ctx){this.fill&&(ctx.save(),this._applyPatternGradientTransform(ctx,this.fill),this.fillRule==="evenodd"?ctx.fill("evenodd"):ctx.fill(),ctx.restore(
14))},_renderStroke:function(ctx){this.stroke&&this.strokeWidth!==0&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(ctx),ctx.save(),this._setLineDash(ctx,this.strokeDashArray,this._renderDashedStroke),this._applyPatternGradientTransform(ctx,this.stroke),ctx.stroke(),ctx.restore())},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var options=fabric.util.qrDecompose(this.transformMatrix);this.flipX=!1;this.flipY=!1;this.set("scaleX",options.scaleX);this.set("scaleY",options.scaleY);this.angle=options.angle;this.skewX=options.skewX;this.skewY=0}},_removeTransformMatrix:function(preserveAspectRatioOptions){var center=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),center=fabric.util.transformPoint(center,this.transformMatrix));this.transformMatrix=null;preserveAspectRatioOptions&&(this.scaleX*=preserveAspectRatioOptions.scaleX,this.scaleY*=preserveAspectRatioOptions.scaleY,this.cropX=preserveAspectRatioOptions.cropX,this.cropY=preserveAspectRatioOptions.cropY,center.x+=preserveAspectRatioOptions.offsetLeft,center.y+=preserveAspectRatioOptions.offsetTop,this.width=preserveAspectRatioOptions.width,this.height=preserveAspectRatioOptions.height);this.setPositionByOrigin(center,"center","center")},clone:function(callback,propertiesToInclude){var objectForm=this.toObject(propertiesToInclude);this.constructor.fromObject?this.constructor.fromObject(objectForm,callback):fabric.Object._fromObject("Object",objectForm,callback)},cloneAsImage:function(callback,options){var dataUrl=this.toDataURL(options);return fabric.util.loadImage(dataUrl,function(img){callback&&callback(new fabric.Image(img))}),this},toDataURL:function(options){var origParams,el,boundingRect,canvas,originalCanvas,data;return options||(options={}),origParams=fabric.util.saveObjectTransform(this),options.withoutTransform&&fabric.util.resetObjectTransform(this),el=fabric.util.createCanvasElement(),boundingRect=this.getBoundingRect(!0,!0),el.width=boundingRect.width,el.height=boundingRect.height,canvas=new fabric.StaticCanvas(el,{enableRetinaScaling:options.enableRetinaScaling,renderOnAddRemove:!1,skipOffscreen:!1}),options.format==="jpg"&&(options.format="jpeg"),options.format==="jpeg"&&(canvas.backgroundColor="#fff"),this.setPositionByOrigin(new fabric.Point(canvas.width/2,canvas.height/2),"center","center"),originalCanvas=this.canvas,canvas.add(this),data=canvas.toDataURL(options),this.set(origParams).setCoords(),this.canvas=originalCanvas,canvas._objects=[],canvas.dispose(),canvas=null,data},isType:function(type){return this.type===type},complexity:function(){return 1},toJSON:function(propertiesToInclude){return this.toObject(propertiesToInclude)},setGradient:function(property,options){options||(options={});var gradient={colorStops:[]};return gradient.type=options.type||(options.r1||options.r2?"radial":"linear"),gradient.coords={x1:options.x1,y1:options.y1,x2:options.x2,y2:options.y2},(options.r1||options.r2)&&(gradient.coords.r1=options.r1,gradient.coords.r2=options.r2),gradient.gradientTransform=options.gradientTransform,fabric.Gradient.prototype.addColorStop.call(gradient,options.colorStops),this.set(property,fabric.Gradient.forObject(this,gradient))},setPatternFill:function(options,callback){return this.set("fill",new fabric.Pattern(options,callback))},setShadow:function(options){return this.set("shadow",options?new fabric.Shadow(options):null)},setColor:function(color){return this.set("fill",color),this},rotate:function(angle){var shouldCenterOrigin=(this.originX!=="center"||this.originY!=="center")&&this.centeredRotation;return shouldCenterOrigin&&this._setOriginToCenter(),this.set("angle",angle),shouldCenterOrigin&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(e,pointer){pointer=pointer||this.canvas.getPointer(e);var pClicked=new fabric.Point(pointer.x,pointer.y),objectLeftTop=this._getLeftTopCoords();return this.angle&&(pClicked=fabric.util.rotatePoint(pClicked,objectLeftTop,degreesToRadians(-this.angle))),{x:pClicked.x-objectLeftTop.x,y:pClicked.y-objectLeftTop.y}},_setupCompositeOperation:function(ctx){this.globalCompositeOperation&&(ctx.globalCompositeOperation=this.globalCompositeOperation)}}),fabric.util.createAccessors&&fabric.util.createAccessors(fabric.Object),extend(fabric.Object.prototype,fabric.Observable),fabric.Object.NUM_FRACTION_DIGITS=2,fabric.Object._fromObject=function(className,object,callback,extraParam){var klass=fabric[className];object=clone(object,!0);fabric.util.enlivenPatterns([object.fill,object.stroke],function(patterns){typeof patterns[0]!="undefined"&&(object.fill=patterns[0]);typeof patterns[1]!="undefined"&&(object.stroke=patterns[1]);var instance=extraParam?new klass(object[extraParam],object):new klass(object);callback&&callback(instance)})},fabric.Object.__uid=0)}(typeof exports!="undefined"?exports:this),function(){var degreesToRadians=fabric.util.degreesToRadians,originXOffset={left:-.5,center:0,right:.5},originYOffset={top:-.5,center:0,bottom:.5};fabric.util.object.extend(fabric.Object.prototype,{translateToGivenOrigin:function(point,fromOriginX,fromOriginY,toOriginX,toOriginY){var x=point.x,y=point.y,offsetX,offsetY,dim;
14return typeof fromOriginX=="string"?fromOriginX=originXOffset[fromOriginX]:fromOriginX-=.5,typeof toOriginX=="string"?toOriginX=originXOffset[toOriginX]:toOriginX-=.5,offsetX=toOriginX-fromOriginX,typeof fromOriginY=="string"?fromOriginY=originYOffset[fromOriginY]:fromOriginY-=.5,typeof toOriginY=="string"?toOriginY=originYOffset[toOriginY]:toOriginY-=.5,offsetY=toOriginY-fromOriginY,(offsetX||offsetY)&&(dim=this._getTransformedDimensions(),x=point.x+offsetX*dim.x,y=point.y+offsetY*dim.y),new fabric.Point(x,y)},translateToCenterPoint:function(point,originX,originY){var p=this.translateToGivenOrigin(point,originX,originY,"center","center");return this.angle?fabric.util.rotatePoint(p,point,degreesToRadians(this.angle)):p},translateToOriginPoint:function(center,originX,originY){var p=this.translateToGivenOrigin(center,"center","center",originX,originY);return this.angle?fabric.util.rotatePoint(p,center,degreesToRadians(this.angle)):p},getCenterPoint:function(){var leftTop=new fabric.Point(this.left,this.top);return this.translateToCenterPoint(leftTop,this.originX,this.originY)},getPointByOrigin:function(originX,originY){var center=this.getCenterPoint();return this.translateToOriginPoint(center,originX,originY)},toLocalPoint:function(point,originX,originY){var center=this.getCenterPoint(),p,p2;return p=typeof originX!="undefined"&&typeof originY!="undefined"?this.translateToGivenOrigin(center,"center","center",originX,originY):new fabric.Point(this.left,this.top),p2=new fabric.Point(point.x,point.y),this.angle&&(p2=fabric.util.rotatePoint(p2,center,-degreesToRadians(this.angle))),p2.subtractEquals(p)},setPositionByOrigin:function(pos,originX,originY){var center=this.translateToCenterPoint(pos,originX,originY),position=this.translateToOriginPoint(center,this.originX,this.originY);this.set("left",position.x);this.set("top",position.y)},adjustPosition:function(to){var angle=degreesToRadians(this.angle),hypotFull=this.getScaledWidth(),xFull=fabric.util.cos(angle)*hypotFull,yFull=fabric.util.sin(angle)*hypotFull,offsetFrom,offsetTo;offsetFrom=typeof this.originX=="string"?originXOffset[this.originX]:this.originX-.5;offsetTo=typeof to=="string"?originXOffset[to]:to-.5;this.left+=xFull*(offsetTo-offsetFrom);this.top+=yFull*(offsetTo-offsetFrom);this.setCoords();this.originX=to},_setOriginToCenter:function(){this._originalOriginX=this.originX;this._originalOriginY=this.originY;var center=this.getCenterPoint();this.originX="center";this.originY="center";this.left=center.x;this.top=center.y},_resetOrigin:function(){var originPoint=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX;this.originY=this._originalOriginY;this.left=originPoint.x;this.top=originPoint.y;this._originalOriginX=null;this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),"left","top")}})}(),function(){function getCoords(coords){return[new fabric.Point(coords.tl.x,coords.tl.y),new fabric.Point(coords.tr.x,coords.tr.y),new fabric.Point(coords.br.x,coords.br.y),new fabric.Point(coords.bl.x,coords.bl.y)]}var degreesToRadians=fabric.util.degreesToRadians,multiplyMatrices=fabric.util.multiplyTransformMatrices,transformPoint=fabric.util.transformPoint;fabric.util.object.extend(fabric.Object.prototype,{oCoords:null,aCoords:null,ownMatrixCache:null,matrixCache:null,getCoords:function(absolute,calculate){this.oCoords||this.setCoords();var coords=absolute?this.aCoords:this.oCoords;return getCoords(calculate?this.calcCoords(absolute):coords)},intersectsWithRect:function(pointTL,pointBR,absolute,calculate){var coords=this.getCoords(absolute,calculate),intersection=fabric.Intersection.intersectPolygonRectangle(coords,pointTL,pointBR);return intersection.status==="Intersection"},intersectsWithObject:function(other,absolute,calculate){var intersection=fabric.Intersection.intersectPolygonPolygon(this.getCoords(absolute,calculate),other.getCoords(absolute,calculate));return intersection.status==="Intersection"||other.isContainedWithinObject(this,absolute,calculate)||this.isContainedWithinObject(other,absolute,calculate)},isContainedWithinObject:function(other,absolute,calculate){for(var points=this.getCoords(absolute,calculate),i=0,lines=other._getImageLines(calculate?other.calcCoords(absolute):absolute?other.aCoords:other.oCoords);i<4;i++)if(!other.containsPoint(points[i],lines))return!1;return!0},isContainedWithinRect:function(pointTL,pointBR,absolute,calculate){var boundingRect=this.getBoundingRect
14(absolute,calculate);return boundingRect.left>=pointTL.x&&boundingRect.left+boundingRect.width<=pointBR.x&&boundingRect.top>=pointTL.y&&boundingRect.top+boundingRect.height<=pointBR.y},containsPoint:function(point,lines,absolute,calculate){var lines=lines||this._getImageLines(calculate?this.calcCoords(absolute):absolute?this.aCoords:this.oCoords),xPoints=this._findCrossPoints(point,lines);return xPoints!==0&&xPoints%2==1},isOnScreen:function(calculate){var i;if(!this.canvas)return!1;var pointTL=this.canvas.vptCoords.tl,pointBR=this.canvas.vptCoords.br,points=this.getCoords(!0,calculate),point;for(i=0;i<4;i++)if(point=points[i],point.x<=pointBR.x&&point.x>=pointTL.x&&point.y<=pointBR.y&&point.y>=pointTL.y)return!0;return this.intersectsWithRect(pointTL,pointBR,!0,calculate)?!0:this._containsCenterOfCanvas(pointTL,pointBR,calculate)},_containsCenterOfCanvas:function(pointTL,pointBR,calculate){var centerPoint={x:(pointTL.x+pointBR.x)/2,y:(pointTL.y+pointBR.y)/2};return this.containsPoint(centerPoint,null,!0,calculate)?!0:!1},isPartiallyOnScreen:function(calculate){if(!this.canvas)return!1;var pointTL=this.canvas.vptCoords.tl,pointBR=this.canvas.vptCoords.br;return this.intersectsWithRect(pointTL,pointBR,!0,calculate)?!0:this._containsCenterOfCanvas(pointTL,pointBR,calculate)},_getImageLines:function(oCoords){return{topline:{o:oCoords.tl,d:oCoords.tr},rightline:{o:oCoords.tr,d:oCoords.br},bottomline:{o:oCoords.br,d:oCoords.bl},leftline:{o:oCoords.bl,d:oCoords.tl}}},_findCrossPoints:function(point,lines){var b1,b2,a1,a2,xi,xcount=0,iLine;for(var lineKey in lines)if((iLine=lines[lineKey],!(iLine.o.y<point.y)||!(iLine.d.y<point.y))&&(!(iLine.o.y>=point.y)||!(iLine.d.y>=point.y))&&(iLine.o.x===iLine.d.x&&iLine.o.x>=point.x?xi=iLine.o.x:(b1=0,b2=(iLine.d.y-iLine.o.y)/(iLine.d.x-iLine.o.x),a1=point.y-b1*point.x,a2=iLine.o.y-b2*iLine.o.x,xi=-(a1-a2)/(b1-b2)),xi>=point.x&&(xcount+=1),xcount===2))break;return xcount},getBoundingRect:function(absolute,calculate){var coords=this.getCoords(absolute,calculate);return fabric.util.makeBoundingBoxFromPoints(coords)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(value){return Math.abs(value)<this.minScaleLimit?value<0?-this.minScaleLimit:this.minScaleLimit:value===0?.0001:value},scale:function(value){return this._set("scaleX",value),this._set("scaleY",value),this.setCoords()},scaleToWidth:function(value,absolute){var boundingRectFactor=this.getBoundingRect(absolute).width/this.getScaledWidth();return this.scale(value/this.width/boundingRectFactor)},scaleToHeight:function(value,absolute){var boundingRectFactor=this.getBoundingRect(absolute).height/this.getScaledHeight();return this.scale(value/this.height/boundingRectFactor)},calcCoords:function(absolute){var rotateMatrix=this._calcRotateMatrix(),translateMatrix=this._calcTranslateMatrix(),startMatrix=multiplyMatrices(translateMatrix,rotateMatrix),vpt=this.getViewportTransform(),finalMatrix=absolute?startMatrix:multiplyMatrices(vpt,startMatrix),dim=this._getTransformedDimensions(),w=dim.x/2,h=dim.y/2,tl=transformPoint({x:-w,y:-h},finalMatrix),tr=transformPoint({x:w,y:-h},finalMatrix),bl=transformPoint({x:-w,y:h},finalMatrix),br=transformPoint({x:w,y:h},finalMatrix),coords;if(!absolute){var padding=this.padding,angle=degreesToRadians(this.angle),cos=fabric.util.cos(angle),sin=fabric.util.sin(angle),cosP=cos*padding,sinP=sin*padding,cosPSinP=cosP+sinP,cosPMinusSinP=cosP-sinP;padding&&(tl.x-=cosPMinusSinP,tl.y-=cosPSinP,tr.x+=cosPSinP,tr.y-=cosPMinusSinP,bl.x-=cosPSinP,bl.y+=cosPMinusSinP,br.x+=cosPMinusSinP,br.y+=cosPSinP);var ml=new fabric.Point((tl.x+bl.x)/2,(tl.y+bl.y)/2),mt=new fabric.Point((tr.x+tl.x)/2,(tr.y+tl.y)/2),mr=new fabric.Point((br.x+tr.x)/2,(br.y+tr.y)/2),mb=new fabric.Point((br.x+bl.x)/2,(br.y+bl.y)/2),mtr=new fabric.Point(mt.x+sin*this.rotatingPointOffset,mt.y-cos*this.rotatingPointOffset)}return coords={tl:tl,tr:tr,br:br,bl:bl},absolute||(coords.ml=ml,coords.mt=mt,coords.mr=mr,coords.mb=mb,coords.mtr=mtr),coords},setCoords:function(ignoreZoom,skipAbsolute){return this.oCoords=this.calcCoords(ignoreZoom),skipAbsolute||(this.aCoords=this.calcCoords(!0)),ignoreZoom||this._setCornerCoords&&this._setCornerCoords(),this},_calcRotateMatrix:function(){if(this.angle){var theta=degreesToRadians(this.angle),cos=fabric.util.cos(theta),sin=fabric.util.sin(theta);return[cos,sin,-sin,cos,0,0]}return fabric.iMatrix.concat()},_calcTranslateMatrix:function(){var center=this.getCenterPoint();return[1,0,0,1,center.x,center.y]},transformMatrixKey:function(skipGroup){var sep="_",prefix="";return!skipGroup&&this.group&&(prefix=this.group.transformMatrixKey(skipGroup)+sep),prefix+this.top+sep+this.left+sep+this.scaleX+sep+this.scaleY+sep+this.skewX+sep+this.skewY+sep+this.angle+sep+this.originX+sep+this.originY+sep+this.width+sep+this.height+sep+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(skipGroup){var key,cache,matrix;return skipGroup?this.calcOwnMatrix():(key=this.transformMatrixKey(),cache=this.matrixCache||(this.matrixCache={}),cache.key===key)?cache.value:(matrix=this.calcOwnMatrix(),this.group&&(matrix=multiplyMatrices(this.group.calcTransformMatrix(),matrix)),cache.key=key,cache.value=matrix,matrix)},calcOwnMatrix:function(){var key=this.transformMatrixKey(!0),cache=this.ownMatrixCache||(this.ownMatrixCache={}),matrix,rotateMatrix,dimensionMatrix;return cache.key===key?cache.value:(matrix=this._calcTranslateMatrix(),dimensionMatrix=this._calcDimensionsTransformMatrix(this.skewX,this.skewY,!0),this.angle&&(rotateMatrix=this._calcRotateMatrix(),matrix=multiplyMatrices(matrix,rotateMatrix)),matrix=multiplyMatrices(matrix,dimensionMatrix),cache.key=key,cache.value=matrix,matrix)},_calcDimensionsTransformMatrix:function(skewX,skewY,flipping){var skewMatrix,scaleX=this.scaleX*(flipping&&this.flipX?-1:1),scaleY=this.scaleY*(flipping&&this.flipY?-1:1),scaleMatrix=[scaleX,0,0,scaleY,0,0];return skewX&&(skewMatrix=[1,0,Math.tan(degreesToRadians(skewX)),1],scaleMatrix=multiplyMatrices(scaleMatrix,skewMatrix,!0)),skewY&&(skewMatrix=[1,Math.tan(degreesToRadians(skewY)),0,1],scaleMatrix=multiplyMatrices(scaleMatrix,skewMatrix,!0)),scaleMatrix},_getNonTransformedDimensions:function(){var strokeWidth=this.strokeWidth,w=this.width+strokeWidth,h=this.height+strokeWidth;return{x:w,y:h}},_getTransformedDimensions:function(skewX,skewY){var dimensions;
14if(typeof skewX=="undefined"&&(skewX=this.skewX),typeof skewY=="undefined"&&(skewY=this.skewY),dimensions=this._getNonTransformedDimensions(),skewX===0&&skewY===0)return{x:dimensions.x*this.scaleX,y:dimensions.y*this.scaleY};for(var dimX=dimensions.x/2,dimY=dimensions.y/2,points=[{x:-dimX,y:-dimY},{x:dimX,y:-dimY},{x:-dimX,y:dimY},{x:dimX,y:dimY}],transformMatrix=this._calcDimensionsTransformMatrix(skewX,skewY,!1),bbox,i=0;i<points.length;i++)points[i]=fabric.util.transformPoint(points[i],transformMatrix);return bbox=fabric.util.makeBoundingBoxFromPoints(points),{x:bbox.width,y:bbox.height}},_calculateCurrentDimensions:function(){var vpt=this.getViewportTransform(),dim=this._getTransformedDimensions(),p=fabric.util.transformPoint(dim,vpt,!0);return p.scalarAdd(2*this.padding)}})}();fabric.util.object.extend(fabric.Object.prototype,{sendToBack:function(){return this.group?fabric.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?fabric.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas.bringToFront(this),this},sendBackwards:function(intersecting){return this.group?fabric.StaticCanvas.prototype.sendBackwards.call(this.group,this,intersecting):this.canvas.sendBackwards(this,intersecting),this},bringForward:function(intersecting){return this.group?fabric.StaticCanvas.prototype.bringForward.call(this.group,this,intersecting):this.canvas.bringForward(this,intersecting),this},moveTo:function(index){return this.group&&this.group.type!=="activeSelection"?fabric.StaticCanvas.prototype.moveTo.call(this.group,this,index):this.canvas.moveTo(this,index),this}}),function(){function getSvgColorString(prop,value){if(value){if(value.toLive)return prop+": url(#SVGID_"+value.id+"); ";var color=new fabric.Color(value),str=prop+": "+color.toRgb()+"; ",opacity=color.getAlpha();return opacity!==1&&(str+=prop+"-opacity: "+opacity.toString()+"; "),str}return prop+": none; "}var toFixed=fabric.util.toFixed;fabric.util.object.extend(fabric.Object.prototype,{getSvgStyles:function(skipShadow){var fillRule=this.fillRule,strokeWidth=this.strokeWidth?this.strokeWidth:"0",strokeDashArray=this.strokeDashArray?this.strokeDashArray.join(" "):"none",strokeLineCap=this.strokeLineCap?this.strokeLineCap:"butt",strokeLineJoin=this.strokeLineJoin?this.strokeLineJoin:"miter",strokeMiterLimit=this.strokeMiterLimit?this.strokeMiterLimit:"4",opacity=typeof this.opacity!="undefined"?this.opacity:"1",visibility=this.visible?"":" visibility: hidden;",filter=skipShadow?"":this.getSvgFilter(),fill=getSvgColorString("fill",this.fill),stroke=getSvgColorString("stroke",this.stroke);return[stroke,"stroke-width: ",strokeWidth,"; ","stroke-dasharray: ",strokeDashArray,"; ","stroke-linecap: ",strokeLineCap,"; ","stroke-linejoin: ",strokeLineJoin,"; ","stroke-miterlimit: ",strokeMiterLimit,"; ",fill,"fill-rule: ",fillRule,"; ","opacity: ",opacity,";",filter,visibility].join("")},getSvgSpanStyles:function(style,useWhiteSpace){var term="; ",fontFamily=style.fontFamily?"font-family: "+(style.fontFamily.indexOf("'")===-1&&style.fontFamily.indexOf('"')===-1?"'"+style.fontFamily+"'":style.fontFamily)+term:"",strokeWidth=style.strokeWidth?"stroke-width: "+style.strokeWidth+term:"",fontFamily=fontFamily,fontSize=style.fontSize?"font-size: "+style.fontSize+"px"+term:"",fontStyle=style.fontStyle?"font-style: "+style.fontStyle+term:"",fontWeight=style.fontWeight?"font-weight: "+style.fontWeight+term:"",fill=style.fill?getSvgColorString("fill",style.fill):"",stroke=style.stroke?getSvgColorString("stroke",style.stroke):"",textDecoration=this.getSvgTextDecoration(style),deltaY=style.deltaY?"baseline-shift: "+-style.deltaY+"; ":"";return textDecoration&&(textDecoration="text-decoration: "+textDecoration+term),[stroke,strokeWidth,fontFamily,fontSize,fontStyle,fontWeight,textDecoration,fill,deltaY,useWhiteSpace?"white-space: pre; ":""].join("")},getSvgTextDecoration:function(style){return"overline"in style||"underline"in style||"linethrough"in style?(style.overline?"overline ":"")+(style.underline?"underline ":"")+(style.linethrough?"line-through ":""):""},getSvgFilter:function(){return this.shadow?"filter: url(#SVGID_"+this.shadow.id+");":""}
14,getSvgId:function(){return this.id?'id="'+this.id+'" ':""},getSvgTransform:function(){var angle=this.angle,skewX=this.skewX%360,skewY=this.skewY%360,center=this.getCenterPoint(),NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS,translatePart="translate("+toFixed(center.x,NUM_FRACTION_DIGITS)+" "+toFixed(center.y,NUM_FRACTION_DIGITS)+")",anglePart=angle!==0?" rotate("+toFixed(angle,NUM_FRACTION_DIGITS)+")":"",scalePart=this.scaleX===1&&this.scaleY===1?"":" scale("+toFixed(this.scaleX,NUM_FRACTION_DIGITS)+" "+toFixed(this.scaleY,NUM_FRACTION_DIGITS)+")",skewXPart=skewX!==0?" skewX("+toFixed(skewX,NUM_FRACTION_DIGITS)+")":"",skewYPart=skewY!==0?" skewY("+toFixed(skewY,NUM_FRACTION_DIGITS)+")":"",flipXPart=this.flipX?" matrix(-1 0 0 1 0 0) ":"",flipYPart=this.flipY?" matrix(1 0 0 -1 0 0)":"";return[translatePart,anglePart,scalePart,flipXPart,flipYPart,skewXPart,skewYPart].join("")},getSvgTransformMatrix:function(){return this.transformMatrix?" matrix("+this.transformMatrix.join(" ")+") ":""},_setSVGBg:function(textBgRects){if(this.backgroundColor){var NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS;textBgRects.push("\t\t<rect ",this._getFillAttributes(this.backgroundColor),' x="',toFixed(-this.width/2,NUM_FRACTION_DIGITS),'" y="',toFixed(-this.height/2,NUM_FRACTION_DIGITS),'" width="',toFixed(this.width,NUM_FRACTION_DIGITS),'" height="',toFixed(this.height,NUM_FRACTION_DIGITS),'"><\/rect>\n')}},_createBaseSVGMarkup:function(){var markup=[];return this.fill&&this.fill.toLive&&markup.push(this.fill.toSVG(this,!1)),this.stroke&&this.stroke.toLive&&markup.push(this.stroke.toSVG(this,!1)),this.shadow&&markup.push(this.shadow.toSVG(this)),markup},addPaintOrder:function(){return this.paintFirst!=="fill"?' paint-order="'+this.paintFirst+'" ':""}})}(),function(){function saveProps(origin,destination,props){var tmpObj={};props.forEach(function(prop){tmpObj[prop]=origin[prop]});extend(origin[destination],tmpObj,!0)}function _isEqual(origValue,currentValue,firstPass){var keys,key,i,len;if(origValue===currentValue)return!0;if(Array.isArray(origValue)){if(!Array.isArray(currentValue)||origValue.length!==currentValue.length)return!1;for(i=0,len=origValue.length;i<len;i++)if(!_isEqual(origValue[i],currentValue[i]))return!1;return!0}if(origValue&&typeof origValue=="object"){if(keys=Object.keys(origValue),!currentValue||typeof currentValue!="object"||!firstPass&&keys.length!==Object.keys(currentValue).length)return!1;for(i=0,len=keys.length;i<len;i++)if(key=keys[i],!_isEqual(origValue[key],currentValue[key]))return!1;return!0}}var extend=fabric.util.object.extend,originalSet="stateProperties";fabric.util.object.extend(fabric.Object.prototype,{hasStateChanged:function(propertySet){propertySet=propertySet||originalSet;var dashedPropertySet="_"+propertySet;return Object.keys(this[dashedPropertySet]).length<this[propertySet].length?!0:!_isEqual(this[dashedPropertySet],this,!0)},saveState:function(options){var propertySet=options&&options.propertySet||originalSet,destination="_"+propertySet;return this[destination]?(saveProps(this,destination,this[propertySet]),options&&options.stateProperties&&saveProps(this,destination,options.stateProperties),this):this.setupState(options)},setupState:function(options){options=options||{};var propertySet=options.propertySet||originalSet;return options.propertySet=propertySet,this["_"+propertySet]={},this.saveState(options),this}})}(),function(){var degreesToRadians=fabric.util.degreesToRadians;fabric.util.object.extend(fabric.Object.prototype,{_controlsVisibility:null,_findTargetCorner:function(pointer){var ex,ey,xPoints,lines,i;if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;ex=pointer.x;ey=pointer.y;this.__corner=0;for(i in this.oCoords)if(this.isControlVisible(i)&&(i!=="mtr"||this.hasRotatingPoint)&&(!this.get("lockUniScaling")||i!=="mt"&&i!=="mr"&&i!=="mb"&&i!=="ml")&&(lines=this._getImageLines(this.oCoords[i].corner),xPoints=this._findCrossPoints({x:ex,y:ey},lines),xPoints!==0&&xPoints%2==1))return this.__corner=i,i;return!1},_setCornerCoords:function(){var coords=this.oCoords,newTheta=degreesToRadians(45-this.angle),cornerHypotenuse=this.cornerSize*.707106,cosHalfOffset=cornerHypotenuse*fabric.util.cos(newTheta),sinHalfOffset=cornerHypotenuse*fabric.util.sin(newTheta),x,y;for(var point in coords)x=coords[point].x,y=coords[point].y,coords[point].corner={tl:{x:x-sinHalfOffset,y:y-cosHalfOffset},tr:{x:x+cosHalfOffset,y:y-sinHalfOffset},bl:{x:x-cosHalfOffset,y:y+sinHalfOffset},br:{x:x+sinHalfOffset,y:y+cosHalfOffset}}}
14,drawSelectionBackground:function(ctx){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;ctx.save();var center=this.getCenterPoint(),wh=this._calculateCurrentDimensions(),vpt=this.canvas.viewportTransform;return ctx.translate(center.x,center.y),ctx.scale(1/vpt[0],1/vpt[3]),ctx.rotate(degreesToRadians(this.angle)),ctx.fillStyle=this.selectionBackgroundColor,ctx.fillRect(-wh.x/2,-wh.y/2,wh.x,wh.y),ctx.restore(),this},drawBorders:function(ctx,styleOverride){var rotateHeight;styleOverride=styleOverride||{};var wh=this._calculateCurrentDimensions(),strokeWidth=1/this.borderScaleFactor,width=wh.x+strokeWidth,height=wh.y+strokeWidth,drawRotatingPoint=typeof styleOverride.hasRotatingPoint!="undefined"?styleOverride.hasRotatingPoint:this.hasRotatingPoint,hasControls=typeof styleOverride.hasControls!="undefined"?styleOverride.hasControls:this.hasControls,rotatingPointOffset=typeof styleOverride.rotatingPointOffset!="undefined"?styleOverride.rotatingPointOffset:this.rotatingPointOffset;return ctx.save(),ctx.strokeStyle=styleOverride.borderColor||this.borderColor,this._setLineDash(ctx,styleOverride.borderDashArray||this.borderDashArray,null),ctx.strokeRect(-width/2,-height/2,width,height),drawRotatingPoint&&this.isControlVisible("mtr")&&hasControls&&(rotateHeight=-height/2,ctx.beginPath(),ctx.moveTo(0,rotateHeight),ctx.lineTo(0,rotateHeight-rotatingPointOffset),ctx.stroke()),ctx.restore(),this},drawBordersInGroup:function(ctx,options,styleOverride){styleOverride=styleOverride||{};var p=this._getNonTransformedDimensions(),matrix=fabric.util.customTransformMatrix(options.scaleX,options.scaleY,options.skewX),wh=fabric.util.transformPoint(p,matrix),strokeWidth=1/this.borderScaleFactor,width=wh.x+strokeWidth,height=wh.y+strokeWidth;return ctx.save(),this._setLineDash(ctx,styleOverride.borderDashArray||this.borderDashArray,null),ctx.strokeStyle=styleOverride.borderColor||this.borderColor,ctx.strokeRect(-width/2,-height/2,width,height),ctx.restore(),this},drawControls:function(ctx,styleOverride){styleOverride=styleOverride||{};var wh=this._calculateCurrentDimensions(),width=wh.x,height=wh.y,scaleOffset=styleOverride.cornerSize||this.cornerSize,left=-(width+scaleOffset)/2,top=-(height+scaleOffset)/2,transparentCorners=typeof styleOverride.transparentCorners!="undefined"?styleOverride.transparentCorners:this.transparentCorners,hasRotatingPoint=typeof styleOverride.hasRotatingPoint!="undefined"?styleOverride.hasRotatingPoint:this.hasRotatingPoint,methodName=transparentCorners?"stroke":"fill";return ctx.save(),ctx.strokeStyle=ctx.fillStyle=styleOverride.cornerColor||this.cornerColor,this.transparentCorners||(ctx.strokeStyle=styleOverride.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(ctx,styleOverride.cornerDashArray||this.cornerDashArray,null),this._drawControl("tl",ctx,methodName,left,top,styleOverride),this._drawControl("tr",ctx,methodName,left+width,top,styleOverride),this._drawControl("bl",ctx,methodName,left,top+height,styleOverride),this._drawControl("br",ctx,methodName,left+width,top+height,styleOverride),this.get("lockUniScaling")||(this._drawControl("mt",ctx,methodName,left+width/2,top,styleOverride),this._drawControl("mb",ctx,methodName,left+width/2,top+height,styleOverride),this._drawControl("mr",ctx,methodName,left+width,top+height/2,styleOverride),this._drawControl("ml",ctx,methodName,left,top+height/2,styleOverride)),hasRotatingPoint&&this._drawControl("mtr",ctx,methodName,left+width/2,top-this.rotatingPointOffset,styleOverride),ctx.restore(),this},_drawControl:function(control,ctx,methodName,left,top,styleOverride){if(styleOverride=styleOverride||{},this.isControlVisible(control)){var size=this.cornerSize,stroke=!this.transparentCorners&&this.cornerStrokeColor;switch(styleOverride.cornerStyle||this.cornerStyle){case"circle":ctx.beginPath();ctx.arc(left+size/2,top+size/2,size/2,0,2*Math.PI,!1);ctx[methodName]();stroke&&ctx.stroke();break;default:this.transparentCorners||ctx.clearRect(left,top,size,size);ctx[methodName+"Rect"](left,top,size,size);stroke&&ctx.strokeRect(left,top,size,size)}}},isControlVisible:function(controlName){return this._getControlsVisibility()[controlName]},setControlVisible:function(controlName,visible){return this._getControlsVisibility()[controlName]=visible,this},setControlsVisibility:function(options){options||(options={});for(var p in options)this.setControlVisible(p,options[p]);return this},_getControlsVisibility:function(){return this._controlsVisibility||(this._controlsVisibility={tl:!0,tr:!0,br:!0,bl:!0,ml:!0,mt:!0,mr:!0,mb:!0,mtr:!0}),this._controlsVisibility},onDeselect:function(){},onSelect:function(){}})}();fabric.util.object.extend(fabric.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(object,callbacks){callbacks=callbacks||{};var empty=function(){},onComplete=callbacks.onComplete||empty,onChange=callbacks.onChange||empty,_this=this;return fabric.util.animate({startValue:object.left,endValue:this.getCenter().left,duration:this.FX_DURATION,onChange:function(value){object.set("left",value);_this.requestRenderAll();onChange()},onComplete:function(){object.setCoords();onComplete()}}),this},fxCenterObjectV:function(object,callbacks){callbacks=callbacks||{};var empty=function(){},onComplete=callbacks.onComplete||empty,onChange=callbacks.onChange||empty,_this=this;return fabric.util.animate({startValue:object.top,endValue:this.getCenter().top,duration:this.FX_DURATION,onChange:function(value){object.set("top",value);_this.requestRenderAll();onChange()},onComplete:function(){object.setCoords();onComplete()}}),this},fxRemove:function(object,callbacks){callbacks=callbacks||{};var empty=function(){},onComplete=callbacks.onComplete||empty,onChange=callbacks.onChange||empty,_this=this;return fabric.util.animate({startValue:object.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(value){object.set("opacity",value);_this.requestRenderAll();onChange()},onComplete:function(){_this.remove(object);onComplete()}}),this}});fabric.util.object.extend(fabric.Object.prototype,{animate:function(){var propsToAnimate,prop,skipCallbacks,i,len;if(arguments[0]&&typeof arguments[0]=="object"){propsToAnimate=[];for(prop in arguments[0])propsToAnimate.push(prop);for(i=0,len=propsToAnimate.length;i<len;i++)prop=propsToAnimate[i],skipCallbacks=i!==len-1,this._animate(prop,arguments[0][prop],arguments[1],skipCallbacks)}else this._animate.apply(this,arguments);return this},_animate:function(property,to,options,skipCallbacks){var _this=this,propPair,currentValue;to=to.toString();options=options?fabric.util.object.clone(options):{};~property.indexOf(".")&&(propPair=property.split("."));currentValue=propPair?this.get(propPair[0])[propPair[1]]:this.get(property);"from"in options||(options.from=currentValue);to=~to.indexOf("=")?currentValue+parseFloat(to.replace("=","")):parseFloat(to);fabric.util.animate({startValue:options.from,endValue:to,byValue:options.by,easing:options.easing,duration:options.duration,abort:
14options.abort&&function(){return options.abort.call(_this)},onChange:function(value,valueProgress,timeProgress){(propPair?_this[propPair[0]][propPair[1]]=value:_this.set(property,value),skipCallbacks)||options.onChange&&options.onChange(value,valueProgress,timeProgress)},onComplete:function(value,valueProgress,timeProgress){skipCallbacks||(_this.setCoords(),options.onComplete&&options.onComplete(value,valueProgress,timeProgress))}})}}),function(global){"use strict";function makeEdgeToOriginGetter(propertyNames,originValues){var origin=propertyNames.origin,axis1=propertyNames.axis1,axis2=propertyNames.axis2,dimension=propertyNames.dimension,nearest=originValues.nearest,center=originValues.center,farthest=originValues.farthest;return function(){switch(this.get(origin)){case nearest:return Math.min(this.get(axis1),this.get(axis2));case center:return Math.min(this.get(axis1),this.get(axis2))+.5*this.get(dimension);case farthest:return Math.max(this.get(axis1),this.get(axis2))}}}var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,clone=fabric.util.object.clone,coordProps={x1:1,x2:1,y1:1,y2:1},supportsLineDash=fabric.StaticCanvas.supports("setLineDash");if(fabric.Line){fabric.warn("fabric.Line is already defined");return}fabric.Line=fabric.util.createClass(fabric.Object,{type:"line",x1:0,y1:0,x2:0,y2:0,cacheProperties:fabric.Object.prototype.cacheProperties.concat("x1","x2","y1","y2"),initialize:function(points,options){points||(points=[0,0,0,0]);this.callSuper("initialize",options);this.set("x1",points[0]);this.set("y1",points[1]);this.set("x2",points[2]);this.set("y2",points[3]);this._setWidthHeight(options)},_setWidthHeight:function(options){options||(options={});this.width=Math.abs(this.x2-this.x1);this.height=Math.abs(this.y2-this.y1);this.left="left"in options?options.left:this._getLeftToOriginX();this.top="top"in options?options.top:this._getTopToOriginY()},_set:function(key,value){return this.callSuper("_set",key,value),typeof coordProps[key]!="undefined"&&this._setWidthHeight(),this},_getLeftToOriginX:makeEdgeToOriginGetter({origin:"originX",axis1:"x1",axis2:"x2",dimension:"width"},{nearest:"left",center:"center",farthest:"right"}),_getTopToOriginY:makeEdgeToOriginGetter({origin:"originY",axis1:"y1",axis2:"y2",dimension:"height"},{nearest:"top",center:"center",farthest:"bottom"}),_render:function(ctx){var p,origStrokeStyle;ctx.beginPath();(!this.strokeDashArray||this.strokeDashArray&&supportsLineDash)&&(p=this.calcLinePoints(),ctx.moveTo(p.x1,p.y1),ctx.lineTo(p.x2,p.y2));ctx.lineWidth=this.strokeWidth;origStrokeStyle=ctx.strokeStyle;ctx.strokeStyle=this.stroke||ctx.fillStyle;this.stroke&&this._renderStroke(ctx);ctx.strokeStyle=origStrokeStyle},_renderDashedStroke:function(ctx){var p=this.calcLinePoints();ctx.beginPath();fabric.util.drawDashedLine(ctx,p.x1,p.y1,p.x2,p.y2,this.strokeDashArray);ctx.closePath()},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(propertiesToInclude){return extend(this.callSuper("toObject",propertiesToInclude),this.calcLinePoints())},_getNonTransformedDimensions:function(){var dim=this.callSuper("_getNonTransformedDimensions");return this.strokeLineCap==="butt"&&(this.width===0&&(dim.y-=this.strokeWidth),this.height===0&&(dim.x-=this.strokeWidth)),dim},calcLinePoints:function(){var xMult=this.x1<=this.x2?-1:1,yMult=this.y1<=this.y2?-1:1,x1=xMult*this.width*.5,y1=yMult*this.height*.5,x2=xMult*this.width*-.5,y2=yMult*this.height*-.5;return{x1:x1,x2:x2,y1:y1,y2:y2}},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),p=this.calcLinePoints();return markup.push("<line ",this.getSvgId(),'x1="',p.x1,'" y1="',p.y1,'" x2="',p.x2,'" y2="',p.y2,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"/>\n'),reviver?reviver(markup.join("")):markup.join("")}});fabric.Line.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x1 y1 x2 y2".split(" "));fabric.Line.fromElement=function(element,callback,options){options=options||{};var parsedAttributes=fabric.parseAttributes(element,fabric.Line.ATTRIBUTE_NAMES),points=[parsedAttributes.x1||0,parsedAttributes.y1||0,parsedAttributes.x2||0,parsedAttributes.y2||0];callback(new fabric.Line(points,extend(parsedAttributes,options)))};fabric.Line.fromObject=function(object,callback){function _callback(instance){delete instance.points;callback&&callback(instance)}var options=clone(object,!0);options.points=[object.x1,object.y1,object.x2,object.y2];fabric.Object._fromObject("Line",options,_callback,"points")}}(typeof exports!="undefined"?exports:this),function(global){"use strict";function isValidRadius(attributes){return"radius"in attributes&&attributes.radius>=0}var fabric=global.fabric||(global.fabric={}),pi=Math.PI;if(fabric.Circle){fabric.warn("fabric.Circle is already defined.");return}fabric.Circle=fabric.util.createClass(fabric.Object,{type:"circle",radius:0,startAngle:0,endAngle:pi*2,cacheProperties:fabric.Object.prototype.cacheProperties.concat("radius","startAngle","endAngle"),_set
14:function(key,value){return this.callSuper("_set",key,value),key==="radius"&&this.setRadius(value),this},toObject:function(propertiesToInclude){return this.callSuper("toObject",["radius","startAngle","endAngle"].concat(propertiesToInclude))},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),angle=(this.endAngle-this.startAngle)%(2*pi);if(angle===0)markup.push("<circle ",this.getSvgId(),'cx="0" cy="0" ','r="',this.radius,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"',this.addPaintOrder(),"/>\n");else{var startX=fabric.util.cos(this.startAngle)*this.radius,startY=fabric.util.sin(this.startAngle)*this.radius,endX=fabric.util.cos(this.endAngle)*this.radius,endY=fabric.util.sin(this.endAngle)*this.radius,largeFlag=angle>pi?"1":"0";markup.push('<path d="M '+startX+" "+startY," A "+this.radius+" "+this.radius," 0 ",+largeFlag+" 1"," "+endX+" "+endY,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"',this.addPaintOrder(),"/>\n")}return reviver?reviver(markup.join("")):markup.join("")},_render:function(ctx){ctx.beginPath();ctx.arc(0,0,this.radius,this.startAngle,this.endAngle,!1);this._renderPaintInOrder(ctx)},getRadiusX:function(){return this.get("radius")*this.get("scaleX")},getRadiusY:function(){return this.get("radius")*this.get("scaleY")},setRadius:function(value){return this.radius=value,this.set("width",value*2).set("height",value*2)}});fabric.Circle.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("cx cy r".split(" "));fabric.Circle.fromElement=function(element,callback){var parsedAttributes=fabric.parseAttributes(element,fabric.Circle.ATTRIBUTE_NAMES);if(!isValidRadius(parsedAttributes))throw new Error("value of `r` attribute is required and can not be negative");parsedAttributes.left=(parsedAttributes.left||0)-parsedAttributes.radius;parsedAttributes.top=(parsedAttributes.top||0)-parsedAttributes.radius;callback(new fabric.Circle(parsedAttributes))};fabric.Circle.fromObject=function(object,callback){return fabric.Object._fromObject("Circle",object,callback)}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={});if(fabric.Triangle){fabric.warn("fabric.Triangle is already defined");return}fabric.Triangle=fabric.util.createClass(fabric.Object,{type:"triangle",width:100,height:100,_render:function(ctx){var widthBy2=this.width/2,heightBy2=this.height/2;ctx.beginPath();ctx.moveTo(-widthBy2,heightBy2);ctx.lineTo(0,-heightBy2);ctx.lineTo(widthBy2,heightBy2);ctx.closePath();this._renderPaintInOrder(ctx)},_renderDashedStroke:function(ctx){var widthBy2=this.width/2,heightBy2=this.height/2;ctx.beginPath();fabric.util.drawDashedLine(ctx,-widthBy2,heightBy2,0,-heightBy2,this.strokeDashArray);
14fabric.util.drawDashedLine(ctx,0,-heightBy2,widthBy2,heightBy2,this.strokeDashArray);fabric.util.drawDashedLine(ctx,widthBy2,heightBy2,-widthBy2,heightBy2,this.strokeDashArray);ctx.closePath()},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),widthBy2=this.width/2,heightBy2=this.height/2,points=[-widthBy2+" "+heightBy2,"0 "+-heightBy2,widthBy2+" "+heightBy2].join(",");return markup.push("<polygon ",this.getSvgId(),'points="',points,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),'"',this.addPaintOrder(),"/>"),reviver?reviver(markup.join("")):markup.join("")}});fabric.Triangle.fromObject=function(object,callback){return fabric.Object._fromObject("Triangle",object,callback)}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),piBy2=Math.PI*2;if(fabric.Ellipse){fabric.warn("fabric.Ellipse is already defined.");return}fabric.Ellipse=fabric.util.createClass(fabric.Object,{type:"ellipse",rx:0,ry:0,cacheProperties:fabric.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(options){this.callSuper("initialize",options);this.set("rx",options&&options.rx||0);this.set("ry",options&&options.ry||0)},_set:function(key,value){this.callSuper("_set",key,value);switch(key){case"rx":this.rx=value;this.set("width",value*2);break;case"ry":this.ry=value;this.set("height",value*2)}return this},getRx:function(){return this.get("rx")*this.get("scaleX")},getRy:function(){return this.get("ry")*this.get("scaleY")},toObject:function(propertiesToInclude){return this.callSuper("toObject",["rx","ry"].concat(propertiesToInclude))},toSVG:function(reviver){var markup=this._createBaseSVGMarkup();return markup.push("<ellipse ",this.getSvgId(),'cx="0" cy="0" ','rx="',this.rx,'" ry="',this.ry,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"',this.addPaintOrder(),"/>\n"),reviver?reviver(markup.join("")):markup.join("")},_render:function(ctx){ctx.beginPath();ctx.save();ctx.transform(1,0,0,this.ry/this.rx,0,0);ctx.arc(0,0,this.rx,0,piBy2,!1);ctx.restore();this._renderPaintInOrder(ctx)}});fabric.Ellipse.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("cx cy rx ry".split(" "));fabric.Ellipse.fromElement=function(element,callback){var parsedAttributes=fabric.parseAttributes(element,fabric.Ellipse.ATTRIBUTE_NAMES);parsedAttributes.left=(parsedAttributes.left||0)-parsedAttributes.rx;parsedAttributes.top=(parsedAttributes.top||0)-parsedAttributes.ry;callback(new fabric.Ellipse(parsedAttributes))};fabric.Ellipse.fromObject=function(object,callback){return fabric.Object._fromObject("Ellipse",object,callback)}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend;if(fabric.Rect){fabric.warn("fabric.Rect is already defined");return}fabric.Rect=fabric.util.createClass(fabric.Object,{stateProperties:fabric.Object.prototype.stateProperties.concat("rx","ry"),type:"rect",rx:0,ry:0,cacheProperties:fabric.Object.prototype.cacheProperties.concat("rx","ry"),initialize:function(options){this.callSuper("initialize",options);this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(ctx){if(this.width===1&&this.height===1){ctx.fillRect(-.5,-.5,1,1);return}var rx=this.rx?Math.min(this.rx,this.width/2):0,ry=this.ry?Math.min(this.ry,this.height/2):0,w=this.width,h=this.height,x=-this.width/2,y=-this.height/2,isRounded=rx!==0||ry!==0,k=1-.5522847498;ctx.beginPath();ctx.moveTo(x+rx,y);ctx.lineTo(x+w-rx,y);isRounded&&ctx.bezierCurveTo(x+w-k*rx,y,x+w,y+k*ry,x+w,y+ry);ctx.lineTo(x+w,y+h-ry);isRounded&&ctx.bezierCurveTo(x+w,y+h-k*ry,x+w-k*rx,y+h,x+w-rx,y+h);ctx.lineTo(x+rx,y+h);isRounded&&ctx.bezierCurveTo(x+k*rx,y+h,x,y+h-k*ry,x,y+h-ry);ctx.lineTo(x,y+ry);isRounded&&ctx.bezierCurveTo(x,y+k*ry,x+k*rx,y,x+rx,y);ctx.closePath();this._renderPaintInOrder(ctx)},_renderDashedStroke:function(ctx){var x=-this.width/2,y=-this.height/2,w=this.width,h=this.height;ctx.beginPath();fabric.util.drawDashedLine(ctx,x,y,x+w,y,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x+w,y,x+w,y+h,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x+w,y+h,x,y+h,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x,y+h,x,y,this.strokeDashArray);ctx.closePath()},toObject:function(propertiesToInclude){return this.callSuper("toObject",["rx","ry"].concat(propertiesToInclude))},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),x=-this.width/2,y=-this.height/2;
14return markup.push("<rect ",this.getSvgId(),'x="',x,'" y="',y,'" rx="',this.get("rx"),'" ry="',this.get("ry"),'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"',this.addPaintOrder(),"/>\n"),reviver?reviver(markup.join("")):markup.join("")}});fabric.Rect.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y rx ry width height".split(" "));fabric.Rect.fromElement=function(element,callback,options){var parsedAttributes,rect;if(!element)return callback(null);options=options||{};parsedAttributes=fabric.parseAttributes(element,fabric.Rect.ATTRIBUTE_NAMES);parsedAttributes.left=parsedAttributes.left||0;parsedAttributes.top=parsedAttributes.top||0;rect=new fabric.Rect(extend(options?fabric.util.object.clone(options):{},parsedAttributes));rect.visible=rect.visible&&rect.width>0&&rect.height>0;callback(rect)};fabric.Rect.fromObject=function(object,callback){return fabric.Object._fromObject("Rect",object,callback)}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,min=fabric.util.array.min,max=fabric.util.array.max,toFixed=fabric.util.toFixed;if(fabric.Polyline){fabric.warn("fabric.Polyline is already defined");return}fabric.Polyline=fabric.util.createClass(fabric.Object,{type:"polyline",points:null,cacheProperties:fabric.Object.prototype.cacheProperties.concat("points"),initialize:function(points,options){options=options||{};this.points=points||[];this.callSuper("initialize",options);var calcDim=this._calcDimensions();typeof options.left=="undefined"&&(this.left=calcDim.left);typeof options.top=="undefined"&&(this.top=calcDim.top);this.width=calcDim.width;this.height=calcDim.height;this.pathOffset={x:calcDim.left+this.width/2,y:calcDim.top+this.height/2}},_calcDimensions:function(){var points=this.points,minX=min(points,"x")||0,minY=min(points,"y")||0,maxX=max(points,"x")||0,maxY=max(points,"y")||0,width=maxX-minX,height=maxY-minY;return{left:minX,top:minY,width:width,height:height}},toObject:function(propertiesToInclude){return extend(this.callSuper("toObject",propertiesToInclude),{points:this.points.concat()})},toSVG:function(reviver){for(var points=[],diffX=this.pathOffset.x,diffY=this.pathOffset.y,markup=this._createBaseSVGMarkup(),NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS,i=0,len=this.points.length;i<len;i++)points.push(toFixed(this.points[i].x-diffX,NUM_FRACTION_DIGITS),",",toFixed(this.points[i].y-diffY,NUM_FRACTION_DIGITS)," ");return markup.push("<",this.type," ",this.getSvgId(),'points="',points.join(""),'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform()," ",this.getSvgTransformMatrix(),'"',this.addPaintOrder(),"/>\n"),reviver?reviver(markup.join("")):markup.join("")},commonRender:function(ctx){var point,len=this.points.length,x=this.pathOffset.x,y=this.pathOffset.y,i;if(!len||isNaN(this.points[len-1].y))return!1;for(ctx.beginPath(),ctx.moveTo(this.points[0].x-x,this.points[0].y-y),i=0;i<len;i++)point=this.points[i],ctx.lineTo(point.x-x,point.y-y);return!0},_render:function(ctx){this.commonRender(ctx)&&this._renderPaintInOrder(ctx)},_renderDashedStroke:function(ctx){var p1,p2,i,len;for(ctx.beginPath(),i=0,len=this.points.length;i<len;i++)p1=this.points[i],p2=this.points[i+1]||p1,fabric.util.drawDashedLine(ctx,p1.x,p1.y,p2.x,p2.y,this.strokeDashArray)},complexity:function(){return this.get("points").length}});fabric.Polyline.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat();fabric.Polyline.fromElement=function(element,callback,options){if(!element)return callback(null);options||(options={});var points=fabric.parsePointsAttribute(element.getAttribute("points")),parsedAttributes=fabric.parseAttributes(element,fabric.Polyline.ATTRIBUTE_NAMES);callback(new fabric.Polyline(points,fabric.util.object.extend(parsedAttributes,options)))};fabric.Polyline.fromObject=function(object,callback){return fabric.Object._fromObject("Polyline",object,callback,"points")}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend;if(fabric.Polygon){fabric.warn("fabric.Polygon is already defined");return}fabric.Polygon=fabric.util.createClass(fabric.Polyline,{type:"polygon",_render:function(ctx){this.commonRender(ctx)&&(ctx.closePath(),this._renderPaintInOrder(ctx))},_renderDashedStroke:function(ctx){this.callSuper("_renderDashedStroke",ctx);ctx.closePath()}});fabric.Polygon.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat();fabric.Polygon.fromElement=function(element,callback,options){if(!element)return callback(null);
14options||(options={});var points=fabric.parsePointsAttribute(element.getAttribute("points")),parsedAttributes=fabric.parseAttributes(element,fabric.Polygon.ATTRIBUTE_NAMES);callback(new fabric.Polygon(points,extend(parsedAttributes,options)))};fabric.Polygon.fromObject=function(object,callback){return fabric.Object._fromObject("Polygon",object,callback,"points")}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),min=fabric.util.array.min,max=fabric.util.array.max,extend=fabric.util.object.extend,_toString=Object.prototype.toString,drawArc=fabric.util.drawArc,commandLengths={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},repeatedCommands={m:"l",M:"L"};if(fabric.Path){fabric.warn("fabric.Path is already defined");return}fabric.Path=fabric.util.createClass(fabric.Object,{type:"path",path:null,cacheProperties:fabric.Object.prototype.cacheProperties.concat("path","fillRule"),stateProperties:fabric.Object.prototype.stateProperties.concat("path"),initialize:function(path,options){options=options||{};this.callSuper("initialize",options);path||(path=[]);var fromArray=_toString.call(path)==="[object Array]";(this.path=fromArray?path:path.match&&path.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi),this.path)&&(fromArray||(this.path=this._parsePath()),this._setPositionDimensions(options))},_setPositionDimensions:function(options){var calcDim=this._parseDimensions();this.width=calcDim.width;this.height=calcDim.height;typeof options.left=="undefined"&&(this.left=calcDim.left);typeof options.top=="undefined"&&(this.top=calcDim.top);this.pathOffset=this.pathOffset||{x:calcDim.left+this.width/2,y:calcDim.top+this.height/2}},_renderPathCommands:function(ctx){var current,previous=null,subpathStartX=0,subpathStartY=0,x=0,y=0,controlX=0,controlY=0,tempX,tempY,l=-this.pathOffset.x,t=-this.pathOffset.y,i,len;for(ctx.beginPath(),i=0,len=this.path.length;i<len;++i){current=this.path[i];switch(current[0]){case"l":x+=current[1];y+=current[2];ctx.lineTo(x+l,y+t);break;case"L":x=current[1];y=current[2];ctx.lineTo(x+l,y+t);break;case"h":x+=current[1];ctx.lineTo(x+l,y+t);break;case"H":x=current[1];ctx.lineTo(x+l,y+t);break;case"v":y+=current[1];ctx.lineTo(x+l,y+t);break;case"V":y=current[1];ctx.lineTo(x+l,y+t);break;case"m":x+=current[1];y+=current[2];subpathStartX=x;subpathStartY=y;ctx.moveTo(x+l,y+t);break;case"M":x=current[1];y=current[2];subpathStartX=x;subpathStartY=y;ctx.moveTo(x+l,y+t);break;case"c":tempX=x+current[5];tempY=y+current[6];controlX=x+current[3];controlY=y+current[4];ctx.bezierCurveTo(x+current[1]+l,y+current[2]+t,controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case"C":x=current[5];y=current[6];controlX=current[3];controlY=current[4];ctx.bezierCurveTo(current[1]+l,current[2]+t,controlX+l,controlY+t,x+l,y+t);break;case"s":tempX=x+current[3];tempY=y+current[4];previous[0].match(/[CcSs]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);ctx.bezierCurveTo(controlX+l,controlY+t,x+current[1]+l,y+current[2]+t,tempX+l,tempY+t);controlX=x+current[1];controlY=y+current[2];x=tempX;y=tempY;break;case"S":tempX=current[3];tempY=current[4];previous[0].match(/[CcSs]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);ctx.bezierCurveTo(controlX+l,controlY+t,current[1]+l,current[2]+t,tempX+l,tempY+t);x=tempX;y=tempY;controlX=current[1];controlY=current[2];break;case"q":tempX=x+current[3];tempY=y+current[4];controlX=x+current[1];controlY=y+current[2];ctx.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case"Q":tempX=current[3];tempY=current[4];ctx.quadraticCurveTo(current[1]+l,current[2]+t,tempX+l,tempY+t);x=tempX;y=tempY;controlX=current[1];controlY=current[2];break;case"t":tempX=x+current[1];tempY=y+current[2];previous[0].match(/[QqTt]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);ctx.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case"T":tempX=current[1];tempY=current[2];previous[0].match(/[QqTt]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);ctx.quadraticCurveTo(controlX+l,controlY+t,tempX+l,tempY+t);x=tempX;y=tempY;break;case"a":drawArc(ctx,x+l,y+t,[current[1],current[2],current[3],current[4],current[5],current[6]+x+l,current[7]+y+t]);x+=current[6];y+=current[7];break;case"A":drawArc(ctx,x+l,y+t,[current[1],current[2],current[3],current[4],current[5],current[6]+l,current[7]+t]);x=current[6];y=current[7];break;case"z":case"Z":x=subpathStartX;y=subpathStartY;ctx.closePath()}previous=current}},_render:function(ctx){this._renderPathCommands(ctx);this._renderPaintInOrder(ctx)},toString:function(){return"#<fabric.Path ("+this.complexity()+'): { "top": '+this.top+', "left"
14: '+this.left+" }>"},toObject:function(propertiesToInclude){return extend(this.callSuper("toObject",propertiesToInclude),{path:this.path.map(function(item){return item.slice()}),top:this.top,left:this.left})},toDatalessObject:function(propertiesToInclude){var o=this.toObject(["sourcePath"].concat(propertiesToInclude));return o.sourcePath&&delete o.path,o},toSVG:function(reviver){for(var path,chunks=[],markup=this._createBaseSVGMarkup(),addTransform="",i=0,len=this.path.length;i<len;i++)chunks.push(this.path[i].join(" "));return path=chunks.join(" "),addTransform=" translate("+-this.pathOffset.x+", "+-this.pathOffset.y+") ",markup.push("<path ",this.getSvgId(),'d="',path,'" style="',this.getSvgStyles(),'" transform="',this.getSvgTransform(),addTransform,this.getSvgTransformMatrix(),'" stroke-linecap="round" ',this.addPaintOrder(),"/>\n"),reviver?reviver(markup.join("")):markup.join("")},complexity:function(){return this.path.length},_parsePath:function(){for(var j,jlen,k,klen,result=[],coords=[],currentPath,parsed,re=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/ig,match,coordsStr,i=0,coordsParsed,len=this.path.length;i<len;i++){for(currentPath=this.path[i],coordsStr=currentPath.slice(1).trim(),coords.length=0;match=re.exec(coordsStr);)coords.push(match[0]);for(coordsParsed=[currentPath.charAt(0)],j=0,jlen=coords.length;j<jlen;j++)parsed=parseFloat(coords[j]),isNaN(parsed)||coordsParsed.push(parsed);var command=coordsParsed[0],commandLength=commandLengths[command.toLowerCase()],repeatedCommand=repeatedCommands[command]||command;if(coordsParsed.length-1>commandLength)for(k=1,klen=coordsParsed.length;k<klen;k+=commandLength)result.push([command].concat(coordsParsed.slice(k,k+commandLength))),command=repeatedCommand;else result.push(coordsParsed)}return result},_parseDimensions:function(){for(var aX=[],aY=[],current,previous=null,subpathStartX=0,subpathStartY=0,x=0,y=0,controlX=0,controlY=0,tempX,tempY,bounds,i=0,len=this.path.length;i<len;++i){current=this.path[i];switch(current[0]){case"l":x+=current[1];y+=current[2];bounds=[];break;case"L":x=current[1];y=current[2];bounds=[];break;case"h":x+=current[1];bounds=[];break;case"H":x=current[1];bounds=[];break;case"v":y+=current[1];bounds=[];break;case"V":y=current[1];bounds=[];break;case"m":x+=current[1];y+=current[2];subpathStartX=x;subpathStartY=y;bounds=[];break;case"M":x=current[1];y=current[2];subpathStartX=x;subpathStartY=y;bounds=[];break;case"c":tempX=x+current[5];tempY=y+current[6];controlX=x+current[3];controlY=y+current[4];bounds=fabric.util.getBoundsOfCurve(x,y,x+current[1],y+current[2],controlX,controlY,tempX,tempY);x=tempX;y=tempY;break;case"C":controlX=current[3];controlY=current[4];bounds=fabric.util.getBoundsOfCurve(x,y,current[1],current[2],controlX,controlY,current[5],current[6]);x=current[5];y=current[6];break;case"s":tempX=x+current[3];tempY=y+current[4];previous[0].match(/[CcSs]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,x+current[1],y+current[2],tempX,tempY);controlX=x+current[1];controlY=y+current[2];x=tempX;y=tempY;break;case"S":tempX=current[3];tempY=current[4];previous[0].match(/[CcSs]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,current[1],current[2],tempX,tempY);x=tempX;y=tempY;controlX=current[1];controlY=current[2];break;case"q":tempX=x+current[3];tempY=y+current[4];controlX=x+current[1];controlY=y+current[2];bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,controlX,controlY,tempX,tempY);x=tempX;y=tempY;break;case"Q":controlX=current[1];controlY=current[2];bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,controlX,controlY,current[3],current[4]);x=current[3];y=current[4];break;case"t":tempX=x+current[1];tempY=y+current[2];previous[0].match(/[QqTt]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,controlX,controlY,tempX,tempY);x=tempX;y=tempY;break;case"T":tempX=current[1];tempY=current[2];previous[0].match(/[QqTt]/)===null?(controlX=x,controlY=y):(controlX=2*x-controlX,controlY=2*y-controlY);bounds=fabric.util.getBoundsOfCurve(x,y,controlX,controlY,controlX,controlY,tempX,tempY);x=tempX;y=tempY;break;case"a":bounds=fabric.util.getBoundsOfArc(x,y,current[1],current[2],current[3],current[4],current[5],current[6]+x,current[7]+y);x+=current[6];y+=current[7];break;case"A":bounds=fabric.util.getBoundsOfArc(x,y,current[1],current[2],current[3],current[4],current[5],current[6],current[7]);x=current[6];y=current[7];break;case"z":case"Z":x=subpathStartX;y=subpathStartY}previous=current;bounds.forEach(function(point){aX.push(point.x);aY.push(point.y)});aX.push(x);aY.push(y)}var minX=min(aX)||0,minY=min(aY)||0,maxX=max(aX)||0,maxY=max(aY)||0,deltaX=maxX-minX,deltaY=maxY-minY;return{left:minX,top:minY,width:deltaX,height:deltaY}}});fabric.Path.fromObject=function(object,callback){if(typeof object.sourcePath=="string"){var pathUrl=object.sourcePath;fabric.loadSVGFromURL(pathUrl,function(elements){var path=elements[0];path.setOptions(object);callback&&callback(path)})}else fabric.Object._fromObject("Path",object,callback,"path")};fabric.Path.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat(["d"]);fabric.Path.fromElement=function(element,callback,options){var parsedAttributes=fabric.parseAttributes(element,fabric.Path.ATTRIBUTE_NAMES);callback(new fabric.Path(parsedAttributes.d,extend(parsedAttributes,options)))}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),min=fabric.util.array.min,max=fabric.util.array.max;fabric.Group||(fabric.Group=fabric.util.createClass(fabric.Object,fabric.Collection,{type:"group",strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(objects,options,isAlreadyGrouped){var i,center;for(options=options||{},this._objects=[],isAlreadyGrouped&&this.callSuper("initialize",options),this._objects=objects||[],i=this._objects.length;i--;)this._objects[i].group=this;isAlreadyGrouped?this._updateObjectsACoords():(center=options&&options.centerPoint,options.originX!==un
14defined&&(this.originX=options.originX),options.originY!==undefined&&(this.originY=options.originY),center||this._calcBounds(),this._updateObjectsCoords(center),delete options.centerPoint,this.callSuper("initialize",options));this.setCoords()},_updateObjectsACoords:function(){for(var i=this._objects.length;i--;)this._objects[i].setCoords(!0,!0)},_updateObjectsCoords:function(center){for(var center=center||this.getCenterPoint(),i=this._objects.length;i--;)this._updateObjectCoords(this._objects[i],center)},_updateObjectCoords:function(object,center){var objectLeft=object.left,objectTop=object.top;object.set({left:objectLeft-center.x,top:objectTop-center.y});object.group=this;object.setCoords(!0,!0)},toString:function(){return"#<fabric.Group: ("+this.complexity()+")>"},addWithUpdate:function(object){return this._restoreObjectsState(),fabric.util.resetObjectTransform(this),object&&(this._objects.push(object),object.group=this,object._set("canvas",this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},removeWithUpdate:function(object){return this._restoreObjectsState(),fabric.util.resetObjectTransform(this),this.remove(object),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(object){this.dirty=!0;object.group=this;object._set("canvas",this.canvas)},_onObjectRemoved:function(object){this.dirty=!0;delete object.group},_set:function(key,value){var i=this._objects.length;if(this.useSetOnGroup)while(i--)this._objects[i].setOnGroup(key,value);if(key==="canvas")while(i--)this._objects[i]._set(key,value);fabric.Object.prototype._set.call(this,key,value)},toObject:function(propertiesToInclude){var objsToObject=this._objects.map(function(obj){var originalDefaults=obj.includeDefaultValues,_obj;return obj.includeDefaultValues=obj.group.includeDefaultValues,_obj=obj.toObject(propertiesToInclude),obj.includeDefaultValues=originalDefaults,_obj}),obj=fabric.Object.prototype.toObject.call(this,propertiesToInclude);return obj.objects=objsToObject,obj},toDatalessObject:function(propertiesToInclude){var objsToObject,sourcePath=this.sourcePath,obj;return objsToObject=sourcePath?sourcePath:this._objects.map(function(obj){var originalDefaults=obj.includeDefaultValues,_obj;return obj.includeDefaultValues=obj.group.includeDefaultValues,_obj=obj.toDatalessObject(propertiesToInclude),obj.includeDefaultValues=originalDefaults,_obj}),obj=fabric.Object.prototype.toDatalessObject.call(this,propertiesToInclude),obj.objects=objsToObject,obj},render:function(ctx){this._transformDone=!0;this.callSuper("render",ctx);this._transformDone=!1},shouldCache:function(){var ownCache=this.objectCaching&&(!this.group||this.needsItsOwnCache()||!this.group.isOnACache()),i,len;if(this.ownCaching=ownCache,ownCache)for(i=0,len=this._objects.length;i<len;i++)if(this._objects[i].willDrawShadow())return this.ownCaching=!1,!1;return ownCache},willDrawShadow:function(){if(this.shadow)return fabric.Object.prototype.willDrawShadow.call(this);for(var i=0,len=this._objects.length;i<len;i++)if(this._objects[i].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(ctx){for(var i=0,len=this._objects.length;i<len;i++)this._objects[i].render(ctx)},isCacheDirty:function(){var i,len,x,y;if(this.callSuper("isCacheDirty"))return!0;if(!this.statefullCache)return!1;for(i=0,len=this._objects.length;i<len;i++)if(this._objects[i].isCacheDirty(!0))return this._cacheCanvas&&(x=this.cacheWidth/this.zoomX,y=this.cacheHeight/this.zoomY,this._cacheContext.clearRect(-x/2,-y/2,x,y)),!0;return!1},_restoreObjectsState:function(){return this._objects.forEach(this._restoreObjectState,this),this},realizeTransform:function(object){var matrix=object.calcTransformMatrix(),options=fabric.util.qrDecompose(matrix),center=new fabric.Point(options.translateX,options.translateY);return object.flipX=!1,object.flipY=!1,object.set("scaleX",options.scaleX),object.set("scaleY",options.scaleY),object.skewX=options.skewX,object.skewY=options.skewY,object.angle=options.angle,object.setPositionByOrigin(center,"center","center"),object},_restoreObjectState:function(object){return this.realizeTransform(object),object.setCoords(),delete object.group,this}
14,destroy:function(){return this._objects.forEach(function(object){object.set("dirty",!0)}),this._restoreObjectsState()},toActiveSelection:function(){var objects,canvas,options,activeSelection;if(this.canvas)return objects=this._objects,canvas=this.canvas,this._objects=[],options=this.toObject(),delete options.objects,activeSelection=new fabric.ActiveSelection([]),activeSelection.set(options),activeSelection.type="activeSelection",canvas.remove(this),objects.forEach(function(object){object.group=activeSelection;object.dirty=!0;canvas.add(object)}),activeSelection.canvas=canvas,activeSelection._objects=objects,canvas._activeObject=activeSelection,activeSelection.setCoords(),activeSelection},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){var ignoreZoom=!0,skipAbsolute=!0;return this.forEachObject(function(object){object.setCoords(ignoreZoom,skipAbsolute)}),this},_calcBounds:function(onlyWidthHeight){for(var aX=[],aY=[],o,prop,props=["tr","br","bl","tl"],i=0,iLen=this._objects.length,j,jLen=props.length;i<iLen;++i)for(o=this._objects[i],o.setCoords(!0),j=0;j<jLen;j++)prop=props[j],aX.push(o.oCoords[prop].x),aY.push(o.oCoords[prop].y);this._getBounds(aX,aY,onlyWidthHeight)},_getBounds:function(aX,aY,onlyWidthHeight){var minXY=new fabric.Point(min(aX),min(aY)),maxXY=new fabric.Point(max(aX),max(aY)),top=minXY.y||0,left=minXY.x||0,width=maxXY.x-minXY.x||0,height=maxXY.y-minXY.y||0;this.width=width;this.height=height;onlyWidthHeight||this.setPositionByOrigin({x:left,y:top},"left","top")},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),i,len;for(markup.push("<g ",this.getSvgId(),'transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'" style="',this.getSvgFilter(),'">\n'),i=0,len=this._objects.length;i<len;i++)markup.push("\t",this._objects[i].toSVG(reviver));return markup.push("<\/g>\n"),reviver?reviver(markup.join("")):markup.join("")}}),fabric.Group.fromObject=function(object,callback){fabric.util.enlivenObjects(object.objects,function(enlivenedObjects){var options=fabric.util.object.clone(object,!0);delete options.objects;callback&&callback(new fabric.Group(enlivenedObjects,options,!0))})})}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={});fabric.ActiveSelection||(fabric.ActiveSelection=fabric.util.createClass(fabric.Group,{type:"activeSelection",initialize:function(objects,options){options=options||{};this._objects=objects||[];for(var i=this._objects.length;i--;)this._objects[i].group=this;options.originX&&(this.originX=options.originX);options.originY&&(this.originY=options.originY);this._calcBounds();this._updateObjectsCoords();fabric.Object.prototype.initialize.call(this,options);this.setCoords()},toGroup:function(){var objects=this._objects.concat(),options,newGroup,canvas;return(this._objects=[],options=fabric.Object.prototype.toObject.call(this),newGroup=new fabric.Group([]),delete options.type,newGroup.set(options),objects.forEach(function(object){object.canvas.remove(object);object.group=newGroup}),newGroup._objects=objects,!this.canvas)?newGroup:(canvas=this.canvas,canvas.add(newGroup),canvas._activeObject=newGroup,newGroup.setCoords(),newGroup)},onDeselect:function(){return this.destroy(),!1},toString:function(){return"#<fabric.ActiveSelection: ("+this.complexity()+")>"},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(ctx,styleOverride,childrenOverride){ctx.save();ctx.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1;this.callSuper("_renderControls",ctx,styleOverride);childrenOverride=childrenOverride||{};typeof childrenOverride.hasControls=="undefined"&&(childrenOverride.hasControls=!1);typeof childrenOverride.hasRotatingPoint=="undefined"&&(childrenOverride.hasRotatingPoint=!1);childrenOverride.forActiveSelection=!0;for(var i=0,len=this._objects.length;i<len;i++)this._objects[i]._renderControls(ctx,childrenOverride);ctx.restore()}}),fabric.ActiveSelection.fromObject=function(object,callback){fabric.util.enlivenObjects(object.objects,function(enlivenedObjects){delete object.objects;callback&&callback(new fabric.ActiveSelection(enlivenedObjects,object,!0))})})}(typeof exports!="undefined"?exports:this),function(global){"use strict";var extend=fabric.util.object.extend;if(global.fabric||(global.fabric={}),global.fabric.Image){fabric.warn("fabric.Image is already defined.");return}fabric.Image=fabric.util.createClass(fabric.Object,{type:"image",crossOrigin:"",strokeWidth:0,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:fabric.Object.prototype.stateProperties.concat("cropX","cropY"),objectCaching:!1,cacheKey:"",cropX:0,cropY:0,initialize:function(element,options){options||(options={});this.filters=[];this.cacheKey="texture"+fabric.Object.__uid++;this.callSuper("initialize",options);this._initElement(element,options)},getElement:function(){return this._element||{}},setElement:function(element,options){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+"_filtered"),this._element=element,this._originalElement=element,this._initConfig(options),this.resizeFilter&&this.applyResizeFilters(),this.filters.length!==0&&this.applyFilters(),this},removeTexture:function(key){var backend=fabric.filterBackend;backend&&backend.evictCachesForKey&&backend.evictCachesForKey(key)},dispose:function(){this.removeTexture(this.cacheKey);this.removeTexture(this.cacheKey+"_filtered");this._cacheContext=undefined;["_originalElement","_element","_filteredEl","_cacheCanvas"].forEach(function(element){fabric.util.cleanUpJsdomNode(this[element]);this[element]=undefined}.bind(this))},setCrossOrigin:function(value){return this.crossOrigin=value,this._element.crossOrigin=value,this},getOriginalSize:function(){var element=this.getElement();
14return{width:element.naturalWidth||element.width,height:element.naturalHeight||element.height}},_stroke:function(ctx){if(this.stroke&&this.strokeWidth!==0){var w=this.width/2,h=this.height/2;ctx.beginPath();ctx.moveTo(-w,-h);ctx.lineTo(w,-h);ctx.lineTo(w,h);ctx.lineTo(-w,h);ctx.lineTo(-w,-h);ctx.closePath()}},_renderDashedStroke:function(ctx){var x=-this.width/2,y=-this.height/2,w=this.width,h=this.height;ctx.save();this._setStrokeStyles(ctx,this);ctx.beginPath();fabric.util.drawDashedLine(ctx,x,y,x+w,y,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x+w,y,x+w,y+h,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x+w,y+h,x,y+h,this.strokeDashArray);fabric.util.drawDashedLine(ctx,x,y+h,x,y,this.strokeDashArray);ctx.closePath();ctx.restore()},toObject:function(propertiesToInclude){var filters=[],object;return this.filters.forEach(function(filterObj){filterObj&&filters.push(filterObj.toObject())}),object=extend(this.callSuper("toObject",["crossOrigin","cropX","cropY"].concat(propertiesToInclude)),{src:this.getSrc(),filters:filters}
14),this.resizeFilter&&(object.resizeFilter=this.resizeFilter.toObject()),object},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),x=-this.width/2,y=-this.height/2,clipPath="",clipPathId,imageMarkup,origFill;return this.hasCrop()&&(clipPathId=fabric.Object.__uid++,markup.push('<clipPath id="imageCrop_'+clipPathId+'">\n','\t<rect x="'+x+'" y="'+y+'" width="'+this.width+'" height="'+this.height+'" />\n',"<\/clipPath>\n"),clipPath=' clip-path="url(#imageCrop_'+clipPathId+')" '),markup.push('<g transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'">\n'),imageMarkup=["\t<image ",this.getSvgId(),'xlink:href="',this.getSvgSrc(!0),'" x="',x-this.cropX,'" y="',y-this.cropY,'" style="',this.getSvgStyles(),'" width="',this._element.width||this._element.naturalWidth,'" height="',this._element.height||this._element.height,'"',clipPath,"><\/image>\n"],this.paintFirst==="fill"&&Array.prototype.push.apply(markup,imageMarkup),(this.stroke||this.strokeDashArray)&&(origFill=this.fill,this.fill=null,markup.push("\t<rect ",'x="',x,'" y="',y,'" width="',this.width,'" height="',this.height,'" style="',this.getSvgStyles(),'"/>\n'),this.fill=origFill),this.paintFirst!=="fill"&&Array.prototype.push.apply(markup,imageMarkup),markup.push("<\/g>\n"),reviver?reviver(markup.join("")):markup.join("")},getSrc:function(filtered){var element=filtered?this._element:this._originalElement;return element?element.toDataURL?element.toDataURL():element.src:this.src||""},setSrc:function(src,callback,options){return fabric.util.loadImage(src,function(img){this.setElement(img,options);this._setWidthHeight();callback(this)},this,options&&options.crossOrigin),this},toString:function(){return'#<fabric.Image: { src: "'+this.getSrc()+'" }>'},applyResizeFilters:function(){var filter=this.resizeFilter,minimumScale=this.minimumScaleTrigger,objectScale=this.getTotalObjectScaling(),scaleX=objectScale.scaleX,scaleY=objectScale.scaleY,elementToFilter=this._filteredEl||this._originalElement;if(this.group&&this.set("dirty",!0),!filter||scaleX>minimumScale&&scaleY>minimumScale){this._element=elementToFilter;this._filterScalingX=1;this._filterScalingY=1;this._lastScaleX=scaleX;this._lastScaleY=scaleY;return}fabric.filterBackend||(fabric.filterBackend=fabric.initFilterBackend());var canvasEl=fabric.util.createCanvasElement(),cacheKey=this._filteredEl?this.cacheKey+"_filtered":this.cacheKey,sourceWidth=elementToFilter.width,sourceHeight=elementToFilter.height;canvasEl.width=sourceWidth;canvasEl.height=sourceHeight;this._element=canvasEl;this._lastScaleX=filter.scaleX=scaleX;this._lastScaleY=filter.scaleY=scaleY;fabric.filterBackend.applyFilters([filter],elementToFilter,sourceWidth,sourceHeight,this._element,cacheKey);this._filterScalingX=canvasEl.width/this._originalElement.width;this._filterScalingY=canvasEl.height/this._originalElement.height},applyFilters:function(filters){var canvasEl;if(filters=filters||this.filters||[],filters=filters.filter(function(filter){return filter&&!filter.isNeutralState()}),this.group&&this.set("dirty",!0),this.removeTexture(this.cacheKey+"_filtered"),filters.length===0)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;
14var imgElement=this._originalElement,sourceWidth=imgElement.naturalWidth||imgElement.width,sourceHeight=imgElement.naturalHeight||imgElement.height;return this._element===this._originalElement?(canvasEl=fabric.util.createCanvasElement(),canvasEl.width=sourceWidth,canvasEl.height=sourceHeight,this._element=canvasEl,this._filteredEl=canvasEl):(this._element=this._filteredEl,this._filteredEl.getContext("2d").clearRect(0,0,sourceWidth,sourceHeight),this._lastScaleX=1,this._lastScaleY=1),fabric.filterBackend||(fabric.filterBackend=fabric.initFilterBackend()),fabric.filterBackend.applyFilters(filters,this._originalElement,sourceWidth,sourceHeight,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(ctx){this.isMoving!==!0&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters();this._stroke(ctx);this._renderPaintInOrder(ctx)},_renderFill:function(ctx){var w=this.width,h=this.height,sW=w*this._filterScalingX,sH=h*this._filterScalingY,x=-w/2,y=-h/2,elementToDraw=this._element;elementToDraw&&ctx.drawImage(elementToDraw,this.cropX*this._filterScalingX,this.cropY*this._filterScalingY,sW,sH,x,y,w,h)},_needsResize:function(){var scale=this.getTotalObjectScaling();return scale.scaleX!==this._lastScaleX||scale.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(element,options){this.setElement(fabric.util.getById(element),options);fabric.util.addClass(this.getElement(),fabric.Image.CSS_CANVAS)},_initConfig:function(options){options||(options={});this.setOptions(options);this._setWidthHeight(options);this._element&&this.crossOrigin&&(this._element.crossOrigin=this.crossOrigin)},_initFilters:function(filters,callback){filters&&filters.length?fabric.util.enlivenObjects(filters,function(enlivenedObjects){callback&&callback(enlivenedObjects)},"fabric.Image.filters"):callback&&callback()},_setWidthHeight:function(options){options||(options={});var el=this.getElement();this.width=options.width||el.naturalWidth||el.width||0;this.height=options.height||el.naturalHeight||el.height||0},parsePreserveAspectRatioAttribute:function(){var pAR=fabric.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||""),rWidth=this._element.width,rHeight=this._element.height,scaleX=1,scaleY=1,offsetLeft=0,offsetTop=0,cropX=0,cropY=0,offset,pWidth=this.width,pHeight=this.height,parsedAttributes={width:pWidth,height:pHeight};return pAR&&(pAR.alignX!=="none"||pAR.alignY!=="none")?(pAR.meetOrSlice==="meet"&&(scaleX=scaleY=fabric.util.findScaleToFit(this._element,parsedAttributes),offset=(pWidth-rWidth*scaleX)/2,pAR.alignX==="Min"&&(offsetLeft=-offset),pAR.alignX==="Max"&&(offsetLeft=offset),offset=(pHeight-rHeight*scaleY)/2,pAR.alignY==="Min"&&(offsetTop=-offset),pAR.alignY==="Max"&&(offsetTop=offset)),pAR.meetOrSlice==="slice"&&(scaleX=scaleY=fabric.util.findScaleToCover(this._element,parsedAttributes),offset=rWidth-pWidth/scaleX,pAR.alignX==="Mid"&&(cropX=offset/2),pAR.alignX==="Max"&&(cropX=offset),offset=rHeight-pHeight/scaleY,pAR.alignY==="Mid"&&(cropY=offset/2),pAR.alignY==="Max"&&(cropY=offset),rWidth=pWidth/scaleX,rHeight=pHeight/scaleY)):(scaleX=pWidth/rWidth,scaleY=pHeight/rHeight),{width:rWidth,height:rHeight,scaleX:scaleX,scaleY:scaleY,offsetLeft:offsetLeft,offsetTop:offsetTop,cropX:cropX,cropY:cropY}}});fabric.Image.CSS_CANVAS="canvas-img";fabric.Image.prototype.getSvgSrc=fabric.Image.prototype.getSrc;fabric.Image.fromObject=function(_object,callback){var object=fabric.util.object.clone(_object);fabric.util.loadImage(object.src,function(img,error){if(error){callback&&callback(null,error);return}fabric.Image.prototype._initFilters.call(object,object.filters,function(filters){object.filters=filters||[];fabric.Image.prototype._initFilters.call(object,[object.resizeFilter],function(resizeFilters){object.resizeFilter=resizeFilters[0];var image=new fabric.Image(img,object);callback(image)})})},null,object.crossOrigin)};fabric.Image.fromURL=function(url,callback,imgOptions){fabric.util.loadImage(url,function(img){callback&&callback(new fabric.Image(img,imgOptions))},null,imgOptions&&imgOptions.crossOrigin)};fabric.Image.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y width height preserveAspectRatio xlink:href crossOrigin".split(" "));fabric.Image.fromElement=function(element,callback,options){var parsedAttributes=fabric.parseAttributes(element,fabric.Image.ATTRIBUTE_NAMES);fabric.Image.fromURL(parsedAttributes["xlink:href"],callback,extend(options?fabric.util.object.clone(options):{},parsedAttributes))}}(typeof exports!="undefined"?exports:this);fabric.util.object.extend(fabric.Object.prototype,{_getAngleValueForStraighten:function(){var angle=this.angle%360;return angle>0?Math.round((angle-1)/90)*90:Math.round(angle/90)*90},straighten:function(){return this.rotate(this._getAngleValueForStraighten()),this},fxStraighten:function(callbacks){callbacks=callbacks||{};var empty=function(){},onComplete=callbacks.onComplete||empty,onChange=callbacks.onChange||empty,_this=this;return fabric.util.animate({startValue:this.get("angle"),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(value){_this.rotate(value);onChange()},onComplete:function(){_this.setCoords();onComplete()}}),this}});fabric.util.object.extend(fabric.StaticCanvas.prototype,{straightenObject:function(object){return object.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(object){return object.fxStraighten({onCh
14ange:this.requestRenderAllBound}),this}}),function(){"use strict";function testPrecision(gl,precision){var fragmentSource="precision "+precision+" float;\nvoid main(){}",fragmentShader=gl.createShader(gl.FRAGMENT_SHADER);return(gl.shaderSource(fragmentShader,fragmentSource),gl.compileShader(fragmentShader),!gl.getShaderParameter(fragmentShader,gl.COMPILE_STATUS))?!1:!0}function WebglFilterBackend(options){options&&options.tileSize&&(this.tileSize=options.tileSize);this.setupGLContext(this.tileSize,this.tileSize);this.captureGPUInfo()}fabric.isWebglSupported=function(tileSize){var precisions,i;if(fabric.isLikelyNode)return!1;tileSize=tileSize||fabric.WebglFilterBackend.prototype.tileSize;var canvas=document.createElement("canvas"),gl=canvas.getContext("webgl")||canvas.getContext("experimental-webgl"),isSupported=!1;if(gl)for(fabric.maxTextureSize=gl.getParameter(gl.MAX_TEXTURE_SIZE),isSupported=fabric.maxTextureSize>=tileSize,precisions=["highp","mediump","lowp"],i=0;i<3;i++)if(testPrecision(gl,precisions[i])){fabric.webGlPrecision=precisions[i];break}return this.isSupported=isSupported,isSupported};fabric.WebglFilterBackend=WebglFilterBackend;WebglFilterBackend.prototype={tileSize:2048,resources:{},setupGLContext:function(width,height){this.dispose();this.createWebGLCanvas(width,height);this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]);this.chooseFastestCopyGLTo2DMethod(width,height)},chooseFastestCopyGLTo2DMethod:function(width,height){var canMeasurePerf=typeof performance!="undefined",canUseImageData,canUseArrayBuffer,canUseUint8Clamped;try{new ImageData(1,1);canUseImageData=!0}catch(e){canUseImageData=!1}if(canUseArrayBuffer=typeof ArrayBuffer!="undefined",canUseUint8Clamped=typeof Uint8ClampedArray!="undefined",canMeasurePerf&&canUseImageData&&canUseArrayBuffer&&canUseUint8Clamped){var targetCanvas=fabric.util.createCanvasElement(),imageBuffer=new ArrayBuffer(width*height*4),testContext={imageBuffer:imageBuffer,destinationWidth:width,destinationHeight:height,targetCanvas:targetCanvas},startTime,drawImageTime,putImageDataTime;targetCanvas.width=width;targetCanvas.height=height;startTime=window.performance.now();copyGLTo2DDrawImage.call(testContext,this.gl,testContext);drawImageTime=window.performance.now()-startTime;startTime=window.performance.now();copyGLTo2DPutImageData.call(testContext,this.gl,testContext);putImageDataTime=window.performance.now()-startTime;drawImageTime>putImageDataTime?(this.imageBuffer=imageBuffer,this.copyGLTo2D=copyGLTo2DPutImageData):this.copyGLTo2D=copyGLTo2DDrawImage}},createWebGLCanvas:function(width,height){var canvas=fabric.util.createCanvasElement(),glOptions,gl;(canvas.width=width,canvas.height=height,glOptions={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},gl=canvas.getContext("webgl",glOptions),gl||(gl=canvas.getContext("experimental-webgl",glOptions)),gl)&&(gl.clearColor(0,0,0,0),this.canvas=canvas,this.gl=gl)},applyFilters:function(filters,source,width,height,targetCanvas,cacheKey){var gl=this.gl,cachedTexture,pipelineState,tempFbo;return cacheKey&&(cachedTexture=this.getCachedTexture(cacheKey,source)),pipelineState={originalWidth:source.width||source.originalWidth,originalHeight:source.height||source.originalHeight,sourceWidth:width,sourceHeight:height,destinationWidth:width,destinationHeight:height,context:gl,sourceTexture:this.createTexture(gl,width,height,!cachedTexture&&source),targetTexture:this.createTexture(gl,width,height),originalTexture:cachedTexture||this.createTexture(gl,width,height,!cachedTexture&&source),passes:filters.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:targetCanvas},tempFbo=gl.createFramebuffer(),gl.bindFramebuffer(gl.FRAMEBUFFER,tempFbo),filters.forEach(function(filter){filter&&filter.applyTo(pipelineState)}),resizeCanvasIfNeeded(pipelineState),this.copyGLTo2D(gl,pipelineState),gl.bindTexture(gl.TEXTURE_2D,null),gl.deleteTexture(pipelineState.sourceTexture),gl.deleteTexture(pipelineState.targetTexture),gl.deleteFramebuffer(tempFbo),targetCanvas.getContext("2d").setTransform(1,0,0,1,0,0),pipelineState},applyFiltersDebug:function(filters,source,width,height,targetCanvas,cacheKey){var gl=this.gl,ret=this.applyFilters(filters,source,width,height,targetCanvas,cacheKey),glError=gl.getError(),errorString,error;if(glError!==gl.NO_ERROR){errorString=this.glErrorToString(gl,glError);error=new Error("WebGL Error "+errorString);error.glErrorCode=glError;throw error;}return ret},glErrorToString:function(context,errorCode){if(context){if(typeof errorCode!="number")return"Error code is not a number"}else return"Context undefined for error code: "+errorCode;switch(errorCode){case context.NO_ERROR:return"NO_ERROR";case context.INVALID_ENUM:return"INVALID_ENUM";case context.INVALID_VALUE:return"INVALID_VALUE";case context.INVALID_OPERATION:return"INVALID_OPERATION";case context.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case context.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case context.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"UNKNOWN_ERROR"}},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null);this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={};this.textureCache={}},createTexture:function(gl,width,height,textureImageSource){var texture=gl.createTexture();return gl.bindTexture(gl.TEXTURE_2D,texture),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE),gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE),textureImageSource?gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,gl.RGBA,gl.UNSIGNED_BYTE,textureImageSource):gl.texImage2D(gl.TEXTURE_2D,0,gl.RGBA,width,height,0,gl.RGBA,gl.UNSIGNED_BYTE,null),texture},getCachedTexture:function(uniqueId,textureImageSource){if(this.textureCache[uniqueId])return this.textureCache[uniqueId];var texture=this.createTexture(this.gl,textureImageSource.width,textureImageSource.height,textureImageSource);return this.textureCache[uniqueId]=texture,texture},evictCachesForKey:function(cacheKey){this.textureCache[cacheKey]&&(this.gl.deleteTexture(this.textureCache[cacheKey]),delete this.textureCache[cacheKey])},copyGLTo2D:copyGLTo2DDrawImage,captureGPUInfo:function(){var renderer,vendor;if(this.gpuInfo)return this.gpuInfo;var gl=this.gl,ext=gl.getExtension("WEBGL_debug_renderer_info"),gpuInfo={renderer:"",vendor:""};return ext&&(renderer=gl.getParameter(ext.UNMASKED_RENDERER_WEBGL),vendor=gl.getParameter(ext.UNMASKED_VENDOR_WEBGL),renderer&&(gpuInfo.renderer=renderer.toLowerCase()),vendor&&(gpuInfo.vendor=vendor.toLowerCase())),this.gpuInfo=gpuInfo,gpuInfo}}}(),function(){"use strict";function Canvas2dFilterBackend(){}var noop=function(){};fabric.Canvas2dFilterBackend=Canvas2dFilterBackend;Canvas2dFilterBackend.prototype={evictCachesForKey:noop,dispose:noop,clearWebGLCaches:noop,resources:{}
14,applyFilters:function(filters,sourceElement,sourceWidth,sourceHeight,targetCanvas){var ctx=targetCanvas.getContext("2d");ctx.drawImage(sourceElement,0,0,sourceWidth,sourceHeight);var imageData=ctx.getImageData(0,0,sourceWidth,sourceHeight),originalImageData=ctx.getImageData(0,0,sourceWidth,sourceHeight),pipelineState={sourceWidth:sourceWidth,sourceHeight:sourceHeight,imageData:imageData,originalEl:sourceElement,originalImageData:originalImageData,canvasEl:targetCanvas,ctx:ctx,filterBackend:this};return filters.forEach(function(filter){filter.applyTo(pipelineState)}),(pipelineState.imageData.width!==sourceWidth||pipelineState.imageData.height!==sourceHeight)&&(targetCanvas.width=pipelineState.imageData.width,targetCanvas.height=pipelineState.imageData.height),ctx.putImageData(pipelineState.imageData,0,0),pipelineState}}}();fabric.Image.filters=fabric.Image.filters||{};fabric.Image.filters.BaseFilter=fabric.util.createClass({type:"BaseFilter",vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvoid main() {\nvTexCoord = aPosition;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:"precision highp float;\nvarying vec2 vTexCoord;\nuniform sampler2D uTexture;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\n}",initialize:function(options){options&&this.setOptions(options)},setOptions:function(options){for(var prop in options)this[prop]=options[prop]},createProgram:function(gl,fragmentSource,vertexSource){var vertexShader,fragmentShader,program,attributeLocations,uniformLocations;if(fragmentSource=fragmentSource||this.fragmentSource,vertexSource=vertexSource||this.vertexSource,fabric.webGlPrecision!=="highp"&&(fragmentSource=fragmentSource.replace(/precision highp float/g,"precision "+fabric.webGlPrecision+" float")),vertexShader=gl.createShader(gl.VERTEX_SHADER),gl.shaderSource(vertexShader,vertexSource),gl.compileShader(vertexShader),!gl.getShaderParameter(vertexShader,gl.COMPILE_STATUS))throw new Error("Vertex shader compile error for "+this.type+": "+gl.getShaderInfoLog(vertexShader));if(fragmentShader=gl.createShader(gl.FRAGMENT_SHADER),gl.shaderSource(fragmentShader,fragmentSource),gl.compileShader(fragmentShader),!gl.getShaderParameter(fragmentShader,gl.COMPILE_STATUS))throw new Error("Fragment shader compile error for "+this.type+": "+gl.getShaderInfoLog(fragmentShader));if(program=gl.createProgram(),gl.attachShader(program,vertexShader),gl.attachShader(program,fragmentShader),gl.linkProgram(program),!gl.getProgramParameter(program,gl.LINK_STATUS))throw new Error('Shader link error for "${this.type}" '+gl.getProgramInfoLog(program));return attributeLocations=this.getAttributeLocations(gl,program),uniformLocations=this.getUniformLocations(gl,program)||{},uniformLocations.uStepW=gl.getUniformLocation(program,"uStepW"),uniformLocations.uStepH=gl.getUniformLocation(program,"uStepH"),{program:program,attributeLocations:attributeLocations,uniformLocations:uniformLocations}},getAttributeLocations:function(gl,program){return{aPosition:gl.getAttribLocation(program,"aPosition")}},getUniformLocations:function(){return{}},sendAttributeData:function(gl,attributeLocations,aPositionData){var attributeLocation=attributeLocations.aPosition,buffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,buffer);gl.enableVertexAttribArray(attributeLocation);gl.vertexAttribPointer(attributeLocation,2,gl.FLOAT,!1,0,0);gl.bufferData(gl.ARRAY_BUFFER,aPositionData,gl.STATIC_DRAW)},_setupFrameBuffer:function(options){var gl=options.context,width,height;options.passes>1?(width=options.destinationWidth,height=options.destinationHeight,(options.sourceWidth!==width||options.sourceHeight!==height)&&(gl.deleteTexture(options.targetTexture),options.targetTexture=options.filterBackend.createTexture(gl,width,height)),gl.framebufferTexture2D(gl.FRAMEBUFFER,gl.COLOR_ATTACHMENT0,gl.TEXTURE_2D,options.targetTexture,0)):(gl.bindFramebuffer(gl.FRAMEBUFFER,null),gl.finish())},_swapTextures:function(options){options.passes--;options.pass++;var temp=options.targetTexture;options.targetTexture=options.sourceTexture;options.sourceTexture=temp},isNeutralState:function(){var main=this.mainParameter,_class=fabric.Image.filters[this.type].prototype,i;
14if(main){if(Array.isArray(_class[main])){for(i=_class[main].length;i--;)if(this[main][i]!==_class[main][i])return!1;return!0}return _class[main]===this[main]}return!1},applyTo:function(options){options.webgl?(this._setupFrameBuffer(options),this.applyToWebGL(options),this._swapTextures(options)):this.applyTo2d(options)},retrieveShader:function(options){return options.programCache.hasOwnProperty(this.type)||(options.programCache[this.type]=this.createProgram(options.context)),options.programCache[this.type]},applyToWebGL:function(options){var gl=options.context,shader=this.retrieveShader(options);options.pass===0&&options.originalTexture?gl.bindTexture(gl.TEXTURE_2D,options.originalTexture):gl.bindTexture(gl.TEXTURE_2D,options.sourceTexture);gl.useProgram(shader.program);this.sendAttributeData(gl,shader.attributeLocations,options.aPosition);gl.uniform1f(shader.uniformLocations.uStepW,1/options.sourceWidth);gl.uniform1f(shader.uniformLocations.uStepH,1/options.sourceHeight);this.sendUniformData(gl,shader.uniformLocations);gl.viewport(0,0,options.destinationWidth,options.destinationHeight);gl.drawArrays(gl.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(gl,texture,textureUnit){gl.activeTexture(textureUnit);gl.bindTexture(gl.TEXTURE_2D,texture);gl.activeTexture(gl.TEXTURE0)},unbindAdditionalTexture:function(gl,textureUnit){gl.activeTexture(textureUnit);gl.bindTexture(gl.TEXTURE_2D,null);gl.activeTexture(gl.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(value){this[this.mainParameter]=value},sendUniformData:function(){},createHelpLayer:function(options){if(!options.helpLayer){var helpLayer=document.createElement("canvas");helpLayer.width=options.sourceWidth;helpLayer.height=options.sourceHeight;options.helpLayer=helpLayer}},toObject:function(){var object={type:this.type},mainP=this.mainParameter;return mainP&&(object[mainP]=this[mainP]),object},toJSON:function(){return this.toObject()}});fabric.Image.filters.BaseFilter.fromObject=function(object,callback){var filter=new fabric.Image.filters[object.type](object);return callback&&callback(filter),filter},function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.ColorMatrix=createClass(filters.BaseFilter,{type:"ColorMatrix",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nuniform mat4 uColorMatrix;\nuniform vec4 uConstants;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor *= uColorMatrix;\ncolor += uConstants;\ngl_FragColor = color;\n}",matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:"matrix",colorsOnly:!0,initialize:function(options){this.callSuper("initialize",options);this.matrix=this.matrix.slice(0)},applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,iLen=data.length,m=this.matrix,r,g,b,a,colorsOnly=this.colorsOnly,i=0;i<iLen;i+=4)r=data[i],g=data[i+1],b=data[i+2],colorsOnly?(data[i]=r*m[0]+g*m[1]+b*m[2]+m[4]*255,data[i+1]=r*m[5]+g*m[6]+b*m[7]+m[9]*255,data[i+2]=r*m[10]+g*m[11]+b*m[12]+m[14]*255):(a=data[i+3],data[i]=r*m[0]+g*m[1]+b*m[2]+a*m[3]+m[4]*255,data[i+1]=r*m[5]+g*m[6]+b*m[7]+a*m[8]+m[9]*255,data[i+2]=r*m[10]+g*m[11]+b*m[12]+a*m[13]+m[14]*255,data[i+3]=r*m[15]+g*m[16]+b*m[17]+a*m[18]+m[19]*255)},getUniformLocations:function(gl,program){return{uColorMatrix:gl.getUniformLocation(program,"uColorMatrix"),uConstants:gl.getUniformLocation(program,"uConstants")}},sendUniformData:function(gl,uniformLocations){var m=this.matrix,matrix=[m[0],m[1],m[2],m[3],m[5],m[6],m[7],m[8],m[10],m[11],m[12],m[13],m[15],m[16],m[17],m[18]],constants=[m[4],m[9],m[14],m[19]];gl.uniformMatrix4fv(uniformLocations.uColorMatrix,!1,matrix);gl.uniform4fv(uniformLocations.uConstants,constants)}});fabric.Image.filters.ColorMatrix.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Brightness=createClass(filters.BaseFilter,{type:"Brightness",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBrightness;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += uBrightness;\ngl_FragColor = color;\n}",brightness:0,mainParameter:"brightness",applyTo2d:function(options){if(this.brightness!==0)for(var imageData=options.imageData,data=imageData.data,len=data.length,brightness=Math.round(this.brightness*255),i=0;i<len;i+=4)data[i]=data[i]+brightness,data[i+1]=data[i+1]+brightness,data[i+2]=data[i+2]+brightness},getUniformLocations:function(gl,program){return{uBrightness:gl.getUniformLocation(program,"uBrightness")}},sendUniformData:function(gl,uniformLocations){gl.uniform1f(uniformLocations.uBrightness,this.brightness)}});fabric.Image.filters.Brightness.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,filters=fabric.Image.filters,createClass=fabric.util.createClass;
14filters.Convolute=createClass(filters.BaseFilter,{type:"Convolute",opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_3_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[9];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 3.0; h+=1.0) {\nfor (float w = 0.0; w < 3.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_5_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_5_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[25];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 5.0; h+=1.0) {\nfor (float w = 0.0; w < 5.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_7_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_7_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[49];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 7.0; h+=1.0) {\nfor (float w = 0.0; w < 7.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}",Convolute_9_1:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 0);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];\n}\n}\ngl_FragColor = color;\n}",Convolute_9_0:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uMatrix[81];\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = vec4(0, 0, 0, 1);\nfor (float h = 0.0; h < 9.0; h+=1.0) {\nfor (float w = 0.0; w < 9.0; w+=1.0) {\nvec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));\ncolor.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];\n}\n}\nfloat alpha = texture2D(uTexture, vTexCoord).a;\ngl_FragColor = color;\ngl_FragColor.a = alpha;\n}"},retrieveShader:function(options){var size=Math.sqrt(this.matrix.length),c
14acheKey=this.type+"_"+size+"_"+(this.opaque?1:0),shaderSource=this.fragmentSource[cacheKey];return options.programCache.hasOwnProperty(cacheKey)||(options.programCache[cacheKey]=this.createProgram(options.context,shaderSource)),options.programCache[cacheKey]},applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,weights=this.matrix,side=Math.round(Math.sqrt(weights.length)),halfSide=Math.floor(side/2),sw=imageData.width,sh=imageData.height,output=options.ctx.createImageData(sw,sh),dst=output.data,alphaFac=this.opaque?1:0,r,g,b,a,dstOff,scx,scy,srcOff,wt,x,cx,cy,y=0;y<sh;y++)for(x=0;x<sw;x++){for(dstOff=(y*sw+x)*4,r=0,g=0,b=0,a=0,cy=0;cy<side;cy++)for(cx=0;cx<side;cx++)(scy=y+cy-halfSide,scx=x+cx-halfSide,scy<0||scy>sh||scx<0||scx>sw)||(srcOff=(scy*sw+scx)*4,wt=weights[cy*side+cx],r+=data[srcOff]*wt,g+=data[srcOff+1]*wt,b+=data[srcOff+2]*wt,alphaFac||(a+=data[srcOff+3]*wt));dst[dstOff]=r;dst[dstOff+1]=g;dst[dstOff+2]=b;dst[dstOff+3]=alphaFac?data[dstOff+3]:a}options.imageData=output},getUniformLocations:function(gl,program){return{uMatrix:gl.getUniformLocation(program,"uMatrix"),uOpaque:gl.getUniformLocation(program,"uOpaque"),uHalfSize:gl.getUniformLocation(program,"uHalfSize"),uSize:gl.getUniformLocation(program,"uSize")}},sendUniformData:function(gl,uniformLocations){gl.uniform1fv(uniformLocations.uMatrix,this.matrix)},toObject:function(){return extend(this.callSuper("toObject"),{opaque:this.opaque,matrix:this.matrix})}});fabric.Image.filters.Convolute.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Grayscale=createClass(filters.BaseFilter,{type:"Grayscale",fragmentSource:{average:"precision highp float;\nuniform sampler2D uTexture;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat average = (color.r + color.b + color.g) / 3.0;\ngl_FragColor = vec4(average, average, average, color.a);\n}",lightness:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;\ngl_FragColor = vec4(average, average, average, col.a);\n}",luminosity:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uMode;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 col = texture2D(uTexture, vTexCoord);\nfloat average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;\ngl_FragColor = vec4(average, average, average, col.a);\n}"},mode:"average",mainParameter:"mode",applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,len=data.length,value,mode=this.mode,i=0;i<len;i+=4)mode==="average"?value=(data[i]+data[i+1]+data[i+2])/3:mode==="lightness"?value=(Math.min(data[i],data[i+1],data[i+2])+Math.max(data[i],data[i+1],data[i+2]))/2:mode==="luminosity"&&(value=.21*data[i]+.72*data[i+1]+.07*data[i+2]),data[i]=value,data[i+1]=value,data[i+2]=value},retrieveShader:function(options){var cacheKey=this.type+"_"+this.mode,shaderSource;return options.programCache.hasOwnProperty(cacheKey)||(shaderSource=this.fragmentSource[this.mode],options.programCache[cacheKey]=this.createProgram(options.context,shaderSource)),options.programCache[cacheKey]},getUniformLocations:function(gl,program){return{uMode:gl.getUniformLocation(program,"uMode")}},sendUniformData:function(gl,uniformLocations){gl.uniform1i(uniformLocations.uMode,1)},isNeutralState:function(){return!1}});fabric.Image.filters.Grayscale.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Invert=createClass(filters.BaseFilter,{type:"Invert",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform int uInvert;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nif (uInvert == 1) {\ngl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);\n} else {\ngl_FragColor = color;\n}\n}",invert:!0,mainParameter:"invert",applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,len=data.length,i=0;i<len;i+=4)data[i]=255-data[i],data[i+1]=255-data[i+1],data[i+2]=255-data[i+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(gl,program){return{uInvert:gl.getUniformLocation(program,"uInvert")}},sendUniformData:function(gl,uniformLocations){gl.uniform1i(uniformLocations.uInvert,this.invert)}});fabric.Image.filters.Invert.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Noise=createClass(filters.BaseFilter,{type:"Noise",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uStepH;\nuniform float uNoise;\nuniform float uSeed;\nvarying vec2 vTexCoord;\nfloat rand(vec2 co, float seed, float vScale) {\nreturn fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);\n}\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ncolor.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;\ngl_FragColor = color;\n}",mainParameter:"noise",noise:0,applyTo2d:function(options){if(this.noise!==0)for(var imageData=options.imageData,data=imageData.data,len=data.length,noise=this.noise,rand,i=0,len=data.length;i<len;i+=4)rand=(.5-Math.random())*noise,data[i]+=rand,data[i+1]+=rand,data[i+2]+=rand},getUniformLocations:function(gl,program){return{uNoise:gl.getUniformLocation(program,"uNoise"),uSeed:gl.getUniformLocation(program,"uSeed")}},sendUniformData:function(gl,uniformLocations){gl.uniform1f(uniformLocations.uNoise,this.noise/255);gl.uniform1f(uniformLocations.uSeed,Math.random())},toObject:function(){return extend(this.callSuper("toObject"),{noise:this.noise})}});fabric.Image.filters.Noise.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Pixelate=createClass(filters.BaseFilter,{type:"Pixelate",blocksize:4,mainParameter:"blocksize",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uBlocksize;\nuniform float uStepW;\nuniform float uStepH;\nvarying vec2 vTexCoord;\nvoid main() {\nfloat blockW = uBlocksize * uStepW;\nfloat blockH = uBlocksize * uStepW;\nint posX = int(vTexCoord.x / blockW);\nint posY = int(vTexCoord.y / blockH);\nfloat fposX = float(posX);\nfloat fposY = float(posY);\nvec2 squareCoords = vec2(fposX * blockW, fposY * blockH);\nvec4 color = texture2D(uTexture, squareCoords);\ngl_FragColor = color;\n}",applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,iLen=imageData.height,jLen=imageData.width,index,j,r,g,b,a,_i,_j,_iLen,_jLen,i=0;i<iLen;i+=this.blocksize)for(j=0;j<jLen;j+=this.blocksize)for(index=i*4*jLen+j*4,r=data[index],g=data[index+1],b=data[index+2],a=data[index+3],_iLen=Math.min(i+this.blocksize,iLen),_jLen=Math.min(j+this.blocksize,jLen),_i=i;_i<_iLen;_i++)for(_j=j;_j<_jLen;_j++)index=_i*4*jLen+_j*4,data[index]=r,data[index+1]=g,data[index+2]=b,data[index+3]=a},isNeutralState:function(){return this.blocksize===1},getUniformLocations:function(gl,program){return{uBlocksize:gl.getUniformLocation(program,"uBlocksize"),uStepW:gl.getUniformLocation(program,"uStepW"),uStepH:gl.getUniformLocation(program,"uStepH")}},sendUniformData:function(gl,uniformLocations){gl.uniform1f(uniformLocations.uBlocksize,this.blocksize)}});fabric.Image.filters.Pixelate.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),extend=fabric.util.object.extend,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.RemoveColor=createClass(filters.BaseFilter,{type:"RemoveColor",color:"#FFFFFF",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uLow;\nuniform vec4 uHigh;\nvarying vec2 vTexCoord;\nvoid main() {\ngl_FragColor = texture2D(uTexture, vTexCoord);\nif(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {\ngl_FragColor.a = 0.0;\n}\n}",distance:.02,useAlpha:!1,applyTo2d:function(options){for(var imageData=options.imageData,data=imageData.data,distance=this.distance*255,r,g,b,source=new fabric.Color(this.color).getSource(),lowC=[source[0]-distance,source[1]-distance,source[2]-distance,],highC=[source[0]+distance,source[1]+distance,source[2]+distance,],i=0;i<data.length;i+=4)r=data[i],g=data[i+1],b=data[i+2],r>lowC[0]&&g>lowC[1]&&b>lowC[2]&&r<highC[0]&&g<highC[1]&&b<highC[2]&&(data[i+3]=0)},getUniformLocations:function(gl,program){return{uLow:gl.getUniformLocation(program,"uLow"),uHigh:gl.getUniformLocation(program,"uHigh")}},sendUniformData:function(gl,uniformLocations){var source=new fabric.Color(this.color).getSource(),distance=parseFloat(this.distance),lowC=[0+source[0]/255-distance,0+source[1]/255-distance,0+source[2]/255-distance,1],highC=[source[0]/255+distance,source[1]/255+distance,source[2]/255+distance,1];gl.uniform4fv(uniformLocations.uLow,lowC);gl.uniform4fv(uniformLocations.uHigh,highC)},toObject:function(){return extend(this.callSuper("toObject"),{color:this.color,distance:this.distance})}});fabric.Image.filters.RemoveColor.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass,matrices={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0,]};for(var key in matrices)filters[key]=createClass(filters.ColorMatrix,{type:key,matrix:matrices[key],mainParameter:!1,colorsOnly:!0}),fabric.Image.filters[key].fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.BlendColor=createClass(filters.BaseFilter,{type:"BlendColor",color:"#F95C63",mode:"multiply",alpha:1,fragmentSource:{multiply:"gl_FragColor.rgb *= uColor.rgb;\n",screen:"gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);\n",add:"gl_FragColor.rgb += uColor.rgb;\n",diff:"gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);\n",subtract:"gl_FragColor.rgb -= uColor.rgb;\n",lighten:"gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);\n",darken:"gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);\n",exclusion:"gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);\n",overlay:"if (uColor.r < 0.5) {\ngl_FragColor.r *= 2.0 * uColor.r;\n} else {\ngl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);\n}\nif (uColor.g < 0.5) {\ngl_FragColor.g *= 2.0 * uColor.g;\n} else {\ngl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);\n}\nif (uColor.b < 0.5) {\ngl_FragColor.b *= 2.0 * uColor.b;\n} else {\ngl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);\n}\n",tint:"gl_FragColor.rgb *= (1.0 - uColor.a);\ngl_FragColor.rgb += uColor.rgb;\n"},buildSource:function(mode){return"precision highp float;\nuniform sampler2D uTexture;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\ngl_FragColor = color;\nif (color.a > 0.0) {\n"+this.fragmentSource[mode]+"}\n}"},retrieveShader:function(options){var cacheKey=this.type+"_"+this.mode,shaderSource;return options.programCache.hasOwnProperty(cacheKey)||(shaderSource=this.buildSource(this.mode),options.programCache[cacheKey]=this.createProgram(options.context,shaderSource)),options.programCache[cacheKey]},applyTo2d:function(options){var imageData=options.imageData,data=imageData.data,iLen=data.length,tr,tg,tb,r,g,b,source,alpha1=1-this.alpha,i;for(source=new fabric.Color(this.color).getSource(),tr=source[0]*this.alpha,tg=source[1]*this.alpha,tb=source[2]*this.alpha,i=0;i<iLen;i+=4){r=data[i];g=data[i+1];b=data[i+2];switch(this.mode){case"multiply":data[i]=r*tr/255;data[i+1]=g*tg/255;data[i+2]=b*tb/255;break;case"screen":data[i]=255-(255-r)*(255-tr)/255;data[i+1]=255-(255-g)*(255-tg)/255;data[i+2]=255-(255-b)*(255-tb)/255;break;
14case"add":data[i]=r+tr;data[i+1]=g+tg;data[i+2]=b+tb;break;case"diff":case"difference":data[i]=Math.abs(r-tr);data[i+1]=Math.abs(g-tg);data[i+2]=Math.abs(b-tb);break;case"subtract":data[i]=r-tr;data[i+1]=g-tg;data[i+2]=b-tb;break;case"darken":data[i]=Math.min(r,tr);data[i+1]=Math.min(g,tg);data[i+2]=Math.min(b,tb);break;case"lighten":data[i]=Math.max(r,tr);data[i+1]=Math.max(g,tg);data[i+2]=Math.max(b,tb);break;case"overlay":data[i]=tr<128?2*r*tr/255:255-2*(255-r)*(255-tr)/255;data[i+1]=tg<128?2*g*tg/255:255-2*(255-g)*(255-tg)/255;data[i+2]=tb<128?2*b*tb/255:255-2*(255-b)*(255-tb)/255;break;case"exclusion":data[i]=tr+r-2*tr*r/255;data[i+1]=tg+g-2*tg*g/255;data[i+2]=tb+b-2*tb*b/255;break;case"tint":data[i]=tr+r*alpha1;data[i+1]=tg+g*alpha1;data[i+2]=tb+b*alpha1}}},getUniformLocations:function(gl,program){return{uColor:gl.getUniformLocation(program,"uColor")}},sendUniformData:function(gl,uniformLocations){var source=new fabric.Color(this.color).getSource();source[0]=this.alpha*source[0]/255;source[1]=this.alpha*source[1]/255;source[2]=this.alpha*source[2]/255;source[3]=this.alpha;gl.uniform4fv(uniformLocations.uColor,source)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}});fabric.Image.filters.BlendColor.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.BlendImage=createClass(filters.BaseFilter,{type:"BlendImage",image:null,mode:"multiply",alpha:1,vertexSource:"attribute vec2 aPosition;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nuniform mat3 uTransformMatrix;\nvoid main() {\nvTexCoord = aPosition;
14\nvTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;\ngl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);\n}",fragmentSource:{multiply:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.rgba *= color2.rgba;\ngl_FragColor = color;\n}",mask:"precision highp float;\nuniform sampler2D uTexture;\nuniform sampler2D uImage;\nuniform vec4 uColor;\nvarying vec2 vTexCoord;\nvarying vec2 vTexCoord2;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec4 color2 = texture2D(uImage, vTexCoord2);\ncolor.a = color2.a;\ngl_FragColor = color;\n}"},retrieveShader:function(options){var cacheKey=this.type+"_"+this.mode,shaderSource=this.fragmentSource[this.mode];return options.programCache.hasOwnProperty(cacheKey)||(options.programCache[cacheKey]=this.createProgram(options.context,shaderSource)),options.programCache[cacheKey]},applyToWebGL:function(options){var gl=options.context,texture=this.createTexture(options.filterBackend,this.image);this.bindAdditionalTexture(gl,texture,gl.TEXTURE1);this.callSuper("applyToWebGL",options);this.unbindAdditionalTexture(gl,gl.TEXTURE1)},createTexture:function(backend,image){return backend.getCachedTexture(image.cacheKey,image._element)},calculateMatrix:function(){var image=this.image,width=image._element.width,height=image._element.height;return[1/image.scaleX,0,0,0,1/image.scaleY,0,-image.left/width,-image.top/height,1]},applyTo2d:function(options){var imageData=options.imageData,resources=options.filterBackend.resources,data=imageData.data,iLen=data.length,width=imageData.width,height=imageData.height,tr,tg,tb,ta,r,g,b,a,canvas1,context,image=this.image,blendData,i;for(resources.blendImage||(resources.blendImage=fabric.util.createCanvasElement()),canvas1=resources.blendImage,context=canvas1.getContext("2d"),canvas1.width!==width||canvas1.height!==height?(canvas1.width=width,canvas1.height=height):context.clearRect(0,0,width,height),context.setTransform(image.scaleX,0,0,image.scaleY,image.left,image.top),context.drawImage(image._element,0,0,width,height),blendData=context.getImageData(0,0,width,height).data,i=0;i<iLen;i+=4){r=data[i];g=data[i+1];b=data[i+2];a=data[i+3];tr=blendData[i];tg=blendData[i+1];tb=blendData[i+2];ta=blendData[i+3];switch(this.mode){case"multiply":data[i]=r*tr/255;data[i+1]=g*tg/255;data[i+2]=b*tb/255;data[i+3]=a*ta/255;break;case"mask":data[i+3]=ta}}},getUniformLocations:function(gl,program){return{uTransformMatrix:gl.getUniformLocation(program,"uTransformMatrix"),uImage:gl.getUniformLocation(program,"uImage")}},sendUniformData:function(gl,uniformLocations){var matrix=this.calculateMatrix();gl.uniform1i(uniformLocations.uImage,1);gl.uniformMatrix3fv(uniformLocations.uTransformMatrix,!1,matrix)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}});fabric.Image.filters.BlendImage.fromObject=function(object,callback){fabric.Image.fromObject(object.image,function(image){var options=fabric.util.object.clone(object);options.image=image;callback(new fabric.Image.filters.BlendImage(options))})}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),pow=Math.pow,floor=Math.floor,sqrt=Math.sqrt,abs=Math.abs,round=Math.round,sin=Math.sin,ceil=Math.ceil,filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Resize=createClass(filters.BaseFilter,{type:"Resize",resizeType:"hermite",scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(gl,program){return{uDelta:gl.getUniformLocation(program,"uDelta"),uTaps:gl.getUniformLocation(program,"uTaps")}},sendUniformData:function(gl,uniformLocations){gl.uniform2fv(uniformLocations.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]);gl.uniform1fv(uniformLocations.uTaps,this.taps)},retrieveShader:function(options){var filterWindow=this.getFilterWindow(),cacheKey=this.type+"_"+filterWindow,fragmentShader;return options.programCache.hasOwnProperty(cacheKey)||(fragmentShader=this.generateShader(filterWindow),options.programCache[cacheKey]=this.createProgram(options.context,fragmentShader)),options.programCache[cacheKey]},getFilterWindow:function(){var scale=this.tempScale;return Math.ceil(this.lanczosLobes/scale)},getTaps:function(){for(var lobeFunction=this.lanczosCreate(this.lanczosLobes),scale=this.tempScale,filterWindow=this.getFilterWindow(),taps=new Array(filterWindow),i=1;i<=filterWindow;i++)taps[i-1]=lobeFunction(i*scale);return taps},generateShader:function(filterWindow){for(var offsets=new Array(filterWindow),fragmentShader=this.fragmentSourceTOP,filterWindow,i=1;i<=filterWindow;i++)offsets[i-1]=i+".0 * uDelta";return fragmentShader+="uniform float uTaps["+filterWindow+"];\n",fragmentShader+="void main() {\n",fragmentShader+=" vec4 color = texture2D(uTexture, vTexCoord);\n",fragmentShader+=" float sum = 1.0;
14\n",offsets.forEach(function(offset,i){fragmentShader+=" color += texture2D(uTexture, vTexCoord + "+offset+") * uTaps["+i+"];\n";fragmentShader+=" color += texture2D(uTexture, vTexCoord - "+offset+") * uTaps["+i+"];\n";fragmentShader+=" sum += 2.0 * uTaps["+i+"];\n"}),fragmentShader+=" gl_FragColor = color / sum;\n",fragmentShader+="}"},fragmentSourceTOP:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\n",applyTo:function(options){options.webgl?(options.passes++,this.width=options.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=options.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),options.destinationWidth=this.dW,this._setupFrameBuffer(options),this.applyToWebGL(options),this._swapTextures(options),options.sourceWidth=options.destinationWidth,this.height=options.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),options.destinationHeight=this.dH,this._setupFrameBuffer(options),this.applyToWebGL(options),this._swapTextures(options),options.sourceHeight=options.destinationHeight):this.applyTo2d(options)},isNeutralState:function(){return this.scaleX===1&&this.scaleY===1},lanczosCreate:function(lobes){return function(x){if(x>=lobes||x<=-lobes)return 0;if(x<11920929e-14&&x>-11920929e-14)return 1;x*=Math.PI;var xx=x/lobes;return sin(x)/x*sin(xx)/xx}},applyTo2d:function(options){var imageData=options.imageData,scaleX=this.scaleX,scaleY=this.scaleY;this.rcpScaleX=1/scaleX;this.rcpScaleY=1/scaleY;var oW=imageData.width,oH=imageData.height,dW=round(oW*scaleX),dH=round(oH*scaleY),newData;this.resizeType==="sliceHack"?newData=this.sliceByTwo(options,oW,oH,dW,dH):this.resizeType==="hermite"?newData=this.hermiteFastResize(options,oW,oH,dW,dH):this.resizeType==="bilinear"?newData=this.bilinearFiltering(options,oW,oH,dW,dH):this.resizeType==="lanczos"&&(newData=this.lanczosResize(options,oW,oH,dW,dH));options.imageData=newData},sliceByTwo:function(options,oW,oH,dW,dH){var imageData=options.imageData,mult=.5,doneW=!1,doneH=!1,stepW=oW*mult,stepH=oH*mult,resources=fabric.filterBackend.resources,tmpCanvas,ctx,sX=0,sY=0,dX=oW,dY=0;for(resources.sliceByTwo||(resources.sliceByTwo=document.createElement("canvas")),tmpCanvas=resources.sliceByTwo,(tmpCanvas.width<oW*1.5||tmpCanvas.height<oH)&&(tmpCanvas.width=oW*1.5,tmpCanvas.height=oH),ctx=tmpCanvas.getContext("2d"),ctx.clearRect(0,0,oW*1.5,oH),ctx.putImageData(imageData,0,0),dW=floor(dW),dH=floor(dH);!doneW||!doneH;)oW=stepW,oH=stepH,dW<floor(stepW*mult)?stepW=floor(stepW*mult):(stepW=dW,doneW=!0),dH<floor(stepH*mult)?stepH=floor(stepH*mult):(stepH=dH,doneH=!0),ctx.drawImage(tmpCanvas,sX,sY,oW,oH,dX,dY,stepW,stepH),sX=dX,sY=dY,dY+=stepH;return ctx.getImageData(sX,sY,dW,dH)},lanczosResize:function(options,oW,oH,dW,dH){function process(u){var v,i,weight,idx,a,red,green,blue,alpha,fX,fY,j;for(center.x=(u+.5)*ratioX,icenter.x=floor(center.x),v=0;v<dH;v++){for(center.y=(v+.5)*ratioY,icenter.y=floor(center.y),a=0,red=0,green=0,blue=0,alpha=0,i=icenter.x-range2X;i<=icenter.x+range2X;i++)if(!(i<0)&&!(i>=oW))for(fX=floor(1e3*abs(i-center.x)),cacheLanc[fX]||(cacheLanc[fX]={}),j=icenter.y-range2Y;j<=icenter.y+range2Y;j++)j<0||j>=oH||(fY=floor(1e3*abs(j-center.y)),cacheLanc[fX][fY]||(cacheLanc[fX][fY]=lanczos(sqrt(pow(fX*rcpRatioX,2)+pow(fY*rcpRatioY,2))/1e3)),weight=cacheLanc[fX][fY],weight>0&&(idx=(j*oW+i)*4,a+=weight,red+=weight*srcData[idx],green+=weight*srcData[idx+1],blue+=weight*srcData[idx+2],alpha+=weight*srcData[idx+3]));idx=(v*dW+u)*4;destData[idx]=red/a;destData[idx+1]=green/a;destData[idx+2]=blue/a;destData[idx+3]=alpha/a}return++u<dW?process(u):destImg}var srcData=options.imageData.data,destImg=options.ctx.createImageData(dW,dH),destData=destImg.data,lanczos=this.lanczosCreate(this.lanczosLobes),ratioX=this.rcpScaleX,ratioY=this.rcpScaleY,rcpRatioX=2/this.rcpScaleX,rcpRatioY=2/this.rcpScaleY,range2X=ceil(ratioX*this.lanczosLobes/2),range2Y=ceil(ratioY*this.lanczosLobes/2),cacheLanc={},center={},icenter={};return process(0)},bilinearFiltering:function(options,oW,oH,dW,dH){for(var a,b,c,d,x,y,j,xDiff,yDiff,chnl,color,offset=0,origPix,ratioX=this.rcpScaleX,ratioY=this.rcpScaleY,w4=4*(oW-1),img=options.imageData,pixels=img.data,destImage=options.ctx.createImageData(dW,dH),destPixels=destImage.data,i=0;i<dH;i++)for(j=0;j<dW;j++)for(x=floor(ratioX*j),y=floor(ratioY*i),xDiff=ratioX*j-x,yDiff=ratioY*i-y,origPix=4*(y*oW+x),chnl=0;chnl<4;chnl++)a=pixels[origPix+chnl],b=pixels[origPix+4+chnl],c=pixels[origPix+w4+c
14hnl],d=pixels[origPix+w4+4+chnl],color=a*(1-xDiff)*(1-yDiff)+b*xDiff*(1-yDiff)+c*yDiff*(1-xDiff)+d*xDiff*yDiff,destPixels[offset++]=color;return destImage},hermiteFastResize:function(options,oW,oH,dW,dH){for(var i,yy,xx,dx,w,ratioW=this.rcpScaleX,ratioH=this.rcpScaleY,ratioWHalf=ceil(ratioW/2),ratioHHalf=ceil(ratioH/2),img=options.imageData,data=img.data,img2=options.ctx.createImageData(dW,dH),data2=img2.data,j=0;j<dH;j++)for(i=0;i<dW;i++){var x2=(i+j*dW)*4,weight=0,weights=0,weightsAlpha=0,gxR=0,gxG=0,gxB=0,gxA=0,centerY=(j+.5)*ratioH;for(yy=floor(j*ratioH);yy<(j+1)*ratioH;yy++){var dy=abs(centerY-(yy+.5))/ratioHHalf,centerX=(i+.5)*ratioW,w0=dy*dy;for(xx=floor(i*ratioW);xx<(i+1)*ratioW;xx++)(dx=abs(centerX-(xx+.5))/ratioWHalf,w=sqrt(w0+dx*dx),w>1&&w<-1)||(weight=2*w*w*w-3*w*w+1,weight>0&&(dx=4*(xx+yy*oW),gxA+=weight*data[dx+3],weightsAlpha+=weight,data[dx+3]<255&&(weight=weight*data[dx+3]/250),gxR+=weight*data[dx],gxG+=weight*data[dx+1],gxB+=weight*data[dx+2],weights+=weight))}data2[x2]=gxR/weights;data2[x2+1]=gxG/weights;data2[x2+2]=gxB/weights;data2[x2+3]=gxA/weightsAlpha}return img2},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}});fabric.Image.filters.Resize.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Contrast=createClass(filters.BaseFilter,{type:"Contrast",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uContrast;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));\ncolor.rgb = contrastF * (color.rgb - 0.5) + 0.5;\ngl_FragColor = color;\n}",contrast:0,mainParameter:"contrast",applyTo2d:function(options){if(this.contrast!==0)for(var imageData=options.imageData,data=imageData.data,len=data.length,contrast=Math.floor(this.contrast*255),contrastF=259*(contrast+255)/(255*(259-contrast)),i=0;i<len;i+=4)data[i]=contrastF*(data[i]-128)+128,data[i+1]=contrastF*(data[i+1]-128)+128,data[i+2]=contrastF*(data[i+2]-128)+128},getUniformLocations:function(gl,program){return{uContrast:gl.getUniformLocation(program,"uContrast")}},sendUniformData:function(gl,uniformLocations){gl.uniform1f(uniformLocations.uContrast,this.contrast)}});fabric.Image.filters.Contrast.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Saturation=createClass(filters.BaseFilter,{type:"Saturation",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform float uSaturation;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nfloat rgMax = max(color.r, color.g);\nfloat rgbMax = max(rgMax, color.b);\ncolor.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;\ncolor.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;\ncolor.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;\ngl_FragColor = color;\n}",saturation:0,mainParameter:"saturation",applyTo2d:function(options){if(this.saturation!==0)for(var imageData=options.imageData,data=imageData.data,len=data.length,adjust=-this.saturation,max,i=0;i<len;i+=4)max=Math.max(data[i],data[i+1],data[i+2]),data[i]+=max!==data[i]?(max-data[i])*adjust:0,data[i+1]+=max!==data[i+1]?(max-data[i+1])*adjust:0,data[i+2]+=max!==data[i+2]?(max-data[i+2])*adjust:0},getUniformLocations:function(gl,program){return{uSaturation:gl.getUniformLocation(program,"uSaturation")}},sendUniformData:function(gl,uniformLocations){gl.uniform1f(uniformLocations.uSaturation,-this.saturation)}});fabric.Image.filters.Saturation.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Blur=createClass(filters.BaseFilter,{type:"Blur",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec2 uDelta;\nvarying vec2 vTexCoord;\nconst float nSamples = 15.0;\nvec3 v3offset = vec3(12.9898, 78.233, 151.7182);\nfloat random(vec3 scale) {\nreturn fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);\n}\nvoid main() {\nvec4 color = vec4(0.0);\nfloat total = 0.0;\nfloat offset = random(v3offset);\nfor (float t = -nSamples; t <= nSamples; t++) {\nfloat percent = (t + offset - 0.5) / nSamples;\nfloat weight = 1.0 - abs(percent);\ncolor += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;\ntotal += weight;\n}\ngl_FragColor = color / total;\n}",blur:0,mainParameter:"blur",applyTo:function(options){options.webgl?(this.aspectRatio=options.sourceWidth/options.sourceHeight,options.passes++,this._setupFrameBuffer(options),this.horizontal=!0,this.applyToWebGL(options),this._swapTextures(options),this._setupFrameBuffer(options),this.horizontal=!1,this.applyToWebGL(options),this._swapTextures(options)):this.applyTo2d(options)},applyTo2d:function(options){options.imageData=this.simpleBlur(options)},simpleBlur:function(options){var resources=options.filterBackend.resources,canvas1,canvas2,width=options.imageData.width,height=options.imageData.height,newImageData;resources.blurLayer1||(resources.blurLayer1=fabric.util.createCanvasElement(),resources.blurLayer2=fabric.util.createCanvasElement());canvas1=resources.blurLayer1;canvas2=resources.blurLayer2;(canvas1.width!==width||canvas1.height!==height)&&(canvas2.width=canvas1.width=width,canvas2.height=canvas1.height=height);var ctx1=canvas1.getContext("2d"),ctx2=canvas2.getContext("2d"),nSamples=15,random,percent,j,i,blur=this.blur*.06*.5;for(ctx1.putImageData(options.imageData,0,0),ctx2.clearRect(0,0,width,height),i=-nSamples;i<=nSamples;i++)random=(Math.random()-.5)/4,percent=i/nSamples,j=blur*percent*width+random,ctx2.globalAlpha=1-Math.abs(percent),ctx2.drawImage(canvas1,j,random),ctx1.drawImage(canvas2,0,0),ctx2.globalAlpha=1,ctx2.clearRect(0,0,canvas2.width,canvas2.height);for(i=-nSamples;i<=nSamples;i++)random=(Math.random()-.5)/4,percent=i/nSamples,j=blur*percent*height+random,ctx2.globalAlpha=1-Math.abs(percent),ctx2.drawImage(canvas1,random,j),ctx1.drawImage(canvas2,0,0),ctx2.globalAlpha=1,ctx2.clearRect(0,0,canvas2.width,canvas2.height);return options.ctx.drawImage(canvas1,0,0),newImageData=options.ctx.getImageData(0,0,canvas1.width,canvas1.height),ctx1.globalAlpha=1,ctx1.clearRect(0,0,canvas1.width,canvas1.height),newImageData},getUniformLocations:function(gl,program){return{delta:gl.getUniformLocation(program,"uDelta")}},sendUniformData:function(gl,uniformLocations){var delta=this.chooseRightDelta();gl.uniform2fv(uniformLocations.delta,delta)},chooseRightDelta:function(){var blurScale=1,delta=[0,0],blur;return this.horizontal?this.aspectRatio>1&&(blurScale=1/this.aspectRatio):this.aspectRatio<1&&(blurScale=this.aspectRatio),blur=blurScale*this.blur*.
1412,this.horizontal?delta[0]=blur:delta[1]=blur,delta}});filters.Blur.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Gamma=createClass(filters.BaseFilter,{type:"Gamma",fragmentSource:"precision highp float;\nuniform sampler2D uTexture;\nuniform vec3 uGamma;\nvarying vec2 vTexCoord;\nvoid main() {\nvec4 color = texture2D(uTexture, vTexCoord);\nvec3 correction = (1.0 / uGamma);\ncolor.r = pow(color.r, correction.r);\ncolor.g = pow(color.g, correction.g);\ncolor.b = pow(color.b, correction.b);\ngl_FragColor = color;\ngl_FragColor.rgb *= color.a;\n}",gamma:[1,1,1],mainParameter:"gamma",initialize:function(options){this.gamma=[1,1,1];filters.BaseFilter.prototype.initialize.call(this,options)},applyTo2d:function(options){var imageData=options.imageData,data=imageData.data,gamma=this.gamma,len=data.length,rInv=1/gamma[0],gInv=1/gamma[1],bInv=1/gamma[2],i;for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),i=0,len=256;i<len;i++)this.rVals[i]=Math.pow(i/255,rInv)*255,this.gVals[i]=Math.pow(i/255,gInv)*255,this.bVals[i]=Math.pow(i/255,bInv)*255;for(i=0,len=data.length;i<len;i+=4)data[i]=this.rVals[data[i]],data[i+1]=this.gVals[data[i+1]],data[i+2]=this.bVals[data[i+2]]},getUniformLocations:function(gl,program){return{uGamma:gl.getUniformLocation(program,"uGamma")}},sendUniformData:function(gl,uniformLocations){gl.uniform3fv(uniformLocations.uGamma,this.gamma)}});fabric.Image.filters.Gamma.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.Composed=createClass(filters.BaseFilter,{type:"Composed",subFilters:[],initialize:function(options){this.callSuper("initialize",options);this.subFilters=this.subFilters.slice(0)},applyTo:function(options){options.passes+=this.subFilters.length-1;this.subFilters.forEach(function(filter){filter.applyTo(options)})},toObject:function(){return fabric.util.object.extend(this.callSuper("toObject"),{subFilters:this.subFilters.map(function(filter){return filter.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(filter){return!filter.isNeutralState()})}});fabric.Image.filters.Composed.fromObject=function(object,callback){var filters=object.subFilters||[],subFilters=filters.map(function(filter){return new fabric.Image.filters[filter.type](filter)}),instance=new fabric.Image.filters.Composed({subFilters:subFilters});return callback&&callback(instance),instance}}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),filters=fabric.Image.filters,createClass=fabric.util.createClass;filters.HueRotation=createClass(filters.ColorMatrix,{type:"HueRotation",rotation:0,mainParameter:"rotation",calculateMatrix:function(){var rad=this.rotation*Math.PI,cos=fabric.util.cos(rad),sin=fabric.util.sin(rad),aThird=1/3,aThirdSqtSin=Math.sqrt(aThird)*sin,OneMinusCos=1-cos;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this.matrix[0]=cos+OneMinusCos/3;this.matrix[1]=aThird*OneMinusCos-aThirdSqtSin;this.matrix[2]=aThird*OneMinusCos+aThirdSqtSin;this.matrix[5]=aThird*OneMinusCos+aThirdSqtSin;this.matrix[6]=cos+aThird*OneMinusCos;this.matrix[7]=aThird*OneMinusCos-aThirdSqtSin;this.matrix[10]=aThird*OneMinusCos-aThirdSqtSin;this.matrix[11]=aThird*OneMinusCos+aThirdSqtSin;this.matrix[12]=cos+aThird*OneMinusCos},isNeutralState:function(options){return this.calculateMatrix(),filters.BaseFilter.prototype.isNeutralState.call(this,options)},applyTo:function(options){this.calculateMatrix();filters.BaseFilter.prototype.applyTo.call(this,options)}});fabric.Image.filters.HueRotation.fromObject=fabric.Image.filters.BaseFilter.fromObject}(typeof exports!="undefined"?exports:this),function(global){"use strict";var fabric=global.fabric||(global.fabric={}),clone=fabric.util.object.clone;if(fabric.Text){fabric.warn("fabric.Text is already defined");return}fabric.Text=fabric.util.createClass(fabric.Object,{_dimensionAffectingProps:["fontSize","fontWeight","fontFamily","fontStyle","lineHeight","text","charSpacing","textAlign","styles",],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:"text",fontSize:40,fontWeight:"normal",fontFamily:"Times New Roman",underline:!1,overline:!1,linethrough:!1,textAlign:"left",fontStyle:"normal",lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11}
14,textBackgroundColor:"",stateProperties:fabric.Object.prototype.stateProperties.concat("fontFamily","fontWeight","fontSize","text","underline","overline","linethrough","textAlign","fontStyle","lineHeight","textBackgroundColor","charSpacing","styles"),cacheProperties:fabric.Object.prototype.cacheProperties.concat("fontFamily","fontWeight","fontSize","text","underline","overline","linethrough","textAlign","fontStyle","lineHeight","textBackgroundColor","charSpacing","styles"),stroke:null,shadow:null,_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,_styleProperties:["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor",],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(text,options){this.styles=options?options.styles||{}:{};this.text=text;this.__skipDimension=!0;this.callSuper("initialize",options);this.__skipDimension=!1;this.initDimensions();this.setCoords();this.setupState({propertySet:"_dimensionAffectingProps"})},getMeasuringContext:function(){return fabric._measuringContext||(fabric._measuringContext=this.canvas&&this.canvas.contextCache||fabric.util.createCanvasElement().getContext("2d")),fabric._measuringContext},_splitText:function(){var newLines=this._splitTextIntoLines(this.text);return this.textLines=newLines.lines,this._textLines=newLines.graphemeLines,this._unwrappedTextLines=newLines._unwrappedLines,this._text=newLines.graphemeText,newLines},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},enlargeSpaces:function(){for(var j,jlen,diffSpace,currentLineWidth,numberOfSpaces,accumulatedSpace,line,charBound,spaces,i=0,len=this._textLines.length;i<len;i++)if((this.textAlign==="justify"||i!==len-1&&!this.isEndOfWrapping(i))&&(accumulatedSpace=0,line=this._textLines[i],currentLineWidth=this.getLineWidth(i),currentLineWidth<this.width&&(spaces=this.textLines[i].match(this._reSpacesAndTabs))))for(numberOfSpaces=spaces.length,diffSpace=(this.width-currentLineWidth)/numberOfSpaces,j=0,jlen=line.length;j<=jlen;j++)charBound=this.__charBounds[i][j],this._reSpaceAndTab.test(line[j])?(charBound.width+=diffSpace,charBound.kernedWidth+=diffSpace,charBound.left+=accumulatedSpace,accumulatedSpace+=diffSpace):charBound.left+=accumulatedSpace},isEndOfWrapping:function(lineIndex){return lineIndex===this._textLines.length-1},toString:function(){return"#<fabric.Text ("+this.complexity()+'): { "text": "'+this.text+'", "fontFamily": "'+this.fontFamily+'" }>'},_getCacheCanvasDimensions:function(){var dims=this.callSuper("_getCacheCanvasDimensions"),fontSize=this.fontSize;return dims.width+=fontSize*dims.zoomX,dims.height+=fontSize*dims.zoomY,dims},_render:function(ctx){this._setTextStyles(ctx);this._renderTextLinesBackground(ctx);this._renderTextDecoration(ctx,"underline");this._renderText(ctx);this._renderTextDecoration(ctx,"overline");this._renderTextDecoration(ctx,"linethrough")},_renderText:function(ctx){this.paintFirst==="stroke"?(this._renderTextStroke(ctx),this._renderTextFill(ctx)):(this._renderTextFill(ctx),this._renderTextStroke(ctx))},_setTextStyles:function(ctx,charStyle,forMeasuring){ctx.textBaseline="alphabetic";
14ctx.font=this._getFontDeclaration(charStyle,forMeasuring)},calcTextWidth:function(){for(var currentLineWidth,maxWidth=this.getLineWidth(0),i=1,len=this._textLines.length;i<len;i++)currentLineWidth=this.getLineWidth(i),currentLineWidth>maxWidth&&(maxWidth=currentLineWidth);return maxWidth},_renderTextLine:function(method,ctx,line,left,top,lineIndex){this._renderChars(method,ctx,line,left,top,lineIndex)},_renderTextLinesBackground:function(ctx){var i,len,j,jlen;if(this.textBackgroundColor||this.styleHas("textBackgroundColor")){var lineTopOffset=0,heightOfLine,lineLeftOffset,originalFill=ctx.fillStyle,line,lastColor,leftOffset=this._getLeftOffset(),topOffset=this._getTopOffset(),boxStart=0,boxWidth=0,charBox,currentColor;for(i=0,len=this._textLines.length;i<len;i++){if(heightOfLine=this.getHeightOfLine(i),!this.textBackgroundColor&&!this.styleHas("textBackgroundColor",i)){lineTopOffset+=heightOfLine;continue}for(line=this._textLines[i],lineLeftOffset=this._getLineLeftOffset(i),boxWidth=0,boxStart=0,lastColor=this.getValueOfPropertyAt(i,0,"textBackgroundColor"),j=0,jlen=line.length;j<jlen;j++)charBox=this.__charBounds[i][j],currentColor=this.getValueOfPropertyAt(i,j,"textBackgroundColor"),currentColor!==lastColor?(ctx.fillStyle=lastColor,lastColor&&ctx.fillRect(leftOffset+lineLeftOffset+boxStart,topOffset+lineTopOffset,boxWidth,heightOfLine/this.lineHeight),boxStart=charBox.left,boxWidth=charBox.width,lastColor=currentColor):boxWidth+=charBox.kernedWidth;currentColor&&(ctx.fillStyle=currentColor,ctx.fillRect(leftOffset+lineLeftOffset+boxStart,topOffset+lineTopOffset,boxWidth,heightOfLine/this.lineHeight));lineTopOffset+=heightOfLine}ctx.fillStyle=originalFill;this._removeShadow(ctx)}},getFontCache:function(decl){var fontFamily=decl.fontFamily.toLowerCase(),cache,cacheProp;return fabric.charWidthsCache[fontFamily]||(fabric.charWidthsCache[fontFamily]={}),cache=fabric.charWidthsCache[fontFamily],cacheProp=decl.fontStyle.toLowerCase()+"_"+(decl.fontWeight+"").toLowerCase(),cache[cacheProp]||(cache[cacheProp]={}),cache[cacheProp]},_applyCharStyles:function(method,ctx,lineIndex,charIndex,styleDeclaration){this._setFillStyles(ctx,styleDeclaration);this._setStrokeStyles(ctx,styleDeclaration);ctx.font=this._getFontDeclaration(styleDeclaration)},_measureChar:function(_char,charStyle,previousChar,prevCharStyle){var fontCache=this.getFontCache(charStyle),fontDeclaration=this._getFontDeclaration(ch
14arStyle),previousFontDeclaration=this._getFontDeclaration(prevCharStyle),couple=previousChar+_char,stylesAreEqual=fontDeclaration===previousFontDeclaration,width,coupleWidth,previousWidth,fontMultiplier=charStyle.fontSize/this.CACHE_FONT_SIZE,kernedWidth,ctx;return previousChar&&fontCache[previousChar]!==undefined&&(previousWidth=fontCache[previousChar]),fontCache[_char]!==undefined&&(kernedWidth=width=fontCache[_char]),stylesAreEqual&&fontCache[couple]!==undefined&&(coupleWidth=fontCache[couple],kernedWidth=coupleWidth-previousWidth),(width===undefined||previousWidth===undefined||coupleWidth===undefined)&&(ctx=this.getMeasuringContext(),this._setTextStyles(ctx,charStyle,!0)),width===undefined&&(kernedWidth=width=ctx.measureText(_char).width,fontCache[_char]=width),previousWidth===undefined&&stylesAreEqual&&previousChar&&(previousWidth=ctx.measureText(previousChar).width,fontCache[previousChar]=previousWidth),stylesAreEqual&&coupleWidth===undefined&&(coupleWidth=ctx.measureText(couple).width,fontCache[couple]=coupleWidth,kernedWidth=coupleWidth-previousWidth),{width:width*fontMultiplier,kernedWidth:kernedWidth*fontMultiplier}},getHeightOfChar:function(line,char){return this.getValueOfPropertyAt(line,char,"fontSize")},measureLine:function(lineIndex){var lineInfo=this._measureLine(lineIndex);return this.charSpacing!==0&&(lineInfo.width-=this._getWidthOfCharSpacing()),lineInfo.width<0&&(lineInfo.width=0),lineInfo},_measureLine:function(lineIndex){var width=0,i,grapheme,line=this._textLines[lineIndex],prevGrapheme,graphemeInfo,lineBounds=new Array(line.length);for(this.__charBounds[lineIndex]=lineBounds,i=0;i<line.length;i++)grapheme=line[i],graphemeInfo=this._getGraphemeBox(grapheme,lineIndex,i,prevGrapheme),lineBounds[i]=graphemeInfo,width+=graphemeInfo.kernedWidth,prevGrapheme=grapheme;return lineBounds[i]={left:graphemeInfo?graphemeInfo.left+graphemeInfo.width:0,width:0,kernedWidth:0,height:this.fontSize},{width:width,numOfSpaces:0}},_getGraphemeBox:function(grapheme,lineIndex,charIndex,prevGrapheme,skipLeft){var style=this.getCompleteStyleDeclaration(lineIndex,charIndex),prevStyle=prevGrapheme?this.getCompleteStyleDeclaration(lineIndex,charIndex-1):{},info=this._measureChar(grapheme,style,prevGrapheme,prevStyle),kernedWidth=info.kernedWidth,width=info.width,charSpacing,box,previousBox;return this.charSpacing!==0&&(charSpacing=this._getWidthOfCharSpacing(),width+=charSpacing,kernedWidth+=charSpacing),box={width:width,left:0,height:style.fontSize,kernedWidth:kernedWidth,deltaY:style.deltaY},charIndex>0&&!skipLeft&&(previousBox=this.__charBounds[lineIndex][charIndex-1],box.left=previousBox.left+previousBox.width+info.kernedWidth-info.width),box},getHeightOfLine:function(lineIndex){var line,maxHeight,i,len;if(this.__lineHeights[lineIndex])return this.__lineHeights[lineIndex];for(line=this._textLines[lineIndex],maxHeight=this.getHeightOfChar(lineIndex,0),i=1,len=line.length;i<len;i++)maxHeight=Math.max(this.getHeightOfChar(lineIndex,i),maxHeight);return this.__lineHeights[lineIndex]=maxHeight*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var lineHeight,height=0,i=0,len=this._textLines.length;i<len;i++)lineHeight=this.getHeightOfLine(i),height+=i===len-1?lineHeight/this.lineHeight:lineHeight;return height},_getLeftOffset:function(){return-this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(ctx,method){var i,len;ctx.save();var lineHeights=0,left=this._getLeftOffset(),top=this._getTopOffset(),offsets=this._applyPatternGradientTransform(ctx,method==="fillText"?this.fill:this.stroke);for(i=0,len=this._textLines.length;i<len;i++){var heightOfLine=this.getHeightOfLine(i),maxHeight=heightOfLine/this.lineHeight,leftOffset=this._getLineLeftOffset(i);this._renderTextLine(method,ctx,this._textLines[i],left+leftOffset-offsets.offsetX,top+lineHeights+maxHeight-offsets.offsetY,i);lineHeights+=heightOfLine}ctx.restore()},_renderTextFill:function(ctx){(this.fill||this.styleHas("fill"))&&this._renderTextCommon(ctx,"fillText")},_renderTextStroke:function(ctx){(this.stroke&&this.strokeWidth!==0||!this.isEmptyStyles())&&(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(ctx),ctx.save(),this._setLineDash(ctx,this.strokeDashArray),ctx.beginPath(),this._renderTextCommon(ctx,"strokeText"),ctx.closePath(),ctx.restore(
14))},_renderChars:function(method,ctx,line,left,top,lineIndex){var lineHeight=this.getHeightOfLine(lineIndex),isJustify=this.textAlign.indexOf("justify")!==-1,actualStyle,nextStyle,charsToRender="",charBox,boxWidth=0,timeToRender,shortCut=!isJustify&&this.charSpacing===0&&this.isEmptyStyles(lineIndex),i,len;if(ctx.save(),top-=lineHeight*this._fontSizeFraction/this.lineHeight,shortCut){this._renderChar(method,ctx,lineIndex,0,this.textLines[lineIndex],left,top,lineHeight);ctx.restore();return}for(i=0,len=line.length-1;i<=len;i++)timeToRender=i===len||this.charSpacing,charsToRender+=line[i],charBox=this.__charBounds[lineIndex][i],boxWidth===0?(left+=charBox.kernedWidth-charBox.width,boxWidth+=charBox.width):boxWidth+=charBox.kernedWidth,isJustify&&!timeToRender&&this._reSpaceAndTab.test(line[i])&&(timeToRender=!0),timeToRender||(actualStyle=actualStyle||this.getCompleteStyleDeclaration(lineIndex,i),nextStyle=this.getCompleteStyleDeclaration(lineIndex,i+1),timeToRender=this._hasStyleChanged(actualStyle,nextStyle)),timeToRender&&(this._renderChar(method,ctx,lineIndex,i,charsToRender,left,top,lineHeight),charsToRender="",actualStyle=nextStyle,left+=boxWidth,boxWidth=0);ctx.restore()},_renderChar:function(method,ctx,lineIndex,charIndex,_char,left,top){var decl=this._getStyleDeclaration(lineIndex,charIndex),fullDecl=this.getCompleteStyleDeclaration(lineIndex,charIndex),shouldFill=method==="fillText"&&fullDecl.fill,shouldStroke=method==="strokeText"&&fullDecl.stroke&&fullDecl.strokeWidth;(shouldStroke||shouldFill)&&(decl&&ctx.save(),this._applyCharStyles(method,ctx,lineIndex,charIndex,fullDecl),decl&&decl.textBackgroundColor&&this._removeShadow(ctx),decl&&decl.deltaY&&(top+=decl.deltaY),shouldFill&&ctx.fillText(_char,left,top),shouldStroke&&ctx.strokeText(_char,left,top),decl&&ctx.restore())},setSuperscript:function(start,end){return this._setScript(start,end,this.superscript)},setSubscript:function(start,end){return this._setScript(start,end,this.subscript)},_setScript:function(start,end,schema){var loc=this.get2DCursorLocation(start,!0),fontSize=this.getValueOfPropertyAt(loc.lineIndex,loc.charIndex,"fontSize"),dy=this.getValueOfPropertyAt(loc.lineIndex,loc.charIndex,"deltaY"),style={fontSize:fontSize*schema.size,deltaY:dy+fontSize*schema.baseline};return this.setSelectionStyles(style,start,end),this},_hasStyleChanged:function(prevStyle,thisStyle){return prevStyle.fill!==thisStyle.fill||prevStyle.stroke!==thisStyle.stroke||prevStyle.strokeWidth!==thisStyle.strokeWidth||prevStyle.fontSize!==thisStyle.fontSize||prevStyle.fontFamily!==thisStyle.fontFamily||prevStyle.fontWeight!==thisStyle.fontWeight||prevStyle.fontStyle!==thisStyle.fontStyle||prevStyle.deltaY!==thisStyle.deltaY},_hasStyleChangedForSvg:function(prevStyle,thisStyle){return this._hasStyleChanged(prevStyle,thisStyle)||prevStyle.overline!==thisStyle.overline||prevStyle.underline!==thisStyle.underline||prevStyle.linethrough!==thisStyle.linethrough},_getLineLeftOffset:function(lineIndex){var lineWidth=this.getLineWidth(lineIndex);return this.textAlign==="center"?(this.width-lineWidth)/2:this.textAlign==="right"?this.width-lineWidth:this.textAlign==="justify-center"&&this.isEndOfWrapping(lineIndex)?(this.width-lineWidth)/2:this.textAlign==="justify-right"&&this.isEndOfWrapping(lineIndex)?this.width-lineWidth:0},_clearCache:function(){this.__lineWidths=[];this.__lineHeights=[];this.__charBounds=[]},_shouldClearDimensionCache:function(){var shouldClear=this._forceClearCache;return shouldClear||(shouldClear=this.hasStateChanged("_dimensionAffectingProps")),shouldClear&&(this.dirty=!0,this._forceClearCache=!1),shouldClear},getLineWidth:function(lineIndex){if(this.__lineWidths[lineIndex])return this.__lineWidths[lineIndex];var width,line=this._textLines[lineIndex],lineInfo;return line===""?width=0:(lineInfo=this.measureLine(lineIndex),width=lineInfo.width),this.__lineWidths[lineIndex]=width,width},_getWidthOfCharSpacing:function(){return this.charSpacing!==0?this.fontSize*this.charSpacing/1e3:0},getValueOfPropertyAt:function(lineIndex,charIndex,property){var charStyle=this._getStyleDeclaration(lineIndex,charIndex);return charStyle&&typeof charStyle[property]!="undefined"?charStyle[property]:this[property]},_renderTextDecoration:function(ctx,type){var i,len,j,jlen;if(this[type]||this.styleHas(type)){var heightOfLine,size,_size,lineLeftOffset,dy,_dy,line,lastDecoration,leftOffset=this._getLeftOffset(),topOffset=this._getTopOffset(),top,boxStart,boxWidth,charBox,currentDecoration,maxHeight,currentFill,lastFill,charSpacing=this._getWidthOfCharSpacing();for(i=0,len=this._textLines.length;i<len;i++){if(heightOfLine=this.getHeightOfLine(i),!this[type]&&!this.styleHas(type,i
14)){topOffset+=heightOfLine;continue}for(line=this._textLines[i],maxHeight=heightOfLine/this.lineHeight,lineLeftOffset=this._getLineLeftOffset(i),boxStart=0,boxWidth=0,lastDecoration=this.getValueOfPropertyAt(i,0,type),lastFill=this.getValueOfPropertyAt(i,0,"fill"),top=topOffset+maxHeight*(1-this._fontSizeFraction),size=this.getHeightOfChar(i,0),dy=this.getValueOfPropertyAt(i,0,"deltaY"),j=0,jlen=line.length;j<jlen;j++)charBox=this.__charBounds[i][j],currentDecoration=this.getValueOfPropertyAt(i,j,type),currentFill=this.getValueOfPropertyAt(i,j,"fill"),_size=this.getHeightOfChar(i,j),_dy=this.getValueOfPropertyAt(i,j,"deltaY"),(currentDecoration!==lastDecoration||currentFill!==lastFill||_size!==size||_dy!==dy)&&boxWidth>0?(ctx.fillStyle=lastFill,lastDecoration&&lastFill&&ctx.fillRect(leftOffset+lineLeftOffset+boxStart,top+this.offsets[type]*size+dy,boxWidth,this.fontSize/15),boxStart=charBox.left,boxWidth=charBox.width,lastDecoration=currentDecoration,lastFill=currentFill,size=_size,dy=_dy):boxWidth+=charBox.kernedWidth;ctx.fillStyle=currentFill;currentDecoration&¤tFill&&ctx.fillRect(leftOffset+lineLeftOffset+boxStart,top+this.offsets[type]*size+dy,boxWidth-charSpacing,this.fontSize/15);topOffset+=heightOfLine}this._removeShadow(ctx)}},_getFontDeclaration:function(styleObject,forMeasuring){var style=styleObject||this,family=this.fontFamily,fontIsGeneric=fabric.Text.genericFonts.indexOf(family.toLowerCase())>-1,fontFamily=family===undefined||family.indexOf("'")>-1||family.indexOf('"')>-1||fontIsGeneric?style.fontFamily:'"'+style.fontFamily+'"';return[fabric.isLikelyNode?style.fontWeight:style.fontStyle,fabric.isLikelyNode?style.fontStyle:style.fontWeight,forMeasuring?this.CACHE_FONT_SIZE+"px":style.fontSize+"px",fontFamily].join(" ")},render:function(ctx){this.visible&&(!this.canvas||!this.canvas.skipOffscreen||this.group||this.isOnScreen())&&(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper("render",ctx))},_splitTextIntoLines:function(text){for(var lines=text.split(this._reNewline),newLines=new Array(lines.length),newLine=["\n"],newText=[],i=0;i<lines.length;i++)newLines[i]=fabric.util.string.graphemeSplit(lines[i]),newText=newText.concat(newLines[i],newLine);return newText.pop(),{_unwrappedLines:newLines,lines:lines,graphemeText:newText,graphemeLines:newLines}},toObject:function(propertiesToInclude){var additionalProperties=["text","fontSize","fontWeight","fontFamily","fontStyle","lineHeight","underline","overline","linethrough","textAlign","textBackgroundColor","charSpacing",].concat(propertiesToInclude),obj=this.callSuper("toObject",additionalProperties);return obj.styles=clone(this.styles,!0),obj},set:function(key,value){var needsDims,_key;if(this.callSuper("set",key,value),needsDims=!1,typeof key=="object")for(_key in key)needsDims=needsDims||this._dimensionAffectingProps.indexOf(_key)!==-1;else needsDims=this._dimensionAffectingProps.indexOf(key)!==-1;return needsDims&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}});fabric.Text.ATTRIBUTE_NAMES=fabric.SHARED_ATTRIBUTES.concat("x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor".split(" "));fabric.Text.DEFAULT_SVG_FONT_SIZE=16;fabric.Text.fromElement=function(element,callback,options){var parsedAttributes,parsedAnchor,textDecoration,textContent,originalStrokeWidth;if(!element)return callback(null);parsedAttributes=fabric.parseAttributes(element,fabric.Text.ATTRIBUTE_NAMES);parsedAnchor=parsedAttributes.textAnchor||"left";options=fabric.util.object.extend(options?clone(options):{},parsedAttributes);options.top=options.top||0;options.left=options.left||0;parsedAttributes.textDecoration&&(textDecoration=parsedAttributes.textDecoration,textDecoration.indexOf("underline")!==-1&&(options.underline=!0),textDecoration.indexOf("overline")!==-1&&(options.overline=!0),textDecoration.indexOf("line-through")!==-1&&(options.linethrough=!0),delete options.textDecoration);"dx"in parsedAttributes&&(options.left+=parsedAttributes.dx);"dy"in parsedAttributes&&(options.top+=parsedAttributes.dy);"fontSize"in options||(options.fontSize=fabric.Text.DEFAULT_SVG_FONT_SIZE);textContent="";"textContent"in element?textContent=element.textContent:"firstChild"in element&&element.firstChild!==null&&"data"in element.firstChild&&element.firstChild.data!==null&&(textContent=element.firstChild.data);textContent=textContent.replace(/^\s+|\s+$|\n+/g,"").replace(/\s+/g," ");originalStrokeWidth=options.strokeWidth;options.strokeWidth=0;var text=new fabric.Text(textContent,options),textHeightScaleFactor=text.getScaledHeight()/text.height,lineHeightDiff=(text.height+text.strokeWidth)*text.lineHeight-text.height,scaledDiff=lineHeightDiff*textHeightScaleFactor,textHeight=text.getScaledHeight()+scaledDiff,offX=0;parsedAnchor==="center"&&(offX=text.getScaledWidth()/2);parsedAnchor==="right"&&(offX=text.getScaledWidth());text.set({left:text.left-offX,top:text.top-(textHeight-text.fontSize*(.07+text._fontSizeFraction))/text.lineHeight,strokeWidth:typeof originalStrokeWidth!="undefined"?originalStrokeWidth:1});callback(text)};fabric.Text.fromObject=function(object,callback){return fabric.Object._fromObject("Text",object,callback,"text")};fabric.Text.genericFonts=["sans-serif","serif","cursive","fantasy","monospace"];fabric.util.createAccessors&&fabric.util.createAccessors(fabric.Text)}(typeof exports!="undefined"?exports:this),function(){fabric.util.object.extend(fabric.Text.prototype,{isEmptyStyles:function(lineIndex){var obj,p1,p2,p3;if(!this.styles||typeof lineIndex!="undefined"&&!this.styles[lineIndex])return!0;obj=typeof lineIndex=="undefined"?this.styles:{line:this.styles[lineIndex]};for(p1 in obj)for(p2 in obj[p1])for(p3 in obj[p1][p2])return!1;return!0},styleHas:function(property,lineIndex){var obj,p1,p2;if(!this.styles||!property||property===""||typeof lineIndex!="undefined"&&!this.styles[lineIndex])return!1;obj=typeof lineIndex=="undefined"?this.styles:{line:this.styles[lineIndex]};for(p1 in obj)for(p2 in obj[p1])if(typeof obj[p1][p2][property]!="undefined")return!0;return!1},cleanStyle:function(property){var p1,p2,styleObject,stylePropertyHasBeenSet,i;if(!this.styles||!property||property==="")return!1;var obj=this.styles,stylesCount=0,letterCount,stylePropertyValue,allStyleObjectPropertiesMatch=!0,graphemeCount=0,styleObject;for(p1 in obj){letterCount=0;for(p2 in obj[p1])styleObject=obj[p1][p2],stylePropertyHasBeenSet=styleObject.hasOwnProperty(property),stylesCount++,stylePropertyHasBeenSet?(stylePropertyValue?styleObject[property]!==stylePropertyValue&&(allStyleObjectPropertiesMatch=!1):stylePropertyValue=styleObject[property],styleObject[property]===this[property]&&delete styleObject[property]):allStyleObjectPropertiesMatch=!1,Object.keys(styleObject).length!==0?letterCount++:delete obj[p1][p2];letterCount===0&&delete obj[p1]}for(i=0;i<this._textLines.length;
14i++)graphemeCount+=this._textLines[i].length;allStyleObjectPropertiesMatch&&stylesCount===graphemeCount&&(this[property]=stylePropertyValue,this.removeStyle(property))},removeStyle:function(property){if(this.styles&&property&&property!==""){var obj=this.styles,line,lineNum,charNum;for(lineNum in obj){line=obj[lineNum];for(charNum in line)delete line[charNum][property],Object.keys(line[charNum]).length===0&&delete line[charNum];Object.keys(line).length===0&&delete obj[lineNum]}}},_extendStyles:function(index,styles){var loc=this.get2DCursorLocation(index);this._getLineStyle(loc.lineIndex)||this._setLineStyle(loc.lineIndex,{});this._getStyleDeclaration(loc.lineIndex,loc.charIndex)||this._setStyleDeclaration(loc.lineIndex,loc.charIndex,{});fabric.util.object.extend(this._getStyleDeclaration(loc.lineIndex,loc.charIndex),styles)},get2DCursorLocation:function(selectionStart,skipWrapping){var lines,len,i;for(typeof selectionStart=="undefined"&&(selectionStart=this.selectionStart),lines=skipWrapping?this._unwrappedTextLines:this._textLines,len=lines.length,i=0;i<len;i++){if(selectionStart<=lines[i].length)return{lineIndex:i,charIndex:selectionStart};selectionStart-=lines[i].length+1}return{lineIndex:i-1,charIndex:lines[i-1].length<selectionStart?lines[i-1].length:selectionStart}},getSelectionStyles:function(startIndex,endIndex,complete){var styles,i;for(typeof startIndex=="undefined"&&(startIndex=this.selectionStart||0),typeof endIndex=="undefined"&&(endIndex=this.selectionEnd||startIndex),styles=[],i=startIndex;i<endIndex;i++)styles.push(this.getStyleAtPosition(i,complete));return styles},getStyleAtPosition:function(position,complete){var loc=this.get2DCursorLocation(position),style=complete?this.getCompleteStyleDeclaration(loc.lineIndex,loc.charIndex):this._getStyleDeclaration(loc.lineIndex,loc.charIndex);return style||{}},setSelectionStyles:function(styles,startIndex,endIndex){typeof startIndex=="undefined"&&(startIndex=this.selectionStart||0);typeof endIndex=="undefined"&&(endIndex=this.selectionEnd||startIndex);for(var i=startIndex;i<endIndex;i++)this._extendStyles(i,styles);return this._forceClearCache=!0,this},_getStyleDeclaration:function(lineIndex,charIndex){var lineStyle=this.styles&&this.styles[lineIndex];return lineStyle?lineStyle[charIndex]:null},getCompleteStyleDeclaration:function(lineIndex,charIndex){for(var style=this._getStyleDeclaration(lineIndex,charIndex)||{},styleObject={},prop,i=0;i<this._styleProperties.length;i++)prop=this._styleProperties[i],styleObject[prop]=typeof style[prop]=="undefined"?this[prop]:style[prop];return styleObject},_setStyleDeclaration:function(lineIndex,charIndex,style){this.styles[lineIndex][charIndex]=style},_deleteStyleDeclaration:function(lineIndex,charIndex){delete this.styles[lineIndex][charIndex]},_getLineStyle:function(lineIndex){return this.styles[lineIndex]},_setLineStyle:function(lineIndex,style){this.styles[lineIndex]=style},_deleteLineStyle:function(lineIndex){delete this.styles[lineIndex]}})}(),function(){function parseDecoration(object){object.textDecoration&&(object.textDecoration.indexOf("underline")>-1&&(object.underline=!0),object.textDecoration.indexOf("line-through")>-1&&(object.linethrough=!0),object.textDecoration.indexOf("overline")>-1&&(object.overline=!0),delete object.textDecoration)}fabric.IText=fabric.util.createClass(fabric.Text,fabric.Observable,{type:"i-text",selectionStart:0,selectionEnd:0,selectionColor:"rgba(17,119,255,0.3)",isEditing:!1,editable:!0,editingBorderColor:"rgba(102,153,255,0.25)",cursorWidth:2,cursorColor:"#333",cursorDelay:1e3,cursorDuration:600,caching:!0,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(text,options){this.callSuper("initialize",text,options);this.initBehavior()},setSelectionStart:function(index){index=Math.max(index,0);this._updateAndFire("selectionStart",index)},setSelectionEnd:function(index){index=Math.min(index,this.text.length);this._updateAndFire("selectionEnd",index)},_updateAndFire:function(property,index){this[property]!==index&&(this._fireSelectionChanged(),this[property]=index);this._updateTextarea()},_fireSelectionChanged:function(){this.fire("selection:changed");this.canvas&&this.canvas.fire("text:selection:changed",{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor();this.clearContextTop();this.callSuper("initDimensions")},render:function(ctx){this.clearContextTop();this.callSuper("render",ctx);
14this.cursorOffsetCache={};this.renderCursorOrSelection()},_render:function(ctx){this.callSuper("_render",ctx)},clearContextTop:function(skipRestore){if(this.isEditing&&this.canvas&&this.canvas.contextTop){var ctx=this.canvas.contextTop,v=this.canvas.viewportTransform;ctx.save();ctx.transform(v[0],v[1],v[2],v[3],v[4],v[5]);this.transform(ctx);this.transformMatrix&&ctx.transform.apply(ctx,this.transformMatrix);this._clearTextArea(ctx);skipRestore||ctx.restore()}},renderCursorOrSelection:function(){if(this.isEditing&&this.canvas){var boundaries=this._getCursorBoundaries(),ctx;this.canvas&&this.canvas.contextTop?(ctx=this.canvas.contextTop,this.clearContextTop(!0)):(ctx=this.canvas.contextContainer,ctx.save());this.selectionStart===this.selectionEnd?this.renderCursor(boundaries,ctx):this.renderSelection(boundaries,ctx);ctx.restore()}},_clearTextArea:function(ctx){var width=this.width+4,height=this.height+4;ctx.clearRect(-width/2,-height/2,width,height)},_getCursorBoundaries:function(position){typeof position=="undefined"&&(position=this.selectionStart);var left=this._getLeftOffset(),top=this._getTopOffset(),offsets=this._getCursorBoundariesOffsets(position);return{left:left,top:top,leftOffset:offsets.left,topOffset:offsets.top}},_getCursorBoundariesOffsets:function(position){var i,bound;if(this.cursorOffsetCache&&"top"in this.cursorOffsetCache)return this.cursorOffsetCache;var lineLeftOffset,lineIndex,charIndex,topOffset=0,leftOffset=0,boundaries,cursorPosition=this.get2DCursorLocation(position);for(charIndex=cursorPosition.charIndex,lineIndex=cursorPosition.lineIndex,i=0;i<lineIndex;i++)topOffset+=this.getHeightOfLine(i);return lineLeftOffset=this._getLineLeftOffset(lineIndex),bound=this.__charBounds[lineIndex][charIndex],bound&&(leftOffset=bound.left),this.charSpacing!==0&&charIndex===this._textLines[lineIndex].length&&(leftOffset-=this._getWidthOfCharSpacing()),boundaries={top:topOffset,left:lineLeftOffset+(leftOffset>0?leftOffset:0)},this.cursorOffsetCache=boundaries,this.cursorOffsetCache},renderCursor:function(boundaries,ctx){var cursorLocation=this.get2DCursorLocation(),lineIndex=cursorLocation.lineIndex,charIndex=cursorLocation.charIndex>0?cursorLocation.charIndex-1:0,charHeight=this.getValueOfPropertyAt(lineIndex,charIndex,"fontSize"),multiplier=this.scaleX*this.canvas.getZoom(),cursorWidth=this.cursorWidth/multiplier,topOffset=boundaries.topOffset,dy=this.getValueOfPropertyAt(lineIndex,charIndex,"deltaY");topOffset+=(1-this._fontSizeFraction)*this.getHeightOfLine(lineIndex)/this.lineHeight-charHeight*(1-this._fontSizeFraction);this.inCompositionMode&&this.renderSelection(boundaries,ctx);ctx.fillStyle=this.getValueOfPropertyAt(lineIndex,charIndex,"fill");ctx.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity;ctx.fillRect(boundaries.left+boundaries.leftOffset-cursorWidth/2,topOffset+boundaries.top+dy,cursorWidth,charHeight)},renderSelection:function(boundaries,ctx){for(var charSpacing,selectionStart=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,selectionEnd=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,isJustify=this.textAlign.indexOf("justify")!==-1,start=this.get2DCursorLocation(selectionStart),end=this.get2DCursorLocation(selectionEnd),startLine=start.lineIndex,endLine=end.lineIndex,startChar=start.charIndex<0?0:start.charIndex,endChar=end.charIndex<0?0:end.charIndex,i=startLine;i<=endLine;i++){var lineOffset=this._getLineLeftOffset(i)||0,lineHeight=this.getHeightOfLine(i),realLineHeight=0,boxStart=0,boxEnd=0;i===startLine&&(boxStart=this.__charBounds[startLine][startChar].left);i>=startLine&&i<endLine?boxEnd=isJustify&&!this.isEndOfWrapping(i)?this.width:this.getLineWidth(i)||5:i===endLine&&(endChar===0?boxEnd=this.__charBounds[endLine][endChar].left:(charSpacing=this._getWidthOfCharSpacing(),boxEnd=this.__charBounds[endLine][endChar-1].left+this.__charBounds[endLine][endChar-1].width-charSpacing));realLineHeight=lineHeight;(this.lineHeight<1||i===endLine&&this.lineHeight>1)&&(lineHeight/=this.lineHeight);this.inCompositionMode?(ctx.fillStyle=this.compositionColor||"black",ctx.fillRect(boundaries.left+lineOffset+boxStart,boundaries.top+boundaries.topOffset+lineHeight,boxEnd-boxStart,1)):(ctx.fillStyle=this.selectionColor,ctx.fillRect(boundaries.left+lineOffset+boxStart,boundaries.top+boundaries.topOffset,boxEnd-boxStart,lineHeight));boundaries.topOffset+=realLineHeight}},getCurrentCharFontSize:function(){var cp=this._getCurrentCharIndex();return this.getValueOfPropertyAt(cp.l,cp.c,"fontSize")},getCurrentCharColor:function(){var cp=this._getCurrentCharIndex();return this.getValueOfPropertyAt(cp.l,cp.c,"fill")},_getCurrentCharIndex:function(){var cursorPosition=this.get2DCursorLocation(this.selectionStart,!0),charIndex=cursorPosition.charIndex>0?cursorPosition.charIndex-1:0;
14return{l:cursorPosition.lineIndex,c:charIndex}}});fabric.IText.fromObject=function(object,callback){var i,j;if(parseDecoration(object),object.styles)for(i in object.styles)for(j in object.styles[i])parseDecoration(object.styles[i][j]);fabric.Object._fromObject("IText",object,callback,"text")}}(),function(){var clone=fabric.util.object.clone;fabric.util.object.extend(fabric.IText.prototype,{initBehavior:function(){this.initAddedHandler();this.initRemovedHandler();this.initCursorSelectionHandlers();this.initDoubleClickSimulation();this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing();this.selected=!1},initAddedHandler:function(){var _this=this;this.on("added",function(){var canvas=_this.canvas;canvas&&(canvas._hasITextHandlers||(canvas._hasITextHandlers=!0,_this._initCanvasHandlers(canvas)),canvas._iTextInstances=canvas._iTextInstances||[],canvas._iTextInstances.push(_this))})},initRemovedHandler:function(){var _this=this;this.on("removed",function(){var canvas=_this.canvas;canvas&&(canvas._iTextInstances=canvas._iTextInstances||[],fabric.util.removeFromArray(canvas._iTextInstances,_this),canvas._iTextInstances.length===0&&(canvas._hasITextHandlers=!1,_this._removeCanvasHandlers(canvas)))})},_initCanvasHandlers:function(canvas){canvas._mouseUpITextHandler=function(){canvas._iTextInstances&&canvas._iTextInstances.forEach(function(obj){obj.__isMousedown=!1})};canvas.on("mouse:up",canvas._mouseUpITextHandler)},_removeCanvasHandlers:function(canvas){canvas.off("mouse:up",canvas._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,"_onTickComplete")},_animateCursor:function(obj,targetOpacity,duration,completeMethod){var tickState;return tickState={isAborted:!1,abort:function(){this.isAborted=!0}},obj.animate("_currentCursorOpacity",targetOpacity,{duration:duration,onComplete:function(){tickState.isAborted||obj[completeMethod]()},onChange:function(){obj.canvas&&obj.selectionStart===obj.selectionEnd&&obj.renderCursorOrSelection()},abort:function(){return tickState.isAborted}}),tickState},_onTickComplete:function(){var _this=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1);this._cursorTimeout1=setTimeout(function(){_this._currentTickCompleteState=_this._animateCursor(_this,0,this.cursorDuration/2,"_tick")},100)},initDelayedCursor:function(restart){var _this=this,delay=restart?0:this.cursorDelay;this.abortCursorAnimation();this._currentCursorOpacity=1;this._cursorTimeout2=setTimeout(function(){_this._tick()},delay)},abortCursorAnimation:function(){var shouldClear=this._currentTickState||this._currentTickCompleteState,canvas=this.canvas;this._currentTickState&&this._currentTickState.abort();this._currentTickCompleteState&&this._currentTickCompleteState.abort();clearTimeout(this._cursorTimeout1);clearTimeout(this._cursorTimeout2);this._currentCursorOpacity=0;shouldClear&&canvas&&canvas.clearContext(canvas.contextTop||canvas.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join("")},findWordBoundaryLeft:function(startFrom){var offset=0,index=startFrom-1;if(this._reSpace.test(this._text[index]))while(this._reSpace.test(this._text[index]))offset++,index--;while(/\S/.test(this._text[index])&&index>-1)offset++,index--;return startFrom-offset},findWordBoundaryRight:function(startFrom){var offset=0,index=startFrom;if(this._reSpace.test(this._text[index]))while(this._reSpace.test(this._text[index]))offset++,index++;while(/\S/.test(this._text[index])&&index<this.text.length)offset++,index++;return startFrom+offset},findLineBoundaryLeft:function(startFrom){for(var offset=0,index=startFrom-1;!/\n/.test(this._text[index])&&index>-1;)offset++,index--;return startFrom-offset},findLineBoundaryRight:function(startFrom){for(var offset=0,index=startFrom;!/\n/.test(this._text[index])&&index<this.text.length;)offset++,index++;return startFrom+offset},searchWordBoundary:function(selectionStart,direction){for(var index=this._reSpace.test(this.text.charAt(selectionStart))?selectionStart-1:selectionStart,_char=this.text.charAt(index),reNonWord=/[ \n\.,;!\?\-]/;!reNonWord.test(_char)&&index>0&&index<this.text.length;)index+=direction,_char=this.text.charAt(index);return reNonWord.test(_char)&&_char!=="\n"&&(index+=direction===1?0:1),index},selectWord:function(selectionStart){selectionStart=selectionStart||this.selectionStart;var newSelectionStart=this.searchWordBoundary(selectionStart,-1),newSelectionEnd=this.searchWordBoundary(selectionStart,1);this.selectionStart=newSelectionStart;this.selectionEnd=newSelectionEnd;this._fireSelectionChanged();this._updateTextarea();this.renderCursorOrSelection()},selectLine:function(selectionStart){selectionStart=selectionStart||this.selectionStart;var newSelectionStart=this.findLineBoundaryLeft(selectionStart),newSelectionEnd=this.findLineBoundaryRight(selectionStart);return this.selectionStart=newSelectionStart,this.selectionEnd=newSelectionEnd,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(e){if(!this.isEditing&&this.editable)return(this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(e),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire("editing:entered"),this._fireSelectionChanged(),!this.canvas)?this:(this.canvas.fire("text:editing:entered",{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this)},exitEditingOnOthers:function(canvas){canvas._iTextInstances&&canvas._iTextInstances.forEac
14h(function(obj){obj.selected=!1;obj.isEditing&&obj.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on("mouse:move",this.mouseMoveHandler)},mouseMoveHandler:function(options){if(this.__isMousedown&&this.isEditing){var newSelectionStart=this.getSelectionStartFromPointer(options.e),currentStart=this.selectionStart,currentEnd=this.selectionEnd;(newSelectionStart===this.__selectionStartOnMouseDown&¤tStart!==currentEnd||currentStart!==newSelectionStart&¤tEnd!==newSelectionStart)&&(newSelectionStart>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=newSelectionStart):(this.selectionStart=newSelectionStart,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==currentStart||this.selectionEnd!==currentEnd)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor="text";this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor="text");this.borderColor=this.editingBorderColor;this.hasControls=this.selectable=!1;this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(start,end,text){var smallerTextStart=text.slice(0,start),graphemeStart=fabric.util.string.graphemeSplit(smallerTextStart).length,smallerTextEnd,graphemeEnd;return start===end?{selectionStart:graphemeStart,selectionEnd:graphemeStart}:(smallerTextEnd=text.slice(start,end),graphemeEnd=fabric.util.string.graphemeSplit(smallerTextEnd).length,{selectionStart:graphemeStart,selectionEnd:graphemeStart+graphemeEnd})},fromGraphemeToStringSelection:function(start,end,_text){var smallerTextStart=_text.slice(0,start),graphemeStart=smallerTextStart.join("").length,smallerTextEnd,graphemeEnd;return start===end?{selectionStart:graphemeStart,selectionEnd:graphemeStart}:(smallerTextEnd=_text.slice(start,end),graphemeEnd=smallerTextEnd.join("").length,{selectionStart:graphemeStart,selectionEnd:graphemeStart+graphemeEnd})},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var newSelection=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=newSelection.selectionStart;this.hiddenTextarea.selectionEnd=newSelection.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={};this.text=this.hiddenTextarea.value;this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var newSelection=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=newSelection.selectionEnd;this.inCompositionMode||(this.selectionStart=newSelection.selectionStart);this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var style=this._calcTextareaPosition();this.hiddenTextarea.style.left=style.left;this.hiddenTextarea.style.top=style.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var desiredPostion=this.inCompositionMode?this.compositionStart:this.selectionStart,boundaries=this._getCursorBoundaries(desiredPostion),cursorLocation=this.get2DCursorLocation(desiredPostion),lineIndex=cursorLocation.lineIndex,charIndex=cursorLocation.charIndex,charHeight=this.getValueOfPropertyAt(lineIndex,charIndex,"fontSize")*this.lineHeight,leftOffset=boundaries.leftOffset,m=this.calcTransformMatrix(),p={x:boundaries.left+leftOffset,y:boundaries.top+boundaries.topOffset+charHeight},upperCanvas=this.canvas.upperCanvasEl,upperCanvasWidth=upperCanvas.width,upperCanvasHeight=upperCanvas.height,maxWidth=upperCanvasWidth-charHeight,maxHeight=upperCanvasHeight-charHeight,scaleX=upperCanvas.clientWidth/upperCanvasWidth,scaleY=upperCanvas.clientHeight/upperCanvasHeight;return p=fabric.util.transformPoint(p,m),p=fabric.util.transformPoint(p,this.canvas.viewportTransform),p.x*=scaleX,p.y*=scaleY,p.x<0&&(p.x=0),p.x>maxWidth&&(p.x=maxWidth),p.y<0&&(p.y=0),p.y>maxHeight&&(p.y=maxHeight),p.x+=this.canvas._offset.left,p.y+=this.canvas._offset.top,{left:p.x+"px",top:p.y+"px",fontSize:charHeight+"px",charHeight:charHeight}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCurs
14or:this.hoverCursor,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var isTextChanged=this._textBeforeEdit!==this.text;return this.selected=!1,this.isEditing=!1,this.selectable=!0,this.selectionEnd=this.selectionStart,this.hiddenTextarea&&(this.hiddenTextarea.blur&&this.hiddenTextarea.blur(),this.canvas&&this.hiddenTextarea.parentNode.removeChild(this.hiddenTextarea),this.hiddenTextarea=null),this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire("editing:exited"),isTextChanged&&this.fire("modified"),this.canvas&&(this.canvas.off("mouse:move",this.mouseMoveHandler),this.canvas.fire("text:editing:exited",{target:this}),isTextChanged&&this.canvas.fire("object:modified",{target:this})),this},_removeExtraneousStyles:function(){for(var prop in this.styles)this._textLines[prop]||delete this.styles[prop]},removeStyleFromTo:function(start,end){var cursorStart=this.get2DCursorLocation(start,!0),cursorEnd=this.get2DCursorLocation(end,!0),lineStart=cursorStart.lineIndex,charStart=cursorStart.charIndex,lineEnd=cursorEnd.lineIndex,charEnd=cursorEnd.charIndex,i,styleObj,diff,numericChar,_char;if(lineStart!==lineEnd){if(this.styles[lineStart])for(i=charStart;i<this._unwrappedTextLines[lineStart].length;i++)delete this.styles[lineStart][i];if(this.styles[lineEnd])for(i=charEnd;i<this._unwrappedTextLines[lineEnd].length;i++)styleObj=this.styles[lineEnd][i],styleObj&&(this.styles[lineStart]||(this.styles[lineStart]={}),this.styles[lineStart][charStart+i-charEnd]=styleObj);for(i=lineStart+1;i<=lineEnd;i++)delete this.styles[i];this.shiftLineStyles(lineEnd,lineStart-lineEnd)}else if(this.styles[lineStart]){for(styleObj=this.styles[lineStart],diff=charEnd-charStart,i=charStart;i<charEnd;i++)delete styleObj[i];for(_char in this.styles[lineStart])numericChar=parseInt(_char,10),numericChar>=charEnd&&(styleObj[numericChar-diff]=styleObj[_char],delete styleObj[_char])}},shiftLineStyles:function(lineIndex,offset){var clonedStyles=clone(this.styles),line,numericLine;for(line in this.styles)numericLine=parseInt(line,10),numericLine>lineIndex&&(this.styles[numericLine+offset]=clonedStyles[numericLine],clonedStyles[numericLine-offset]||delete this.styles[numericLine])},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(lineIndex,charIndex,qty,copiedStyle){var currentCharStyle,newLineStyles={},somethingAdded=!1,index,numIndex;qty||(qty=1);this.shiftLineStyles(lineIndex,qty);this.styles[lineIndex]&&(currentCharStyle=this.styles[lineIndex][charIndex===0?charIndex:charIndex-1]);for(index in this.styles[lineIndex])numIndex=parseInt(index,10),numIndex>=charIndex&&(somethingAdded=!0,newLineStyles[numIndex-charIndex]=this.styles[lineIndex][index],delete this.styles[lineIndex][index]);for(somethingAdded?this.styles[lineIndex+qty]=newLineStyles:delete this.styles[lineIndex+qty];qty>1;)qty--,copiedStyle&&copiedStyle[qty]?this.styles[lineIndex+qty]={0:clone(copiedStyle[qty])}:currentCharStyle?this.styles[lineIndex+qty]={0:clone(currentCharStyle)}:delete this.styles[lineIndex+qty];this._forceClearCache=!0},insertCharStyleObject:function(lineIndex,charIndex,quantity,copiedStyle){var currentLineStyles,currentLineStylesCloned,index,numericIndex,newStyle;this.styles||(this.styles={});currentLineStyles=this.styles[lineIndex];currentLineStylesCloned=currentLineStyles?clone(currentLineStyles):{};quantity||(quantity=1);for(index in currentLineStylesCloned)numericIndex=parseInt(index,10),numericIndex>=charIndex&&(currentLineStyles[numericIndex+quantity]=currentLineStylesCloned[numericIndex],currentLineStylesCloned[numericIndex-quantity]||delete currentLineStyles[numericIndex]);if(this._forceClearCache=!0,copiedStyle){while(quantity--)Object.keys(copiedStyle[quantity]).length&&(this.styles[lineIndex]||(this.styles[lineIndex]={}),this.styles[lineIndex][charIndex+quantity]=clone(copiedStyle[quantity]));return}if(currentLineStyles)for(newStyle=currentLineStyles[charIndex?charIndex-1:1];newStyle&&quantity--;)this.styles[lineIndex][charIndex+quantity]=clone(newStyle)},insertNewStyleBlock:function(insertedText,start,copiedStyle){for(var cursorLoc=this.get2DCursorLocation(start,!0),addedLines=[0],linesLenght=0,i=0;i<insertedText.length;i++)insertedText[i]==="\n"?(linesLenght++,addedLines[linesLenght]=0):addedLines[linesLenght]++;for(addedLines[0]>0&&(this.insertCharStyleObject(cursorLoc.lineIndex,cursorLoc.charIndex,addedLines[0],copiedStyle),copiedStyle=copiedStyle&&copiedStyle.slice(addedLines[0]+1)),linesLenght&&this.insertNewlineStyleObject(cursorLoc.lineIndex,cursorLoc.charIndex+addedLines[0],linesLenght),i=1;i<linesLenght;i++)addedLines[i]>0?this.insertCharStyleObject(cursorLoc.lineIndex+i,0,addedLines[i],copiedStyle):copiedStyle&&(this.styles[cursorLoc.lineIndex+i][0]=copiedStyle[0]),c
14opiedStyle=copiedStyle&&copiedStyle.slice(addedLines[i]+1);addedLines[i]>0&&this.insertCharStyleObject(cursorLoc.lineIndex+i,0,addedLines[i],copiedStyle)},setSelectionStartEndWithShift:function(start,end,newSelection){newSelection<=start?(end===start?this._selectionDirection="left":this._selectionDirection==="right"&&(this._selectionDirection="left",this.selectionEnd=start),this.selectionStart=newSelection):newSelection>start&&newSelection<end?this._selectionDirection==="right"?this.selectionEnd=newSelection:this.selectionStart=newSelection:(end===start?this._selectionDirection="right":this._selectionDirection==="left"&&(this._selectionDirection="right",this.selectionStart=end),this.selectionEnd=newSelection)},setSelectionInBoundaries:function(){var length=this.text.length;this.selectionStart>length?this.selectionStart=length:this.selectionStart<0&&(this.selectionStart=0);this.selectionEnd>length?this.selectionEnd=length:this.selectionEnd<0&&(this.selectionEnd=0)}})}();fabric.util.object.extend(fabric.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date;this.__lastLastClickTime=+new Date;this.__lastPointer={};this.on("mousedown",this.onMouseDown)},onMouseDown:function(options){if(this.canvas){this.__newClickTime=+new Date;var newPointer=options.pointer;this.isTripleClick(newPointer)&&(this.fire("tripleclick",options),this._stopEvent(options.e));this.__lastLastClickTime=this.__lastClickTime;this.__lastClickTime=this.__newClickTime;this.__lastPointer=newPointer;this.__lastIsEditing=this.isEditing;this.__lastSelected=this.selected}},isTripleClick:function(newPointer){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===newPointer.x&&this.__lastPointer.y===newPointer.y},_stopEvent:function(e){e.preventDefault&&e.preventDefault();e.stopPropagation&&e.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler();this.initMouseupHandler();this.initClicks()},initClicks:function(){this.on("mousedblclick",function(options){this.selectWord(this.getSelectionStartFromPointer(options.e))});this.on("tripleclick",function(options){this.selectLine(this.getSelectionStartFromPointer(options.e))})},_mouseDownHandler:function(options){this.canvas&&this.editable&&(!options.e.button||options.e.button===1)&&(this.__isMousedown=!0,this.selected&&this.setCursorByClick(options.e),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(options){this.canvas&&this.editable&&(!options.e.button||options.e.button===1)&&this===this.canvas._activeObject&&(this.selected=!0)},initMousedownHandler:function(){this.on("mousedown",this._mouseDownHandler);this.on("mousedown:before",this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on("mouseup",this.mouseUpHandler)},mouseUpHandler:function(options){(this.__isMousedown=!1,!this.editable||this.group||options.transform&&options.transform.actionPerformed||options.e.button&&options.e.button!==1)||(this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(options.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0)},setCursorByClick:function(e){var newSelection=this.getSelectionStartFromPointer(e),start=this.selectionStart,end=this.selectionEnd;e.shiftKey?this.setSelectionStartEndWithShift(start,end,newSelection):(this.selectionStart=newSelection,this.selectionEnd=newSelection);this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(e){for(var j,jlen,mouseOffset=this.getLocalPointer(e),prevWidth=0,width=0,height=0,charIndex=0,lineIndex=0,lineLeftOffset,line,i=0,len=this._textLines.length;i<len;i++)if(height<=mouseOffset.y)height+=this.getHeightOfLine(i)*this.scaleY,lineIndex=i,i>0&&(charIndex+=this._textLines[i-1].length+1);else break;for(lineLeftOffset=this._getLineLeftOffset(lineIndex),width=lineLeftOffset*this.scaleX,line=this._textLines[lineIndex],j=0,jlen=line.length;j<jlen;j++)if(prevWidth=width,width+=this.__charBounds[lineIndex][j].kernedWidth*this.scaleX,width<=mouseOffset.x)charIndex++;else break;return this._getNewSelectionStartFromOffset(mouseOffset,prevWidth,width,charIndex,jlen)},_getNewSelectionStartFromOffset:function(mouseOffset,prevWidth,width,index,jlen){var distanceBtwLastCharAndCursor=mouseOffset.x-prevWidth,distanceBtwNextCharAndCursor=width-mouseOffset.x,offset=distanceBtwNextCharAndCursor>distanceBtwLastCharAndCursor||distanceBtwNextCharAndCursor<0?0:1,newSelectionStart=index+offset;return this.flipX&&(newSelectionStart=jlen-newSelectionStart),newSelectionStart>this._text.length&&(newSelectionStart=this._text.length),newSelectionStart}});fabric.util.object.extend(fabric.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=fabric.document.createElement("textarea");this.hiddenTextarea.setAttribute("autocapitalize","off");this.hiddenTextarea.setAttribute("autocorrect","off");this.hiddenTextarea.setAttribute("autocomplete","off");
14this.hiddenTextarea.setAttribute("spellcheck","false");this.hiddenTextarea.setAttribute("data-fabric-hiddentextarea","");this.hiddenTextarea.setAttribute("wrap","off");var style=this._calcTextareaPosition();this.hiddenTextarea.style.cssText="position: absolute; top: "+style.top+"; left: "+style.left+"; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; paddingï½°top: "+style.fontSize+";";fabric.document.body.appendChild(this.hiddenTextarea);fabric.util.addListener(this.hiddenTextarea,"keydown",this.onKeyDown.bind(this));fabric.util.addListener(this.hiddenTextarea,"keyup",this.onKeyUp.bind(this));fabric.util.addListener(this.hiddenTextarea,"input",this.onInput.bind(this));fabric.util.addListener(this.hiddenTextarea,"copy",this.copy.bind(this));fabric.util.addListener(this.hiddenTextarea,"cut",this.copy.bind(this));fabric.util.addListener(this.hiddenTextarea,"paste",this.paste.bind(this));fabric.util.addListener(this.hiddenTextarea,"compositionstart",this.onCompositionStart.bind(this));fabric.util.addListener(this.hiddenTextarea,"compositionupdate",this.onCompositionUpdate.bind(this));fabric.util.addListener(this.hiddenTextarea,"compositionend",this.onCompositionEnd.bind(this));!this._clickHandlerInitialized&&this.canvas&&(fabric.util.addListener(this.canvas.upperCanvasEl,"click",this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:"exitEditing",27:"exitEditing",33:"moveCursorUp",34:"moveCursorDown",35:"moveCursorRight",36:"moveCursorLeft",37:"moveCursorLeft",38:"moveCursorUp",39:"moveCursorRight",40:"moveCursorDown"},ctrlKeysMapUp:{67:"copy",88:"cut"},ctrlKeysMapDown:{65:"selectAll"},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(e){if(this.isEditing&&!this.inCompositionMode){if(e.keyCode in this.keysMap)this[this.keysMap[e.keyCode]](e);else if(e.keyCode in this.ctrlKeysMapDown&&(e.ctrlKey||e.metaKey))this[this.ctrlKeysMapDown[e.keyCode]](e);else return;e.stopImmediatePropagation();e.preventDefault();e.keyCode>=33&&e.keyCode<=40?(this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(e){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(e.keyCode in this.ctrlKeysMapUp&&(e.ctrlKey||e.metaKey))this[this.ctrlKeysMapUp[e.keyCode]](e);else return;e.stopImmediatePropagation();e.preventDefault();this.canvas&&this.canvas.requestRenderAll()},onInput:function(e){var fromPaste=this.fromPaste,textareaSelection,backDelete;if(this.fromPaste=!1,e&&e.stopPropagation(),this.isEditing){var nextText=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,charCount=this._text.length,nextCharCount=nextText.length,removedText,insertedText,charDiff=nextCharCount-charCount;if(this.hiddenTextarea.value===""){this.styles={};this.updateFromTextArea();this.fire("changed");this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll());return}textareaSelection=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);backDelete=this.selectionStart>textareaSelection.selectionStart;this.selectionStart!==this.selectionEnd?(removedText=this._text.slice(this.selectionStart,this.selectionEnd),charDiff+=this.selectionEnd-this.selectionStart):nextCharCount<charCount&&(removedText=backDelete?this._text.slice(this.selectionEnd+charDiff,this.selectionEnd):this._text.slice(this.selectionStart,this.selectionStart-charDiff));insertedText=nextText.slice(textareaSelection.selectionEnd-charDiff,textareaSelection.selectionEnd);removedText&&removedText.length&&(this.selectionStart!==this.selectionEnd?this.removeStyleFromTo(this.selectionStart,this.selectionEnd):backDelete?this.removeStyleFromTo(this.selectionEnd-removedText.length,this.selectionEnd):this.removeStyleFromTo(this.selectionEnd,this.selectionEnd+removedText.length));insertedText.length&&(fromPaste&&insertedText.join("")===fabric.copiedText?this.insertNewStyleBlock(insertedText,this.selectionStart,fabric.copiedTextStyle):this.insertNewStyleBlock(insertedText,this.selectionStart));this.updateFromTextArea();this.fire("changed");this.canvas&&(this.canvas.fire("text:changed",{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(e){this.compositionStart=e.target.selectionStart;this.compositionEnd=e.target.selectionEnd;this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(fabric.copiedText=this.getSelectedText(),fabric.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(e){return e&&e.clipboardData||fabric.window.clipboardData},_getWidthBeforeCursor:function(lineIndex,charIndex){var widthBeforeCursor=this._getLineLeftOffset(lineIndex),bound;return charIndex>0&&(bound=this.__charBounds[lineIndex][charIndex-1],widthBeforeCursor+=bou
14nd.left+bound.width),widthBeforeCursor},getDownCursorOffset:function(e,isRight){var selectionProp=this._getSelectionForOffset(e,isRight),cursorLocation=this.get2DCursorLocation(selectionProp),lineIndex=cursorLocation.lineIndex;if(lineIndex===this._textLines.length-1||e.metaKey||e.keyCode===34)return this._text.length-selectionProp;var charIndex=cursorLocation.charIndex,widthBeforeCursor=this._getWidthBeforeCursor(lineIndex,charIndex),indexOnOtherLine=this._getIndexOnLine(lineIndex+1,widthBeforeCursor),textAfterCursor=this._textLines[lineIndex].slice(charIndex);return textAfterCursor.length+indexOnOtherLine+2},_getSelectionForOffset:function(e,isRight){return e.shiftKey&&this.selectionStart!==this.selectionEnd&&isRight?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(e,isRight){var selectionProp=this._getSelectionForOffset(e,isRight),cursorLocation=this.get2DCursorLocation(selectionProp),lineIndex=cursorLocation.lineIndex;if(lineIndex===0||e.metaKey||e.keyCode===33)return-selectionProp;var charIndex=cursorLocation.charIndex,widthBeforeCursor=this._getWidthBeforeCursor(lineIndex,charIndex),indexOnOtherLine=this._getIndexOnLine(lineIndex-1,widthBeforeCursor),textBeforeCursor=this._textLines[lineIndex].slice(0,charIndex);return-this._textLines[lineIndex-1].length+indexOnOtherLine-textBeforeCursor.length},_getIndexOnLine:function(lineIndex,width){for(var line=this._textLines[lineIndex],lineLeftOffset=this._getLineLeftOffset(lineIndex),widthOfCharsOnLine=lineLeftOffset,indexOnLine=0,charWidth,foundMatch,j=0,jlen=line.length;j<jlen;j++)if(charWidth=this.__charBounds[lineIndex][j].width,widthOfCharsOnLine+=charWidth,widthOfCharsOnLine>width){foundMatch=!0;var leftEdge=widthOfCharsOnLine-charWidth,rightEdge=widthOfCharsOnLine,offsetFromLeftEdge=Math.abs(leftEdge-width),offsetFromRightEdge=Math.abs(rightEdge-width);indexOnLine=offsetFromRightEdge<offsetFromLeftEdge?j:j-1;break}return foundMatch||(indexOnLine=line.length-1),indexOnLine},moveCursorDown:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown("Down",e)},moveCursorUp:function(e){(this.selectionStart!==0||this.selectionEnd!==0)&&this._moveCursorUpOrDown("Up",e)},_moveCursorUpOrDown:function(direction,e){var action="get"+direction+"CursorOffset",offset=this[action](e,this._selectionDirection==="right");e.shiftKey?this.moveCursorWithShift(offset):this.moveCursorWithoutShift(offset);offset!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(offset){var newSelection=this._selectionDirection==="left"?this.selectionStart+offset:this.selectionEnd+offset;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,newSelection),offset!==0},moveCursorWithoutShift:function(offset){return offset<0?(this.selectionStart+=offset,this.selectionEnd=this.selectionStart):(this.selectionEnd+=offset,this.selectionStart=this.selectionEnd),offset!==0},moveCursorLeft:function(e){(this.selectionStart!==0||this.selectionEnd!==0)&&this._moveCursorLeftOrRight("Left",e)},_move:function(e,prop,direction){var newValue;if(e.altKey)newValue=this["findWordBoundary"+direction](this[prop]);else if(e.metaKey||e.keyCode===35||e.keyCode===36)newValue=this["findLineBoundary"+direction](this[prop]);else return this[prop]+=direction==="Left"?-1:1,!0;if(typeof newValue!==undefined&&this[prop]!==newValue)return this[prop]=newValue,!0},_moveLeft:function(e,prop){return this._move(e,prop,"Left")},_moveRight:function(e,prop){return this._move(e,prop,"Right")},moveCursorLeftWithoutShift:function(e){var change=!0;return this._selectionDirection="left",this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(change=this._moveLeft(e,"selectionStart")),this.selectionEnd=this.selectionStart,change},moveCursorLeftWithShift:function(e){return this._selectionDirection==="right"&&this.selectionStart!==this.selectionEnd?this._moveLeft(e,"selectionEnd"):this.selectionStart!==0?(this._selectionDirection="left",this._moveLeft(e,"selectionStart")):void 0},moveCursorRight:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight("Right",e)},_moveCursorLeftOrRight:function(direction,e){var actionName="moveCursor"+direction+"With";this._currentCursorOpacity=1;actionName+=e.shiftKey?"Shift":"outShift";this[actionName](e)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(e){return this._selectionDirection==="left"&&this.selectionStart!==this.selectionEnd?this._moveRight(e,"selectionStart"):this.selectionEnd!==this._text.length?(this._selectionDirection="right",this._moveRight(e,"selectionEnd")):void 0},moveCursorRightWithoutShift:function(e){var changed=!0;return this._selectionDirection="right",this.selectionStart===this.selectionEnd?(changed=this._moveRight(e,"selectionStart"),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,changed},removeChars:function(start,end){typeof end=="undefined"&&(end=start+1);this.removeStyleFromTo(start,end);this._text.splice(start,end-start);this.text=this._text.join("");this.set("dirty",!0);this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());this._removeExtraneousStyles()},insertChars:function(text,style,start,end){typeof end=="undefined"&&(end=start);end>start&&this.removeStyleFromTo(start,end);var graphemes=fabric.util.string.graphemeSplit(text);this.insertNewStyleBlock(graphemes,start,style);this._text=[].concat(this._text.slice(0,start),graphemes,this._text.slice(end));this.text=this._text.join("");this.set("dirty",!0);this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());this._removeExtraneousStyles()}}
14),function(){var toFixed=fabric.util.toFixed,multipleSpacesRegex=/ +/g;fabric.util.object.extend(fabric.Text.prototype,{toSVG:function(reviver){var markup=this._createBaseSVGMarkup(),offsets=this._getSVGLeftTopOffsets(),textAndBg=this._getSVGTextAndBg(offsets.textTop,offsets.textLeft);return this._wrapSVGTextAndBg(markup,textAndBg),reviver?reviver(markup.join("")):markup.join("")},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(markup,textAndBg){var filter=this.getSvgFilter(),style=filter===""?"":' style="'+filter+'"',textDecoration=this.getSvgTextDecoration(this);markup.push("\t<g ",this.getSvgId(),'transform="',this.getSvgTransform(),this.getSvgTransformMatrix(),'"',style,">\n",textAndBg.textBgRects.join(""),'\t\t<text xml:space="preserve" ',this.fontFamily?'font-family="'+this.fontFamily.replace(/"/g,"'")+'" ':"",this.fontSize?'font-size="'+this.fontSize+'" ':"",this.fontStyle?'font-style="'+this.fontStyle+'" ':"",this.fontWeight?'font-weight="'+this.fontWeight+'" ':"",textDecoration?'text-decoration="'+textDecoration+'" ':"",'style="',this.getSvgStyles(!0),'"',this.addPaintOrder()," >",textAndBg.textSpans.join(""),"<\/text>\n","\t<\/g>\n")},_getSVGTextAndBg:function(textTopOffset,textLeftOffset){var textSpans=[],textBgRects=[],height=textTopOffset,lineOffset,i,len;for(this._setSVGBg(textBgRects),i=0,len=this._textLines.length;i<len;i++)lineOffset=this._getLineLeftOffset(i),(this.textBackgroundColor||this.styleHas("textBackgroundColor",i))&&this._setSVGTextLineBg(textBgRects,i,textLeftOffset+lineOffset,height),this._setSVGTextLineText(textSpans,i,textLeftOffset+lineOffset,height),height+=this.getHeightOfLine(i);return{textSpans:textSpans,textBgRects:textBgRects}},_createTextCharSpan:function(_char,styleDecl,left,top){var shouldUseWhitespace=_char!==_char.trim()||_char.match(multipleSpacesRegex),styleProps=this.getSvgSpanStyles(styleDecl,shouldUseWhitespace),fillStyles=styleProps?'style="'+styleProps+'"':"",dy=styleDecl.deltaY,dySpan="",NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS;return dy&&(dySpan=' dy="'+toFixed(dy,NUM_FRACTION_DIGITS)+'" '),['<tspan x="',toFixed(left,NUM_FRACTION_DIGITS),'" y="',toFixed(top,NUM_FRACTION_DIGITS),'" ',dySpan,fillStyles,">",fabric.util.string.escapeXml(_char),"<\/tspan>"].join("")},_setSVGTextLineText:function(textSpans,lineIndex,textLeftOffset,textTopOffset){var lineHeight=this.getHeightOfLine(lineIndex),isJustify=this.textAlign.indexOf("justify")!==-1,actualStyle,nextStyle,charsToRender="",charBox,style,boxWidth=0,line=this._textLines[lineIndex],timeToRender,i,len;for(textTopOffset+=lineHeight*(1-this._fontSizeFraction)/this.lineHeight,i=0,len=line.length-1;i<=len;i++)timeToRender=i===len||this.charSpacing,charsToRender+=line[i],charBox=this.__charBounds[lineIndex][i],boxWidth===0?(textLeftOffset+=charBox.kernedWidth-charBox.width,boxWidth+=charBox.width):boxWidth+=charBox.kernedWidth,isJustify&&!timeToRender&&this._reSpaceAndTab.test(line[i])&&(timeToRender=!0),timeToRender||(actualStyle=actualStyle||this.getCompleteStyleDeclaration(lineIndex,i),nextStyle=this.getCompleteStyleDeclaration(lineIndex,i+1),timeToRender=this._hasStyleChangedForSvg(actualStyle,nextStyle)),timeToRender&&(style=this._getStyleDeclaration(lineIndex,i)||{},textSpans.push(this._createTextCharSpan(charsToRender,style,textLeftOffset,textTopOffset)),charsToRender="",actualStyle=nextStyle,textLeftOffset+=boxWidth,boxWidth=0)},_pushTextBgRect:function(textBgRects,color,left,top,width,height){var NUM_FRACTION_DIGITS=fabric.Object.NUM_FRACTION_DIGITS;textBgRects.push("\t\t<rect ",this._getFillAttributes(color),' x="',toFixed(left,NUM_FRACTION_DIGITS),'" y="',toFixed(top,NUM_FRACTION_DIGITS),'" width="',toFixed(width,NUM_FRACTION_DIGITS),'" height="',toFixed(height,NUM_FRACTION_DIGITS),'"><\/rect>\n')},_setSVGTextLineBg:function(textBgRects,i,leftOffset,textTopOffset){for(var line=this._textLines[i],heightOfLine=this.getHeightOfLine(i)/this.lineHeight,boxWidth=0,boxStart=0,charBox,currentColor,lastColor=this.getValueOfPropertyAt(i,0,"textBackgroun
14dColor"),j=0,jlen=line.length;j<jlen;j++)charBox=this.__charBounds[i][j],currentColor=this.getValueOfPropertyAt(i,j,"textBackgroundColor"),currentColor!==lastColor?(lastColor&&this._pushTextBgRect(textBgRects,lastColor,leftOffset+boxStart,textTopOffset,boxWidth,heightOfLine),boxStart=charBox.left,boxWidth=charBox.width,lastColor=currentColor):boxWidth+=charBox.kernedWidth;currentColor&&this._pushTextBgRect(textBgRects,currentColor,leftOffset+boxStart,textTopOffset,boxWidth,heightOfLine)},_getFillAttributes:function(value){var fillColor=value&&typeof value=="string"?new fabric.Color(value):"";return!fillColor||!fillColor.getSource()||fillColor.getAlpha()===1?'fill="'+value+'"':'opacity="'+fillColor.getAlpha()+'" fill="'+fillColor.setAlpha(1).toRgb()+'"'},_getSVGLineTopOffset:function(lineIndex){for(var lineTopOffset=0,lastHeight=0,j=0;j<lineIndex;j++)lineTopOffset+=this.getHeightOfLine(j);return lastHeight=this.getHeightOfLine(j),{lineTop:lineTopOffset,offset:(this._fontSizeMult-this._fontSizeFraction)*lastHeight/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(skipShadow){var svgStyle=fabric.Object.prototype.getSvgStyles.call(this,skipShadow);return svgStyle+" white-space: pre;"}})}(),function(global){"use strict";var fabric=global.fabric||(global.fabric={});fabric.Textbox=fabric.util.createClass(fabric.IText,fabric.Observable,{type:"textbox",minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:fabric.Text.prototype._dimensionAffectingProps.concat("width"),initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set("width",this.dynamicMinWidth),this.textAlign.indexOf("justify")!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:"_dimensionAffectingProps"}))},_generateStyleMap:function(textInfo){for(var realLineCount=0,realLineCharCount=0,charCount=0,map={},i=0;i<textInfo.graphemeLines.length;i++)textInfo.graphemeText[charCount]==="\n"&&i>0?(realLineCharCount=0,charCount++,realLineCount++):this._reSpaceAndTab.test(textInfo.graphemeText[charCount])&&i>0&&(realLineCharCount++,charCount++),map[i]={line:realLineCount,offset:realLineCharCount},charCount+=textInfo.graphemeLines[i].length,realLineCharCount+=textInfo.graphemeLines[i].length;return map},styleHas:function(property,lineIndex){if(this._styleMap&&!this.isWrapping){var map=this._styleMap[lineIndex];map&&(lineIndex=map.line)}return fabric.Text.prototype.styleHas.call(this,property,lineIndex)},isEmptyStyles:function(lineIndex){var offset=0,nextLineIndex=lineIndex+1,nextOffset,obj,shouldLimit=!1,map=this._styleMap[lineIndex],mapNextLine=this._styleMap[lineIndex+1],p1,p2,p3;map&&(lineIndex=map.line,offset=map.offset);mapNextLine&&(nextLineIndex=mapNextLine.line,shouldLimit=nextLineIndex===lineIndex,nextOffset=mapNextLine.offset);obj=typeof lineIndex=="undefined"?this.styles:{line:this.styles[lineIndex]};for(p1 in obj)for(p2 in obj[p1])if(p2>=offset&&(!shouldLimit||p2<nextOffset))for(p3 in obj[p1][p2])return!1;return!0},_getStyleDeclaration:function(lineIndex,charIndex){if(this._styleMap&&!this.isWrapping){var map=this._styleMap[lineIndex];if(!map)return null;lineIndex=map.line;charIndex=map.offset+charIndex}return this.callSuper("_getStyleDeclaration",lineIndex,charIndex)},_setStyleDeclaration:function(lineIndex,charIndex,style){var map=this._styleMap[lineIndex];lineIndex=map.line;charIndex=map.offset+charIndex;this.styles[lineIndex][charIndex]=style},_deleteStyleDeclaration:function(lineIndex,charIndex){var map=this._styleMap[lineIndex];lineIndex=map.line;charIndex=map.offset+charIndex;delete this.styles[lineIndex][charIndex]},_getLineStyle:function(lineIndex){var map=this._styleMap[lineIndex];return this.styles[map.line]},_setLineStyle:function(lineIndex,style){var map=this._styleMap[lineIndex];this.styles[map.line]=style},_deleteLineStyle:function(lineIndex){var map=this._styleMap[lineIndex];delete this.styles[map.line]},_wrapText:function(lines,desiredWidth){var wrapped=[],i;for(this.isWrapping=!0,i=0;i<lines.length;i++)wrapped=wrapped.concat(this._wrapLine(lines[i],i,desiredWidth));return this.isWrapping=!1,wrapped},_measureWord:function(word,lineIndex,charOffset){var width=0,prevGrapheme,i,len,box;for(charOffset=charOffset||0,i=0,len=word.length;i<len;i++)box=this._getGraphemeBox(word[i],lineIndex,i+charOffset,prevGrapheme,!0),width+=box.kernedWidth,prevGrapheme=word[i];return width},_wrapLine:function(_line,lineIndex,desiredWidth,reservedSpace){var lineWidth=0,graphemeLines=[],line=[],words=_line.split(this._reSpaceAndTab),word="",offset=0,infix=" ",wordWidth=0,infi
14xWidth=0,largestWordWidth=0,lineJustStarted=!0,additionalSpace=this._getWidthOfCharSpacing(),reservedSpace=reservedSpace||0,i;for(desiredWidth-=reservedSpace,i=0;i<words.length;i++)word=fabric.util.string.graphemeSplit(words[i]),wordWidth=this._measureWord(word,lineIndex,offset),offset+=word.length,lineWidth+=infixWidth+wordWidth-additionalSpace,lineWidth>=desiredWidth&&!lineJustStarted?(graphemeLines.push(line),line=[],lineWidth=wordWidth,lineJustStarted=!0):lineWidth+=additionalSpace,lineJustStarted||line.push(infix),line=line.concat(word),infixWidth=this._measureWord([infix],lineIndex,offset),offset++,lineJustStarted=!1,wordWidth>largestWordWidth&&(largestWordWidth=wordWidth);return i&&graphemeLines.push(line),largestWordWidth+reservedSpace>this.dynamicMinWidth&&(this.dynamicMinWidth=largestWordWidth-additionalSpace+reservedSpace),graphemeLines},isEndOfWrapping:function(lineIndex){return this._styleMap[lineIndex+1]?this._styleMap[lineIndex+1].line!==this._styleMap[lineIndex].line?!0:!1:!0},_splitTextIntoLines:function(text){for(var newText=fabric.Text.prototype._splitTextIntoLines.call(this,text),graphemeLines=this._wrapText(newText.lines,this.width),lines=new Array(graphemeLines.length),i=0;i<graphemeLines.length;i++)lines[i]=graphemeLines[i].join("");return newText.lines=lines,newText.graphemeLines=graphemeLines,newText},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},toObject:function(propertiesToInclude){return this.callSuper("toObject",["minWidth"].concat(propertiesToInclude))}});fabric.Textbox.fromObject=function(object,callback){return fabric.Object._fromObject("Textbox",object,callback,"text")}}(typeof exports!="undefined"?exports:this),function(){var setObjectScaleOverridden=fabric.Canvas.prototype._setObjectScale;fabric.Canvas.prototype._setObjectScale=function(localMouse,transform,lockScalingX,lockScalingY,by,lockScalingFlip,_dim){var t=transform.target,tw,w;if(by==="x"&&t instanceof fabric.Textbox){if(tw=t._getTransformedDimensions().x,w=t.width*(localMouse.x/tw),w>=t.getMinWidth())return t.set("width",w),!0}else return setObjectScaleOverridden.call(fabric.Canvas.prototype,localMouse,transform,lockScalingX,lockScalingY,by,lockScalingFlip,_dim)};fabric.util.object.extend(fabric.Textbox.prototype,{_removeExtraneousStyles:function(){for(var prop in this._styleMap)this._textLines[prop]||delete this.styles[this._styleMap[prop].line]}})}();window.cookieUtils=window.cookieUtils||new Website.CookiesManager;window.application.addView(function($,application){function isLocalStorageAvailable(){try{return window.localStorage.length,!0}catch(e){return!1}}function EditProduct(){this.product=null;this.options=null;this.productTabsComponent=null;this.canvasTabsComponent=null;this.productCarouselComponent=null;this.dialogueComponent=null;this.productOptionsComponent=null;this.cartComponent=null;this.tooltips=null;this.finalPreviewCarousel=null;this.dropDownComponent=null}return EditProduct.prototype.init=function(){this.product=application.getModel("Product");this.options=application.getModel("Options");this.productOptionsComponent=application.getComponent("ProductOptions",[]).init();this.productTabsComponent=application.getComponent("ProductTabs").init();this.canvasTabsComponent=application.getComponent("CanvasTabs").init();this.productCarouselComponent=application.getComponent("ProductCarousel").init();this.dialogueComponent=application.getComponent("Dialogue").init();application.getComponent("UploadDialogue").init();this.cartComponent=application.getComponent("ProductCart").init();this.tooltips=application.getComponent("Tooltips").init();this.finalPreviewCarousel=application.getComponent("FinalPreviewCarousel").init();application.getComponent("ImageDropDownOptions").init();application.getComponent("PreviewSizeChange").init();application.getComponent("Breadcrumb").init();this.validationService=application.getModel("ValidationService")},EditProduct.prototype.loadProduct=function(firstLoad,clearDesign){var self=this,id,options;firstLoad&&this.product.productDesignService.loadProductOptions();firstLoad&&(this.productOptionsComponent=application.getComponent("ProductOptions",[]).init(),this.dropDownComponent=application.getComponent("DropdownWithPopup").init());document.getElementById("btnFinalPreview").disabled=!0;application.triggerApplicationEvent("/product/edit/showpreviewloader/loadproduct");id=presets.productId;options=this.productOptionsComponent.getAffectedOptionsAsString();presets.isBulkFabric&&(options=this.productOptionsComponent.getOptionsAsString());this.product.productDesignService.loadById(id,options,clearDesign,function(){self.onDesignLoaded(firstLoad)},self.onDesignLoadError);firstLoad&&this.product.productDesignService.loadRecentlyUsedColors()},EditProduct.prototype.onDesignLoaded=function(firstLoad){if(application.triggerApplicationEvent("/product/edit/initField"),application.triggerApplicationEvent("/product/refreshPrice"),application.triggerApplicationEvent("/product/edit/loadField/true"),application.triggerApplicationEvent("/product/edit/productLoaded/"),application.triggerApplicationEvent("/product/selectField/displayHideControls"),firstLoad&&(application.triggerApplicationEvent("/product/design/firstload"),this.validationService.validate(),presets.addImageIndex!==-1&&application.triggerApplicationEvent("/product/selectField/{0}
14/false".format(presets.addImageIndex)),application.getComponent("ContentChanges").init()),presets.IsAddedToStore==!0&&presets.TweakOptionValue!=null&&presets.TweakOptionValue!=""){let tweakableOptions=this.productOptionsComponent.getTweakableAffectedOptionsAsString();this.product.productDesignService.getInitialTemplateForOptionValues(presets.productId,tweakableOptions)}!firstLoad},EditProduct.prototype.onDesignLoadError=function(error){if(!isLocalStorageAvailable()&&!window.cookieUtils.isCookiesEnabled()){$("#md-errorMessage").hide();$("#md-cookieBlocked").modal();return}JL().error("Design Load Error : "+error);console.log(error);window.isDirty=!1;var errorMessage=$("#md-errorMessage").modal();errorMessage.find(".ok_btn_pop").on("click",function(){window.location="/"})},EditProduct.prototype.selectField=function(ind){parseInt(ind)!="NaN"&&(this.product.fieldsService.setCurrent(parseInt(ind)),setTimeout(function(){application.triggerApplicationEvent("/product/edit/initField");application.triggerApplicationEvent("/product/edit/loadField/false");application.triggerApplicationEvent("/accordion/setFirstObjectAsActive");application.triggerApplicationEvent("/product/selectField/displayHideControls");application.triggerApplicationEvent("/product/edit/updatepreviewsize")},200))},new EditProduct}(jQuery,window.application),"EditProduct");window.application.addController(function($,application){function PrevImgLdNfController(){this.route("/product/edit/updatePreview",this.requested);this.route("/product/edit/flatImageLoaded",this.loaded);this.route("/product/edit/showloader/:source/:name",this.requested);this.route("/product/edit/showpreviewloader/:source",this.showPreviewLoader);this.route("/product/edit/hidepreviewloader/:source",this.hidePreviewLoader);this.prevImgLdNf=null}return PrevImgLdNfController.prototype=new application.Controller,PrevImgLdNfController.prototype.init=function(){this.prevImgLdNf=application.getView("PrevImgLdNf")},PrevImgLdNfController.prototype.requested=function(){this.prevImgLdNf.showView()},PrevImgLdNfController.prototype.loaded=function(){this.prevImgLdNf.hideView()},PrevImgLdNfController.prototype.showPreviewLoader=function(){this.prevImgLdNf.showPreviewLoader()},PrevImgLdNfController.prototype.hidePreviewLoader=function(){this.prevImgLdNf.hidePreviewLoader()},new PrevImgLdNfController}(jQuery,window.application));window.application.addView(function($){function PrevImgLdNf(){this.notification=null;this.notificationprev=null}return PrevImgLdNf.prototype.init=function(){var self=this;this.notification=$(".canvasprogress");this.notificationprev=$(".previewloading");this.hideView()},PrevImgLdNf.prototype.hideView=function(){this.notification.css("display","none")},PrevImgLdNf.prototype.showView=function(){this.notification.css("display","flex");$(".js-addimage-overlay").hide()},PrevImgLdNf.prototype.showPreviewLoader=function(){this.notificationprev.css("display","flex");$(".js-addimage-overlay").hide()},PrevImgLdNf.prototype.hidePreviewLoader=function(){this.notificationprev.css("display","none")},new PrevImgLdNf}(jQuery,window.application),"PrevImgLdNf");__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Preview){var Help;(function(){ko.validation.configure({messagesOnModified:!0,errorElementClass:"error",errorMessageClass:"text-error",decorateElement:!0});var PreviewHelperController=function(_super){function PreviewHelperController(){var _this=_super.call(this)||this;return _this.route("/preview/helper",_this.openFooterHelp),_this.route("/preview/helper/top",_this.openTopHelp),_this.route("/preview/helper/load",_this.load),_this}return __extends(PreviewHelperController,_super),PreviewHelperController.prototype.init=function(){this._previewHelperViewModel||(this._previewHelperViewModel=new PreviewHelperViewModel);this._previewHelperViewModel.showFooterHelpLink()},PreviewHelperController.prototype.openFooterHelp=function(){var previewHelper,isDownloadProductTemplatesEnabled;application.triggerApplicationEvent("/track/detailedevent/EstoreDesign/ClickedHelp/FooterHelp/1");previewHelper=$("#md-previewHelper").modal();previewHelper.find(".gallery-load").show();isDownloadProductTemplatesEnabled=$(".action-button[rel='/preview/helper']").data("downloadtemplates");$.ajax({url:"/estore/PreviewHelp/EstoreHelp",type:"GET",data:{isDownloadProductTemplatesEnable:isDownloadProductTemplatesEnabled}
14,success:function(result){previewHelper.find(".modal-container").html(result);application.triggerApplicationEvent("/preview/helper/load")}});window.pushCreationStudioToGTM("Click: Need help")},PreviewHelperController.prototype.openTopHelp=function(){application.triggerApplicationEvent("/track/detailedevent/EstoreDesign/ClickedHelp/TopHelp/1");this._previewHelperViewModel.openHelper()},PreviewHelperController.prototype.load=function(){this._previewHelperViewModel.load();ko.applyBindings(this._previewHelperViewModel,$("#estorehelp")[0])},PreviewHelperController}(Controller),PreviewHelperViewModel=function(){function PreviewHelperViewModel(){var _this=this;this._getTopicsUrl="/estore/previewhelp/gettopics";this._getQuestionsUrl="/estore/previewhelp/getquestions";this._searchUrl="/estore/previewhelp/search";this._saveQuestionUrl="/estore/previewhelp/savecustomerquestion";this.helpTopics=ko.observableArray();this.helpQuestions=ko.observableArray();this.searchResult=ko.observableArray();this.searchPhrase=ko.observable();this.selectedTopic=ko.observable();this.bleedImageString=ko.observable("");this.questionsVisibility=ko.observable(!1);this.searchResultVisibility=ko.observable(!1);this.formVisibility=ko.observable(!1);this.messageVisibility=ko.observable(!1);this.invalidEmailMessageVisibility=ko.observable(!1);this.searchPhrase.subscribe(function(){_this.search()})}return PreviewHelperViewModel.prototype.load=function(){var _this=this,estoreHelperPresets,jxhr;this.searchResultVisibility(!1);this.formVisibility(!1);this.questionsVisibility(!1);this.searchPhrase("");this.selectedTopic("");this.messageVisibility(!1);this.invalidEmailMessageVisibility(!1);estoreHelperPresets=application.getObject("EstoreHelperPresets");this.bleedImageString(estoreHelperPresets.bleedsandsafearea);this.customerHelpQuestion=new CustomerHelpQuestionModel(estoreHelperPresets);jxhr=application.ajax({type:"Get",url:this._getTopicsUrl,dataType:"json",data:{}});jxhr.done(function(result){_this.helpTopics($.parseJSON(result));_this.helpTopics.unshift(_this.getBleedTopicObject());_this.loadImageElement(_this.helpTopics()[0])})},PreviewHelperViewModel.prototype.loadImageElement=function(topic){this.selectedTopic(topic.TopicName);var questions=[this.getBleedQuestionObject()];this.questionsVisibility(!0);this.searchResultVisibility(!1);this.formVisibility(!1);this.messageVisibility(!1);this.helpQuestions(questions)},PreviewHelperViewModel.prototype.getBleedQuestionObject=function(){return{Id:999,Title:this.bleedImageString(),Description:$(".design-tips-popup").html(),SearchKeywords:this.bleedImageString(),HelpTopicId:999,Visibility:ko.observable(!0),IsHide:ko.observable(!0)}},PreviewHelperViewModel.prototype.getBleedTopicObject=function(){return{Id:999,TopicName:this.bleedImageString(),SystemName:"custom"}},PreviewHelperViewModel.prototype.getBleedSearchObject=function(){return{TopicName:this.bleedImageString(),Questions:[this.getBleedQuestionObject()]}},PreviewHelperViewModel.prototype.loadQuestions=function(topic){var _this=this,jxhr;topic.Id==999&&this.loadImageElement(this.helpTopics()[0]);this.questionsVisibility(!0);this.searchResultVisibility(!1);this.formVisibility(!1);this.messageVisibility(!1);this.invalidEmailMessageVisibility(!1);this.searchPhrase("");this.selectedTopic(topic.TopicName);$(".topic-item").removeClass("active-topic");$(".topic-item.topicid_"+topic.Id).addClass("active-topic");topic.Id!=999&&(jxhr=application.ajax({type:"GET",url:this._getQuestionsUrl,dataType:"json",data:{topicId:topic.Id}}),jxhr.done(function(result){for(var questions=$.parseJSON(result),i=0;i<questions.length;i++)questions[i].Visibility=ko.observable(!1),questions[i].IsHide=ko.observable(!1);_this.helpQuestions(questions)}))},PreviewHelperViewModel.prototype.showQuestionContent=function(question){ko.utils.arrayMap(this.helpQuestions(),function(helpQuestion){return helpQuestion!=question&&helpQuestion.Visibility()?helpQuestion.Visibility(!1):helpQuestion.Visibility()});question.Visibility(!question.Visibility())},PreviewHelperViewModel.prototype.search=function(){var _this=this,jxhr;this.searchPhrase()&&this.searchPhrase().length>3&&(jxhr=application.ajax({type:"POST",url:this._searchUrl,dataType:"json",data:{searchPhrase:this.searchPhrase()}}),jxhr.done(function(result){var topics=$.parseJSON(result);_this.bleedImageString().indexOf(_this.searchPhrase())!=-1&&topics.length==0&&(topics=[_this.getBleedSearchObject()]);topics.length>0?(_this.searchResultVisibility(!0),_this.formVisibility(!1),_this.questionsVisibility(!1),_this.messageVisibility(!1),_this.invalidEmailMessageVisibility(!1),topics.unshift(_this.getBleedSearchObject()),_this.searchResult(topics)):(_this.searchResultVisibility(!1),_this.questionsVisibility(!1),_this.formVisibility(!0),_this.messageVisibility(!1),_this.invalidEmailMessageVisibility(!1))}))},PreviewHelperViewModel.prototype.sendQuestion=function(){var _this=this,regexp,result,jxhr;if(this.customerHelpQuestion.IsValid())if(regexp=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,result=regexp.test(this.customerHelpQuestion.Email()),result)jxhr=application.ajax({type:"POST",url:this._saveQuestionUrl,dataType:"json",data:{email:this.customerHelpQuestion.Email(),phone:this.customerHelpQuestion.Phone(),question:this.customerHelpQuestion.Question()}}),jxhr.done(function(result){var saveResult=$.parseJSON(result);_this.formVisibility(!1);_this.invalidEmailMessageVisibility(!1);_this.messageVisibility(!0)});else return this.invalidEmailMessageVisibility(!0),!1},PreviewHelperViewModel.prototype.openHelper=function(){this._helpDialogue=application.getComponent("Dialogue");this._helpDialogue.open("previewHelper",function(){})},PreviewHelperViewModel.prototype.showFooterHelpLink=function(){$("div.fr-lastmessage-estore").show();$("div.fr-lastmessage").hide()},PreviewHelperViewModel}(),CustomerHelpQuestionModel=function(){function CustomerHelpQuestionModel(estoreHelperPresets){var _this=this;this.Email=ko.observable().extend({required:{params:!0,message:estoreHelperPresets.requiredMessage}});this.Phone=ko.observable();this.Question=ko.observable().extend({required:{params:!0,message:estoreHelperPresets.requiredMessage}});this.IsValid=ko.computed(function(){return ko.validation.group(_this,{observable:!0,deep:!0}).showAllMessages(!0),_this.Email.isValid()&&_this.Question.isValid()})}return CustomerHelpQuestionModel}();application.addController(new PreviewHelperController)})(Help=Preview.Help||(Preview.Help={}))}(Preview||(Preview={}));application.addController(function($,application){function PreviewController(){this.route("/product/edit/loadField/:forceLoad",this.updatePreview);this.route("/product/preview/load/field/for/carousel/:forceLoad",this.updatePreview);this.route("/product/loadProductDesign/:firstLoad",this.showPreviewLoadImage);this.route("/product/edit/updateProductPreview",this.updatePreview);this.route("/preview/update/pending/",this.updatePending);this.route("/product/carousel/copyDesign/Completed",this.CopyDesignCompleted);this.route("/product/carousel/copyDesign/ClearDesignCompleted",this.ClearDesignCompleted);this.route("/product/preview/toggleaddbutton",this.toggleAddButton);this.route("/product/preview/openDownloadMask",this.openDownloadMaskModal);this.preview=null}function isLocalStorageAvailable(){try{return window.localStorage.length,!0}catch(e){return!1}}return PreviewController.prototype=new application.Controller,PreviewController.prototype.init=function(){if(this.preview=application.getComponent("Preview"),$("#backToAccountOrStore").length>0){if(isLocalStorageAvailable())try{var backtoaccountOrStoreUrl=localStorage.getItem("backToAccountOrStoreUrl")}catch(e){console.log("Local Storage error",e)}if(document.referrer!=null&&(document.referrer.indexOf("mystore/edit")>0||document.referrer.toLowerCase().indexOf("designartview")>0)&&(backtoaccountOrStoreUrl=document.referrer),backtoaccountOrStoreUrl!=""&&backtoaccountOrStoreUrl!=null&&(backtoaccountOrStoreUrl.indexOf("mystore/edit")>0||backtoaccountOrStoreUrl.toLowerCase().indexOf("designartview")>
140)?($("#lbldgnbackbtn").html(presets.productDesign.backUrlText),$("#lbldgnbackarrow strong").html("<"),$("#backToAccountOrStore").attr("href",backtoaccountOrStoreUrl).attr("title",presets.productDesign.backUrlText)):($("#lbldgnbackbtn").html(presets.productDesign.backtoaccounturl),$("#lbldgnbackarrow strong").html("<"),$("#backToAccountOrStore").attr("href","/estore/account/manage/mydesigns").attr("title",presets.productDesign.backtoaccounturl)),isLocalStorageAvailable())try{localStorage.removeItem("designBackToButtonclick")}catch(e){console.log("Local Storage error",e)}}if(document.referrer){let url=new URL(document.referrer);if(url.pathname!=="/estore/design/"+presets.productId&&url.pathname!=="/estore/design/createdesign/"+presets.productId&&!url.pathname.includes("/estore/design/duplicate/")&&isLocalStorageAvailable())try{localStorage.setItem("backButtonURL",document.referrer)}catch(e){console.log("Local Storage error",e)}}if(document.referrer&&history.length>1){let url=new URL(document.referrer);url.hostname===window.location.hostname&&$("#backToURL").attr("style","visibility: visible")}else $("#backToURL").attr("style","visibility:hidden")},$("#backToAccountOrStore").click(function(){if($("#lbldgnbackbtn").html()==presets.productDesign.backtoaccounturl){if(isLocalStorageAvailable())try{localStorage.setItem("designBackToButtonclick","myaccount")}catch(e){console.log("Local Storage error",e)}}else if(this.isLocalStorageAvailable())try{localStorage.setItem("designBackToButtonclick","mystore")}catch(e){console.log("Local Storage error",e)}}),$("#backToURL").click(function(e){if($(this).hasClass("disabled")){e.preventDefault();return}let referrerUrl=document.referrer,result=referrerUrl.includes("/estore/compose");if(window.history)if(pushAdvanceStudioToGTM(ActionCategory.TopNavBackButton),result){const urlObj=new URL(referrerUrl);urlObj.searchParams.delete("optionValue");window.location.href=urlObj.toString();e.preventDefault()}else{if(isLocalStorageAvailable()){const backURL=localStorage.getItem("backButtonURL");try{backURL&&backURL!==window.location.href?window.location.replace(backURL):history.back()}catch(e){console.log("Local Storage error",e)}}else history.back();e.preventDefault()}}),PreviewController.prototype.updatePreview=function(event){var forceLoad=!1;event.parameters.forceLoad&&(forceLoad=event.parameters.forceLoad.bool());this.preview.updatePreview(forceLoad)},PreviewController.prototype.showPreviewLoadImage=function(){this.preview.showPreviewLoadImage()},PreviewController.prototype.updatePending=function(){this.preview.updatePending()},PreviewController.prototype.CopyDesignCompleted=function(){this.preview.CopyDesignCompleted()},PreviewController.prototype.ClearDesignCompleted=function(){this.preview.ClearDesignCompleted()},PreviewController.prototype.toggleAddButton=function(){this.preview.toggleAddImageButton()},PreviewController.prototype.openDownloadMaskModal=function(){console.log("openDownloadMaskModal");const productId=presets.productId;if(!productId){console.error("ProductId missing in presets");return}const $modal=$("#md-downloadMask"),$content=$modal.find(".js-downloadmask-content"),$optionsContainer=$("#selectedOptionsContainer"),$loader=$modal.find(".downloadmask-loader");if(!$modal.is(":visible")){$(".modal-generic:visible").not($modal).length>0?$modal.addClass("child-model"):$modal.removeClass("child-model");$modal.modal();$(document).off("keyup");$(document).off("keyup.downloadMaskEsc").on("keyup.downloadMaskEsc",function(evt){if(evt.keyCode===27&&$modal.is(":visible")){evt.preventDefault();evt.stopImmediatePropagation();var preview=application.getComponent("Preview");return preview.closeDownloadMaskModal(),!1}});const url=`/estore/DownloadMask/OpenDownloadMask?productId=${productId}`;$content.empty();$optionsContainer.empty();$loader.show();$content.hide();$optionsContainer.hide();$.get(url).done(function(html){$content.html(html);const preview=application.getComponent("Preview");preview.renderOptionsInModal();$loader.hide();$content.show();$optionsContainer.show();$(".js-download-template-btn").prop("disabled",!1)}).fail(function(err){console.error(err);$loader.hide();$content.show();s$content.html(` 15 <div class="download-error"> 16 Failed to load selected options. 17 </div> 18 `)})}},new PreviewController}(jQuery,window.application));application.addComponent(function($){function Preview(){this.product=null;this.canvasTab=null;this._$preview=null;this.productOptions=null;this._$tabPreview=null;this.designInterfaceIntroLoded=!1}
18function pushDownloadTemplateGATag(action){var formattedAction="",event_data,jsonData;formattedAction=downloadTemplateSource?downloadTemplateSource.toLowerCase().replace(/\s+/g,"")+": "+action:action;event_data={event_list:"",product_id:presets.productId,product_name:presets.DBProductName};event_label=`${window.location.href} / Event data : ${JSON.stringify(event_data)}`;jsonData={event:"custom_event",event_category:"Template Download",event_action:formattedAction,event_label:event_label};window.dataLayer=window.dataLayer||[];window.dataLayer.push(jsonData);console.log("Download Template GATag :",JSON.stringify(jsonData))}var downloadTemplateSource="";return Preview.prototype.init=function(){this.canvasTabs=application.getComponent("CanvasTabs");this.product=application.getModel("Product");this._$preview=$("#preview a");this.productOptions=application.getComponent("ProductOptions",[]);this._$tabPreview=$("#tab-preview");$(document).off("click.previewDownloadMask").on("click.previewDownloadMask",".js-open-downloadmask-modal",function(e){e.preventDefault();downloadTemplateSource=$(this).data("source")||"";console.log("previewDownloadMask click fired");console.log("Source:",downloadTemplateSource);pushDownloadTemplateGATag("templates_click");application.triggerApplicationEvent("/product/preview/openDownloadMask")});$(document).off("click.downloadTemplate").on("click.downloadTemplate",".js-download-template-btn",function(){var preview=application.getComponent("Preview");preview.downloadTemplates()});$(document).off("click.downloadMaskClose").on("click.downloadMaskClose","#md-downloadMask .downloadmask-close, #md-downloadMask .downloadmask-cancel",function(e){var action,preview;e.preventDefault();e.stopPropagation();action=$(this).hasClass("downloadmask-close")?"close_click":"cancel_click";pushDownloadTemplateGATag(action);preview=application.getComponent("Preview");preview.closeDownloadMaskModal()});return this},Preview.prototype.updatePreview=function(forceLoad){var self,active,designTabSelected;this._forceLoad=forceLoad;self=this;active=this.canvasTabs.getActive();(forceLoad||active===0)&&(designTabSelected=application.getComponent("ProductTabs").getActive(),presets.is3DPreviewEnabled===!0?self.product.productDesignService.loadPreviewImage(designTabSelected,self,self.update3DPreviewPostback):(self.showPreviewLoadImage(),self.product.productDesignService.loadPreviewImage(designTabSelected,self,self.updatePreviewPostback)))},Preview.prototype.getPreviewPath=function(){return presets.productDesign.loadProductDesignUrl+this.getImageQueryString()},Preview.prototype.getImageQueryString=function(){var field=this.product.fieldsService.getCurrent(),optionValues=this.productOptions.getAffectedOptionsAsString(),currentFieldIndex=this.product.productDesignService.getCurrentEditableFieldId();return presets.isBulkFabric&&(optionValues=this.productOptions.getOptionsAsString()),"?productId="+presets.productId+"&productName="+presets.productName+"&pvers="+preset
18s.pvers+"&systemName="+presets.systemName+"¤tFieldIndex="+currentFieldIndex+"&listOfOptionValues="+optionValues+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&viewName=&designName="+presets.designName+"&previewSize="+presets.productDesign.PreviewSize+"&version="+field.editablefield.version},Preview.prototype.update3DPreviewPostback=function(){var currentFieldIndex=this.product.productDesignService.getCurrentEditableFieldId();this._forceLoad&&application.triggerApplicationEvent("/product/canvasTabs/select/0/true");$(".js-fieldCanvasImage").hide();$("#fieldCanvasImage"+currentFieldIndex).show()},Preview.prototype.updatePreviewPostback=function(){var self=this,path=self.getPreviewPath(),$previewImage,currentFieldIndex;$("#tab-canvas .preview").empty();application.triggerApplicationEvent("/product/edit/showpreviewloader/updateimage");$("button.update-pending").remove();$previewImage=$("<img/>");$previewImage.load(function(){if(self._$preview.children().remove(),application.triggerApplicationEvent("/product/edit/hidepreviewloader/imageloaded"),application.triggerApplicationEvent("/product/preview/toggleaddbutton"),self._$preview.prepend($previewImage),application.triggerApplicationEvent("/product/edit/previewImageLoaded"),application.triggerApplicationEvent("/preview/canvasTabs/togglecopyside"),!self.designInterfaceIntroLoded&&self.product.previewRestriction.ShowDesignInterfaceTour()){var designInterfaceGuide=new IntroHandler;designInterfaceGuide.DisplayTour("designinterface","designinterfacetour");self.designInterfaceIntroLoded=!0}});currentFieldIndex=this.product.productDesignService.getCurrentEditableFieldId();application.triggerApplicationEvent("/product/edit/previewImageRequest/"+currentFieldIndex);$previewImage.attr("src",path);this._forceLoad&&application.triggerApplicationEvent("/product/canvasTabs/select/0/true")},Preview.prototype.toggleAddImageButton=function(){let showAddbtn=!0;const field=this.product.fieldsService.getCurrent();if(typeof field!="undefined"&&field.editablefield){let hideButton=field.deny.indexOf("text")>=0||field.deny.indexOf("image")>=0,designobjects=field.editablefield.designobjects.filter(design=>!design.predefined);showAddbtn=designobjects.length>0||field.editablefield.backgroundColour!==null||field.locked||hideButton?!1:!0}($(".canvasprogress").is(":visible")||$(".previewloading").is(":visible"))&&(showAddbtn=!1);showAddbtn?$(".js-addimage-overlay").show():$(".js-addimage-overlay").hide()},Preview.prototype.showPreviewLoadImage=function(){(this._$preview.empty(),presets.is3DPreviewEnabled)||application.triggerApplicationEvent("/product/edit/showpreviewloader/previewloaded")},Preview.prototype.updatePending=function(){if(!this._$tabPreview.find("button.update-pending").length){var pos=$.extend({width:this._$tabPreview.outerWidth(),height:this._$tabPreview.outerHeight()},this._$tabPreview.position()),$btnUpdatePending=application.getFromTemplate($("#update-preview-content"),{templateData:{}});$btnUpdatePending.css("top",pos.top);$btnUpdatePending.css("left",pos.left);$btnUpdatePending.css("width",pos.width);$btnUpdatePending.css("height",pos.height);$btnUpdatePending.on("mousedown",function(e){e.stopPropagation();application.triggerApplicationEvent("/preview/update/pending/clicked")}).appendTo(this._$tabPreview)}},Preview.prototype.CopyDesignCompleted=function(){if(this.product.fieldsService.getIsDesignCoping()){let total=this.product.fieldsService.getTotal();total>0&&(total=total-1,this.product.fieldsService.setTotal(total),total==0&&(this.product.fieldsService.setIsDesignCoping(!1),application.triggerApplicationEvent("/product/carousel/select/Field/true/0"),application.triggerApplicationEvent("/product/productTabs/ProductQuickView"),$(".canvasprogress").css("display","none")))}},Preview.prototype.ClearDesignCompleted=function(){this.product.fieldsService.getIsDesignClearing()&&(this.product.fieldsService.setIsDesignClearing(!1),$(".canvasprogress").css("display","none"))},Preview.prototype.renderOptionsInModal=function(){const productOptions=application.getComponent("ProductOptions");
18if(!productOptions){console.error("ProductOptions not available");return}const options=productOptions.getOptionOptionValuesArray();if(!options||options.length===0){$("#selectedOptionsContainer").html(`<p>${presets.DownloadMaskNoOptionText}</p>`);return}let html=`<div class="download-options">`;options.forEach(opt=>{html+=` 19 <div class="option-row"> 20 <span class="option-label">${opt.optionName}:</span> 21 <span class="option-value">${opt.optionValue}</span> 22 </div> 23 `});html+=`</div>`;$("#selectedOptionsContainer").html(html)},Preview.prototype.downloadTemplates=function(){var product,productOptions,fields,optionsForMask,optionoptionvalues,filteredFields,request;console.log("----Download triggered from modal----");const $downloadBtn=$(".js-download-template-btn");if($downloadBtn.prop("disabled",!0),product=application.getModel("Product"),console.log("Product model:",product),productOptions=application.getComponent("ProductOptions",[]),console.log("Product options:",productOptions),fields=product.productDesign&&product.productDesign.fields,!fields||!fields.length)return console.error("Fields not available:",fields),$downloadBtn.prop("disabled",!1),[];console.log("Product fields:",fields);optionsForMask=productOptions.getOptionsAsString();optionoptionvalues=productOptions?productOptions.getOptionOptionValuesArray():[];console.log("Total fields:",fields.length);filteredFields=[];fields.forEach(function(field,index){if(field.uiHidden||field.locked){console.log("Skipping field:",field.name);return}var editable=field.editablefield||{};filteredFields.push({fieldIndex:index,editablefieldVersion:editable.version||"0",currentOrientation:editable.currentOrientation||"null",width:field.printw||0,height:field.printh||0,dpi:field.printq||product.productDesign&&product.productDesign.printq||200,fieldName:field.name||""})});console.log("---- DONE ----");request={maskUrl:presets.productDesign.MaskUrl||"",productId:presets.productId,productName:presets.productName||"",productFullName:presets.productFullName||"",systemName:presets.systemName||"",listOfOptionValues:optionsForMask,pvers:presets.pvers,tid:presets.tid,fields:filteredFields,optionoptionvalues:optionoptionvalues,designGuideUrl:presets.productDesign.designGuideUrl||"",registerCustomerId:presets.Customer.RegisterCustomerId||0,siteName:presets.SiteName||""};pushDownloadTemplateGATag("download_click");this.submitDownloadForm(request)},Preview.prototype.submitDownloadForm=function(request){const $downloadBtn=$(".js-download-template-btn");var token=$('input[name="__RequestVerificationToken"]').val();fetch(presets.DownloadMaskUrl,{method:"POST",headers:{"Content-Type":"application/json",__RequestVerificationToken:token},body:JSON.stringify(request)}).then(function(res){var disposition,fileName,utf8Match,normalMatch;return(console.log("Status:",res.status),console.log("StatusText:",res.statusText),!res.ok)?res.text().then(function(errorText){console.error("Server Error:",errorText);throw new Error(`Download failed: ${res.status}`);}):(disposition=res.headers.get("Content-Disposition"),fileName="output.zip",disposition&&(utf8Match=disposition.match(/filename\*=UTF-8''([^;]+)/i),utf8Match?fileName=decodeURIComponent(utf8Match[1]):(normalMatch=disposition.match(/filename="?([^"]+)"?/i),normalMatch&&(fileName=normalMatch[1]))),$(".downloadtemplate-modal-loader").hide(),res.blob().then(function(blob){return{blob:blob,fileName:fileName}}))}).then(function(result){var blob=result.blob,fileName=result.fileName,url=window.URL.createObjectURL(blob),a=document.createElement("a");a.href=url;a.download=fileName;document.body.appendChild(a);a.click();a.remove();window.URL.revokeObjectURL(url);this.closeDownloadMaskModal();$downloadBtn.prop("disabled",!1)}.bind(this)).catch(function(err){console.error(err);$downloadBtn.prop("disabled",!1)})},Preview.prototype.closeDownloadMaskModal=function(){const $downloadMask=$("#md-downloadMask");$downloadMask.hide();$downloadMask.removeClass("child-model");const hasOtherOpenModal=$(".modal-generic:visible").not("#md-downloadMask").length>0;hasOtherOpenModal||$("#studio-modal").css("display","none");$(document).off("keyup.downloadMaskEsc");$(document).off("keyup").on("keyup",function(evt){if(evt.keyCode==27){var $visibleModals=$(".modal-generic:visible");$visibleModals.length>0&&$visibleModals.last().closeModal()}})},new Preview}(jQuery),"Preview");application.addController(function($,application){function FinalPreviewCarou
23selController(){this.route("/finalpreview/selectField/:index",this.previewSelectedFiled);this.route("/finalpreview/displayErrorSummary",this.displayErrorSummary);this.route("/finalpreview/displaySelectedError/:index",this.displaySelectedError);this.route("/finalpreview/displaySelectedError3D/:scrollTo/:index",this.displaySelectedError3D);this.route("/finalpreview/displaySelectedError3DItem/:index",this.displaySelectedError3DItem)}return FinalPreviewCarouselController.prototype=new application.Controller,FinalPreviewCarouselController.prototype.init=function(){this.FinalPreviewCarousel=application.getComponent("FinalPreviewCarousel")},FinalPreviewCarouselController.prototype.previewSelectedFiled=function(event){var fieldIndex=event.parameters.index;this.FinalPreviewCarousel.previewSelectedFiled(fieldIndex)},FinalPreviewCarouselController.prototype.displayErrorSummary=function(){this.FinalPreviewCarousel.displayErrorSummary()},FinalPreviewCarouselController.prototype.displaySelectedError=function(event){var fieldIndex=event.parameters.index;this.FinalPreviewCarousel.displaySelectedError(fieldIndex)},FinalPreviewCarouselController.prototype.displaySelectedError3D=function(event){var fieldIndex=event.parameters.index,scrollTo=event.parameters.scrollTo==="true";this.FinalPreviewCarousel.displaySelectedError3D(fieldIndex,scrollTo)},FinalPreviewCarouselController.prototype.displaySelectedError3DItem=function(event){var fieldIndex=event.parameters.index;this.FinalPreviewCarousel.displaySelectedError3DItem(fieldIndex)},new FinalPreviewCarouselController}(jQuery,window.application));application.addComponent(function($){function FinalPreviewCarousel(){this.carryOnlooping=null;this.$fields=null;this.warnings=null;this.product=null;this.productOptions=null;this.isIE6=!1;this.isIE8OrLess=!1;this.qualityService=null;this.validationService=null;this.finalPreview=null;this.productCart=null}function getErrorContentbyClass(errorClass){let content="";if(errorClass!=null&&errorClass!=undefined)switch(errorClass){case"warningLQ":case"warningMin":case"warningWS":case"warningTCE":case"warningID":case"warningAR":case"warningICE":content=presets.qualityChecks.filter(x=>x.cssclass==errorClass)[0].finalPrevText}return content}function getAvailableTabs(self){let fieldsLength=self.product.fieldsService.getAll().length;const allFieldTabs=presets.product3DConfigurationModel.ProductFeilds.map((pf,index)=>index).filter(n=>n!=-1);return Array.from(allFieldTabs)}function getTabWithErrors(availableTabs){var $errorlistfortab=[];return $.each(availableTabs,function(key,val){var $selectedTab=$("#previewButton .tab-3d-button[tab-id="+(val+1)+"]");$selectedTab.find(".preview-button-error-"+(val+1)+" .haserror").length>0&&$errorlistfortab.push($selectedTab[0])}),$errorlistfortab}function expandCarouselFields(fieldIndex){var mirrorFieldIndex=self.product.fieldsService.getSourceMirrorField(fieldIndex),customCommands,srcField;let fields=self.product.fieldsService.getAll();for(i=0;i<fields.length;i++)customCommands=fields[i].customCommands,customCommands&&(srcField=self.product.fieldsService.getSourceMirrorField(i),mirrorFieldIndex==srcField&&(customCommands=customCommands.replace("mirrorOf-","xMirrorOf-"),customCommands=customCommands.replace("copyOf-","xCopyOf-"),fields[i].customCommands=customCommands));return application.triggerApplicationEvent("/product/edit/updatePreview/forceUpdate"),application.triggerApplicationEvent("/product/edit/productLoaded/"),presets.isMultiple3DObjectsEvaluated=!0,application.triggerApplicationEvent("/product/carousel/select/Field/false/"+self.product.fieldsService.getCurrentEditableFieldId()),application.triggerApplicationEvent("product/carousel/select/Field/false/"+fieldIndex),application.triggerApplicationEvent("/quality/display/field/all"),application.triggerApplicationEvent("/product3d/build/carousel"),application.triggerApplicationEvent("/product/selectField/"+fieldIndex+"/true"),!1}function GAWarning(self,source){let warnClass=self.qualityService.GetWarnClassByFields();for(var i=0;i<warnClass.length;i++)PushGAFaceliftWarning(warnClass[i],source)}function reloadImage(fieldIndex,newSource=""){var li=$("li#fp"+fieldIndex),img,leftImg,oldsrc,newsrc;li.length>0&&(li.addClass("finalPreviewloading"),img=li.find(".imgcontainer img"),leftImg=$("#md-finalPreview .preview-left"),leftImg.append("<div class='copy-progress-wrap'><div class='progress-box' id='progress'><p>
23"+presets.loadingLabel+"<\/p><div class='loader-line'><\/div><\/div><\/div>"),oldsrc=img.attr("src"),newsrc=newSource!=""?presets.productDesign.finalPreview+newSource:oldsrc,setTimeout(function(){img.attr("src",newsrc);leftImg.find(".preview-active__img img").attr("src",newsrc)},500),img.load(function(){li.removeClass("finalPreviewloading")}),leftImg.find(".preview-active__img img").load(function(){leftImg.find(".copy-progress-wrap .progress-box").remove()}))}function isFaceLift(){return GAVariantId=="1"}function getCookie(name){var dc=document.cookie,prefix=name+"=",begin=dc.indexOf("; "+prefix),end;if(begin==-1){if(begin=dc.indexOf(prefix),begin!=0)return null}else begin+=2,end=document.cookie.indexOf(";",begin),end==-1&&(end=dc.length);return decodeURI(dc.substring(begin+prefix.length,end))}return FinalPreviewCarousel.prototype.init=function(){var self=this,browserVersion=parseFloat($.browser.version.substr(0,3));this.isIE6=$.browser.msie!==null&&browserVersion<parseFloat("7.0");this.isIE8OrLess=$.browser.msie!==null&&browserVersion<parseFloat("9.0");this.product=application.getModel("Product");this.productOptions=application.getComponent("ProductOptions",[]);this.qualityService=application.getModel("QualityService");this.validationService=application.getModel("ValidationService");this.productCart=application.getComponent("ProductCart",[]);this.carryOnlooping=!0;self.registerEvents()},FinalPreviewCarousel.prototype.registerEvents=function(){var self=this;$("#btnFinalPreview").bind("click",function(){showTooltip();$.when(self.validationService.validate()).done(function(result){result&&self.productCart.isValidPrice&&($(".zoom-box").length>0&&$(".zoom-box").remove(),self.render())})})},FinalPreviewCarousel.prototype.InitFinalView=function(){var self=this;showTooltip();presets.is3DPreviewEnabled===!0?self.finalPreview=$("#md-final3DPreview").modal():(self.finalPreview=presets.is3DItemPreviewEnabled==!0?$("#md-final3DItemPreview").modal():$("#md-finalViews").modal(),self.finalPreview.find(".ok_btn_pop").click(function(){$("button[id='btnAddToCart']").click();self.closeModal()}));presets.createDesign?(self.finalPreview.find(".ok_btn_pop").hide(),self.finalPreview.find("#btnCreateDesign").show()):(self.finalPreview.find(".ok_btn_pop").show(),self.finalPreview.find("#btnCreateDesign").hide())},FinalPreviewCarousel.prototype.render=function(){var self,$btnProceedToCart;const previewQuantityInfoMessage=$("#previewQuantityInfoMessage"),$quantityInfoMessage=$("#quantityInfoMessage");$quantityInfoMessage.css("display")!=="none"&&($("#previewQuantityInfoMessage").html($("#quantityInfoMessage").html()),previewQuantityInfoMessage.css("display","flex"));console.log("FinalPreviewCarousel render");self=this;presets.is3DPreviewEnabled===!0?(self.finalPreview=$("#md-final3DPreview").modal(function(){$("#md-final3DPreview").find("#displayselectederror3D").remove();$("#md-final3DPreview").find("#finalpreviewsuccess").remove();application.triggerApplicationEvent("/product3d/close/preview/popup")}),application.triggerApplicationEvent("/product3d/set/preview/popup/window"),$btnProceedToCart=$("#btnProceedToCart")[0],$("#btnProceedToCartLoader").css("width",$btnProceedToCart.clientWidth),$("#btnProceedToCartLoader").css("height",$btnProceedToCart.clientHeight),$("#btnProceedToCartLoader").addClass("target-content--hide")):presets.is3DItemPreviewEnabled===!0?(self.finalPreview=$("#md-final3DItemPreview").modal(function(){application.triggerApplicationEvent("/productItem3d/close/preview/popup");application.triggerApplicationEvent("/product/carousel/resetData")}),$btnProceedToCart=$("#btnItemProceedToCart")[0],$("#btnItemProceedToCartLoader").css("width",$btnProceedToCart.clientWidth),$("#btnItemProceedToCartLoader").css("height",$btnProceedToCart.clientHeight),$("#btnItemProceedToCartLoader").addClass("target-content--hide")):self.finalPreview=$("#md-finalPreview").modal(function(){self.carryOnlooping=!1});$("#span-quantity").length>0&&$(".span-preview-quantity").text($("#span-quantity").text());presets.createDesign?(self.finalPreview.addClass("createDesign"),self.finalPreview.find("#btnCreateDesign").show(),self.finalPreview.find("#btnEnterContest").hide()):presets.createContestDesign?(self.finalPreview.find(".ok_btn_pop").hide(),self.finalPreview.find("#btnCreateDesign").hide(),self.finalPreview.find("#btnEnterContest").show()):(self.finalPreview.find(".ok_btn_pop").show(),presets.isAuthorizedCustomer&&!preset
23s.IsPackagingProduct?self.finalPreview.find("#btnCreateDesign").show():self.finalPreview.find("#btnCreateDesign").hide(),self.finalPreview.find("#btnEnterContest").hide());self.finalPreview.find(".ok_btn_pop").click(function(event){var $target=$(event.target),saveToStoreIdCookie,editDesignStoreId;$target.attr("disabled","disabled");saveToStoreIdCookie=getCookie("saveToStoreId");editDesignStoreId=getCookie("EditDesignStoreId");presets.is3DPreviewEnabled===!0?application.triggerApplicationEvent("/product3d/create/thumbnails/for/basket"):presets.is3DItemPreviewEnabled!==!0||saveToStoreIdCookie||editDesignStoreId?presets.is3DItemPreviewEnabled===!0&&(saveToStoreIdCookie||editDesignStoreId)?application.triggerApplicationEvent("/preview/canvasTabs/authorizedcustomer/savedesigntoaccount"):$("button[id='btnAddToCart']").click():application.triggerApplicationEvent("/productItem3d/create/thumbnails/for/basket");isFaceLift()?pushAdvanceStudioToGTM("Preview_Add to basket_"):pushCreationStudioToGTM("Preview and Buy: Proceed to Cart")});presets.is3DItemPreviewEnabled===!0?application.triggerApplicationEvent("/productItem3d/render/3d/contet"):presets.is3DPreviewEnabled===!1&&(isFaceLift()?self.setDefaultCarouselFacelift():self.setDefaultCarousel());presets.is3DPreviewEnabled===!0&&self.getErrorMsg3DImage()},FinalPreviewCarousel.prototype.getErrorMsg3DImage=function(){var self=this,fieldsIndices=[],fields=self.product.fieldsService.getAll(),imageIndexcounter=0,i;$.each(fields,function(index){fieldsIndices[imageIndexcounter]=index;imageIndexcounter++});i=0;for(let obj of fieldsIndices)application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/{0}".format(obj)),i==fieldsIndices.length-1&&setTimeout(function(){application.triggerApplicationEvent("/finalpreview/displayErrorSummary")},200),i++;self.setDefaultCarouselFor3D()},FinalPreviewCarousel.prototype.setDefaultCarousel=function(){var self=this,ul,imageIndexcounter,max;self.carryOnlooping=!0;this._$elleft=this.finalPreview.find(".modal-container .preview-wrapper .preview-left");this._$elleft.children().remove();this._$elleft.append("<div class='copy-progress-wrap'><div class='progress-box' id='progress'><p>"+presets.loadingLabel+"<\/p><div class='loader-line'><\/div><\/div><\/div>");this._$el=this.finalPreview.find(".modal-container .preview-wrapper .layer-list .layers");this._warninglistblock=this.finalPreview.find(".modal-container .preview-right .warning-listing--block");this._warninglistblock.find("#finalpreviewerrorsummary").remove();this._warninglistblock.find("#displayselectederror").remove();this._warninglistblock.find("#finalpreviewsuccess").remove();this._$el.children().remove();var fields=self.product.fieldsService.getAll(),images=[],zoomUrls=[],zoomUrlsLg=[],fieldsIndices=[],fieldsName=[];$("#finalPreview").remove();ul=$('<ul id="finalPreview" class="finalPrevie-block clearfix"><\/ul>');ul.appendTo(this._$el);imageIndexcounter=0;$.each(fields,function(index,field){if(field.invisibleOnFinalPreview!==!0){zoomUrls[imageIndexcounter]="/estore/preview/zoompreview"+self.getQuery(index);zoomUrlsLg[imageIndexcounter]="/estore/preview/ZoomPreviewLarge"+self.getQuery(index);images[imageIndexcounter]=presets.productDesign.finalPreview+self.getQuery(index);fieldsIndices[imageIndexcounter]=index;fieldsName[imageIndexcounter]=field.name;var data={index:imageIndexcounter,fieldIndex:index},li=application.getFromTemplate($("#template-finalpreviewitem"),{templateData:data});ul.append(li);li.on("click",()=>{application.triggerApplicationEvent("/finalpreview/selectField/"+index),application.triggerApplicationEvent("/finalpreview/displaySelectedError/"+index)});imageIndexcounter==0&&$(".layer-list .simplebar-content-wrapper").animate({scrollTop:$(".layer-list .simplebar-content-wrapper li:nth-child(1)").position().top},"slow");imageIndexcounter++}});max=images.length;max>0&&(self.$fields=self._$el,self.LoadImageSequentially(0,max,images,zoomUrls,zoomUrlsLg,fieldsIndices,fieldsName))},FinalPreviewCarousel.prototype.setDefaultCarouselFor3D=function(){var self=this,ul,imageIndexcounter,max;self.carryOnlooping=!0;self._fieldService=application.getModel("Product").fieldsService;this._$el=this.finalPreview.find("#preview3dContainer");var fields=self.product.fieldsService.getAll(),images=[],fieldsIndices=[];$("#finalPreview").remove();ul=$(`<ul id="finalPreview" class="finalPrevie-block clearfix"></ul>`);
23ul.appendTo(this._$el);imageIndexcounter=0;$.each(fields,function(index,field){images[imageIndexcounter]=presets.productDesign.finalPreview+self.getQuery(index);fieldsIndices[imageIndexcounter]=index;var data={index:imageIndexcounter,fieldIndex:index},li=application.getFromTemplate($("#template-finalpreviewitem3D"),{templateData:data});li.find(".editAnchorlink-3D").click(function(){self._fieldService.setCurrent(index);application.triggerApplicationEvent(`/product/carousel/select/Field/true/${index}/true`);self.finalPreview=$("#md-final3DPreview").modal();self.finalPreview.closeModal();application.triggerApplicationEvent("/product3d/close/preview/popup");_.contains(field.deny,"image")?application.triggerApplicationEvent("/product/edit/add/text"):application.triggerApplicationEvent("/product/edit/add/image")});li.hide();ul.append(li);imageIndexcounter++});ul.find(".js-close-modal").on("click",function(){self.carryOnlooping=!1});if(presets.isCopyDesignEnabled){ul.find(".finalpreview--showSides").on("click",function(){var container=$(this).siblings(".finalpreview--sides-container"),w,r,selectedDesign,sides;if(container.data("openState")==="open")container.hide(200).data("openState","close");else{var _max_sides_to_show=4,_show_more_button=!1,currentFieldId=$(this).data("fieldIndex"),copyables=self.product.fieldsService.getCopyable(currentFieldId);copyables.length>_max_sides_to_show?(_max_sides_to_show--,_show_more_button=!0):(w=100/_max_sides_to_show*copyables.length,r=(100-w)/2,container.css({width:w+"%",right:r+"%","min-width":"25%"}));ul.find(".finalpreview--sides-container").not(container).hide(200).data("openState","close");container.show(200).data("openState","open");application.triggerApplicationEvent("/product/selectField/"+currentFieldId+"/true");selectedDesign=application.getComponent("SelectExistingDesign");selectedDesign.init();sides=_.map(copyables.slice(0,_max_sides_to_show),function(field){return selectedDesign.renderSide(field).on("click",function(){container.hide(200);var data=$(this).data("view");self.product.fieldsService.copyDesignMaintainScaleForPattern(self.product.fieldsService.getCurrent(),data.templateData.fieldIndex,!1,!0);self.product.fieldsService.incrementCurrentFieldVersion();application.triggerApplicationEvent(`/product/carousel/select/Field/true/${currentFieldId}/true`);$("#finalPreview").hide();$(`#errorbox-3d-${currentFieldId}`).remove();setTimeout(()=>{application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/"+currentFieldId);$("#errorbox-3d").children().length==1&&($("#errorbox-3d").empty(),$("#errorbox-3d").removeClass("product3d-err"));let spans=$("#errorbox-3d").find("div").find("span:first");for(let index in spans)spans.get(index).innerHTML=+index+1+". "},2e3)}).find(".field-loader+img").load(function(){$(this).prev(".field-loader").remove()}).end()});container.children(".existingDesign").remove();container.find(".not-available").toggle(copyables.length===0);container.children(".copySide-cta").toggle(_show_more_button);container.prepend(sides)}return!1});ul.find(".js-showAllSides").on("click",function(){var uploadDialogue=application.getComponent("UploadDialogue");uploadDialogue.open(undefined,undefined,function(){application.triggerApplicationEvent("/gallery/show/copydesign");self.finalPreview.closeModal()})})}max=images.length;max>0&&(self.$fields=self._$el,self.LoadImageSequentially3D(0,max,images,fieldsIndices))},FinalPreviewCarousel.prototype.LoadImageSequentially3D=function(index,max,images,fieldsIndices){var self=this;if(presets.is3DPreviewEnabled!==!0&&index<max){var currentLi=$("#finalPreview li#fp"+fieldsIndices[index]),currAnchor=currentLi.find("a span.imgcontainer"),img=new Image;currentLi.append($(img).load(function(){if($(this).hide(),currAnchor.append(this),currentLi.removeClass("finalPreviewloading"),$(this).show(),self.carryOnlooping===!0)self.LoadImageSequentially3D(index+1,max,images,fieldsIndices);else return $("#finalPreview").remove(),self.carryOnlooping=!0,!1;application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/{0}".format(fieldsIndices[index]));$(img).off()}).error(function(){currentLi.remove();self.LoadImageSequentially3D(index+1,max,images,fieldsIndices)}).attr("src",images[index]))}}
23,FinalPreviewCarousel.prototype.LoadImageSequentially=function(index,max,images,zoomUrls,zoomUrlsLg,fieldsIndices,fieldsName){var self=this,currentLi,layerdetails,url,urlLg;if(presets.is3DPreviewEnabled!==!0&&index<max){currentLi=$("#finalPreview li#fp"+fieldsIndices[index]);layerdetails=currentLi.find(".layer-details");index===0&&max%2!=0&¤tLi.addClass("middle");url=zoomUrls[index];urlLg=zoomUrlsLg[index];currentLi.find(".zoom-trigger").on("click",function(){self.ShowZoomDialogue(url,urlLg);$(".zoom-box").css({"z-index":"9999999999"});isFaceLift()&&pushAdvanceStudioToGTM("Preview_Zoom_")});var currAnchor=currentLi.find("a span.imgcontainer"),currFiledName=currentLi.find("span.fName"),fieldImage=currAnchor.find(".field-image");fieldImage.attr("src",images[index]);currentLi.find("a").attr("style","display:none;");fieldImage.load(function(){if(currentLi.removeClass("finalPreviewloading"),index==0&&application.triggerApplicationEvent("/finalpreview/selectField/0"),self.carryOnlooping===!0)self.LoadImageSequentially(index+1,max,images,zoomUrls,zoomUrlsLg,fieldsIndices,fieldsName);else return $("#finalPreview").remove(),self.carryOnlooping=!0,!1;$(fieldImage).off();application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/{0}".format(fieldsIndices[index]));index==max-1&&application.triggerApplicationEvent("/finalpreview/displayErrorSummary")});layerdetails.prepend(currFiledName.html(fieldsName[index]))}},FinalPreviewCarousel.prototype.ShowZoomDialogue=function(url,urlLg){var zoomBox=application.getFromTemplate($("#template-zoom"),{templateData:{}}),img=zoomBox.find("img");zoomBox.on("mousedown",function(){$(this).hide().remove()});img.on("load",function(){zoomBox.find("span").hide();img.css({display:"inline"})});$("body").append(zoomBox);img.hide();img.attr("src",url);img.attr("data-magnify-src",urlLg);img.magnify({magnifiedWidth:2e3,magnifiedHeight:2e3});img.css({display:"inline"});$("body").on("keydown",function(evt){(evt.keyCode===27||evt.key==="Escape")&&$(zoomBox).hide().remove()})},FinalPreviewCarousel.prototype.Cancel=function(){var self=this;self.carryOnlooping=!1},FinalPreviewCarousel.prototype.setDefaultCarouselFacelift=function(){var self,fields,optionValues,ul,imageIndexcounter,max;$("body").addClass("no-scroll");pushAdvanceStudioToGTM("Preview_View_");self=this;self.carryOnlooping=!0;this._$faceliftpreviewel=this.finalPreview.find(".preview-canvas");this._$previewTitle=this.finalPreview.find(".preview-product-title");this._$faceliftpreviewel.children().remove();fields=self.product.fieldsService.getAll();const productCarousel=application.getComponent("ProductCarousel");var images=[],zoomUrls=[],zoomUrlsLg=[],fieldsIndices=[];let templateId="template-finalpreviewitem-facelift";this._$previewTitle.html(presets.productFullName);$("#finalPreview").remove();optionValues=self.productOptions.getAffectedOptionsAsString();ul=$('<ul id="finalPreview" class="finalPrevie-block clearfix"><\/ul>');ul.appendTo(this._$faceliftpreviewel);imageIndexcounter=0;let fiedsCount=fields.length;$.each(fields,function(index,field){var fieldOptions=optionValues,q,data,li;if(presets.isBulkFabric&&(fieldOptions=self.productOptions.getOptionsAsString()),q="?productId="+presets.productId+"&productName="+presets.productName+"&pvers="+preset
23s.pvers+"¤tFieldIndex="+index+"&listOfOptionValues="+fieldOptions+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&systemName="+presets.systemName+"&viewName=&designName="+presets.designName+"&rnd="+$.nextVersion()+"&isPreBasketItem="+/isPreBasketItem=true|EditBasketItem/i.test(window.location.href),field.invisibleOnFinalPreview===!1){if(zoomUrls[imageIndexcounter]="/estore/preview/zoompreview"+q,zoomUrlsLg[imageIndexcounter]="/estore/preview/ZoomPreviewLarge"+q,images[imageIndexcounter]=presets.productDesign.finalPreview+q,fieldsIndices[imageIndexcounter]=index,fieldsName[imageIndexcounter]=field.name,data={index:imageIndexcounter,fieldIndex:index},li=application.getFromTemplate($("#"+templateId),{templateData:data}),fiedsCount>1){let sizeLable=productCarousel.getFilesSizeLabel(index);li.find(".view-label").html(`${field.name} ${sizeLable}`)}ul.append(li);imageIndexcounter++}});ul.find(".js-close-modal").on("click",function(){self.carryOnlooping=!1;self.finalPreview.closeModal();GAWarning(self,"ClickImage")});$(".design-status-group").find(".js-close-modal").off();$(".design-status-group").find(".js-close-modal").on("click",function(){self.carryOnlooping=!1;self.finalPreview.closeModal();GAWarning(self,"ClickEdit")});if(presets.isCopyDesignEnabled){ul.find(".finalpreview--showSides").on("click",function(){var container,w,r,selectedDesign,sides;if(pushCreationStudioToGTM("Preview and Buy: Copy design"),container=$(this).siblings(".finalpreview--sides-container"),container.data("openState")==="open")container.hide(200).data("openState","close");else{var _max_sides_to_show=4,_show_more_button=!1,currentFieldId=$(this).data("fieldIndex"),copyables=self.product.fieldsService.getCopyable(currentFieldId);copyables.length>_max_sides_to_show?(_max_sides_to_show--,_show_more_button=!0):(w=100/_max_sides_to_show*copyables.length,r=(100-w)/2,container.css({width:w+"%",right:r+"%","min-width":"25%"}));ul.find(".finalpreview--sides-container").not(container).hide(200).data("openState","close");container.show(200).data("openState","open");application.triggerApplicationEvent("/product/selectField/"+currentFieldId+"/true");selectedDesign=application.getComponent("SelectExistingDesign");selectedDesign.init();sides=_.map(copyables.slice(0,_max_sides_to_show),function(field){return selectedDesign.renderSide(field).attr("style","width: "+(copyables.length<_max_sides_to_show?"100% !important":"")).on("click",function(){var data,dirtyFields,i,messageHtml;for(container.hide(200),data=$(this).data("view"),reloadImage(currentFieldId),self.product.fieldsService.copyDesignMaintainScaleForPattern(self.product.fieldsService.getCurrent(),data.templateData.fieldIndex,!1,!0),self.product.fieldsService.incrementCurrentFieldVersion(),application.triggerApplicationEvent("/product/selectField/"+currentFieldId+"/false"),application.triggerApplicationEvent("/quality/check/fieldbyindex/"+currentFieldId),application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/"+currentFieldId),dirtyFields=self.product.fieldsService.applyCustomCommands(),i=0;i<dirtyFields.length;i++)reloadImage(dirtyFields[i]);self.qualityService.HasWarning()||(messageHtml=application.getFromTemplate($("#template-finalpreview-qualitymessage"),{templateData:{}}),$(messageHtml).insertBefore(ul),self.finalPreview.removeClass("hasWarning"))}).find(".field-loader+img").load(function(){$(this).prev(".field-loader").remove()}).end()});container.children(".existingDesign").remove();container.find(".not-available").toggle(copyables.length===0);container.children(".copySide-cta").toggle(_show_more_button);container.prepend(sides)}return!1});ul.find(".js-showAllSides").on("click",function(){var uploadDialogue=application.getComponent("UploadDialogue");uploadDialogue.open(undefined,undefined,function(){application.triggerApplicationEvent("/gallery/show/copydesign");self.finalPreview.closeModal()})})}if(this._$designStatusPassed=this.finalPreview.find(".design-status-passed"),self.qualityService.HasWarning())this._$designStatusPassed.hide(),this.finalPreview.find("#designerrorcount").html("1");else{let prevfaceliftmsgHtml=application.getFromTemplate($("#template-finalpreview-qualitymessage-previewfacelift"),{templateData:{}});this._$designStatusPassed.show().children().remove();$(prevfaceliftmsgHtml).appendTo(this._$designStatusPassed);this.finalPreview.find("#designerrorcount").html("0")}max=images.length;max>0&&(self.$fields=self._$el,self.LoadImageSequentially(0,max,images,zoomUrls,zoomUrlsLg,fieldsIndices,fieldsName))}
23,FinalPreviewCarousel.prototype.previewSelectedFiled=function(fieldIndex){var self=this,zoomUrls,zoomUrlsLg,selectedField,url,urlLg,previewfaceliftmessageHtml;if($("ul#finalPreview").find(".selected-thumb").attr("rel")!=fieldIndex){$("ul#finalPreview li").removeClass("selected-thumb");$("ul#finalPreview li[rel="+fieldIndex+"]").addClass("selected-thumb");zoomUrls="";zoomUrlsLg="";this._$el=this.finalPreview.find(".modal-container .preview-wrapper .preview-left");this._$el.children().remove();this._$el.append("<div class='copy-progress-wrap'><div class='progress-box' id='progress'><p>"+presets.loadingLabel+"<\/p><div class='loader-line'><\/div><\/div><\/div>");selectedField=self.product.fieldsService.getAll()[fieldIndex];selectedField.invisibleOnFinalPreview===!0||(zoomUrls="/estore/preview/zoompreview"+self.getQuery(fieldIndex),zoomUrlsLg="/estore/preview/ZoomPreviewLarge"+self.getQuery(fieldIndex));var previewImg=$("ul#finalPreview li[rel="+fieldIndex+"]").find(".imgcontainer img").attr("src"),data={fName:selectedField.name,fieldIndex:fieldIndex,previewImg:previewImg},image=application.getFromTemplate($("#template-finalpreviewitemimage"),{templateData:data});this._$el.append(image);this._$el.find(".preview-active__img img").load(function(){self._$el.find(".copy-progress-wrap .progress-box").remove()});url=zoomUrls;urlLg=zoomUrlsLg;this._$el.find(".zoom-trigger").on("click",function(){self.ShowZoomDialogue(url,urlLg);$(".zoom-box").css({"z-index":"9999999999"})});this._$el.find(".js-close-modal").on("click",function(){self.carryOnlooping=!1;self.finalPreview.closeModal()});$(".design-status-group").find(".js-close-modal").on("click",function(){self.carryOnlooping=!1;self.finalPreview.closeModal()});if(presets.isCopyDesignEnabled){this._$el.find(".finalpreview--showSides").on("click",function(){var container,w,r,selectedDesign,sides;if(pushCreationStudioToGTM("Preview and Buy: Copy design"),container=$(this).siblings(".finalpreview--sides-container"),container.data("openState")==="open")container.hide(200).data("openState","close");else{var _max_sides_to_show=4,_show_more_button=!1,currentFieldId=$(this).data("fieldIndex"),copyables=self.product.fieldsService.getCopyable(currentFieldId);copyables.length>_max_sides_to_show?(_max_sides_to_show--,_show_more_button=!0):(w=100/_max_sides_to_show*copyables.length,r=(100-w)/2,container.css({width:w+"%",right:r+"%","min-width":"25%"}));self._$el.find(".finalpreview--sides-container").not(container).hide(200).data("openState","close");container.show(200).data("openState","open");application.triggerApplicationEvent("/product/selectField/"+currentFieldId+"/true");selectedDesign=application.getComponent("SelectExistingDesign");selectedDesign.init();sides=_.map(copyables.slice(0,_max_sides_to_show),function(field){return selectedDesign.renderSide(field).attr("style","width: "+(copyables.length<_max_sides_to_show?"100% !important":"")).on("click",function(){var data,$errorlist,dirtyFields,i,messageHtml;for(container.hide(200),data=$(this).data("view"),reloadImage(currentFieldId,self.getQuery(currentFieldId)),self.product.fieldsService.copyDesignMaintainScaleForPattern(self.product.fieldsService.getCurrent(),data.templateData.fieldIndex,!1,!0),self.product.fieldsService.incrementCurrentFieldVersion(),application.triggerApplicationEvent("/product/selectField/"+currentFieldId+"/false"),application.triggerApplicationEvent("/quality/check/fieldbyindex/"+currentFieldId),application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/"+currentFieldId),application.triggerApplicationEvent("/finalpreview/selectField/"+currentFieldId),application.triggerApplicationEvent("/finalpreview/displaySelectedError/"+currentFieldId),$errorlist=$("ul#finalPreview .li-warningID, .li-warningWS, .li-warningLQ, .li-warningMin, .li-warningAR, .li-warningTCE"),$errorlist.length==0&&application.triggerApplicationEvent("/finalpreview/displayErrorSummary"),dirtyFields=self.product.fieldsService.applyCustomCommands(),i=0;i<dirtyFields.length;i++)reloadImage(dirtyFields[i],self.getQuery(dirtyFields[i]));self.qualityService.HasWarning()||(messageHtml=application.getFromTemplate($("#template-finalpreview-qualitymessage"),{templateData:{}}),$(messageHtml).insertBefore(ul),self.finalPreview.removeClass("hasWarning"))}).find(".field-loader+img").load(function(){$(this).prev(".field-loader").remove()}).end()});container.children(".existingDesign").remove();container.find(".not-available").toggle(copyables.length===0);container.children(".copySide-cta").toggle(_show_more_button);container.prepend(sides)}return!1});this._$el.find(".js-showAllSides").on("click",function(){var uploadDialogue=application.getComponent("UploadDialogue");
23uploadDialogue.open(undefined,undefined,function(){application.triggerApplicationEvent("/gallery/show/copydesign");self.finalPreview.closeModal()})})}self.qualityService.HasWarning()||(this._$designStatusPassed=this.finalPreview.find(".design-status-passed"),previewfaceliftmessageHtml=application.getFromTemplate($("#template-finalpreview-qualitymessage-previewfacelift"),{templateData:{}}),this._$designStatusPassed.children().remove(),$(previewfaceliftmessageHtml).appendTo(this._$designStatusPassed));application.triggerApplicationEvent("/quality/display/finalpreviewbyindex/{0}".format(fieldIndex))}},FinalPreviewCarousel.prototype.displayErrorSummary=function(){var $firstError,availableTabs,$errorlist,fieldIndex,finalpreviewsuccess;if(self=this,$errorlist=null,$firstError=null,presets.is3DPreviewEnabled===!0?(this._warninglistblock=this.finalPreview.find(".modal-container .md3D-sidebar .warning-listing--block"),availableTabs=getAvailableTabs(self),$errorlist=getTabWithErrors(availableTabs)):presets.is3DItemPreviewEnabled==!0?(this._warninglistblock=this.finalPreview.find(".modal-container .md3D-sidebar .warning-listing--block"),$errorlist=$("#previewItemButton .preview-button-error-icon.warningID, #previewItemButton .preview-button-error-icon.warningWS, #previewItemButton .preview-button-error-icon.warningLQ, #previewItemButton .preview-button-error-icon.warningMin, #previewItemButton .preview-button-error-icon.warningAR, #previewItemButton .preview-button-error-icon.warningTCE, #previewItemButton .preview-button-error-icon.warningICE")):(this._warninglistblock=this.finalPreview.find(".modal-container .preview-right .warning-listing--block"),$errorlist=$("ul#finalPreview .li-warningID, .li-warningWS, .li-warningLQ, .li-warningMin, .li-warningAR, .li-warningTCE, .li-warningICE")),this._warninglistblock.find("#finalpreviewerrorsummary").remove(),this._warninglistblock.find("#displayselectederror").remove(),this._warninglistblock.find("#displayselectederror3D").remove(),this._warninglistblock.find("#finalpreviewsuccess").remove(),$errorlist.length>0){if(fieldIndex="",presets.is3DPreviewEnabled===!0){$firstError=$errorlist[0];let tabId=$firstError.attributes["tab-id"].value;fieldIndex=presets.product3DConfigurationModel.ProductFeilds.findIndex((f,i)=>i==tabId)}else $firstError=$errorlist.first(),fieldIndex=$firstError.attr("rel");self.displaySelectedError(fieldIndex)}else presets.is3DPreviewEnabled===!0&&$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child(1)").position().top},"slow"),finalpreviewsuccess=application.getFromTemplate($("#template-finalpreviewsuccess"),{templateData:{}}),this._warninglistblock.prepend(finalpreviewsuccess)},FinalPreviewCarousel.prototype.displaySelectedError=function(fieldIndex){var tabId,$errorlist,$selectedError,content,Errorclass,Errorclasses,data,displayselectederror;if(fieldIndex!=-1){if(presets.is3DPreviewEnabled===!0){tabId=presets.product3DConfigurationModel.ProductFeilds[fieldIndex].TabId;application.triggerApplicationEvent("/product3d/preview/object/"+fieldIndex);return}if(presets.is3DItemPreviewEnabled==!0){application.triggerApplicationEvent("/productItem3d/preview/object/"+fieldIndex);return}if(this._warninglistblock=this.finalPreview.find(".modal-container .preview-right .warning-listing--block"),$errorlist=$("ul#finalPreview .li-warningID, .li-warningWS, .li-warningLQ, .li-warningMin, .li-warningAR, .li-warningTCE, .li-warningICE"),$selectedError=$("ul#finalPreview li[rel="+fieldIndex+"]:not(.li-qualityPassed)"),$selectedError.length>0&&$selectedError.is(".li-warningID, .li-warningWS, .li-warningLQ, .li-warningMin, .li-warningAR, .li-warningTCE, .li-warningICE")){this._warninglistblock.find("#displayselectederror").remove();fieldIndex==0?$(".layer-list .simplebar-content-wrapper").animate({scrollTop:$(".layer-list .simplebar-content-wrapper li:nth-child(1)").position().top},"slow"):fieldIndex<=$("#md-finalPreview .preview-right .layer-list .simplebar-content-wrapper li").length?$(".layer-list .simplebar-content-wrapper").animate({scrollTop:$(".layer-list .simplebar-content-wrapper li:nth-child("+fieldIndex+")").position().top-$(".layer-list .simplebar-content-wrapper li:first").position().top},"slow"):$(".layer-list .simplebar-content-wrapper").animate({scrollTop:$(".layer-list .simplebar-content-wrapper li:last").position().top-$(".layer-list .simplebar-content-wrapper li:first").position().top},"slow");var fName=$selectedError.find(".fName").html(),$nextError=$errorlist[($.inArray($selectedError[0],$errorlist)+1)%$errorlist.length],$prevError=null;$prevError=$.inArray($selectedError[0],$errorlist)-1<0?$errorlist[$errorlist.length-1]:$errorlist[($.inArray($selectedError[0],$errorlist)-1)%$errorlist.length];content="";Errorclass="";let div=$('<div id="errorcontent">'),divfielderror=$('<div class="fielderror">'),anchorLink=$('<a href="javascript:void(0);" class="error-link" field-index="'+fieldIndex+'">');anchorLink.html(fName);content=anchorLink.html();Errorclasses=$selectedError[0].attributes.class.value.split(" ");$.each(Errorclasses,function(key,val){Errorclass=val.split("-")[1];content=getErrorContentbyClass(Errorclass)});$("ul#finalPreview li .errorcontent").html("");$selectedError.find(".errorcontent").append(content);const span2=$("<span>");span2.html(content);divfielderror.append(span2);div.append(divfielderror);data={prevfieldIndex:$prevError.attributes.rel.value,nextfieldIndex:$nextError.attributes.rel.value};displayselectederror=application.getFromTemplate($("#template-displayselectederror"),{templateData:data});this._warninglistblock.append(displayselectederror);$("#displayselectederror").find(".totalissues").html($errorlist.length);displayselectederror.find(".error-link").on("click",function(){self.finalPreview=$("#md-finalViews").modal();self.finalPreview.closeModal();self.carryOnlooping=!1;application.triggerApplicationEvent("product/carousel/select/Field/false/"+fieldIndex);application.triggerApplicationEvent("/product/selectField/"+fieldIndex+"/true")});$errorlist.length==1&&displayselectederror.find(".layer-control").remove();application.triggerApplicationEvent("/finalpreview/selectField/"+fieldIndex)}else application.triggerApplicationEvent("/finalpreview/selectField/"+fieldIndex)}}
23,FinalPreviewCarousel.prototype.displaySelectedError3D=function(tabId,scrollTo){var selectedErrorIndexByTab,$nextError,$prevError,data,displayselectederror;self=this;this.finalPreview.find("#finalPreview").hide();this._warninglistblock=this.finalPreview.find(".modal-container .md3D-sidebar .warning-listing--block");var availableTabs=getAvailableTabs(self),$errorlist=getTabWithErrors(availableTabs),$selectedErrorTab=$("#previewButton .tab-3d-button[tab-id="+tabId+"]");if($selectedErrorTab.find(".preview-button-error-"+tabId).children().length>0)if(selectedErrorIndexByTab=[],$.each($selectedErrorTab.find(".preview-button-error-"+tabId).children(),function(key,val){$(val).attr("field-index")!=undefined&&selectedErrorIndexByTab.push({"field-index":$(val).attr("field-index"),"error-class":$(val).attr("error-class")})}),selectedErrorIndexByTab.length>0){this._warninglistblock.find("#displayselectederror3D").remove();scrollTo&&(tabId==1?$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child(1)").position().top},"slow"):$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child("+parseInt(tabId)+")").position().top-$("#md-final3DPreview .simplebar-content-wrapper button:first").position().top},"slow"));this._warninglistblock.find("#finalpreviewerrorsummary").remove();$nextError=$errorlist[($.inArray($selectedErrorTab[0],$errorlist)+1)%$errorlist.length];$prevError=null;$prevError=$.inArray($selectedErrorTab[0],$errorlist)-1<0?$errorlist[$errorlist.length-1]:$errorlist[($.inArray($selectedErrorTab[0],$errorlist)-1)%$errorlist.length];var totalErrorsForAllTab=$("#previewButton [class^='preview-button-error'] .haserror").length,content="",Errorclass="",fName="";let div=$('<div id="errorcontent">');$.each(selectedErrorIndexByTab,function(key,val){var selectedField=self.product.fieldsService.getAll()[val["field-index"]];fName=selectedField.name;Errorclass=val["error-class"];content=getErrorContentbyClass(Errorclass);let divfielderror=$('<div class="fielderror">'),anchorLink=$('<a href="javascript:void(0);" class="error-link" field-index="'+parseInt(val["field-index"])+1+'">');anchorLink.html(fName);const span2=$("<span>");span2.html(content);divfielderror.append(span2);div.append(divfielderror)});$("#previewButton").find("#errorcontent").remove();$("#preview-button-error-"+tabId).append(div);data={prevtabIndex:$prevError.attributes["tab-id"].value,nexttabIndex:$nextError.attributes["tab-id"].value};displayselectederror=application.getFromTemplate($("#template-displayselectederror3D"),{templateData:data});this._warninglistblock.append(displayselectederror);$("#displayselectederror3D").find(".totalissues").html(totalErrorsForAllTab);$("#preview-button-error-"+tabId).find(".error-link").on("mousedown",function(){let fieldIndex=this.attributes["field-index"].value;self.finalPreview=$("#md-final3DPreview").modal();self.finalPreview.closeModal();$("#md-final3DPreview").find("#displayselectederror3D").remove();$("#md-final3DPreview").find("#finalpreviewsuccess").remove();application.triggerApplicationEvent("/product3d/close/preview/popup");var selectedField=self.product.fieldsService.getAll()[fieldIndex];selectedField.customCommands&&selectedField.customCommands.indexOf("copyOf-")>=0?expandCarouselFields(fieldIndex):(application.triggerApplicationEvent("product/carousel/select/Field/false/"+fieldIndex),application.triggerApplicationEvent("/product/selectField/"+fieldIndex+"/true"))});$errorlist.length==1&&displayselectederror.find(".layer-control").remove()}else scrollTo&&(tabId==1?$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child(1)").position().top},"slow"):$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child("+parseInt(tabId)+")").position().top-$("#md-final3DPreview .simplebar-content-wrapper button:first").position().top},"slow"));else scrollTo&&(tabId==1?$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child(1)").position().top},"slow"):$("#md-final3DPreview .simplebar-content-wrapper").animate({scrollTop:$("#md-final3DPreview .simplebar-content-wrapper button:nth-child("+parseInt(tabId)+")").position().top-$("#md-final3DPreview .simplebar-content-wrapper button:first").position().top},"slow"))}
23,FinalPreviewCarousel.prototype.displaySelectedError3DItem=function(fieldIndex){var $errorlist,$selectedError,data,displayselectederror;if(this._warninglistblock=this.finalPreview.find(".modal-container .md3D-sidebar .warning-listing--block"),$errorlist=$("#previewItemButton .preview-button-error-icon.warningID, #previewItemButton .preview-button-error-icon.warningWS, #previewItemButton .preview-button-error-icon.warningLQ, #previewItemButton .preview-button-error-icon.warningMin, #previewItemButton .preview-button-error-icon.warningAR, #previewItemButton .preview-button-error-icon.warningTCE, #previewItemButton .preview-button-error-icon.warningICE"),$selectedError=$("#previewItemButton a span.preview-button-error-icon[rel="+fieldIndex+"]:not(.qualityPassed)"),$selectedError.length>0&&$selectedError.is(".warningID, .warningWS, .warningLQ, .warningMin, .warningAR, .warningTCE, .warningICE")){this._warninglistblock.find("#displayselectederror").remove();var fName=$selectedError.parents().find(".fName").html(),$nextError=$errorlist[($.inArray($selectedError[0],$errorlist)+1)%$errorlist.length],$prevError=null;$prevError=$.inArray($selectedError[0],$errorlist)-1<0?$errorlist[$errorlist.length-1]:$errorlist[($.inArray($selectedError[0],$errorlist)-1)%$errorlist.length];data={prevfieldIndex:$prevError.attributes.rel.value,nextfieldIndex:$nextError.attributes.rel.value};displayselectederror=application.getFromTemplate($("#template-displayselectederror"),{templateData:data});this._warninglistblock.append(displayselectederror);$("#displayselectederror").find(".totalissues").html($errorlist.length);$errorlist.length==1&&displayselectederror.find(".layer-control").remove()}},FinalPreviewCarousel.prototype.getQuery=function(fieldIndex){var self=this,optionValues=self.productOptions.getAffectedOptionsAsString(),fieldOptions=optionValues;return presets.isBulkFabric&&(fieldOptions=self.productOptions.getOptionsAsString()),"?productId="+presets.productId+"&productName="+presets.productName+"&pvers="+preset
23s.pvers+"¤tFieldIndex="+fieldIndex+"&listOfOptionValues="+fieldOptions+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&systemName="+presets.systemName+"&viewName=&designName="+presets.designName+"&rnd="+$.nextVersion()+"&isPreBasketItem="+/isPreBasketItem=true|EditBasketItem/i.test(window.location.href)},new FinalPreviewCarousel}(jQuery),"FinalPreviewCarousel");application.addComponent(function($){function DesignHistory(){this.$container=null;this.redoBtn=null;this.undoBtn=null}return DesignHistory.prototype.init=function(){var self=this;this.$container=$("#actionhistory");this.$container.html(application.getFromTemplate($("#template-designhistory"),{templateData:{}}));this.redoBtn=this.$container.find(".redo");this.updateRedo("disabled");this.undoBtn=this.$container.find(".undo");this.updateUndo("disabled");self.RegisterEvents()},DesignHistory.prototype.RegisterEvents=function(){var self=this;self.$container.find(".undo").hover(function(){$("span.undo_popup").show()},function(){$("span.undo_popup").hide()});self.$container.find(".redo").hover(function(){$("span.redo_popup").show()},function(){$("span.redo_popup").hide()})},DesignHistory.prototype.updateRedo=function(state){var self=this;self.ResetPopups();self.$container.find(".redo").attr({disabled:state=="enable"&&!presets.isReadOnly?!1:!0});self.$container.find(".redo").attr("data-disabledtitle",state=="enable"&&!presets.isReadOnly?"Enabled":"Disabled");self.$container.find(".redo_popup").html(state=="enable"&&!presets.isReadOnly?self.redoBtn.data("enabledtitle"):self.redoBtn.data("disabledtitle"))},DesignHistory.prototype.updateUndo=function(state){var self=this;self.ResetPopups();self.$container.find(".undo").attr({disabled:state=="enable"&&!presets.isReadOnly?!1:!0});self.$container.find(".undo").attr("data-disabledtitle",state=="enable"&&!presets.isReadOnly?"Enabled":"Disabled");self.$container.find(".undo_popup").html(state=="enable"&&!presets.isReadOnly?self.undoBtn.data("enabledtitle"):self.undoBtn.data("disabledtitle"))},DesignHistory.prototype.ResetPopups=function(){var self=this;$("span.undo_popup").hide();$("span.redo_popup").hide()},new DesignHistory}(jQuery),"DesignHistory");application.addController(function($,application){function ProductTabsController(){this.route("/product/productTabs/select/:ind",this.select);this.route("/product/productTabs/onlySelect/:ind",this.onlySelect);this.route("/product/edit/initField",this.load);this.route("/preview/update/pending/",this.updatePending);this.route("/product/edit/previewImageLoaded/",this.previewImageLoaded);this.route("/product/edit/cmsOrderEditLoad/",this.cmsOrderEditLoad);this.route("/product/productTabs/ProductQuickView",this.ProductQuickView);this.productTabs=null}return ProductTabsController.prototype=new application.Controller,ProductTabsController.prototype.init=function(){this.productTabs=application.getComponent("ProductTabs")},ProductTabsController.prototype.select=function(event){var ind=event.parameters.ind;this.productTabs.select(ind)},ProductTabsController.prototype.ProductQuickView=function(){this.productTabs.ProductQuickView()},ProductTabsController.prototype.onlySelect=function(event){var ind=event.parameters.ind;this.productTabs.select(ind,!0)},ProductTabsController.prototype.load=function(){this.productTabs.render()},ProductTabsController.prototype.updatePending=function(){this.productTabs.updatePending()},ProductTabsController.prototype.previewImageLoaded=function(){this.productTabs.previewImageLoaded()},ProductTabsController.prototype.cmsOrderEditLoad=function(){this.productTabs.designButtonClick()},new ProductTabsController}(jQuery,window.application));application.addComponent(function($){function ProductTabs(){this.accordion=null;this.addButtons=null;this.product=null;this.$designButton=null;this._el=null;this.container=null;this.controls=null;this.$bleed_info=null}return ProductTabs.prototype.init=function(){var self=this,$fabrizSizeOption,selectedSizeSystemName,$selectedSize;this.$el=$("#product-tabs").tabs();this.container=$("#product-tabs");this.$bleed_info=$("#info-area");this.$controls=$(".control-panel");this.$controlsmobile=$(".mobile-canvas-column-left");this.$previewDesignButton=$(".st-div");
23$fabrizSizeOption=this.$el.find("#optId-FabricSize");selectedSizeSystemName=this.$el.find("#optId-FabricPredefinedSizes select").find(":selected").data("systemname");selectedSizeSystemName!=="FabricCustomSize"&&selectedSizeSystemName!=undefined&&$fabrizSizeOption.hide();$selectedSize=this.$el.find("[data-systemname='ScarfOrWrapSize']").find("span.selected").attr("data-optvalue");presets.productId=="331"&&$selectedSize!=undefined&&$selectedSize!="1964"&&$("#optId-Add2PocketSquare")&&$("#optId-Add2PocketSquare").hide();this.$designButton=$("#tab-options .design");this.$templateButton=$("#tab-options .template-btn");this.product=application.getModel("Product");this.addButtons=application.getComponent("AddButtons");this.addButtons.init();this.addButtons.render();this.accordion=application.getComponent("Accordion").init();this.container.find("a[href='#tab-accordion']").bind("click",function(){self.designClick();pushCreationStudioToGTM("Click: Images & text tools")});this.container.find("a[href='#tab-options']").bind("click",function(){self.optionsClick();pushCreationStudioToGTM("Click: Product options")});this.$previewDesignButton.find("a[href='#tab-switch']").bind("click",function(){if($(this).attr("disabled")!=="disabled"){var activeTab=self.getActive();activeTab==1?(self.optionsClick(),self.select(0)):(self.designClick(),self.select(1),application.triggerApplicationEvent("/product/edit/updatePreview"))}});this.$designButton.on("click",function(){var isLocked=!1,isDependsOn=!1,cf=self.product.fieldsService.getCurrent(),fieldIndex=self.product.fieldsService.indexOf(cf),customCommands=cf.customCommands,i,currentcommad;if(customCommands!=null&&!(customCommands.length===0||!customCommands.trim())){for(customCommands=cf.customCommands.split(";"),i=0;i<customCommands.length;i++)currentcommad=customCommands[i].split("-"),currentcommad[0].toLowerCase()==="dependson"&&(isDependsOn=!0,fieldIndex=currentcommad[1]);cf.locked&&(isLocked=!0);isLocked&&isDependsOn&&application.triggerApplicationEvent("/product/selectField/{0}/false".format(fieldIndex))}application.triggerApplicationEvent("/track/event/Options/GoToDesign");self.designButtonClick()});return this.container.find("select.transform").change(function(){application.triggerApplicationEvent("/product/design/transform/rotate/false")}),this},ProductTabs.prototype.showColorPicker=function(){var self=this,cf=self.product.fieldsService.getCurrent(),selectedHex=cf.editablefield.backgroundColour||"ffffff",chooseButtonText=$(application.getFromTemplate($("#colorpicker-choosecolor"),{templateData:{}})),cancelButtonText=$(application.getFromTemplate($("#colorpicker-cancelcolorselection"),{templateData:{}})),data={change:function(vl){self.product.fieldsService.getCurrent().editablefield.backgroundColour=vl;application.triggerApplicationEvent("/product/edit/updatePreview");application.triggerApplicationEvent("/quality/check/fieldbyindex/"+self.product.fieldsService.getCurrentEditableFieldId());pushCreationStudioToGTM("Image & Text tools: Select background-color: "+vl)},templateData:{selectedHex:selectedHex,selected:{red:0,blue:0,green:0}},chooseText:chooseButtonText[0].innerHTML,cancelText:cancelButtonText[0].innerHTML},cp=application.getComponent("BgColorPicker",[]);self.container.find(".allowedColors").remove();$(".bgcolour-wrapper").find(".sp-replacer.sp-light.full-spectrum").length==0?(cp.init(data,$(".color-picker-background")),cp.render()):cp.updateColor($(".bgcolour-wrapper").find(".color-picker-background"),selectedHex);$(".sp-replacer.sp-light.full-spectrum").click(function(){pushCreationStudioToGTM("Image & Text tools: Open background-color")})},ProductTabs.prototype.render=function(){var self=this,cf=self.product.fieldsService.getCurrent(),rule,sellerStuff,template,sellerFieldSettings,$fabrizSizeOption,selectedSizeSystemName;if(this.$controls.empty(),this.$controlsmobile.empty(),presets.isReadOnly||this.product.previewRestriction.isItLimittedColorsInBackGround()){if(this.product.previewRestriction.isItLimittedColorsInBackGround()){var isbgColorAllowed=_.indexOf(cf.deny,"bgcolor")===-1,showDefaultPicker=!0,preselectedColors=[];cf.rules&&(rule=_.find(cf.rules,function(r){return r.name==="allowBgcolors"}),rule&&rule.content.length>0&&isbgColorAllowed&&(showDefaultPicker=!1,preselectedColors=rule.content));
23showDefaultPicker&&!presets.isReadOnly?self.showColorPicker():_.each(preselectedColors,function(color){var result={templateData:{color:color}};self.container.find(".bg-color-container").after(application.getFromTemplate($("#template-product-tab-Buyer-preselectedColor"),result));self.container.find(".allowedColors."+color).find(".Color:last").css("background-color","#"+color)})}}else self.showColorPicker();sellerStuff=self.container.find("#seller-field-settings");!cf.locked&&this.product.previewRestriction.canShowDesignerOptions()?(sellerStuff.show(),template=application.getFromTemplate($("#template-product-tab-seller-controlls"),this),sellerStuff.html(template),sellerFieldSettings=application.getComponent("SellerFieldSettings"),sellerFieldSettings.init()):sellerStuff.hide().empty();$("#tab-options .simplebar-content-wrapper").scroll(function(){$(".sp-container.sp-light.sp-clear-enabled.sp-palette-buttons-disabled.sp-initial-disabled.full-spectrum:not(.sp-hidden)").find(".sp-cancel").trigger("click")});$fabrizSizeOption=this.$el.find("#optId-FabricSize");selectedSizeSystemName=this.$el.find("#optId-FabricPredefinedSizes select").find(":selected").data("systemname");selectedSizeSystemName!=="FabricCustomSize"&&selectedSizeSystemName!=undefined&&$fabrizSizeOption.hide()},ProductTabs.prototype.designButtonClick=function(){var self=this,hasCustomImages;application.triggerApplicationEvent("/product/productTabs/onlySelect/1");application.triggerApplicationEvent("/product/canvasTabs/select/1/false");hasCustomImages=self.product.designObjectService.hasCustomObjects();hasCustomImages!=!1||self.product.fieldsService.getCurrent().locked||application.triggerApplicationEvent("/product/edit/add/something");application.triggerApplicationEvent("/accordion/setFirstObjectAsActive")},ProductTabs.prototype.optionsClick=function(){application.triggerApplicationEvent("/product/edit/addAppertureDiv");application.triggerApplicationEvent("/product/canvasTabs/select/0/false");this.$bleed_info.css("visibility","hidden");$("#area-accordion li").each(function(){$(this).removeClass("active")});$(".interactionContainer div[id^=D]").each(function(){$(this).removeClass("PreDefinedTextAreaHighlight")});$(".sp-container.sp-light.sp-clear-enabled.sp-palette-buttons-disabled.sp-initial-disabled.full-spectrum:not(.sp-hidden)").find(".sp-cancel").trigger("click")},ProductTabs.prototype.designClick=function(){application.triggerApplicationEvent("/product/edit/addAppertureDiv");application.triggerApplicationEvent("/product/canvasTabs/select/1/false");presets.showBleedInfo===!0&&this.$bleed_info.css("visibility","visible");$("#area-accordion li").each(function(){$(this).removeClass("active")});$(".interactionContainer div[id^=D]").each(function(){$(this).removeClass("PreDefinedTextAreaHighlight")});$(".sp-container.sp-light.sp-clear-enabled.sp-palette-buttons-disabled.sp-initial-disabled.full-spectrum:not(.sp-hidden)").find(".sp-cancel").trigger("click");application.triggerApplicationEvent("/accordion/setUserSelectedDOAsActive")},ProductTabs.prototype.select=function(ind,dontAddSomething){var self=this,appertureDiv,hasCustomImages;parseInt(ind)!="NaN"&&(this.$el.tabs("select",parseInt(ind)),appertureDiv=$(".innerContainer"),ind=="1"&&appertureDiv.length=="0"&&(application.triggerApplicationEvent("/product/edit/addAppertureDiv"),presets.showBleedInfo==!0&&this.$bleed_info.css("visibility","visible")),hasCustomImages=self.product.designObjectService.hasCustomObjects(),dontAddSomething||hasCustomImages!=!1||self.product.fieldsService.getCurrent().locked||application.triggerApplicationEvent("/product/edit/add/something"))},ProductTabs.prototype.getActive=function(){return $("#product-tabs").tabs("option","selected")},ProductTabs.prototype.updateCanvasPreview=function(){var self=this,tabSelected=this.getActive();tabSelected==0?$("#product-tabs").tabs("disable",1):tabSelected==1&&$("#product-tabs").tabs("disable",0);setTimeout(function(){self.updateCanvasPreviewPostback()},100)},ProductTabs.prototype.updateCanvasPreviewPostback=function(){application.getComponent("Canvas").updatePreviewPostback();$("#product-tabs").tabs("enable",0);$("#product-tabs").tabs("enable",1)},ProductTabs.prototype.updatePending=function(){this.$designButton.attr("disabled","disabled");this.$el.tabs("disable",1)},ProductTabs.prototype.previewImageLoaded=function(){this.$designButton.removeAttr("disabled");this.$el.tabs("enable",1)},ProductTabs.prototype.ProductQuickView=function(){var activeTab=this.getActive();this.optionsClick();this.select(0)},new ProductTabs}(jQuery),"ProductTabs");__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.
23setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Preview){var UI;(function(){var PreselectedBgColorsController=function(_super){function PreselectedBgColorsController(){var _this=_super.call(this)||this;return _this.route("/preview/preselectedbgcolors/render",_this.render),_this.route("/preview/preselectedbgcolors/add/:color",_this.addColor),_this.route("/preview/preselectedbgcolors/delete/:color",_this.deleteColor),_this.route("/preview/preselectedbgcolors/select/:color",_this.selectColor),_this}return __extends(PreselectedBgColorsController,_super),PreselectedBgColorsController.prototype.init=function(){this._preselectedBgColors=application.getComponent("PreselectedBgColors");this._preselectedBgColors.init()},PreselectedBgColorsController.prototype.render=function(){this._preselectedBgColors.render()},PreselectedBgColorsController.prototype.addColor=function(event){var color=event.parameters.color;this._preselectedBgColors.addColor(color)},PreselectedBgColorsController.prototype.deleteColor=function(event){var color=event.parameters.color;this._preselectedBgColors.deleteColor(color)},PreselectedBgColorsController.prototype.selectColor=function(event){var color=event.parameters.color;this._preselectedBgColors.selectColor(color)},PreselectedBgColorsController}(Controller),PreselectedBgColors;application.addController(new PreselectedBgColorsController);PreselectedBgColors=function(){function PreselectedBgColors(){}return PreselectedBgColors.prototype.init=function(){var _this=this;this.self=this;this._$container=$("#product-tabs #tab-accordion #seller-field-settings .seller-field-controlls .bgColors");this._$divColorPicker=this._$container.find(".preselectedColorPicker");this._$divColors=this._$container.find(".preselctedColors");this._$delLink=this._$divColors.find("a.delColorLink");this.product=application.getModel("Product");this._$divColorPicker.jPicker({window:{expandable:!0,effects:{type:"fade",speed:{show:"fast",hide:"fast"}}},color:{active:new $.jPicker.Color({hex:"ffffff"})}},function(color){_this.addColor(color)});$("body").on("keydown",function(e){e.keyCode===$.ui.keyCode.ESCAPE&&($(".jPicker-color-picker-background").hide(),$(".jPicker-").hide());e.stopPropagation()})},PreselectedBgColors.prototype.render=function(){var _this=this,cf,bgColorsRule;this.init();cf=this.product.fieldsService.getCurrent();cf.rules&&(bgColorsRule=_.find(cf.rules,function(rule){return rule.name==="allowBgcolors"}),bgColorsRule&&_.each(bgColorsRule.content,function(color){_this.showColor(color)}));_.indexOf(cf.deny,"bgcolor")===-1?this._$container.show():this._$container.hide()},PreselectedBgColors.prototype.addColor=function(color){var bgColorsRule,cf;color=color.val().hex;cf=this.product.fieldsService.getCurrent();cf.rules!==null?(bgColorsRule=_.find(cf.rules,function(rule){return rule.name==="allowBgcolors"}),bgColorsRule===null&&(bgColorsRule={name:"allowBgcolors",content:[]},cf.rules.push(bgColorsRule))):(bgColorsRule={name:"allowBgcolors",content:[]},cf.rules=[bgColorsRule]);bgColorsRule.content.length<presets.noOfPreselectedBgColors&&(bgColorsRule.content.push(color),this.showColor(color));application.triggerApplicationEvent("/product/edit/updatePreview")},PreselectedBgColors.prototype.deleteColor=function(color){this._$divColors.find("a.delColorLink[data-color ="+color+"]").parent().remove();var cf=this.product.fieldsService.getCurrent(),bgColorsRule=_.find(cf.rules,function(rule){return rule.name==="allowBgcolors"});bgColorsRule.content=_.without(bgColorsRule.content,color);application.triggerApplicationEvent("/product/edit/updatePreview")},PreselectedBgColors.prototype.selectColor=function(color){var cf=this.product.fieldsService.getCurrent();cf.editablefield.backgroundColour=color;this.product.fieldsService.incrementCurrentFieldVersion();application.triggerApplicationEvent("/product/edit/updatePreview")},PreselectedBgColors.prototype.showColor=function(color){var result={templateData:{color:color}};this._$divColors.append(application.getFromTemplate($("#template-product-tab-seller-preselectedColor"),result));this._$divColors.find(".Color:last").css("background-color","#"+color)},PreselectedBgColors}();application.addComponent(new PreselectedBgColors,"PreselectedBgColors")})(UI=Preview.UI||(Preview.UI={}))}(Preview||(Preview={}));application.addController(function($,application){function ProductCarouselController(){this.route("/product/edit/productLoaded/",this.load);this.route("/product/edit/previewImageRequest/:index",this.updateCarouselField);this.route("/product/edit/updateImageLandscape/:index",this.updateFieldByIndexforLandscape);this.route("/product/carousel/select/Field/:showGallery/:index",this.selectCarousalField);this.route("/product/carousel/select/Field/:showGallery/:index/:isForce",this.selectCarousalField);this.route("/product/carousel/scrollTo/:index",this.scrollToCarousalField);this.route("/product/carousel/resetData",this.resetData);this.route("/product/selectField/:ind/:isFinalPreview",this.selectField);this.route("/preview/update/pending/",this.updatePending);this.route("/product/edit/previewImageLoaded/",this.previewImageLoaded);this.route("/product3d/carousel/update",this.setCarouselButtonStatesFor3D);this.route("/product/canvasTabs/select/:ind/:skipLoad",this.selectTab);this.route("/product/carousel/copyDesign/field/dropDown/:isShow",this.ShowHideCopydesign);this.productCarousel=null;this.product=null;this.fieldsService=null;this.productOptions=null;this.containerId=null;this.$copyproductfieldbtn;this.$copableproductfields;this.$copytooltipicon;this.$copableproductfieldlist;this.canvasTabs=null;this.$clearproductfieldbtn;this.$clearableproductfields}return ProductCarouselController.prototype=new application.Controller,ProductCarouselController.prototype.init=function(){this.productCarousel=application.getComponent("ProductCarousel");this.product=application.getModel("Product");this.fieldsService=application.getModel("Product").fieldsService;this.productOptions=application.getComponent("ProductOptions",[]);this.$copyproductfieldbtn=$("#copyproductfieldbtn");this.$copableproductfields=$("#copableproductfields");this.$copytooltipicon=$("#copytooltipicon");this.$copableproductfieldlist=$("#copableproductfieldlist");this.canvasTabs=application.getComponent("CanvasTabs");this.$clearproductfieldbtn=$("#clearproductfieldbtn");this.$clearableproductfields=$("#clearableproductfields")},ProductCarouselController.prototype.load=function(){this.productCarousel.render()},ProductCarouselController.prototype.updateCarouselField=function(event){var index=event.parameters.index,optionValues=this.productOptions.getAffectedOptionsAsString(),currentFieldIndex=index?index:this.fieldsService.getCurrentEditableFieldId(),dirtyFields,i;for(this.productCarousel.updateFieldByIndex(optionValues,currentFieldIndex),dirtyFields=this.fieldsService.applyCustomCommands(),i=0;i<dirtyFields.length;i++)this.productCarousel.updateFieldByIndex(optionValues,dirtyFields[i],!0,currentFieldIndex)},ProductCarouselController.prototype.updateFieldByIndexforLandscape=function(event){var index=event.parameters.index,currentField=this.fieldsService.getFieldByIndex(index);(!currentField||currentField.editablefield.isModified)&&this.productCarousel.updateforLandscape(index)},ProductCarouselController.prototype.selectField=function(event){var ind=event.parameters.ind,isFinalPreview=event.parameters.isFinalPreview;this.productCarousel.selectField(ind,isFinalPreview);pushCreationStudioToGTM("Preview and Buy: Click edit design image")},ProductCarouselController.prototype.scrollToCarousalField=function(event){var index=
23parseInt(event.parameters.index);this.productCarousel.seekTo(index)},ProductCarouselController.prototype.resetData=function(){this.productCarousel.containerId=null;this.productCarousel.carouselSize=2;this.productCarousel.init();this.productCarousel.render()},ProductCarouselController.prototype.selectCarousalField=function(event){var index=parseInt(event.parameters.index),isForce=event.parameters.isForce?event.parameters.isForce:!1,showGallery=event.parameters.showGallery==="true",currentFieldIndex=this.fieldsService.getCurrentEditableFieldId(),optionValues,hasCustomImages;(isForce||index!==currentFieldIndex)&&(this.fieldsService.setCurrent(index),optionValues=this.productOptions.getAffectedOptionsAsString(),this.productCarousel.updateFieldByIndex(optionValues,index),application.triggerApplicationEvent("/product/accordion/load/field/for/carousal/false"),application.triggerApplicationEvent("/product/canvas/load/field/for/carousel/true"),application.triggerApplicationEvent("/product/preview/load/field/for/carousel/false"),application.triggerApplicationEvent("/product/edit/initField"),application.triggerApplicationEvent("/design/history/clear"),application.triggerApplicationEvent("/product/edit/addimagestext/showhide"),application.triggerApplicationEvent("/accordion/setFirstObjectAsActive"),application.triggerApplicationEvent("/product/selectField/displayHideControls"),hasCustomImages=this.product.designObjectService.hasCustomObjects(),hasCustomImages!==!1||this.product.fieldsService.getCurrent().locked||(presets.addImageIndex=-1,showGallery&&(!$("#md-final3DPreview")||$("#md-final3DPreview").is(":hidden"))&&application.triggerApplicationEvent("/product/edit/add/something"),application.triggerApplicationEvent("/product/productTabs/onlySelect/1"),application.triggerApplicationEvent("/product/canvasTabs/select/1/false")),application.triggerApplicationEvent("/product/edit/updatepreviewsize"),presets.is3DPreviewEnabled&&application.triggerApplicationEvent("/product3d/select/field/for/carousel/"+index),application.triggerApplicationEvent("/preview/canvasTabs/togglecopyside"),pushCreationStudioToGTM("Select: Image thumb"))},ProductCarouselController.prototype.updatePending=function(){this.productCarousel.updatePending()},ProductCarouselController.prototype.previewImageLoaded=function(){this.productCarousel.previewImageLoaded()},ProductCarouselController.prototype.setCarouselButtonStatesFor3D=function(){this.productCarousel.setCarouselButtonStates()},ProductCarouselController.prototype.selectTab=function(event){this.productCarousel.selectTab(event.parameters.ind)},ProductCarouselController.prototype.ShowHideCopydesign=function(event){var active,CurrentEditableFielId;let totalcarousalcnt=this.fieldsService.getTotalCarousalFieldCnt();active=this.canvasTabs.getActive();totalcarousalcnt>1&&active!=0?event.parameters.isShow==="true"?$("#copableproductfieldlist").find("a").length>1&&(CurrentEditableFielId=this.fieldsService.getCurrentEditableFieldId(),this.$copableproductfields.children("a").removeAttr("disabled"),this.$copableproductfields.children("a[data-index="+CurrentEditableFielId+"]").attr("disabled","disabled"),this.$copyproductfieldbtn.show().prop("disabled",!1),this.$copytooltipicon.show()):(this.$copableproductfieldlist.hide(),this.$copyproductfieldbtn.show().prop("disabled",!0),this.$copytooltipicon.show()):(this.$copableproductfieldlist.hide(),this.$copyproductfieldbtn.hide(),this.$copytooltipicon.hide())},new ProductCarouselController}(jQuery,window.application));application.addComponent(function($){function ProductCarousel(){this.product=null;this._$el=null;this._$items;this._scrollableDt;this.carouselSize=2;this.productOptions=null;this.containerId=null;this._sizeConverter=null;this.$copyproductfieldbtn;this.$copableproductfields;this.$copableproductfieldlist;this.$copytooltipicon;this.canvasTabs=null;this.$clearproductfieldbtn;this.$clearableproductfields}function LoadImage_CMS(imageElm,fields,ind,optionValues){var thumbUrl,editableField,imageSrc;(presets.is3DPreviewEnabled!==!0||presets.isIpad||presets.isMobile)&&(thumbUrl=presets.productDesign.thumbUrl,editableField=fields[ind].editablefield,presets.isCMS&&presets.designName!==""&&(editableField.version=$.nextVersion(),editableField.isModified=!0),editableField.version===0&&(thumbUrl=presets.productDesign.loadInitialThumbUrl),imageSrc=thumbUrl+"?productId="+preset
23s.productId+"&productName="+presets.productName+"&systemName="+presets.systemName+"¤tFieldIndex="+ind+"&listOfOptionValues="+optionValues+"&templateChanged="+presets.tmplChanged+"&designName="+presets.designName+"&viewName=&version="+editableField.version+"&isPreBasketItem="+/isPreBasketItem=true|EditBasketItem/i.test(window.location.href),$(imageElm).attr("src",imageSrc),$(imageElm).load(function(e){var $target=$(e.target);$target.prev().remove()}))}function LoadImage(imageElm,fields,ind,optionValues){var thumbUrl,editableField,imageSrc;(presets.is3DPreviewEnabled!==!0||presets.isIpad||presets.isMobile)&&(ind=ind%fields.length,thumbUrl=presets.productDesign.thumbUrl,editableField=fields[ind].editablefield,editableField.version===0&&(thumbUrl=presets.productDesign.loadInitialThumbUrl),imageSrc=thumbUrl+"?productId="+presets.productId+"&systemName="+presets.systemName+"&productName="+presets.productName+"&pvers="+presets.pvers+"¤tFieldIndex="+ind+"&listOfOptionValues="+optionValues+"&templateChanged="+preset
23s.tmplChanged+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&viewName=&designName="+presets.designName+"&version="+editableField.version+"&isCMSEdit="+presets.cmsEdit+"&orderId="+presets.orderId+"&tid="+presets.tid,$(imageElm).attr("src",imageSrc),$(imageElm).load(function(e){var $target=$(e.target);$target.siblings("span.field-loader").hide()}))}return ProductCarousel.prototype.init=function(){var self=this;if(this.product=application.getModel("Product"),this.productOptions=application.getComponent("ProductOptions",[]),this.canvasTabs=application.getComponent("CanvasTabs"),this._sizeConverter=new Utils.SizeConverter,this.containerId){const container=$("#"+this.containerId);this._$el=$(".product-carousel",container)}else this._$el=$(".product-carousel");this._$items=$("#items",this._$el);this.$scroll=$(".scrollable-0",this._$el);this.totalheight=0;$(window).resize(function(){this.resizeTO&&clearTimeout(this.resizeTO);this.resizeTO=setTimeout(function(){self.setCarouselButtonStates.apply(self,[])},500)});this.$leftBtn=self._$el.find(".left");this.$rightBtn=self._$el.find(".right");this.$startBtn=self._$el.find(".start");this.$endBtn=self._$el.find(".end");this.$topBtn=self._$el.find(".custom-top");this.$bottomBtn=self._$el.find(".custom-bottom");this.$topBtn.css("visibility","hidden");this.$bottomBtn.css("visibility","hidden");this._$el.on("mouseover","a",function(){self.product.productDesign.fields&&self.product.productDesign.fields.filter(v=>v.uiHidden==!1).length>1?$(this).attr("class")!=="active"&&($(this).removeClass("no-carousel-border"),$(this).addClass("hover")):$(this).addClass("no-carousel-border")});this._$el.on("mouseout","a",function(){self.product.productDesign.fields&&self.product.productDesign.fields.filter(v=>v.uiHidden==!1).length>1?$(this).attr("class")!=="active"&&$(this).removeClass("hover"):$(this).addClass("no-carousel-border")});self.$leftBtn.on("mouseup",function(){var ind=self._scrollableDt.getIndex(),pos=ind<self.carouselSize?0:ind-self.carouselSize;self._scrollableDt.seekTo(pos)});self.$rightBtn.on("mouseup",function(){self._scrollableDt.seekTo(self._scrollableDt.getIndex()+self.carouselSize)});self.$startBtn.on("mouseup",function(){self._scrollableDt.seekTo(0)});self.$endBtn.on("mouseup",function(){var hiddenItems=self.$scroll.find("a").not(function(i,a){return $(a).css("display")!=="none"}),totalNumber=0,pos;totalNumber=$(".product-carousel-field:not(.js-hide-carousel-item)",this._$items).length;pos=0;pos=totalNumber>5?totalNumber-3:totalNumber-1;self._scrollableDt.seekTo(pos-hiddenItems.length)});this._$el.on("mousedown",".btn-unlink",function(){var mirrorFieldIndex=$(this).data("mirrorFieldIndex"),customCommands=self.product.fieldsService.getAll()[mirrorFieldIndex].customCommands;return customCommands=customCommands.replace("mirrorOf-","xMirrorOf-"),customCommands=customCommands.replace("copyOf-","xCopyOf-"),self.product.fieldsService.getAll()[mirrorFieldIndex].customCommands=customCommands,application.triggerApplicationEvent("/product/edit/updatePreview/forceUpdate"),self.render(),presets.isMultiple3DObjectsEvaluated=!0,application.triggerApplicationEvent("/product/carousel/select/Field/false/"+self.product.fieldsService.getCurrentEditableFieldId()),application.triggerApplicationEvent("/quality/display/field/all"),application.triggerApplicationEvent("/product3d/build/carousel"),!1});this._$el.on("mousedown",".btn-link",function(){var mirrorFieldIndex=$(this).data("mirrorFieldIndex"),srcField=self.product.fieldsService.getSourceMirrorField(mirrorFieldIndex),customCommands;let fields=self.product.fieldsService.getAll();for(i=0;i<fields.length;i++)if(customCommands=fields[i].customCommands,customCommands!=null){let srcMirrorInd=self.product.fieldsService.getSourceMirrorField(i);srcMirrorInd==srcField&&(customCommands=customCommands.replace("xMirrorOf-","mirrorOf-"),customCommands=customCommands.replace("xCopyOf-","copyOf-"),fields[i].customCommands=customCommands)}return application.triggerApplicationEvent("/product/edit/updatePreview/forceUpdate"),self.render(),presets.isMultiple3DObjectsEvaluated=!0,application.triggerApplicationEvent("/product/carousel/select/Field/false/"+srcField),application.triggerApplicationEvent("/quality/display/field/all"),application.triggerApplicationEvent("/product3d/build/carou
23sel"),!1});self.$topBtn.on("mouseup",function(){var divscrolltop=parseInt($("#stage-wrapper #simplebar-container .simplebar-content-wrapper").scrollTop());divscrolltop>0&&$("#stage-wrapper #simplebar-container .simplebar-content-wrapper").animate({scrollTop:divscrolltop-150},300)});self.$bottomBtn.on("mouseup",function(){var totalHeight=parseInt(self.totalheight),divscrolltop=parseInt($("#stage-wrapper #simplebar-container .simplebar-content-wrapper").scrollTop());divscrolltop<=totalHeight&&$("#stage-wrapper #simplebar-container .simplebar-content-wrapper").animate({scrollTop:divscrolltop+150},500)});this._$el.on("mousedown",".btn-expand",function(){var mirrorFieldIndex=parseInt($(this).attr("data-src-field-index")),customCommands,srcField;let fields=self.product.fieldsService.getAll();for(i=0;i<fields.length;i++)customCommands=fields[i].customCommands,customCommands&&(srcField=self.product.fieldsService.getSourceMirrorField(i),mirrorFieldIndex==srcField&&(customCommands=customCommands.replace("mirrorOf-","xMirrorOf-"),customCommands=customCommands.replace("copyOf-","xCopyOf-"),fields[i].customCommands=customCommands));return application.triggerApplicationEvent("/product/edit/updatePreview/forceUpdate"),self.render(),presets.isMultiple3DObjectsEvaluated=!0,application.triggerApplicationEvent("/product/carousel/select/Field/false/"+self.product.fieldsService.getCurrentEditableFieldId()),application.triggerApplicationEvent("/quality/display/field/all"),application.triggerApplicationEvent("/product3d/build/carousel"),!1});this._$el.on("mousedown",".btn-collaspse",function(){var srcField=parseInt($(this).attr("data-src-field-index")),customCommands;let fields=self.product.fieldsService.getAll();for(i=0;i<fields.length;i++)if(customCommands=fields[i].customCommands,customCommands){let srcMirrorInd=self.product.fieldsService.getSourceMirrorField(i);srcMirrorInd==srcField&&(customCommands=customCommands.replace("xMirrorOf-","mirrorOf-"),customCommands=customCommands.replace("xCopyOf-","copyOf-"),fields[i].customCommands=customCommands)}return application.triggerApplicationEvent("/product/edit/updatePreview/forceUpdate"),self.render(),presets.isMultiple3DObjectsEvaluated=!0,application.triggerApplicationEvent("/product/carousel/select/Field/false/"+srcField),application.triggerApplicationEvent("/quality/display/field/all"),application.triggerApplicationEvent("/product3d/build/carousel"),!1});this.$copyproductfieldbtn=$("#copyproductfieldbtn");this.$copableproductfields=$("#copableproductfields");this.$copableproductfieldlist=$("#copableproductfieldlist");this.$copytooltipicon=$("#copytooltipicon");this.$copyproductfieldbtn.on("click",function(){$("#copableproductfieldlist").toggle();pushCreationStudioToGTM("CopyDesign:Click-open fields")});this.$copableproductfields.on("click","a.copableProductdfield",function(){var fieldIndex=$(this).attr("data-index"),selectedindex=$("#copableproductfields").children("a.copableProductdfield[disabled='disabled']").attr("data-index");fieldIndex!==selectedindex&&(application.triggerApplicationEvent("/product/dropdown/designCopyToSelectedField/"+fieldIndex),pushCreationStudioToGTM("CopyDesign:select field:"+$(this).text()))});this.$clearproductfieldbtn=$("#clearproductfieldbtn");this.$clearableproductfields=$("#clearableproductfields");this.$clearableproductfieldlist=$("#clearableproductfieldlist");this.$clearproductfieldbtn.on("click",function(){if(self.product.productDesign.fields&&(self.product.productDesign.fields.filter(v=>v.uiHidden==!1).length<=1||self.product.productDesign.fields.filter(v=>v.locked==!1).length<=1)){const unlockedIndex=self.product.productDesign.fields.findIndex(v=>v.locked===!1);application.triggerApplicationEvent("/preview/design/clearDesign/"+unlockedIndex)}else $("#clearableproductfieldlist a").length<1&&(self.$clearableproductfields.empty(),$("<a class='clearableProductfield dvcleardesign' data-index='666' href='javascript:void(0);'>
23"+presets.ClearDesignAllOptionLbl+"<\/a>").appendTo(self.$clearableproductfields),$.each(self.product.productDesign.fields,function(index,field){if(!field.locked&&field.fieldType!=6){let fieldTitle=self.product.fieldsService.getFieldTitle(field);$("<a class='clearableProductfield dvcleardesign' data-index="+index+" href='javascript:void(0);'>"+fieldTitle+"<\/a>").appendTo(self.$clearableproductfields)}})),$("#clearableproductfieldlist").toggle();pushCreationStudioToGTM("clearDesign:Click-open fields")});this.$clearableproductfields.on("click","a.clearableProductfield",function(){var fieldIndex=$(this).attr("data-index");application.triggerApplicationEvent("/preview/design/clearDesign/"+fieldIndex);pushCreationStudioToGTM("ClearDesign:select field:"+$(this).text())});$(document).on("click",function(e){$("#copableproductfieldlist").is(":visible")&&$(e.target).is(":not(.dvcopydesign)")&&$("#copableproductfieldlist").hide();$("#clearableproductfieldlist").is(":visible")&&e.srcElement.id!="idClrDesign"&&$("#clearableproductfieldlist").hide()});return this},ProductCarousel.prototype.render=function(){var intialThumbLoaded=$("#IntialThumbLoaded");return presets.is3DPreviewEnabled!==!0||presets.isIpad||presets.isMobile?(this.setCarousel(),this.setCarouselButtonStates()):(presets.isMultiple3DObjectsEvaluated=!1,this.set3DCarousel(),this.setCarouselButtonStates()),intialThumbLoaded.val("True"),this},ProductCarousel.prototype.setCarousel=function(){var self=this,i,$ajaxLoaderImage;if(this.fields=this.product.fieldsService.getAll(),this.fields.length<=1){self._$el.hide();return}self._$el.show();this._$items.children().remove();self.$copableproductfields.empty();self.$clearableproductfields.empty();let copyableFields=0;for(i=0;i<this.fields.length;i++)this.fields[i].locked||(copyableFields+=1);copyableFields>1&&($("<a class='copableProductdfield dvcopydesign' data-index='555' href='javascript:void(0);'>
23"+presets.CopyDesignAllOptionLbl+"<\/a>").appendTo(self.$copableproductfields),$("<a class='clearableProductfield dvcleardesign' data-index='666' href='javascript:void(0);'>"+presets.ClearDesignAllOptionLbl+"<\/a>").appendTo(self.$clearableproductfields),this.canvasTabs.getActive()!=0?(this.$copyproductfieldbtn.show(),this.$copytooltipicon.show()):(this.$copyproductfieldbtn.hide(),this.$copytooltipicon.hide()));copyableFields=0;$ajaxLoaderImage=$("<img class='carousel-item-image' />");$.each(this.fields,function(index,field){if((""+field.customCommands).indexOf("mirrorOf-")===-1&&(""+field.customCommands).indexOf("copyOf-")===-1){var mirrors=self.product.fieldsService.getMirroredFields(index),expMirrors=self.product.fieldsService.getExpMirroredFields(index),srcFieldIndex=self.product.fieldsService.getSourceMirrorField(index),srcField=srcFieldIndex===null?field:self.fields[srcFieldIndex];const showHide=field.uiHidden?"js-hide-carousel-item":"";let fieldTitle=self.product.fieldsService.getFieldTitle(field);self._$items.append($("<a/>").attr("href","javascript:").attr("class","dev-carousel-item").attr("rel","/product/carousel/select/Field/true/"+index).toggleClass("collapsed",mirrors.length>1).append($(`<span class='product-carousel-field ${showHide}' style='width:auto;'>`).append($("<span class='field-loader'><\/span>")).append($ajaxLoaderImage.clone().data("fieldIndex",index)).append(function(){return mirrors.length?$("<div class='mirror-field'><\/div>").append(function(){return $.map(mirrors,function(m,index){return $ajaxLoaderImage.clone().data("fieldIndex",self.fields.indexOf(m)).toggleClass("first",index===0)})}):""}).append(function(){return mirrors.length?$.map(mirrors,function(m,i){return application.getFromTemplate($("#template-mirror-side-options"),{templateData:{unlink:!0,link:(""+field.customCommands).indexOf("xMirrorOf-")>=0||(""+field.customCommands).indexOf("xCopyOf-")>=0,isCopy:self.product.fieldsService.getCopiedFields(index).length>0||self.product.fieldsService.getSourceCopyField(index)!==null,srcFieldIndex:index,mirrorFieldIndex:self.fields.indexOf(m),sourceFieldTitle:srcField.name,mirrorFieldTitle:m.name,buttonStyle:mirrors.length===1?"display: inline-block; width: auto;":"width:"+100/(mirrors.length+1)+"%; top:"+(i+1)*(100/(mirrors.length+1))+"%;"}})}):application.getFromTemplate($("#template-mirror-side-options"),{templateData:{unlink:!1,link:((""+field.customCommands).indexOf("xMirrorOf-")>=0||(""+field.customCommands).indexOf("xCopyOf-")>=0)&&self.product.fieldsService.IsLinkedFied(index),isCopy:self.product.fieldsService.getCopiedFields(index).length>0||self.product.fieldsService.getSourceCopyField(index)!==null,srcFieldIndex:index,mirrorFieldIndex:index,sourceFieldTitle:srcField.name,mirrorFieldTitle:field.name,buttonStyle:"display: inline-block; width: auto;"}})}).append(function(){return mirrors.length>1||expMirrors.length>1?application.getFromTemplate($("#template-mirror-side-multiple"),{templateData:{srcFieldIndex:index,mirrorFieldIndex:index,sourceFieldTitle:srcField.name,mirrorFieldTitle:field.name,buttonStyle:"display: inline-block; width: auto;"}}):""}).append(("<p id='fieldLable"+index+"'>"+fieldTitle+getFieldSize(field,self)).toString()+"<\/p>")).append("<span class='data-field' data-fieldindex='"+index+"'><\/span>"));field.locked||field.fieldType==6||field.deny.indexOf("image")!==-1||(copyableFields++,$("<a class='copableProductdfield dvcopydesign' data-index="+index+" href='javascript:void(0);'>"+fieldTitle+"<\/a>").appendTo(self.$copableproductfields));field.locked||field.fieldType==6||$("<a class='clearableProductfield dvcleardesign' data-index="+index+" href='javascript:void(0);'>"+fieldTitle+"<\/a>").appendTo(self.$clearableproductfields)}});copyableFields<=1&&(self.$copyproductfieldbtn.hide(),self.$copytooltipicon.hide(),self.$copableproductfields.empty(),self.$clearableproductfields.empty());self.product.fieldsService.setTotalCarousalFieldCnt(copyableFields);this.updateField();this.ReplaceCarouselSrc()},ProductCarousel.prototype.set3DCarousel=function(){var self=this,timer;if(this.fields=self.product.fieldsService.getAll(),timer=setInterval(function(){if(!presets.isMultiple3DObjectsEvaluated){console.log("waiting for Multiple 3D Objects Evaluation to get ready...");return}if(clearInterval(timer),presets.firstPageLoad3D===!1){const currentFieldIndex=self.product.productDesignService.getCurrentEditableFieldId();console.log("3d carousel:",currentFieldIndex);application.triggerApplicationEvent("/product3d/optionvalue/change/update/carousel/fields");application.triggerApplicationEvent("/product/carousel/select/Field/true/"+currentFieldIndex);application.triggerApplicationEvent("/product/carousel/scrollTo/"+currentFieldIndex);self.setCarouselButtonStates();var $fields=$("a",self._$items);$fields.removeClass("active");self.product.productDesign.fields&&self.product.productDesign.fields.filter(v=>v.uiHidden==!1).length>1&&($fields.eq(currentFieldIndex).removeClass("no-carousel-border"),$fields.eq(currentFieldIndex).addClass("active"))}}),self.fields.length<=1){self._$el.hide();return}self._$el.show()},ProductCarousel.prototype.ReplaceCarouselSrc=function(){var optionValues=this.productOptions.getOptionsAsString(),fields=this.product.fieldsService.getAll(),$imgEL=$("img",this._$items),loadImageMethod=presets.isCMS?LoadImage_CMS:LoadImage;$imgEL.each(function(ind){var $img=$(this),fieldIndex=$img.data("fieldIndex");window.setTimeout(function(){loadImageMethod($img,fields,fieldIndex,optionValues)},ind*200)})},ProductCarousel.prototype.setCarouselButtonStates=function(){var self=this,position=0,positions=$(".product-carou
23sel-field:not(.js-hide-carousel-item)",this._$items).length-this.carouselSize,visibleItems=this.$scroll.find(".product-carousel-field").not(function(){return $(this).css("display")==="none"||$(this).parent().css("display")==="none"}),i,scrollRatio;visibleItems=$(".product-carousel-field:not(.js-hide-carousel-item)",this._$items);var firstItem=visibleItems.first(),marginWidth=0,marginElement=firstItem.css("margin-right");for(marginElement&&(marginWidth=parseFloat(marginElement.replace("px",""))),this.totalheight=0,i=0;i<visibleItems.length;i++){let item=visibleItems[i];this.totalheight+=item.offsetHeight}visibleItems.length>0&&(this.totalheight>this.$scroll.height()?(self._$el.find("div.scrollable-0").attr("style","max-height: none !important;"),self.$topBtn.css("visibility","visible"),self.$bottomBtn.css("visibility","visible")):(self._$el.find("div.scrollable-0").attr("style","max-height: 95% !important;"),self.$topBtn.css("visibility","hidden"),self.$bottomBtn.css("visibility","hidden")),self._$el.find("div.scrollable-0").attr("style","height:calc("+this.totalheight+"px + 64px) !important;"),self._$el.find("#simplebar-container .simplebar-content").attr("style","height:calc("+this.totalheight+"px + 47px) !important;"));this.totalheight=this.totalheight+this.$scroll.height()/2;scrollRatio=this.totalheight/this.$scroll.height();scrollRatio<=1.4?(self.$leftBtn.hide(),self.$startBtn.hide(),self.$rightBtn.hide(),self.$endBtn.hide(),self.$topBtn.css("visibility","hidden"),self.$bottomBtn.css("visibility","hidden"),self._$el.find(".carousel-arrow").hide(),self._$el.find("#items").removeClass("items"),self._$el.find("#items").addClass("less-itmes")):scrollRatio<=1.75?(self.$leftBtn.hide(),self.$startBtn.show(),self.$rightBtn.hide(),self.$endBtn.show(),self.$topBtn.css("visibility","visible"),self.$bottomBtn.css("visibility","visible")):(self.$leftBtn.show(),self.$startBtn.show(),self.$rightBtn.show(),self.$endBtn.show(),self.$topBtn.css("visibility","visible"),self.$bottomBtn.css("visibility","visible"));position===0?(self.$leftBtn.addClass("disabled"),self.$startBtn.addClass("disabled")):(self.$leftBtn.removeClass("disabled"),self.$startBtn.removeClass("disabled"));position>=positions?(self.$rightBtn.addClass("disabled"),self.$endBtn.addClass("disabled")):(self.$rightBtn.removeClass("disabled"),self.$endBtn.removeClass("disabled"));presets.is3DPreviewEnabled===!1?$("div#preview a").has("img").length?(document.getElementById("btnFinalPreview").disabled=!1,application.triggerApplicationEvent("/product/edit/hidepreviewloader/carouselbutton")):document.getElementById("btnFinalPreview").disabled=!0:document.getElementById("btnFinalPreview").disabled=!1},ProductCarousel.prototype.updateField=function(){var optionValues=application.getComponent("ProductOptions",[]).getOptionsAsString(),currentFieldIndex=this.product.productDesignService.getCurrentEditableFieldId();this.updateFieldByIndex(optionValues,currentFieldIndex)},ProductCarousel.prototype.updateforLandscape=function(index){var $fields=$("a",this._$items),$field=$fields.eq(index),field=this.product.fieldsService.getAll()[index];field.editablefield.isModified&&$field.find("img").attr("src",presets.productDesign.loadCurrentThumbUrl+this.getQuery(index))},ProductCarousel.prototype.updateFieldByIndex=function(optionValues,fieldIndex,force){var commands,fielToUpdate,commandName;fieldIndex=+fieldIndex;var field=this.product.fieldsService.getAll()[fieldIndex],editableField=field.editablefield,$fields=$("a",this._$items),$field=$fields.filter(function(i,elm){var res=!1;return $(elm).find("img,span").each(function(a,b){res=res||$(b).data("fieldIndex")===fieldIndex}),res}).first();if(force&&(editableField.version=$.nextVersion(),editableField.isModified=!0),editableField.isModified)if(window.isDirty=!0,force){commands="";field.customCommands?commands=field.customCommands.split(";"):console.log("Custom Command is null");fielToUpdate=0;commandName=commands[0].split("-")[0];commandName=commandName.toLocaleLowerCase();switch(commandName){case"copyof":case"copyfabric":fielToUpdate=fieldIndex;break;case"mirrorof":fielToUpdate=fieldIndex;break;case"locked":fielToUpdate=fieldIndex;break;case"dependson":fielToUpdate=fieldIndex;break;case"viewof":fielToUpdate=fieldIndex;break;case"overlaysize":fielToUpdate=fieldIndex;break;default:console.log("Unknown Command : "+commandName)}if(editableField.isModified){let loadfield=$field.find("img").filter(function(i,elm){return $(elm).data("fieldIndex")===fielToUpdate}).attr("src",presets.productDesign.loadCurrentThumbUrl+this.getQuery(fielToUpdate));$(loadfield).load(function(e){var $target=$(e.target);$target.siblings("span.field-loader").hide();application.triggerApplicationEvent("/product/carousel/copyDesign/Completed");application.triggerApplicationEvent("/product/carousel/copyDesign/ClearDesignCompleted")})}}else if(editableField.isModified){let loadfield=$field.find("img").filter(function(i,elm){return $(elm).data("fieldIndex")===fieldIndex}).attr("src",presets.productDesign.loadCurrentThumbUrl+this.getQuery(fieldIndex));$(loadfield).load(function(e){var $target=$(e.target);$target.siblings("span.field-loader").hide();application.triggerApplicationEvent("/product/carousel/copyDesign/Completed");application.triggerApplicationEvent("/product/carousel/copyDesign/ClearDesignCompleted")})}force||($fields.removeClass("active"),this.product.productDesign.fields&&this.product.productDesign.fields.filter(v=>v.uiHidden==!1).length>1&&($field.removeClass("no-carousel-border"),$field.addClass("active")));editableField.isModified=!1},ProductCarousel.prototype.getQuery=function(index){var field=this.product.fieldsService.getAll()[index],editableField=field.editablefield,optionValues=application.getComponent("ProductOptions",[]).getOptionsAsString();
23return"?productId="+presets.productId+"&productName="+presets.productName+"&pvers="+presets.pvers+"¤tFieldIndex="+index+"&systemName="+presets.systemName+"&listOfOptionValues="+optionValues+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&viewName=&designName="+presets.designName+"&version="+editableField.version},ProductCarousel.prototype.seekTo=function(){},ProductCarousel.prototype.selectField=function(ind,isFinalPreview){isFinalPreview=="true"&&(ind==0?$(".product-carousel #simplebar-container .simplebar-content-wrapper").animate({scrollTop:$(".product-carousel #simplebar-container .simplebar-content-wrapper a:nth-child(1)").position().top},"slow"):ind<$(".product-carousel #simplebar-container .simplebar-content-wrapper a").length?$(".product-carousel #simplebar-container .simplebar-content-wrapper").animate({scrollTop:$(".product-carousel #simplebar-container .simplebar-content-wrapper a:nth-child("+(parseInt(ind)+1)+")").position().top-$(".product-carousel #simplebar-container .simplebar-content-wrapper a:first").position().top},"slow"):$(".product-carousel #simplebar-container .simplebar-content-wrapper").animate({scrollTop:$(".product-carousel #simplebar-container .simplebar-content-wrapper a:last").position().top-$(".product-carousel #simplebar-container .simplebar-content-wrapper a:first").position().top},"slow"));var hasCustomImages=this.product.designObjectService.hasCustomObjects();hasCustomImages&&presets.addImageIndex===-1||isFinalPreview!=="false"||this.product.fieldsService.getCurrent().locked||(presets.addImageIndex=-1,application.triggerApplicationEvent("/product/edit/add/something"),application.triggerApplicationEvent("/product/productTabs/onlySelect/1"));application.triggerApplicationEvent("/design/history/clear");application.triggerApplicationEvent("/product/edit/addimagestext/showhide")},ProductCarousel.prototype.updatePending=function(){var fieldIndex=this.product.productDesignService.getCurrentEditableFieldId(),$fields=$("a",this._$items),$fieldAnchor=$fields.eq(fieldIndex),$fieldSpan=$fieldAnchor.find("span").first(),$image,pos,$btnUpdatePending;($fieldAnchor.disableRel(),$image=$fieldSpan.find("img"),$fieldSpan.find("button.update-pending").length)||(pos=$.extend({width:$image.outerWidth(),height:$image.outerHeight()},$image.position()),$btnUpdatePending=application.getFromTemplate($("#update-preview-content"),{templateData:{}}),$btnUpdatePending.addClass("update-pending-thumb"),$btnUpdatePending.css("top",pos.top),$btnUpdatePending.css("left",pos.left),$btnUpdatePending.css("width",pos.width),$btnUpdatePending.css("height",pos.height),$btnUpdatePending.on("click",function(e){e.stopPropagation();application.triggerApplicationEvent("/preview/update/pending/clicked")}).appendTo($fieldSpan),$image.hide())},ProductCarousel.prototype.previewImageLoaded=function(){var fieldIndex=this.product.productDesignService.getCurrentEditableFieldId(),$fields=$("a",this._$items),$fieldAnchor=$fields.eq(fieldIndex);$fieldAnchor.enableRel()},ProductCarousel.prototype.selectTab=function(indx){+indx==0&&this._$el.removeClass("design-tab").addClass("preview-tab");+indx==1&&this._$el.removeClass("preview-tab").addClass("design-tab")},ProductCarousel.prototype.getFilesSizeLabel=function(index){let self=this,fields=this.product.fieldsService.getAll(),field=fields[index];if(presets.isBulkFabric&&self.product.productDesign.fields.length>1){let data=fieldSizeCalculation(field,self);return" ("+data.dimInUnit+" "+data.unitDescription+")"}return""},getFieldSize=function(field,self){if(presets.isBulkFabric&&self.product.productDesign.fields.length>1){let data=fieldSizeCalculation(field,self);return"<br>("+data.dimInUnit+" "+data.unitDescription+")"}return""},fieldSizeCalculation=function(field,self){var $lengthElement=$("#optvalId-LengthOptionValueOpenInput"),$widthElement=$("#optvalId-WidthOptionValueOpenInput"),sizeElement=$("div#optId-FabricSizeUnit input[type='radio']:checked"),unit=self._sizeConverter.getLengthUnit(sizeElement.data("systemname")),lengthInput=$lengthElement.attr("data-accurate-value")||$lengthElement.val(),widthInput=$widthElement.attr("data-accurate-value")||$widthElement.val(),dpi=self.product.fieldsService.getCurrentDPI(),length=parseFloat(lengthInput),width=parseFloat(widthInput),dim=length>width?parseFloat(field.printh):parseFloat(field.printw),dimCM=parseFloat(Math.round(dim*2.54/dpi)),dimInUnit=dimCM,unitDescription;return unit!=="cm"&&unit!=="CM"&&(dimInUnit=self._sizeConverter.convert(dimCM,"cm",unit).roundedValue),unitDescription=sizeElement.siblings("span")[0].innerText,{dimInUnit,unitDescription}},new ProductCarousel}(jQuery),"ProductCarousel");__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.
23setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Preview){var UI;(function(){var QuantitySuggestController=function(_super){function QuantitySuggestController(){var _this=_super.call(this)||this;return _this.route("/cart/quantity/changed/:quantity",_this.selectQuantity),_this.route("/cart/quantity/update",_this.updateQuantity),_this.route("/validation/success/:result",_this.onValidation),_this}return __extends(QuantitySuggestController,_super),QuantitySuggestController.prototype.init=function(){this._quantitySuggest=application.getComponent("QuantitySuggest");this._quantitySuggest.init()},QuantitySuggestController.prototype.selectQuantity=function(event){var quantity=event.parameters.quantity;this._quantitySuggest.selectQuantity(quantity)},QuantitySuggestController.prototype.updateQuantity=function(){this._quantitySuggest.updateQuantity()},QuantitySuggestController.prototype.onValidation=function(event){var result=event.parameters.result.bool();this._quantitySuggest.onValidation(result)},QuantitySuggestController}(Controller),QuantitySuggest;application.addController(new QuantitySuggestController);QuantitySuggest=function(){function QuantitySuggest(){this.timeOut=500;this.timerId=0;this._isFormValid=!0}return QuantitySuggest.prototype.init=function(){var _this=this;this._$divQuantity=$("div.quantity");this._$quantitySelect=$(".div-quantity-sel");this._$quantitySuggest=$("div#quantity-suggest");this._$quantityElement=$("#span-quantity");this._$quantityInput=$("input#Quantity");
23this._$quantityDropdownForNewVariant=$(".cdo-dropdown-menu");this._productOptions=application.getComponent("ProductOptions",[]);this._$quantitySelect.on("click",function(){_this.showQuantitySuggest()});this._$divQuantity.on("mouseout",function(){var isTxtFocus=_this._$quantitySuggest.find("#txtQuantity").is(":focus");isTxtFocus||_this.closeQuantitySuggest()});this._$divQuantity.on("mouseover",function(){_this.cancelTimer()});this._$isRequestPending=!1},QuantitySuggest.prototype.showQuantitySuggest=function(){var _this=this,jxhr;if(this._isFormValid)if(this._$quantitySuggest.html().trim()!=="")this.setQuantitySuggestResponse();else{if(this._$isRequestPending)return;this._$isRequestPending=!0;jxhr=application.ajax({type:"post",dataType:"text",url:presets.getQuantitySuggestUrl,data:{tid:presets.tid,selectedOptionData:this._productOptions.getOptionsAsString()}});jxhr.done(function(result){_this._$quantitySuggest.html(result);_this.setQuantitySuggestResponse()});jxhr.always(function(){_this._$isRequestPending=!1})}},QuantitySuggest.prototype.ontxtQuantityKeyPress=function(event){var _this=this,quantity;event.keyCode===13&&(quantity=this._$txtQuantity.val(),this.syncQuantity(quantity,function(newQuantity){application.triggerApplicationEvent("/product/setquantity/"+newQuantity);_this.setDropdownValue(newQuantity)}),this._$quantitySuggest.hide(),event.preventDefault())},QuantitySuggest.prototype.selectQuantity=function(quantity){var _this=this;this.syncQuantity(quantity,function(newQuantity){application.triggerApplicationEvent("/product/setquantity/"+newQuantity);_this.setDropdownValue(newQuantity)});this._$quantitySuggest.hide()},QuantitySuggest.prototype.updateQuantity=function(){var _this=this,element=document.getElementById("btnFinalPreview"),quantity;element.disabled=!0;quantity=this._$txtQuantity.val();this.syncQuantity(quantity,function(newQuantity){application.triggerApplicationEvent("/product/setquantity/"+newQuantity);_this.setDropdownValue(newQuantity)});this._$quantitySuggest.hide()},QuantitySuggest.prototype.syncQuantity=function(quantity,callback){callback===void 0&&(callback=null);application.ajax({type:"post",dataType:"text",url:presets.syncQuantityUrl,data:{quantity:quantity,tid:presets.tid}}).done(function(q){callback&&callback(q)})},QuantitySuggest.prototype.closeQuantitySuggest=function(){var _this=this;this.timerId=window.setTimeout(function(){_this._$quantitySuggest.hide();_this.timerId=0},this.timeOut)},QuantitySuggest.prototype.cancelTimer=function(){clearTimeout(this.timerId);this.timerId=0},QuantitySuggest.prototype.onValidation=function(result){this._isFormValid=result},QuantitySuggest.prototype.setDropdownValue=function(newQuantity){$(".cdo-dropdown-menu").empty();$(".cdo-dropdown-menu").append("<option value="+newQuantity+">"+newQuantity+"<\/option>");$(".cdo-dropdown-menu").val(newQuantity);$(".cdo-dropdown-menu").trigger("change");$(".cdo-dropdown-menu").find("option:selected").attr("id","span-quantity")},QuantitySuggest.prototype.setQuantitySuggestResponse=function(){var _this=this,txtQuantityField;this._$quantityElement=$("#span-quantity");txtQuantityField=$("#txtQuantity");this._$txtQuantity=this._$quantitySuggest.find("#txtQuantity");this._$txtQuantity.val(Number(this._$quantityElement.text()));this._$txtQuantity.numeric({decimal:!1,negative:!1});this._$txtQuantity.on("keypress",function(event){_this.ontxtQuantityKeyPress(event)});this._$quantitySuggest.toggle(100);txtQuantityField.focus(function(){var value=txtQuantityField.val();txtQuantityField.val("").val(value)}).focus()},QuantitySuggest}();application.addComponent(new QuantitySuggest,"QuantitySuggest")})(UI=Preview.UI||(Preview.UI={}))}(Preview||(Preview={}));__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);
23d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Preview){var UI;(function(){var DesignObjectsController=function(_super){function DesignObjectsController(){var _this=_super.call(this)||this;return _this.route("/product/designobject/remove/:name",_this.deleteObject),_this}return __extends(DesignObjectsController,_super),DesignObjectsController.prototype.init=function(){this.desionObjects=application.getComponent("DesignObjects");this.desionObjects.init()},DesignObjectsController.prototype.deleteObject=function(event){var parameters=event.parameters;this.desionObjects.deleteObject(parameters.name)},DesignObjectsController}(Controller),DesignObjects;application.addController(new DesignObjectsController);DesignObjects=function(){function DesignObjects(){}return DesignObjects.prototype.init=function(){this.product=application.getModel("Product")},DesignObjects.prototype.selectTopDesignObject=function(){var designObjects=this.product.designObjectService.getAll().filter(function(designObject){return!designObject.hidden}),designObjectName;designObjects.length<1||(designObjectName=designObjects[designObjects.length-1].name,application.triggerApplicationEvent("/product/edit/select/canvas/"+designObjectName),application.triggerApplicationEvent("/product/edit/select/designObject/"+designObjectName))},DesignObjects.prototype.deleteObject=function(name){var _this=this,designObject=this.product.designObjectService.get(name),imgeSrc;if(this.product.previewRestriction.canUserDeleteThisDesignObject(designObject)){var deleteLayer=$("#md-deleteLayer").modal(function(){deleteLayer.find(".ok_btn_pop").off("click")}),$textForDelete=deleteLayer.find("#textToDelete"),$imageForDelete=deleteLayer.find("#imageToDelete").hide();designObject.type==="text"&&($textForDelete.html(designObject.text.value),$textForDelete.show(),$imageForDelete.hide());designObject.type==="image"&&(imgeSrc=this.getImageSrc(designObject.image.id),$imageForDelete.attr("src",imgeSrc),$imageForDelete.show(),$textForDelete.html(""),$textForDelete.hide());designObject.type==="montage"&&(imgeSrc=this.getImageSrc(designObject.montage.id),$imageForDelete.attr("src",imgeSrc),$imageForDelete.show(),$textForDelete.html(""),$textForDelete.hide());deleteLayer.find(".ok_btn_pop").on("click",function(){console.log("delete called: name : "+name);_this.product.fieldsService.incrementCurrentFieldVersion();$.tooltips("hide");application.triggerApplicationEvent("/product/edit/removeDesignObject/canvas/"+name);application.triggerApplicationEvent("/quality/display/fieldbyindex/{0}".format(_this.product.fieldsService.getCurrentEditableFieldId()));application.triggerApplicationEvent("/product/edit/updateView/accordion/"+name);application.triggerApplicationEvent("/product/edit/showloader/accordion/"+name);application.triggerApplicationEvent("/product/edit/loadField/false");application.triggerApplicationEvent("/product/edit/addimagestext/showhide");_this.selectTopDesignObject();_this.product.designObjectService.getCurrentThumbUrl(designObject);deleteLayer.closeModal();window.pushCreationStudioToGTM("Image & text tools tab: delete "+designObject.type)})}},DesignObjects.prototype.getImageSrc=function(designObjectId){var fileName=designObjectId,extension=fileName.substr(fileName.lastIndexOf(".")),isBelongTodesign;return(extension.toLowerCase()===".tiff"||extension.toLowerCase()===".tif")&&(fileName=fileName.replace(extension,".png")),isBelongTodesign=designObjectId&&designObjectId.indexOf("T@")>-1,isBelongTodesign?(fileName=fileName.replace("T@",""),presets.designerS3ThumUrl.format(fileName)):presets.s3ThumUrl.format(fileName)},DesignObjects}();application.addComponent(new DesignObjects,"DesignObjects")})(UI=Preview.UI||(Preview.UI={}))}(Preview||(Preview={}));__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);
23d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Preview){var UI;(function(UI){var DesignOnDesktopController=function(_super){function DesignOnDesktopController(){var _this=_super.call(this)||this;return _this.route("/product/designOnDesktop/sendlink",_this.sendLink),_this.route("/product/designOnDesktop/closepanel",_this.closepanel),_this.route("/product/designOnDesktop/hidemessage",_this.hidemessage),_this}return __extends(DesignOnDesktopController,_super),DesignOnDesktopController.prototype.init=function(){this.designOnDesktop=application.getComponent("DesignOnDesktop");this.designOnDesktop.init()},DesignOnDesktopController.prototype.sendLink=function(){this.designOnDesktop.sendEmail()},DesignOnDesktopController.prototype.closepanel=function(){this.designOnDesktop.closePanel()},DesignOnDesktopController.prototype.hidemessage=function(){this.designOnDesktop.hideSuccessfulMessage()},DesignOnDesktopController}(Controller),DesignOnDesktop;UI.DesignOnDesktopController=DesignOnDesktopController;application.addController(new DesignOnDesktopController);DesignOnDesktop=function(){function DesignOnDesktop(){}return DesignOnDesktop.prototype.init=function(){this.designActions=application.getComponent("DesignActions");this.designActions.init();this.$designOnDesktopPanel=$("#md-design_on_desktop")},DesignOnDesktop.prototype.sendEmail=function(){var regexp,self;if(!this.actionInProgress&&this.$designOnDesktopPanel){var emailElementFinder="#emailsendmelink",nameElementFinder="#namesendmelink",errorClassName="ui-state-error",name=this.$designOnDesktopPanel.find(nameElementFinder).val(),email=this.$designOnDesktopPanel.find(emailElementFinder).val();if(email=$.trim(email),name=$.trim(name),name.length>250||name.length<1)return $(nameElementFinder).addClass(errorClassName),!1;if($(nameElementFinder).removeClass(errorClassName),regexp=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,regexp.test(email))$(emailElementFinder).removeClass(errorClassName);else return $(emailElementFinder).addClass(errorClassName),!1;presets.Customer.Name=name;presets.Customer.Email=email;presets.Customer.LastName="";this.actionInProgress=!0;self=this;this.designActions.saveDesignDialogCallback(function(){self.closePanel();self.showSuccessfulMessage()})}},DesignOnDesktop.prototype.closePanel=function(){$(".better-on-desktop--outer").hide()},DesignOnDesktop.prototype.hideSuccessfulMessage=function(){$(".better-on-desktop--thankyou").hide()},DesignOnDesktop.prototype.showSuccessfulMessage=function(){$(".better-on-desktop--thankyou").show()},DesignOnDesktop}();UI.DesignOnDesktop=DesignOnDesktop;application.addComponent(new DesignOnDesktop,"DesignOnDesktop")})(UI=Preview.UI||(Preview.UI={}))}(Preview||(Preview={}));application.addController(function($,application){function ProductOptionsController(){this.route("/product/design/firstload",this.onProductDesignFirstLoad);this.route("/option/Sync",this.SyncOptions);this.route("/product/DropdownWithPopup/helppopup/:optionId/:optionName",this.helppopup);this.route("/product/option/templateoptionvalue/success",this.selectedfield);this.productOptions=null}return ProductOptionsController.prototype=new application.Controller,ProductOptionsController.prototype.init=function(){this.ProductOptions=application.getComponent("ProductOptions");
23presets&&(presets.productId.toString()==="75"||presets.productId.toString()==="2985")?$(self.wallpaperTypeHelpModal).show():$(self.wallpaperTypeHelpModal).hide()},ProductOptionsController.prototype.onProductDesignFirstLoad=function(){this.ProductOptions.onProductDesignFirstLoad()},ProductOptionsController.prototype.selectedfield=function(){this.ProductOptions.selectedfield()},ProductOptionsController.prototype.SyncOptions=function(){this.ProductOptions._productOptionsService.syncOptions()},ProductOptionsController.prototype.onBeforeProductDesignFirstLoad=function(){this.ProductOptions.onBeforeProductDesignFirstLoad()},ProductOptionsController.prototype.helppopup=function(){if(document.getElementById("contrado-wallpaper-details")){$("#contrado-wallpaper-details").show();$("body").addClass("wp-type-modal-open");return}$("body").addClass("wp-type-modal-open");$("head").append('<script type="text/javascript" src="/Scripts/WallpaperDetails/polyfills.js"><\/script>');$("head").append('<script type="text/javascript" src="/Scripts/WallpaperDetails/main.js"><\/script>');$("head").append('<link rel="stylesheet" href="/Scripts/WallpaperDetails/styles.css" type="text/css" />');const productId=presets.productId.toString()==="2985"?"75":presets.productId.toString(),modalHeader=presets.wallpaperTypeTitle;this.popupElement=document.createElement("contrado-wallpaper-details");this.popupElement.setAttribute("id","contrado-wallpaper-details");this.popupElement.setAttribute("product-id",productId);this.popupElement.setAttribute("is-modal-open","true");this.popupElement.setAttribute("wallpaper-type-title",modalHeader);this.popupElement.addEventListener("onSelectWallpaperId",event=>{const selectedValue=event&&event.detail;selectedValue&&this.ProductOptions.selectWallpaperTypeOptionValue(selectedValue);this.ProductOptions.hideWallpaperDetails()});let self=this;$(document).keyup(function(e){e.key==="Escape"&&self.ProductOptions.hideWallpaperDetails()});setTimeout(()=>{$("#wallpaper-details-container").append(this.popupElement)},100)},new ProductOptionsController}(jQuery,window.application));application.addComponent(function($){function ProductOptions(){this._$fopt=null;this._guestbooksizeclass=null;this._BoxandtinOptionclass=null;this._options=null;this._optionFactory=null;this._selectExtns=null;this._validationService=null;this._productOptionsService=null;this._fieldsService=null;this._isUpdatePending=!1;this._sizeConverter=null;this._updateCurrentFieldIndex=!1}return ProductOptions.prototype.selectedfield=function(){if(this._updateCurrentFieldIndex===!0){var selectedName=this._fieldsService.root.productDesign.fields;selectedName.forEach((field,index)=>{field.name==="Back Message"&&(this._fieldsService.setCurrent(index),setTimeout(()=>{$("a[href='#tab-accordion']").click(),setTimeout(()=>{$("#tab-accordion").find("textarea").first().focus()},200)},100))})}},ProductOptions.prototype.init=function(){var self=this,optionElement;return self._$fopt=$("#fopt"),self._options=[],self._optionFactory=new OptionComponentLib.OptionFactory(self),self._validationService=application.getModel("ValidationService"),self._productOptionsService=application.getModel("Options"),this._selectExtns=application.getComponent("SelectExtns").init(),this._fieldsService=application.getModel("Product").fieldsService,self._sizeConverter=new Utils.SizeConverter,this.productCart=application.getComponent("ProductCart",[]),self._$fopt.find("div.DdlStyleOpt").each(function(){var option=self._optionFactory.create($(this));option.init();self._options.push(option)}),presets.systemName==="Canvas"&&(optionElement=$("#optId-CanvasSizeUnits"),self.wrapElements(optionElement)),self.InitHemOpt(),this._$btnLoadingInsideButton=$(".loading-inside-btn"),this},ProductOptions.prototype.onSelectedOptionChange=function($optionElement,$optionValueElement,autoSelect){var self=this,funcRaiseEvent,modifiedOption,btnFinalPreview,OptId;window.isDirty=!0;JL().info("The Last change: {0} ::: All other Options are set on: {1}".format(self.getOptionSelectedOptionName($optionValueElement),this.getOptionsNameAsString()));self.OnchangeHemOpt($optionElement,$optionValueElement);funcRaiseEvent=function(){self.raiseOnChangeEvent($optionElement)};self.triggerOptionEvent($optionElement,$optionValueElement);modifiedOption=_.find(self._options,function(option){return option.getOptionElement()===$optionElement});modifiedOption&&!modifiedOption.isPreviewAffected()&&modifiedOption.isPackagingProduct()||self._selectExtns.run($optionElement,$optionValueElement,funcRaiseEvent,autoSelect);modifiedOption&&!modifiedOption.isPreviewAffected()&&(modifiedOption.isPackagingProduct()?(presets.loadingTemplate=!0,btnFinalPreview=$("#btnFinalPreview"),btnFinalPreview.length>0&&btnFinalPreview.prop("disabled",!0),self._productOptionsService.syncOptionsPP().then(()=>{self._selectExtns.run($optionElement,$optionValueElement,funcRaiseEvent,autoSelect)}).catch(err=>{console.error(err)}).finally(()=>{presets.loadingTemplate=!1,btnFinalPreview.prop("disabled",!1),application.triggerApplicationEvent("/product/edit/hidepreviewloader/optionchange")})):self._productOptionsService.syncOptions());
23OptId=$optionValueElement.context.id;(presets.productId=="293"&&OptId=="a-1859"||OptId=="a-1860"||OptId=="a-1861"||OptId=="a-1862"||OptId=="a-1873")&&$("#a-3004, #a-3005, #a-3006").show()},ProductOptions.prototype.loadOptionValueDetails=function(optionId,optionValueId){window.isDirty=!0;var self=this;optionValueId&&$.ajax({url:"/estore/PreviewHelp/OptionValueDetails",type:"GET",data:{optionValueId:optionValueId},success:function(result){result&&self.showOrHideOnSelection(optionId,result)}})},ProductOptions.prototype.InitHemOpt=function(){var self=this;let $fabOpts=self.getBaseOptByHemOption();$fabOpts.forEach($fabOpt=>{if($fabOpt!=null){let selectedId,hemOptType=self.getBaseOptPreviewType($fabOpt);switch(hemOptType){case"Dropdown":selectedId=$fabOpt.find("option:selected").val();self.loadOptionValueDetails($fabOpt.attr("data-opt-id"),selectedId);break;case"Icons":selectedId=$fabOpt.find("span.selected").attr("data-optvalue");this.loadOptionValueDetails($fabOpt.attr("data-opt-id"),selectedId)}}})},ProductOptions.prototype.OnchangeHemOpt=function($optionElement,$optionValueElement){var self=this;if(self.isHemOption($optionElement)){let $fabOpts=self.getBaseOptByHemOption();
23$fabOpts.forEach($fabOpt=>{let hemOptType=self.getBaseOptPreviewType($fabOpt),optid=0;hemOptType=="Dropdown"&&parseInt($optionValueElement.val())>0&&$fabOpt.find(`option[value=${$optionValueElement.val()}]`).length>0?optid=parseInt($optionValueElement.val()):hemOptType=="Icons"&&$fabOpt.attr("data-opt-id")==$optionElement.attr("data-opt-id")&&(optid=parseInt($optionValueElement.find("span").attr("data-optvalue")));optid>0&&self.loadOptionValueDetails($fabOpt.attr("data-opt-id"),optid)})}},ProductOptions.prototype.showOrHideOnSelection=function(optionId,data){var self=this;let hemOptions=this.getChildHemOption(optionId);if(!hemOptions||!hemOptions.length){window.isDirty=!1;return}let OptionSelectresult;data.OptionValueOptionValue&&(OptionSelectresult=data.OptionValueOptionValue.split("|"));for(const hemOption of hemOptions){let hemOptType=self.getBaseOptPreviewType(hemOption);switch(hemOptType){case"Dropdown":this.toggleHemDropdownOption(hemOption,OptionSelectresult);break;case"Icons":this.toggleHemIconsOption(hemOption,OptionSelectresult);break;default:window.isDirty=!1}}},ProductOptions.prototype.triggerOptionEvent=function($optionElement,$optionValueElement){var optionValueSystemName=$optionValueElement.data("systemname"),optionSystemName=$optionElement.data("systemname"),eventName="/option/select/";optionSystemName&&(eventName+=optionSystemName,optionValueSystemName&&(eventName+="/"+optionValueSystemName),application.triggerApplicationEvent(eventName))},ProductOptions.prototype.wrapElements=function($optionElement){for(var value,wrapElement,widthCanvasElements,j,val,dropCanvasElements,k,v,widthCanvas,dropCanvas,wrapElements=[],i=0;i<$optionElement.parent().children().length;i++)value=$optionElement.parent().children()[i],value.hasAttribute("data-systemname")&&value.attributes["data-systemname"].value.indexOf("CanvasPrintsOptions")!==-1&&wrapElements.push(value);if(wrapElements.length>0){for(wrapElement=wrapElements[0],widthCanvasElements=[],j=0;j<$optionElement.parent().children().length;j++)val=$optionElement.parent().children()[j],val.hasAttribute("data-systemname")&&val.attributes["data-systemname"].value.indexOf("Width(X,horizontal)")!==-1&&widthCanvasElements.push(val);for(dropCanvasElements=[],k=0;k<$optionElement.parent().children().length;k++)v=$optionElement.parent().children()[k],v.hasAttribute("data-systemname")&&v.attributes["data-systemname"].value.indexOf("Drop(Y,vertical)")!==-1&&dropCanvasElements.push(v);widthCanvas=widthCanvasElements[0].children.Options;dropCanvas=dropCanvasElements[0].children.Options;parseInt(widthCanvas.value)>42&&parseInt(dropCanvas.value)>14?(wrapElement.style.display="none",$("#"+wrapElement.id).find("span.selected").removeClass("selected"),$("#"+wrapElement.id+" div a span:last").attr("class","selected"),this._fieldsService.getAll().length&&this._fieldsService.addAttribute("wrapcolor","FFFFFF")):(wrapElement.style.display==="none"&&($("#"+wrapElement.id).find("span.selected").removeClass("selected"),$("#"+wrapElement.id+" div a span:first").attr("class","selected"),this._fieldsService.getAll().length&&this._fieldsService.removeAttributeByIndex(0,"wrapcolor")),wrapElement.style.display="inline-block")}},ProductOptions.prototype.raiseOnChangeEvent=function($optionElement){var self=this;if(this._$btnLoadingInsideButton.removeClass("hide-loader"),$optionElement.data("skipPostBack")){$optionElement.removeData("skipPostBack");return}presets.isAuthorizedOrder&&presets.Mode=="CustomerEditingOrder"||(presets.systemName==="Canvas"&&self.wrapElements($optionElement),$.when(self._validationService.validate()).done(function(result){if(application.triggerApplicationEvent("/design/history/clear"),self._isUpdatePending=self._isUpdatePending?!0:result?!1:$optionElement.data("previewAffected")==="True",self.productCart.isValidPrice=!1,self._updateCurrentFieldIndex=!1,$optionElement.data("systemname")==="UrlonBack"&&(presets.productId==2946||presets.productId==130||presets.productId==2947||presets.productId==317||presets.productId==1488)){let opts=[];opts=self.getOptionsAsString().split(",");for(let i=0;i<opts.length;i++)opts[i].search("bas-66")>-1&&(opts[i].search(":1041")>-1||opts[i].search(":1021")>-1)&&(self._updateCurrentFieldIndex=!0)}result&&($optionElement.data("previewAffected")==="True"||self._isUpdatePending||presets.isBulkFabric&&$optionElement.data("systemname")=="FabricSizeUnit"&&self._fieldsService.getAll().length>1)?(presets.tmplChanged=!0,self._isUpdatePending=!1,application.triggerApplicationEvent("/product/loadProductDesign/false")):application.triggerApplicationEvent("/product/refreshPrice")}))},ProductOptions.prototype.onProductDesignFirstLoad=function(){presets.Mode==="CustomerBuyingProduct"&&this.triggerOptionsEvents();for(var i=0;i<this._options.length;i++)this._options[i].onProductDesignFirstLoad();application.triggerApplicationEvent("/product/edit/addimagestext/showhide")},ProductOptions.prototype.triggerOptionsEvents=function(){for(var option,j,childOption,i=0;i<this._options.length;i++)if(option=this._options[i],option.childOptions)for(j=0;j<option.childOptions.length;j++)childOption=option.childOptions[j],this.triggerOptionEvent(childOption.getOptionElement(),childOption.getSelectedOptionValueElement());else this.triggerOptionEvent(option.getOptionElement(),option.getSelectedOptionValueElement())},ProductOptions.prototype.getOptionsAsString=function(){for(var scarf,selectedoptionvalue,data=[],i=0;i<this._options.length;i++)this._options[i].isUiOnly()||this._options[i].isPackagingProduct()||(scarf=this._options.filter(x=>x.systemName=="ScarfOrWrapSize"),selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&presets.productId==331&&this._options[i].systemName=="Add2PocketSquare"?$("#optId-Add2PocketSquare")&&scarf.length>0&&scarf[0].getSelectedOptionValue()=="1964"&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue()):(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue())));return data.join(",")},ProductOptions.prototype.getOptionsAsStringWithOverrideValues=function(overrideDetails){for(var scarf,overrideOption,selectedoptionvalue,data=[],i=0;i<this._options.length;i++)if(!this._options[i].isUiOnly()&&!this._options[i].isPackagingProduct()){scarf=this._options.filter(x=>x.systemName=="ScarfOrWrapSize");selectedoptionvalue=this._options[i].getSelectedOptionValue();let optionId=0;this._options[i]._optId.includes("-")&&(optionId=this._options[i]._optId.split("-")[1]);overrideDetails||(overrideDetails=[]);overrideOption=overrideDetails.find(f=>f.optionId==optionId);
23overrideOption?data.push(this._options[i]._optId+":"+overrideOption.optionValueId):selectedoptionvalue&&presets.productId==331&&this._options[i].systemName=="Add2PocketSquare"?$("#optId-Add2PocketSquare")&&scarf.length>0&&scarf[0].getSelectedOptionValue()=="1964"&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue()):(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue()))}return data.join(",")},ProductOptions.prototype.getProductPackagingOptionsAsString=function(){for(var selectedoptionvalue,data=[],i=0;i<this._options.length;i++)!this._options[i].isUiOnly()&&this._options[i].isPackagingProduct()&&(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&data.push(this._options[i]._optId.split("-")[0]+"-"+this._options[i].getSelectedOptionValue()));return data.join(",")},ProductOptions.prototype.getProductPackagingsIdAsString=function(){for(var selectedProductPackagingsId,data=[],i=0;i<this._options.length;i++)!this._options[i].isUiOnly()&&this._options[i].isPackagingProduct()&&(selectedProductPackagingsId=this._options[i].getSelectedProductPackagingsId(),selectedProductPackagingsId&&data.push(selectedProductPackagingsId));return data.join(",")},ProductOptions.prototype.getPackagingProductId=function(){for(var i=0;i<this._options.length;i++)if(!this._options[i].isUiOnly()&&this._options[i].isPackagingProduct())return this._options[i].getSelectedPackagingProductId();return""},ProductOptions.prototype.getOptionsNameAsString=function(){for(var optionValueName,data=[],i=0;i<this._options.length;i++)optionValueName=this.getOptionSelectedOptionName(this._options[i].getSelectedOptionValueElement()),data.push(optionValueName);return data.join(" | ")},ProductOptions.prototype.getOptionSelectedOptionName=function(selectedOptionValueElement){if(!selectedOptionValueElement||selectedOptionValueElement.length===0)return"";var titleOrText=selectedOptionValueElement.text();return selectedOptionValueElement[0].tagName==="SPAN"&&(titleOrText=selectedOptionValueElement.prop("title"),titleOrText=titleOrText.replace("\n"," ")),selectedOptionValueElement[0].tagName==="INPUT"&&(titleOrText=selectedOptionValueElement[0].getAttribute("data-systemname")),titleOrText},ProductOptions.prototype.getAffectedOptionsAsString=function(){for(var selectedoptionvalue,data=[],i=0;i<this._options.length;i++)this._options[i].isPreviewAffected()&&(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue()));return data.join(",")},ProductOptions.prototype.getTweakableAffectedOptionsAsString=function(){for(var selectedoptionvalue,data=[],i=0;i<this._options.length;i++)this._options[i].isPreviewAffected()&&(this._options[i]._optId=="bas-"+presets.TweakOptionValue?data.push(this._options[i]._optId+":"+this._options[i].getLastOptionValueForTweakable()):(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue&&data.push(this._options[i]._optId+":"+this._options[i].getSelectedOptionValue())));return data.join(",")},ProductOptions.prototype.getAffectedOptionsAsArray=function(){for(var selectedoptionvalue,data=[],i=0;i<this._options.length;i++)if(this._options[i].isPreviewAffected()&&(selectedoptionvalue=this._options[i].getSelectedOptionValue(),selectedoptionvalue)){var optionId=parseInt(this._options[i]._optId.split("-")[1]),optionValueId=parseInt(this._options[i].getSelectedOptionValue()),obj={selectedOptionId:optionId,selectedOptionValueId:optionValueId};data.push(obj)}return data},ProductOptions.prototype.getOptions=function(){var self=this;return self._options},ProductOptions.prototype.getChildHemOption=function(baseOptId){let optList=this.getHemOptions(),opts=optList.find(f=>f.baseOpt._optId==baseOptId);return opts&&opts.baseOpt!=undefined&&opts.childOpt.length?opts.childOpt.map(copt=>$(`[data-opt-id=${copt._optId}`)):[]},ProductOptions.prototype.isHemOption=function($currentOption){if(this._options==undefined||this._options.length==0)return!1;let optList=this.getHemOptions();return optList.find(opts=>opts.baseOpt==undefined||!opts.childOpt.length?!1:opts.baseOpt._optId==$currentOption.attr("data-opt-id")?!0:void 0)},ProductOptions.prototype.getBaseOptByHemOption=function(){if(this._options==undefined||this._options.length==0)return[];let baseOpts=[],optList=this.getHemOptions();return optList.forEach(opts=>{opts.baseOpt!=undefined&&opts.childOpt.length&&baseOpts.push($(`div.DdlStyleOpt.${opts.baseOpt._optId}`))}),baseOpts},ProductOptions.prototype.getHemOptions=function(){let baseOpt={};var self=this,hemFabOptMappingIds=self.mapHemOptArray();return hemFabOptMappingIds.length>0&&jQuery.each(hemFabOptMappingIds,(index,ele)=>{let objbaseOpt=self._options.find(x=>x._optId.replace("bas-","")==ele[0]);if(objbaseOpt!=undefined){baseOpt[ele[0]]||(baseOpt[ele[0]]={baseOpt:objbaseOpt,childOpt:[]});let objchildOpt=self._options.find(x=>x._optId.replace("bas-","")==ele[1]);objchildOpt!=undefined&&baseOpt[ele[0]].childOpt.push(objchildOpt)}}),Object.values(baseOpt)},ProductOptions.prototype.mapHemOptArray=function(){var disabledoptionsDict=[],result;
23return presets.hemFabricOptionMappingId!=null&&(result=presets.hemFabricOptionMappingId.split(",").map(function(item){return[parseInt(item.split("-")[0]),parseInt(item.split("-")[1])]}),disabledoptionsDict=result),disabledoptionsDict},ProductOptions.prototype.toggleHemIconsOption=function(hemOption,optionSelectresult){var packagingproduct,packagingOption,selecteditem;hemOption.show();hemOption.find(".optionvalue-icon").show();optionSelectresult!=undefined&&optionSelectresult!=null&&(optionSelectresult.forEach(item=>$(`#span-${item}`).parent().hide()),hemOption.length>=2&&(packagingproduct=hemOption[0].getAttribute("data-packaging-product"),packagingproduct&&packagingproduct.toLowerCase()=="true"&&(packagingOption=hemOption[0].getAttribute("data-opt-id"),packagingOption&&(packagingOption=packagingOption.replace("bas","span"),optionSelectresult.forEach(item=>{const element=document.getElementById(`${packagingOption}:${item}`);element&&$(element).parent().hide()})))));selecteditem=hemOption.find(".optionvalue-icon span.selected").attr("data-optvalue");let isFirstItemNeedToClick=!0;selecteditem?(hemOption.find(".optionvalue-icon span").each(function(index,item){$(item).is(":visible")&&$(item).data("optvalue")==selecteditem&&(isFirstItemNeedToClick=!1)}),isFirstItemNeedToClick&&hemOption.find(".optionvalue-icon:has(span:visible)").first().click()):hemOption.find(".optionvalue-icon span:visible").length!=0&&hemOption.find(".optionvalue-icon:has(span:visible)").first().click();hemOption.find(".optionvalue-icon span:visible").length==0&&(hemOption.find(".optionvalue-icon span.selected").removeClass("selected"),hemOption.hide(),this._productOptionsService.syncOptions(),this.raiseOnChangeEvent(hemOption))},ProductOptions.prototype.toggleHemDropdownOption=function(hemOption,optionSelectresult){(hemOption.find("option").show(),optionSelectresult)&&($.each(optionSelectresult,function(index,values){hemOption.find(`option[value=${values}]`).hide().attr("selected",!1)}),hemOption.find("option").each(function(){if(this.value&&hemOption.find(`option[value=${this.values}]`).css("display")!=="none")return hemOption.find(`option[value=${this.values}]`).attr("selected","selected"),!1}),window.isDirty=!1)}
23,ProductOptions.prototype.getBaseOptPreviewType=function($fabOpt){let type=$fabOpt.attr("data-preview-type");return(type=="DropDownWithPopup"||type=="SearchableDropdown")&&(type="Dropdown"),type},ProductOptions.prototype.selectWallpaperTypeOptionValue=function(selectedValue){const $optionElement=$(`[data-opt-name="Wallpaper Type"]`),$dropdown=$optionElement.find("select");if($dropdown.length>0){$dropdown.val(selectedValue).trigger("change");const selectedOption=$dropdown.find(`option[value='${selectedValue}']`);if(selectedOption.length)this.onSelectedOptionChange($optionElement,selectedOption,!0)}else{const $targetSpan=$optionElement.find(`span[data-optvalue="${selectedValue}"]`);if($targetSpan.length>0){$optionElement.find("span.selected").removeClass("selected");$targetSpan.addClass("selected");this.onSelectedOptionChange($optionElement,$targetSpan,!0)}}this.hideWallpaperDetails()},ProductOptions.prototype.hideWallpaperDetails=function(){$("#contrado-wallpaper-details").hide();$("body").removeClass("wp-type-modal-open")},ProductOptions.prototype.getOptionOptionValuesArray=function(){for(var opt,selectedValue,optionId,self=this,options=self.getOptions(),mappedOptions=[],i=0;i<options.length;i++)if((opt=options[i],!opt.isUiOnly||!opt.isUiOnly())&&(!opt.isPackagingProduct||!opt.isPackagingProduct())){var $el=opt.getOptionElement(),el=$el&&$el[0],isHiddenOption=el&&el.classList.contains("Hidden");if(!isHiddenOption&&(selectedValue="",optionId=null,opt._optId&&opt._optId.indexOf("-")!==-1&&(optionId=opt._optId.split("-")[1]),selectedValue=opt._optId==="bas-"+presets.TweakOptionValue?opt.getLastOptionValueForTweakable():opt.getSelectedOptionValue(),selectedValue)){var selectedElement=opt.getSelectedOptionValueElement(),selectedText=selectedElement?self.getOptionSelectedOptionName(selectedElement):"",optionName=$el.attr("data-opt-name")||$el.attr("data-systemname")||opt.systemName||$el.closest(".DdlStyleOpt").find("h3, h4").first().text().trim();optionName=optionName||"Option-"+optionId;console.log({systemName:opt.systemName,label:$el.find("label").first().text().trim(),h3:$el.closest(".DdlStyleOpt").find("h3, h4").first().text().trim(),dataName:$el.attr("data-opt-name"),selected:selectedText});mappedOptions.push({optionId:optionId,optionName:optionName,optionValueId:selectedValue,optionValue:selectedText})}}return mappedOptions},new ProductOptions}(jQuery),"ProductOptions");application.addComponent(function($){function SelectExtns(){this._fieldService=null}var SELECTED_EXTN="selectExtn",lastColor="000000";return SelectExtns.prototype.init=function(){return this._fieldService=application.getModel("Product").fieldsService,this},SelectExtns.prototype.setInitialState=function($optionElement,selectExtn,callback){switch(selectExtn){case"setWrapColor":this.setWrapColor_Init($optionElement,callback)}},SelectExtns.prototype.run=function($element,$selectedElement,callback,autoSelect){var selectExtns=[],i;if($element.data(SELECTED_EXTN)&&selectExtns.push($element.data(SELECTED_EXTN)),$selectedElement.data(SELECTED_EXTN)&&selectExtns.push($selectedElement.data(SELECTED_EXTN)),selectExtns.length!==0)for(i=0;i<selectExtns.length;i++)this.runSelectExtn(selectExtns[i],$element,$selectedElement,callback,autoSelect);else callback()},SelectExtns.prototype.runSelectExtn=function(selectExtn,$element,$selectedElement,callback,autoSelect){switch(selectExtn){case"setWrapColor":this.setWrapColor($element,$selectedElement,callback,!1,autoSelect);break;case"removeColorSpan":this._fieldService.removeAttributeByIndex(0,"wrapcolor");this.removeColorSpan($element,$selectedElement,callback);break;case"setUnitIn":this.setUnitIn();break;case"setUnitCm":this.setUnitCm();break;default:console.log("Unknown selectExt : "+selectExtn);this._fieldService.removeAttributeByIndex(0,"wrapcolor")}},SelectExtns.prototype.setWrapColor_Init=function($optionElement,callback){this.setWrapColor($optionElement,null,callback,!0)},SelectExtns.prototype.setWrapColor=function($element,$selectedElement,callback,noAutoOpen,autoSelect){var self=this,selectedColor;$element.data(SELECTED_EXTN)||$element.data(SELECTED_EXTN,"removeColorSpan");selectedColor=self._fieldService.getAttributeByIndex(0,"wrapcolor")||lastColor;self._fieldService.addAttributeByIndex(0,"wrapcolor",selectedColor);var chooseButtonText=$(application.getFromTemplate($("#colorpicker-choosecolor"),{templateData:{}})),cancelButtonText=$(application.getFromTemplate($("#colorpicker-cancelcolorselection"),{templateData:{}})),data={change:function(vl){lastColor=vl;self._fieldService.addAttributeByIndex(0,"wrapcolor",vl||"000000");callback()},close:function(){callback()},templateData:{selectedHex:selectedColor,disabledCopyDesign:!0},chooseText:chooseButtonText[0].innerHTML,cancelText:cancelButtonText[0].innerHTML};
23application.getComponent("BgColorPicker",[]).init(data,$(".color-picker-color-wrap")).render();noAutoOpen||autoSelect||callback();autoSelect&&callback()},SelectExtns.prototype.setUnitIn=function(){var self=this;$("#fopt").find("select.preview-product-option option[data-unitvalue]").each(function(){var unitvalue=$(this).attr("data-unitvalue");$(this).text(unitvalue.split("-")[0])});application.triggerApplicationEvent("ruler/switchTo/inch")},SelectExtns.prototype.setUnitCm=function(){var self=this;$("#fopt").find("select.preview-product-option option[data-unitvalue]").each(function(){var unitvalue=$(this).attr("data-unitvalue");$(this).text(unitvalue.split("-")[1])});application.triggerApplicationEvent("ruler/switchTo/cm")},SelectExtns.prototype.removeColorSpan=function($element,$selectedElement,callback){$element.parent().find(".sp-replacer.sp-light.full-spectrum").hide();callback()},new SelectExtns}(jQuery),"SelectExtns");application.addComponent(function($){function ImageDropDownOptions(){this._el=null}return ImageDropDownOptions.prototype.init=function(){return this._el=$("select.Imgdd").msDropDown({rowHeight:100}),this},new ImageDropDownOptions}(jQuery),"ImageDropDownOptions");application.addController(function($,application){function GalleryController(){this.route("/gallery/init/",this.galleryInit);this.route("/gallery/addSelectedImages",this.addSelectedImages);this.route("/gallery/openAIEditorForImageSelect/:imagename",this.openAIEditorForImageSelect);application.postbox.subscribe(this.queueUpload,this,"queueUpload");application.postbox.subscribe(this.uploadFinished,this,"uploadFinished");application.postbox.subscribe(this.replaceImage,this,"replaceImage")}return GalleryController.prototype=new application.Controller,GalleryController.prototype.init=function(){this.galleryViewModel=application.getViewModel("GalleryViewModel")},GalleryController.prototype.addSelectedImages=function(){this.galleryViewModel.addimagesToDesign()},GalleryController.prototype.load=function(){this.galleryViewModel.CalculateMaxNumberOfImages()},GalleryController.prototype.galleryInit=function(){this.galleryViewModel.init();this.route("/product/edit/loadField/:forceLoad",this.load);this.route("/gallery/checkforusedimages/",this.checkforusedimages);ko.applyBindings(this.galleryViewModel,$("#GalleryContainer")[0]);ko.applyBindings(this.galleryViewModel,$("#md-deleteSelectedImages")[0]);
23application.LazyImage("image_container_class","scrollable-bg")},GalleryController.prototype.queueUpload=function(model){this.galleryViewModel.queueUpload(model)},GalleryController.prototype.checkforusedimages=function(){this.galleryViewModel.CheckForUsedImages()},GalleryController.prototype.uploadFinished=function(uploadFinishedModel){this.galleryViewModel.uploadFinished(uploadFinishedModel)},GalleryController.prototype.replaceImage=function(replaceImageParam){this.galleryViewModel.replaceImage(replaceImageParam)},GalleryController.prototype.openAIEditorForImageSelect=function(obj){this.galleryViewModel.openAIEditorForImageSelect(obj.parameters.imagename,!1)},new GalleryController}(jQuery,window.application));application.addViewModel(function($,application){function GalleryViewModel(){this.GalleryModes={MultiImage:0,SingleImage:1,Text:2}}function GalleryImageModel(galleryPresets,galleryImage,setAlert){var self=this;self.imageId=ko.observable(galleryImage.ImageName);self.width=galleryImage.Width;self.height=galleryImage.Height;self.size=galleryImage.FileSize;self.clientFileName=galleryImage.ClientFileName;self.uploadSource=galleryImage.UploadSource;self.plUploadviewModel=application.getViewModel("PluploadViewModel");self.selected=ko.observable(!1);self.usedInDesign=ko.observable(!1);self.thumbSource=ko.computed(function(){var fileName=this.imageId(),extension;if(fileName!=undefined&&fileName!=null)return extension=fileName.substr(fileName.lastIndexOf(".")),(extension.toLowerCase()==".tiff"||extension.toLowerCase()==".tif")&&(fileName=fileName.replace(extension,".png")),fileName=fileName.replace(".","_100."),galleryPresets.s3ThumUrl.format(fileName)},this);self.originalThumb=ko.computed(function(){var fileName=this.imageId(),extension;if(fileName!=undefined&&fileName!=null)return extension=fileName.substr(fileName.lastIndexOf(".")),(extension.toLowerCase()==".tiff"||extension.toLowerCase()==".tif")&&(fileName=fileName.replace(extension,".png")),galleryPresets.s3ThumUrl.format(fileName)},this);self.IsRemoving=ko.observable(!1);self.isImageSmall=!1;galleryImage.FileSize&&(self.isImageSmall=galleryImage.FileSize<presets.minImageUploadSize);self.ShowSmallChoice=ko.observable(self.isImageSmall&&setAlert);self.presets=galleryPresets;self.info=ko.observable("");self.isMenuOpen=ko.observable(!1);self.updateInfo()}return GalleryViewModel.prototype.init=function(){var self=this,selectedImages;self._presets=application.getObject("GalleryPresets");self.imageGallery=application.getComponent("ImageGallery");self.uploadQueueModel=application.getModel("UploadQueueModel");self.product=application.getModel("Product");self.montageService=application.getModel("MontageService");self.designObjects=application.getComponent("DesignObjects");self.plUploadviewModel=application.getViewModel("PluploadViewModel");self.galleryId=self._presets.galleryId;self.galleryImages=ko.observableArray(ko.utils.arrayMap(self._presets.galleryImages,function(item){return new GalleryImageModel(self._presets,item)}));self.filteredGalleryImages=ko.computed(function(){return ko.utils.arrayFilter(self.galleryImages(),function(item){return item.uploadSource!=="AISticker"})});self.instructionText=ko.computed(function(){return self.galleryImages().length>0?"":self._presets.useGreenBtnMessage});selectedImages=_.filter(self.galleryImages(),function(image){return image.selected()});self.SelectedCount=ko.observable(selectedImages.length);self.repeatedImageCount=ko.observable({add:0,remove:0,show:!1});self.showUsedImageButton=ko.observable(!1);self.showMaxNumberForDIYMontage=ko.observable(!1);self.MaxNumberOfImages=ko.observable();self.ShowMissingImageAlert=ko.observable(!1);self.CalculateMaxNumberOfImages();self.CheckForUsedImages();self.mode=ko.observable(this.GalleryModes.SingleImage);self.isSelectAll=ko.observable(!1);self.aiEditorListners();self.aiEditorTabActive=ko.observable(!1)},GalleryViewModel.prototype.GetAllImages=function(){var self=this;return self.galleryImages()},GalleryViewModel.prototype.ResetAlerts=function(){var self=this;self.showMaxNumberForDIYMontage(!1);self.repeatedImageCount({add:0,remove:0,show:!1});self.ShowMissingImageAlert(!1)},GalleryViewModel.prototype.UpdateRepeatedImageCount=function(styleId){this.ResetAlerts();this.montageService.CalculateAlerts(styleId);var ss=this.repeatedImageCount()},GalleryViewModel.prototype.CheckForUsedImages=function(){var self=this,i;if(self.galleryImages().length<5){self.showUsedImageButton(!1);return}for(i=0;i<self.product.productDesign.fields.length;i++)if(self.product.designObjectService.hasCustomImages(self.product.productDesign.fields[i])){self.showUsedImageButton(!0);return}self.showUsedImageButton(!1)},GalleryViewModel.prototype.setOrRemoveUsedFlag=function(){var self=this,usedImages,i,j,dO,k;if(application.triggerApplicationEvent("/track/event/Upload/UsedImage"),_.find(self.galleryImages(),function(image){return image.usedInDesign()===!0})){self.removeUsedFlag();return}for(usedImages=[],i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++){dO=self.product.productDesign.fields[i].editablefield.designobjects[j];switch(dO.type){case"image":usedImages.push(dO.image.id);break;case"montage":for(k=0;k<dO.montage.Images.length;k++)usedImages.push(dO.montage.Images[k].Name)}}_.each(self.galleryImages(),function(image){_.find(usedImages,function(name){return name===image.imageId()})&&image.usedInDesign(!0)})},GalleryViewModel.prototype.removeUsedFlag=function(){var self=this;_.each(self.galleryImages(),function(image){image.usedInDesign&&image.usedInDesign(!1)})},GalleryViewModel.prototype.ShowMaxNumberInGallery=function(){var self=this;return self.MaxNumberOfImages()>1&&self.MaxNumberOfImages()<100},GalleryViewModel.prototype.ShowMaxNumberInMontage=function(){var self=this;return self.MaxNumberOfImages()>1&&self.MaxNumberOfImages()<100&&self.SelectedCount()>self.MaxNumberOfImages()&&!self.showMaxNumberForDIYMontage()},GalleryViewModel.prototype.CalculateMaxNumberOfImages=function(){var self=this,minSize=self.product.productDesign.minsize;if(minSize===null||minSize===0)return 0;minSize=Math.round(minSize*self.product.productDesign.printq/25.4);var field=self.product.fieldsService.getCurrent(),mask=self.montageService.SetBleed({},field,Math.max(field.printw,field.printh)),aperture=self.product.fieldsService.getAperture(),designw=Math.round(aperture.width*field.printw*field.editablefield.width),designh=Math.round(aperture.height*field.printh*field.editablefield.height),columns=parseInt(Math.floor((designw-mask.bleedE-mask.bleedW)/(minSize*1.33))),rows=parseInt(Math.floor((designh-mask.bleedN-mask.bleedS)/minSize));self.MaxNumberOfImages(parseInt(columns*rows))},GalleryViewModel.prototype.selectMax=function(image,self){for(var self=this,i=0;i<self.MaxNumberOfImages();i++)self.galleryImages()[i].selected(!0);application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram")},GalleryViewModel.prototype.removeImage=function(image,self,removingSmallImage){var removeImageUrl,designobjectsNames,j,dO,i;for(self.SelectedCount(0),image.IsRemoving(!0),removeImageUrl=self._presets.removeImageUrl.format(image.imageId()),removingSmallImage&&application.triggerApplicationEvent("/track/event/Upload/RemovingSmallImage"),$.post(removeImageUrl,application.addAdditionalData({}),function(){pushCreationStudioToGTM("Delete image");self.galleryImages.remove(image);self.filteredGalleryImages().length==0&&application.triggerApplicationEvent("/plupupload/init/false")}),designobjectsNames=[],i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="image"&&dO.image.id==image.imageId()&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="montage"&&dO.montage.Images.filter(m=>m.Name==image.imageId())&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="collage"&&dO.collage.
23images.filter(m=>m.name==image.imageId())&&designobjectsNames.push(dO.name);for(i=0;i<designobjectsNames.length;i++)application.triggerApplicationEvent("/product/edit/removeAllDesignObject/canvas/"+designobjectsNames[i]),application.triggerApplicationEvent("/product/edit/updatedesignObjectView/accordion/"+designobjectsNames[i]);application.triggerApplicationEvent("/product/edit/loadField/false");application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram");designobjectsNames.length>0&&location.reload()},GalleryViewModel.prototype.gallerySelectionText=function(){var self=this;return self.SelectedCount()+"/"+self.galleryImages().length},GalleryViewModel.prototype.MontageButtonText=function(){var self=this;return self._presets.notSelectedMontageText},GalleryViewModel.prototype.AddToDesignButtonText=function(){var self=this;return self._presets.notselectedAddDesignText},GalleryViewModel.prototype.ContinueButtonText=function(){var self=this;return self._presets.aiEditorContinueText},GalleryViewModel.prototype.aiEditorListners=function(){var self=this,cdoImageEditor=document.getElementById("aiImageEditor");cdoImageEditor&&(cdoImageEditor.addEventListener("onBack",()=>{$(".uploadedImagesContainer").show(),$(".aiImageEditorContainer").hide()}),cdoImageEditor.addEventListener("onImageSelection",event=>{$(".uploadedImagesContainer").show();$(".aiImageEditorContainer").hide();application.triggerApplicationEvent("/track/event/Upload/AddimageToDesign");const eventData=event.detail;self.addImage(eventData);self.imageGallery.selectImage([{GalleryId:self.galleryId,FileName:eventData.ImageName,Width:eventData.Width,Height:eventData.Height,type:"image",imageSource:eventData.UploadSource}]);self.imageGallery.HideHelper("adddesignhelp");self.deselectAll()}))},GalleryViewModel.prototype.openAIEditorForImageSelect=function(selectedImage,fromgalleryModel){$("#imageSource .tab-userAI a").click();var self=this;const image=fromgalleryModel?selectedImage:self.galleryImages().find(img=>img.imageId()===selectedImage);if(image){this.openAIEditorImageSelect(image);let retryCount=0;const interval=setInterval(()=>{const btn=document.querySelector("#aiImageEditor .ai-btn-black");btn&&!btn.disabled&&(btn.click(),clearInterval(interval));retryCount++;retryCount>
23=20&&(clearInterval(interval),console.warn("Remove Background button not found/clickable after 20 attempts"))},300)}},GalleryViewModel.prototype.openAIEditorImageSelect=function(selectedImage){var self=this,cdoImageEditor=document.getElementById("aiImageEditor"),field=self.product.fieldsService.getCurrent();$(".uploadedImagesContainer").hide();$(".aiImageEditorContainer").show();cdoImageEditor.editorConfig={removeBgEnabled:self._presets.isRemoveBgEnabled,outpaintEnabled:self._presets.isOutpaintEnabled};cdoImageEditor.clear=!0;cdoImageEditor.creditsEnabled=self._presets.aiCreditsEnabled;setTimeout(()=>{cdoImageEditor.mask={width:field.originalMask.width*6,height:field.originalMask.height*6},cdoImageEditor.galleryImage={galleryId:self.galleryId,imageName:selectedImage.imageId(),width:selectedImage.width,height:selectedImage.height,thumbUrl:selectedImage.originalThumb(),uploadSource:selectedImage.uploadSource}},1e3)},GalleryViewModel.prototype.openAIEditor=function(){var self=this,selectedImages=_.filter(self.galleryImages(),function(image){return image.selected()==!0});selectedImages.length==1&&this.openAIEditorImageSelect(selectedImages[0])},GalleryViewModel.prototype.AddToDesignOnHover=function(){var self=this,firstSelected,data;self.SelectedCount()>1&&(firstSelected=_.find(self.galleryImages(),function(image){return image.selected()==!0}),data={url:firstSelected.thumbSource()},self.imageGallery.ShowHelper("adddesignhelp","button#addimagetodesign","#template-montage-buttonhelp",data))},GalleryViewModel.prototype.AddToDesignOutHover=function(){var self=this;self.imageGallery.HideHelper("adddesignhelp")},GalleryViewModel.prototype.listOfSelectedImages=function(){var self=this,im=[];return _.each(self.galleryImages(),function(image){image.selected&&image.selected()&&im.push({Name:image.imageId(),oWidth:image.width})}),im},GalleryViewModel.prototype.galleryImageNames=function(){return _.map(this.galleryImages(),function(image){if(image.imageId)return image.imageId()})},GalleryImageModel.prototype.ShowHideUsed=function(){var self=this;return self.galleryImages().length>5},GalleryViewModel.prototype.goToMontage=function(){var self=this;application.triggerApplicationEvent("/track/event/Upload/GoToMontageDesigner");self.imageGallery.selectTab("montage");$(".tab-montage").addClass("ui-tabs-selected ui-state-active");self.repeatedImageCount({add:0,remove:0,show:!1});self.removeUsedFlag()},GalleryViewModel.prototype.goToNewMontage=function(){var self=this;self.isSelectAll(!1);self.imageGallery.selectTab("newMontage");$(".tab-montage").addClass("ui-tabs-selected ui-state-active")},GalleryViewModel.prototype.editImage=function(image){application.triggerApplicationEvent("/track/event/EditImage/ClickEditImage");this.imageGallery.selectTab("edit");$(".tab-upload").addClass("ui-tabs-selected ui-state-active");application.postbox.notifySubscribers(image,"editImage")},GalleryViewModel.prototype.addimagesToDesign=function(cb){var self=this,imageModel,selectedImages,data,i;if(application.triggerApplicationEvent("/product/edit/showloader/gallay/addimage"),cb!=null&&cb!=undefined&&cb.constructor.name=="GalleryImageModel"&&(self.deselectAll(),imageModel=new GalleryImageModel(self._presets,cb,!0),imageModel.changeSelection(cb)),self.removeUsedFlag(),application.triggerApplicationEvent("/track/event/Upload/AddimageToDesign"),self.imageGallery.HideHelper("adddesignhelp"),selectedImages=_.filter(self.galleryImages(),function(image){return image.selected()==!0}),selectedImages.length>0){for(self.deselectAll(),data=[],i=0;i<selectedImages.length;i++)data.push({GalleryId:self.galleryId,FileName:selectedImages[i].imageId(),Width:selectedImages[i].width,Height:selectedImages[i].height,type:"image",cb:cb,imageSource:selectedImages[i].uploadSource});self.imageGallery.selectImage(data)}},GalleryViewModel.prototype.selectAll=function(){var self=this,count;this.mode!==this.GalleryModes.SingleImage&&(self.isSelectAll(!self.isSelectAll()),self.isSelectAll()?(count=0,_.each(self.galleryImages(),function(image){image.isImageSmall||image.IsRemoving()||image.selected(!0);image.selected()&&count++}),self.getSelectedImages().length>0?self.plUploadviewModel.uploadImageComplete(!0):self.plUploadviewModel.uploadImageComplete(!1),self.SelectedCount(count),application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums"),application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram")):self.deselectAll())},GalleryViewModel.prototype.SelectImages=function(images){var self=this,selectedCount=0;_.each(self.galleryImages(),function(image){var isSelected=images.indexOf(image.imageId())!=-1;image.selected(isSelected);isSelected&&selectedCount++});self.SelectedCount(selectedCount);application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram")},GalleryViewModel.prototype.deselectAll=function(){var self=this;_.each(self.galleryImages(),function(image){image.selected&&image.selected(!1)});self.getSelectedImages().length>0?self.plUploadviewModel.uploadImageComplete(!0):self.plUploadviewModel.uploadImageComplete(!1);self.SelectedCount(0);application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram")},GalleryViewModel.prototype.removeAll=function(){var self=this,deleteAllImages=$("#md-deleteAllImages").modal();deleteAllImages.find(".ok_btn_pop").on("click",function(){self.SelectedCount(0);var removeImageUrl=self._presets.removeAllImagesUrl;$.post(removeImageUrl,application.addAdditionalData({}),function(){var designobjectsNames=[],i;for(_.each(self.galleryImages(),function(image){for(var j,dO,i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="image"&&dO.image.id==image.imageId()&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="montage"&&dO.montage.Images.filter(m=>m.Name==image.imageId())&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="collage"&&dO.collage.
23images.filter(m=>m.name==image.imageId())&&designobjectsNames.push(dO.name)}),self.galleryImages.removeAll(),i=0;i<designobjectsNames.length;i++)application.triggerApplicationEvent("/product/edit/removeAllDesignObject/canvas/"+designobjectsNames[i]),application.triggerApplicationEvent("/product/edit/updatedesignObjectView/accordion/"+designobjectsNames[i]);application.triggerApplicationEvent("/product/edit/loadField/false");application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram");deleteAllImages.closeModal();designobjectsNames.length>0&&location.reload()});application.triggerApplicationEvent("/plupupload/init/false")})},GalleryViewModel.prototype.RemoveSelectedText=function(){var self=this;return self.SelectedCount()>0?self._presets.removeSelectedText.format(self.SelectedCount()):self._presets.removeAllText},GalleryViewModel.prototype.RemoveSelectedConfirmText=function(){var self=this;return self._presets.removeSelectedConfirmText.format(self.SelectedCount())},GalleryViewModel.prototype.getSelectedImages=function(){var self=this;return _.filter(self.galleryImages(),function(image){return image.selected()})},GalleryViewModel.prototype.removeSelected=function(){var self=this,deleteSelectedImages;if(self.SelectedCount()===0){self.removeAll();return}deleteSelectedImages=$("#md-deleteSelectedImages").modal();deleteSelectedImages.find(".ok_btn_pop").on("click",function(){var im,removeImageUrl;self.SelectedCount(0);im=[];_.each(self.getSelectedImages(),function(image){im.push(image.imageId())});removeImageUrl=self._presets.removeSelectedImagesUrl;$.post(removeImageUrl,application.addAdditionalData({imageNames:im}),function(){var designobjectsNames,i;for(self.galleryImages.removeAll(self.getSelectedImages()),designobjectsNames=[],_.each(im,function(imageId){for(var j,dO,i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="image"&&dO.image.id==imageId&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="montage"&&dO.montage.Images.filter(m=>m.Name==imageId)&&designobjectsNames.push(dO.name);for(i=0;i<self.product.productDesign.fields.length;i++)for(j=0;j<self.product.productDesign.fields[i].editablefield.designobjects.length;j++)dO=self.product.productDesign.fields[i].editablefield.designobjects[j],dO.type=="collage"&&dO.collage.images.filter(m=>m.name==imageId)&&designobjectsNames.push(dO.name)}),i=0;i<designobjectsNames.length;i++)application.triggerApplicationEvent("/product/edit/removeAllDesignObject/canvas/"+designobjectsNames[i]),application.triggerApplicationEvent("/product/edit/updatedesignObjectView/accordion/"+designobjectsNames[i]);application.triggerApplicationEvent("/product/edit/loadField/false");application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram");deleteSelectedImages.closeModal();designobjectsNames.length>0&&location.reload();
23self.galleryImages().length==0&&$(".image_container_class").length==0&&(self.isSelectAll(!1),application.triggerApplicationEvent("/plupupload/init/false"))})})},GalleryViewModel.prototype.queueUpload=function(uploadViewModel){var self=this;self.uploadQueueModel.unshift(uploadViewModel)},GalleryViewModel.prototype.uploadFinished=function(uploadFinishedModel){var self=this;if(self.uploadQueueModel.remove(uploadFinishedModel.uploadedFile),Array.isArray(uploadFinishedModel.galleryImage))for(let i=0;i<uploadFinishedModel.galleryImage.length;i++)self.addImage(uploadFinishedModel.galleryImage[i]);else self.addImage(uploadFinishedModel.galleryImage)},GalleryViewModel.prototype.replaceImage=function(){var self=this;self.uploadQueueModel.remove(uploadFinishedModel.uploadedFile)},GalleryViewModel.prototype.addImage=function(galleryImage){var self=this;self.galleryImages.unshift(new GalleryImageModel(self._presets,galleryImage,!0));application.LazyImage("image_container_class","scrollable-bg")},GalleryViewModel.prototype.addImageAndSelect=function(image){var self=this,imageModel=new GalleryImageModel(self._presets,image,!0);self.galleryImages.unshift(imageModel);imageModel.changeSelectionFbImage(imageModel);
23application.LazyImage("image_container_class","scrollable-bg")},GalleryViewModel.prototype.markAsSelectedUnSelected=function(filename){var vm=this,galleryImages=vm.galleryImages(),image=_.where(galleryImages,{clientFileName:filename})[0],shouldSelect=!image.selected();if(vm.mode()===vm.GalleryModes.MultiImage){image.selected(shouldSelect);vm.incrementSelectedCount(shouldSelect?1:-1);return}vm.mode()===vm.GalleryModes.SingleImage&&(shouldSelect?(vm.deselectAll(),image.selected(!0)):image.selected(!1),vm.incrementSelectedCount(shouldSelect?1:-1))},GalleryViewModel.prototype.incrementSelectedCount=function(inc){this.SelectedCount(this.SelectedCount()+inc)},GalleryViewModel.prototype.AddWordArt=function(galleryItem){var self=this;this.deselectAll();this.addImageAndSelect(galleryItem);this.addimagesToDesign(name=>{if(self.product.designObjectService.getCustomImages(self.product.fieldsService.getCurrent()).length===1){const dO=self.product.designObjectService.getByName(name);dO.x=0;dO.y=0;dO.width=1;dO.height=1}application.triggerApplicationEvent("/product/edit/updateView/facetool/false");application.triggerApplicationEvent("/product/edit/showloader/facetool/false");application.triggerApplicationEvent("/product/edit/select/designObject/"+name)})},GalleryViewModel.prototype.AddAISticker=function(galleryItem){var self=this,imageModel=new GalleryImageModel(self._presets,galleryItem,!0);self.galleryImages.unshift(imageModel)},GalleryViewModel.prototype.AddAIStickerToDesign=function(galleryItem){this.deselectAll();this.addImageAndSelect(galleryItem);this.addimagesToDesign()},GalleryImageModel.prototype.updateInfo=function(){var self=this,imgInfo=self.width+self.height+self.size>0?"{0}\n{1}x{2}px \n{3}mb".format(self.clientFileName,self.width,self.height,parseFloat(self.size/1048576).toFixed(2)):"";self.info(imgInfo);
23application.LazyImage("image_container_class","scrollable-bg")},GalleryImageModel.prototype.cancelSmallChoice=function(image){var self=this;application.triggerApplicationEvent("/track/event/Upload/UseSmallImage");self.ShowSmallChoice(!1);self.changeSelection(image)},GalleryImageModel.prototype.showConfirmRemove=function(){var self=this;self.IsRemoving(!0)},GalleryImageModel.prototype.cancelRemove=function(){var self=this;self.IsRemoving(!1)},GalleryImageModel.prototype.changeSelection=function(image){var self=this,vm=application.getViewModel("GalleryViewModel"),shouldSelect=!image.selected();vm.isSelectAll(!1);vm.mode()===vm.GalleryModes.MultiImage?(image.selected(shouldSelect),vm.incrementSelectedCount(shouldSelect?1:-1)):vm.mode()===vm.GalleryModes.SingleImage&&(shouldSelect?(vm.deselectAll(),image.selected(!0)):image.selected(!1),vm.incrementSelectedCount(shouldSelect?1:-1));vm.getSelectedImages().length>0?self.plUploadviewModel.uploadImageComplete(!0):self.plUploadviewModel.uploadImageComplete(!1);application.triggerApplicationEvent("/gallery/facebook/selectimagesfromalbums");application.triggerApplicationEvent("/gallery/instagram/selectimagesfrominstagram")},GalleryViewModel.prototype.openMenu=function(image){image!=undefined?(_.each(this.galleryImages(),function(img){img.isMenuOpen()&&img.imageId!==image.imageId&&img.isMenuOpen(!1)}),image.isMenuOpen(!image.isMenuOpen()),event.stopPropagation()):_.each(this.galleryImages(),function(img){img.isMenuOpen()&&img.isMenuOpen(!1)})},GalleryImageModel.prototype.openMenuClass=function(){var self=this,classes=["action-menu"];return self.isMenuOpen()&&classes.push("active"),classes.join(" ")},GalleryImageModel.prototype.changeSelectionFbImage=function(image){var vm=application.getViewModel("GalleryViewModel"),shouldSelect=!image.selected();vm.mode()===vm.GalleryModes.MultiImage?(image.selected(shouldSelect),vm.incrementSelectedCount(shouldSelect?1:-1)):vm.mode()===vm.GalleryModes.SingleImage&&(shouldSelect?(vm.deselectAll(),image.selected(!0)):image.selected(!1),vm.incrementSelectedCount(shouldSelect?1:-1))},GalleryImageModel.prototype.SelectButtonText=function(){var self=this;return self.selected()?self.presets.deSelectImageText:self.presets.selectImageText},GalleryImageModel.prototype.SelectButtonClass=function(){var self=this,classes=[];return self.selected()&&classes.push("selected"),classes.join(" ")},GalleryImageModel.prototype.ImageContainerClass=function(){var self=this,classes=[];return self.selected()&&classes.push("box-selected"),self.usedInDesign()&&classes.push("box-used"),classes.join(" ")},GalleryImageModel.prototype.OverlayClasses=function(){const activeLinkHtml=document.querySelector(".gallery-tabs .ui-state-active a");return activeLinkHtml&&activeLinkHtml.id=="userAILink"?"ai-overlay":""},new GalleryViewModel}(jQuery,application),"GalleryViewModel"),function(Utils){var SizeConverter=function(){function SizeConverter(){}return SizeConverter.prototype.convert=function(value,fromUnit,toUnit){var accurateValue=0;switch(fromUnit){case"meter":switch(toUnit){case"meter":accurateValue=value;break;case"inch":accurateValue=value*39.370078740157481;break;case"cm":accurateValue=value*100;break;case"yard":accurateValue=value*1.093613298337708;break;default:accurateValue=value}break;case"inch":switch(toUnit){case"meter":accurateValue=value/39.370078740157481;break;case"inch":accurateValue=value;break;case"cm":accurateValue=value*2.54;break;case"yard":accurateValue=value/36;break;default:accurateValue=value}break;case"cm":switch(toUnit){case"meter":accurateValue=value/100;break;case"inch":accurateValue=value/2.54;break;case"cm":accurateValue=value;break;case"yard":accurateValue=value*.010936132983377081;break;default:accurateValue=value}break;case"yard":switch(toUnit){case"meter":accurateValue=value/1.093613298337708;break;case"inch":accurateValue=value*36;break;case"cm":accurateValue=value/.010936132983377081;break;case"yard":accurateValue=value;break;default:accurateValue=value}break;default:accurateValue=value}return{accurateValue:accurateValue,roundedValue:Math.round(accurateValue*100)/100}},SizeConverter.prototype.describeInFeet=function(value){var wholeCount=Math.floor(value/12),partCount=value%12;partCount=Math.round(partCount*100)/100;var wholeString=wholeCount===0?"":wholeCount<=1?wholeCount+" foot ":wholeCount+" feet ",partString=partCount===0?"":partCount<=1?partCount+" inch ":partCount+" inches ";return(wholeString+partString).trim()},SizeConverter.prototype.getLengthUnit=function(unitSystemName){var lengthUnit="";switch(unitSystemName){case"FabricMeter":lengthUnit="meter";break;case"FabricInch":lengthUnit="inch";break;case"FabricCM":lengthUnit="cm";break;case"FabricYard":lengthUnit="yard"}return lengthUnit},SizeConverter.prototype.squareAreaConvertor=function(value,fromUnit,toUnit){return value*{meter:{inch:1550.0031,cm:1e4,yard:.836127,meter:1}}[fromUnit][toUnit]},SizeConverter}();Utils.SizeConverter=SizeConverter}(Utils||(Utils={}));application.addComponent(function($){function FabricSizeUnitSelectHandler(){var self=this;this._sizeConverter=new Utils.SizeConverter;application.route("/preview/update/pending/clicked",function(){self.handleEvent()})}return FabricSizeUnitSelectHandler.prototype.init=function(){},FabricSizeUnitSelectHandler.prototype.handleEvent=function(){var self=this,$lengthTextElement=$("#o
23ptvalId-LengthOptionValueOpenInput"),$widthTextElement=$("#optvalId-WidthOptionValueOpenInput"),$previouseSizeUnit=$("div#optId-FabricSizeUnit input[type='radio'][data-lastselected='true']"),$currentSizeUnit=$("div#optId-FabricSizeUnit input[type='radio']:checked"),$widthnotes=$("#optId-FabricWidth div.fabric-size-notes"),$lengthNotes=$("#optId-FabricLength div.fabric-size-notes"),fromUnit="",toUnit="";switch($previouseSizeUnit.data("systemname")){case"FabricMeter":fromUnit="meter";break;case"FabricInch":fromUnit="inch";break;case"FabricCM":fromUnit="cm";break;case"FabricYard":fromUnit="yard"}switch($currentSizeUnit.data("systemname")){case"FabricMeter":toUnit="meter";break;case"FabricInch":toUnit="inch";break;case"FabricCM":toUnit="cm";break;case"FabricYard":toUnit="yard"}var length=$lengthTextElement.attr("data-accurate-value")||$lengthTextElement.val(),width=$widthTextElement.attr("data-accurate-value")||$widthTextElement.val(),newLength=self._sizeConverter.convert(length,fromUnit,toUnit),newWidth=self._sizeConverter.convert(width,fromUnit,toUnit);toUnit==="inch"?($widthnotes.html(self._sizeConverter.describeInFeet(newWidth.accurateValue)),$lengthNotes.html(self._sizeConverter.describeInFeet(newLength.accurateValue))):($widthnotes.html(""),$lengthNotes.html(""));$lengthTextElement.val(newLength.roundedValue);$lengthTextElement.attr("data-accurate-value",newLength.accurateValue);$widthTextElement.attr("data-accurate-value",newWidth.accurateValue);$widthTextElement.val(newWidth.roundedValue);$previouseSizeUnit.removeAttr("data-lastselected");$currentSizeUnit.attr("data-lastselected","true");application.triggerApplicationEvent("ruler/switchTo/{0}".format(toUnit))},new FabricSizeUnitSelectHandler}(jQuery),"FabricSizeUnitSelectHandler"),function(Preview){var Events;(function(){var FabricPredefinedSizesSelectHandler=function(){function FabricPredefinedSizesSelectHandler(){this._sizeConverter=new Utils.SizeConverter}return FabricPredefinedSizesSelectHandler.prototype.init=function(){this._productOptions=application.getComponent("ProductOptions");this._$lengthOption=$("#optvalId-LengthOptionValueOpenInput");this._$widthOption=$("#optvalId-WidthOptionValueOpenInput");this._container=$("#optionItems");this.init=function(){}},FabricPredefinedSizesSelectHandler.prototype.handleEvent=function(){var $selectedPredefinedSize,$fabrizSizeOption,selectedSizeSystemName,$selectedFabricOrderType,predefinedSizeJson,predefinedSize;if(console.log("Handling event: FabricPredefinedSizesSelectHandler"),$selectedPredefinedSize=this._container.find("#optId-FabricPredefinedSizes select").find(":selected"),$("#optId-FabricPredefinedSizes").data("skipPostBack",!0),$("#optId-FabricSizeUnit").data("skipPostBack",!0),$fabrizSizeOption=this._container.find("#optId-FabricSize"),selectedSizeSystemName=$selectedPredefinedSize.data("systemname"),selectedSizeSystemName!=="FabricCustomSize")$fabrizSizeOption.hide();else{$fabrizSizeOption.show();$selectedFabricOrderType=this._container.find('#optId-FabricOrderType input[type="radio"]:checked');$selectedFabricOrderType.data("systemname")==="FabricHalfWidth"&&this.GetHalfWidth();return}predefinedSizeJson=$selectedPredefinedSize.attr("data-openinput-predefinedsize");predefinedSize=jQuery.parseJSON(predefinedSizeJson);$("#optvalId-{0}".format(SizeUnit[predefinedSize.Unit])).prop("checked",!0).trigger("change");$("#optvalId-LengthOptionValueOpenInput").val(predefinedSize.Length).attr("data-accurate-value",predefinedSize.Length);$("#optvalId-WidthOptionValueOpenInput").val(predefinedSize.Width).attr("data-accurate-value",predefinedSize.Width);application.triggerApplicationEvent("/preview/update/pending/clicked")},FabricPredefinedSizesSelectHandler.prototype.GetHalfWidth=function(){var unit=this.getSelectedUnit(),oneCmWidth=this._sizeConverter.convert(1,"cm",unit),fabricValidator=application.getComponent("FabricValidator"),maxWidth,minFabArea,minFabAreatoUnit;if(fabricValidator.init(),maxWidth=fabricValidator.getMaxWidth(),maxWidth>0&&(this._$widthOption.val(maxWidth/2-oneCmWidth.accurateValue).change(),minFabArea=this.getFabricMinArea(),parseFloat(minFabArea)>0&&(minFabAreatoUnit=this._sizeConverter.squareAreaConvertor(parseFloat(minFabArea),"meter",unit),minFabAreatoUnit>0))){var width=this._$widthOption.val(),halfWidthLength=minFabAreatoUnit/width,originallenth=this._$lengthOption.data("original-value");this._$lengthOption.data("original-value")!=halfWidthLength&&(halfWidthLength=originallenth);this._$lengthOption.val(halfWidthLength).change()}},FabricPredefinedSizesSelectHandler.prototype.getFabricMinArea=function(){var _fabricTypeOption,options;return _fabricTypeOption==undefined&&(options=this._productOptions.getOptions(),_fabricTypeOption=_.find(options,function(opt){return opt.systemName==="FabricType"})),_fabricTypeOption.getSelectedOptionValueElement()[0].attributes.getNamedItem("data-fabricarea-fabricminarea").value},FabricPredefinedSizesSelectHandler.prototype.getSelectedUnit=function(){var $currentSizeUnit=$("div#optId-Fabr
23icSizeUnit input[type='radio']:checked"),toUnit="";switch($currentSizeUnit.data("systemname")){case"FabricMeter":toUnit="meter";break;case"FabricInch":toUnit="inch";break;case"FabricCM":toUnit="cm";break;case"FabricYard":toUnit="yard"}return toUnit},FabricPredefinedSizesSelectHandler}(),SizeUnit;(function(SizeUnit){SizeUnit[SizeUnit.FabricMeter=0]="FabricMeter";SizeUnit[SizeUnit.FabricCM=1]="FabricCM";SizeUnit[SizeUnit.FabricInch=2]="FabricInch";SizeUnit[SizeUnit.FabricYard=3]="FabricYard"})(SizeUnit||(SizeUnit={}));application.addComponent(new FabricPredefinedSizesSelectHandler,"FabricPredefinedSizesSelectHandler")})(Events=Preview.Events||(Preview.Events={}))}(Preview||(Preview={})),function(Preview){var Events;(function(){var ScarfOrWrapSizeSelectHandler=function(){function ScarfOrWrapSizeSelectHandler(){}return ScarfOrWrapSizeSelectHandler.prototype.init=function(){this._container=$("#optionItems");this.init=function(){}},ScarfOrWrapSizeSelectHandler.prototype.handleEvent=function(){console.log("Handling event: ScarfSizeSelectHandler");var $selectedSize=this._container.find("[data-systemname='ScarfOrWrapSize']").find("span.selected").attr("data-optvalue"),$add2PocketSquare=$("#optId-Add2PocketSquare");presets.productId=="331"&&$selectedSize&&$selectedSize=="1964"?$add2PocketSquare&&$add2PocketSquare.show():$add2PocketSquare&&($add2PocketSquare.hide(),$add2PocketSquare.find("span[data-optvalue='830']").trigger("click"))},ScarfOrWrapSizeSelectHandler}();application.addComponent(new ScarfOrWrapSizeSelectHandler,"ScarfOrWrapSizeSelectHandler")})(Events=Preview.Events||(Preview.Events={}))}(Preview||(Preview={})),function(Preview){var UI;(function(UI){var PreviewZoom=function(){function PreviewZoom(){this.init()}return PreviewZoom.prototype.init=function(){var _this=this;if(this.button=$(".zoom-trigger"),!presets.showZoom){this.button.hide();return}this.canvasTabs=application.getComponent("CanvasTabs");this.button.show();this.product=application.getModel("Product");this.productOptions=application.getComponent("ProductOptions",[]);this.button.on("click",function(){_this.showZoom();window.pushCreationStudioToGTM("Click: Image zoom")})},PreviewZoom.prototype.showZoom=function(){var activeTab=this.canvasTabs.getActive(),url=this.getZoomUrl(activeTab),magnifyImgOption={magnifiedWidth:2e3,magnifiedHeight:2e3},zoomBox=application.getFromTemplate($("#template-zoom"),{templateData:{}}),img=zoomBox.find("img"),imageLargeUrl;zoomBox.on("mousedown",function(){$(this).hide().remove()});this.maskDiv=zoomBox.find(".zoom-img-bg-js");activeTab===1||presets.is3DPreviewEnabled?(img.attr("data-magnify-src",url),this.maskDiv.attr("data-magnify-src",this.setOutputPreviewInZoom(!0)),this.maskDiv.css({"background-image":"url('{0}')".format(this.setOutputPreviewInZoom())}),img.magnify(magnifyImgOption),this.maskDiv.magnify(magnifyImgOption)):(imageLargeUrl=this.getZoomForProductPreviewLg(),img.attr("data-magnify-src",imageLargeUrl),img.magnify(magnifyImgOption));$("body").append(zoomBox);img.hide();img.on("load",function(){zoomBox.find("span").hide();img.css({display:"inline"})});img.attr("src",url);$("body").on("keydown",function(evt){(evt.keyCode===27||evt.key==="Escape")&&$(zoomBox).hide().remove()})},PreviewZoom.prototype.setOutputPreviewInZoom=function(isLargeImg){isLargeImg===void 0&&(isLargeImg=!1);var optionValues=this.productOptions.getAffectedOptionsAsString(),pd=this.product.productDesign,editablefield=this.product.fieldsService.getFieldByIndex(pd.currenteditablefieldindex).editablefield,outputParams="?productId="+presets.productId+"&productName="+presets.productName+"&pvers="+preset
23s.pvers+"¤tFieldIndex="+pd.currenteditablefieldindex+"&listOfOptionValues="+optionValues+"&galleryId="+presets.galleryId+"&productTabIndex=1&designName="+presets.designName+"&tid="+presets.tid+"&isPreBasketItem="+/isPreBasketItem=true|EditBasketItem/i.test(window.location.href)+"&version="+editablefield.version,url=presets.productDesign.previewOutputPath+outputParams;return isLargeImg&&(url=presets.productDesign.previewOutputPathLarge+outputParams),url},PreviewZoom.prototype.getZoomUrl=function(activeTab){return activeTab===1||presets.is3DPreviewEnabled?this.getZoomForOutputMask():this.getZoomForProductPreview()},PreviewZoom.prototype.getZoomForProductPreview=function(){var optionValues=this.productOptions.getAffectedOptionsAsString(),pd=this.product.productDesign,productPreviewParams,url;return presets.isBulkFabric&&(optionValues=this.productOptions.getOptionsAsString()),productPreviewParams="?productId="+presets.productId+"&systemName="+presets.systemName+"&productName="+presets.productName+"&pvers="+presets.pvers+"¤tFieldIndex="+pd.currenteditablefieldindex+"&listOfOptionValues="+optionValues+"&galleryId="+preset
23s.galleryId+"&tid="+presets.tid+"&viewName=&designName="+presets.designName+"&rnd="+$.nextVersion(),url="/estore/preview/zoompreview",url+productPreviewParams},PreviewZoom.prototype.getZoomForProductPreviewLg=function(){var optionValues=this.productOptions.getAffectedOptionsAsString(),pd=this.product.productDesign,productPreviewParams,url;return presets.isBulkFabric&&(optionValues=this.productOptions.getOptionsAsString()),productPreviewParams="?productId="+presets.productId+"&systemName="+presets.systemName+"&productName="+presets.productName+"&pvers="+presets.pvers+"¤tFieldIndex="+pd.currenteditablefieldindex+"&listOfOptionValues="+optionValues+"&galleryId="+presets.galleryId+"&tid="+presets.tid+"&viewName=&designName="+presets.designName+"&rnd="+$.nextVersion(),url="/estore/preview/ZoomPreviewLarge",url+productPreviewParams},PreviewZoom.prototype.getZoomForOutputMask=function(){var pd=this.product.productDesign,optionValues=this.productOptions.getOptionsAsString();return presets.productDesign.MaskUrl+"?productId="+presets.productId+"&productName="+presets.productName+"¤tFieldIndex="+this.product.fieldsService.getCurrentEditableFieldId()+"&systemName="+presets.systemName+"&listOfOptionValues="+optionValues+"&pvers="+preset
23s.pvers+"&tid="+presets.tid+"&size=840&editablefieldVersion="+pd.fields[pd.currenteditablefieldindex].editablefield.version+"¤tOrientation="+pd.fields[pd.currenteditablefieldindex].editablefield.currentOrientation},PreviewZoom}();UI.PreviewZoom=PreviewZoom;application.addComponent(new PreviewZoom,"PreviewZoom")})(UI=Preview.UI||(Preview.UI={}))}(Preview||(Preview={}));__extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),function(Estore){var Gallery;(function(Gallery){var FaceToolController=function(_super){function FaceToolController(){var _this=_super.call(this)||this;return _this.route("/gallery/init",_this.initFromGallery),_this}return __extends(FaceToolController,_super),FaceToolController.prototype.init=function(){this.component=application.getComponent("FaceTool")},FaceToolController.prototype.initFromGallery=function(){this.component.init()},FaceToolController}(Controller),FaceTool;Gallery.FaceToolController=FaceToolController;application.addController(new FaceToolController);FaceTool=function(){function FaceTool(){}return FaceTool.prototype.init=function(){var _this=this;this.designObjectService=application.getModel("Product").designObjectService;this.galleryViewModel=application.getViewModel("GalleryViewModel");this.loader=new Website.Igf.PatternAppLoader({frameId:"bol-face-tool",elementClass:"open-face-tool",containerQuery:".facetool-container",onSaved:function(url){_this.galleryViewModel.deselectAll();_this.galleryViewModel.addImageAndSelect(url.galleryItem);_this.galleryViewModel.addimagesToDesign(function(name){var dO=_this.designObjectService.getByName(name);_this.designObjectService.setSize(dO,dO.width/2,dO.height/2);_this.designObjectService.transform(name,"Pattern-Basic");_this.designObjectService.transform(name,"centre");application.triggerApplicationEvent("/product/edit/updateView/facetool/false");application.triggerApplicationEvent("/product/edit/showloader/facetool/false");application.triggerApplicationEvent("/product/edit/select/designObject/"+name)});_this.galleryViewModel.deselectAll();setTimeout(function(){application.triggerApplicationEvent("/product/dropdown/designCopyToSelectedField/555")},1e3)},showFacetoolTour:this.designObjectService.root.previewRestriction.ShowDesignInterfaceTour()})},FaceTool.prototype.show=function(){this.loader&&this.loader.showAppFrame()},FaceTool}();Gallery.FaceTool=FaceTool;application.addComponent(new FaceTool,"FaceTool")})(Gallery=Estore.Gallery||(Estore.Gallery={}))}(Estore||(Estore={}));isMobile=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),function(Website){var Igf;(function(Igf){var PatternAppLoader=function(){function PatternAppLoader(settings){var _this=this,commandElements,selectProductActions,i,closeListDiv;if(this.settings=settings,this.pp="",settings.elementClass){for(commandElements=document.getElementsByClassName(settings.elementClass),i=0;i<commandElements.length;i++)commandElements.item(i).addEventListener("click",function(e){return _this.showAppFrame(e)});window.addEventListener("message",function(e){return _this.receiveMessage(e)},!1)}if(settings.productSelectQuery)for(selectProductActions=document.querySelectorAll(settings.productSelectQuery),i=0;i<selectProductActions.length;i++)selectProductActions.item(i).addEventListener("click",function(e){return _this.selectProduct(e)});settings.closeListQuery&&(closeListDiv=document.querySelector(settings.closeListQuery),closeListDiv!=null&&closeListDiv.addEventListener("click",function(){_this.closeProductsList();_this.orgWindow.postMessage({action:"canceled",data:"close"},location.origin)}));this.facetoolFaceselectionTourLoaded=!1;this.facetoolGeneratePatternTourLoaded=!1}return PatternAppLoader.prototype.showAppFrame=function(e){if(e){var t=e.target;this.pid=t.getAttribute("data-productId")}this.iframe?this.startIframe():this.createIframe()},PatternAppLoader.prototype.createIframe=function(){var _this=this;this.iframe=document.createElement("iframe");this.iframe.addEventListener("load",function(){return _this.onIframeLoad()});this.iframe.style.cssText="border: 0;width: 100%;height: 100%;position: absolute;top: 0;left: 0;z-index: 1;";this.settings.frameId&&(this.iframe.id=this.settings.frameId);this.iframe.src="/facetool/upload";this.container=document.querySelector(this.settings.containerQuery);this.container?this.container.appendChild(this.iframe):(this.container=this.iframe,document.documentElement.appendChild(this.iframe));this.container.classList.add("show-this");this.orgWindow=this.iframe.contentWindow;this.orgWindow.postMessage({action:"start",data:{pid:this.pid}},location.origin)},PatternAppLoader.prototype.startIframe=function(){var _a;this.closeFaceApp=document.querySelector((_a=this.settings)===null||_a===void 0?void 0:_a.closeFaceapp);
23this.closeFaceApp&&(this.closeFaceApp.style.display="block");this.container.classList.add("show-this");document.body.classList.add("no-scroll");this.orgWindow.postMessage({action:"start",data:{pid:this.pid}},location.origin)},PatternAppLoader.prototype.onIframeLoad=function(){if(this.container.className=="facetool-container show-this"){var iframeBody=this.iframe.contentDocument.body;iframeBody&&iframeBody.classList.add("face-tool-estore")}this.startIframe()},PatternAppLoader.prototype.receiveMessage=function(e){var data,showTour,faceTourGuide,faceTourGuide2,thumbImg,org;if(e.data&&e.data.action&&e.data.data&&e.origin===location.origin){data=e.data;switch(data.action){case"closed":this.container.classList.remove("show-this");location.hash="";document.body.classList.remove("no-scroll");break;case"navigated":showTour=this.settings.frameId=="bol-face-tool"&&$("#bol-face-tool")[0]!=undefined&&!isMobile;showTour&&(data.data=="/crop"&&!this.facetoolFaceselectionTourLoaded&&this.settings.showFacetoolTour&&(faceTourGuide=new IntroHandler,faceTourGuide.DisplayTour("FaceTool-faceselection","facetoolfaceselectiontour"),this.facetoolFaceselectionTourLoaded=!0),data.data=="/pattern"&&!this.facetoolGeneratePatternTourLoaded&&this.settings.showFacetoolTour&&(faceTourGuide2=new IntroHandler,faceTourGuide2.DisplayTour("FaceTool-generatepattern","facetoolgeneratepatterntour"),this.facetoolGeneratePatternTourLoaded=!0));location.hash=data.data;break;case"saved":if(this.settings.onSaved){this.settings.onSaved(data.data);this.orgWindow.postMessage({action:"canceled",data:{}},location.origin)}else this.pid?this.orgWindow.postMessage({action:"selected",data:{pid:this.pid}},location.origin):(this.openProductsList(),thumbImg=document.querySelector(this.settings.thumbQuery),thumbImg.src=data.data.thumbUrl);break;case"generated":location.assign(this.pp+"?"+data.data);break;case"requestpid":this.orgWindow.postMessage({action:"start",data:{pid:this.pid}},location.origin);break;case"requestorigin":org="";org=window.location.href.indexOf("estore")>0?"estore":"pdppage";this.orgWindow.postMessage({action:"start",data:{origin:org}},location.origin)}}},PatternAppLoader.prototype.selectProduct=function(e){e.preventDefault();var pid=e.currentTarget.getAttribute("data-pid");this.pp=e.currentTarget.href;this.orgWindow.postMessage({action:"selected",data:{pid:pid}},location.origin)},PatternAppLoader.prototype.openProductsList=function(){var listDiv=document.querySelector(this.settings.productsListQuery);listDiv.style.display="block";listDiv.style.zIndex="3000";this.CallGATrackingPatternList();listDiv.addEventListener("scroll",this.CallGATrackingPatternList)},PatternAppLoader.prototype.closeProductsList=function(){var listDiv=document.querySelector(this.settings.productsListQuery);listDiv.style.display="none"},PatternAppLoader.prototype.CallGATrackingPatternList=function(){typeof loadPatternList=="function"&&loadPatternList()},PatternAppLoader}();Igf.PatternAppLoader=PatternAppLoader})(Igf=Website.Igf||(Website.Igf={}))}(Website||(Website={}));const EventCategory={CreationStudio:"Creation Studio",AdvancedStudio:"Advanced Studio",EStoreDesignPreview:"Estore Design Preview"},EVariants={Original:0,NewVariant:1},ActionCategory={TopNavBackButton:"Top nav: Back button",TopNavAccount:"Top nav: Account",TopNavBasket:"Top nav: Basket",BottomNavQuantityOpenModal:"Bottom nav: Quantity - open modal",BottomNavQuantitySubmitQuantity:"Bottom nav: Quantity - submit quantity",BottomNavAddToBasket:"Bottom nav: Preview & Add to basket",BottomNavPreviewAndSave:"Bottom nav: Preview and save",BottomNavUpdateDesign:"Bottom nav: Update design"},ActionName={View:"View"},EventList={Design:"estore/design"};pushToDatalayer=function(data){data&&window.dataLayer!=undefined&&dataLayer.push({event:data.event,event_category:data.event_category,event_action:data.event_action,event_label:data.event_label})};document.addEventListener("DOMContentLoaded",function(){pushAdvanceStudioToGTM(ActionName.View);GAVariantId=="1"&&$("html").addClass("studioFacelift")});$(document).on("click",".design-int-upload",".color-picker-background",".sp-preview-inner",ele=>{ele.currentTarget.classList.contains("gtm-design-int-upload")&&pushCreationStudioToGTM("Click on Upload image"),ele.currentTarget.classList.contains("color-picker-background")&&pushCreationStudioToGTM("Image & Text tools tab : color picker"),ele.currentTarget.classList.contains("sp-preview-inner")&&pushCreationStudioToGTM("Image gallery : color picker")}).on("click",".icon-options",ele=>{let actionData=getTitle(ele),valueEle=$(ele.target).closest("span");if(valueEle){let value=valueEle.attr("data-systemname");
23value&&(actionData=`${actionData}: ${value}`,pushCreationStudioToGTM(actionData))}}).on("change",".preview-product-option",ele=>{let actionData=getTitle(ele),valueEle=$(ele.target).closest("span");if(valueEle&&ele.currentTarget.selectedOptions!=undefined){let value=ele.currentTarget.selectedOptions[0].text;value&&(actionData=`${actionData}: ${value}`,pushCreationStudioToGTM(actionData))}}).on("click",".stage-tools-wrapper a[href=#tab-switch]",ele=>{pushCreationStudioToGTM("Click:"+ele.currentTarget.innerText)});$(".user__link").on("click",()=>{pushAdvanceStudioToGTM(ActionCategory.TopNavAccount)});$(".cart__link").on("click",()=>{pushAdvanceStudioToGTM(ActionCategory.TopNavBasket)});$(".cdo-dropdown-menu, .div-quantity-sel").on("click",()=>{pushAdvanceStudioToGTM(ActionCategory.BottomNavQuantityOpenModal)});$("#btnFinalPreview").on("click",()=>{let event_data_json={product_quantity:$("#span-quantity").text()};window.location.href.toString().indexOf("editdesign")!=-1||window.location.href.indexOf("createdesign")!=-1?pushAdvanceStudioToGTM(ActionCategory.BottomNavPreviewAndSave,event_data_json):window.location.href.toString().indexOf("editbasketitem")!=-1?pushAdvanceStudioToGTM(ActionCategory.BottomNavUpdateDesign,event_data_json):pushAdvanceStudioToGTM(ActionCategory.BottomNavAddToBasket,event_data_json)});pushCreationStudioToGTM=function(action){let productId=document.getElementsByName("productId")[0],event_data={event_list:EventList.Design,product_id:productId.value},event_label=window.location.href+" / Event data : "+JSON.stringify(event_data);const gtaPreviewDesign={event:"custom_event",event_category:EventCategory.CreationStudio,event_action:action,event_label:event_label};pushToDatalayer(gtaPreviewDesign)};pushAdvanceStudioToGTM=function(action,event_data_json){let productId=document.getElementsByName("productId")[0],event_data;event_data_json!=undefined?(event_data=event_data_json,event_data.event_list=EventList.Design,event_data.product_id=productId.value):event_data={event_list:EventList.Design,product_id:productId.value};event_data.variantId=window.GAVariantId;let event_label=window.location.href+" / Event data : "+JSON.stringify(event_data);const gtaPreviewDesign={event:"custom_event",event_category:EventCategory.AdvancedStudio,event_action:action,event_label:event_label};pushToDatalayer(gtaPreviewDesign)};PushGAFaceliftWarning=function(className,source,isWarningOnly){let warnEventAction="";switch(className){case"warningMin":warnEventAction="Too_Small_image";break;case"warningICE":warnEventAction="Image_CloseTo_Edge";break;case"warningWS":warnEventAction="Possible_empty_areas";break;case"warningID":warnEventAction="No_image";break;case"warningLQ":warnEventAction="Low_quality";break;case"qualityPassed":warnEventAction="Good_quality"}isWarningOnly?pushAdvanceStudioToGTM(`Preview_Alert_${warnEventAction}`):pushAdvanceStudioToGTM(`Preview_Alert_action_${warnEventAction}_${source}`)};$("#previewButton").on("click",".tab-3d-button",ele=>{const tabEventAction=$(ele.currentTarget).attr("tab-event-action");tabEventAction&&pushEStoreDesignPreviewToGTM(tabEventAction)});pushEStoreDesignPreviewToGTM=function(action){const gtaPreviewDesign={event:"custom_event",event_category:EventCategory.EStoreDesignPreview,event_action:action,event_label:""};pushToDatalayer(gtaPreviewDesign)}; 24/** 25 * SimpleBar.js - v5.1.0 26 * Scrollbars, simpler. 27 * https://grsmto.github.io/simplebar/ 28 * 29 * Made by Adrien Denat from a fork by Jonathan Nicol 30 * Under MIT License 31 */ 32 33(function (global, factory) { 34 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 35 typeof define === 'function' && define.amd ? define(factory) : 36 (global = global || self, global.SimpleBar = factory()); 37}(this, function () { 38 'use strict'; 39 40 var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; 41 42 function createCommonjsModule(fn, module) { 43 return module = { exports: {} }, fn(module, module.exports), module.exports; 44 } 45 46 var O = 'object'; 47 var check = function (it) { 48 return it && it.Math == Math && it; 49 }; 50 51 // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 52 var global_1 = 53 // eslint-disable-next-line no-undef 54 check(typeof globalThis == O && globalThis) || 55 check(typeof window == O && window) || 56 check(typeof self == O && self) || 57 check(typeof commonjsGlobal == O && commonjsGlobal) || 58 // eslint-disable-next-line no-new-func 59 Function('return this')(); 60 61 var fails = function (exec) { 62 try { 63 return !!exec();
vendor: 5,798 bytes, lines 64-221
64 } catch (error) { 65 return true; 66 } 67 }; 68 69 // Thank's IE8 for his funny defineProperty 70 var descriptors = !fails(function () { 71 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; 72 }); 73 74 var nativePropertyIsEnumerable = {}.propertyIsEnumerable; 75 var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 76 77 // Nashorn ~ JDK8 bug 78 var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1); 79 80 // `Object.prototype.propertyIsEnumerable` method implementation 81 // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable 82 var f = NASHORN_BUG ? function propertyIsEnumerable(V) { 83 var descriptor = getOwnPropertyDescriptor(this, V); 84 return !!descriptor && descriptor.enumerable; 85 } : nativePropertyIsEnumerable; 86 87 var objectPropertyIsEnumerable = { 88 f: f 89 }; 90 91 var createPropertyDescriptor = function (bitmap, value) { 92 return { 93 enumerable: !(bitmap & 1), 94 configurable: !(bitmap & 2), 95 writable: !(bitmap & 4), 96 value: value 97 }; 98 }; 99 100 var toString = {}.toString; 101 102 var classofRaw = function (it) { 103 return toString.call(it).slice(8, -1); 104 }; 105 106 var split = ''.split; 107 108 // fallback for non-array-like ES3 and non-enumerable old V8 strings 109 var indexedObject = fails(function () { 110 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 111 // eslint-disable-next-line no-prototype-builtins 112 return !Object('z').propertyIsEnumerable(0); 113 }) ? function (it) { 114 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it); 115 } : Object; 116 117 // `RequireObjectCoercible` abstract operation 118 // https://tc39.github.io/ecma262/#sec-requireobjectcoercible 119 var requireObjectCoercible = function (it) { 120 if (it == undefined) throw TypeError("Can't call method on " + it); 121 return it; 122 }; 123 124 // toObject with fallback for non-array-like ES3 strings 125 126 127 128 var toIndexedObject = function (it) { 129 return indexedObject(requireObjectCoercible(it)); 130 }; 131 132 var isObject = function (it) { 133 return typeof it === 'object' ? it !== null : typeof it === 'function'; 134 }; 135 136 // `ToPrimitive` abstract operation 137 // https://tc39.github.io/ecma262/#sec-toprimitive 138 // instead of the ES6 spec version, we didn't implement @@toPrimitive case 139 // and the second argument - flag - preferred type is a string 140 var toPrimitive = function (input, PREFERRED_STRING) { 141 if (!isObject(input)) return input; 142 var fn, val; 143 if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; 144 if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; 145 if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; 146 throw TypeError("Can't convert object to primitive value"); 147 }; 148 149 var hasOwnProperty = {}.hasOwnProperty; 150 151 var has = function (it, key) { 152 return hasOwnProperty.call(it, key); 153 }; 154 155 var document$1 = global_1.document; 156 // typeof document.createElement is 'object' in old IE 157 var EXISTS = isObject(document$1) && isObject(document$1.createElement); 158 159 var documentCreateElement = function (it) { 160 return EXISTS ? document$1.createElement(it) : {}; 161 }; 162 163 // Thank's IE8 for his funny defineProperty 164 var ie8DomDefine = !descriptors && !fails(function () { 165 return Object.defineProperty(documentCreateElement('div'), 'a', { 166 get: function () { return 7; } 167 }).a != 7; 168 }); 169 170 var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 171 172 // `Object.getOwnPropertyDescriptor` method 173 // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor 174 var f$1 = descriptors ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) { 175 O = toIndexedObject(O); 176 P = toPrimitive(P, true); 177 if (ie8DomDefine) try { 178 return nativeGetOwnPropertyDescriptor(O, P); 179 } catch (error) { /* empty */ } 180 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]); 181 }; 182 183 var objectGetOwnPropertyDescriptor = { 184 f: f$1 185 }; 186 187 var anObject = function (it) { 188 if (!isObject(it)) { 189 throw TypeError(String(it) + ' is not an object'); 190 } return it; 191 }; 192 193 var nativeDefineProperty = Object.defineProperty; 194 195 // `Object.defineProperty` method 196 // https://tc39.github.io/ecma262/#sec-object.defineproperty 197 var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) { 198 anObject(O); 199 P = toPrimitive(P, true); 200 anObject(Attributes); 201 if (ie8DomDefine) try { 202 return nativeDefineProperty(O, P, Attributes); 203 } catch (error) { /* empty */ } 204 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported'); 205 if ('value' in Attributes) O[P] = Attributes.value; 206 return O; 207 }; 208 209 var objectDefineProperty = { 210 f: f$2 211 }; 212 213 var hide = descriptors ? function (object, key, value) { 214 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value)); 215 } : function (object, key, value) { 216 object[key] = value; 217 return object; 218 }; 219 220 var setGlobal = function (key, value) { 221 try {
vendor: 4,305 bytes, lines 222-348
222 hide(global_1, key, value); 223 } catch (error) { 224 global_1[key] = value; 225 } return value; 226 }; 227 228 var shared = createCommonjsModule(function (module) { 229 var SHARED = '__core-js_shared__'; 230 var store = global_1[SHARED] || setGlobal(SHARED, {}); 231 232 (module.exports = function (key, value) { 233 return store[key] || (store[key] = value !== undefined ? value : {}); 234 })('versions', []).push({ 235 version: '3.2.1', 236 mode: 'global', 237 copyright: '© 2019 Denis Pushkarev (zloirock.ru)' 238 }); 239 }); 240 241 var functionToString = shared('native-function-to-string', Function.toString); 242 243 var WeakMap$1 = global_1.WeakMap; 244 245 var nativeWeakMap = typeof WeakMap$1 === 'function' && /native code/.test(functionToString.call(WeakMap$1)); 246 247 var id = 0; 248 var postfix = Math.random(); 249 250 var uid = function (key) { 251 return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); 252 }; 253 254 var keys = shared('keys'); 255 256 var sharedKey = function (key) { 257 return keys[key] || (keys[key] = uid(key)); 258 }; 259 260 var hiddenKeys = {}; 261 262 var WeakMap$2 = global_1.WeakMap; 263 var set, get, has$1; 264 265 var enforce = function (it) { 266 return has$1(it) ? get(it) : set(it, {}); 267 }; 268 269 var getterFor = function (TYPE) { 270 return function (it) { 271 var state; 272 if (!isObject(it) || (state = get(it)).type !== TYPE) { 273 throw TypeError('Incompatible receiver, ' + TYPE + ' required'); 274 } return state; 275 }; 276 }; 277 278 if (nativeWeakMap) { 279 var store = new WeakMap$2(); 280 var wmget = store.get; 281 var wmhas = store.has; 282 var wmset = store.set; 283 set = function (it, metadata) { 284 wmset.call(store, it, metadata); 285 return metadata; 286 }; 287 get = function (it) { 288 return wmget.call(store, it) || {}; 289 }; 290 has$1 = function (it) { 291 return wmhas.call(store, it); 292 }; 293 } else { 294 var STATE = sharedKey('state'); 295 hiddenKeys[STATE] = true; 296 set = function (it, metadata) { 297 hide(it, STATE, metadata); 298 return metadata; 299 }; 300 get = function (it) { 301 return has(it, STATE) ? it[STATE] : {}; 302 }; 303 has$1 = function (it) { 304 return has(it, STATE); 305 }; 306 } 307 308 var internalState = { 309 set: set, 310 get: get, 311 has: has$1, 312 enforce: enforce, 313 getterFor: getterFor 314 }; 315 316 var redefine = createCommonjsModule(function (module) { 317 var getInternalState = internalState.get; 318 var enforceInternalState = internalState.enforce; 319 var TEMPLATE = String(functionToString).split('toString'); 320 321 shared('inspectSource', function (it) { 322 return functionToString.call(it); 323 }); 324 325 (module.exports = function (O, key, value, options) { 326 var unsafe = options ? !!options.unsafe : false; 327 var simple = options ? !!options.enumerable : false; 328 var noTargetGet = options ? !!options.noTargetGet : false; 329 if (typeof value == 'function') { 330 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key); 331 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : ''); 332 } 333 if (O === global_1) { 334 if (simple) O[key] = value; 335 else setGlobal(key, value); 336 return; 337 } else if (!unsafe) { 338 delete O[key]; 339 } else if (!noTargetGet && O[key]) { 340 simple = true; 341 } 342 if (simple) O[key] = value; 343 else hide(O, key, value); 344 // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative 345 })(Function.prototype, 'toString', function toString() { 346 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this); 347 }); 348 });
vendor: 5,938 bytes, lines 349-513
349 350 var path = global_1; 351 352 var aFunction = function (variable) { 353 return typeof variable == 'function' ? variable : undefined; 354 }; 355 356 var getBuiltIn = function (namespace, method) { 357 return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global_1[namespace]) 358 : path[namespace] && path[namespace][method] || global_1[namespace] && global_1[namespace][method]; 359 }; 360 361 var ceil = Math.ceil; 362 var floor = Math.floor; 363 364 // `ToInteger` abstract operation 365 // https://tc39.github.io/ecma262/#sec-tointeger 366 var toInteger = function (argument) { 367 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); 368 }; 369 370 var min = Math.min; 371 372 // `ToLength` abstract operation 373 // https://tc39.github.io/ecma262/#sec-tolength 374 var toLength = function (argument) { 375 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 376 }; 377 378 var max = Math.max; 379 var min$1 = Math.min; 380 381 // Helper for a popular repeating case of the spec: 382 // Let integer be ? ToInteger(index). 383 // If integer < 0, let result be max((length + integer), 0); else let result be min(length, length). 384 var toAbsoluteIndex = function (index, length) { 385 var integer = toInteger(index); 386 return integer < 0 ? max(integer + length, 0) : min$1(integer, length); 387 }; 388 389 // `Array.prototype.{ indexOf, includes }` methods implementation 390 var createMethod = function (IS_INCLUDES) { 391 return function ($this, el, fromIndex) { 392 var O = toIndexedObject($this); 393 var length = toLength(O.length); 394 var index = toAbsoluteIndex(fromIndex, length); 395 var value; 396 // Array#includes uses SameValueZero equality algorithm 397 // eslint-disable-next-line no-self-compare 398 if (IS_INCLUDES && el != el) while (length > index) { 399 value = O[index++]; 400 // eslint-disable-next-line no-self-compare 401 if (value != value) return true; 402 // Array#indexOf ignores holes, Array#includes - not 403 } else for (; length > index; index++) { 404 if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0; 405 } return !IS_INCLUDES && -1; 406 }; 407 }; 408 409 var arrayIncludes = { 410 // `Array.prototype.includes` method 411 // https://tc39.github.io/ecma262/#sec-array.prototype.includes 412 includes: createMethod(true), 413 // `Array.prototype.indexOf` method 414 // https://tc39.github.io/ecma262/#sec-array.prototype.indexof 415 indexOf: createMethod(false) 416 }; 417 418 var indexOf = arrayIncludes.indexOf; 419 420 421 var objectKeysInternal = function (object, names) { 422 var O = toIndexedObject(object); 423 var i = 0; 424 var result = []; 425 var key; 426 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); 427 // Don't enum bug & hidden keys 428 while (names.length > i) if (has(O, key = names[i++])) { 429 ~indexOf(result, key) || result.push(key); 430 } 431 return result; 432 }; 433 434 // IE8- don't enum bug keys 435 var enumBugKeys = [ 436 'constructor', 437 'hasOwnProperty', 438 'isPrototypeOf', 439 'propertyIsEnumerable', 440 'toLocaleString', 441 'toString', 442 'valueOf' 443 ]; 444 445 var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype'); 446 447 // `Object.getOwnPropertyNames` method 448 // https://tc39.github.io/ecma262/#sec-object.getownpropertynames 449 var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { 450 return objectKeysInternal(O, hiddenKeys$1); 451 }; 452 453 var objectGetOwnPropertyNames = { 454 f: f$3 455 }; 456 457 var f$4 = Object.getOwnPropertySymbols; 458 459 var objectGetOwnPropertySymbols = { 460 f: f$4 461 }; 462 463 // all object keys, includes non-enumerable and symbols 464 var ownKeys = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { 465 var keys = objectGetOwnPropertyNames.f(anObject(it)); 466 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; 467 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; 468 }; 469 470 var copyConstructorProperties = function (target, source) { 471 var keys = ownKeys(source); 472 var defineProperty = objectDefineProperty.f; 473 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f; 474 for (var i = 0; i < keys.length; i++) { 475 var key = keys[i]; 476 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); 477 } 478 }; 479 480 var replacement = /#|\.prototype\./; 481 482 var isForced = function (feature, detection) { 483 var value = data[normalize(feature)]; 484 return value == POLYFILL ? true 485 : value == NATIVE ? false 486 : typeof detection == 'function' ? fails(detection) 487 : !!detection; 488 }; 489 490 var normalize = isForced.normalize = function (string) { 491 return String(string).replace(replacement, '.').toLowerCase(); 492 }; 493 494 var data = isForced.data = {}; 495 var NATIVE = isForced.NATIVE = 'N'; 496 var POLYFILL = isForced.POLYFILL = 'P'; 497 498 var isForced_1 = isForced; 499 500 var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f; 501 502 503 504 505 506 507 /* 508 options.target - name of the target object 509 options.global - target is the global object 510 options.stat - export as static methods of target 511 options.proto - export as prototype methods of target 512 options.real - real prototype method for the `pure` version 513 options.forced - export even if the native feature is available
514 options.bind - bind methods to the target, required for the `pure` version 515 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version 516 options.unsafe - use the simple assignment of property instead of delete + defineProperty 517 options.sham - add a flag to not completely full polyfills 518 options.enumerable - export as enumerable property 519 options.noTargetGet - prevent calling a getter on target 520 */ 521 var _export = function (options, source) { 522 var TARGET = options.target; 523 var GLOBAL = options.global; 524 var STATIC = options.stat; 525 var FORCED, target, key, targetProperty, sourceProperty, descriptor; 526 if (GLOBAL) { 527 target = global_1; 528 } else if (STATIC) { 529 target = global_1[TARGET] || setGlobal(TARGET, {}); 530 } else { 531 target = (global_1[TARGET] || {}).prototype; 532 } 533 if (target) for (key in source) { 534 sourceProperty = source[key]; 535 if (options.noTargetGet) { 536 descriptor = getOwnPropertyDescriptor$1(target, key); 537 targetProperty = descriptor && descriptor.value; 538 } else targetProperty = target[key]; 539 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); 540 // contained in target 541 if (!FORCED && targetProperty !== undefined) { 542 if (typeof sourceProperty === typeof targetProperty) continue; 543 copyConstructorProperties(sourceProperty, targetProperty); 544 } 545 // add a flag to not completely full polyfills 546 if (options.sham || (targetProperty && targetProperty.sham)) { 547 hide(sourceProperty, 'sham', true); 548 } 549 // extend global 550 redefine(target, key, sourceProperty, options); 551 } 552 }; 553 554 var aFunction$1 = function (it) { 555 if (typeof it != 'function') { 556 throw TypeError(String(it) + ' is not a function'); 557 } return it; 558 }; 559 560 // optional / simple context binding 561 var bindContext = function (fn, that, length) { 562 aFunction$1(fn); 563 if (that === undefined) return fn; 564 switch (length) { 565 case 0: return function () { 566 return fn.call(that); 567 }; 568 case 1: return function (a) { 569 return fn.call(that, a); 570 }; 571 case 2: return function (a, b) { 572 return fn.call(that, a, b); 573 }; 574 case 3: return function (a, b, c) { 575 return fn.call(that, a, b, c); 576 }; 577 } 578 return function (/* ...args */) { 579 return fn.apply(that, arguments); 580 }; 581 }; 582 583 // `ToObject` abstract operation 584 // https://tc39.github.io/ecma262/#sec-toobject 585 var toObject = function (argument) { 586 return Object(requireObjectCoercible(argument)); 587 }; 588 589 // `IsArray` abstract operation 590 // https://tc39.github.io/ecma262/#sec-isarray 591 var isArray = Array.isArray || function isArray(arg) { 592 return classofRaw(arg) == 'Array'; 593 }; 594 595 var nativeSymbol = !!Object.getOwnPropertySymbols && !fails(function () { 596 // Chrome 38 Symbol has incorrect toString conversion 597 // eslint-disable-next-line no-undef 598 return !String(Symbol()); 599 }); 600 601 var Symbol$1 = global_1.Symbol; 602 var store$1 = shared('wks'); 603 604 var wellKnownSymbol = function (name) { 605 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name] 606 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name)); 607 }; 608 609 var SPECIES = wellKnownSymbol('species'); 610 611 // `ArraySpeciesCreate` abstract operation 612 // https://tc39.github.io/ecma262/#sec-arrayspeciescreate 613 var arraySpeciesCreate = function (originalArray, length) { 614 var C; 615 if (isArray(originalArray)) { 616 C = originalArray.constructor; 617 // cross-realm fallback 618 if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; 619 else if (isObject(C)) { 620 C = C[SPECIES]; 621 if (C === null) C = undefined; 622 } 623 } return new (C === undefined ? Array : C)(length === 0 ? 0 : length); 624 }; 625 626 var push = [].push; 627
628 // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex }` methods implementation 629 var createMethod$1 = function (TYPE) { 630 var IS_MAP = TYPE == 1; 631 var IS_FILTER = TYPE == 2; 632 var IS_SOME = TYPE == 3; 633 var IS_EVERY = TYPE == 4; 634 var IS_FIND_INDEX = TYPE == 6; 635 var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; 636 return function ($this, callbackfn, that, specificCreate) { 637 var O = toObject($this); 638 var self = indexedObject(O); 639 var boundFunction = bindContext(callbackfn, that, 3); 640 var length = toLength(self.length); 641 var index = 0; 642 var create = specificCreate || arraySpeciesCreate; 643 var target = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; 644 var value, result; 645 for (; length > index; index++) if (NO_HOLES || index in self) { 646 value = self[index]; 647 result = boundFunction(value, index, O); 648 if (TYPE) { 649 if (IS_MAP) target[index] = result; // map 650 else if (result) switch (TYPE) { 651 case 3: return true; // some 652 case 5: return value; // find 653 case 6: return index; // findIndex 654 case 2: push.call(target, value); // filter 655 } else if (IS_EVERY) return false; // every 656 } 657 } 658 return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target; 659 }; 660 }; 661 662 var arrayIteration = { 663 // `Array.prototype.forEach` method 664 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach 665 forEach: createMethod$1(0), 666 // `Array.prototype.map` method 667 // https://tc39.github.io/ecma262/#sec-array.prototype.map 668 map: createMethod$1(1), 669 // `Array.prototype.filter` method 670 // https://tc39.github.io/ecma262/#sec-array.prototype.filter 671 filter: createMethod$1(2), 672 // `Array.prototype.some` method 673 // https://tc39.github.io/ecma262/#sec-array.prototype.some 674 some: createMethod$1(3), 675 // `Array.prototype.every` method 676 // https://tc39.github.io/ecma262/#sec-array.prototype.every 677 every: createMethod$1(4), 678 // `Array.prototype.find` method 679 // https://tc39.github.io/ecma262/#sec-array.prototype.find 680 find: createMethod$1(5), 681 // `Array.prototype.findIndex` method 682 // https://tc39.github.io/ecma262/#sec-array.prototype.findIndex 683 findIndex: createMethod$1(6) 684 }; 685 686 var sloppyArrayMethod = function (METHOD_NAME, argument) { 687 var method = [][METHOD_NAME]; 688 return !method || !fails(function () { 689 // eslint-disable-next-line no-useless-call,no-throw-literal 690 method.call(null, argument || function () { throw 1; }, 1); 691 }); 692 }; 693 694 var $forEach = arrayIteration.forEach; 695 696 697 // `Array.prototype.forEach` method implementation 698 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach 699 var arrayForEach = sloppyArrayMethod('forEach') ? function forEach(callbackfn /* , thisArg */) { 700 return $forEach(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 701 } : [].forEach; 702 703 // `Array.prototype.forEach` method 704 // https://tc39.github.io/ecma262/#sec-array.prototype.foreach 705 _export({ target: 'Array', proto: true, forced: [].forEach != arrayForEach }, { 706 forEach: arrayForEach 707 }); 708 709 // iterable DOM collections 710 // flag - `iterable` interface - 'entries', 'keys', 'values', 'forEach' methods 711 var domIterables = { 712 CSSRuleList: 0, 713 CSSStyleDeclaration: 0, 714 CSSValueList: 0, 715 ClientRectList: 0, 716 DOMRectList: 0, 717 DOMStringList: 0, 718 DOMTokenList: 1, 719 DataTransferItemList: 0, 720 FileList: 0, 721 HTMLAllCollection: 0, 722 HTMLCollection: 0, 723 HTMLFormElement: 0, 724 HTMLSelectElement: 0, 725 MediaList: 0, 726 MimeTypeArray: 0, 727 NamedNodeMap: 0, 728 NodeList: 1, 729 PaintRequestList: 0, 730 Plugin: 0, 731 PluginArray: 0, 732 SVGLengthList: 0, 733 SVGNumberList: 0, 734 SVGPathSegList: 0, 735 SVGPointList: 0, 736 SVGStringList: 0, 737 SVGTransformList: 0, 738 SourceBufferList: 0, 739 StyleSheetList: 0, 740 TextTrackCueList: 0, 741 TextTrackList: 0, 742 TouchList: 0 743 }; 744 745 for (var COLLECTION_NAME in domIterables) { 746 var Collection = global_1[COLLECTION_NAME]; 747 var CollectionPrototype = Collection && Collection.prototype; 748 // some Chrome versions have non-configurable methods on DOMTokenList 749 if (CollectionPrototype && CollectionPrototype.forEach !== arrayForEach) try { 750 hide(CollectionPrototype, 'forEach', arrayForEach); 751 } catch (error) { 752 CollectionPrototype.forEach = arrayForEach; 753 } 754 } 755 756 var canUseDOM = !!( 757 typeof window !== 'undefined' && 758 window.document && 759 window.document.createElement 760 ); 761 762 var canUseDom = canUseDOM; 763 764 var SPECIES$1 = wellKnownSymbol('species'); 765 766 var arrayMethodHasSpeciesSupport = function (METHOD_NAME) { 767 return !fails(function () { 768 var array = []; 769 var constructor = array.constructor = {}; 770 constructor[SPECIES$1] = function () { 771 return { foo: 1 }; 772 }; 773 return array[METHOD_NAME](Boolean).foo !== 1; 774 }); 775 }; 776 777 var $filter = arrayIteration.filter; 778 779 780 // `Array.prototype.filter` method 781 // https://tc39.github.io/ecma262/#sec-array.prototype.filter 782 // with adding support of @@species 783 _export({ target: 'Array', proto: true, forced: !arrayMethodHasSpeciesSupport('filter') }, { 784 filter: function filter(callbackfn /* , thisArg */) { 785 return $filter(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); 786 } 787 });
vendor: 14,255 bytes, lines 788-1124
788 789 // `Object.keys` method 790 // https://tc39.github.io/ecma262/#sec-object.keys 791 var objectKeys = Object.keys || function keys(O) { 792 return objectKeysInternal(O, enumBugKeys); 793 }; 794 795 // `Object.defineProperties` method 796 // https://tc39.github.io/ecma262/#sec-object.defineproperties 797 var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) { 798 anObject(O); 799 var keys = objectKeys(Properties); 800 var length = keys.length; 801 var index = 0; 802 var key; 803 while (length > index) objectDefineProperty.f(O, key = keys[index++], Properties[key]); 804 return O; 805 }; 806 807 var html = getBuiltIn('document', 'documentElement'); 808 809 var IE_PROTO = sharedKey('IE_PROTO'); 810 811 var PROTOTYPE = 'prototype'; 812 var Empty = function () { /* empty */ }; 813 814 // Create object with fake `null` prototype: use iframe Object with cleared prototype 815 var createDict = function () { 816 // Thrash, waste and sodomy: IE GC bug 817 var iframe = documentCreateElement('iframe'); 818 var length = enumBugKeys.length; 819 var lt = '<'; 820 var script = 'script'; 821 var gt = '>'; 822 var js = 'java' + script + ':'; 823 var iframeDocument; 824 iframe.style.display = 'none'; 825 html.appendChild(iframe); 826 iframe.src = String(js); 827 iframeDocument = iframe.contentWindow.document; 828 iframeDocument.open(); 829 iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt); 830 iframeDocument.close(); 831 createDict = iframeDocument.F; 832 while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]]; 833 return createDict(); 834 }; 835 836 // `Object.create` method 837 // https://tc39.github.io/ecma262/#sec-object.create 838 var objectCreate = Object.create || function create(O, Properties) { 839 var result; 840 if (O !== null) { 841 Empty[PROTOTYPE] = anObject(O); 842 result = new Empty(); 843 Empty[PROTOTYPE] = null; 844 // add "__proto__" for Object.getPrototypeOf polyfill 845 result[IE_PROTO] = O; 846 } else result = createDict(); 847 return Properties === undefined ? result : objectDefineProperties(result, Properties); 848 }; 849 850 hiddenKeys[IE_PROTO] = true; 851 852 var UNSCOPABLES = wellKnownSymbol('unscopables'); 853 var ArrayPrototype = Array.prototype; 854 855 // Array.prototype[@@unscopables] 856 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables 857 if (ArrayPrototype[UNSCOPABLES] == undefined) { 858 hide(ArrayPrototype, UNSCOPABLES, objectCreate(null)); 859 } 860 861 // add a key to Array.prototype[@@unscopables] 862 var addToUnscopables = function (key) { 863 ArrayPrototype[UNSCOPABLES][key] = true; 864 }; 865 866 var iterators = {}; 867 868 var correctPrototypeGetter = !fails(function () { 869 function F() { /* empty */ } 870 F.prototype.constructor = null; 871 return Object.getPrototypeOf(new F()) !== F.prototype; 872 }); 873 874 var IE_PROTO$1 = sharedKey('IE_PROTO'); 875 var ObjectPrototype = Object.prototype; 876 877 // `Object.getPrototypeOf` method 878 // https://tc39.github.io/ecma262/#sec-object.getprototypeof 879 var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) { 880 O = toObject(O); 881 if (has(O, IE_PROTO$1)) return O[IE_PROTO$1]; 882 if (typeof O.constructor == 'function' && O instanceof O.constructor) { 883 return O.constructor.prototype; 884 } return O instanceof Object ? ObjectPrototype : null; 885 }; 886 887 var ITERATOR = wellKnownSymbol('iterator'); 888 var BUGGY_SAFARI_ITERATORS = false; 889 890 var returnThis = function () { return this; }; 891 892 // `%IteratorPrototype%` object 893 // https://tc39.github.io/ecma262/#sec-%iteratorprototype%-object 894 var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; 895 896 if ([].keys) { 897 arrayIterator = [].keys(); 898 // Safari 8 has buggy iterators w/o `next` 899 if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true; 900 else { 901 PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator)); 902 if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype; 903 } 904 } 905 906 if (IteratorPrototype == undefined) IteratorPrototype = {}; 907 908 // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() 909 if (!has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); 910 911 var iteratorsCore = { 912 IteratorPrototype: IteratorPrototype, 913 BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS 914 }; 915 916 var defineProperty = objectDefineProperty.f; 917 918 919 920 var TO_STRING_TAG = wellKnownSymbol('toStringTag'); 921 922 var setToStringTag = function (it, TAG, STATIC) { 923 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { 924 defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG }); 925 } 926 }; 927 928 var IteratorPrototype$1 = iteratorsCore.IteratorPrototype; 929 930 931 932 933 934 var returnThis$1 = function () { return this; }; 935 936 var createIteratorConstructor = function (IteratorConstructor, NAME, next) { 937 var TO_STRING_TAG = NAME + ' Iterator'; 938 IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) }); 939 setToStringTag(IteratorConstructor, TO_STRING_TAG, false); 940 iterators[TO_STRING_TAG] = returnThis$1; 941 return IteratorConstructor; 942 }; 943 944 var aPossiblePrototype = function (it) { 945 if (!isObject(it) && it !== null) { 946 throw TypeError("Can't set " + String(it) + ' as a prototype'); 947 } return it; 948 }; 949 950 // `Object.setPrototypeOf` method 951 // https://tc39.github.io/ecma262/#sec-object.setprototypeof 952 // Works with __proto__ only. Old v8 can't work with null proto objects. 953 /* eslint-disable no-proto */ 954 var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () { 955 var CORRECT_SETTER = false; 956 var test = {}; 957 var setter; 958 try { 959 setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; 960 setter.call(test, []); 961 CORRECT_SETTER = test instanceof Array; 962 } catch (error) { /* empty */ } 963 return function setPrototypeOf(O, proto) { 964 anObject(O); 965 aPossiblePrototype(proto); 966 if (CORRECT_SETTER) setter.call(O, proto); 967 else O.__proto__ = proto; 968 return O; 969 }; 970 }() : undefined); 971 972 var IteratorPrototype$2 = iteratorsCore.IteratorPrototype; 973 var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS; 974 var ITERATOR$1 = wellKnownSymbol('iterator'); 975 var KEYS = 'keys'; 976 var VALUES = 'values'; 977 var ENTRIES = 'entries'; 978 979 var returnThis$2 = function () { return this; }; 980 981 var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) { 982 createIteratorConstructor(IteratorConstructor, NAME, next); 983 984 var getIterationMethod = function (KIND) { 985 if (KIND === DEFAULT && defaultIterator) return defaultIterator; 986 if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND]; 987 switch (KIND) { 988 case KEYS: return function keys() { return new IteratorConstructor(this, KIND); }; 989 case VALUES: return function values() { return new IteratorConstructor(this, KIND); }; 990 case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); }; 991 } return function () { return new IteratorConstructor(this); }; 992 }; 993 994 var TO_STRING_TAG = NAME + ' Iterator'; 995 var INCORRECT_VALUES_NAME = false; 996 var IterablePrototype = Iterable.prototype; 997 var nativeIterator = IterablePrototype[ITERATOR$1] 998 || IterablePrototype['@@iterator'] 999 || DEFAULT && IterablePrototype[DEFAULT]; 1000 var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT); 1001 var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator; 1002 var CurrentIteratorPrototype, methods, KEY; 1003 1004 // fix native 1005 if (anyNativeIterator) { 1006 CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable())); 1007 if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) { 1008 if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) { 1009 if (objectSetPrototypeOf) { 1010 objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2); 1011 } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') { 1012 hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$2); 1013 } 1014 } 1015 // Set @@toStringTag to native iterators 1016 setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true); 1017 } 1018 } 1019 1020 // fix Array#{values, @@iterator}.name in V8 / FF 1021 if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { 1022 INCORRECT_VALUES_NAME = true; 1023 defaultIterator = function values() { return nativeIterator.call(this); }; 1024 } 1025 1026 // define iterator 1027 if (IterablePrototype[ITERATOR$1] !== defaultIterator) { 1028 hide(IterablePrototype, ITERATOR$1, defaultIterator); 1029 } 1030 iterators[NAME] = defaultIterator; 1031 1032 // export additional methods 1033 if (DEFAULT) { 1034 methods = { 1035 values: getIterationMethod(VALUES), 1036 keys: IS_SET ? defaultIterator : getIterationMethod(KEYS), 1037 entries: getIterationMethod(ENTRIES) 1038 }; 1039 if (FORCED) for (KEY in methods) { 1040 if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) { 1041 redefine(IterablePrototype, KEY, methods[KEY]); 1042 } 1043 } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods); 1044 } 1045 1046 return methods; 1047 }; 1048 1049 var ARRAY_ITERATOR = 'Array Iterator'; 1050 var setInternalState = internalState.set; 1051 var getInternalState = internalState.getterFor(ARRAY_ITERATOR); 1052 1053 // `Array.prototype.entries` method 1054 // https://tc39.github.io/ecma262/#sec-array.prototype.entries 1055 // `Array.prototype.keys` method 1056 // https://tc39.github.io/ecma262/#sec-array.prototype.keys 1057 // `Array.prototype.values` method 1058 // https://tc39.github.io/ecma262/#sec-array.prototype.values 1059 // `Array.prototype[@@iterator]` method 1060 // https://tc39.github.io/ecma262/#sec-array.prototype-@@iterator 1061 // `CreateArrayIterator` internal method 1062 // https://tc39.github.io/ecma262/#sec-createarrayiterator 1063 var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) { 1064 setInternalState(this, { 1065 type: ARRAY_ITERATOR, 1066 target: toIndexedObject(iterated), // target 1067 index: 0, // next index 1068 kind: kind // kind 1069 }); 1070 // `%ArrayIteratorPrototype%.next` method 1071 // https://tc39.github.io/ecma262/#sec-%arrayiteratorprototype%.next 1072 }, function () { 1073 var state = getInternalState(this); 1074 var target = state.target; 1075 var kind = state.kind; 1076 var index = state.index++; 1077 if (!target || index >= target.length) { 1078 state.target = undefined; 1079 return { value: undefined, done: true }; 1080 } 1081 if (kind == 'keys') return { value: index, done: false }; 1082 if (kind == 'values') return { value: target[index], done: false }; 1083 return { value: [index, target[index]], done: false }; 1084 }, 'values'); 1085 1086 // argumentsList[@@iterator] is %ArrayProto_values% 1087 // https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject 1088 // https://tc39.github.io/ecma262/#sec-createmappedargumentsobject 1089 iterators.Arguments = iterators.Array; 1090 1091 // https://tc39.github.io/ecma262/#sec-array.prototype-@@unscopables 1092 addToUnscopables('keys'); 1093 addToUnscopables('values'); 1094 addToUnscopables('entries'); 1095 1096 var nativeAssign = Object.assign; 1097 1098 // `Object.assign` method 1099 // https://tc39.github.io/ecma262/#sec-object.assign 1100 // should work with symbols and should have deterministic property order (V8 bug) 1101 var objectAssign = !nativeAssign || fails(function () { 1102 var A = {}; 1103 var B = {}; 1104 // eslint-disable-next-line no-undef 1105 var symbol = Symbol(); 1106 var alphabet = 'abcdefghijklmnopqrst'; 1107 A[symbol] = 7; 1108 alphabet.split('').forEach(function (chr) { B[chr] = chr; }); 1109 return nativeAssign({}, A)[symbol] != 7 || objectKeys(nativeAssign({}, B)).join('') != alphabet; 1110 }) ? function assign(target, source) { // eslint-disable-line no-unused-vars 1111 var T = toObject(target); 1112 var argumentsLength = arguments.length; 1113 var index = 1; 1114 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f; 1115 var propertyIsEnumerable = objectPropertyIsEnumerable.f; 1116 while (argumentsLength > index) { 1117 var S = indexedObject(arguments[index++]); 1118 var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); 1119 var length = keys.length; 1120 var j = 0; 1121 var key; 1122 while (length > j) { 1123 key = keys[j++]; 1124 if (!descriptors || propertyIsEnumerable.call(S, key)) T[ke
1124y] = S[key]; 1125 } 1126 } return T; 1127 } : nativeAssign; 1128 1129 // `Object.assign` method 1130 // https://tc39.github.io/ecma262/#sec-object.assign 1131 _export({ target: 'Object', stat: true, forced: Object.assign !== objectAssign }, { 1132 assign: objectAssign 1133 }); 1134 1135 var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag'); 1136 // ES3 wrong here 1137 var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments'; 1138 1139 // fallback for IE11 Script Access Denied error 1140 var tryGet = function (it, key) { 1141 try { 1142 return it[key]; 1143 } catch (error) { /* empty */ } 1144 }; 1145 1146 // getting tag from ES6+ `Object.prototype.toString` 1147 var classof = function (it) { 1148 var O, tag, result; 1149 return it === undefined ? 'Undefined' : it === null ? 'Null' 1150 // @@toStringTag case 1151 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG$1)) == 'string' ? tag 1152 // builtinTag case 1153 : CORRECT_ARGUMENTS ? classofRaw(O) 1154 // ES3 arguments fallback 1155 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; 1156 }; 1157 1158 var TO_STRING_TAG$2 = wellKnownSymbol('toStringTag'); 1159 var test = {}; 1160 1161 test[TO_STRING_TAG$2] = 'z'; 1162 1163 // `Object.prototype.toString` method implementation 1164 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring 1165 var objectToString = String(test) !== '[object z]' ? function toString() { 1166 return '[object ' + classof(this) + ']'; 1167 } : test.toString; 1168 1169 var ObjectPrototype$1 = Object.prototype; 1170 1171 // `Object.prototype.toString` method 1172 // https://tc39.github.io/ecma262/#sec-object.prototype.tostring 1173 if (objectToString !== ObjectPrototype$1.toString) { 1174 redefine(ObjectPrototype$1, 'toString', objectToString, { unsafe: true }); 1175 } 1176 1177 // a string of all valid unicode whitespaces 1178 // eslint-disable-next-line max-len 1179 var whitespaces = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; 1180 1181 var whitespace = '[' + whitespaces + ']'; 1182 var ltrim = RegExp('^' + whitespace + whitespace + '*'); 1183 var rtrim = RegExp(whitespace + whitespace + '*$'); 1184 1185 // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation 1186 var createMethod$2 = function (TYPE) { 1187 return function ($this) { 1188 var string = String(requireObjectCoercible($this)); 1189 if (TYPE & 1) string = string.replace(ltrim, ''); 1190 if (TYPE & 2) string = string.replace(rtrim, ''); 1191 return string; 1192 }; 1193 }; 1194 1195 var stringTrim = { 1196 // `String.prototype.{ trimLeft, trimStart }` methods 1197 // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart 1198 start: createMethod$2(1), 1199 // `String.prototype.{ trimRight, trimEnd }` methods 1200 // https://tc39.github.io/ecma262/#sec-string.prototype.trimend 1201 end: createMethod$2(2), 1202 // `String.prototype.trim` method 1203 // https://tc39.github.io/ecma262/#sec-string.prototype.trim 1204 trim: createMethod$2(3) 1205 }; 1206 1207 var trim = stringTrim.trim; 1208 1209 1210 var nativeParseInt = global_1.parseInt; 1211 var hex = /^[+-]?0[Xx]/;
1212 var FORCED = nativeParseInt(whitespaces + '08') !== 8 || nativeParseInt(whitespaces + '0x16') !== 22; 1213 1214 // `parseInt` method 1215 // https://tc39.github.io/ecma262/#sec-parseint-string-radix 1216 var _parseInt = FORCED ? function parseInt(string, radix) { 1217 var S = trim(String(string)); 1218 return nativeParseInt(S, (radix >>> 0) || (hex.test(S) ? 16 : 10)); 1219 } : nativeParseInt; 1220 1221 // `parseInt` method 1222 // https://tc39.github.io/ecma262/#sec-parseint-string-radix 1223 _export({ global: true, forced: parseInt != _parseInt }, { 1224 parseInt: _parseInt 1225 }); 1226 1227 // `String.prototype.{ codePointAt, at }` methods implementation 1228 var createMethod$3 = function (CONVERT_TO_STRING) { 1229 return function ($this, pos) { 1230 var S = String(requireObjectCoercible($this)); 1231 var position = toInteger(pos); 1232 var size = S.length; 1233 var first, second; 1234 if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; 1235 first = S.charCodeAt(position); 1236 return first < 0xD800 || first > 0xDBFF || position + 1 === size 1237 || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF 1238 ? CONVERT_TO_STRING ? S.charAt(position) : first 1239 : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; 1240 }; 1241 }; 1242 1243 var stringMultibyte = { 1244 // `String.prototype.codePointAt` method 1245 // https://tc39.github.io/ecma262/#sec-string.prototype.codepointat 1246 codeAt: createMethod$3(false), 1247 // `String.prototype.at` method 1248 // https://github.com/mathiasbynens/String.prototype.at 1249 charAt: createMethod$3(true) 1250 }; 1251 1252 var charAt = stringMultibyte.charAt; 1253 1254 1255 1256 var STRING_ITERATOR = 'String Iterator'; 1257 var setInternalState$1 = internalState.set; 1258 var getInternalState$1 = internalState.getterFor(STRING_ITERATOR); 1259 1260 // `String.prototype[@@iterator]` method 1261 // https://tc39.github.io/ecma262/#sec-string.prototype-@@iterator 1262 defineIterator(String, 'String', function (iterated) { 1263 setInternalState$1(this, { 1264 type: STRING_ITERATOR, 1265 string: String(iterated), 1266 index: 0 1267 }); 1268 // `%StringIteratorPrototype%.next` method 1269 // https://tc39.github.io/ecma262/#sec-%stringiteratorprototype%.next 1270 }, function next() { 1271 var state = getInternalState$1(this); 1272 var string = state.string; 1273 var index = state.index; 1274 var point; 1275 if (index >= string.length) return { value: undefined, done: true }; 1276 point = charAt(string, index); 1277 state.index += point.length; 1278 return { value: point, done: false }; 1279 }); 1280 1281 var redefineAll = function (target, src, options) { 1282 for (var key in src) redefine(target, key, src[key], options); 1283 return target; 1284 }; 1285 1286 var freezing = !fails(function () { 1287 return Object.isExtensible(Object.preventExtensions({})); 1288 }); 1289 1290 var internalMetadata = createCommonjsModule(function (module) { 1291 var defineProperty = objectDefineProperty.f; 1292 1293 1294 1295 var METADATA = uid('meta'); 1296 var id = 0; 1297 1298 var isExtensible = Object.isExtensible || function () { 1299 return true; 1300 }; 1301 1302 var setMetadata = function (it) { 1303 defineProperty(it, METADATA, { 1304 value: { 1305 objectID: 'O' + ++id, // object ID 1306 weakData: {} // weak collections IDs 1307 } 1308 }); 1309 }; 1310 1311 var fastKey = function (it, create) { 1312 // return a primitive with prefix 1313 if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; 1314 if (!has(it, METADATA)) { 1315 // can't set metadata to uncaught frozen object 1316 if (!isExtensible(it)) return 'F'; 1317 // not necessary to add metadata 1318 if (!create) return 'E'; 1319 // add missing metadata 1320 setMetadata(it); 1321 // return object ID 1322 } return it[METADATA].objectID; 1323 }; 1324 1325 var getWeakData = function (it, create) { 1326 if (!has(it, METADATA)) { 1327 // can't set metadata to uncaught frozen object 1328 if (!isExtensible(it)) return true; 1329 // not necessary to add metadata 1330 if (!create) return false; 1331 // add missing metadata 1332 setMetadata(it); 1333 // return the store of weak collections IDs 1334 } return it[METADATA].weakData; 1335 }; 1336 1337 // add metadata on freeze-family methods calling 1338 var onFreeze = function (it) { 1339 if (freezing && meta.REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); 1340 return it; 1341 }; 1342 1343 var meta = module.exports = { 1344 REQUIRED: false, 1345 fastKey: fastKey, 1346 getWeakData: getWeakData, 1347 onFreeze: onFreeze 1348 }; 1349 1350 hiddenKeys[METADATA] = true; 1351 });
vendor: 4,127 bytes, lines 1352-1456
1352 var internalMetadata_1 = internalMetadata.REQUIRED; 1353 var internalMetadata_2 = internalMetadata.fastKey; 1354 var internalMetadata_3 = internalMetadata.getWeakData; 1355 var internalMetadata_4 = internalMetadata.onFreeze; 1356 1357 var ITERATOR$2 = wellKnownSymbol('iterator'); 1358 var ArrayPrototype$1 = Array.prototype; 1359 1360 // check on default Array iterator 1361 var isArrayIteratorMethod = function (it) { 1362 return it !== undefined && (iterators.Array === it || ArrayPrototype$1[ITERATOR$2] === it); 1363 }; 1364 1365 var ITERATOR$3 = wellKnownSymbol('iterator'); 1366 1367 var getIteratorMethod = function (it) { 1368 if (it != undefined) return it[ITERATOR$3] 1369 || it['@@iterator'] 1370 || iterators[classof(it)]; 1371 }; 1372 1373 // call something on iterator step with safe closing on error 1374 var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) { 1375 try { 1376 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value); 1377 // 7.4.6 IteratorClose(iterator, completion) 1378 } catch (error) { 1379 var returnMethod = iterator['return']; 1380 if (returnMethod !== undefined) anObject(returnMethod.call(iterator)); 1381 throw error; 1382 } 1383 }; 1384 1385 var iterate_1 = createCommonjsModule(function (module) { 1386 var Result = function (stopped, result) { 1387 this.stopped = stopped; 1388 this.result = result; 1389 }; 1390 1391 var iterate = module.exports = function (iterable, fn, that, AS_ENTRIES, IS_ITERATOR) { 1392 var boundFunction = bindContext(fn, that, AS_ENTRIES ? 2 : 1); 1393 var iterator, iterFn, index, length, result, step; 1394 1395 if (IS_ITERATOR) { 1396 iterator = iterable; 1397 } else { 1398 iterFn = getIteratorMethod(iterable); 1399 if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); 1400 // optimisation for array iterators 1401 if (isArrayIteratorMethod(iterFn)) { 1402 for (index = 0, length = toLength(iterable.length); length > index; index++) { 1403 result = AS_ENTRIES 1404 ? boundFunction(anObject(step = iterable[index])[0], step[1]) 1405 : boundFunction(iterable[index]); 1406 if (result && result instanceof Result) return result; 1407 } return new Result(false); 1408 } 1409 iterator = iterFn.call(iterable); 1410 } 1411 1412 while (!(step = iterator.next()).done) { 1413 result = callWithSafeIterationClosing(iterator, boundFunction, step.value, AS_ENTRIES); 1414 if (result && result instanceof Result) return result; 1415 } return new Result(false); 1416 }; 1417 1418 iterate.stop = function (result) { 1419 return new Result(true, result); 1420 }; 1421 }); 1422 1423 var anInstance = function (it, Constructor, name) { 1424 if (!(it instanceof Constructor)) { 1425 throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); 1426 } return it; 1427 }; 1428 1429 var ITERATOR$4 = wellKnownSymbol('iterator'); 1430 var SAFE_CLOSING = false; 1431 1432 try { 1433 var called = 0; 1434 var iteratorWithReturn = { 1435 next: function () { 1436 return { done: !!called++ }; 1437 }, 1438 'return': function () { 1439 SAFE_CLOSING = true; 1440 } 1441 }; 1442 iteratorWithReturn[ITERATOR$4] = function () { 1443 return this; 1444 }; 1445 // eslint-disable-next-line no-throw-literal 1446 Array.from(iteratorWithReturn, function () { throw 2; }); 1447 } catch (error) { /* empty */ } 1448 1449 var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) { 1450 if (!SKIP_CLOSING && !SAFE_CLOSING) return false; 1451 var ITERATION_SUPPORT = false; 1452 try { 1453 var object = {}; 1454 object[ITERATOR$4] = function () { 1455 return { 1456 next: function () {
vendor: 5,438 bytes, lines 1457-1579
1457 return { done: ITERATION_SUPPORT = true }; 1458 } 1459 }; 1460 }; 1461 exec(object); 1462 } catch (error) { /* empty */ } 1463 return ITERATION_SUPPORT; 1464 }; 1465 1466 // makes subclassing work correct for wrapped built-ins 1467 var inheritIfRequired = function ($this, dummy, Wrapper) { 1468 var NewTarget, NewTargetPrototype; 1469 if ( 1470 // it can work only with native `setPrototypeOf` 1471 objectSetPrototypeOf && 1472 // we haven't completely correct pre-ES6 way for getting `new.target`, so use this 1473 typeof (NewTarget = dummy.constructor) == 'function' && 1474 NewTarget !== Wrapper && 1475 isObject(NewTargetPrototype = NewTarget.prototype) && 1476 NewTargetPrototype !== Wrapper.prototype 1477 ) objectSetPrototypeOf($this, NewTargetPrototype); 1478 return $this; 1479 }; 1480 1481 var collection = function (CONSTRUCTOR_NAME, wrapper, common, IS_MAP, IS_WEAK) { 1482 var NativeConstructor = global_1[CONSTRUCTOR_NAME]; 1483 var NativePrototype = NativeConstructor && NativeConstructor.prototype; 1484 var Constructor = NativeConstructor; 1485 var ADDER = IS_MAP ? 'set' : 'add'; 1486 var exported = {}; 1487 1488 var fixMethod = function (KEY) { 1489 var nativeMethod = NativePrototype[KEY]; 1490 redefine(NativePrototype, KEY, 1491 KEY == 'add' ? function add(value) { 1492 nativeMethod.call(this, value === 0 ? 0 : value); 1493 return this; 1494 } : KEY == 'delete' ? function (key) { 1495 return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); 1496 } : KEY == 'get' ? function get(key) { 1497 return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); 1498 } : KEY == 'has' ? function has(key) { 1499 return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); 1500 } : function set(key, value) { 1501 nativeMethod.call(this, key === 0 ? 0 : key, value); 1502 return this; 1503 } 1504 ); 1505 }; 1506 1507 // eslint-disable-next-line max-len 1508 if (isForced_1(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { 1509 new NativeConstructor().entries().next(); 1510 })))) { 1511 // create collection constructor 1512 Constructor = common.getConstructor(wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER); 1513 internalMetadata.REQUIRED = true; 1514 } else if (isForced_1(CONSTRUCTOR_NAME, true)) { 1515 var instance = new Constructor(); 1516 // early implementations not supports chaining 1517 var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; 1518 // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false 1519 var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); 1520 // most early implementations doesn't supports iterables, most modern - not close it correctly 1521 // eslint-disable-next-line no-new 1522 var ACCEPT_ITERABLES = checkCorrectnessOfIteration(function (iterable) { new NativeConstructor(iterable); }); 1523 // for early implementations -0 and +0 not the same 1524 var BUGGY_ZERO = !IS_WEAK && fails(function () { 1525 // V8 ~ Chromium 42- fails only with 5+ elements 1526 var $instance = new NativeConstructor(); 1527 var index = 5; 1528 while (index--) $instance[ADDER](index, index); 1529 return !$instance.has(-0); 1530 }); 1531 1532 if (!ACCEPT_ITERABLES) { 1533 Constructor = wrapper(function (dummy, iterable) { 1534 anInstance(dummy, Constructor, CONSTRUCTOR_NAME); 1535 var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); 1536 if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); 1537 return that; 1538 }); 1539 Constructor.prototype = NativePrototype; 1540 NativePrototype.constructor = Constructor; 1541 } 1542 1543 if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { 1544 fixMethod('delete'); 1545 fixMethod('has'); 1546 IS_MAP && fixMethod('get'); 1547 } 1548 1549 if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); 1550 1551 // weak collections should not contains .clear method 1552 if (IS_WEAK && NativePrototype.clear) delete NativePrototype.clear; 1553 } 1554 1555 exported[CONSTRUCTOR_NAME] = Constructor; 1556 _export({ global: true, forced: Constructor != NativeConstructor }, exported); 1557 1558 setToStringTag(Constructor, CONSTRUCTOR_NAME); 1559 1560 if (!IS_WEAK) common.setStrong(Constructor, CONSTRUCTOR_NAME, IS_MAP); 1561 1562 return Constructor; 1563 }; 1564 1565 var getWeakData = internalMetadata.getWeakData; 1566 1567 1568 1569 1570 1571 1572 1573 1574 var setInternalState$2 = internalState.set; 1575 var internalStateGetterFor = internalState.getterFor; 1576 var find = arrayIteration.find; 1577 var findIndex = arrayIteration.findIndex; 1578 var id$1 = 0; 1579
1580 // fallback for uncaught frozen keys 1581 var uncaughtFrozenStore = function (store) { 1582 return store.frozen || (store.frozen = new UncaughtFrozenStore()); 1583 }; 1584 1585 var UncaughtFrozenStore = function () { 1586 this.entries = []; 1587 }; 1588 1589 var findUncaughtFrozen = function (store, key) { 1590 return find(store.entries, function (it) { 1591 return it[0] === key; 1592 }); 1593 }; 1594 1595 UncaughtFrozenStore.prototype = { 1596 get: function (key) { 1597 var entry = findUncaughtFrozen(this, key); 1598 if (entry) return entry[1]; 1599 }, 1600 has: function (key) { 1601 return !!findUncaughtFrozen(this, key); 1602 }, 1603 set: function (key, value) { 1604 var entry = findUncaughtFrozen(this, key); 1605 if (entry) entry[1] = value; 1606 else this.entries.push([key, value]); 1607 }, 1608 'delete': function (key) { 1609 var index = findIndex(this.entries, function (it) { 1610 return it[0] === key; 1611 }); 1612 if (~index) this.entries.splice(index, 1); 1613 return !!~index; 1614 } 1615 }; 1616 1617 var collectionWeak = { 1618 getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { 1619 var C = wrapper(function (that, iterable) { 1620 anInstance(that, C, CONSTRUCTOR_NAME); 1621 setInternalState$2(that, { 1622 type: CONSTRUCTOR_NAME, 1623 id: id$1++, 1624 frozen: undefined 1625 }); 1626 if (iterable != undefined) iterate_1(iterable, that[ADDER], that, IS_MAP); 1627 }); 1628 1629 var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); 1630 1631 var define = function (that, key, value) { 1632 var state = getInternalState(that); 1633 var data = getWeakData(anObject(key), true); 1634 if (data === true) uncaughtFrozenStore(state).set(key, value); 1635 else data[state.id] = value; 1636 return that; 1637 }; 1638 1639 redefineAll(C.prototype, { 1640 // 23.3.3.2 WeakMap.prototype.delete(key) 1641 // 23.4.3.3 WeakSet.prototype.delete(value) 1642 'delete': function (key) { 1643 var state = getInternalState(this); 1644 if (!isObject(key)) return false; 1645 var data = getWeakData(key); 1646 if (data === true) return uncaughtFrozenStore(state)['delete'](key); 1647 return data && has(data, state.id) && delete data[state.id]; 1648 }, 1649 // 23.3.3.4 WeakMap.prototype.has(key) 1650 // 23.4.3.4 WeakSet.prototype.has(value) 1651 has: function has$1(key) { 1652 var state = getInternalState(this); 1653 if (!isObject(key)) return false; 1654 var data = getWeakData(key); 1655 if (data === true) return uncaughtFrozenStore(state).has(key); 1656 return data && has(data, state.id); 1657 } 1658 }); 1659 1660 redefineAll(C.prototype, IS_MAP ? { 1661 // 23.3.3.3 WeakMap.prototype.get(key) 1662 get: function get(key) { 1663 var state = getInternalState(this); 1664 if (isObject(key)) { 1665 var data = getWeakData(key); 1666 if (data === true) return uncaughtFrozenStore(state).get(key); 1667 return data ? data[state.id] : undefined; 1668 } 1669 }, 1670 // 23.3.3.5 WeakMap.prototype.set(key, value) 1671 set: function set(key, value) { 1672 return define(this, key, value); 1673 } 1674 } : { 1675 // 23.4.3.1 WeakSet.prototype.add(value) 1676 add: function add(value) { 1677 return define(this, value, true); 1678 } 1679 }); 1680 1681 return C;
1682 } 1683 }; 1684 1685 var es_weakMap = createCommonjsModule(function (module) { 1686 1687 1688 1689 1690 1691 1692 var enforceIternalState = internalState.enforce; 1693 1694 1695 var IS_IE11 = !global_1.ActiveXObject && 'ActiveXObject' in global_1; 1696 var isExtensible = Object.isExtensible; 1697 var InternalWeakMap; 1698 1699 var wrapper = function (get) { 1700 return function WeakMap() { 1701 return get(this, arguments.length ? arguments[0] : undefined); 1702 }; 1703 }; 1704 1705 // `WeakMap` constructor 1706 // https://tc39.github.io/ecma262/#sec-weakmap-constructor 1707 var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak, true, true); 1708 1709 // IE11 WeakMap frozen keys fix 1710 // We can't use feature detection because it crash some old IE builds 1711 // https://github.com/zloirock/core-js/issues/485 1712 if (nativeWeakMap && IS_IE11) { 1713 InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); 1714 internalMetadata.REQUIRED = true; 1715 var WeakMapPrototype = $WeakMap.prototype; 1716 var nativeDelete = WeakMapPrototype['delete']; 1717 var nativeHas = WeakMapPrototype.has; 1718 var nativeGet = WeakMapPrototype.get; 1719 var nativeSet = WeakMapPrototype.set; 1720 redefineAll(WeakMapPrototype, { 1721 'delete': function (key) { 1722 if (isObject(key) && !isExtensible(key)) { 1723 var state = enforceIternalState(this); 1724 if (!state.frozen) state.frozen = new InternalWeakMap(); 1725 return nativeDelete.call(this, key) || state.frozen['delete'](key); 1726 } return nativeDelete.call(this, key); 1727 }, 1728 has: function has(key) { 1729 if (isObject(key) && !isExtensible(key)) { 1730 var state = enforceIternalState(this); 1731 if (!state.frozen) state.frozen = new InternalWeakMap(); 1732 return nativeHas.call(this, key) || state.frozen.has(key); 1733 } return nativeHas.call(this, key); 1734 }, 1735 get: function get(key) { 1736 if (isObject(key) && !isExtensible(key)) { 1737 var state = enforceIternalState(this); 1738 if (!state.frozen) state.frozen = new InternalWeakMap(); 1739 return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); 1740 } return nativeGet.call(this, key); 1741 }, 1742 set: function set(key, value) { 1743 if (isObject(key) && !isExtensible(key)) { 1744 var state = enforceIternalState(this); 1745 if (!state.frozen) state.frozen = new InternalWeakMap(); 1746 nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); 1747 } else nativeSet.call(this, key, value); 1748 return this; 1749 } 1750 }); 1751 } 1752 }); 1753 1754 var ITERATOR$5 = wellKnownSymbol('iterator'); 1755 var TO_STRING_TAG$3 = wellKnownSymbol('toStringTag'); 1756 var ArrayValues = es_array_iterator.values; 1757 1758 for (var COLLECTION_NAME$1 in domIterables) { 1759 var Collection$1 = global_1[COLLECTION_NAME$1]; 1760 var CollectionPrototype$1 = Collection$1 && Collection$1.prototype; 1761 if (CollectionPrototype$1) { 1762 // some Chrome versions have non-configurable methods on DOMTokenList 1763 if (CollectionPrototype$1[ITERATOR$5] !== ArrayValues) try { 1764 hide(CollectionPrototype$1, ITERATOR$5, ArrayValues); 1765 } catch (error) { 1766 CollectionPrototype$1[ITERATOR$5] = ArrayValues; 1767 } 1768 if (!CollectionPrototype$1[TO_STRING_TAG$3]) hide(CollectionPrototype$1, TO_STRING_TAG$3, COLLECTION_NAME$1); 1769 if (domIterables[COLLECTION_NAME$1]) for (var METHOD_NAME in es_array_iterator) { 1770 // some Chrome versions have non-configurable methods on DOMTokenList 1771 if (CollectionPrototype$1[METHOD_NAME] !== es_array_iterator[METHOD_NAME]) try { 1772 hide(CollectionPrototype$1, METHOD_NAME, es_array_iterator[METHOD_NAME]); 1773 } catch (error) { 1774 CollectionPrototype$1[METHOD_NAME] = es_array_iterator[METHOD_NAME]; 1775 } 1776 } 1777 } 1778 } 1779 1780 /** 1781 * lodash (Custom Build) <https://lodash.com/> 1782 * Build: `lodash modularize exports="npm" -o ./` 1783 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 1784 * Released under MIT license <https://lodash.com/license> 1785 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 1786 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 1787 */ 1788 1789 /** Used as the `TypeError` message for "Functions" methods. */
vendor: 9,496 bytes, lines 1790-2042
1790 var FUNC_ERROR_TEXT = 'Expected a function'; 1791 1792 /** Used as references for various `Number` constants. */ 1793 var NAN = 0 / 0; 1794 1795 /** `Object#toString` result references. */ 1796 var symbolTag = '[object Symbol]'; 1797 1798 /** Used to match leading and trailing whitespace. */ 1799 var reTrim = /^\s+|\s+$/g; 1800 1801 /** Used to detect bad signed hexadecimal string values. */ 1802 var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 1803 1804 /** Used to detect binary string values. */ 1805 var reIsBinary = /^0b[01]+$/i; 1806 1807 /** Used to detect octal string values. */ 1808 var reIsOctal = /^0o[0-7]+$/i; 1809 1810 /** Built-in method references without a dependency on `root`. */ 1811 var freeParseInt = parseInt; 1812 1813 /** Detect free variable `global` from Node.js. */ 1814 var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; 1815 1816 /** Detect free variable `self`. */ 1817 var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 1818 1819 /** Used as a reference to the global object. */ 1820 var root = freeGlobal || freeSelf || Function('return this')(); 1821 1822 /** Used for built-in method references. */ 1823 var objectProto = Object.prototype; 1824 1825 /** 1826 * Used to resolve the 1827 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 1828 * of values. 1829 */ 1830 var objectToString$1 = objectProto.toString; 1831 1832 /* Built-in method references for those with the same name as other `lodash` methods. */ 1833 var nativeMax = Math.max, 1834 nativeMin = Math.min; 1835 1836 /** 1837 * Gets the timestamp of the number of milliseconds that have elapsed since 1838 * the Unix epoch (1 January 1970 00:00:00 UTC). 1839 * 1840 * @static 1841 * @memberOf _ 1842 * @since 2.4.0 1843 * @category Date 1844 * @returns {number} Returns the timestamp. 1845 * @example 1846 * 1847 * _.defer(function(stamp) { 1848 * console.log(_.now() - stamp); 1849 * }, _.now()); 1850 * // => Logs the number of milliseconds it took for the deferred invocation. 1851 */ 1852 var now = function () { 1853 return root.Date.now(); 1854 }; 1855 1856 /** 1857 * Creates a debounced function that delays invoking `func` until after `wait` 1858 * milliseconds have elapsed since the last time the debounced function was 1859 * invoked. The debounced function comes with a `cancel` method to cancel 1860 * delayed `func` invocations and a `flush` method to immediately invoke them. 1861 * Provide `options` to indicate whether `func` should be invoked on the 1862 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 1863 * with the last arguments provided to the debounced function. Subsequent 1864 * calls to the debounced function return the result of the last `func` 1865 * invocation. 1866 * 1867 * **Note:** If `leading` and `trailing` options are `true`, `func` is 1868 * invoked on the trailing edge of the timeout only if the debounced function 1869 * is invoked more than once during the `wait` timeout. 1870 * 1871 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 1872 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 1873 * 1874 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 1875 * for details over the differences between `_.debounce` and `_.throttle`. 1876 * 1877 * @static 1878 * @memberOf _ 1879 * @since 0.1.0 1880 * @category Function 1881 * @param {Function} func The function to debounce. 1882 * @param {number} [wait=0] The number of milliseconds to delay. 1883 * @param {Object} [options={}] The options object. 1884 * @param {boolean} [options.leading=false] 1885 * Specify invoking on the leading edge of the timeout. 1886 * @param {number} [options.maxWait] 1887 * The maximum time `func` is allowed to be delayed before it's invoked. 1888 * @param {boolean} [options.trailing=true] 1889 * Specify invoking on the trailing edge of the timeout. 1890 * @returns {Function} Returns the new debounced function. 1891 * @example 1892 * 1893 * // Avoid costly calculations while the window size is in flux. 1894 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 1895 * 1896 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 1897 * jQuery(element).on('click', _.debounce(sendMail, 300, { 1898 * 'leading': true, 1899 * 'trailing': false 1900 * })); 1901 * 1902 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 1903 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 1904 * var source = new EventSource('/stream'); 1905 * jQuery(source).on('message', debounced); 1906 * 1907 * // Cancel the trailing debounced invocation. 1908 * jQuery(window).on('popstate', debounced.cancel); 1909 */ 1910 function debounce(func, wait, options) { 1911 var lastArgs, 1912 lastThis, 1913 maxWait, 1914 result, 1915 timerId, 1916 lastCallTime, 1917 lastInvokeTime = 0, 1918 leading = false, 1919 maxing = false, 1920 trailing = true; 1921 1922 if (typeof func != 'function') { 1923 throw new TypeError(FUNC_ERROR_TEXT); 1924 } 1925 wait = toNumber(wait) || 0; 1926 if (isObject$1(options)) { 1927 leading = !!options.leading; 1928 maxing = 'maxWait' in options; 1929 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 1930 trailing = 'trailing' in options ? !!options.trailing : trailing; 1931 } 1932 1933 function invokeFunc(time) { 1934 var args = lastArgs, 1935 thisArg = lastThis; 1936 1937 lastArgs = lastThis = undefined; 1938 lastInvokeTime = time; 1939 result = func.apply(thisArg, args); 1940 return result; 1941 } 1942 1943 function leadingEdge(time) { 1944 // Reset any `maxWait` timer. 1945 lastInvokeTime = time; 1946 // Start the timer for the trailing edge. 1947 timerId = setTimeout(timerExpired, wait); 1948 // Invoke the leading edge. 1949 return leading ? invokeFunc(time) : result; 1950 } 1951 1952 function remainingWait(time) { 1953 var timeSinceLastCall = time - lastCallTime, 1954 timeSinceLastInvoke = time - lastInvokeTime, 1955 result = wait - timeSinceLastCall; 1956 1957 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; 1958 } 1959 1960 function shouldInvoke(time) { 1961 var timeSinceLastCall = time - lastCallTime, 1962 timeSinceLastInvoke = time - lastInvokeTime; 1963 1964 // Either this is the first call, activity has stopped and we're at the 1965 // trailing edge, the system time has gone backwards and we're treating 1966 // it as the trailing edge, or we've hit the `maxWait` limit. 1967 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 1968 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 1969 } 1970 1971 function timerExpired() { 1972 var time = now(); 1973 if (shouldInvoke(time)) { 1974 return trailingEdge(time); 1975 } 1976 // Restart the timer. 1977 timerId = setTimeout(timerExpired, remainingWait(time)); 1978 } 1979 1980 function trailingEdge(time) { 1981 timerId = undefined; 1982 1983 // Only invoke if we have `lastArgs` which means `func` has been 1984 // debounced at least once. 1985 if (trailing && lastArgs) { 1986 return invokeFunc(time); 1987 } 1988 lastArgs = lastThis = undefined; 1989 return result; 1990 } 1991 1992 function cancel() { 1993 if (timerId !== undefined) { 1994 clearTimeout(timerId); 1995 } 1996 lastInvokeTime = 0; 1997 lastArgs = lastCallTime = lastThis = timerId = undefined; 1998 } 1999 2000 function flush() { 2001 return timerId === undefined ? result : trailingEdge(now()); 2002 } 2003 2004 function debounced() { 2005 var time = now(), 2006 isInvoking = shouldInvoke(time); 2007 2008 lastArgs = arguments; 2009 lastThis = this; 2010 lastCallTime = time; 2011 2012 if (isInvoking) { 2013 if (timerId === undefined) { 2014 return leadingEdge(lastCallTime); 2015 } 2016 if (maxing) { 2017 // Handle invocations in a tight loop. 2018 timerId = setTimeout(timerExpired, wait); 2019 return invokeFunc(lastCallTime); 2020 } 2021 } 2022 if (timerId === undefined) { 2023 timerId = setTimeout(timerExpired, wait); 2024 } 2025 return result; 2026 } 2027 debounced.cancel = cancel; 2028 debounced.flush = flush; 2029 return debounced; 2030 } 2031 2032 /** 2033 * Creates a throttled function that only invokes `func` at most once per 2034 * every `wait` milliseconds. The throttled function comes with a `cancel` 2035 * method to cancel delayed `func` invocations and a `flush` method to 2036 * immediately invoke them. Provide `options` to indicate whether `func` 2037 * should be invoked on the leading and/or trailing edge of the `wait` 2038 * timeout. The `func` is invoked with the last arguments provided to the 2039 * throttled function. Subsequent calls to the throttled function return the 2040 * result of the last `func` invocation. 2041 * 2042 * **Note:** If `leading` and `trailing` options are `true`, `func` is
2043 * invoked on the trailing edge of the timeout only if the throttled function 2044 * is invoked more than once during the `wait` timeout. 2045 * 2046 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 2047 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 2048 * 2049 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 2050 * for details over the differences between `_.throttle` and `_.debounce`. 2051 * 2052 * @static 2053 * @memberOf _ 2054 * @since 0.1.0 2055 * @category Function 2056 * @param {Function} func The function to throttle. 2057 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 2058 * @param {Object} [options={}] The options object. 2059 * @param {boolean} [options.leading=true] 2060 * Specify invoking on the leading edge of the timeout. 2061 * @param {boolean} [options.trailing=true] 2062 * Specify invoking on the trailing edge of the timeout. 2063 * @returns {Function} Returns the new throttled function. 2064 * @example 2065 * 2066 * // Avoid excessively updating the position while scrolling. 2067 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 2068 * 2069 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 2070 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 2071 * jQuery(element).on('click', throttled); 2072 * 2073 * // Cancel the trailing throttled invocation. 2074 * jQuery(window).on('popstate', throttled.cancel); 2075 */ 2076 function throttle(func, wait, options) { 2077 var leading = true, 2078 trailing = true; 2079 2080 if (typeof func != 'function') { 2081 throw new TypeError(FUNC_ERROR_TEXT); 2082 } 2083 if (isObject$1(options)) { 2084 leading = 'leading' in options ? !!options.leading : leading; 2085 trailing = 'trailing' in options ? !!options.trailing : trailing; 2086 } 2087 return debounce(func, wait, { 2088 'leading': leading, 2089 'maxWait': wait, 2090 'trailing': trailing 2091 }); 2092 } 2093 2094 /** 2095 * Checks if `value` is the 2096 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 2097 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 2098 * 2099 * @static 2100 * @memberOf _ 2101 * @since 0.1.0 2102 * @category Lang 2103 * @param {*} value The value to check. 2104 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 2105 * @example 2106 * 2107 * _.isObject({}); 2108 * // => true 2109 * 2110 * _.isObject([1, 2, 3]); 2111 * // => true 2112 * 2113 * _.isObject(_.noop); 2114 * // => true 2115 * 2116 * _.isObject(null); 2117 * // => false 2118 */ 2119 function isObject$1(value) { 2120 var type = typeof value; 2121 return !!value && (type == 'object' || type == 'function'); 2122 } 2123 2124 /** 2125 * Checks if `value` is object-like. A value is object-like if it's not `null` 2126 * and has a `typeof` result of "object". 2127 * 2128 * @static 2129 * @memberOf _ 2130 * @since 4.0.0 2131 * @category Lang 2132 * @param {*} value The value to check. 2133 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 2134 * @example 2135 * 2136 * _.isObjectLike({}); 2137 * // => true 2138 * 2139 * _.isObjectLike([1, 2, 3]); 2140 * // => true 2141 * 2142 * _.isObjectLike(_.noop); 2143 * // => false 2144 * 2145 * _.isObjectLike(null); 2146 * // => false 2147 */ 2148 function isObjectLike(value) { 2149 return !!value && typeof value == 'object'; 2150 } 2151 2152 /** 2153 * Checks if `value` is classified as a `Symbol` primitive or object. 2154 * 2155 * @static 2156 * @memberOf _ 2157 * @since 4.0.0 2158 * @category Lang 2159 * @param {*} value The value to check. 2160 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 2161 * @example 2162 * 2163 * _.isSymbol(Symbol.iterator); 2164 * // => true 2165 * 2166 * _.isSymbol('abc'); 2167 * // => false 2168 */ 2169 function isSymbol(value) { 2170 return typeof value == 'symbol' || 2171 (isObjectLike(value) && objectToString$1.call(value) == symbolTag); 2172 } 2173 2174 /** 2175 * Converts `value` to a number. 2176 * 2177 * @static 2178 * @memberOf _ 2179 * @since 4.0.0 2180 * @category Lang 2181 * @param {*} value The value to process. 2182 * @returns {number} Returns the number. 2183 * @example 2184 * 2185 * _.toNumber(3.2); 2186 * // => 3.2 2187 * 2188 * _.toNumber(Number.MIN_VALUE); 2189 * // => 5e-324 2190 * 2191 * _.toNumber(Infinity); 2192 * // => Infinity 2193 * 2194 * _.toNumber('3.2'); 2195 * // => 3.2 2196 */ 2197 function toNumber(value) { 2198 if (typeof value == 'number') { 2199 return value; 2200 } 2201 if (isSymbol(value)) { 2202 return NAN; 2203 } 2204 if (isObject$1(value)) { 2205 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 2206 value = isObject$1(other) ? (other + '') : other; 2207 } 2208 if (typeof value != 'string') { 2209 return value === 0 ? value : +value; 2210 } 2211 value = value.replace(reTrim, ''); 2212 var isBinary = reIsBinary.test(value); 2213 return (isBinary || reIsOctal.test(value)) 2214 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 2215 : (reIsBadHex.test(value) ? NAN : +value); 2216 } 2217 2218 var lodash_throttle = throttle; 2219 2220 /** 2221 * lodash (Custom Build) <https://lodash.com/> 2222 * Build: `lodash modularize exports="npm" -o ./` 2223 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 2224 * Released under MIT license <https://lodash.com/license> 2225 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 2226 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 2227 */ 2228 2229 /** Used as the `TypeError` message for "Functions" methods. */
vendor: 12,579 bytes, lines 2230-2607
2230 var FUNC_ERROR_TEXT$1 = 'Expected a function'; 2231 2232 /** Used as references for various `Number` constants. */ 2233 var NAN$1 = 0 / 0; 2234 2235 /** `Object#toString` result references. */ 2236 var symbolTag$1 = '[object Symbol]'; 2237 2238 /** Used to match leading and trailing whitespace. */ 2239 var reTrim$1 = /^\s+|\s+$/g; 2240 2241 /** Used to detect bad signed hexadecimal string values. */ 2242 var reIsBadHex$1 = /^[-+]0x[0-9a-f]+$/i; 2243 2244 /** Used to detect binary string values. */ 2245 var reIsBinary$1 = /^0b[01]+$/i; 2246 2247 /** Used to detect octal string values. */ 2248 var reIsOctal$1 = /^0o[0-7]+$/i; 2249 2250 /** Built-in method references without a dependency on `root`. */ 2251 var freeParseInt$1 = parseInt; 2252 2253 /** Detect free variable `global` from Node.js. */ 2254 var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; 2255 2256 /** Detect free variable `self`. */ 2257 var freeSelf$1 = typeof self == 'object' && self && self.Object === Object && self; 2258 2259 /** Used as a reference to the global object. */ 2260 var root$1 = freeGlobal$1 || freeSelf$1 || Function('return this')(); 2261 2262 /** Used for built-in method references. */ 2263 var objectProto$1 = Object.prototype; 2264 2265 /** 2266 * Used to resolve the 2267 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 2268 * of values. 2269 */ 2270 var objectToString$2 = objectProto$1.toString; 2271 2272 /* Built-in method references for those with the same name as other `lodash` methods. */ 2273 var nativeMax$1 = Math.max, 2274 nativeMin$1 = Math.min; 2275 2276 /** 2277 * Gets the timestamp of the number of milliseconds that have elapsed since 2278 * the Unix epoch (1 January 1970 00:00:00 UTC). 2279 * 2280 * @static 2281 * @memberOf _ 2282 * @since 2.4.0 2283 * @category Date 2284 * @returns {number} Returns the timestamp. 2285 * @example 2286 * 2287 * _.defer(function(stamp) { 2288 * console.log(_.now() - stamp); 2289 * }, _.now()); 2290 * // => Logs the number of milliseconds it took for the deferred invocation. 2291 */ 2292 var now$1 = function () { 2293 return root$1.Date.now(); 2294 }; 2295 2296 /** 2297 * Creates a debounced function that delays invoking `func` until after `wait` 2298 * milliseconds have elapsed since the last time the debounced function was 2299 * invoked. The debounced function comes with a `cancel` method to cancel 2300 * delayed `func` invocations and a `flush` method to immediately invoke them. 2301 * Provide `options` to indicate whether `func` should be invoked on the 2302 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 2303 * with the last arguments provided to the debounced function. Subsequent 2304 * calls to the debounced function return the result of the last `func` 2305 * invocation. 2306 * 2307 * **Note:** If `leading` and `trailing` options are `true`, `func` is 2308 * invoked on the trailing edge of the timeout only if the debounced function 2309 * is invoked more than once during the `wait` timeout. 2310 * 2311 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 2312 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 2313 * 2314 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 2315 * for details over the differences between `_.debounce` and `_.throttle`. 2316 * 2317 * @static 2318 * @memberOf _ 2319 * @since 0.1.0 2320 * @category Function 2321 * @param {Function} func The function to debounce. 2322 * @param {number} [wait=0] The number of milliseconds to delay. 2323 * @param {Object} [options={}] The options object. 2324 * @param {boolean} [options.leading=false] 2325 * Specify invoking on the leading edge of the timeout. 2326 * @param {number} [options.maxWait] 2327 * The maximum time `func` is allowed to be delayed before it's invoked. 2328 * @param {boolean} [options.trailing=true] 2329 * Specify invoking on the trailing edge of the timeout. 2330 * @returns {Function} Returns the new debounced function. 2331 * @example 2332 * 2333 * // Avoid costly calculations while the window size is in flux. 2334 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 2335 * 2336 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 2337 * jQuery(element).on('click', _.debounce(sendMail, 300, { 2338 * 'leading': true, 2339 * 'trailing': false 2340 * })); 2341 * 2342 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 2343 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 2344 * var source = new EventSource('/stream'); 2345 * jQuery(source).on('message', debounced); 2346 * 2347 * // Cancel the trailing debounced invocation. 2348 * jQuery(window).on('popstate', debounced.cancel); 2349 */ 2350 function debounce$1(func, wait, options) { 2351 var lastArgs, 2352 lastThis, 2353 maxWait, 2354 result, 2355 timerId, 2356 lastCallTime, 2357 lastInvokeTime = 0, 2358 leading = false, 2359 maxing = false, 2360 trailing = true; 2361 2362 if (typeof func != 'function') { 2363 throw new TypeError(FUNC_ERROR_TEXT$1); 2364 } 2365 wait = toNumber$1(wait) || 0; 2366 if (isObject$2(options)) { 2367 leading = !!options.leading; 2368 maxing = 'maxWait' in options; 2369 maxWait = maxing ? nativeMax$1(toNumber$1(options.maxWait) || 0, wait) : maxWait; 2370 trailing = 'trailing' in options ? !!options.trailing : trailing; 2371 } 2372 2373 function invokeFunc(time) { 2374 var args = lastArgs, 2375 thisArg = lastThis; 2376 2377 lastArgs = lastThis = undefined; 2378 lastInvokeTime = time; 2379 result = func.apply(thisArg, args); 2380 return result; 2381 } 2382 2383 function leadingEdge(time) { 2384 // Reset any `maxWait` timer. 2385 lastInvokeTime = time; 2386 // Start the timer for the trailing edge. 2387 timerId = setTimeout(timerExpired, wait); 2388 // Invoke the leading edge. 2389 return leading ? invokeFunc(time) : result; 2390 } 2391 2392 function remainingWait(time) { 2393 var timeSinceLastCall = time - lastCallTime, 2394 timeSinceLastInvoke = time - lastInvokeTime, 2395 result = wait - timeSinceLastCall; 2396 2397 return maxing ? nativeMin$1(result, maxWait - timeSinceLastInvoke) : result; 2398 } 2399 2400 function shouldInvoke(time) { 2401 var timeSinceLastCall = time - lastCallTime, 2402 timeSinceLastInvoke = time - lastInvokeTime; 2403 2404 // Either this is the first call, activity has stopped and we're at the 2405 // trailing edge, the system time has gone backwards and we're treating 2406 // it as the trailing edge, or we've hit the `maxWait` limit. 2407 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 2408 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 2409 } 2410 2411 function timerExpired() { 2412 var time = now$1(); 2413 if (shouldInvoke(time)) { 2414 return trailingEdge(time); 2415 } 2416 // Restart the timer. 2417 timerId = setTimeout(timerExpired, remainingWait(time)); 2418 } 2419 2420 function trailingEdge(time) { 2421 timerId = undefined; 2422 2423 // Only invoke if we have `lastArgs` which means `func` has been 2424 // debounced at least once. 2425 if (trailing && lastArgs) { 2426 return invokeFunc(time); 2427 } 2428 lastArgs = lastThis = undefined; 2429 return result; 2430 } 2431 2432 function cancel() { 2433 if (timerId !== undefined) { 2434 clearTimeout(timerId); 2435 } 2436 lastInvokeTime = 0; 2437 lastArgs = lastCallTime = lastThis = timerId = undefined; 2438 } 2439 2440 function flush() { 2441 return timerId === undefined ? result : trailingEdge(now$1()); 2442 } 2443 2444 function debounced() { 2445 var time = now$1(), 2446 isInvoking = shouldInvoke(time); 2447 2448 lastArgs = arguments; 2449 lastThis = this; 2450 lastCallTime = time; 2451 2452 if (isInvoking) { 2453 if (timerId === undefined) { 2454 return leadingEdge(lastCallTime); 2455 } 2456 if (maxing) { 2457 // Handle invocations in a tight loop. 2458 timerId = setTimeout(timerExpired, wait); 2459 return invokeFunc(lastCallTime); 2460 } 2461 } 2462 if (timerId === undefined) { 2463 timerId = setTimeout(timerExpired, wait); 2464 } 2465 return result; 2466 } 2467 debounced.cancel = cancel; 2468 debounced.flush = flush; 2469 return debounced; 2470 } 2471 2472 /** 2473 * Checks if `value` is the 2474 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 2475 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 2476 * 2477 * @static 2478 * @memberOf _ 2479 * @since 0.1.0 2480 * @category Lang 2481 * @param {*} value The value to check. 2482 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 2483 * @example 2484 * 2485 * _.isObject({}); 2486 * // => true 2487 * 2488 * _.isObject([1, 2, 3]); 2489 * // => true 2490 * 2491 * _.isObject(_.noop); 2492 * // => true 2493 * 2494 * _.isObject(null); 2495 * // => false 2496 */ 2497 function isObject$2(value) { 2498 var type = typeof value; 2499 return !!value && (type == 'object' || type == 'function'); 2500 } 2501 2502 /** 2503 * Checks if `value` is object-like. A value is object-like if it's not `null` 2504 * and has a `typeof` result of "object". 2505 * 2506 * @static 2507 * @memberOf _ 2508 * @since 4.0.0 2509 * @category Lang 2510 * @param {*} value The value to check. 2511 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 2512 * @example 2513 * 2514 * _.isObjectLike({}); 2515 * // => true 2516 * 2517 * _.isObjectLike([1, 2, 3]); 2518 * // => true 2519 * 2520 * _.isObjectLike(_.noop); 2521 * // => false 2522 * 2523 * _.isObjectLike(null); 2524 * // => false 2525 */ 2526 function isObjectLike$1(value) { 2527 return !!value && typeof value == 'object'; 2528 } 2529 2530 /** 2531 * Checks if `value` is classified as a `Symbol` primitive or object. 2532 * 2533 * @static 2534 * @memberOf _ 2535 * @since 4.0.0 2536 * @category Lang 2537 * @param {*} value The value to check. 2538 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 2539 * @example 2540 * 2541 * _.isSymbol(Symbol.iterator); 2542 * // => true 2543 * 2544 * _.isSymbol('abc'); 2545 * // => false 2546 */ 2547 function isSymbol$1(value) { 2548 return typeof value == 'symbol' || 2549 (isObjectLike$1(value) && objectToString$2.call(value) == symbolTag$1); 2550 } 2551 2552 /** 2553 * Converts `value` to a number. 2554 * 2555 * @static 2556 * @memberOf _ 2557 * @since 4.0.0 2558 * @category Lang 2559 * @param {*} value The value to process. 2560 * @returns {number} Returns the number. 2561 * @example 2562 * 2563 * _.toNumber(3.2); 2564 * // => 3.2 2565 * 2566 * _.toNumber(Number.MIN_VALUE); 2567 * // => 5e-324 2568 * 2569 * _.toNumber(Infinity); 2570 * // => Infinity 2571 * 2572 * _.toNumber('3.2'); 2573 * // => 3.2 2574 */ 2575 function toNumber$1(value) { 2576 if (typeof value == 'number') { 2577 return value; 2578 } 2579 if (isSymbol$1(value)) { 2580 return NAN$1; 2581 } 2582 if (isObject$2(value)) { 2583 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 2584 value = isObject$2(other) ? (other + '') : other; 2585 } 2586 if (typeof value != 'string') { 2587 return value === 0 ? value : +value; 2588 } 2589 value = value.replace(reTrim$1, ''); 2590 var isBinary = reIsBinary$1.test(value); 2591 return (isBinary || reIsOctal$1.test(value)) 2592 ? freeParseInt$1(value.slice(2), isBinary ? 2 : 8) 2593 : (reIsBadHex$1.test(value) ? NAN$1 : +value); 2594 } 2595 2596 var lodash_debounce = debounce$1; 2597 2598 /** 2599 * lodash (Custom Build) <https://lodash.com/> 2600 * Build: `lodash modularize exports="npm" -o ./` 2601 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 2602 * Released under MIT license <https://lodash.com/license> 2603 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 2604 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 2605 */ 2606 2607 /** Used as the `TypeError` message for "Functions" methods. */
vendor: 15,606 bytes, lines 2608-3147
2608 var FUNC_ERROR_TEXT$2 = 'Expected a function'; 2609 2610 /** Used to stand-in for `undefined` hash values. */ 2611 var HASH_UNDEFINED = '__lodash_hash_undefined__'; 2612 2613 /** `Object#toString` result references. */ 2614 var funcTag = '[object Function]', 2615 genTag = '[object GeneratorFunction]'; 2616 2617 /** 2618 * Used to match `RegExp` 2619 * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). 2620 */ 2621 var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; 2622 2623 /** Used to detect host constructors (Safari). */ 2624 var reIsHostCtor = /^\[object .+?Constructor\]$/; 2625 2626 /** Detect free variable `global` from Node.js. */ 2627 var freeGlobal$2 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal; 2628 2629 /** Detect free variable `self`. */ 2630 var freeSelf$2 = typeof self == 'object' && self && self.Object === Object && self; 2631 2632 /** Used as a reference to the global object. */ 2633 var root$2 = freeGlobal$2 || freeSelf$2 || Function('return this')(); 2634 2635 /** 2636 * Gets the value at `key` of `object`. 2637 * 2638 * @private 2639 * @param {Object} [object] The object to query. 2640 * @param {string} key The key of the property to get. 2641 * @returns {*} Returns the property value. 2642 */ 2643 function getValue(object, key) { 2644 return object == null ? undefined : object[key]; 2645 } 2646 2647 /** 2648 * Checks if `value` is a host object in IE < 9. 2649 * 2650 * @private 2651 * @param {*} value The value to check. 2652 * @returns {boolean} Returns `true` if `value` is a host object, else `false`. 2653 */ 2654 function isHostObject(value) { 2655 // Many host objects are `Object` objects that can coerce to strings 2656 // despite having improperly defined `toString` methods. 2657 var result = false; 2658 if (value != null && typeof value.toString != 'function') { 2659 try { 2660 result = !!(value + ''); 2661 } catch (e) { } 2662 } 2663 return result; 2664 } 2665 2666 /** Used for built-in method references. */ 2667 var arrayProto = Array.prototype, 2668 funcProto = Function.prototype, 2669 objectProto$2 = Object.prototype; 2670 2671 /** Used to detect overreaching core-js shims. */ 2672 var coreJsData = root$2['__core-js_shared__']; 2673 2674 /** Used to detect methods masquerading as native. */ 2675 var maskSrcKey = (function () { 2676 var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); 2677 return uid ? ('Symbol(src)_1.' + uid) : ''; 2678 }()); 2679 2680 /** Used to resolve the decompiled source of functions. */ 2681 var funcToString = funcProto.toString; 2682 2683 /** Used to check objects for own properties. */ 2684 var hasOwnProperty$1 = objectProto$2.hasOwnProperty; 2685 2686 /** 2687 * Used to resolve the 2688 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 2689 * of values. 2690 */ 2691 var objectToString$3 = objectProto$2.toString; 2692 2693 /** Used to detect if a method is native. */ 2694 var reIsNative = RegExp('^' + 2695 funcToString.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&') 2696 .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' 2697 ); 2698 2699 /** Built-in value references. */ 2700 var splice = arrayProto.splice; 2701 2702 /* Built-in method references that are verified to be native. */ 2703 var Map$1 = getNative(root$2, 'Map'), 2704 nativeCreate = getNative(Object, 'create'); 2705 2706 /** 2707 * Creates a hash object. 2708 * 2709 * @private 2710 * @constructor 2711 * @param {Array} [entries] The key-value pairs to cache. 2712 */ 2713 function Hash(entries) { 2714 var index = -1, 2715 length = entries ? entries.length : 0; 2716 2717 this.clear(); 2718 while (++index < length) { 2719 var entry = entries[index]; 2720 this.set(entry[0], entry[1]); 2721 } 2722 } 2723 2724 /** 2725 * Removes all key-value entries from the hash. 2726 * 2727 * @private 2728 * @name clear 2729 * @memberOf Hash 2730 */ 2731 function hashClear() { 2732 this.__data__ = nativeCreate ? nativeCreate(null) : {}; 2733 } 2734 2735 /** 2736 * Removes `key` and its value from the hash. 2737 * 2738 * @private 2739 * @name delete 2740 * @memberOf Hash 2741 * @param {Object} hash The hash to modify. 2742 * @param {string} key The key of the value to remove. 2743 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 2744 */ 2745 function hashDelete(key) { 2746 return this.has(key) && delete this.__data__[key]; 2747 } 2748 2749 /** 2750 * Gets the hash value for `key`. 2751 * 2752 * @private 2753 * @name get 2754 * @memberOf Hash 2755 * @param {string} key The key of the value to get. 2756 * @returns {*} Returns the entry value. 2757 */ 2758 function hashGet(key) { 2759 var data = this.__data__; 2760 if (nativeCreate) { 2761 var result = data[key]; 2762 return result === HASH_UNDEFINED ? undefined : result; 2763 } 2764 return hasOwnProperty$1.call(data, key) ? data[key] : undefined; 2765 } 2766 2767 /** 2768 * Checks if a hash value for `key` exists. 2769 * 2770 * @private 2771 * @name has 2772 * @memberOf Hash 2773 * @param {string} key The key of the entry to check. 2774 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 2775 */ 2776 function hashHas(key) { 2777 var data = this.__data__; 2778 return nativeCreate ? data[key] !== undefined : hasOwnProperty$1.call(data, key); 2779 } 2780 2781 /** 2782 * Sets the hash `key` to `value`. 2783 * 2784 * @private 2785 * @name set 2786 * @memberOf Hash 2787 * @param {string} key The key of the value to set. 2788 * @param {*} value The value to set. 2789 * @returns {Object} Returns the hash instance. 2790 */ 2791 function hashSet(key, value) { 2792 var data = this.__data__; 2793 data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; 2794 return this; 2795 } 2796 2797 // Add methods to `Hash`. 2798 Hash.prototype.clear = hashClear; 2799 Hash.prototype['delete'] = hashDelete; 2800 Hash.prototype.get = hashGet; 2801 Hash.prototype.has = hashHas; 2802 Hash.prototype.set = hashSet; 2803 2804 /** 2805 * Creates an list cache object. 2806 * 2807 * @private 2808 * @constructor 2809 * @param {Array} [entries] The key-value pairs to cache. 2810 */ 2811 function ListCache(entries) { 2812 var index = -1, 2813 length = entries ? entries.length : 0; 2814 2815 this.clear(); 2816 while (++index < length) { 2817 var entry = entries[index]; 2818 this.set(entry[0], entry[1]); 2819 } 2820 } 2821 2822 /** 2823 * Removes all key-value entries from the list cache. 2824 * 2825 * @private 2826 * @name clear 2827 * @memberOf ListCache 2828 */ 2829 function listCacheClear() { 2830 this.__data__ = []; 2831 } 2832 2833 /** 2834 * Removes `key` and its value from the list cache. 2835 * 2836 * @private 2837 * @name delete 2838 * @memberOf ListCache 2839 * @param {string} key The key of the value to remove. 2840 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 2841 */ 2842 function listCacheDelete(key) { 2843 var data = this.__data__, 2844 index = assocIndexOf(data, key); 2845 2846 if (index < 0) { 2847 return false; 2848 } 2849 var lastIndex = data.length - 1; 2850 if (index == lastIndex) { 2851 data.pop(); 2852 } else { 2853 splice.call(data, index, 1); 2854 } 2855 return true; 2856 } 2857 2858 /** 2859 * Gets the list cache value for `key`. 2860 * 2861 * @private 2862 * @name get 2863 * @memberOf ListCache 2864 * @param {string} key The key of the value to get. 2865 * @returns {*} Returns the entry value. 2866 */ 2867 function listCacheGet(key) { 2868 var data = this.__data__, 2869 index = assocIndexOf(data, key); 2870 2871 return index < 0 ? undefined : data[index][1]; 2872 } 2873 2874 /** 2875 * Checks if a list cache value for `key` exists. 2876 * 2877 * @private 2878 * @name has 2879 * @memberOf ListCache 2880 * @param {string} key The key of the entry to check. 2881 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 2882 */ 2883 function listCacheHas(key) { 2884 return assocIndexOf(this.__data__, key) > -1; 2885 } 2886 2887 /** 2888 * Sets the list cache `key` to `value`. 2889 * 2890 * @private 2891 * @name set 2892 * @memberOf ListCache 2893 * @param {string} key The key of the value to set. 2894 * @param {*} value The value to set. 2895 * @returns {Object} Returns the list cache instance. 2896 */ 2897 function listCacheSet(key, value) { 2898 var data = this.__data__, 2899 index = assocIndexOf(data, key); 2900 2901 if (index < 0) { 2902 data.push([key, value]); 2903 } else { 2904 data[index][1] = value; 2905 } 2906 return this; 2907 } 2908 2909 // Add methods to `ListCache`. 2910 ListCache.prototype.clear = listCacheClear; 2911 ListCache.prototype['delete'] = listCacheDelete; 2912 ListCache.prototype.get = listCacheGet; 2913 ListCache.prototype.has = listCacheHas; 2914 ListCache.prototype.set = listCacheSet; 2915 2916 /** 2917 * Creates a map cache object to store key-value pairs. 2918 * 2919 * @private 2920 * @constructor 2921 * @param {Array} [entries] The key-value pairs to cache. 2922 */ 2923 function MapCache(entries) { 2924 var index = -1, 2925 length = entries ? entries.length : 0; 2926 2927 this.clear(); 2928 while (++index < length) { 2929 var entry = entries[index]; 2930 this.set(entry[0], entry[1]); 2931 } 2932 } 2933 2934 /** 2935 * Removes all key-value entries from the map. 2936 * 2937 * @private 2938 * @name clear 2939 * @memberOf MapCache 2940 */ 2941 function mapCacheClear() { 2942 this.__data__ = { 2943 'hash': new Hash, 2944 'map': new (Map$1 || ListCache), 2945 'string': new Hash 2946 }; 2947 } 2948 2949 /** 2950 * Removes `key` and its value from the map. 2951 * 2952 * @private 2953 * @name delete 2954 * @memberOf MapCache 2955 * @param {string} key The key of the value to remove. 2956 * @returns {boolean} Returns `true` if the entry was removed, else `false`. 2957 */ 2958 function mapCacheDelete(key) { 2959 return getMapData(this, key)['delete'](key); 2960 } 2961 2962 /** 2963 * Gets the map value for `key`. 2964 * 2965 * @private 2966 * @name get 2967 * @memberOf MapCache 2968 * @param {string} key The key of the value to get. 2969 * @returns {*} Returns the entry value. 2970 */ 2971 function mapCacheGet(key) { 2972 return getMapData(this, key).get(key); 2973 } 2974 2975 /** 2976 * Checks if a map value for `key` exists. 2977 * 2978 * @private 2979 * @name has 2980 * @memberOf MapCache 2981 * @param {string} key The key of the entry to check. 2982 * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 2983 */ 2984 function mapCacheHas(key) { 2985 return getMapData(this, key).has(key); 2986 } 2987 2988 /** 2989 * Sets the map `key` to `value`. 2990 * 2991 * @private 2992 * @name set 2993 * @memberOf MapCache 2994 * @param {string} key The key of the value to set. 2995 * @param {*} value The value to set. 2996 * @returns {Object} Returns the map cache instance. 2997 */ 2998 function mapCacheSet(key, value) { 2999 getMapData(this, key).set(key, value); 3000 return this; 3001 } 3002 3003 // Add methods to `MapCache`. 3004 MapCache.prototype.clear = mapCacheClear; 3005 MapCache.prototype['delete'] = mapCacheDelete; 3006 MapCache.prototype.get = mapCacheGet; 3007 MapCache.prototype.has = mapCacheHas; 3008 MapCache.prototype.set = mapCacheSet; 3009 3010 /** 3011 * Gets the index at which the `key` is found in `array` of key-value pairs. 3012 * 3013 * @private 3014 * @param {Array} array The array to inspect. 3015 * @param {*} key The key to search for. 3016 * @returns {number} Returns the index of the matched value, else `-1`. 3017 */ 3018 function assocIndexOf(array, key) { 3019 var length = array.length; 3020 while (length--) { 3021 if (eq(array[length][0], key)) { 3022 return length; 3023 } 3024 } 3025 return -1; 3026 } 3027 3028 /** 3029 * The base implementation of `_.isNative` without bad shim checks. 3030 * 3031 * @private 3032 * @param {*} value The value to check. 3033 * @returns {boolean} Returns `true` if `value` is a native function, 3034 * else `false`. 3035 */ 3036 function baseIsNative(value) { 3037 if (!isObject$3(value) || isMasked(value)) { 3038 return false; 3039 } 3040 var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; 3041 return pattern.test(toSource(value)); 3042 } 3043 3044 /** 3045 * Gets the data for `map`. 3046 * 3047 * @private 3048 * @param {Object} map The map to query. 3049 * @param {string} key The reference key. 3050 * @returns {*} Returns the map data. 3051 */ 3052 function getMapData(map, key) { 3053 var data = map.__data__; 3054 return isKeyable(key) 3055 ? data[typeof key == 'string' ? 'string' : 'hash'] 3056 : data.map; 3057 } 3058 3059 /** 3060 * Gets the native function at `key` of `object`. 3061 * 3062 * @private 3063 * @param {Object} object The object to query. 3064 * @param {string} key The key of the method to get. 3065 * @returns {*} Returns the function if it's native, else `undefined`. 3066 */ 3067 function getNative(object, key) { 3068 var value = getValue(object, key); 3069 return baseIsNative(value) ? value : undefined; 3070 } 3071 3072 /** 3073 * Checks if `value` is suitable for use as unique object key. 3074 * 3075 * @private 3076 * @param {*} value The value to check. 3077 * @returns {boolean} Returns `true` if `value` is suitable, else `false`. 3078 */ 3079 function isKeyable(value) { 3080 var type = typeof value; 3081 return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') 3082 ? (value !== '__proto__') 3083 : (value === null); 3084 } 3085 3086 /** 3087 * Checks if `func` has its source masked. 3088 * 3089 * @private 3090 * @param {Function} func The function to check. 3091 * @returns {boolean} Returns `true` if `func` is masked, else `false`. 3092 */ 3093 function isMasked(func) { 3094 return !!maskSrcKey && (maskSrcKey in func); 3095 } 3096 3097 /** 3098 * Converts `func` to its source code. 3099 * 3100 * @private 3101 * @param {Function} func The function to process. 3102 * @returns {string} Returns the source code. 3103 */ 3104 function toSource(func) { 3105 if (func != null) { 3106 try { 3107 return funcToString.call(func); 3108 } catch (e) { } 3109 try { 3110 return (func + ''); 3111 } catch (e) { } 3112 } 3113 return ''; 3114 } 3115 3116 /** 3117 * Creates a function that memoizes the result of `func`. If `resolver` is 3118 * provided, it determines the cache key for storing the result based on the 3119 * arguments provided to the memoized function. By default, the first argument 3120 * provided to the memoized function is used as the map cache key. The `func` 3121 * is invoked with the `this` binding of the memoized function. 3122 * 3123 * **Note:** The cache is exposed as the `cache` property on the memoized 3124 * function. Its creation may be customized by replacing the `_.memoize.Cache` 3125 * constructor with one whose instances implement the 3126 * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) 3127 * method interface of `delete`, `get`, `has`, and `set`. 3128 * 3129 * @static 3130 * @memberOf _ 3131 * @since 0.1.0 3132 * @category Function 3133 * @param {Function} func The function to have its output memoized. 3134 * @param {Function} [resolver] The function to resolve the cache key. 3135 * @returns {Function} Returns the new memoized function. 3136 * @example 3137 * 3138 * var object = { 'a': 1, 'b': 2 }; 3139 * var other = { 'c': 3, 'd': 4 }; 3140 * 3141 * var values = _.memoize(_.values); 3142 * values(object); 3143 * // => [1, 2] 3144 * 3145 * values(other); 3146 * // => [3, 4] 3147 *
vendor: 5,873 bytes, lines 3148-3348
3148 * object.a = 2; 3149 * values(object); 3150 * // => [1, 2] 3151 * 3152 * // Modify the result cache. 3153 * values.cache.set(object, ['a', 'b']); 3154 * values(object); 3155 * // => ['a', 'b'] 3156 * 3157 * // Replace `_.memoize.Cache`. 3158 * _.memoize.Cache = WeakMap; 3159 */ 3160 function memoize(func, resolver) { 3161 if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { 3162 throw new TypeError(FUNC_ERROR_TEXT$2); 3163 } 3164 var memoized = function () { 3165 var args = arguments, 3166 key = resolver ? resolver.apply(this, args) : args[0], 3167 cache = memoized.cache; 3168 3169 if (cache.has(key)) { 3170 return cache.get(key); 3171 } 3172 var result = func.apply(this, args); 3173 memoized.cache = cache.set(key, result); 3174 return result; 3175 }; 3176 memoized.cache = new (memoize.Cache || MapCache); 3177 return memoized; 3178 } 3179 3180 // Assign cache to `_.memoize`. 3181 memoize.Cache = MapCache; 3182 3183 /** 3184 * Performs a 3185 * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) 3186 * comparison between two values to determine if they are equivalent. 3187 * 3188 * @static 3189 * @memberOf _ 3190 * @since 4.0.0 3191 * @category Lang 3192 * @param {*} value The value to compare. 3193 * @param {*} other The other value to compare. 3194 * @returns {boolean} Returns `true` if the values are equivalent, else `false`. 3195 * @example 3196 * 3197 * var object = { 'a': 1 }; 3198 * var other = { 'a': 1 }; 3199 * 3200 * _.eq(object, object); 3201 * // => true 3202 * 3203 * _.eq(object, other); 3204 * // => false 3205 * 3206 * _.eq('a', 'a'); 3207 * // => true 3208 * 3209 * _.eq('a', Object('a')); 3210 * // => false 3211 * 3212 * _.eq(NaN, NaN); 3213 * // => true 3214 */ 3215 function eq(value, other) { 3216 return value === other || (value !== value && other !== other); 3217 } 3218 3219 /** 3220 * Checks if `value` is classified as a `Function` object. 3221 * 3222 * @static 3223 * @memberOf _ 3224 * @since 0.1.0 3225 * @category Lang 3226 * @param {*} value The value to check. 3227 * @returns {boolean} Returns `true` if `value` is a function, else `false`. 3228 * @example 3229 * 3230 * _.isFunction(_); 3231 * // => true 3232 * 3233 * _.isFunction(/abc/); 3234 * // => false 3235 */ 3236 function isFunction(value) { 3237 // The use of `Object#toString` avoids issues with the `typeof` operator 3238 // in Safari 8-9 which returns 'object' for typed array and other constructors. 3239 var tag = isObject$3(value) ? objectToString$3.call(value) : ''; 3240 return tag == funcTag || tag == genTag; 3241 } 3242 3243 /** 3244 * Checks if `value` is the 3245 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 3246 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 3247 * 3248 * @static 3249 * @memberOf _ 3250 * @since 0.1.0 3251 * @category Lang 3252 * @param {*} value The value to check. 3253 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 3254 * @example 3255 * 3256 * _.isObject({}); 3257 * // => true 3258 * 3259 * _.isObject([1, 2, 3]); 3260 * // => true 3261 * 3262 * _.isObject(_.noop); 3263 * // => true 3264 * 3265 * _.isObject(null); 3266 * // => false 3267 */ 3268 function isObject$3(value) { 3269 var type = typeof value; 3270 return !!value && (type == 'object' || type == 'function'); 3271 } 3272 3273 var lodash_memoize = memoize; 3274 3275 /** 3276 * A collection of shims that provide minimal functionality of the ES6 collections. 3277 * 3278 * These implementations are not meant to be used outside of the ResizeObserver 3279 * modules as they cover only a limited range of use cases. 3280 */ 3281 /* eslint-disable require-jsdoc, valid-jsdoc */ 3282 var MapShim = (function () { 3283 if (typeof Map !== 'undefined') { 3284 return Map; 3285 } 3286 /** 3287 * Returns index in provided array that matches the specified key. 3288 * 3289 * @param {Array<Array>} arr 3290 * @param {*} key 3291 * @returns {number} 3292 */ 3293 function getIndex(arr, key) { 3294 var result = -1; 3295 arr.some(function (entry, index) { 3296 if (entry[0] === key) { 3297 result = index; 3298 return true; 3299 } 3300 return false; 3301 }); 3302 return result; 3303 } 3304 return /** @class */ (function () { 3305 function class_1() { 3306 this.__entries__ = []; 3307 } 3308 Object.defineProperty(class_1.prototype, "size", { 3309 /** 3310 * @returns {boolean} 3311 */ 3312 get: function () { 3313 return this.__entries__.length; 3314 }, 3315 enumerable: true, 3316 configurable: true 3317 }); 3318 /** 3319 * @param {*} key 3320 * @returns {*} 3321 */ 3322 class_1.prototype.get = function (key) { 3323 var index = getIndex(this.__entries__, key); 3324 var entry = this.__entries__[index]; 3325 return entry && entry[1]; 3326 }; 3327 /** 3328 * @param {*} key 3329 * @param {*} value 3330 * @returns {void} 3331 */ 3332 class_1.prototype.set = function (key, value) { 3333 var index = getIndex(this.__entries__, key); 3334 if (~index) { 3335 this.__entries__[index][1] = value; 3336 } 3337 else { 3338 this.__entries__.push([key, value]); 3339 } 3340 }; 3341 /** 3342 * @param {*} key 3343 * @returns {void} 3344 */ 3345 class_1.prototype.delete = function (key) { 3346 var entries = this.__entries__; 3347 var index = getIndex(entries, key); 3348 if (~index) {
vendor: 26,200 bytes, lines 3349-4009
3349 entries.splice(index, 1); 3350 } 3351 }; 3352 /** 3353 * @param {*} key 3354 * @returns {void} 3355 */ 3356 class_1.prototype.has = function (key) { 3357 return !!~getIndex(this.__entries__, key); 3358 }; 3359 /** 3360 * @returns {void} 3361 */ 3362 class_1.prototype.clear = function () { 3363 this.__entries__.splice(0); 3364 }; 3365 /** 3366 * @param {Function} callback 3367 * @param {*} [ctx=null] 3368 * @returns {void} 3369 */ 3370 class_1.prototype.forEach = function (callback, ctx) { 3371 if (ctx === void 0) { ctx = null; } 3372 for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) { 3373 var entry = _a[_i]; 3374 callback.call(ctx, entry[1], entry[0]); 3375 } 3376 }; 3377 return class_1; 3378 }()); 3379 })(); 3380 3381 /** 3382 * Detects whether window and document objects are available in current environment. 3383 */ 3384 var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document; 3385 3386 // Returns global object of a current environment. 3387 var global$1 = (function () { 3388 if (typeof global !== 'undefined' && global.Math === Math) { 3389 return global; 3390 } 3391 if (typeof self !== 'undefined' && self.Math === Math) { 3392 return self; 3393 } 3394 if (typeof window !== 'undefined' && window.Math === Math) { 3395 return window; 3396 } 3397 // eslint-disable-next-line no-new-func 3398 return Function('return this')(); 3399 })(); 3400 3401 /** 3402 * A shim for the requestAnimationFrame which falls back to the setTimeout if 3403 * first one is not supported. 3404 * 3405 * @returns {number} Requests' identifier. 3406 */ 3407 var requestAnimationFrame$1 = (function () { 3408 if (typeof requestAnimationFrame === 'function') { 3409 // It's required to use a bounded function because IE sometimes throws 3410 // an "Invalid calling object" error if rAF is invoked without the global 3411 // object on the left hand side. 3412 return requestAnimationFrame.bind(global$1); 3413 } 3414 return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); }; 3415 })(); 3416 3417 // Defines minimum timeout before adding a trailing call. 3418 var trailingTimeout = 2; 3419 /** 3420 * Creates a wrapper function which ensures that provided callback will be 3421 * invoked only once during the specified delay period. 3422 * 3423 * @param {Function} callback - Function to be invoked after the delay period. 3424 * @param {number} delay - Delay after which to invoke callback. 3425 * @returns {Function} 3426 */ 3427 function throttle$1(callback, delay) { 3428 var leadingCall = false, trailingCall = false, lastCallTime = 0; 3429 /** 3430 * Invokes the original callback function and schedules new invocation if 3431 * the "proxy" was called during current request. 3432 * 3433 * @returns {void} 3434 */ 3435 function resolvePending() { 3436 if (leadingCall) { 3437 leadingCall = false; 3438 callback(); 3439 } 3440 if (trailingCall) { 3441 proxy(); 3442 } 3443 } 3444 /** 3445 * Callback invoked after the specified delay. It will further postpone 3446 * invocation of the original function delegating it to the 3447 * requestAnimationFrame. 3448 * 3449 * @returns {void} 3450 */ 3451 function timeoutCallback() { 3452 requestAnimationFrame$1(resolvePending); 3453 } 3454 /** 3455 * Schedules invocation of the original function. 3456 * 3457 * @returns {void} 3458 */ 3459 function proxy() { 3460 var timeStamp = Date.now(); 3461 if (leadingCall) { 3462 // Reject immediately following calls. 3463 if (timeStamp - lastCallTime < trailingTimeout) { 3464 return; 3465 } 3466 // Schedule new call to be in invoked when the pending one is resolved. 3467 // This is important for "transitions" which never actually start 3468 // immediately so there is a chance that we might miss one if change 3469 // happens amids the pending invocation. 3470 trailingCall = true; 3471 } 3472 else { 3473 leadingCall = true; 3474 trailingCall = false; 3475 setTimeout(timeoutCallback, delay); 3476 } 3477 lastCallTime = timeStamp; 3478 } 3479 return proxy; 3480 } 3481 3482 // Minimum delay before invoking the update of observers. 3483 var REFRESH_DELAY = 20; 3484 // A list of substrings of CSS properties used to find transition events that 3485 // might affect dimensions of observed elements. 3486 var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight']; 3487 // Check if MutationObserver is available. 3488 var mutationObserverSupported = typeof MutationObserver !== 'undefined'; 3489 /** 3490 * Singleton controller class which handles updates of ResizeObserver instances. 3491 */ 3492 var ResizeObserverController = /** @class */ (function () { 3493 /** 3494 * Creates a new instance of ResizeObserverController. 3495 * 3496 * @private 3497 */ 3498 function ResizeObserverController() { 3499 /** 3500 * Indicates whether DOM listeners have been added. 3501 * 3502 * @private {boolean} 3503 */ 3504 this.connected_ = false; 3505 /** 3506 * Tells that controller has subscribed for Mutation Events. 3507 * 3508 * @private {boolean} 3509 */ 3510 this.mutationEventsAdded_ = false; 3511 /** 3512 * Keeps reference to the instance of MutationObserver. 3513 * 3514 * @private {MutationObserver} 3515 */ 3516 this.mutationsObserver_ = null; 3517 /** 3518 * A list of connected observers. 3519 * 3520 * @private {Array<ResizeObserverSPI>} 3521 */ 3522 this.observers_ = []; 3523 this.onTransitionEnd_ = this.onTransitionEnd_.bind(this); 3524 this.refresh = throttle$1(this.refresh.bind(this), REFRESH_DELAY); 3525 } 3526 /** 3527 * Adds observer to observers list. 3528 * 3529 * @param {ResizeObserverSPI} observer - Observer to be added. 3530 * @returns {void} 3531 */ 3532 ResizeObserverController.prototype.addObserver = function (observer) { 3533 if (!~this.observers_.indexOf(observer)) { 3534 this.observers_.push(observer); 3535 } 3536 // Add listeners if they haven't been added yet. 3537 if (!this.connected_) { 3538 this.connect_(); 3539 } 3540 }; 3541 /** 3542 * Removes observer from observers list. 3543 * 3544 * @param {ResizeObserverSPI} observer - Observer to be removed. 3545 * @returns {void} 3546 */ 3547 ResizeObserverController.prototype.removeObserver = function (observer) { 3548 var observers = this.observers_; 3549 var index = observers.indexOf(observer); 3550 // Remove observer if it's present in registry. 3551 if (~index) { 3552 observers.splice(index, 1); 3553 } 3554 // Remove listeners if controller has no connected observers. 3555 if (!observers.length && this.connected_) { 3556 this.disconnect_(); 3557 } 3558 }; 3559 /** 3560 * Invokes the update of observers. It will continue running updates insofar 3561 * it detects changes. 3562 * 3563 * @returns {void} 3564 */ 3565 ResizeObserverController.prototype.refresh = function () { 3566 var changesDetected = this.updateObservers_(); 3567 // Continue running updates if changes have been detected as there might 3568 // be future ones caused by CSS transitions. 3569 if (changesDetected) { 3570 this.refresh(); 3571 } 3572 }; 3573 /** 3574 * Updates every observer from observers list and notifies them of queued 3575 * entries. 3576 * 3577 * @private 3578 * @returns {boolean} Returns "true" if any observer has detected changes in 3579 * dimensions of it's elements. 3580 */ 3581 ResizeObserverController.prototype.updateObservers_ = function () { 3582 // Collect observers that have active observations. 3583 var activeObservers = this.observers_.filter(function (observer) { 3584 return observer.gatherActive(), observer.hasActive(); 3585 }); 3586 // Deliver notifications in a separate cycle in order to avoid any 3587 // collisions between observers, e.g. when multiple instances of 3588 // ResizeObserver are tracking the same element and the callback of one 3589 // of them changes content dimensions of the observed target. Sometimes 3590 // this may result in notifications being blocked for the rest of observers. 3591 activeObservers.forEach(function (observer) { return observer.broadcastActive(); }); 3592 return activeObservers.length > 0; 3593 }; 3594 /** 3595 * Initializes DOM listeners. 3596 * 3597 * @private 3598 * @returns {void} 3599 */ 3600 ResizeObserverController.prototype.connect_ = function () { 3601 // Do nothing if running in a non-browser environment or if listeners 3602 // have been already added. 3603 if (!isBrowser || this.connected_) { 3604 return; 3605 } 3606 // Subscription to the "Transitionend" event is used as a workaround for 3607 // delayed transitions. This way it's possible to capture at least the 3608 // final state of an element. 3609 document.addEventListener('transitionend', this.onTransitionEnd_); 3610 window.addEventListener('resize', this.refresh); 3611 if (mutationObserverSupported) { 3612 this.mutationsObserver_ = new MutationObserver(this.refresh); 3613 this.mutationsObserver_.observe(document, { 3614 attributes: true, 3615 childList: true, 3616 characterData: true, 3617 subtree: true 3618 }); 3619 } 3620 else { 3621 document.addEventListener('DOMSubtreeModified', this.refresh); 3622 this.mutationEventsAdded_ = true; 3623 } 3624 this.connected_ = true; 3625 }; 3626 /** 3627 * Removes DOM listeners. 3628 * 3629 * @private 3630 * @returns {void} 3631 */ 3632 ResizeObserverController.prototype.disconnect_ = function () { 3633 // Do nothing if running in a non-browser environment or if listeners 3634 // have been already removed. 3635 if (!isBrowser || !this.connected_) { 3636 return; 3637 } 3638 document.removeEventListener('transitionend', this.onTransitionEnd_); 3639 window.removeEventListener('resize', this.refresh); 3640 if (this.mutationsObserver_) { 3641 this.mutationsObserver_.disconnect(); 3642 } 3643 if (this.mutationEventsAdded_) { 3644 document.removeEventListener('DOMSubtreeModified', this.refresh); 3645 } 3646 this.mutationsObserver_ = null; 3647 this.mutationEventsAdded_ = false; 3648 this.connected_ = false; 3649 }; 3650 /** 3651 * "Transitionend" event handler. 3652 * 3653 * @private 3654 * @param {TransitionEvent} event 3655 * @returns {void} 3656 */ 3657 ResizeObserverController.prototype.onTransitionEnd_ = function (_a) { 3658 var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b; 3659 // Detect whether transition may affect dimensions of an element. 3660 var isReflowProperty = transitionKeys.some(function (key) { 3661 return !!~propertyName.indexOf(key); 3662 }); 3663 if (isReflowProperty) { 3664 this.refresh(); 3665 } 3666 }; 3667 /** 3668 * Returns instance of the ResizeObserverController. 3669 * 3670 * @returns {ResizeObserverController} 3671 */ 3672 ResizeObserverController.getInstance = function () { 3673 if (!this.instance_) { 3674 this.instance_ = new ResizeObserverController(); 3675 } 3676 return this.instance_; 3677 }; 3678 /** 3679 * Holds reference to the controller's instance. 3680 * 3681 * @private {ResizeObserverController} 3682 */ 3683 ResizeObserverController.instance_ = null; 3684 return ResizeObserverController; 3685 }()); 3686 3687 /** 3688 * Defines non-writable/enumerable properties of the provided target object. 3689 * 3690 * @param {Object} target - Object for which to define properties. 3691 * @param {Object} props - Properties to be defined. 3692 * @returns {Object} Target object. 3693 */ 3694 var defineConfigurable = (function (target, props) { 3695 for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) { 3696 var key = _a[_i]; 3697 Object.defineProperty(target, key, { 3698 value: props[key], 3699 enumerable: false, 3700 writable: false, 3701 configurable: true 3702 }); 3703 } 3704 return target; 3705 }); 3706 3707 /** 3708 * Returns the global object associated with provided element. 3709 * 3710 * @param {Object} target 3711 * @returns {Object} 3712 */ 3713 var getWindowOf = (function (target) { 3714 // Assume that the element is an instance of Node, which means that it 3715 // has the "ownerDocument" property from which we can retrieve a 3716 // corresponding global object. 3717 var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView; 3718 // Return the local global object if it's not possible extract one from 3719 // provided element. 3720 return ownerGlobal || global$1; 3721 }); 3722 3723 // Placeholder of an empty content rectangle. 3724 var emptyRect = createRectInit(0, 0, 0, 0); 3725 /** 3726 * Converts provided string to a number. 3727 * 3728 * @param {number|string} value 3729 * @returns {number} 3730 */ 3731 function toFloat(value) { 3732 return parseFloat(value) || 0; 3733 } 3734 /** 3735 * Extracts borders size from provided styles. 3736 * 3737 * @param {CSSStyleDeclaration} styles 3738 * @param {...string} positions - Borders positions (top, right, ...) 3739 * @returns {number} 3740 */ 3741 function getBordersSize(styles) { 3742 var positions = []; 3743 for (var _i = 1; _i < arguments.length; _i++) { 3744 positions[_i - 1] = arguments[_i]; 3745 } 3746 return positions.reduce(function (size, position) { 3747 var value = styles['border-' + position + '-width']; 3748 return size + toFloat(value); 3749 }, 0); 3750 } 3751 /** 3752 * Extracts paddings sizes from provided styles. 3753 * 3754 * @param {CSSStyleDeclaration} styles 3755 * @returns {Object} Paddings box. 3756 */ 3757 function getPaddings(styles) { 3758 var positions = ['top', 'right', 'bottom', 'left']; 3759 var paddings = {}; 3760 for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) { 3761 var position = positions_1[_i]; 3762 var value = styles['padding-' + position]; 3763 paddings[position] = toFloat(value); 3764 } 3765 return paddings; 3766 } 3767 /** 3768 * Calculates content rectangle of provided SVG element. 3769 * 3770 * @param {SVGGraphicsElement} target - Element content rectangle of which needs 3771 * to be calculated. 3772 * @returns {DOMRectInit} 3773 */ 3774 function getSVGContentRect(target) { 3775 var bbox = target.getBBox(); 3776 return createRectInit(0, 0, bbox.width, bbox.height); 3777 } 3778 /** 3779 * Calculates content rectangle of provided HTMLElement. 3780 * 3781 * @param {HTMLElement} target - Element for which to calculate the content rectangle. 3782 * @returns {DOMRectInit} 3783 */ 3784 function getHTMLElementContentRect(target) { 3785 // Client width & height properties can't be 3786 // used exclusively as they provide rounded values. 3787 var clientWidth = target.clientWidth, clientHeight = target.clientHeight; 3788 // By this condition we can catch all non-replaced inline, hidden and 3789 // detached elements. Though elements with width & height properties less 3790 // than 0.5 will be discarded as well. 3791 // 3792 // Without it we would need to implement separate methods for each of 3793 // those cases and it's not possible to perform a precise and performance 3794 // effective test for hidden elements. E.g. even jQuery's ':visible' filter 3795 // gives wrong results for elements with width & height less than 0.5. 3796 if (!clientWidth && !clientHeight) { 3797 return emptyRect; 3798 } 3799 var styles = getWindowOf(target).getComputedStyle(target); 3800 var paddings = getPaddings(styles); 3801 var horizPad = paddings.left + paddings.right; 3802 var vertPad = paddings.top + paddings.bottom; 3803 // Computed styles of width & height are being used because they are the 3804 // only dimensions available to JS that contain non-rounded values. It could 3805 // be possible to utilize the getBoundingClientRect if only it's data wasn't 3806 // affected by CSS transformations let alone paddings, borders and scroll bars. 3807 var width = toFloat(styles.width), height = toFloat(styles.height); 3808 // Width & height include paddings and borders when the 'border-box' box 3809 // model is applied (except for IE). 3810 if (styles.boxSizing === 'border-box') { 3811 // Following conditions are required to handle Internet Explorer which 3812 // doesn't include paddings and borders to computed CSS dimensions. 3813 // 3814 // We can say that if CSS dimensions + paddings are equal to the "client" 3815 // properties then it's either IE, and thus we don't need to subtract 3816 // anything, or an element merely doesn't have paddings/borders styles. 3817 if (Math.round(width + horizPad) !== clientWidth) { 3818 width -= getBordersSize(styles, 'left', 'right') + horizPad; 3819 } 3820 if (Math.round(height + vertPad) !== clientHeight) { 3821 height -= getBordersSize(styles, 'top', 'bottom') + vertPad; 3822 } 3823 } 3824 // Following steps can't be applied to the document's root element as its 3825 // client[Width/Height] properties represent viewport area of the window. 3826 // Besides, it's as well not necessary as the <html> itself neither has 3827 // rendered scroll bars nor it can be clipped. 3828 if (!isDocumentElement(target)) { 3829 // In some browsers (only in Firefox, actually) CSS width & height 3830 // include scroll bars size which can be removed at this step as scroll 3831 // bars are the only difference between rounded dimensions + paddings 3832 // and "client" properties, though that is not always true in Chrome. 3833 var vertScrollbar = Math.round(width + horizPad) - clientWidth; 3834 var horizScrollbar = Math.round(height + vertPad) - clientHeight; 3835 // Chrome has a rather weird rounding of "client" properties. 3836 // E.g. for an element with content width of 314.2px it sometimes gives 3837 // the client width of 315px and for the width of 314.7px it may give 3838 // 314px. And it doesn't happen all the time. So just ignore this delta 3839 // as a non-relevant. 3840 if (Math.abs(vertScrollbar) !== 1) { 3841 width -= vertScrollbar; 3842 } 3843 if (Math.abs(horizScrollbar) !== 1) { 3844 height -= horizScrollbar; 3845 } 3846 } 3847 return createRectInit(paddings.left, paddings.top, width, height); 3848 } 3849 /** 3850 * Checks whether provided element is an instance of the SVGGraphicsElement. 3851 * 3852 * @param {Element} target - Element to be checked. 3853 * @returns {boolean} 3854 */ 3855 var isSVGGraphicsElement = (function () { 3856 // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement 3857 // interface. 3858 if (typeof SVGGraphicsElement !== 'undefined') { 3859 return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; }; 3860 } 3861 // If it's so, then check that element is at least an instance of the 3862 // SVGElement and that it has the "getBBox" method. 3863 // eslint-disable-next-line no-extra-parens 3864 return function (target) { 3865 return (target instanceof getWindowOf(target).SVGElement && 3866 typeof target.getBBox === 'function'); 3867 }; 3868 })(); 3869 /** 3870 * Checks whether provided element is a document element (<html>). 3871 * 3872 * @param {Element} target - Element to be checked. 3873 * @returns {boolean} 3874 */ 3875 function isDocumentElement(target) { 3876 return target === getWindowOf(target).document.documentElement; 3877 } 3878 /** 3879 * Calculates an appropriate content rectangle for provided html or svg element. 3880 * 3881 * @param {Element} target - Element content rectangle of which needs to be calculated. 3882 * @returns {DOMRectInit} 3883 */ 3884 function getContentRect(target) { 3885 if (!isBrowser) { 3886 return emptyRect; 3887 } 3888 if (isSVGGraphicsElement(target)) { 3889 return getSVGContentRect(target); 3890 } 3891 return getHTMLElementContentRect(target); 3892 } 3893 /** 3894 * Creates rectangle with an interface of the DOMRectReadOnly. 3895 * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly 3896 * 3897 * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions. 3898 * @returns {DOMRectReadOnly} 3899 */ 3900 function createReadOnlyRect(_a) { 3901 var x = _a.x, y = _a.y, width = _a.width, height = _a.height; 3902 // If DOMRectReadOnly is available use it as a prototype for the rectangle. 3903 var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object; 3904 var rect = Object.create(Constr.prototype); 3905 // Rectangle's properties are not writable and non-enumerable. 3906 defineConfigurable(rect, { 3907 x: x, y: y, width: width, height: height, 3908 top: y, 3909 right: x + width, 3910 bottom: height + y, 3911 left: x 3912 }); 3913 return rect; 3914 } 3915 /** 3916 * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates. 3917 * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit 3918 * 3919 * @param {number} x - X coordinate. 3920 * @param {number} y - Y coordinate. 3921 * @param {number} width - Rectangle's width. 3922 * @param {number} height - Rectangle's height. 3923 * @returns {DOMRectInit} 3924 */ 3925 function createRectInit(x, y, width, height) { 3926 return { x: x, y: y, width: width, height: height }; 3927 } 3928 3929 /** 3930 * Class that is responsible for computations of the content rectangle of 3931 * provided DOM element and for keeping track of it's changes. 3932 */ 3933 var ResizeObservation = /** @class */ (function () { 3934 /** 3935 * Creates an instance of ResizeObservation. 3936 * 3937 * @param {Element} target - Element to be observed. 3938 */ 3939 function ResizeObservation(target) { 3940 /** 3941 * Broadcasted width of content rectangle. 3942 * 3943 * @type {number} 3944 */ 3945 this.broadcastWidth = 0; 3946 /** 3947 * Broadcasted height of content rectangle. 3948 * 3949 * @type {number} 3950 */ 3951 this.broadcastHeight = 0; 3952 /** 3953 * Reference to the last observed content rectangle. 3954 * 3955 * @private {DOMRectInit} 3956 */ 3957 this.contentRect_ = createRectInit(0, 0, 0, 0); 3958 this.target = target; 3959 } 3960 /** 3961 * Updates content rectangle and tells whether it's width or height properties 3962 * have changed since the last broadcast. 3963 * 3964 * @returns {boolean} 3965 */ 3966 ResizeObservation.prototype.isActive = function () { 3967 var rect = getContentRect(this.target); 3968 this.contentRect_ = rect; 3969 return (rect.width !== this.broadcastWidth || 3970 rect.height !== this.broadcastHeight); 3971 }; 3972 /** 3973 * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data 3974 * from the corresponding properties of the last observed content rectangle. 3975 * 3976 * @returns {DOMRectInit} Last observed content rectangle. 3977 */ 3978 ResizeObservation.prototype.broadcastRect = function () { 3979 var rect = this.contentRect_; 3980 this.broadcastWidth = rect.width; 3981 this.broadcastHeight = rect.height; 3982 return rect; 3983 }; 3984 return ResizeObservation; 3985 }()); 3986 3987 var ResizeObserverEntry = /** @class */ (function () { 3988 /** 3989 * Creates an instance of ResizeObserverEntry. 3990 * 3991 * @param {Element} target - Element that is being observed. 3992 * @param {DOMRectInit} rectInit - Data of the element's content rectangle. 3993 */ 3994 function ResizeObserverEntry(target, rectInit) { 3995 var contentRect = createReadOnlyRect(rectInit); 3996 // According to the specification following properties are not writable 3997 // and are also not enumerable in the native implementation. 3998 // 3999 // Property accessors are not being used as they'd require to define a 4000 // private WeakMap storage which may cause memory leaks in browsers that 4001 // don't support this type of collections. 4002 defineConfigurable(this, { target: target, contentRect: contentRect }); 4003 } 4004 return ResizeObserverEntry; 4005 }()); 4006 4007 var ResizeObserverSPI = /** @class */ (function () { 4008 /** 4009 * Creates a new instance of ResizeObserver.
4010 * 4011 * @param {ResizeObserverCallback} callback - Callback function that is invoked 4012 * when one of the observed elements changes it's content dimensions. 4013 * @param {ResizeObserverController} controller - Controller instance which 4014 * is responsible for the updates of observer. 4015 * @param {ResizeObserver} callbackCtx - Reference to the public 4016 * ResizeObserver instance which will be passed to callback function. 4017 */ 4018 function ResizeObserverSPI(callback, controller, callbackCtx) { 4019 /** 4020 * Collection of resize observations that have detected changes in dimensions 4021 * of elements. 4022 * 4023 * @private {Array<ResizeObservation>} 4024 */ 4025 this.activeObservations_ = []; 4026 /** 4027 * Registry of the ResizeObservation instances. 4028 * 4029 * @private {Map<Element, ResizeObservation>} 4030 */ 4031 this.observations_ = new MapShim(); 4032 if (typeof callback !== 'function') { 4033 throw new TypeError('The callback provided as parameter 1 is not a function.'); 4034 } 4035 this.callback_ = callback; 4036 this.controller_ = controller; 4037 this.callbackCtx_ = callbackCtx; 4038 } 4039 /** 4040 * Starts observing provided element. 4041 * 4042 * @param {Element} target - Element to be observed. 4043 * @returns {void} 4044 */ 4045 ResizeObserverSPI.prototype.observe = function (target) { 4046 if (!arguments.length) { 4047 throw new TypeError('1 argument required, but only 0 present.'); 4048 } 4049 // Do nothing if current environment doesn't have the Element interface. 4050 if (typeof Element === 'undefined' || !(Element instanceof Object)) { 4051 return; 4052 } 4053 if (!(target instanceof getWindowOf(target).Element)) { 4054 throw new TypeError('parameter 1 is not of type "Element".'); 4055 } 4056 var observations = this.observations_; 4057 // Do nothing if element is already being observed. 4058 if (observations.has(target)) { 4059 return; 4060 } 4061 observations.set(target, new ResizeObservation(target)); 4062 this.controller_.addObserver(this); 4063 // Force the update of observations. 4064 this.controller_.refresh(); 4065 }; 4066 /** 4067 * Stops observing provided element. 4068 * 4069 * @param {Element} target - Element to stop observing. 4070 * @returns {void} 4071 */ 4072 ResizeObserverSPI.prototype.unobserve = function (target) { 4073 if (!arguments.length) { 4074 throw new TypeError('1 argument required, but only 0 present.'); 4075 } 4076 // Do nothing if current environment doesn't have the Element interface. 4077 if (typeof Element === 'undefined' || !(Element instanceof Object)) { 4078 return; 4079 } 4080 if (!(target instanceof getWindowOf(target).Element)) { 4081 throw new TypeError('parameter 1 is not of type "Element".'); 4082 } 4083 var observations = this.observations_; 4084 // Do nothing if element is not being observed. 4085 if (!observations.has(target)) { 4086 return; 4087 } 4088 observations.delete(target); 4089 if (!observations.size) { 4090 this.controller_.removeObserver(this); 4091 } 4092 }; 4093 /** 4094 * Stops observing all elements. 4095 * 4096 * @returns {void} 4097 */ 4098 ResizeObserverSPI.prototype.disconnect = function () { 4099 this.clearActive(); 4100 this.observations_.clear(); 4101 this.controller_.removeObserver(this); 4102 }; 4103 /** 4104 * Collects observation instances the associated element of which has changed 4105 * it's content rectangle. 4106 * 4107 * @returns {void} 4108 */ 4109 ResizeObserverSPI.prototype.gatherActive = function () { 4110 var _this = this; 4111 this.clearActive(); 4112 this.observations_.forEach(function (observation) { 4113 if (observation.isActive()) { 4114 _this.activeObservations_.push(observation); 4115 } 4116 }); 4117 }; 4118 /** 4119 * Invokes initial callback function with a list of ResizeObserverEntry 4120 * instances collected from active resize observations. 4121 * 4122 * @returns {void} 4123 */ 4124 ResizeObserverSPI.prototype.broadcastActive = function () {
4125 // Do nothing if observer doesn't have active observations. 4126 if (!this.hasActive()) { 4127 return; 4128 } 4129 var ctx = this.callbackCtx_; 4130 // Create ResizeObserverEntry instance for every active observation. 4131 var entries = this.activeObservations_.map(function (observation) { 4132 return new ResizeObserverEntry(observation.target, observation.broadcastRect()); 4133 }); 4134 this.callback_.call(ctx, entries, ctx); 4135 this.clearActive(); 4136 }; 4137 /** 4138 * Clears the collection of active observations. 4139 * 4140 * @returns {void} 4141 */ 4142 ResizeObserverSPI.prototype.clearActive = function () { 4143 this.activeObservations_.splice(0); 4144 }; 4145 /** 4146 * Tells whether observer has active observations. 4147 * 4148 * @returns {boolean} 4149 */ 4150 ResizeObserverSPI.prototype.hasActive = function () { 4151 return this.activeObservations_.length > 0; 4152 }; 4153 return ResizeObserverSPI; 4154 }()); 4155 4156 // Registry of internal observers. If WeakMap is not available use current shim 4157 // for the Map collection as it has all required methods and because WeakMap 4158 // can't be fully polyfilled anyway. 4159 var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim(); 4160 /** 4161 * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation 4162 * exposing only those methods and properties that are defined in the spec. 4163 */ 4164 var ResizeObserver = /** @class */ (function () { 4165 /** 4166 * Creates a new instance of ResizeObserver. 4167 * 4168 * @param {ResizeObserverCallback} callback - Callback that is invoked when 4169 * dimensions of the observed elements change. 4170 */ 4171 function ResizeObserver(callback) { 4172 if (!(this instanceof ResizeObserver)) { 4173 throw new TypeError('Cannot call a class as a function.'); 4174 } 4175 if (!arguments.length) { 4176 throw new TypeError('1 argument required, but only 0 present.'); 4177 } 4178 var controller = ResizeObserverController.getInstance(); 4179 var observer = new ResizeObserverSPI(callback, controller, this); 4180 observers.set(this, observer); 4181 } 4182 return ResizeObserver; 4183 }()); 4184 // Expose public methods of ResizeObserver. 4185 [ 4186 'observe', 4187 'unobserve', 4188 'disconnect' 4189 ].forEach(function (method) { 4190 ResizeObserver.prototype[method] = function () { 4191 var _a; 4192 return (_a = observers.get(this))[method].apply(_a, arguments); 4193 }; 4194 }); 4195 4196 var index = (function () { 4197 // Export existing implementation if available. 4198 if (typeof global$1.ResizeObserver !== 'undefined') { 4199 return global$1.ResizeObserver; 4200 } 4201 return ResizeObserver; 4202 })(); 4203 4204 var cachedScrollbarWidth = null; 4205 var cachedDevicePixelRatio = null; 4206 4207 if (canUseDom) { 4208 window.addEventListener('resize', function () { 4209 if (cachedDevicePixelRatio !== window.devicePixelRatio) { 4210 cachedDevicePixelRatio = window.devicePixelRatio; 4211 cachedScrollbarWidth = null; 4212 } 4213 }); 4214 } 4215 4216 function scrollbarWidth() { 4217 if (cachedScrollbarWidth === null) { 4218 if (typeof document === 'undefined') { 4219 cachedScrollbarWidth = 0; 4220 return cachedScrollbarWidth; 4221 } 4222 4223 var body = document.body; 4224 var box = document.createElement('div'); 4225 box.classList.add('simplebar-hide-scrollbar'); 4226 body.appendChild(box); 4227 var width = box.getBoundingClientRect().right; 4228 body.removeChild(box); 4229 cachedScrollbarWidth = width; 4230 } 4231 4232 return cachedScrollbarWidth; 4233 } 4234 4235 // `Array.prototype.{ reduce, reduceRight }` methods implementation 4236 var createMethod$4 = function (IS_RIGHT) { 4237 return function (that, callbackfn, argumentsLength, memo) { 4238 aFunction$1(callbackfn); 4239 var O = toObject(that); 4240 var self = indexedObject(O); 4241 var length = toLength(O.length); 4242 var index = IS_RIGHT ? length - 1 : 0; 4243 var i = IS_RIGHT ? -1 : 1; 4244 if (argumentsLength < 2) while (true) { 4245 if (index in self) { 4246 memo = self[index]; 4247 index += i; 4248 break; 4249 } 4250 index += i; 4251 if (IS_RIGHT ? index < 0 : length <= index) { 4252 throw TypeError('Reduce of empty array with
4252no initial value'); 4253 } 4254 } 4255 for (; IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) { 4256 memo = callbackfn(memo, self[index], index, O); 4257 } 4258 return memo; 4259 }; 4260 }; 4261 4262 var arrayReduce = { 4263 // `Array.prototype.reduce` method 4264 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce 4265 left: createMethod$4(false), 4266 // `Array.prototype.reduceRight` method 4267 // https://tc39.github.io/ecma262/#sec-array.prototype.reduceright 4268 right: createMethod$4(true) 4269 }; 4270 4271 var $reduce = arrayReduce.left; 4272 4273 4274 // `Array.prototype.reduce` method 4275 // https://tc39.github.io/ecma262/#sec-array.prototype.reduce 4276 _export({ target: 'Array', proto: true, forced: sloppyArrayMethod('reduce') }, { 4277 reduce: function reduce(callbackfn /* , initialValue */) { 4278 return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); 4279 } 4280 }); 4281 4282 var defineProperty$1 = objectDefineProperty.f; 4283 4284 var FunctionPrototype = Function.prototype; 4285 var FunctionPrototypeToString = FunctionPrototype.toString; 4286 var nameRE = /^\s*function ([^ (]*)/; 4287 var NAME = 'name'; 4288 4289 // Function instances `.name` property 4290 // https://tc39.github.io/ecma262/#sec-function-instances-name 4291 if (descriptors && !(NAME in FunctionPrototype)) { 4292 defineProperty$1(FunctionPrototype, NAME, { 4293 configurable: true, 4294 get: function () { 4295 try { 4296 return FunctionPrototypeToString.call(this).match(nameRE)[1]; 4297 } catch (error) { 4298 return ''; 4299 } 4300 } 4301 }); 4302 } 4303 4304 // `RegExp.prototype.flags` getter implementation 4305 // https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags 4306 var regexpFlags = function () { 4307 var that = anObject(this); 4308 var result = ''; 4309 if (that.global) result += 'g'; 4310 if (that.ignoreCase) result += 'i'; 4311 if (that.multiline) result += 'm'; 4312 if (that.dotAll) result += 's'; 4313 if (that.unicode) result += 'u'; 4314 if (that.sticky) result += 'y'; 4315 return result; 4316 }; 4317 4318 var nativeExec = RegExp.prototype.exec; 4319 // This always refers to the native implementation, because the 4320 // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js, 4321 // which loads this file before patching the method. 4322 var nativeReplace = String.prototype.replace; 4323 4324 var patchedExec = nativeExec; 4325 4326 var UPDATES_LAST_INDEX_WRONG = (function () { 4327 var re1 = /a/; 4328 var re2 = /b*/g; 4329 nativeExec.call(re1, 'a'); 4330 nativeExec.call(re2, 'a'); 4331 return re1.lastIndex !== 0 || re2.lastIndex !== 0; 4332 })(); 4333 4334 // nonparticipating capturing group, copied from es5-shim's String#split patch. 4335 var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; 4336 4337 var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED; 4338 4339 if (PATCH) { 4340 patchedExec = function exec(str) { 4341 var re = this; 4342 var lastIndex, reCopy, match, i; 4343 4344 if (NPCG_INCLUDED) { 4345 reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re)); 4346 } 4347 if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; 4348 4349 match = nativeExec.call(re, str); 4350 4351 if (UPDATES_LAST_INDEX_WRONG && match) { 4352 re.lastIndex = re.global ? match.index + match[0].length : lastIndex; 4353 } 4354 if (NPCG_INCLUDED && match && match.length > 1) { 4355 // Fix browsers whose `exec` methods don't consistently return `undefined` 4356 // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ 4357 nativeReplace.call(match[0], reCopy, function () { 4358 for (i = 1; i < arguments.length - 2; i++) { 4359 if (arguments[i] === undefined) match[i] = undefined; 4360 } 4361 }); 4362 } 4363 4364 return match; 4365 }; 4366 } 4367 4368 var regexpExec = patchedExec; 4369 4370 _export({ target: 'RegExp', proto: true, forced: /./.exec !== regexpExec }, { 4371 exec: regexpExec 4372 });
vendor: 6,272 bytes, lines 4373-4517
4373 4374 var SPECIES$2 = wellKnownSymbol('species'); 4375 4376 var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () { 4377 // #replace needs built-in support for named groups. 4378 // #match works fine because it just return the exec results, even if it has 4379 // a "grops" property. 4380 var re = /./; 4381 re.exec = function () { 4382 var result = []; 4383 result.groups = { a: '7' }; 4384 return result; 4385 }; 4386 return ''.replace(re, '$<a>') !== '7'; 4387 }); 4388 4389 // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec 4390 // Weex JS has frozen built-in prototypes, so use try / catch wrapper 4391 var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { 4392 var re = /(?:)/; 4393 var originalExec = re.exec; 4394 re.exec = function () { return originalExec.apply(this, arguments); }; 4395 var result = 'ab'.split(re); 4396 return result.length !== 2 || result[0] !== 'a' || result[1] !== 'b'; 4397 }); 4398 4399 var fixRegexpWellKnownSymbolLogic = function (KEY, length, exec, sham) { 4400 var SYMBOL = wellKnownSymbol(KEY); 4401 4402 var DELEGATES_TO_SYMBOL = !fails(function () { 4403 // String methods call symbol-named RegEp methods 4404 var O = {}; 4405 O[SYMBOL] = function () { return 7; }; 4406 return ''[KEY](O) != 7; 4407 }); 4408 4409 var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL && !fails(function () { 4410 // Symbol-named RegExp methods call .exec 4411 var execCalled = false; 4412 var re = /a/; 4413 re.exec = function () { execCalled = true; return null; }; 4414 4415 if (KEY === 'split') { 4416 // RegExp[@@split] doesn't call the regex's exec method, but first creates 4417 // a new one. We need to return the patched regex when creating the new one. 4418 re.constructor = {}; 4419 re.constructor[SPECIES$2] = function () { return re; }; 4420 } 4421 4422 re[SYMBOL](''); 4423 return !execCalled; 4424 }); 4425 4426 if ( 4427 !DELEGATES_TO_SYMBOL || 4428 !DELEGATES_TO_EXEC || 4429 (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) || 4430 (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) 4431 ) { 4432 var nativeRegExpMethod = /./[SYMBOL]; 4433 var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { 4434 if (regexp.exec === regexpExec) { 4435 if (DELEGATES_TO_SYMBOL && !forceStringMethod) { 4436 // The native String method already delegates to @@method (this 4437 // polyfilled function), leasing to infinite recursion. 4438 // We avoid it by directly calling the native @@method method. 4439 return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) }; 4440 } 4441 return { done: true, value: nativeMethod.call(str, regexp, arg2) }; 4442 } 4443 return { done: false }; 4444 }); 4445 var stringMethod = methods[0]; 4446 var regexMethod = methods[1]; 4447 4448 redefine(String.prototype, KEY, stringMethod); 4449 redefine(RegExp.prototype, SYMBOL, length == 2 4450 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) 4451 // 21.2.5.11 RegExp.prototype[@@split](string, limit) 4452 ? function (string, arg) { return regexMethod.call(string, this, arg); } 4453 // 21.2.5.6 RegExp.prototype[@@match](string) 4454 // 21.2.5.9 RegExp.prototype[@@search](string) 4455 : function (string) { return regexMethod.call(string, this); } 4456 ); 4457 if (sham) hide(RegExp.prototype[SYMBOL], 'sham', true); 4458 } 4459 }; 4460 4461 var charAt$1 = stringMultibyte.charAt; 4462 4463 // `AdvanceStringIndex` abstract operation 4464 // https://tc39.github.io/ecma262/#sec-advancestringindex 4465 var advanceStringIndex = function (S, index, unicode) { 4466 return index + (unicode ? charAt$1(S, index).length : 1); 4467 }; 4468 4469 // `RegExpExec` abstract operation 4470 // https://tc39.github.io/ecma262/#sec-regexpexec 4471 var regexpExecAbstract = function (R, S) { 4472 var exec = R.exec; 4473 if (typeof exec === 'function') { 4474 var result = exec.call(R, S); 4475 if (typeof result !== 'object') { 4476 throw TypeError('RegExp exec method returned something other than an Object or null'); 4477 } 4478 return result; 4479 } 4480 4481 if (classofRaw(R) !== 'RegExp') { 4482 throw TypeError('RegExp#exec called on incompatible receiver'); 4483 } 4484 4485 return regexpExec.call(R, S); 4486 }; 4487 4488 // @@match logic 4489 fixRegexpWellKnownSymbolLogic('match', 1, function (MATCH, nativeMatch, maybeCallNative) { 4490 return [ 4491 // `String.prototype.match` method 4492 // https://tc39.github.io/ecma262/#sec-string.prototype.match 4493 function match(regexp) { 4494 var O = requireObjectCoercible(this); 4495 var matcher = regexp == undefined ? undefined : regexp[MATCH]; 4496 return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); 4497 }, 4498 // `RegExp.prototype[@@match]` method 4499 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match 4500 function (regexp) { 4501 var res = maybeCallNative(nativeMatch, regexp, this); 4502 if (res.done) return res.value; 4503 4504 var rx = anObject(regexp); 4505 var S = String(this); 4506 4507 if (!rx.global) return regexpExecAbstract(rx, S); 4508 4509 var fullUnicode = rx.unicode; 4510 rx.lastIndex = 0; 4511 var A = []; 4512 var n = 0; 4513 var result; 4514 while ((result = regexpExecAbstract(rx, S)) !== null) { 4515 var matchStr = String(result[0]); 4516 A[n] = matchStr; 4517 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLe
vendor: 4,971 bytes, lines 4517-4621
4517ngth(rx.lastIndex), fullUnicode); 4518 n++; 4519 } 4520 return n === 0 ? null : A; 4521 } 4522 ]; 4523 }); 4524 4525 var max$1 = Math.max; 4526 var min$2 = Math.min; 4527 var floor$1 = Math.floor; 4528 var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d\d?|<[^>]*>)/g; 4529 var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d\d?)/g; 4530 4531 var maybeToString = function (it) { 4532 return it === undefined ? it : String(it); 4533 }; 4534 4535 // @@replace logic 4536 fixRegexpWellKnownSymbolLogic('replace', 2, function (REPLACE, nativeReplace, maybeCallNative) { 4537 return [ 4538 // `String.prototype.replace` method 4539 // https://tc39.github.io/ecma262/#sec-string.prototype.replace 4540 function replace(searchValue, replaceValue) { 4541 var O = requireObjectCoercible(this); 4542 var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; 4543 return replacer !== undefined 4544 ? replacer.call(searchValue, O, replaceValue) 4545 : nativeReplace.call(String(O), searchValue, replaceValue); 4546 }, 4547 // `RegExp.prototype[@@replace]` method 4548 // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace 4549 function (regexp, replaceValue) { 4550 var res = maybeCallNative(nativeReplace, regexp, this, replaceValue); 4551 if (res.done) return res.value; 4552 4553 var rx = anObject(regexp); 4554 var S = String(this); 4555 4556 var functionalReplace = typeof replaceValue === 'function'; 4557 if (!functionalReplace) replaceValue = String(replaceValue); 4558 4559 var global = rx.global; 4560 if (global) { 4561 var fullUnicode = rx.unicode; 4562 rx.lastIndex = 0; 4563 } 4564 var results = []; 4565 while (true) { 4566 var result = regexpExecAbstract(rx, S); 4567 if (result === null) break; 4568 4569 results.push(result); 4570 if (!global) break; 4571 4572 var matchStr = String(result[0]); 4573 if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); 4574 } 4575 4576 var accumulatedResult = ''; 4577 var nextSourcePosition = 0; 4578 for (var i = 0; i < results.length; i++) { 4579 result = results[i]; 4580 4581 var matched = String(result[0]); 4582 var position = max$1(min$2(toInteger(result.index), S.length), 0); 4583 var captures = []; 4584 // NOTE: This is equivalent to 4585 // captures = result.slice(1).map(maybeToString) 4586 // but for some reason `nativeSlice.call(result, 1, result.length)` (called in 4587 // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and 4588 // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. 4589 for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); 4590 var namedCaptures = result.groups; 4591 if (functionalReplace) { 4592 var replacerArgs = [matched].concat(captures, position, S); 4593 if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); 4594 var replacement = String(replaceValue.apply(undefined, replacerArgs)); 4595 } else { 4596 replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); 4597 } 4598 if (position >= nextSourcePosition) { 4599 accumulatedResult += S.slice(nextSourcePosition, position) + replacement; 4600 nextSourcePosition = position + matched.length; 4601 } 4602 } 4603 return accumulatedResult + S.slice(nextSourcePosition); 4604 } 4605 ]; 4606 4607 // https://tc39.github.io/ecma262/#sec-getsubstitution 4608 function getSubstitution(matched, str, position, captures, namedCaptures, replacement) { 4609 var tailPos = position + matched.length; 4610 var m = captures.length; 4611 var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED; 4612 if (namedCaptures !== undefined) { 4613 namedCaptures = toObject(namedCaptures); 4614 symbols = SUBSTITUTION_SYMBOLS; 4615 } 4616 return nativeReplace.call(replacement, symbols, function (match, ch) { 4617 var capture; 4618 switch (ch.charAt(0)) { 4619 case '$': return '$'; 4620 case '&': return matched; 4621 case '`': return str.slice(0, position);
4622 case "'": return str.slice(tailPos); 4623 case '<': 4624 capture = namedCaptures[ch.slice(1, -1)]; 4625 break; 4626 default: // \d\d? 4627 var n = +ch; 4628 if (n === 0) return match; 4629 if (n > m) { 4630 var f = floor$1(n / 10); 4631 if (f === 0) return match; 4632 if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); 4633 return match; 4634 } 4635 capture = captures[n - 1]; 4636 } 4637 return capture === undefined ? '' : capture; 4638 }); 4639 } 4640 }); 4641 4642 // Helper function to retrieve options from element attributes 4643 var getOptions = function getOptions(obj) { 4644 var options = Array.prototype.reduce.call(obj, function (acc, attribute) { 4645 var option = attribute.name.match(/data-simplebar-(.+)/); 4646 4647 if (option) { 4648 var key = option[1].replace(/\W+(.)/g, function (x, chr) { 4649 return chr.toUpperCase(); 4650 }); 4651 4652 switch (attribute.value) { 4653 case 'true': 4654 acc[key] = true; 4655 break; 4656 4657 case 'false': 4658 acc[key] = false; 4659 break; 4660 4661 case undefined: 4662 acc[key] = true; 4663 break; 4664 4665 default: 4666 acc[key] = attribute.value; 4667 } 4668 } 4669 4670 return acc; 4671 }, {}); 4672 return options; 4673 }; 4674 function getElementWindow(element) { 4675 if (!element || !element.ownerDocument || !element.ownerDocument.defaultView) { 4676 return window; 4677 } 4678 4679 return element.ownerDocument.defaultView; 4680 } 4681 function getElementDocument(element) { 4682 if (!element || !element.ownerDocument) { 4683 return document; 4684 } 4685 4686 return element.ownerDocument; 4687 } 4688 4689 var SimpleBar = 4690 /*#__PURE__*/ 4691 function () { 4692 function SimpleBar(element, options) { 4693 var _this = this; 4694 4695 this.onScroll = function () { 4696 var elWindow = getElementWindow(_this.el); 4697 4698 if (!_this.scrollXTicking) { 4699 elWindow.requestAnimationFrame(_this.scrollX); 4700 _this.scrollXTicking = true; 4701 } 4702 4703 if (!_this.scrollYTicking) { 4704 elWindow.requestAnimationFrame(_this.scrollY); 4705 _this.scrollYTicking = true; 4706 } 4707 }; 4708 4709 this.scrollX = function () { 4710 if (_this.axis.x.isOverflowing) { 4711 _this.showScrollbar('x'); 4712 4713 _this.positionScrollbar('x'); 4714 } 4715 4716 _this.scrollXTicking = false; 4717 }; 4718 4719 this.scrollY = function () { 4720 if (_this.axis.y.isOverflowing) { 4721 _this.showScrollbar('y'); 4722 4723 _this.positionScrollbar('y'); 4724 } 4725 4726 _this.scrollYTicking = false; 4727 }; 4728 4729 this.onMouseEnter = function () { 4730 _this.showScrollbar('x'); 4731 4732 _this.showScrollbar('y'); 4733 }; 4734 4735 this.onMouseMove = function (e) { 4736 _this.mouseX = e.clientX; 4737 _this.mouseY = e.clientY; 4738 4739 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) { 4740 _this.onMouseMoveForAxis('x'); 4741 } 4742 4743 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) { 4744 _this.onMouseMoveForAxis('y'); 4745 } 4746 }; 4747 4748 this.onMouseLeave = function () { 4749 _this.onMouseMove.cancel(); 4750 4751 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) { 4752 _this.onMouseLeaveForAxis('x'); 4753 } 4754 4755 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) { 4756 _this.onMouseLeaveForAxis('y'); 4757 } 4758 4759 _this.mouseX = -1; 4760 _this.mouseY = -1; 4761 }; 4762 4763 this.onWindowResize = function () { 4764 // Recalculate scrollbarWidth in case it's a zoom
4765 _this.scrollbarWidth = _this.getScrollbarWidth(); 4766 4767 _this.hideNativeScrollbar(); 4768 }; 4769 4770 this.hideScrollbars = function () { 4771 _this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect(); 4772 _this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect(); 4773 4774 if (!_this.isWithinBounds(_this.axis.y.track.rect)) { 4775 _this.axis.y.scrollbar.el.classList.remove(_this.classNames.visible); 4776 4777 _this.axis.y.isVisible = false; 4778 } 4779 4780 if (!_this.isWithinBounds(_this.axis.x.track.rect)) { 4781 _this.axis.x.scrollbar.el.classList.remove(_this.classNames.visible); 4782 4783 _this.axis.x.isVisible = false; 4784 } 4785 }; 4786 4787 this.onPointerEvent = function (e) { 4788 var isWithinTrackXBounds, isWithinTrackYBounds; 4789 _this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect(); 4790 _this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect(); 4791 4792 if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) { 4793 isWithinTrackXBounds = _this.isWithinBounds(_this.axis.x.track.rect); 4794 } 4795 4796 if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) { 4797 isWithinTrackYBounds = _this.isWithinBounds(_this.axis.y.track.rect); 4798 } // If any pointer event is called on the scrollbar 4799 4800 4801 if (isWithinTrackXBounds || isWithinTrackYBounds) { 4802 // Preventing the event's default action stops text being 4803 // selectable during the drag. 4804 e.preventDefault(); // Prevent event leaking 4805 4806 e.stopPropagation(); 4807 4808 if (e.type === 'mousedown') { 4809 if (isWithinTrackXBounds) { 4810 _this.axis.x.scrollbar.rect = _this.axis.x.scrollbar.el.getBoundingClientRect(); 4811 4812 if (_this.isWithinBounds(_this.axis.x.scrollbar.rect)) { 4813 _this.onDragStart(e, 'x'); 4814 } else { 4815 _this.onTrackClick(e, 'x'); 4816 } 4817 } 4818 4819 if (isWithinTrackYBounds) { 4820 _this.axis.y.scrollbar.rect = _this.axis.y.scrollbar.el.getBoundingClientRect(); 4821 4822 if (_this.isWithinBounds(_this.axis.y.scrollbar.rect)) { 4823 _this.onDragStart(e, 'y'); 4824 } else { 4825 _this.onTrackClick(e, 'y'); 4826 } 4827 } 4828 } 4829 } 4830 }; 4831 4832 this.drag = function (e) { 4833 var eventOffset; 4834 var track = _this.axis[_this.draggedAxis].track; 4835 var trackSize = track.rect[_this.axis[_this.draggedAxis].sizeAttr]; 4836 var scrollbar = _this.axis[_this.draggedAxis].scrollbar; 4837 var contentSize = _this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollSizeAttr]; 4838 var hostSize = parseInt(_this.elStyles[_this.axis[_this.draggedAxis].sizeAttr], 10); 4839 e.preventDefault(); 4840 e.stopPropagation(); 4841 4842 if (_this.draggedAxis === 'y') { 4843 eventOffset = e.pageY; 4844 } else { 4845 eventOffset = e.pageX; 4846 } // Calculate how far the user's mouse is from the top/left of the scrollbar (minus the dragOffset). 4847 4848 4849 var dragPos = eventOffset - track.rect[_this.axis[_this.draggedAxis].offsetAttr] - _this.axis[_this.draggedAxis].dragOffset; // Convert the mouse position into a percentage of the scrollbar height/width. 4850 4851 var dragPerc = dragPos / (trackSize - scrollbar.size); // Scroll the content by the same percentage. 4852 4853 var scrollPos = dragPerc * (contentSize - hostSize); // Fix browsers inconsistency on RTL 4854 4855 if (_this.draggedAxis === 'x') { 4856 scrollPos = _this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollbarInverted ? scrollPos - (trackSize + scrollbar.size) : scrollPos; 4857 scrollPos = _this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollingInverted ? -scrollPos : scrollPos; 4858 } 4859 4860 _this.contentWrapperEl[_this.axis[_this.draggedAxis].scrollOffsetAttr] = scrollPos; 4861 }; 4862 4863 this.onEndDrag = function (e) { 4864 var elDocument = getElementDocument(_this.el); 4865 var elWindow = getElementWindow(_this.el); 4866 e.preventDefault(); 4867 e.stopPropagation(); 4868 4869 _this.el.classList.remove(_this.classNames.dragging); 4870 4871 elDocument.removeEventListener('mousemove', _this.drag, true); 4872 elDocument.removeEventListener('mouseup', _this.onEndDrag, true); 4873 _this.removePreventClickId = elWindow.setTimeout(function () { 4874 // Remove these asynchronously so we still suppress click events 4875 // generated simultaneously with mouseup. 4876 elDocument.removeEventListener('click', _this.preventClick, true); 4877 elDocument.removeEventListener('dblclick', _this.preventClick, true); 4878 _this.removePreventClickId = null; 4879 }); 4880 }; 4881 4882 this.preventClick = function (e) { 4883 e.preventDefault(); 4884 e.stopPropagation(); 4885 }; 4886 4887 this.el = element; 4888 this.minScrollbarWidth = 20; 4889 this.options = Object.assign({}, SimpleBar.defaultOptions, {}, options); 4890 this.classNames = Object.assign({}, SimpleBar.defaultOptions.classNames, {}, this.options.classNames); 4891 this.axis = { 4892 x: { 4893 scrollOffsetAttr: 'scrollLeft', 4894 sizeAttr: 'width', 4895 scrollSizeAttr: 'scrollWidth', 4896 offsetSizeAttr: 'offsetWidth', 4897 offsetAttr: 'left', 4898 overflowAttr: 'overflowX', 4899 dragOffset: 0, 4900 isOverflowing: true, 4901 isVisible: false, 4902 forceVisible: false, 4903 track: {}, 4904 scrollbar: {} 4905 }, 4906 y: { 4907 scrollOffsetAttr: 'scrollTop', 4908 sizeAttr: 'height', 4909 scrollSizeAttr: 'scrollHeight', 4910 offsetSizeAttr: 'offsetHeight', 4911 offsetAttr: 'top', 4912 overflowAttr: 'overflowY', 4913 dragOffset: 0, 4914 isOverflowing: true, 4915 isVisible: false, 4916 forceVisible: false, 4917 track: {}, 4918 scrollbar: {} 4919 } 4920 }; 4921 this.removePreventClickId = null; // Don't re-instantiate over an existing one 4922 4923 if (SimpleBar.instances.has(this.el)) { 4924 return; 4925 } 4926 4927 this.recalculate = lodash_throttle(this.recalculate.bind(this), 64); 4928 this.onMouseMove = lodash_throttle(this.onMouseMove.bind(this), 64); 4929 this.hideScrollbars = lodash_debounce(this.hideScrollbars.bind(this), this.options.timeout); 4930 this.onWindowResize = lodash_debounce(this.onWindowResize.bind(this), 64, { 4931 leading: true 4932 }); 4933 SimpleBar.getRtlHelpers = lodash_memoize(SimpleBar.getRtlHelpers); 4934 this.init(); 4935 } 4936 /** 4937 * Static properties 4938 */ 4939 4940 /** 4941 * Helper to fix browsers inconsistency on RTL: 4942 * - Firefox inverts the scrollbar initial position 4943 * - IE11 inverts both scrollbar position and scrolling offset 4944 * Directly inspired by @KingSora's OverlayScrollbars https://github.com/KingSora/OverlayScrollbars/blob/master/js/OverlayScrollbars.js#L1634
4945 */ 4946 4947 4948 SimpleBar.getRtlHelpers = function getRtlHelpers() { 4949 var dummyDiv = document.createElement('div'); 4950 dummyDiv.innerHTML = '<div class="hs-dummy-scrollbar-size"><div style="height: 200%; width: 200%; margin: 10px 0;"></div></div>'; 4951 var scrollbarDummyEl = dummyDiv.firstElementChild; 4952 document.body.appendChild(scrollbarDummyEl); 4953 var dummyContainerChild = scrollbarDummyEl.firstElementChild; 4954 scrollbarDummyEl.scrollLeft = 0; 4955 var dummyContainerOffset = SimpleBar.getOffset(scrollbarDummyEl); 4956 var dummyContainerChildOffset = SimpleBar.getOffset(dummyContainerChild); 4957 scrollbarDummyEl.scrollLeft = 999; 4958 var dummyContainerScrollOffsetAfterScroll = SimpleBar.getOffset(dummyContainerChild); 4959 return { 4960 // determines if the scrolling is responding with negative values 4961 isRtlScrollingInverted: dummyContainerOffset.left !== dummyContainerChildOffset.left && dummyContainerChildOffset.left - dummyContainerScrollOffsetAfterScroll.left !== 0, 4962 // determines if the origin scrollbar position is inverted or not (positioned on left or right) 4963 isRtlScrollbarInverted: dummyContainerOffset.left !== dummyContainerChildOffset.left 4964 }; 4965 }; 4966 4967 SimpleBar.getOffset = function getOffset(el) { 4968 var rect = el.getBoundingClientRect(); 4969 var elDocument = getElementDocument(el); 4970 var elWindow = getElementWindow(el); 4971 return { 4972 top: rect.top + (elWindow.pageYOffset || elDocument.documentElement.scrollTop), 4973 left: rect.left + (elWindow.pageXOffset || elDocument.documentElement.scrollLeft) 4974 }; 4975 }; 4976 4977 var _proto = SimpleBar.prototype; 4978 4979 _proto.init = function init() { 4980 // Save a reference to the instance, so we know this DOM node has already been instancied 4981 SimpleBar.instances.set(this.el, this); // We stop here on server-side 4982 4983 if (canUseDom) { 4984 this.initDOM(); 4985 this.scrollbarWidth = this.getScrollbarWidth(); 4986 this.recalculate(); 4987 this.initListeners(); 4988 } 4989 }; 4990 4991 _proto.initDOM = function initDOM() { 4992 var _this2 = this; 4993 4994 var elDocument = getElementDocument(this.el); // make sure this element doesn't have the elements yet 4995 4996 if (Array.prototype.filter.call(this.el.children, function (child) { 4997 return child.classList.contains(_this2.classNames.wrapper); 4998 }).length) { 4999 // assume that element has his DOM already initiated 5000 this.wrapperEl = this.el.querySelector("." + this.classNames.wrapper); 5001 this.contentWrapperEl = this.options.scrollableNode || this.el.querySelector("." + this.classNames.contentWrapper); 5002 this.contentEl = this.options.contentNode || this.el.querySelector("." + this.classNames.contentEl); 5003 this.offsetEl = this.el.querySelector("." + this.classNames.offset); 5004 this.maskEl = this.el.querySelector("." + this.classNames.mask); 5005 this.placeholderEl = this.findChild(this.wrapperEl, "." + this.classNames.placeholder); 5006 this.heightAutoObserverWrapperEl = this.el.querySelector("." + this.classNames.heightAutoObserverWrapperEl); 5007 this.heightAutoObserverEl = this.el.querySelector("." + this.classNames.heightAutoObserverEl); 5008 this.axis.x.track.el = this.findChild(this.el, "." + this.classNames.track + "." + this.classNames.horizontal); 5009 this.axis.y.track.el = this.findChild(this.el, "." + this.classNames.track + "." + this.classNames.vertical); 5010 } else { 5011 // Prepare DOM 5012 this.wrapperEl = document.createElement('div'); 5013 this.contentWrapperEl = document.createElement('div'); 5014 this.offsetEl = document.createElement('div'); 5015 this.maskEl = document.createElement('div'); 5016 this.contentEl = document.createElement('div'); 5017 this.placeholderEl = document.createElement('div'); 5018 this.heightAutoObserverWrapperEl = document.createElement('div'); 5019 this.heightAutoObserverEl = document.createElement('div'); 5020 this.wrapperEl.classList.add(this.classNames.wrapper); 5021 this.contentWrapperEl.classList.add(this.classNames.c
5021ontentWrapper); 5022 this.offsetEl.classList.add(this.classNames.offset); 5023 this.maskEl.classList.add(this.classNames.mask); 5024 this.contentEl.classList.add(this.classNames.contentEl); 5025 this.placeholderEl.classList.add(this.classNames.placeholder); 5026 this.heightAutoObserverWrapperEl.classList.add(this.classNames.heightAutoObserverWrapperEl); 5027 this.heightAutoObserverEl.classList.add(this.classNames.heightAutoObserverEl); 5028 5029 while (this.el.firstChild) { 5030 this.contentEl.appendChild(this.el.firstChild); 5031 } 5032 5033 this.contentWrapperEl.appendChild(this.contentEl); 5034 this.offsetEl.appendChild(this.contentWrapperEl); 5035 this.maskEl.appendChild(this.offsetEl); 5036 this.heightAutoObserverWrapperEl.appendChild(this.heightAutoObserverEl); 5037 this.wrapperEl.appendChild(this.heightAutoObserverWrapperEl); 5038 this.wrapperEl.appendChild(this.maskEl); 5039 this.wrapperEl.appendChild(this.placeholderEl); 5040 this.el.appendChild(this.wrapperEl); 5041 } 5042 5043 if (!this.axis.x.track.el || !this.axis.y.track.el) { 5044 var track = document.createElement('div'); 5045 var scrollbar = document.createElement('div'); 5046 track.classList.add(this.classNames.track); 5047 scrollbar.classList.add(this.classNames.scrollbar); 5048 track.appendChild(scrollbar); 5049 this.axis.x.track.el = track.cloneNode(true); 5050 this.axis.x.track.el.classList.add(this.classNames.horizontal); 5051 this.axis.y.track.el = track.cloneNode(true); 5052 this.axis.y.track.el.classList.add(this.classNames.vertical); 5053 this.el.appendChild(this.axis.x.track.el); 5054 this.el.appendChild(this.axis.y.track.el); 5055 } 5056 5057 this.axis.x.scrollbar.el = this.axis.x.track.el.querySelector("." + this.classNames.scrollbar); 5058 this.axis.y.scrollbar.el = this.axis.y.track.el.querySelector("." + this.classNames.scrollbar); 5059 5060 if (!this.options.autoHide) { 5061 this.axis.x.scrollbar.el.classList.add(this.classNames.visible); 5062 this.axis.y.scrollbar.el.classList.add(this.classNames.visible); 5063 } 5064 5065 this.el.setAttribute('data-simplebar', 'init'); 5066 }; 5067 5068 _proto.initListeners = function initListeners() { 5069 var _this3 = this; 5070 5071 var elWindow = getElementWindow(this.el); // Event listeners 5072 5073 if (this.options.autoHide) { 5074 this.el.addEventListener('mouseenter', this.onMouseEnter); 5075 } 5076 5077 ['mousedown', 'click', 'dblclick'].forEach(function (e) { 5078 _this3.el.addEventListener(e, _this3.onPointerEvent, true); 5079 }); 5080 ['touchstart', 'touchend', 'touchmove'].forEach(function (e) { 5081 _this3.el.addEventListener(e, _this3.onPointerEvent, { 5082 capture: true, 5083 passive: true 5084 }); 5085 }); 5086 this.el.addEventListener('mousemove', this.onMouseMove); 5087 this.el.addEventListener('mouseleave', this.onMouseLeave); 5088 this.contentWrapperEl.addEventListener('scroll', this.onScroll); // Browser zoom triggers a window resize 5089 5090 elWindow.addEventListener('resize', this.onWindowResize); // Hack for https://github.com/WICG/ResizeObserver/issues/38 5091 5092 var resizeObserverStarted = false; 5093 var resizeObserver = elWindow.ResizeObserver || index; 5094 this.resizeObserver = new resizeObserver(function () { 5095 if (!resizeObserverStarted) return; 5096 5097 _this3.recalculate(); 5098 }); 5099 this.resizeObserver.observe(this.el); 5100 this.resizeObserver.observe(this.contentEl); 5101 elWindow.requestAnimationFrame(function () { 5102 resizeObserverStarted = true; 5103 });
5103 // This is required to detect horizontal scroll. Vertical scroll only needs the resizeObserver. 5104 5105 this.mutationObserver = new elWindow.MutationObserver(this.recalculate); 5106 this.mutationObserver.observe(this.contentEl, { 5107 childList: true, 5108 subtree: true, 5109 characterData: true 5110 }); 5111 }; 5112 5113 _proto.recalculate = function recalculate() { 5114 var elWindow = getElementWindow(this.el); 5115 this.elStyles = elWindow.getComputedStyle(this.el); 5116 this.isRtl = this.elStyles.direction === 'rtl'; 5117 var isHeightAuto = this.heightAutoObserverEl.offsetHeight <= 1; 5118 var isWidthAuto = this.heightAutoObserverEl.offsetWidth <= 1; 5119 var contentElOffsetWidth = this.contentEl.offsetWidth; 5120 var contentWrapperElOffsetWidth = this.contentWrapperEl.offsetWidth; 5121 var elOverflowX = this.elStyles.overflowX; 5122 var elOverflowY = this.elStyles.overflowY; 5123 this.contentEl.style.padding = this.elStyles.paddingTop + " " + this.elStyles.paddingRight + " " + this.elStyles.paddingBottom + " " + this.elStyles.paddingLeft; 5124 this.wrapperEl.style.margin = "-" + this.elStyles.paddingTop + " -" + this.elStyles.paddingRight + " -" + this.elStyles.paddingBottom + " -" + this.elStyles.paddingLeft; 5125 var contentElScrollHeight = this.contentEl.scrollHeight; 5126 var contentElScrollWidth = this.contentEl.scrollWidth; 5127 this.contentWrapperEl.style.height = isHeightAuto ? 'auto' : '100%'; // Determine placeholder size 5128 5129 this.placeholderEl.style.width = isWidthAuto ? contentElOffsetWidth + "px" : 'auto'; 5130 this.placeholderEl.style.height = contentElScrollHeight + "px"; 5131 var contentWrapperElOffsetHeight = this.contentWrapperEl.offsetHeight; 5132 this.axis.x.isOverflowing = contentElScrollWidth > contentElOffsetWidth; 5133 this.axis.y.isOverflowing = contentElScrollHeight > contentWrapperElOffsetHeight; // Set isOverflowing to false if user explicitely set hidden overflow 5134 5135 this.axis.x.isOverflowing = elOverflowX === 'hidden' ? false : this.axis.x.isOverflowing; 5136 this.axis.y.isOverflowing = elOverflowY === 'hidden' ? false : this.axis.y.isOverflowing; 5137 this.axis.x.forceVisible = this.options.forceVisible === 'x' || this.options.forceVisible === true; 5138 this.axis.y.forceVisible = this.options.forceVisible === 'y' || this.options.forceVisible === true; 5139 this.hideNativeScrollbar(); // Set isOverflowing to false if scrollbar is not necessary (content is shorter than offset) 5140 5141 var offsetForXScrollbar = this.axis.x.isOverflowing ? this.scrollbarWidth : 0; 5142 var offsetForYScrollbar = this.axis.y.isOverflowing ? this.scrollbarWidth : 0; 5143 this.axis.x.isOverflowing = this.axis.x.isOverflowing && contentElScrollWidth > contentWrapperElOffsetWidth - offsetForYScrollbar; 5144 this.axis.y.isOverflowing = this.axis.y.isOverflowing && contentElScrollHeight > contentWrapperElOffsetHeight - offsetForXScrollbar; 5145 this.axis.x.scrollbar.size = this.getScrollbarSize('x'); 5146 this.axis.y.scrollbar.size = this.getScrollbarSize('y'); 5147 this.axis.x.scrollbar.el.style.width = this.axis.x.scrollbar.size + "px"; 5148 this.axis.y.scrollbar.el.style.height = this.axis.y.scrollbar.size + "px"; 5149 this.positionScrollbar('x'); 5150 this.positionScrollbar('y'); 5151 this.toggleTrackVisibility('x'); 5152 this.toggleTrackVisibility('y'); 5153 } 5154 /** 5155 * Calculate scrollbar size 5156 */ 5157 ; 5158 5159 _proto.getScrollbarSize = function getScrollbarSize(axis) { 5160 if (axis === void 0) { 5161 axis = 'y'; 5162 } 5163 5164 if (!this.axis[axis].isOverflowing) { 5165 return 0; 5166 } 5167 5168 var contentSize = this.contentEl[this.axis[axis].scrollSizeAttr]; 5169 var trackSize = this.axis[axis].track.el[this.axis[axis].offsetSizeAttr]; 5170 var scrollbarSize; 5171 var scrollbarRatio = trackSize / contentSize; // Calculate new height/position of drag handle. 5172 5173 scrollbarSize = Math.max(~~(scrollbarRatio * trackSize), this.options.scrollbarMinSize); 5174 5175 if (this.options.scrollbarMaxSize) { 5176 scrollbarSize = Math.min(scrollbarSize, this.options.scrollbarMaxSize); 5177 } 5178 5179 return scrollbarSize; 5180 }; 5181 5182 _proto.positionScrollbar = function positionScrollbar(axis) { 5183 if (axis === void 0) { 5184 axis = 'y'; 5185 } 5186 5187 if (!this.axis[axis].isOverflowing) { 5188 return; 5189 } 5190 5191 var contentSize = this.contentWrapperEl[this.axis[axis].scrollSizeAttr]; 5192 var trackSize = this.axis[axis].track.el[this.axis[axis].offsetSizeAttr]; 5193 var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10); 5194 var scrollbar = this.axis[axis].scrollbar; 5195 var scrollOffset = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr]; 5196 scrollOffset = axis === 'x' && this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollingInverted ? -scrollOffset : scrollOffset; 5197 var scrollPourcent = scrollOffset / (contentSize - hostSize); 5198 var handleOffset = ~~((trackSize - scrollbar.size) * scrollPourcent); 5199 handleOffset = axis === 'x' && this.isRtl && SimpleBar.getRtlHelpers().isRtlScrollbarInverted ? handleOffset + (trackSize - scrollbar.size) : handleOffset; 5200 scrollbar.el.style.transform = axis === 'x' ? "translate3d(" + handleOffset + "px, 0, 0)" : "translate3d(0, " + handleOffset + "px, 0)"; 5201 }; 5202 5203 _proto.toggleTrackVisibility = function toggleTrackVisibility(axis) { 5204 if (axis === void 0) { 5205 axis = 'y'; 5206 } 5207 5208 var track = this.axis[axis].track.el; 5209 var scrollbar = this.axis[axis].scrollbar.el; 5210 5211 if (this.axis[axis].isOverflowing || this.axis[axis].forceVisible) { 5212 track.style.visibility = 'visible'; 5213 this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'scroll'; 5214 } else { 5215 track.style.visibility = 'hidden'; 5216 this.contentWrapperEl.style[this.axis[axis].overflowAttr] = 'hidden'; 5217 } // Even if forceVisible is enabled, scrollbar itself should be hidden 5218 5219 5220 if (this.axis[axis].isOverflowing) { 5221 scrollbar.style.display = 'block'; 5222 } else { 5223 scrollbar.style.display = 'none'; 5224 } 5225 }; 5226 5227 _proto.hideNativeScrollbar = function hideNativeScrollbar() { 5228 this.offsetEl.style[this.isRtl ? 'left' : 'right'] = this.axis.y.isOverflowing || this.axis.y.forceVisible ? "-" + this.scrollbarWidth + "px" : 0; 5229 this.offsetEl.style.bottom = this.axis.x.isOverflowing || this.axis.x.forceVisible ? "-" + this.scrollbarWidth + "px" : 0; 5230 } 5231 /** 5232 * On scroll event handling 5233 */ 5234 ; 5235 5236 _proto.onMouseMoveForAxis = function onMouseMoveForAxis(axis) { 5237 if (axis === void 0) { 5238 axis = 'y'; 5239 } 5240 5241 this.axis[axis].track.rect = this.axis[axis].track.el.getBoundingClientRect(); 5242 this.axis[axis].scrollbar.rect = this.axis[axis].scrollbar.el.getBoundingClientRect(); 5243 var isWithinScrollbarBoundsX = this.isWithinBounds(this.axis[axis].scrollbar.rect); 5244 5245 if (isWithinScrollbarBoundsX) { 5246 this.axis[axis].scrollbar.el.classList.add(this.classNames.hover); 5247 } else { 5248 this.axis[axis].scrollbar.el.classList.remove(this.classNames.hover); 5249 } 5250 5251 if (this.isWithinBounds(this.axis[axis].track.rect)) { 5252 this.showScrollbar(axis); 5253 this.axis[axis].track.el.classList.add(this.classNames.hover); 5254 } else { 5255 this.axis[axis].track.el.classList.remove(this.classNames.hover); 5256 } 5257 }; 5258 5259 _proto.onMouseLeaveForAxis = function onMouseLeaveForAxis(axis) { 5260 if (axis === void 0) { 5261 axis = 'y'; 5262 } 5263 5264 this.axis[axis].track.el.classList.remove(this.classNames.hover); 5265 this.axis[axis].scrollbar.el.classList.remove(this.classNames.hover); 5266 }; 5267 5268 /** 5269 * Show scrollbar 5270 */ 5271 _proto.showScrollbar = function showScrollbar(axis) { 5272 if (axis === void 0) { 5273 axis = 'y'; 5274 } 5275 5276 var scrollbar = this.axis[axis].scrollbar.el; 5277 5278 if (!this.axis[axis].isVisible) { 5279 scrollbar.classList.add(this.classNames.visible); 5280 this.axis[axis].isVisible = true; 5281 } 5282 5283 if (this.options.autoHide) { 5284 this.hideScrollbars(); 5285 } 5286 } 5287 /** 5288 * Hide Scrollbar 5289 */ 5290 ; 5291 5292 /** 5293 * on scrollbar handle drag movement starts 5294 */ 5295 _proto.onDragStart = function onDragStart(e, axis) { 5296 if (axis === void 0) { 5297 axis = 'y'; 5298 } 5299 5300 var elDocument = getElementDocument(this.el); 5301 var elWindow = getElementWindow(this.el); 5302 var scrollbar = this.axis[axis].scrollbar; // Measure how far the user's mouse is from the top of the scrollbar drag handle. 5303 5304 var eventOffset = axis === 'y' ? e.pageY : e.pageX; 5305 this.axis[axis].dragOffset = eventOffset - scrollbar.rect[this.axis[axis].offsetAttr]; 5306 this.draggedAxis = axis; 5307 this.el.classList.add(this.classNames.dragging); 5308 elDocument.addEventListener('mousemove', this.drag, true); 5309 elDocument.addEventListener('mouseup', this.onEndDrag, true); 5310 5311 if (this.removePreventClickId === null) { 5312 elDocument.addEventListener('click', this.preventClick, true); 5313 elDocument.addEventListener('dblclick', this.preventClick, true); 5314 } else { 5315 elWindow.clearTimeout(this.removePreventClickId); 5316 this.removePreventClickId = null; 5317 } 5318 } 5319 /** 5320 * Drag scrollbar handle 5321 */ 5322 ; 5323 5324 _proto.onTrackClick = function onTrackClick(e, axis) { 5325 var _this4 = this; 5326 5327 if (axis === void 0) { 5328 axis = 'y'; 5329 } 5330 5331 if (!this.options.clickOnTrack) return; 5332 var elWindow = getElementWindow(this.el); 5333 this.axis[axis].scrollbar.rect = this.axis[axis].scrollbar.el.getBoundingClientRect(); 5334 var scrollbar = this.axis[axis].scrollbar; 5335 var scrollbarOffset = scrollbar.rect[this.axis[axis].offsetAttr]; 5336 var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10); 5337 var scrolled = this.contentWrapperEl[this.axis[axis].scrollOffsetAttr]; 5338 var t = axis === 'y' ? this.mouseY - scrollbarOffset : this.mouseX - scrollbarOffset; 5339 var dir = t < 0 ? -1 : 1; 5340 var scrollSize = dir === -1 ? scrolled - hostSize : scrolled + hostSize; 5341 var speed = 40; 5342 5343 var scrollTo = function scrollTo() { 5344 if (dir === -1) { 5345 if (scrolled > scrollSize) { 5346 var _this4$contentWrapper; 5347 5348 scrolled -= speed; 5349 5350 _this4.contentWrapperEl.scrollTo((_this4$contentWrapper = {}, _this4$contentWrapper[_this4.axis[axis].offsetAttr] = scrolled, _this4$contentWrapper)); 5351 5352 elWindow.requestAnimationFrame(scrollTo); 5353 } 5354 } else { 5355 if (scrolled < scrollSize) { 5356 var _this4$contentWrapper2; 5357 5358 scrolled += speed; 5359 5360 _this4.contentWrapperEl.scrollTo((_this4$contentWrapper2 = {}, _this4$contentWrapper2[_this4.axis[axis].offsetAttr] = scrolled, _this4$contentWrapper2)); 5361 5362 elWindow.requestAnimationFrame(scrollTo); 5363 } 5364 } 5365 }; 5366 5367 scrollTo(); 5368 } 5369 /** 5370 * Getter for content element 5371 */ 5372 ; 5373 5374 _proto.getContentElement = function getContentElement() { 5375 return this.contentEl; 5376 } 5377 /** 5378 * Getter for original scrolling element 5379 */ 5380 ; 5381 5382 _proto.getScrollElement = function getScrollElement() { 5383 return this.contentWrapperEl; 5384 }; 5385 5386 _proto.getScrollbarWidth = function getScrollbarWidth() { 5387 // Try/catch for FF 56 throwing on undefined computedStyles 5388 try { 5389 // Detect browsers supporting CSS scrollbar styling and do not calculate 5390 if (getComputedStyle(this.contentWrapperEl, '::-webkit-scrollbar').display === 'none' || 'scrollbarWidth' in document.documentElement.style || '-ms-overflow-style' in document.documentElement.style) { 5391 return 0; 5392 } else { 5393 return scrollbarWidth(); 5394 } 5395 } catch (e) { 5396 return scrollbarWidth(); 5397 } 5398 }; 5399 5400 _proto.removeListeners = function removeListeners() { 5401 var _this5 = this; 5402 5403 var elWindow = getElementWindow(this.el); // Event listeners 5404 5405 if (this.options.autoHide) { 5406 this.el.removeEventListener('mouseenter', this.onMouseEnter); 5407 } 5408 5409 ['mousedown', 'click', 'dblclick'].forEach(function (e) { 5410 _this5.el.removeEventListener(e, _this5.onPointerEvent, true); 5411 }); 5412 ['touchstart', 'touchend', 'touchmove'].forEach(function (e) { 5413 _this5.el.removeEventListener(e, _this5.onPointerEvent, { 5414 capture: true, 5415 passive: true 5416 }); 5417 }); 5418 this.el.removeEventListener('mousemove', this.onMouseMove); 5419 this.el.removeEventListener('mouseleave', this.onMouseLeave); 5420 this.contentWrapperEl.removeEventListener('scroll', this.onScroll); 5421 elWindow.removeEventListener('resize', this.onWindowResize); 5422 this.mutationObserver.disconnect(); 5423 this.resizeObserver.disconnect(); // Cancel all debounced functions 5424 5425 this.recalculate.cancel(); 5426 this.onMouseMove.cancel(); 5427 this.hideScrollbars.cancel(); 5428 this.onWindowResize.cancel(); 5429 } 5430 /** 5431 * UnMount mutation observer and delete SimpleBar instance from DOM element 5432 */ 5433
5433 ; 5434 5435 _proto.unMount = function unMount() { 5436 this.removeListeners(); 5437 SimpleBar.instances.delete(this.el); 5438 } 5439 /** 5440 * Check if mouse is within bounds 5441 */ 5442 ; 5443 5444 _proto.isWithinBounds = function isWithinBounds(bbox) { 5445 return this.mouseX >= bbox.left && this.mouseX <= bbox.left + bbox.width && this.mouseY >= bbox.top && this.mouseY <= bbox.top + bbox.height; 5446 } 5447 /** 5448 * Find element children matches query 5449 */ 5450 ; 5451 5452 _proto.findChild = function findChild(el, query) { 5453 var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector; 5454 return Array.prototype.filter.call(el.children, function (child) { 5455 return matches.call(child, query); 5456 })[0]; 5457 }; 5458 5459 return SimpleBar; 5460 }(); 5461 5462 SimpleBar.defaultOptions = { 5463 autoHide: true, 5464 forceVisible: false, 5465 clickOnTrack: true, 5466 classNames: { 5467 contentEl: 'simplebar-content', 5468 contentWrapper: 'simplebar-content-wrapper', 5469 offset: 'simplebar-offset', 5470 mask: 'simplebar-mask', 5471 wrapper: 'simplebar-wrapper', 5472 placeholder: 'simplebar-placeholder', 5473 scrollbar: 'simplebar-scrollbar', 5474 track: 'simplebar-track', 5475 heightAutoObserverWrapperEl: 'simplebar-height-auto-observer-wrapper', 5476 heightAutoObserverEl: 'simplebar-height-auto-observer', 5477 visible: 'simplebar-visible', 5478 horizontal: 'simplebar-horizontal', 5479 vertical: 'simplebar-vertical', 5480 hover: 'simplebar-hover', 5481 dragging: 'simplebar-dragging' 5482 }, 5483 scrollbarMinSize: 100, 5484 scrollbarMaxSize: 0, 5485 timeout: 1000 5486 }; 5487 SimpleBar.instances = new WeakMap(); 5488 5489 SimpleBar.initDOMLoadedElements = function () { 5490 document.removeEventListener('DOMContentLoaded', this.initDOMLoadedElements); 5491 window.removeEventListener('load', this.initDOMLoadedElements); 5492 Array.prototype.forEach.call(document.querySelectorAll('[data-simplebar]:not([data-simplebar="init"])'), function (el) { 5493 if (!SimpleBar.instances.has(el)) new SimpleBar(el, getOptions(el.attributes)); 5494 }); 5495 }; 5496 5497 SimpleBar.removeObserver = function () { 5498 this.globalObserver.disconnect(); 5499 }; 5500 5501 SimpleBar.initHtmlApi = function () { 5502 this.initDOMLoadedElements = this.initDOMLoadedElements.bind(this); // MutationObserver is IE11+ 5503 5504 if (typeof MutationObserver !== 'undefined') { 5505 // Mutation observer to observe dynamically added elements 5506 this.globalObserver = new MutationObserver(SimpleBar.handleMutations); 5507 this.globalObserver.observe(document, { 5508 childList: true, 5509 subtree: true 5510 }); 5511 } // Taken from jQuery `ready` function 5512 // Instantiate elements already present on the page 5513 5514 5515 if (document.readyState === 'complete' || document.readyState !== 'loading' && !document.documentElement.doScroll) { 5516 // Handle it asynchronously to allow scripts the opportunity to delay init 5517 window.setTimeout(this.initDOMLoadedElements); 5518 } else { 5519 document.addEventListener('DOMContentLoaded', this.initDOMLoadedElements); 5520 window.addEventListener('load', this.initDOMLoadedElements); 5521 } 5522 }; 5523 5524 SimpleBar.handleMutations = function (mutations) { 5525 mutations.forEach(function (mutation) { 5526 Array.prototype.forEach.call(mutation.addedNodes, function (addedNode) { 5527 if (addedNode.nodeType === 1) { 5528 if (addedNode.hasAttribute('data-simplebar')) { 5529 !SimpleBar.instances.has(addedNode) && new SimpleBar(addedNode, getOptions(addedNode.attributes)); 5530 } else { 5531 Array.prototype.forEach.call(addedNode.querySelectorAll('[data-simplebar]:not([data-simplebar="init"])'), function (el) { 5532 !SimpleBar.instances.has(el) && new SimpleBar(el, getOptions(el.attributes)); 5533 }); 5534 } 5535 } 5536 }); 5537 Array.prototype.forEach.call(mutation.removedNodes, function (removedNode) { 5538 if (removedNode.nodeType === 1) { 5539 if (removedNode.hasAttribute('[data-simplebar="init"]')) { 5540 SimpleBar.instances.has(removedNode) && SimpleBar.instances.get(removedNode).unMount(); 5541 } else { 5542 Array.prototype.forEach.call(removedNode.querySelectorAll('[data-simplebar="init"]'), function (el) { 5543 SimpleBar.instances.has(el) && SimpleBar.instances.get(el).unMount(); 5544 }); 5545 } 5546 } 5547 }); 5548 }); 5549 }; 5550 5551 SimpleBar.getOptions = getOptions; 5552 /** 5553 * HTML API 5554 * Called only in a browser env. 5555 */ 5556 5557 if (canUseDom) { 5558 SimpleBar.initHtmlApi(); 5559 } 5560 5561 return SimpleBar; 5562 5563}));; 5564!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};
vendor: 6,741 bytes, line 5564
5564return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,(function(t){return e[t]}).bind(null,r));return o},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=1)}({1:function(e,t,n){e.exports=n("Xa9S")},KJ4T:function(e,t){!function(e,t){"use strict";function n(){var e=M.splice(0,M.length);for(Ye=0;e.length;)e.shift().call(null,e.shift())}function o(e,t){for(var n=0,o=e.length;n<o;n++)d(e[n],t)}function r(e){return function(t){Ae(t)&&(d(t,e),ae.length&&o(t.querySelectorAll(ae),e))}}function a(e){var t=Ve.call(e,"is"),n=e.nodeName.toUpperCase(),o=se.call(oe,t?ee+t.toUpperCase():Q+n);return t&&-1<o&&!i(n,t)?-1:o}function i(e,t){return-1<ae.indexOf(e+'[is="'+t+'"]')}function s(e){var t=e.currentTarget,n=e.attrChange,o=e.attrName,r=e.target,a=e[X]||2,i=e[$]||3;!ot||r&&r!==t||!t[V]||"style"===o||e.prevValue===e.newValue&&(""!==e.newValue||n!==a&&n!==i)||t[V](o,n===a?null:e.prevValue,n===i?null:e.newValue)}function c(e){var t=r(e);return function(e){M.push(t,e.target),Ye&&clearTimeout(Ye),Ye=setTimeout(n,1)}}function l(e){nt&&(nt=!1,e.currentTarget.removeEventListener(Y,l)),ae.length&&o((e.target||b).querySelectorAll(ae),e.detail===x?x:j),Ne&&function(){for(var e,t=0,n=Ie.length;t<n;t++)ie.contains(e=Ie[t])||(n--,Ie.splice(t--,1),d(e,x))}()}function u(e,t){var n=this;Be.call(n,e,t),L.call(n,{target:n})}function h(e,t,n){var o=t.apply(e,n),r=a(o);return-1<r&&Z(o,re[r]),n.pop()&&ae.length&&function(e){for(var t,n=0,o=e.length;n<o;n++)Z(t=e[n],re[a(t)])}(o.querySelectorAll(ae)),o}function p(e,t){De(e,t),O?O.observe(e,$e):(tt&&(e.setAttribute=u,e[A]=S(e),e[I](J,L)),e[I](K,s)),e[G]&&ot&&(e.created=!0,e[G](),e.created=!1)}function f(e){throw new Error("A "+e+" type is already registered")}function d(e,t){var n,o,r=a(e);-1<r&&!xe.call(e,"TEMPLATE")&&(H(e,re[r]),r=0,t!==j||e[j]?t!==x||e[x]||(e[j]=!1,e[x]=!0,o="disconnected",r=1):(e[x]=!1,e[j]=!0,o="connected",r=1,Ne&&se.call(Ie,e)<0&&Ie.push(e)),r&&(n=e[t+R]||e[o+R])&&n.call(e))}function m(){}function g(e,t,n){var o=n&&n[F]||"",r=t.prototype,a=Oe(r),i=t.observedAttributes||pe,s={prototype:a};ze(a,G,{value:function(){if(we)we=!1;else if(!this[Te]){this[Te]=!0,new t(this),r[G]&&r[G].call(this);var e=Me[Ce.get(t)];(!_e||e.create.length>1)&&v(this)}}}),ze(a,V,{value:function(e){-1<se.call(i,e)&&r[V]&&r[V].apply(this,arguments)}}),r[q]&&ze(a,U,{value:r[q]}),r[B]&&ze(a,W,{value:r[B]}),o&&(s[F]=o),e=e.toUpperCase(),Me[e]={constructor:t,create:o?[o,Se(e)]:[e]},Ce.set(t,e),b[N](e.toLowerCase(),s),_(e),Le[e].r()}function y(e){var t=Me[e.toUpperCase()];return t&&t.constructor}function T(e){return"string"==typeof e?e:e&&e.is||""}function v(e){for(var t,n=e[V],o=n?e.attributes:pe,r=o.length;r--;)n.call(e,(t=o[r]).name||t.nodeName,null,t.value||t.nodeValue)}function _(e){return(e=e.toUpperCase())in Le||(Le[e]={},Le[e].p=new Ee(function(t){Le[e].r=t})),Le[e].p}function k(){ve&&delete e.customElements,he(e,"customElements",{configurable:!0,value:new m}),he(e,"CustomElementRegistry",{configurable:!0,value:m});for(var t=w.get(/^HTML[A-Z]*[a-z]/),n=t.length;n--;function(t){var n=e[t];if(n){e[t]=function(e){var t,o;return e||(e=this),e[Te]||(we=!0,t=Me[Ce.get(e.constructor)],(e=(o=_e&&1===t.create.length)?Reflect.construct(n,pe,t.constructor):b.createElement.apply(b,t.create))[Te]=!0,we=!1,o||v(e)),e},e[t].prototype=n.prototype;try{n.prototype.constructor=e[t]}catch(o){he(n,Te,{value:e[t]})}}}(t[n]));b.createElement=function(e,t){var n=T(t);return n?Xe.call(this,e,Se(n)):Xe.call(this,e)},Je||(et=!0,b[N](""))}var b=e.document,E=e.Object,w=function(e){var t,n,o,r,a=/^[A-Z]+[a-z]/,i=function(e,t){(t=t.toLowerCase())in s||(s[e]=(s[e]||[]).concat(t),s[t]=s[t.toUpperCase()]=e)},s=(E.create||E)(null),c={};for(n in e)for(r in e[n])for(s[r]=o=e[n][r],t=0;t<o.length;t++)s[o[t].toLowerCase()]=s[o[t].toUpperCase()]=r;return c.get=function(e){return"string"==typeof e?s[e]||(a.test(e)?[]:""):function(e){var t,n=[];for(t in s)e.test(t)&&n.push(t);return n}(e)},c.set=function(e,t){return a.test(e)?i(e,t):i(t,e),c},c}({collections:{HTMLAllCollection:["all"],HTMLCollection:["forms"],HTMLFormControlsCollection:["elements"],HTMLOptionsCollection:["options"]},elements:{Element:["element"],HTMLAnchorElement:["a"],HTMLAppletElement:["applet"],HTMLAreaElement:["area"],HTMLAttachmentElement:["attachment"],HTMLAudioElement:["audio"],HTMLBRElement:["br"],HTMLBaseElement:["base"],HTMLBodyElement:["body"],HTMLButtonElement:["button"],HTMLCanvasElement:["canvas"],HTMLContentElement:["content"],HTMLDListElement:["dl"],HTMLDataElement:["data"],HTMLDataListElement:["datalist"],HTMLDetailsElement:["details"],HTMLDialogElement:["dialog"],HTMLDirectoryElement:["dir"],HTMLDivElement:["div"],HTMLDocument:["document"],HTMLElement:["element","abbr","address","article","aside","b","bdi","bdo","cite","code","command","dd","dfn","dt","em","figcaption","figure","footer","header","i","kbd","mark","nav","noscript","rp","rt","ruby","s","samp","section","small","strong","sub","summary","sup","u","var","wbr"],HTMLEmbedElement:["embed"],HTMLFieldSetElement:["fieldset"],HTMLFontElement:["font"],HTMLFormElement:["form"],HTMLFrameElement:["frame"],HTMLFrameSetElement:["frameset"],HTMLHRElement:["hr"],HTMLHeadElement:["head"],HTMLHeadingElement:["h1","h2","h3","h4","h5","h6"],HTMLHtmlElement:["html"],HTMLIFrameElement:["iframe"],HTMLImageElement:["img"],HTMLInputElement:["input"],HTMLKeygenElement:["keygen"],HTMLLIElement:["li"],HTMLLabelElement:["label"],HTMLLegendElement:["legend"],HTMLLinkElement:["link"],HTMLMapElement:["map"],HTMLMarqueeElement:["marquee"],HTMLMediaElement:["media"],HTMLMenuElement:["menu"],HTMLMenuItemElement:["menuitem"],HTMLMetaElement:["meta"],HTMLMeterElement:["meter"],HTMLModElement:["del","ins"],HTMLOListElement:["ol"],HTMLObjectElement:["object"],HTMLOptGroupElement:["optgroup"],HTMLOptionElement:["option"],HTMLOutputElement:["output"],HTMLParagraphElement:["p"],HTMLParamElement:["param"],HTMLPictureElement:["picture"],HTMLPreElement:["pre"],HTMLProgressElement:["progress"],HTMLQuoteElement:["blockquote","q","quote"],HTMLScriptElement:["script"],HTMLSelectElement:["select"],HTMLSha
vendor: 4,519 bytes, line 5564
5564dowElement:["shadow"],HTMLSlotElement:["slot"],HTMLSourceElement:["source"],HTMLSpanElement:["span"],HTMLStyleElement:["style"],HTMLTableCaptionElement:["caption"],HTMLTableCellElement:["td","th"],HTMLTableColElement:["col","colgroup"],HTMLTableElement:["table"],HTMLTableRowElement:["tr"],HTMLTableSectionElement:["thead","tbody","tfoot"],HTMLTemplateElement:["template"],HTMLTextAreaElement:["textarea"],HTMLTimeElement:["time"],HTMLTitleElement:["title"],HTMLTrackElement:["track"],HTMLUListElement:["ul"],HTMLUnknownElement:["unknown","vhgroupv","vkeygen"],HTMLVideoElement:["video"]},nodes:{Attr:["node"],Audio:["audio"],CDATASection:["node"],CharacterData:["node"],Comment:["#comment"],Document:["#document"],DocumentFragment:["#document-fragment"],DocumentType:["node"],HTMLDocument:["#document"],Image:["img"],Option:["option"],ProcessingInstruction:["node"],ShadowRoot:["#shadow-root"],Text:["#text"],XMLDocument:["xml"]}});"object"!=typeof t&&(t={type:t||"auto"});var M,L,C,S,O,D,H,Z,P,N="registerElement",z=1e5*e.Math.random()>>0,A="__"+N+z,I="addEventListener",j="attached",R="Callback",x="detached",F="extends",V="attributeChanged"+R,U=j+R,q="connected"+R,B="disconnected"+R,G="created"+R,W=x+R,X="ADDITION",$="REMOVAL",K="DOMAttrModified",Y="DOMContentLoaded",J="DOMSubtreeModified",Q="<",ee="=",te=/^[A-Z][._A-Z0-9]*-[-._A-Z0-9]*$/,ne=["ANNOTATION-XML","COLOR-PROFILE","FONT-FACE","FONT-FACE-SRC","FONT-FACE-URI","FONT-FACE-FORMAT","FONT-FACE-NAME","MISSING-GLYPH"],oe=[],re=[],ae="",ie=b.documentElement,se=oe.indexOf||function(e){for(var t=this.length;t--&&this[t]!==e;);return t},ce=E.prototype,le=ce.hasOwnProperty,ue=ce.isPrototypeOf,he=E.defineProperty,pe=[],fe=E.getOwnPropertyDescriptor,de=E.getOwnPropertyNames,me=E.getPrototypeOf,ge=E.setPrototypeOf,ye=!!E.__proto__,Te="__dreCEv1",ve=e.customElements,_e=!/^force/.test(t.type)&&!!(ve&&ve.define&&ve.get&&ve.whenDefined),ke=E.create||E,be=e.Map||function(){var e,t=[],n=[];return{get:function(e){return n[se.call(t,e)]},set:function(o,r){(e=se.call(t,o))<0?n[t.push(o)-1]=r:n[e]=r}}},Ee=e.Promise||function(e){function t(e){for(o=!0;n.length;)n.shift()(e)}var n=[],o=!1,r={catch:function(){return r},then:function(e){return n.push(e),o&&setTimeout(t,1),r}};return e(t),r},we=!1,Me=ke(null),Le=ke(null),Ce=new be,Se=function(e){return e.toLowerCase()},Oe=E.create||function e(t){return t?(e.prototype=t,new e):this},De=ge||(ye?function(e,t){return e.__proto__=t,e}:de&&fe?function(){function e(e,t){for(var n,o=de(t),r=0,a=o.length;r<a;r++)le.call(e,n=o[r])||he(e,n,fe(t,n))}return function(t,n){do{e(t,n)}while((n=me(n))&&!ue.call(n,t));return t}}():function(e,t){for(var n in t)e[n]=t[n];return e}),He=e.MutationObserver||e.WebKitMutationObserver,Ze=e.HTMLAnchorElement,Pe=(e.HTMLElement||e.Element||e.Node).prototype,Ne=!ue.call(Pe,ie),ze=Ne?function(e,t,n){return e[t]=n.value,e}:he,Ae=Ne?function(e){return 1===e.nodeType}:function(e){return ue.call(Pe,e)},Ie=Ne&&[],je=Pe.attachShadow,Re=Pe.cloneNode,xe=Pe.closest||function(e){for(var t=this;t&&t.nodeName!==e;)t=t.parentNode;return t},Fe=Pe.dispatchEvent,Ve=Pe.getAttribute,Ue=Pe.hasAttribute,qe=Pe.removeAttribute,Be=Pe.setAttribute,Ge=b.createElement,We=b.importNode,Xe=Ge,$e=He&&{attributes:!0,characterData:!0,attributeOldValue:!0},Ke=He||function(e){tt=!1,ie.removeEventListener(K,Ke)},Ye=0,Je=N in b&&!/^force-all/.test(t.type),Qe=!0,et=!1,tt=!0,nt=!0,ot=!0;if(He&&((P=b.createElement("div")).innerHTML="<div><div></div></div>",new He(function(e,t){if(e[0]&&"childList"==e[0].type&&!e[0].removedNodes[0].childNodes.length){var n=(P=fe(Pe,"innerHTML"))&&P.set;n&&he(Pe,"innerHTML",{set:function(e){for(;this.lastChild;)this.removeChild(this.lastChild);n.call(this,e)}})}t.disconnect(),P=null}).observe(P,{childList:!0,subtree:!0}),P.innerHTML=""),Je||(ge||ye?(H=function(e,t){ue.call(t,e)||p(e,t)},Z=p):Z=H=function(e,t){e[A]||(e[A]=E(!0),p(e,t))},Ne?(tt=!1,function(){var e=fe(Pe,I),t=e.value,n=function(e){var t=new CustomEvent(K,{bubbles:!0});t.attrName=e,t.prevValue=Ve.call(this,e),t.newValue=null,t[$]=t.attrChange=2,qe.call(this,e),Fe.call(this,t)},o=function(e,t){var n=Ue.call(this,e),o=n&&Ve.call(this,e),r=new CustomEvent(K,{bubbles:!0});Be.call(this,e,t),r.attrName=e,r.prevValue=n?o:null,r.newValue=t,n?r.MODIFICATION=r.attrChange=1:r[X]=r.attrChange=0,Fe.call(this,r)},r=function(e){var t,n=e.currentTarget,o=n[A],r=e.propertyName;o.hasOwnProperty(r)&&(o=o[r],(t=new CustomEvent(K,{bubbles:!0})).attrName=o.name,t.prevValue=o.value||null,t.newValue=o.value=n[r]||null,
vendor: 6,088 bytes, line 5564
5564null==t.prevValue?t[X]=t.attrChange=0:t.MODIFICATION=t.attrChange=1,Fe.call(n,t))};e.value=function(e,a,i){e===K&&this[V]&&this.setAttribute!==o&&(this[A]={className:{name:"class",value:this.className}},this.setAttribute=o,this.removeAttribute=n,t.call(this,"propertychange",r)),t.call(this,e,a,i)},he(Pe,I,e)}()):He||(ie[I](K,Ke),ie.setAttribute(A,1),ie.removeAttribute(A),tt&&(L=function(e){var t,n,o,r=this;if(r===e.target){for(o in t=r[A],r[A]=n=S(r),n){if(!(o in t))return C(0,r,o,t[o],n[o],X);if(n[o]!==t[o])return C(1,r,o,t[o],n[o],"MODIFICATION")}for(o in t)if(!(o in n))return C(2,r,o,t[o],n[o],$)}},C=function(e,t,n,o,r,a){var i={attrChange:e,currentTarget:t,attrName:n,prevValue:o,newValue:r};i[a]=e,s(i)},S=function(e){for(var t,n,o={},r=e.attributes,a=0,i=r.length;a<i;a++)"setAttribute"!==(n=(t=r[a]).name)&&(o[n]=t.value);return o})),b[N]=function(e,t){if(n=e.toUpperCase(),Qe&&(Qe=!1,He?(O=function(e,t){function n(e,t){for(var n=0,o=e.length;n<o;t(e[n++]));}return new He(function(o){for(var r,a,i,s=0,c=o.length;s<c;s++)"childList"===(r=o[s]).type?(n(r.addedNodes,e),n(r.removedNodes,t)):(a=r.target,ot&&a[V]&&"style"!==r.attributeName&&(i=Ve.call(a,r.attributeName))!==r.oldValue&&a[V](r.attributeName,r.oldValue,i))})}(r(j),r(x)),(D=function(e){return O.observe(e,{childList:!0,subtree:!0}),e})(b),je&&(Pe.attachShadow=function(){return D(je.apply(this,arguments))})):(M=[],b[I]("DOMNodeInserted",c(j)),b[I]("DOMNodeRemoved",c(x))),b[I](Y,l),b[I]("readystatechange",l),b.importNode=function(e,t){switch(e.nodeType){case 1:return h(b,We,[e,!!t]);case 11:for(var n=b.createDocumentFragment(),o=e.childNodes,r=o.length,a=0;a<r;a++)n.appendChild(b.importNode(o[a],!!t));return n;default:return Re.call(e,!!t)}},Pe.cloneNode=function(e){return h(this,Re,[!!e])}),et)return et=!1;if(-2<se.call(oe,ee+n)+se.call(oe,Q+n)&&f(e),!te.test(n)||-1<se.call(ne,n))throw new Error("The type "+e+" is invalid");var n,a,i=function(){return u?b.createElement(p,n):b.createElement(p)},s=t||ce,u=le.call(s,F),p=u?t[F].toUpperCase():n;return u&&-1<se.call(oe,Q+p)&&f(p),a=oe.push((u?ee:Q)+n)-1,ae=ae.concat(ae.length?",":"",u?p+'[is="'+e.toLowerCase()+'"]':p),i.prototype=re[a]=le.call(s,"prototype")?s.prototype:Oe(Pe),ae.length&&o(b.querySelectorAll(ae),j),i},b.createElement=Xe=function(e,t){var n=T(t),o=n?Ge.call(b,e,Se(n)):Ge.call(b,e),r=""+e,a=se.call(oe,(n?ee:Q)+(n||r).toUpperCase()),s=-1<a;return n&&(o.setAttribute("is",n=n.toLowerCase()),s&&(s=i(r.toUpperCase(),n))),ot=!b.createElement.innerHTMLHelper,s&&Z(o,re[a]),o}),addEventListener("beforeunload",function(){delete b.createElement,delete b.importNode,delete b[N]},!1),m.prototype={constructor:m,define:_e?function(e,t,n){if(n)g(e,t,n);else{var o=e.toUpperCase();Me[o]={constructor:t,create:[o]},Ce.set(t,o),ve.define(e,t)}}:g,get:_e?function(e){return ve.get(e)||y(e)}:y,whenDefined:_e?function(e){return Ee.race([ve.whenDefined(e),_(e)])}:_},!ve||/^force/.test(t.type))k();else if(!t.noBuiltIn)try{!function(t,n,o){var r=new RegExp("^<a\\s+is=('|\")"+o+"\\1></a>$");if(n[F]="a",(t.prototype=Oe(Ze.prototype)).constructor=t,e.customElements.define(o,t,n),!r.test(b.createElement("a",{is:o}).outerHTML)||!r.test((new t).outerHTML))throw n}(function e(){return Reflect.construct(Ze,[],e)},{},"document-register-element-a"+z)}catch(rt){k()}if(!t.noBuiltIn)try{if(Ge.call(b,"a","a").outerHTML.indexOf("is")<0)throw{}}catch(at){Se=function(e){return{is:e.toLowerCase()}}}}(window)},Xa9S:function(e,t,n){"use strict";n.r(t),n("pDpN"),n("KJ4T")},pDpN:function(e,t,n){var o,r;void 0===(r="function"==typeof(o=function(){"use strict";!function(e){const t=e.performance;function n(e){t&&t.mark&&t.mark(e)}function o(e,n){t&&t.measure&&t.measure(e,n)}n("Zone");const r=e.__Zone_symbol_prefix||"__zone_symbol__";function a(e){return r+e}const i=!0===e[a("forceDuplicateZoneCheck")];if(e.Zone){if(i||"function"!=typeof e.Zone.__symbol__)throw new Error("Zone already loaded.");return e.Zone}class s{constructor(e,t){this._parent=e,this._name=t?t.name||"unnamed":"<root>",this._properties=t&&t.properties||{},this._zoneDelegate=new l(this,this._parent&&this._parent._zoneDelegate,t)}static assertZonePatched(){if(e.Promise!==O.ZoneAwarePromise)throw new Error("Zone.js has detected that ZoneAwarePromise `(window|global).Promise` has been overwritten.\nMost likely cause is that a Promise polyfill has been loaded after Zone.js (Polyfilling Promise api is not necessary when zone.js is loaded. If you must load one, do so before loading zone.js.)")}static get root(){let e=s.current;for(;e.parent;)e=e.parent;return e}static get current(){return H.zone}static get currentTask(){return Z}static __load_patch(t,r){if(O.hasOwnProperty(t)){if(i)throw Error("Already loaded patch: "+t)}else if(!e["__Zone_disable_"+t]){const a="Zone:"+t;n(a),O[t]=r(e,s,D),o(a,a)}}get parent(){return this._parent}get name(){return this._name}get(e){const t=this.getZoneWith(e);if(t)return t._properties[e]}getZoneWith(e){let t=this;for(;t;){if(t._properties.hasOwnProperty(e))return t;t=t._parent}return null}fork(e){if(!e)throw new Error("ZoneSpec required!");return this._zoneDelegate.fork(this,e)}wrap(e,t){if("function"!=typeof e)throw new Error("Expecting function got: "+e);const n=this._zoneDelegate.intercept(this,e,t),o=this;return function(){return o.runGuarded(n,this,arguments,t)}}run(e,t,n,o){H={parent:H,zone:this};try{return this._zoneDelegate.invoke(this,e,t,n,o)}finally{H=H.parent}}runGuarded(e,t=null,n,o){H={parent:H,zone:this};try{try{return this._zoneDelegate.invoke(this,e,t,n,o)}catch(r){if(this._zoneDelegate.handleError(this,r))throw r}}finally{H=H.parent}}runTask(e,t,n){if(e.zone!=this)throw new Error("A task can only be run in the zone of creation! (Creation: "+(e.zone||v).name+"; Execution: "+this.name+")");if(e.state===_&&(e.type===S||e.type===C))return;const o=e.state!=E;o&&e._transitionTo(E,b),e.runCount++;const r=Z;Z=e,H={parent:H,zone:this};try{e.type==C&&e.data&&!e.data.isPeriodic&&(e.cancelFn=void 0);try{return this._zoneDelegate.invokeTask(this,e,t,n)}catch(a){if(this._zoneDelegate.handleError(this,a))throw a}}
vendor: 5,120 bytes, line 5564
5564finally{e.state!==_&&e.state!==M&&(e.type==S||e.data&&e.data.isPeriodic?o&&e._transitionTo(b,E):(e.runCount=0,this._updateTaskCount(e,-1),o&&e._transitionTo(_,E,_))),H=H.parent,Z=r}}scheduleTask(e){if(e.zone&&e.zone!==this){let t=this;for(;t;){if(t===e.zone)throw Error(`can not reschedule task to ${this.name} which is descendants of the original zone ${e.zone.name}`);t=t.parent}}e._transitionTo(k,_);const t=[];e._zoneDelegates=t,e._zone=this;try{e=this._zoneDelegate.scheduleTask(this,e)}catch(n){throw e._transitionTo(M,k,_),this._zoneDelegate.handleError(this,n),n}return e._zoneDelegates===t&&this._updateTaskCount(e,1),e.state==k&&e._transitionTo(b,k),e}scheduleMicroTask(e,t,n,o){return this.scheduleTask(new u(L,e,t,n,o,void 0))}scheduleMacroTask(e,t,n,o,r){return this.scheduleTask(new u(C,e,t,n,o,r))}scheduleEventTask(e,t,n,o,r){return this.scheduleTask(new u(S,e,t,n,o,r))}cancelTask(e){if(e.zone!=this)throw new Error("A task can only be cancelled in the zone of creation! (Creation: "+(e.zone||v).name+"; Execution: "+this.name+")");e._transitionTo(w,b,E);try{this._zoneDelegate.cancelTask(this,e)}catch(t){throw e._transitionTo(M,w),this._zoneDelegate.handleError(this,t),t}return this._updateTaskCount(e,-1),e._transitionTo(_,w),e.runCount=0,e}_updateTaskCount(e,t){const n=e._zoneDelegates;-1==t&&(e._zoneDelegates=null);for(let o=0;o<n.length;o++)n[o]._updateTaskCount(e.type,t)}}s.__symbol__=a;const c={name:"",onHasTask:(e,t,n,o)=>e.hasTask(n,o),onScheduleTask:(e,t,n,o)=>e.scheduleTask(n,o),onInvokeTask:(e,t,n,o,r,a)=>e.invokeTask(n,o,r,a),onCancelTask:(e,t,n,o)=>e.cancelTask(n,o)};class l{constructor(e,t,n){this._taskCounts={microTask:0,macroTask:0,eventTask:0},this.zone=e,this._parentDelegate=t,this._forkZS=n&&(n&&n.onFork?n:t._forkZS),this._forkDlgt=n&&(n.onFork?t:t._forkDlgt),this._forkCurrZone=n&&(n.onFork?this.zone:t._forkCurrZone),this._interceptZS=n&&(n.onIntercept?n:t._interceptZS),this._interceptDlgt=n&&(n.onIntercept?t:t._interceptDlgt),this._interceptCurrZone=n&&(n.onIntercept?this.zone:t._interceptCurrZone),this._invokeZS=n&&(n.onInvoke?n:t._invokeZS),this._invokeDlgt=n&&(n.onInvoke?t:t._invokeDlgt),this._invokeCurrZone=n&&(n.onInvoke?this.zone:t._invokeCurrZone),this._handleErrorZS=n&&(n.onHandleError?n:t._handleErrorZS),this._handleErrorDlgt=n&&(n.onHandleError?t:t._handleErrorDlgt),this._handleErrorCurrZone=n&&(n.onHandleError?this.zone:t._handleErrorCurrZone),this._scheduleTaskZS=n&&(n.onScheduleTask?n:t._scheduleTaskZS),this._scheduleTaskDlgt=n&&(n.onScheduleTask?t:t._scheduleTaskDlgt),this._scheduleTaskCurrZone=n&&(n.onScheduleTask?this.zone:t._scheduleTaskCurrZone),this._invokeTaskZS=n&&(n.onInvokeTask?n:t._invokeTaskZS),this._invokeTaskDlgt=n&&(n.onInvokeTask?t:t._invokeTaskDlgt),this._invokeTaskCurrZone=n&&(n.onInvokeTask?this.zone:t._invokeTaskCurrZone),this._cancelTaskZS=n&&(n.onCancelTask?n:t._cancelTaskZS),this._cancelTaskDlgt=n&&(n.onCancelTask?t:t._cancelTaskDlgt),this._cancelTaskCurrZone=n&&(n.onCancelTask?this.zone:t._cancelTaskCurrZone),this._hasTaskZS=null,this._hasTaskDlgt=null,this._hasTaskDlgtOwner=null,this._hasTaskCurrZone=null;const o=n&&n.onHasTask;(o||t&&t._hasTaskZS)&&(this._hasTaskZS=o?n:c,this._hasTaskDlgt=t,this._hasTaskDlgtOwner=this,this._hasTaskCurrZone=e,n.onScheduleTask||(this._scheduleTaskZS=c,this._scheduleTaskDlgt=t,this._scheduleTaskCurrZone=this.zone),n.onInvokeTask||(this._invokeTaskZS=c,this._invokeTaskDlgt=t,this._invokeTaskCurrZone=this.zone),n.onCancelTask||(this._cancelTaskZS=c,this._cancelTaskDlgt=t,this._cancelTaskCurrZone=this.zone))}fork(e,t){return this._forkZS?this._forkZS.onFork(this._forkDlgt,this.zone,e,t):new s(e,t)}intercept(e,t,n){return this._interceptZS?this._interceptZS.onIntercept(this._interceptDlgt,this._interceptCurrZone,e,t,n):t}invoke(e,t,n,o,r){return this._invokeZS?this._invokeZS.onInvoke(this._invokeDlgt,this._invokeCurrZone,e,t,n,o,r):t.apply(n,o)}handleError(e,t){return!this._handleErrorZS||this._handleErrorZS.onHandleError(this._handleErrorDlgt,this._handleErrorCurrZone,e,t)}scheduleTask(e,t){let n=t;if(this._scheduleTaskZS)this._hasTaskZS&&n._zoneDelegates.push(this._hasTaskDlgtOwner),n=this._scheduleTaskZS.onScheduleTask(this._scheduleTaskDlgt,this._scheduleTaskCurrZone,e,t),n||(n=t);else if(t.scheduleFn)t.scheduleFn(t);else{if(t.type!=L)throw new Error("Task is missing scheduleFn.");y(t)}return n}invokeTask(e,t,n,o){return this._invokeTaskZS?this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt,this._invokeTaskCurrZone,e,t,n,o):t.callback.apply(n,o)}cancelTask(e,t){let n;if(this._cancelTaskZS)n=this._cancelTaskZS.onCancelTask(this._cancelTaskDlgt,this._cancelTaskCurrZone,e,t);else{if(!t.cancelFn)throw Error("Task is not cancelable");n=t.cancelFn(t)}return n}hasTask(e,t){try{this._hasTaskZS&&this._hasTaskZS.onHasTask(this._hasTaskDlgt,this._hasTaskCurrZone,e,t)}catch(n){this.handleError(e,n)}}_updateTaskCount(e,t){const n=this._taskCounts,o=n[e],r=n[e]=o+t;if(r<0)throw new Error("More tasks executed then were scheduled.");0!=o&&0!=r||this.hasTask(this.zone,{microTask:n.microTask>0,macroTask:n.macroTask>0,eventTask:n.eventTask>0,change:e})}}
vendor: 6,091 bytes, line 5564
5564class u{constructor(t,n,o,r,a,i){if(this._zone=null,this.runCount=0,this._zoneDelegates=null,this._state="notScheduled",this.type=t,this.source=n,this.data=r,this.scheduleFn=a,this.cancelFn=i,!o)throw new Error("callback is not defined");this.callback=o;const s=this;this.invoke=t===S&&r&&r.useG?u.invokeTask:function(){return u.invokeTask.call(e,s,this,arguments)}}static invokeTask(e,t,n){e||(e=this),P++;try{return e.runCount++,e.zone.runTask(e,t,n)}finally{1==P&&T(),P--}}get zone(){return this._zone}get state(){return this._state}cancelScheduleRequest(){this._transitionTo(_,k)}_transitionTo(e,t,n){if(this._state!==t&&this._state!==n)throw new Error(`${this.type} '${this.source}': can not transition to '${e}', expecting state '${t}'${n?" or '"+n+"'":""}, was '${this._state}'.`);this._state=e,e==_&&(this._zoneDelegates=null)}toString(){return this.data&&void 0!==this.data.handleId?this.data.handleId.toString():Object.prototype.toString.call(this)}toJSON(){return{type:this.type,state:this.state,source:this.source,zone:this.zone.name,runCount:this.runCount}}}const h=a("setTimeout"),p=a("Promise"),f=a("then");let d,m=[],g=!1;function y(t){if(0===P&&0===m.length)if(d||e[p]&&(d=e[p].resolve(0)),d){let e=d[f];e||(e=d.then),e.call(d,T)}else e[h](T,0);t&&m.push(t)}function T(){if(!g){for(g=!0;m.length;){const t=m;m=[];for(let n=0;n<t.length;n++){const o=t[n];try{o.zone.runTask(o,null,null)}catch(e){D.onUnhandledError(e)}}}D.microtaskDrainDone(),g=!1}}const v={name:"NO ZONE"},_="notScheduled",k="scheduling",b="scheduled",E="running",w="canceling",M="unknown",L="microTask",C="macroTask",S="eventTask",O={},D={symbol:a,currentZoneFrame:()=>H,onUnhandledError:N,microtaskDrainDone:N,scheduleMicroTask:y,showUncaughtError:()=>!s[a("ignoreConsoleErrorUncaughtError")],patchEventTarget:()=>[],patchOnProperties:N,patchMethod:()=>N,bindArguments:()=>[],patchThen:()=>N,patchMacroTask:()=>N,setNativePromise:e=>{e&&"function"==typeof e.resolve&&(d=e.resolve(0))},patchEventPrototype:()=>N,isIEOrEdge:()=>!1,getGlobalObjects:()=>{},ObjectDefineProperty:()=>N,ObjectGetOwnPropertyDescriptor:()=>{},ObjectCreate:()=>{},ArraySlice:()=>[],patchClass:()=>N,wrapWithCurrentZone:()=>N,filterProperties:()=>[],attachOriginToPatched:()=>N,_redefineProperty:()=>N,patchCallbacks:()=>N};let H={parent:null,zone:new s(null,null)},Z=null,P=0;function N(){}o("Zone","Zone"),e.Zone=s}("undefined"!=typeof window&&window||"undefined"!=typeof self&&self||global),Zone.__load_patch("ZoneAwarePromise",(e,t,n)=>{const o=Object.getOwnPropertyDescriptor,r=Object.defineProperty,a=n.symbol,i=[],s=!0===e[a("DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION")],c=a("Promise"),l=a("then");n.onUnhandledError=e=>{if(n.showUncaughtError()){const t=e&&e.rejection;t?console.error("Unhandled Promise rejection:",t instanceof Error?t.message:t,"; Zone:",e.zone.name,"; Task:",e.task&&e.task.source,"; Value:",t,t instanceof Error?t.stack:void 0):console.error(e)}},n.microtaskDrainDone=()=>{for(;i.length;){const t=i.shift();try{t.zone.runGuarded(()=>{throw t})}catch(e){h(e)}}};const u=a("unhandledPromiseRejectionHandler");function h(e){n.onUnhandledError(e);try{const n=t[u];"function"==typeof n&&n.call(this,e)}catch(o){}}function p(e){return e&&e.then}function f(e){return e}function d(e){return D.reject(e)}const m=a("state"),g=a("value"),y=a("finally"),T=a("parentPromiseValue"),v=a("parentPromiseState"),_=null,k=!0,b=!1;function E(e,t){return n=>{try{M(e,t,n)}catch(o){M(e,!1,o)}}}const w=a("currentTaskTrace");function M(e,o,a){const c=function(){let e=!1;return function(t){return function(){e||(e=!0,t.apply(null,arguments))}}}();if(e===a)throw new TypeError("Promise resolved with itself");if(e[m]===_){let h=null;try{"object"!=typeof a&&"function"!=typeof a||(h=a&&a.then)}catch(u){return c(()=>{M(e,!1,u)})(),e}if(o!==b&&a instanceof D&&a.hasOwnProperty(m)&&a.hasOwnProperty(g)&&a[m]!==_)C(a),M(e,a[m],a[g]);else if(o!==b&&"function"==typeof h)try{h.call(a,c(E(e,o)),c(E(e,!1)))}catch(u){c(()=>{M(e,!1,u)})()}else{e[m]=o;const c=e[g];if(e[g]=a,e[y]===y&&o===k&&(e[m]=e[v],e[g]=e[T]),o===b&&a instanceof Error){const e=t.currentTask&&t.currentTask.data&&t.currentTask.data.__creationTrace__;e&&r(a,w,{configurable:!0,enumerable:!1,writable:!0,value:e})}for(let t=0;t<c.length;)S(e,c[t++],c[t++],c[t++],c[t++]);if(0==c.length&&o==b){e[m]=0;let o=a;if(!s)try{throw new Error("Uncaught (in promise): "+((l=a)&&l.toString===Object.prototype.toString?(l.constructor&&l.constructor.name||"")+": "+JSON.stringify(l):l?l.toString():Object.prototype.toString.call(l))+(a&&a.stack?"\n"+a.stack:""))}catch(u){o=u}o.rejection=a,o.promise=e,o.zone=t.current,o.task=t.currentTask,i.push(o),n.scheduleMicroTask()}}}var l;return e}const L=a("rejectionHandledHandler");function C(e){if(0===e[m]){try{const n=t[L];n&&"function"==typeof n&&n.call(this,{rejection:e[g],promise:e})}catch(n){}e[m]=b;for(let t=0;t<i.length;t++)e===i[t].promise&&i.splice(t,1)}}function S(e,t,n,o,r){C(e);const a=e[m],i=a?"function"==typeof o?o:f:"function"==typeof r?r:d;t.scheduleMicroTask("Promise.then",()=>{try{const o=e[g],r=!!n&&y===n[y];r&&(n[T]=o,n[v]=a);const s=t.run(i,void 0,r&&i!==d&&i!==f?[]:[o]);M(n,!0,s)}catch(o){M(n,!1,o)}},n)}const O=function(){};class D{static toString(){return"function ZoneAwarePromise() { [native code] }"}static resolve(e){return M(new this(null),k,e)}static reject(e){return M(new this(null),b,e)}static race(e){let t,n,o=new this((e,o)=>{t=e,n=o});function r(e){t(e)}function a(e){n(e)}for(let i of e)p(i)||(i=this.resolve(i)),i.then(r,a);return o}static all(e){return D.allWithCallback(e)}static allSettled(e){return(this&&this.prototype instanceof D?this:D).allWithCallback(e,{thenCallback:e=>({status:"fulfilled",value:e}),errorCallback:e=>({status:"rejected",reason:e})})}static allWithCallback(e,t){let n,o,r=new this((e,t)=>{n=e,o=t}),a=2,i=0;const s=[];for(let l of e){p(l)||(l=this.resolve(l));const e=i;try{l.then(o=>{s[e]=t?t.thenCallback(o):o,a--,0===a&&n(s)},r=>{t?(s[e]=t.errorCallback(r),a--,0===a&&n(s)):o(r)})}catch(c){o(c)}a++,i++}return a-=2,0===a&&n(s),r}constructor(e){const t=this;
vendor: 9,389 bytes, line 5564
5564if(!(t instanceof D))throw new Error("Must be an instanceof Promise.");t[m]=_,t[g]=[];try{e&&e(E(t,k),E(t,b))}catch(n){M(t,!1,n)}}get[Symbol.toStringTag](){return"Promise"}get[Symbol.species](){return D}then(e,n){let o=this.constructor[Symbol.species];o&&"function"==typeof o||(o=this.constructor||D);const r=new o(O),a=t.current;return this[m]==_?this[g].push(a,r,e,n):S(this,a,r,e,n),r}catch(e){return this.then(null,e)}finally(e){let n=this.constructor[Symbol.species];n&&"function"==typeof n||(n=D);const o=new n(O);o[y]=y;const r=t.current;return this[m]==_?this[g].push(r,o,e,e):S(this,r,o,e,e),o}}D.resolve=D.resolve,D.reject=D.reject,D.race=D.race,D.all=D.all;const H=e[c]=e.Promise,Z=t.__symbol__("ZoneAwarePromise");let P=o(e,"Promise");P&&!P.configurable||(P&&delete P.writable,P&&delete P.value,P||(P={configurable:!0,enumerable:!0}),P.get=function(){return e[Z]?e[Z]:e[c]},P.set=function(t){t===D?e[Z]=t:(e[c]=t,t.prototype[l]||z(t),n.setNativePromise(t))},r(e,"Promise",P)),e.Promise=D;const N=a("thenPatched");function z(e){const t=e.prototype,n=o(t,"then");if(n&&(!1===n.writable||!n.configurable))return;const r=t.then;t[l]=r,e.prototype.then=function(e,t){return new D((e,t)=>{r.call(this,e,t)}).then(e,t)},e[N]=!0}if(n.patchThen=z,H){z(H);const t=e.fetch;"function"==typeof t&&(e[n.symbol("fetch")]=t,e.fetch=(A=t,function(){let e=A.apply(this,arguments);if(e instanceof D)return e;let t=e.constructor;return t[N]||z(t),e}))}var A;return Promise[t.__symbol__("uncaughtPromiseErrors")]=i,D});const e=Object.getOwnPropertyDescriptor,t=Object.defineProperty,n=Object.getPrototypeOf,o=Object.create,r=Array.prototype.slice,a="addEventListener",i="removeEventListener",s=Zone.__symbol__(a),c=Zone.__symbol__(i),l="true",u="false",h=Zone.__symbol__("");function p(e,t){return Zone.current.wrap(e,t)}function f(e,t,n,o,r){return Zone.current.scheduleMacroTask(e,t,n,o,r)}const d=Zone.__symbol__,m="undefined"!=typeof window,g=m?window:void 0,y=m&&g||"object"==typeof self&&self||global,T=[null];function v(e,t){for(let n=e.length-1;n>=0;n--)"function"==typeof e[n]&&(e[n]=p(e[n],t+"_"+n));return e}function _(e){return!e||!1!==e.writable&&!("function"==typeof e.get&&void 0===e.set)}const k="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope,b=!("nw"in y)&&void 0!==y.process&&"[object process]"==={}.toString.call(y.process),E=!b&&!k&&!(!m||!g.HTMLElement),w=void 0!==y.process&&"[object process]"==={}.toString.call(y.process)&&!k&&!(!m||!g.HTMLElement),M={},L=function(e){if(!(e=e||y.event))return;let t=M[e.type];t||(t=M[e.type]=d("ON_PROPERTY"+e.type));const n=this||e.target||y,o=n[t];let r;if(E&&n===g&&"error"===e.type){const t=e;r=o&&o.call(this,t.message,t.filename,t.lineno,t.colno,t.error),!0===r&&e.preventDefault()}else r=o&&o.apply(this,arguments),null==r||r||e.preventDefault();return r};function C(n,o,r){let a=e(n,o);if(!a&&r&&e(r,o)&&(a={enumerable:!0,configurable:!0}),!a||!a.configurable)return;const i=d("on"+o+"patched");if(n.hasOwnProperty(i)&&n[i])return;delete a.writable,delete a.value;const s=a.get,c=a.set,l=o.substr(2);let u=M[l];u||(u=M[l]=d("ON_PROPERTY"+l)),a.set=function(e){let t=this;t||n!==y||(t=y),t&&(t[u]&&t.removeEventListener(l,L),c&&c.apply(t,T),"function"==typeof e?(t[u]=e,t.addEventListener(l,L,!1)):t[u]=null)},a.get=function(){let e=this;if(e||n!==y||(e=y),!e)return null;const t=e[u];if(t)return t;if(s){let t=s&&s.call(this);if(t)return a.set.call(this,t),"function"==typeof e.removeAttribute&&e.removeAttribute(o),t}return null},t(n,o,a),n[i]=!0}function S(e,t,n){if(t)for(let o=0;o<t.length;o++)C(e,"on"+t[o],n);else{const t=[];for(const n in e)"on"==n.substr(0,2)&&t.push(n);for(let o=0;o<t.length;o++)C(e,t[o],n)}}const O=d("originalInstance");function D(e){const n=y[e];if(!n)return;y[d(e)]=n,y[e]=function(){const t=v(arguments,e);switch(t.length){case 0:this[O]=new n;break;case 1:this[O]=new n(t[0]);break;case 2:this[O]=new n(t[0],t[1]);break;case 3:this[O]=new n(t[0],t[1],t[2]);break;case 4:this[O]=new n(t[0],t[1],t[2],t[3]);break;default:throw new Error("Arg list too long.")}},P(y[e],n);const o=new n(function(){});let r;for(r in o)"XMLHttpRequest"===e&&"responseBlob"===r||function(n){"function"==typeof o[n]?y[e].prototype[n]=function(){return this[O][n].apply(this[O],arguments)}:t(y[e].prototype,n,{set:function(t){"function"==typeof t?(this[O][n]=p(t,e+"."+n),P(this[O][n],t)):this[O][n]=t},get:function(){return this[O][n]}})}(r);for(r in n)"prototype"!==r&&n.hasOwnProperty(r)&&(y[e][r]=n[r])}function H(t,o,r){let a=t;for(;a&&!a.hasOwnProperty(o);)a=n(a);!a&&t[o]&&(a=t);const i=d(o);let s=null;if(a&&!(s=a[i])&&(s=a[i]=a[o],_(a&&e(a,o)))){const e=r(s,i,o);a[o]=function(){return e(this,arguments)},P(a[o],s)}return s}function Z(e,t,n){let o=null;function r(e){const t=e.data;return t.args[t.cbIdx]=function(){e.invoke.apply(this,arguments)},o.apply(t.target,t.args),e}o=H(e,t,e=>function(t,o){const a=n(t,o);return a.cbIdx>=0&&"function"==typeof o[a.cbIdx]?f(a.name,o[a.cbIdx],a,r):e.apply(t,o)})}function P(e,t){e[d("OriginalDelegate")]=t}let N=!1,z=!1;function A(){try{const e=g.navigator.userAgent;if(-1!==e.indexOf("MSIE ")||-1!==e.indexOf("Trident/"))return!0}catch(e){}return!1}function I(){if(N)return z;N=!0;try{const e=g.navigator.userAgent;-1===e.indexOf("MSIE ")&&-1===e.indexOf("Trident/")&&-1===e.indexOf("Edge/")||(z=!0)}catch(e){}return z}Zone.__load_patch("toString",e=>{const t=Function.prototype.toString,n=d("OriginalDelegate"),o=d("Promise"),r=d("Error"),a=function(){if("function"==typeof this){const a=this[n];if(a)return"function"==typeof a?t.call(a):Object.prototype.toString.call(a);if(this===Promise){const n=e[o];if(n)return t.call(n)}if(this===Error){const n=e[r];if(n)return t.call(n)}}return t.call(this)};a[n]=t,Function.prototype.toString=a;const i=Object.prototype.toString;Object.prototype.toString=function(){return this instanceof Promise?"[object Promise]":i.call(this)}});let j=!1;if("undefined"!=typeof window)try{const e=Object.defineProperty({},"passive",{get:function(){j=!0}});window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(he){j=!1}const R={useG:!0},x={},F={},V=new RegExp("^"+h+"(\\w+)(true|false)$"),U=d("propagationStopped");function q(e,t){const n=(t?t(e):e)+u,o=(t?t(e):e)+l,r=h+n,a=h+o;x[e]={},x[e].false=r,x[e].true=a}function B(e,t,o){const r=o&&o.add||a,s=o&&o.rm||i,c=o&&o.listeners||"eventListeners",p=o&&o.rmAll||"removeAllListeners",f=d(r),m="."+r+":",g=function(e,t,n){if(e.isRemoved)return;const o=e.callback;"object"==typeof o&&o.handleEvent&&(e.callback=e=>o.handleEvent(e),e.originalDelegate=o),e.invoke(e,t,[n]);const r=e.options;r&&"object"==typeof r&&r.once&&t[s].call(t,n.type,e.originalDelegate?e.originalDelegate:e.callback,r)},y=function(t){if(!(t=t||e.event))return;const n=this||t.target||e,o=n[x[t.type].false];if(o)if(1===o.length)g(o[0],n,t);else{const e=o.slice();for(let o=0;o<e.length&&(!t||!0!==t[U]);o++)g(e[o],n,t)}},T=function(t){if(!(t=t||e.event))return;const n=this||t.target||e,o=n[x[t.type].true];if(o)if(1===o.length)g(o[0],n,t);else{const e=o.slice();for(let o=0;o<e.length&&(!t||!0!==t[U]);o++)g(e[o],n,t)}};function v(t,o){if(!t)return!1;let a=!0;o&&void 0!==o.useG&&(a=o.useG);const i=o&&o.vh;let g=!0;o&&void 0!==o.chkDup&&(g=o.chkDup);let v=!1;o&&void 0!==o.rt&&(v=o.rt);let _=t;for(;_&&!_.hasOwnProperty(r);)_=n(_);if(!_&&t[r]&&(_=t),!_)return!1;if(_[f])return!1;const k=o&&o.eventNameToString,E={},w=_[f]=_[r],M=_[d(s)]=_[s],L=_[d(c)]=_[c],C=_[d(p)]=_[p];let S;function O(e,t){return!j&&"object"==typeof e&&e?!!e.capture:j&&t?"boolean"==typeof e?{capture:e,passive:!0}:e?"object"==typeof e&&!1!==e.passive?Object.assign(Object.assign({},e),{passive:!0}):e:{passive:!0}:e}o&&o.prepend&&(S=_[d(o.prepend)]=_[o.prepend]);const D=a?function(e){if(!E.isExisting)return w.call(E.target,E.eventName,E.capture?T:y,E.options)}:function(e){return w.call(E.target,E.eventName,e.invoke,E.options)},H=a?function(e){if(!e.isRemoved){const t=x[e.eventName];let n;t&&(n=t[e.capture?l:u]);const o=n&&e.target[n];if(o)for(let r=0;r<o.length;r++)if(o[r]===e){o.splice(r,1),e.isRemoved=!0,0===o.length&&(e.allRemoved=!0,e.target[n]=null);break}}if(e.allRemoved)return M.call(e.target,e.eventName,e.capture?T:y,e.options)}:function(e){return M.call(e.target,e.eventName,e.invoke,e.options)},Z=o&&o.diff?o.diff:function(e,t){const n=typeof t;return"function"===n&&e.callback===t||"object"===n&&e.originalDelegate===t},N=Zone[d("BLACK_LISTED_EVENTS")],z=e[d("PASSIVE_EVENTS")],A=function(t,n,r,s,c=!1,h=!1){return function(){const p=this||e;let f=arguments[0];o&&o.transferEventName&&(f=o.transferEventName(f));let d=arguments[1];if(!d)return t.apply(this,arguments);if(b&&"uncaughtException"===f)return t.apply(this,arguments);let m=!1;if("function"!=typeof d){if(!d.handleEvent)return t.apply(this,arguments);m=!0}if(i&&!i(t,d,p,arguments))return;const y=j&&!!z&&-1!==z.indexOf(f),T=O(arguments[2],y);if(N)for(let e=0;e<N.length;e++)if(f===N[e])return y?t.call(p,f,d,T):t.apply(this,arguments);const v=!!T&&("boolean"==typeof T||T.capture),_=!(!T||"object"!=typeof T)&&T.once,w=Zone.current;let M=x[f];M||(q(f,k),M=x[f]);const L=M[v?l:u];let C,S=p[L],D=!1;if(S){if(D=!0,g)for(let e=0;e<S.length;e++)if(Z(S[e],d))return}else S=p[L]=[];const H=p.constructor.name,P=F[H];P&&(C=P[f]),C||(C=H+n+(k?k(f):f)),E.options=T,_&&(E.options.once=!1),E.target=p,E.capture=v,E.eventName=f,
vendor: 4,261 bytes, line 5564
5564E.isExisting=D;const A=a?R:void 0;A&&(A.taskData=E);const I=w.scheduleEventTask(C,d,A,r,s);return E.target=null,A&&(A.taskData=null),_&&(T.once=!0),(j||"boolean"!=typeof I.options)&&(I.options=T),I.target=p,I.capture=v,I.eventName=f,m&&(I.originalDelegate=d),h?S.unshift(I):S.push(I),c?p:void 0}};return _[r]=A(w,m,D,H,v),S&&(_.prependListener=A(S,".prependListener:",function(e){return S.call(E.target,E.eventName,e.invoke,E.options)},H,v,!0)),_[s]=function(){const t=this||e;let n=arguments[0];o&&o.transferEventName&&(n=o.transferEventName(n));const r=arguments[2],a=!!r&&("boolean"==typeof r||r.capture),s=arguments[1];if(!s)return M.apply(this,arguments);if(i&&!i(M,s,t,arguments))return;const c=x[n];let p;c&&(p=c[a?l:u]);const f=p&&t[p];if(f)for(let e=0;e<f.length;e++){const o=f[e];if(Z(o,s))return f.splice(e,1),o.isRemoved=!0,0===f.length&&(o.allRemoved=!0,t[p]=null,"string"==typeof n)&&(t[h+"ON_PROPERTY"+n]=null),o.zone.cancelTask(o),v?t:void 0}return M.apply(this,arguments)},_[c]=function(){const t=this||e;let n=arguments[0];o&&o.transferEventName&&(n=o.transferEventName(n));const r=[],a=G(t,k?k(n):n);for(let e=0;e<a.length;e++){const t=a[e];r.push(t.originalDelegate?t.originalDelegate:t.callback)}return r},_[p]=function(){const t=this||e;let n=arguments[0];if(n){o&&o.transferEventName&&(n=o.transferEventName(n));const e=x[n];if(e){const o=t[e.false],r=t[e.true];if(o){const e=o.slice();for(let t=0;t<e.length;t++){const o=e[t];this[s].call(this,n,o.originalDelegate?o.originalDelegate:o.callback,o.options)}}if(r){const e=r.slice();for(let t=0;t<e.length;t++){const o=e[t];this[s].call(this,n,o.originalDelegate?o.originalDelegate:o.callback,o.options)}}}}else{const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=V.exec(e[t]);let o=n&&n[1];o&&"removeListener"!==o&&this[p].call(this,o)}this[p].call(this,"removeListener")}if(v)return this},P(_[r],w),P(_[s],M),C&&P(_[p],C),L&&P(_[c],L),!0}let _=[];for(let n=0;n<t.length;n++)_[n]=v(t[n],o);return _}function G(e,t){if(!t){const n=[];for(let o in e){const r=V.exec(o);let a=r&&r[1];if(a&&(!t||a===t)){const t=e[o];if(t)for(let e=0;e<t.length;e++)n.push(t[e])}}return n}let n=x[t];n||(q(t),n=x[t]);const o=e[n.false],r=e[n.true];return o?r?o.concat(r):o.slice():r?r.slice():[]}function W(e,t){const n=e.Event;n&&n.prototype&&t.patchMethod(n.prototype,"stopImmediatePropagation",e=>function(t,n){t[U]=!0,e&&e.apply(t,n)})}function X(e,t,n,o,r){const a=Zone.__symbol__(o);if(t[a])return;const i=t[a]=t[o];t[o]=function(a,s,c){return s&&s.prototype&&r.forEach(function(t){const r=`${n}.${o}::`+t,a=s.prototype;if(a.hasOwnProperty(t)){const n=e.ObjectGetOwnPropertyDescriptor(a,t);n&&n.value?(n.value=e.wrapWithCurrentZone(n.value,r),e._redefineProperty(s.prototype,t,n)):a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],r))}else a[t]&&(a[t]=e.wrapWithCurrentZone(a[t],r))}),i.call(t,a,s,c)},e.attachOriginToPatched(t[o],i)}const $=["absolutedeviceorientation","afterinput","afterprint","appinstalled","beforeinstallprompt","beforeprint","beforeunload","devicelight","devicemotion","deviceorientation","deviceorientationabsolute","deviceproximity","hashchange","languagechange","message","mozbeforepaint","offline","online","paint","pageshow","pagehide","popstate","rejectionhandled","storage","unhandledrejection","unload","userproximity","vrdisplayconnected","vrdisplaydisconnected","vrdisplaypresentchange"],K=["encrypted","waitingforkey","msneedkey","mozinterruptbegin","mozinterruptend"],Y=["load"],J=["blur","error","focus","load","resize","scroll","messageerror"],Q=["bounce","finish","start"],ee=["loadstart","progress","abort","error","load","progress","timeout","loadend","readystatechange"],te=["upgradeneeded","complete","abort","success","error","blocked","versionchange","close"],ne=["close","error","open","message"],oe=["error","message"],re=["abort","animationcancel","animationend","animationiteration","auxclick","beforeinput","blur","cancel","canplay","canplaythrough","change","compositionstart","compositionupdate","compositionend","cuechange","click","close","contextmenu","curechange","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","drop","durationchange","emptied","ended","error","focus","focusin","focusout","gotpointercapture","input","invali
5564d","keydown","keypress","keyup","load","loadstart","loadeddata","loadedmetadata","lostpointercapture","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","mousewheel","orientationchange","pause","play","playing","pointercancel","pointerdown","pointerenter","pointerleave","pointerlockchange","mozpointerlockchange","webkitpointerlockerchange","pointerlockerror","mozpointerlockerror","webkitpointerlockerror","pointermove","pointout","pointerover","pointerup","progress","ratechange","reset","resize","scroll","seeked","seeking","select","selectionchange","selectstart","show","sort","stalled","submit","suspend","timeupdate","volumechange","touchcancel","touchmove","touchstart","touchend","transitioncancel","transitionend","waiting","wheel"].concat(["webglcontextrestored","webglcontextlost","webglcontextcreationerror"],["autocomplete","autocompleteerror"],["toggle"],["afterscriptexecute","beforescriptexecute","DOMContentLoaded","freeze","fullscreenchange","mozfullscreenchange","webkitfullscreenchange","msfullscreenchange","fullscreenerror","mozfullscreenerror","webkitfullscreenerror","msfullscreenerror","readystatechange","visibilitychange","resume"],$,["beforecopy","beforecut","beforepaste","copy","cut","paste","dragstart","loadend","animationstart","search","transitionrun","transitionstart","webkitanimationend","webkitanimationiteration","webkitanimationstart","webkittransitionend"],["activate","afterupdate","ariarequest","beforeactivate","beforedeactivate","beforeeditfocus","beforeupdate","cellchange","controlselect","dataavailable","datasetchanged","datasetcomplete","errorupdate","filterchange","layoutcomplete","losecapture","move","moveend","movestart","propertychange","resizeend","resizestart","rowenter","rowexit","rowsdelete","rowsinserted","command","compassneedscalibration","deactivate","help","mscontentzoom","msmanipulationstatechanged","msgesturechange","msgesturedoubletap","msgestureend","msgesturehold","msgesturestart","msgesturetap","msgotpointercapture","msinertiastart","mslostpointercapture","mspointercancel","mspointerdown","mspointerenter","mspointerhover","mspointerleave","mspointermove","mspointerout","mspointerover","mspointerup","pointerout","mssitemodejumplistitemremoved","msthumbnailclick","stop","storagecommit"]);function ae(e,t,n){if(!n||0===n.length)return t;const o=n.filter(t=>t.target===e);if(!o||0===o.length)return t;const r=o[0].ignoreProperties;return t.filter(e=>-1===r.indexOf(e))}function ie(e,t,n,o){e&&S(e,ae(e,t,n),o)}function se(e,t){if(b&&!w)return;if(Zone[e.symbol("patchEvents")])return;const o="undefined"!=typeof WebSocket,r=t.__Zone_ignore_on_properties;if(E){const e=window,t=A?[{target:e,ignoreProperties:["error"]}]:[];ie(e,re.concat(["messageerror"]),r?r.concat(t):r,n(e)),ie(Document.prototype,re,r),void 0!==e.SVGElement&&ie(e.SVGElement.prototype,re,r),ie(Element.prototype,re,r),ie(HTMLElement.prototype,re,r),ie(HTMLMediaElement.prototype,K,r),ie(HTMLFrameSetElement.prototype,$.concat(J),r),ie(HTMLBodyElement.prototype,$.concat(J),r),ie(HTMLFrameElement.prototype,Y,r),ie(HTMLIFrameElement.prototype,Y,r);const o=e.HTMLMarqueeElement;o&&ie(o.prototype,Q,r);const a=e.Worker;a&&ie(a.prototype,oe,r)}const a=t.XMLHttpRequest;a&&ie(a.prototype,ee,r);const i=t.XMLHttpRequestEventTarget;i&&ie(i&&i.prototype,ee,r),"undefined"!=typeof IDBIndex&&(ie(IDBIndex.prototype,te,r),ie(IDBRequest.prototype,te,r),ie(IDBOpenDBRequest.prototype,te,r),ie(IDBDatabase.prototype,te,r),ie(IDBTransaction.prototype,te,r),ie(IDBCursor.prototype,te,r)),o&&ie(WebSocket.prototype,ne,r)}Zone.__load_patch("util",(n,s,c)=>{c.patchOnProperties=S,c.patchMethod=H,c.bindArguments=v,c.patchMacroTask=Z;const f=s.__symbol__("BLACK_LISTED_EVENTS"),d=s.__symbol__("UNPATCHED_EVENTS");n[d]&&(n[f]=n[d]),n[f]&&(s[f]=s[d]=n[f]),c.patchEventPrototype=W,c.patchEventTarget=B,c.isIEOrEdge=I,c.ObjectDefineProperty=t,c.ObjectGetOwnPropertyDescriptor=e,c.ObjectCreate=o,c.ArraySlice=r,c.patchClass=D,c.wrapWithCurrentZone=p,c.filterProperties=ae,c.attachOriginToPatched=P,c._redefineProperty=Object.defineProperty,c.patchCallbacks=X,c.getGlobalObjects=()=>({globalSources:F,zoneSymbolEventNames:x,eventNames:re,isBrowser:E,isMix:w,isNode:b,TRUE_STR:l,FALSE_STR:u,ZONE_SYMBOL_PREFIX:h,ADD_EVENT_LISTENER_STR:a,REMOVE_EVENT_LISTENER_STR:i})});const ce=d("zoneTask");function le(e,t,n,o){let r=null,a=null;n+=o;const i={};function s(t){const n=t.data;return n.args[0]=function(){try{t.invoke.apply(this,arguments)}finally{t.data&&t.data.isPeriodic||("number"==typeof n.handleId?delete i[n.handleId]:n.handleId&&(n.handleId[ce]=null))}},n.handleId=r.apply(e,n.args),t}function c(e){return a(e.data.handleId)}r=H(e,t+=o,n=>
vendor: 4,096 bytes, line 5564
5564function(r,a){if("function"==typeof a[0]){const e=f(t,a[0],{isPeriodic:"Interval"===o,delay:"Timeout"===o||"Interval"===o?a[1]||0:void 0,args:a},s,c);if(!e)return e;const n=e.data.handleId;return"number"==typeof n?i[n]=e:n&&(n[ce]=e),n&&n.ref&&n.unref&&"function"==typeof n.ref&&"function"==typeof n.unref&&(e.ref=n.ref.bind(n),e.unref=n.unref.bind(n)),"number"==typeof n||n?n:e}return n.apply(e,a)}),a=H(e,n,t=>function(n,o){const r=o[0];let a;"number"==typeof r?a=i[r]:(a=r&&r[ce],a||(a=r)),a&&"string"==typeof a.type?"notScheduled"!==a.state&&(a.cancelFn&&a.data.isPeriodic||0===a.runCount)&&("number"==typeof r?delete i[r]:r&&(r[ce]=null),a.zone.cancelTask(a)):t.apply(e,o)})}function ue(e,t){if(Zone[t.symbol("patchEventTarget")])return;const{eventNames:n,zoneSymbolEventNames:o,TRUE_STR:r,FALSE_STR:a,ZONE_SYMBOL_PREFIX:i}=t.getGlobalObjects();for(let c=0;c<n.length;c++){const e=n[c],t=i+(e+a),s=i+(e+r);o[e]={},o[e][a]=t,o[e][r]=s}const s=e.EventTarget;return s&&s.prototype?(t.patchEventTarget(e,[s&&s.prototype]),!0):void 0}Zone.__load_patch("legacy",e=>{const t=e[Zone.__symbol__("legacyPatch")];t&&t()}),Zone.__load_patch("timers",e=>{const t="set",n="clear";le(e,t,n,"Timeout"),le(e,t,n,"Interval"),le(e,t,n,"Immediate")}),Zone.__load_patch("requestAnimationFrame",e=>{le(e,"request","cancel","AnimationFrame"),le(e,"mozRequest","mozCancel","AnimationFrame"),le(e,"webkitRequest","webkitCancel","AnimationFrame")}),Zone.__load_patch("blocking",(e,t)=>{const n=["alert","prompt","confirm"];for(let o=0;o<n.length;o++)H(e,n[o],(n,o,r)=>function(o,a){return t.current.run(n,e,a,r)})}),Zone.__load_patch("EventTarget",(e,t,n)=>{(function(e,t){t.patchEventPrototype(e,t)})(e,n),ue(e,n);const o=e.XMLHttpRequestEventTarget;o&&o.prototype&&n.patchEventTarget(e,[o.prototype]),D("MutationObserver"),D("WebKitMutationObserver"),D("IntersectionObserver"),D("FileReader")}),Zone.__load_patch("on_property",(e,t,n)=>{se(n,e)}),Zone.__load_patch("customElements",(e,t,n)=>{!function(e,t){const{isBrowser:n,isMix:o}=t.getGlobalObjects();(n||o)&&e.customElements&&"customElements"in e&&t.patchCallbacks(t,e.customElements,"customElements","define",["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback"])}(e,n)}),Zone.__load_patch("XHR",(e,t)=>{!function(e){const u=e.XMLHttpRequest;if(!u)return;const h=u.prototype;let p=h[s],m=h[c];if(!p){const t=e.XMLHttpRequestEventTarget;if(t){const e=t.prototype;p=e[s],m=e[c]}}const g="readystatechange",y="scheduled";function T(e){const o=e.data,i=o.target;i[a]=!1,i[l]=!1;const u=i[r];p||(p=i[s],m=i[c]),u&&m.call(i,g,u);const h=i[r]=()=>{if(i.readyState===i.DONE)if(!o.aborted&&i[a]&&e.state===y){const n=i[t.__symbol__("loadfalse")];if(n&&n.length>0){const r=e.invoke;e.invoke=function(){const n=i[t.__symbol__("loadfalse")];for(let t=0;t<n.length;t++)n[t]===e&&n.splice(t,1);o.aborted||e.state!==y||r.call(e)},n.push(e)}else e.invoke()}else o.aborted||!1!==i[a]||(i[l]=!0)};return p.call(i,g,h),i[n]||(i[n]=e),w.apply(i,o.args),i[a]=!0,e}function v(){}function _(e){const t=e.data;return t.aborted=!0,M.apply(t.target,t.args)}const k=H(h,"open",()=>function(e,t){return e[o]=0==t[2],e[i]=t[1],k.apply(e,t)}),b=d("fetchTaskAborting"),E=d("fetchTaskScheduling"),w=H(h,"send",()=>function(e,n){if(!0===t.current[E])return w.apply(e,n);if(e[o])return w.apply(e,n);{const t={target:e,url:e[i],isPeriodic:!1,args:n,aborted:!1},o=f("XMLHttpRequest.send",v,t,T,_);e&&!0===e[l]&&!t.aborted&&o.state===y&&o.invoke()}}),M=H(h,"abort",()=>function(e,o){const r=e[n];if(r&&"string"==typeof r.type){if(null==r.cancelFn||r.data&&r.data.aborted)return;r.zone.cancelTask(r)}else if(!0===t.current[b])return M.apply(e,o)})}(e);const n=d("xhrTask"),o=d("xhrSync"),r=d("xhrListener"),a=d("xhrScheduled"),i=d("xhrURL"),l=d("xhrErrorBeforeScheduled")}),Zone.__load_patch("geolocation",t=>{t.navigator&&t.navigator.geolocation&&function(t,n){const o=t.constructor.name;for(let r=0;r<n.length;r++){const a=n[r],i=t[a];if(i){if(!_(e(t,a)))continue;t[a]=(e=>{const t=function(){return e.apply(this,v(arguments,o+"."+a))};return P(t,e),t})(i)}}}
vendor: 5,253 bytes, line 5564
5564(t.navigator.geolocation,["getCurrentPosition","watchPosition"])}),Zone.__load_patch("PromiseRejectionEvent",(e,t)=>{function n(t){return function(n){G(e,t).forEach(o=>{const r=e.PromiseRejectionEvent;if(r){const e=new r(t,{promise:n.promise,reason:n.rejection});o.invoke(e)}})}}e.PromiseRejectionEvent&&(t[d("unhandledPromiseRejectionHandler")]=n("unhandledrejection"),t[d("rejectionHandledHandler")]=n("rejectionhandled"))})})?o.call(t,n,t,e):o)||(e.exports=r)}});!function(t){var e={};function n(r){if(e[r])return e[r].exports;var s=e[r]={i:r,l:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}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 s in t)n.d(r,s,(function(e){return t[e]}).bind(null,s));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=0)}({0:function(t,e,n){t.exports=n("7rdI")},"7rdI":function(t,e,n){"use strict";function r(t){return"function"==typeof t}n.r(e);let s=!1;const i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){if(t){const t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else s&&console.log("RxJS: Back to a better error behavior. Thank you. <3");s=t},get useDeprecatedSynchronousErrorHandling(){return s}};function o(t){setTimeout(()=>{throw t},0)}const l={closed:!0,next(t){},error(t){if(i.useDeprecatedSynchronousErrorHandling)throw t;o(t)},complete(){}},a=(()=>Array.isArray||(t=>t&&"number"==typeof t.length))();function u(t){return null!==t&&"object"==typeof t}const c=(()=>{function t(t){return Error.call(this),this.message=t?`${t.length} errors occurred during unsubscription:\n${t.map((t,e)=>`${e+1}) ${t.toString()}`).join("\n ")}`:"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t})();let h=(()=>{class t{constructor(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}unsubscribe(){let e;if(this.closed)return;let{_parentOrParents:n,_ctorUnsubscribe:s,_unsubscribe:i,_subscriptions:o}=this;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(let t=0;t<n.length;++t)n[t].remove(this);if(r(i)){s&&(this._unsubscribe=void 0);try{i.call(this)}catch(l){e=l instanceof c?d(l.errors):[l]}}if(a(o)){let t=-1,n=o.length;for(;++t<n;){const n=o[t];if(u(n))try{n.unsubscribe()}catch(l){e=e||[],l instanceof c?e=e.concat(d(l.errors)):e.push(l)}}}if(e)throw new c(e)}add(e){let n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){const e=n;n=new t,n._subscriptions=[e]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}let{_parentOrParents:r}=n;if(null===r)n._parentOrParents=this;else if(r instanceof t){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}const s=this._subscriptions;return null===s?this._subscriptions=[n]:s.push(n),n}remove(t){const e=this._subscriptions;if(e){const n=e.indexOf(t);-1!==n&&e.splice(n,1)}}}var e;return t.EMPTY=((e=new t).closed=!0,e),t})();function d(t){return t.reduce((t,e)=>t.concat(e instanceof c?e.errors:e),[])}const f=(()=>"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random())();class p extends h{constructor(t,e,n){switch(super(),this.syncErrorValue=null,this.syncErrorThrown=!1,this.syncErrorThrowable=!1,this.isStopped=!1,arguments.length){case 0:this.destination=l;break;case 1:if(!t){this.destination=l;break}if("object"==typeof t){t instanceof p?(this.syncErrorThrowable=t.syncErrorThrowable,this.destination=t,t.add(this)):(this.syncErrorThrowable=!0,this.destination=new g(this,t));break}default:this.syncErrorThrowable=!0,this.destination=new g(this,t,e,n)}}[f](){return this}static create(t,e,n){const r=new p(t,e,n);return r.syncErrorThrowable=!1,r}next(t){this.isStopped||this._next(t)}error(t){this.isStopped||(this.isStopped=!0,this._error(t))}complete(){this.isStopped||(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe())}_next(t){this.destination.next(t)}_error(t){this.destination.error(t),this.unsubscribe()}_complete(){this.destination.complete(),this.unsubscribe()}_unsubscribeAndRecycle(){const{_parentOrParents:t}=this;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this}}class g extends p{constructor(t,e,n,s){let i;super(),this._parentSubscriber=t;let o=this;
vendor: 80,525 bytes, line 5564
5564r(e)?i=e:e&&(i=e.next,n=e.error,s=e.complete,e!==l&&(o=Object.create(e),r(o.unsubscribe)&&this.add(o.unsubscribe.bind(o)),o.unsubscribe=this.unsubscribe.bind(this))),this._context=o,this._next=i,this._error=n,this._complete=s}next(t){if(!this.isStopped&&this._next){const{_parentSubscriber:e}=this;i.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}}error(t){if(!this.isStopped){const{_parentSubscriber:e}=this,{useDeprecatedSynchronousErrorHandling:n}=i;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):o(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;o(t)}}}complete(){if(!this.isStopped){const{_parentSubscriber:t}=this;if(this._complete){const e=()=>this._complete.call(this._context);i.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}}__tryOrUnsub(t,e){try{t.call(this._context,e)}catch(n){if(this.unsubscribe(),i.useDeprecatedSynchronousErrorHandling)throw n;o(n)}}__tryOrSetError(t,e,n){if(!i.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(r){return i.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(o(r),!0)}return!1}_unsubscribe(){const{_parentSubscriber:t}=this;this._context=null,this._parentSubscriber=null,t.unsubscribe()}}const _=(()=>"function"==typeof Symbol&&Symbol.observable||"@@observable")();function m(t){return t}let y=(()=>{class t{constructor(t){this._isScalar=!1,t&&(this._subscribe=t)}lift(e){const n=new t;return n.source=this,n.operator=e,n}subscribe(t,e,n){const{operator:r}=this,s=function(t,e,n){if(t){if(t instanceof p)return t;if(t[f])return t[f]()}return t||e||n?new p(t,e,n):new p(l)}(t,e,n);if(s.add(r?r.call(s,this.source):this.source||i.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),i.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s}_trySubscribe(t){try{return this._subscribe(t)}catch(e){i.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),function(t){for(;t;){const{closed:e,destination:n,isStopped:r}=t;if(e||r)return!1;t=n&&n instanceof p?n:null}return!0}(t)?t.error(e):console.warn(e)}}forEach(t,e){return new(e=v(e))((e,n)=>{let r;r=this.subscribe(e=>{try{t(e)}catch(s){n(s),r&&r.unsubscribe()}},n,e)})}_subscribe(t){const{source:e}=this;return e&&e.subscribe(t)}[_](){return this}pipe(...t){return 0===t.length?this:(0===(e=t).length?m:1===e.length?e[0]:function(t){return e.reduce((t,e)=>e(t),t)})(this);var e}toPromise(t){return new(t=v(t))((t,e)=>{let n;this.subscribe(t=>n=t,t=>e(t),()=>t(n))})}}return t.create=e=>new t(e),t})();function v(t){if(t||(t=i.Promise||Promise),!t)throw new Error("no Promise impl found");return t}const w=(()=>{function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t})();class b extends h{constructor(t,e){super(),this.subject=t,this.subscriber=e,this.closed=!1}unsubscribe(){if(this.closed)return;this.closed=!0;const t=this.subject,e=t.observers;if(this.subject=null,!e||0===e.length||t.isStopped||t.closed)return;const n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}class C extends p{constructor(t){super(t),this.destination=t}}let x=(()=>{class t extends y{constructor(){super(),this.observers=[],this.closed=!1,this.isStopped=!1,this.hasError=!1,this.thrownError=null}[f](){return new C(this)}lift(t){const e=new E(this,this);return e.operator=t,e}next(t){if(this.closed)throw new w;if(!this.isStopped){const{observers:e}=this,n=e.length,r=e.slice();for(let s=0;s<n;s++)r[s].next(t)}}error(t){if(this.closed)throw new w;this.hasError=!0,this.thrownError=t,this.isStopped=!0;const{observers:e}=this,n=e.length,r=e.slice();for(let s=0;s<n;s++)r[s].error(t);this.observers.length=0}complete(){if(this.closed)throw new w;this.isStopped=!0;const{observers:t}=this,e=t.length,n=t.slice();for(let r=0;r<e;r++)n[r].complete();this.observers.length=0}unsubscribe(){this.isStopped=!0,this.closed=!0,this.observers=null}_trySubscribe(t){if(this.closed)throw new w;return super._trySubscribe(t)}_subscribe(t){if(this.closed)throw new w;return this.hasError?(t.error(this.thrownError),h.EMPTY):this.isStopped?(t.complete(),h.EMPTY):(this.observers.push(t),new b(this,t))}asObservable(){const t=new y;return t.source=this,t}}return t.create=(t,e)=>new E(t,e),t})();class E extends x{constructor(t,e){super(),this.destination=t,this.source=e}next(t){const{destination:e}=this;e&&e.next&&e.next(t)}error(t){const{destination:e}=this;e&&e.error&&this.destination.error(t)}complete(){const{destination:t}=this;t&&t.complete&&this.destination.complete()}_subscribe(t){const{source:e}=this;return e?this.source.subscribe(t):h.EMPTY}}function S(t){return t&&"function"==typeof t.schedule}function k(t,e){return function(n){if("function"!=typeof t)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return n.lift(new A(t,e))}}class A{constructor(t,e){this.project=t,this.thisArg=e}call(t,e){return e.subscribe(new T(t,this.project,this.thisArg))}}class T extends p{constructor(t,e,n){super(t),this.project=e,this.count=0,this.thisArg=n||this}_next(t){let e;try{e=this.project.call(this.thisArg,t,this.count++)}catch(n){return void this.destination.error(n)}this.destination.next(e)}}const I=t=>e=>{for(let n=0,r=t.length;n<r&&!e.closed;n++)e.next(t[n]);e.complete()};function V(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}const O=V(),M=t=>t&&"number"==typeof t.length&&"function"!=typeof t;function D(t){return!!t&&"function"!=typeof t.subscribe&&"function"==typeof t.then}const N=t=>{if(t&&"function"==typeof t[_])return r=t,t=>{const e=r[_]();if("function"!=typeof e.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return e.subscribe(t)};if(M(t))return I(t);if(D(t))return n=t,t=>(n.then(e=>{t.closed||(t.next(e),t.complete())},e=>t.error(e)).then(null,o),t);if(t&&"function"==typeof t[O])return e=t,t=>{const n=e[O]();for(;;){let e;try{e=n.next()}catch(r){return t.error(r),t}if(e.done){t.complete();break}if(t.next(e.value),t.closed)break}return"function"==typeof n.return&&t.add(()=>{n.return&&n.return()}),t};{const e=u(t)?"an invalid object":`'${t}'`;throw new TypeError(`You provided ${e} where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.`)}var e,n,r};function P(t,e){return new y(n=>{const r=new h;let s=0;return r.add(e.schedule(function(){s!==t.length?(n.next(t[s++]),n.closed||r.add(this.schedule())):n.complete()})),r})}function R(t,e){return e?function(t,e){if(null!=t){if(function(t){return t&&"function"==typeof t[_]}(t))return function(t,e){return new y(n=>{const r=new h;return r.add(e.schedule(()=>{const s=t[_]();r.add(s.subscribe({next(t){r.add(e.schedule(()=>n.next(t)))},error(t){r.add(e.schedule(()=>n.error(t)))},complete(){r.add(e.schedule(()=>n.complete()))}}))})),r})}(t,e);if(D(t))return function(t,e){return new y(n=>{const r=new h;return r.add(e.schedule(()=>t.then(t=>{r.add(e.schedule(()=>{n.next(t),r.add(e.schedule(()=>n.complete()))}))},t=>{r.add(e.schedule(()=>n.error(t)))}))),r})}(t,e);if(M(t))return P(t,e);if(function(t){return t&&"function"==typeof t[O]}(t)||"string"==typeof t)return function(t,e){if(!t)throw new Error("Iterable cannot be null");return new y(n=>{const r=new h;let s;return r.add(()=>{s&&"function"==typeof s.return&&s.return()}),r.add(e.schedule(()=>{s=t[O](),r.add(e.schedule(function(){if(n.closed)return;let t,e;try{const n=s.next();t=n.value,e=n.done}catch(r){return void n.error(r)}e?n.complete():(n.next(t),this.schedule())}))})),r})}(t,e)}throw new TypeError((null!==t&&typeof t||t)+" is not observable")}(t,e):t instanceof y?t:new y(N(t))}class j extends p{constructor(t){super(),this.parent=t}_next(t){this.parent.notifyNext(t)}_error(t){this.parent.notifyError(t),this.unsubscribe()}_complete(){this.parent.notifyComplete(),this.unsubscribe()}}class F extends p{notifyNext(t){this.destination.next(t)}notifyError(t){this.destination.error(t)}notifyComplete(){this.destination.complete()}}function H(t,e){if(!e.closed)return t instanceof y?t.subscribe(e):N(t)(e)}function z(t,e,n=Number.POSITIVE_INFINITY){return"function"==typeof e?r=>r.pipe(z((n,r)=>R(t(n,r)).pipe(k((t,s)=>e(n,t,r,s))),n)):("number"==typeof e&&(n=e),e=>e.lift(new L(t,n)))}class L{constructor(t,e=Number.POSITIVE_INFINITY){this.project=t,this.concurrent=e}call(t,e){return e.subscribe(new B(t,this.project,this.concurrent))}}class B extends F{constructor(t,e,n=Number.POSITIVE_INFINITY){super(t),this.project=e,this.concurrent=n,this.hasCompleted=!1,this.buffer=[],this.active=0,this.index=0}_next(t){this.active<this.concurrent?this._tryNext(t):this.buffer.push(t)}_tryNext(t){let e;const n=this.index++;try{e=this.project(t,n)}catch(r){return void this.destination.error(r)}this.active++,this._innerSub(e)}_innerSub(t){const e=new j(this),n=this.destination;n.add(e);const r=H(t,e);r!==e&&n.add(r)}_complete(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()}notifyNext(t){this.destination.next(t)}notifyComplete(){const t=this.buffer;this.active--,t.length>0?this._next(t.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()}}function W(t=Number.POSITIVE_INFINITY){return z(m,t)}function $(t,e){return e?P(t,e):new y(I(t))}function Z(...t){let e=Number.POSITIVE_INFINITY,n=null,r=t[t.length-1];return S(r)?(n=t.pop(),t.length>1&&"number"==typeof t[t.length-1]&&(e=t.pop())):"number"==typeof r&&(e=t.pop()),null===n&&1===t.length&&t[0]instanceof y?t[0]:W(e)($(t,n))}function U(){return function(t){return t.lift(new q(t))}}class q{constructor(t){this.connectable=t}call(t,e){const{connectable:n}=this;n._refCount++;const r=new G(t,n),s=e.subscribe(r);return r.closed||(r.connection=n.connect()),s}}class G extends p{constructor(t,e){super(t),this.connectable=e}_unsubscribe(){const{connectable:t}=this;if(!t)return void(this.connection=null);this.connectable=null;const e=t._refCount;if(e<=0)return void(this.connection=null);if(t._refCount=e-1,e>1)return void(this.connection=null);const{connection:n}=this,r=t._connection;this.connection=null,!r||n&&r!==n||r.unsubscribe()}}class Q extends y{constructor(t,e){super(),this.source=t,this.subjectFactory=e,this._refCount=0,this._isComplete=!1}_subscribe(t){return this.getSubject().subscribe(t)}getSubject(){const t=this._subject;return t&&!t.isStopped||(this._subject=this.subjectFactory()),this._subject}connect(){let t=this._connection;return t||(this._isComplete=!1,t=this._connection=new h,t.add(this.source.subscribe(new K(this.getSubject(),this))),t.closed&&(this._connection=null,t=h.EMPTY)),t}refCount(){return U()(this)}}const Y=(()=>{const t=Q.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:t._subscribe},_isComplete:{value:t._isComplete,writable:!0},getSubject:{value:t.getSubject},connect:{value:t.connect},refCount:{value:t.refCount}}})();class K extends C{constructor(t,e){super(t),this.connectable=e}_error(t){this._unsubscribe(),super._error(t)}_complete(){this.connectable._isComplete=!0,this._unsubscribe(),super._complete()}_unsubscribe(){const t=this.connectable;if(t){this.connectable=null;const e=t._connection;t._refCount=0,t._subject=null,t._connection=null,e&&e.unsubscribe()}}}function X(){return new x}function J(t){for(let e in t)if(t[e]===J)return e;throw Error("Could not find renamed property on target object.")}function tt(t,e){for(const n in e)e.hasOwnProperty(n)&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function et(t){if("string"==typeof t)return t;if(Array.isArray(t))return"["+t.map(et).join(", ")+"]";if(null==t)return""+t;if(t.overriddenName)return`${t.overriddenName}`;if(t.name)return`${t.name}`;const e=t.toString();if(null==e)return""+e;const n=e.indexOf("\n");return-1===n?e:e.substring(0,n)}function nt(t,e){return null==t||""===t?null===e?"":e:null==e||""===e?t:t+" "+e}const rt=J({__forward_ref__:J});function st(t){return t.__forward_ref__=st,t.toString=function(){return et(this())},t}function it(t){return ot(t)?t():t}function ot(t){return"function"==typeof t&&t.hasOwnProperty(rt)&&t.__forward_ref__===st}class lt extends Error{constructor(t,e){super(function(t,e){return`${t?`NG0${t}: `:""}${e}`}(t,e)),this.code=t}}function at(t){return"string"==typeof t?t:null==t?"":String(t)}function ut(t){return"function"==typeof t?t.name||t.toString():"object"==typeof t&&null!=t&&"function"==typeof t.type?t.type.name||t.type.toString():at(t)}function ct(t,e){const n=e?` in ${e}`:"";throw new lt("201",`No provider for ${ut(t)} found${n}`)}function ht(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function dt(t){return{factory:t.factory,providers:t.providers||[],imports:t.imports||[]}}function ft(t){return pt(t,_t)||pt(t,yt)}function pt(t,e){return t.hasOwnProperty(e)?t[e]:null}function gt(t){return t&&(t.hasOwnProperty(mt)||t.hasOwnProperty(vt))?t[mt]:null}const _t=J({"\u0275prov":J}),mt=J({"\u0275inj":J}),yt=J({ngInjectableDef:J}),vt=J({ngInjectorDef:J});var wt=function(t){return t[t.Default=0]="Default",t[t.Host=1]="Host",t[t.Self=2]="Self",t[t.SkipSelf=4]="SkipSelf",t[t.Optional=8]="Optional",t}({});let bt;function Ct(t){const e=bt;return bt=t,e}function xt(t,e,n){const r=ft(t);return r&&"root"==r.providedIn?void 0===r.value?r.value=r.factory():r.value:n&wt.Optional?null:void 0!==e?e:void ct(et(t),"Injector")}function Et(t){return{toString:t}.toString()}var St=function(t){return t[t.OnPush=0]="OnPush",t[t.Default=1]="Default",t}({}),kt=function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t}({});const At="undefined"!=typeof globalThis&&globalThis,Tt="undefined"!=typeof window&&window,It="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,Vt="undefined"!=typeof global&&global,Ot=At||Vt||Tt||It,Mt={},Dt=[],Nt=J({"\u0275cmp":J}),Pt=J({"\u0275dir":J}),Rt=J({"\u0275pipe":J}),jt=J({"\u0275mod":J}),Ft=J({"\u0275loc":J}),Ht=J({"\u0275fac":J}),zt=J({__NG_ELEMENT_ID__:J});let Lt=0;function Bt(t){return Et(()=>{const e={},n={type:t.type,providersResolver:null,decls:t.decls,vars:t.vars,factory:null,template:t.template||null,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:e,inputs:null,outputs:null,exportAs:t.exportAs||null,onPush:t.changeDetection===St.OnPush,directiveDefs:null,pipeDefs:null,selectors:t.selectors||Dt,viewQuery:t.viewQuery||null,features:t.features||null,data:t.data||{},encapsulation:t.encapsulation||kt.Emulated,id:"c",styles:t.styles||Dt,_:null,setInput:null,schemas:t.schemas||null,tView:null},r=t.directives,s=t.features,i=t.pipes;return n.id+=Lt++,n.inputs=qt(t.inputs,e),n.outputs=qt(t.outputs),s&&s.forEach(t=>t(n)),n.directiveDefs=r?()=>("function"==typeof r?r():r).map(Wt):null,n.pipeDefs=i?()=>("function"==typeof i?i():i).map($t):null,n})}function Wt(t){return Qt(t)||function(t){return t[Pt]||null}(t)}function $t(t){return function(t){return t[Rt]||null}(t)}const Zt={};function Ut(t){const e={type:t.type,bootstrap:t.bootstrap||Dt,declarations:t.declarations||Dt,imports:t.imports||Dt,exports:t.exports||Dt,transitiveCompileScopes:null,schemas:t.schemas||null,id:t.id||null};return null!=t.id&&Et(()=>{Zt[t.id]=t.type}),e}function qt(t,e){if(null==t)return Mt;const n={};for(const r in t)if(t.hasOwnProperty(r)){let s=t[r],i=s;Array.isArray(s)&&(i=s[1],s=s[0]),n[s]=r,e&&(e[s]=i)}return n}const Gt=Bt;function Qt(t){return t[Nt]||null}function Yt(t,e){const n=t[jt]||null;if(!n&&!0===e)throw new Error(`Type ${et(t)} does not have '\u0275mod' property.`);return n}const Kt=20,Xt=10;function Jt(t){return Array.isArray(t)&&"object"==typeof t[1]}function te(t){return Array.isArray(t)&&!0===t[1]}function ee(t){return 0!=(8&t.flags)}function ne(t){return 2==(2&t.flags)}function re(t){return 1==(1&t.flags)}function se(t){return null!==t.template}function ie(t,e){return t.hasOwnProperty(Ht)?t[Ht]:null}class oe{constructor(t,e,n){this.previousValue=t,this.currentValue=e,this.firstChange=n}isFirstChange(){return this.firstChange}}function le(){return ae}function ae(t){return t.type.prototype.ngOnChanges&&(t.setInput=ce),ue}function ue(){const t=he(this),e=null==t?void 0:t.current;if(e){const n=t.previous;if(n===Mt)t.previous=e;else for(let t in e)n[t]=e[t];t.current=null,this.ngOnChanges(e)}}function ce(t,e,n,r){const s=he(t)||function(t,e){return t.__ngSimpleChanges__=e}(t,{previous:Mt,current:null}),i=s.current||(s.current={}),o=s.previous,l=this.declaredInputs[n],a=o[l];i[l]=new oe(a&&a.currentValue,e,o===Mt),t[r]=e}function he(t){return t.__ngSimpleChanges__||null}le.ngInherit=!0;const de="http://www.w3.org/2000/svg";let fe;function pe(t){return!!t.listen}const ge={createRenderer:(t,e)=>void 0!==fe?fe:"undefined"!=typeof document?document:void 0};function _e(t){for(;Array.isArray(t);)t=t[0];return t}function me(t,e){return _e(e[t])}function ye(t,e){return _e(e[t.index])}function ve(t,e){return t.data[e]}function we(t,e){const n=e[t];return Jt(n)?n:n[0]}function be(t){const e=function(t){return t.__ngContext__||null}(t);return e?Array.isArray(e)?e:e.lView:null}function Ce(t){return 128==(128&t[2])}function xe(t,e){return null==e?null:t[e]}function Ee(t){t[18]=0}function Se(t,e){t[5]+=e;let n=t,r=t[3];for(;null!==r&&(1===e&&1===n[5]||-1===e&&0===n[5]);)r[5]+=e,n=r,r=r[3]}const ke={lFrame:Ze(null),bindingsEnabled:!0,isInCheckNoChangesMode:!1};function Ae(){return ke.bindingsEnabled}function Te(){return ke.lFrame.lView}function Ie(){return ke.lFrame.tView}function Ve(t){ke.lFrame.contextLView=t}function Oe(){let t=Me();for(;null!==t&&64===t.type;)t=t.parent;return t}function Me(){return ke.lFrame.currentTNode}function De(t,e){const n=ke.lFrame;n.currentTNode=t,n.isParent=e}function Ne(){return ke.lFrame.isParent}function Pe(){return ke.isInCheckNoChangesMode}function Re(t){ke.isInCheckNoChangesMode=t}function je(){return ke.lFrame.bindingIndex++}function Fe(t,e){const n=ke.lFrame;n.bindingIndex=n.bindingRootIndex=t,He(e)}function He(t){ke.lFrame.currentDirectiveIndex=t}function ze(t){ke.lFrame.currentQueryIndex=t}function Le(t){const e=t[1];return 2===e.type?e.declTNode:1===e.type?t[6]:null}function Be(t,e,n){if(n&wt.SkipSelf){let r=e,s=t;for(;r=r.parent,!(null!==r||n&wt.Host||(r=Le(s),null===r)||(s=s[15],10&r.type)););if(null===r)return!1;e=r,t=s}const r=ke.lFrame=$e();return r.currentTNode=e,r.lView=t,!0}function We(t){const e=$e(),n=t[1];ke.lFrame=e,e.currentTNode=n.firstChild,e.lView=t,e.tView=n,e.contextLView=t,e.bindingIndex=n.bindingStartIndex,e.inI18n=!1}function $e(){const t=ke.lFrame,e=null===t?null:t.child;return null===e?Ze(t):e}function Ze(t){const e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return null!==t&&(t.child=e),e}function Ue(){const t=ke.lFrame;return ke.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}const qe=Ue;function Ge(){const t=Ue();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function Qe(){return ke.lFrame.selectedIndex}function Ye(t){ke.lFrame.selectedIndex=t}function Ke(){const t=ke.lFrame;return ve(t.tView,t.selectedIndex)}function Xe(){ke.lFrame.currentNamespace=de}function Je(){ke.lFrame.currentNamespace=null}function tn(t,e){for(let n=e.directiveStart,r=e.directiveEnd;n<r;n++){const e=t.data[n].type.prototype,{ngAfterContentInit:r,ngAfterContentChecked:s,ngAfterViewInit:i,ngAfterViewChecked:o,ngOnDestroy:l}=e;r&&(t.contentHooks||(t.contentHooks=[])).push(-n,r),s&&((t.contentHooks||(t.contentHooks=[])).push(n,s),(t.contentCheckHooks||(t.contentCheckHooks=[])).push(n,s)),i&&(t.viewHooks||(t.viewHooks=[])).push(-n,i),o&&((t.viewHooks||(t.viewHooks=[])).push(n,o),(t.viewCheckHooks||(t.viewCheckHooks=[])).push(n,o)),null!=l&&(t.destroyHooks||(t.destroyHooks=[])).push(n,l)}}function en(t,e,n){sn(t,e,3,n)}function nn(t,e,n,r){(3&t[2])===n&&sn(t,e,n,r)}function rn(t,e){let n=t[2];(3&n)===e&&(n&=2047,n+=1,t[2]=n)}function sn(t,e,n,r){const s=null!=r?r:-1,i=e.length-1;let o=0;for(let l=void 0!==r?65535&t[18]:0;l<i;l++)if("number"==typeof e[l+1]){if(o=e[l],null!=r&&o>=r)break}else e[l]<0&&(t[18]+=65536),(o<s||-1==s)&&(on(t,n,e,l),t[18]=(4294901760&t[18])+l+2),l++}function on(t,e,n,r){const s=n[r]<0,i=n[r+1],o=t[s?-n[r]:n[r]];s?t[2]>>11<t[18]>>16&&(3&t[2])===e&&(t[2]+=2048,i.call(o)):i.call(o)}const ln=-1;class an{constructor(t,e,n){this.factory=t,this.resolving=!1,this.canSeeViewProviders=e,this.injectImpl=n}}function un(t,e,n){const r=pe(t);let s=0;for(;s<n.length;){const i=n[s];if("number"==typeof i){if(0!==i)break;s++;const o=n[s++],l=n[s++],a=n[s++];r?t.setAttribute(e,l,a,o):e.setAttributeNS(o,l,a)}else{const o=i,l=n[++s];cn(o)?r&&t.setProperty(e,o,l):r?t.setAttribute(e,o,l):e.setAttribute(o,l),s++}}return s}function cn(t){return 64===t.charCodeAt(0)}function hn(t,e){if(null===e||0===e.length);else if(null===t||0===t.length)t=e.slice();else{let n=-1;for(let r=0;r<e.length;r++){const s=e[r];"number"==typeof s?n=s:0===n||dn(t,n,s,null,-1===n||2===n?e[++r]:null)}}return t}function dn(t,e,n,r,s){let i=0,o=t.length;if(-1===e)o=-1;else for(;i<t.length;){const n=t[i++];if("number"==typeof n){if(n===e){o=-1;break}if(n>e){o=i-1;break}}}for(;i<t.length;){const e=t[i];if("number"==typeof e)break;if(e===n){if(null===r)return void(null!==s&&(t[i+1]=s));if(r===t[i+1])return void(t[i+2]=s)}i++,null!==r&&i++,null!==s&&i++}-1!==o&&(t.splice(o,0,e),i=o+1),t.splice(i++,0,n),null!==r&&t.splice(i++,0,r),null!==s&&t.splice(i++,0,s)}function fn(t){return t!==ln}function pn(t){return 32767&t}function gn(t,e){let n=t>>16,r=e;for(;n>0;)r=r[15],n--;return r}let _n=!0;function mn(t){const e=_n;return _n=t,e}let yn=0;function vn(t,e){const n=bn(t,e);if(-1!==n)return n;const r=e[1];r.firstCreatePass&&(t.injectorIndex=e.length,wn(r.data,t),wn(e,null),wn(r.blueprint,null));const s=Cn(t,e),i=t.injectorIndex;if(fn(s)){const t=pn(s),n=gn(s,e),r=n[1].data;for(let s=0;s<8;s++)e[i+s]=n[t+s]|r[t+s]}return e[i+8]=s,i}function wn(t,e){t.push(0,0,0,0,0,0,0,0,e)}function bn(t,e){return-1===t.injectorIndex||t.parent&&t.parent.injectorIndex===t.injectorIndex||null===e[t.injectorIndex+8]?-1:t.injectorIndex}function Cn(t,e){if(t.parent&&-1!==t.parent.injectorIndex)return t.parent.injectorIndex;let n=0,r=null,s=e;for(;null!==s;){const t=s[1],e=t.type;if(r=2===e?t.declTNode:1===e?s[6]:null,null===r)return ln;if(n++,s=s[15],-1!==r.injectorIndex)return r.injectorIndex|n<<16}return ln}function xn(t,e,n){!function(t,e,n){let r;"string"==typeof n?r=n.charCodeAt(0)||0:n.hasOwnProperty(zt)&&(r=n[zt]),null==r&&(r=n[zt]=yn++);const s=255&r;e.data[t+(s>>5)]|=1<<s}(t,e,n)}function En(t,e,n){if(n&wt.Optional)return t;ct(e,"NodeInjector")}function Sn(t,e,n,r){if(n&wt.Optional&&void 0===r&&(r=null),0==(n&(wt.Self|wt.Host))){const s=t[9],i=Ct(void 0);try{return s?s.get(e,r,n&wt.Optional):xt(e,r,n&wt.Optional)}finally{Ct(i)}}return En(r,e,n)}function kn(t,e,n,r=wt.Default,s){if(null!==t){const i=function(t){if("string"==typeof t)return t.charCodeAt(0)||0;const e=t.hasOwnProperty(zt)?t[zt]:void 0;return"number"==typeof e?e>=0?255&e:Tn:e}(n);if("function"==typeof i){if(!Be(e,t,r))return r&wt.Host?En(s,n,r):Sn(e,n,r,s);try{const t=i();if(null!=t||r&wt.Optional)return t;ct(n)}finally{qe()}}else if("number"==typeof i){let s=null,o=bn(t,e),l=ln,a=r&wt.Host?e[16][6]:null;for((-1===o||r&wt.SkipSelf)&&(l=-1===o?Cn(t,e):e[o+8],l!==ln&&Mn(r,!1)?(s=e[1],o=pn(l),e=gn(l,e)):o=-1);-1!==o;){const t=e[1];if(On(i,o,t.data)){const t=In(o,e,n,s,r,a);if(t!==An)return t}l=e[o+8],l!==ln&&Mn(r,e[1].data[o+8]===a)&&On(i,o,e)?(s=t,o=pn(l),e=gn(l,e)):o=-1}}}return Sn(e,n,r,s)}const An={};function Tn(){return new Dn(Oe(),Te())}function In(t,e,n,r,s,i){const o=e[1],l=o.data[t+8],a=function(t,e,n,r,s){const i=t.providerIndexes,o=e.data,l=1048575&i,a=t.directiveStart,u=i>>20,c=s?l+u:t.directiveEnd;for(let h=r?l:l+u;h<c;h++){const t=o[h];if(h<a&&n===t||h>=a&&t.type===n)return h}if(s){const t=o[a];if(t&&se(t)&&t.type===n)return a}return null}(l,o,n,null==r?ne(l)&&_n:r!=o&&0!=(3&l.type),s&wt.Host&&i===l);return null!==a?Vn(e,o,a,l):An}function Vn(t,e,n,r){let s=t[n];const i=e.data;if(s instanceof an){const o=s;o.resolving&&function(t,e){throw new lt("200",`Circular dependency in DI detected for ${t}`)}(ut(i[n]));const l=mn(o.canSeeViewProviders);o.resolving=!0;const a=o.injectImpl?Ct(o.injectImpl):null;Be(t,r,wt.Default);try{s=t[n]=o.factory(void 0,i,t,r),e.firstCreatePass&&n>=r.directiveStart&&function(t,e,n){const{ngOnChanges:r,ngOnInit:s,ngDoCheck:i}=e.type.prototype;if(r){const r=ae(e);(n.preOrderHooks||(n.preOrderHooks=[])).push(t,r),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(t,r)}s&&(n.preOrderHooks||(n.preOrderHooks=[])).push(0-t,s),i&&((n.preOrderHooks||(n.preOrderHooks=[])).push(t,i),(n.preOrderCheckHooks||(n.preOrderCheckHooks=[])).push(t,i))}(n,i[n],e)}finally{null!==a&&Ct(a),mn(l),o.resolving=!1,qe()}}return s}function On(t,e,n){return!!(n[e+(t>>5)]&1<<t)}function Mn(t,e){return!(t&wt.Self||t&wt.Host&&e)}class Dn{constructor(t,e){this._tNode=t,this._lView=e}get(t,e){return kn(this._tNode,this._lView,t,void 0,e)}}function Nn(t){const e=t;if(ot(t))return()=>{const t=Nn(it(e));return t?t():null};let n=ie(e);if(null===n){const t=gt(e);n=t&&t.factory}return n||null}function Pn(t){return Et(()=>{const e=t.prototype.constructor,n=e[Ht]||Nn(e),r=Object.prototype;let s=Object.getPrototypeOf(t.prototype).constructor;for(;s&&s!==r;){const t=s[Ht]||Nn(s);if(t&&t!==n)return t;s=Object.getPrototypeOf(s)}return t=>new t})}const Rn="__parameters__";function jn(t,e,n){return Et(()=>{const r=function(t){return function(...e){if(t){const n=t(...e);for(const t in n)this[t]=n[t]}}}(e);function s(...t){if(this instanceof s)return r.apply(this,t),this;const e=new s(...t);return n.annotation=e,n;function n(t,n,r){const s=t.hasOwnProperty(Rn)?t[Rn]:Object.defineProperty(t,Rn,{value:[]})[Rn];for(;s.length<=r;)s.push(null);return(s[r]=s[r]||[]).push(e),t}}return n&&(s.prototype=Object.create(n.prototype)),s.prototype.ngMetadataName=t,s.annotationCls=s,s})}class Fn{constructor(t,e){this._desc=t,this.ngMetadataName="InjectionToken",this.\u0275prov=void 0,"number"==typeof e?this.__NG_ELEMENT_ID__=e:void 0!==e&&(this.\u0275prov=ht({token:this,providedIn:e.providedIn||"root",factory:e.factory}))}toString(){return`InjectionToken ${this._desc}`}}function Hn(t,e){t.forEach(t=>Array.isArray(t)?Hn(t,e):e(t))}function zn(t,e,n){e>=t.length?t.push(n):t.splice(e,0,n)}function Ln(t,e){return e>=t.length-1?t.pop():t.splice(e,1)[0]}function Bn(t,e,n){let r=$n(t,e);return r>=0?t[1|r]=n:(r=~r,function(t,e,n,r){let s=t.length;if(s==e)t.push(n,r);else if(1===s)t.push(r,t[0]),t[0]=n;else{for(s--,t.push(t[s-1],t[s]);s>e;)t[s]=t[s-2],s--;t[e]=n,t[e+1]=r}}(t,r,e,n)),r}function Wn(t,e){const n=$n(t,e);if(n>=0)return t[1|n]}function $n(t,e){return function(t,e,n){let r=0,s=t.length>>1;for(;s!==r;){const n=r+(s-r>>1),i=t[n<<1];if(e===i)return n<<1;i>e?s=n:r=n+1}return~(s<<1)}(t,e)}const Zn={},Un=/\n/gm,qn="__source",Gn=J({provide:String,useValue:J});let Qn;function Yn(t){const e=Qn;return Qn=t,e}function Kn(t,e=wt.Default){if(void 0===Qn)throw new Error("inject() must be called from an injection context");return null===Qn?xt(t,void 0,e):Qn.get(t,e&wt.Optional?null:void 0,e)}function Xn(t,e=wt.Default){return(bt||Kn)(it(t),e)}function Jn(t){const e=[];for(let n=0;n<t.length;n++){const r=it(t[n]);if(Array.isArray(r)){if(0===r.length)throw new Error("Arguments array must have arguments.");let t,n=wt.Default;for(let e=0;e<r.length;e++){const s=r[e],i=s.__NG_DI_FLAG__;"number"==typeof i?-1===i?t=s.token:n|=i:t=s}e.push(Xn(t,n))}else e.push(Xn(r))}return e}function tr(t,e){return t.__NG_DI_FLAG__=e,t.prototype.__NG_DI_FLAG__=e,t}const er=tr(jn("Inject",t=>({token:t})),-1),nr=tr(jn("Optional"),8),rr=tr(jn("SkipSelf"),4);class sr{constructor(t){this.changingThisBreaksApplicationSecurity=t}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see https://g.co/ng/security#xss)`}}function ir(t){return t instanceof sr?t.changingThisBreaksApplicationSecurity:t}const or=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,lr=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i;var ar=function(t){return t[t.NONE=0]="NONE",t[t.HTML=1]="HTML",t[t.STYLE=2]="STYLE",t[t.SCRIPT=3]="SCRIPT",t[t.URL=4]="URL",t[t.RESOURCE_URL=5]="RESOURCE_URL",t}({});function ur(t){const e=function(){const t=Te();return t&&t[12]}();return e?e.sanitize(ar.URL,t)||"":function(t,e){const n=function(t){return t instanceof sr&&t.getTypeName()||null}(t);if(null!=n&&n!==e){if("ResourceURL"===n&&"URL"===e)return!0;throw new Error(`Required a safe ${e}, got a ${n} (see https://g.co/ng/security#xss)`)}return n===e}(t,"URL")?ir(t):(n=at(t),(n=String(n)).match(or)||n.match(lr)?n:"unsafe:"+n);var n}function cr(t){return t.ngDebugContext}function hr(t){return t.ngOriginalError}function dr(t,...e){t.error(...e)}class fr{constructor(){this._console=console}handleError(t){const e=this._findOriginalError(t),n=this._findContext(t),r=function(t){return t.ngErrorLogger||dr}(t);r(this._console,"ERROR",t),e&&r(this._console,"ORIGINAL ERROR",e),n&&r(this._console,"ERROR CONTEXT",n)}_findContext(t){return t?cr(t)?cr(t):this._findContext(hr(t)):null}_findOriginalError(t){let e=hr(t);for(;e&&hr(e);)e=hr(e);return e}}function pr(t,e){t.__ngContext__=e}const gr=(()=>("undefined"!=typeof requestAnimationFrame&&requestAnimationFrame||setTimeout).bind(Ot))();function _r(t){return t instanceof Function?t():t}var mr=function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t}({});function yr(t,e){return(void 0)(t,e)}function vr(t){const e=t[3];return te(e)?e[3]:e}function wr(t){return Cr(t[13])}function br(t){return Cr(t[4])}function Cr(t){for(;null!==t&&!te(t);)t=t[4];return t}function xr(t,e,n,r,s){if(null!=r){let i,o=!1;te(r)?i=r:Jt(r)&&(o=!0,r=r[0]);const l=_e(r);0===t&&null!==n?null==s?Vr(e,n,l):Ir(e,n,l,s||null,!0):1===t&&null!==n?Ir(e,n,l,s||null,!0):2===t?function(t,e,n){const r=Mr(t,e);r&&function(t,e,n,r){pe(t)?t.removeChild(e,n,r):e.removeChild(n)}(t,r,e,n)}(e,l,o):3===t&&e.destroyNode(l),null!=i&&function(t,e,n,r,s){const i=n[7];i!==_e(n)&&xr(e,t,r,i,s);for(let o=Xt;o<n.length;o++){const s=n[o];Fr(s[1],s,t,e,r,i)}}(e,t,i,n,s)}}function Er(t,e,n){return pe(t)?t.createElement(e,n):null===n?t.createElement(e):t.createElementNS(n,e)}function Sr(t,e){const n=t[9],r=n.indexOf(e),s=e[3];1024&e[2]&&(e[2]&=-1025,Se(s,-1)),n.splice(r,1)}function kr(t,e){if(t.length<=Xt)return;const n=Xt+e,r=t[n];if(r){const i=r[17];null!==i&&i!==t&&Sr(i,r),e>0&&(t[n-1][4]=r[4]);const o=Ln(t,Xt+e);Fr(r[1],s=r,s[11],2,null,null),s[0]=null,s[6]=null;const l=o[19];null!==l&&l.detachView(o[1]),r[3]=null,r[4]=null,r[2]&=-129}var s;return r}function Ar(t,e){if(!(256&e[2])){const n=e[11];pe(n)&&n.destroyNode&&Fr(t,e,n,3,null,null),function(t){let e=t[13];if(!e)return Tr(t[1],t);for(;e;){let n=null;if(Jt(e))n=e[13];else{const t=e[10];t&&(n=t)}if(!n){for(;e&&!e[4]&&e!==t;)Jt(e)&&Tr(e[1],e),e=e[3];null===e&&(e=t),Jt(e)&&Tr(e[1],e),n=e&&e[4]}e=n}}(e)}}function Tr(t,e){if(!(256&e[2])){e[2]&=-129,e[2]|=256,function(t,e){let n;if(null!=t&&null!=(n=t.destroyHooks))for(let r=0;r<n.length;r+=2){const t=e[n[r]];if(!(t instanceof an)){const e=n[r+1];if(Array.isArray(e))for(let n=0;n<e.length;n+=2)e[n+1].call(t[e[n]]);else e.call(t)}}}(t,e),function(t,e){const n=t.cleanup,r=e[7];let s=-1;if(null!==n)for(let i=0;i<n.length-1;i+=2)if("string"==typeof n[i]){const t=n[i+1],o="function"==typeof t?t(e):_e(e[t]),l=r[s=n[i+2]],a=n[i+3];"boolean"==typeof a?o.removeEventListener(n[i],l,a):a>=0?r[s=a]():r[s=-a].unsubscribe(),i+=2}else{const t=r[s=n[i+1]];n[i].call(t)}if(null!==r){for(let t=s+1;t<r.length;t++)(0,r[t])();e[7]=null}}(t,e),1===e[1].type&&pe(e[11])&&e[11].destroy();const n=e[17];if(null!==n&&te(e[3])){n!==e[3]&&Sr(n,e);const r=e[19];null!==r&&r.detachView(t)}}}function Ir(t,e,n,r,s){pe(t)?t.insertBefore(e,n,r,s):e.insertBefore(n,r,s)}function Vr(t,e,n){pe(t)?t.appendChild(e,n):e.appendChild(n)}function Or(t,e,n,r,s){null!==r?Ir(t,e,n,r,s):Vr(t,e,n)}function Mr(t,e){return pe(t)?t.parentNode(e):e.parentNode}function Dr(t,e,n,r){const s=function(t,e,n){return function(t,e,n){let r=e;for(;null!==r&&40&r.type;)r=(e=r).parent;if(null===r)return n[0];if(2&r.flags){const e=t.data[r.directiveStart].encapsulation;if(e===kt.None||e===kt.Emulated)return null}return ye(r,n)}(t,e.parent,n)}(t,r,e),i=e[11],o=function(t,e,n){return function(t,e,n){return 40&t.type?ye(t,n):null}(t,0,n)}(r.parent||e[6],0,e);if(null!=s)if(Array.isArray(n))for(let l=0;l<n.length;l++)Or(i,s,n[l],o,!1);else Or(i,s,n,o,!1)}function Nr(t,e){if(null!==e){const n=e.type;if(3&n)return ye(e,t);if(4&n)return Rr(-1,t[e.index]);if(8&n){const n=e.child;if(null!==n)return Nr(t,n);{const n=t[e.index];return te(n)?Rr(-1,n):_e(n)}}if(32&n)return yr(e,t)()||_e(t[e.index]);{const n=Pr(t,e);return null!==n?Array.isArray(n)?n[0]:Nr(vr(t[16]),n):Nr(t,e.next)}}return null}function Pr(t,e){return null!==e?t[16][6].projection[e.projection]:null}function Rr(t,e){const n=Xt+t+1;if(n<e.length){const t=e[n],r=t[1].firstChild;if(null!==r)return Nr(t,r)}return e[7]}function jr(t,e,n,r,s,i,o){for(;null!=n;){const l=r[n.index],a=n.type;if(o&&0===e&&(l&&pr(_e(l),r),n.flags|=4),64!=(64&n.flags))if(8&a)jr(t,e,n.child,r,s,i,!1),xr(e,t,s,l,i);else if(32&a){const o=yr(n,r);let a;for(;a=o();)xr(e,t,s,a,i);xr(e,t,s,l,i)}else 16&a?Hr(t,e,r,n,s,i):xr(e,t,s,l,i);n=o?n.projectionNext:n.next}}function Fr(t,e,n,r,s,i){jr(n,r,t.firstChild,e,s,i,!1)}function Hr(t,e,n,r,s,i){const o=n[16],l=o[6].projection[r.projection];if(Array.isArray(l))for(let a=0;a<l.length;a++)xr(e,t,s,l[a],i);else jr(t,e,l,o[3],s,i,!0)}function zr(t,e,n){pe(t)?t.setAttribute(e,"style",n):e.style.cssText=n}function Lr(t,e,n){pe(t)?""===n?t.removeAttribute(e,"class"):t.setAttribute(e,"class",n):e.className=n}function Br(t,e,n){let r=t.length;for(;;){const s=t.indexOf(e,n);if(-1===s)return s;if(0===s||t.charCodeAt(s-1)<=32){const n=e.length;if(s+n===r||t.charCodeAt(s+n)<=32)return s}n=s+1}}const Wr="ng-template";function $r(t,e,n){let r=0;for(;r<t.length;){let s=t[r++];if(n&&"class"===s){if(s=t[r],-1!==Br(s.toLowerCase(),e,0))return!0}else if(1===s){for(;r<t.length&&"string"==typeof(s=t[r++]);)if(s.toLowerCase()===e)return!0;return!1}}return!1}function Zr(t){return 4===t.type&&t.value!==Wr}function Ur(t,e,n){return e===(4!==t.type||n?t.value:Wr)}function qr(t,e,n){let r=4;const s=t.attrs||[],i=function(t){for(let n=0;n<t.length;n++)if(3===(e=t[n])||4===e||6===e)return n;var e;return t.length}(s);let o=!1;for(let l=0;l<e.length;l++){const a=e[l];if("number"!=typeof a){if(!o)if(4&r){if(r=2|1&r,""!==a&&!Ur(t,a,n)||""===a&&1===e.length){if(Gr(r))return!1;o=!0}}else{const u=8&r?a:e[++l];if(8&r&&null!==t.attrs){if(!$r(t.attrs,u,n)){if(Gr(r))return!1;o=!0}continue}const c=Qr(8&r?"class":a,s,Zr(t),n);if(-1===c){if(Gr(r))return!1;o=!0;continue}if(""!==u){let t;t=c>i?"":s[c+1].toLowerCase();const e=8&r?t:null;if(e&&-1!==Br(e,u,0)||2&r&&u!==t){if(Gr(r))return!1;o=!0}}}}else{if(!o&&!Gr(r)&&!Gr(a))return!1;if(o&&Gr(a))continue;o=!1,r=a|1&r}}return Gr(r)||o}function Gr(t){return 0==(1&t)}function Qr(t,e,n,r){if(null===e)return-1;let s=0;if(r||!n){let n=!1;for(;s<e.length;){const r=e[s];if(r===t)return s;if(3===r||6===r)n=!0;else{if(1===r||2===r){let t=e[++s];for(;"string"==typeof t;)t=e[++s];continue}if(4===r)break;if(0===r){s+=4;continue}}s+=n?1:2}return-1}return function(t,e){let n=t.indexOf(4);if(n>-1)for(n++;n<t.length;){const r=t[n];if("number"==typeof r)return-1;if(r===e)return n;n++}return-1}(e,t)}function Yr(t,e,n=!1){for(let r=0;r<e.length;r++)if(qr(t,e[r],n))return!0;return!1}function Kr(t,e){return t?":not("+e.trim()+")":e}function Xr(t){let e=t[0],n=1,r=2,s="",i=!1;for(;n<t.length;){let o=t[n];if("string"==typeof o)if(2&r){const e=t[++n];s+="["+o+(e.length>0?'="'+e+'"':"")+"]"}else 8&r?s+="."+o:4&r&&(s+=" "+o);else""===s||Gr(o)||(e+=Kr(i,s),s=""),r=o,i=i||!Gr(r);n++}return""!==s&&(e+=Kr(i,s)),e}const Jr={};function ts(t){es(Ie(),Te(),Qe()+t,Pe())}function es(t,e,n,r){if(!r)if(3==(3&e[2])){const r=t.preOrderCheckHooks;null!==r&&en(e,r,n)}else{const r=t.preOrderHooks;null!==r&&nn(e,r,0,n)}Ye(n)}function ns(t,e){return t<<17|e<<2}function rs(t){return t>>17&32767}function ss(t){return 2|t}function is(t){return(131068&t)>>2}function os(t,e){return-131069&t|e<<2}function ls(t){return 1|t}function as(t,e){const n=t.contentQueries;if(null!==n)for(let r=0;r<n.length;r+=2){const s=n[r],i=n[r+1];if(-1!==i){const n=t.data[i];ze(s),n.contentQueries(2,e[i],i)}}}function us(t,e,n,r,s,i,o,l,a,u){const c=e.blueprint.slice();return c[0]=s,c[2]=140|r,Ee(c),c[3]=c[15]=t,c[8]=n,c[10]=o||t&&t[10],c[11]=l||t&&t[11],c[12]=a||t&&t[12]||null,c[9]=u||t&&t[9]||null,c[6]=i,c[16]=2==e.type?t[16]:c,c}function cs(t,e,n,r,s){let i=t.data[e];if(null===i)i=function(t,e,n,r,s){const i=Me(),o=Ne(),l=t.data[e]=function(t,e,n,r,s,i){return{type:n,index:r,insertBeforeIndex:null,injectorIndex:e?e.injectorIndex:-1,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,propertyBindings:null,flags:0,providerIndexes:0,value:s,attrs:i,mergedAttrs:null,localNames:null,initialInputs:void 0,inputs:null,outputs:null,tViews:null,next:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}(0,o?i:i&&i.parent,n,e,r,s);return null===t.firstChild&&(t.firstChild=l),null!==i&&(o?null==i.child&&null!==l.parent&&(i.child=l):null===i.next&&(i.next=l)),l}(t,e,n,r,s),ke.lFrame.inI18n&&(i.flags|=64);else if(64&i.type){i.type=n,i.value=r,i.attrs=s;const t=function(){const t=ke.lFrame,e=t.currentTNode;return t.isParent?e:e.parent}();i.injectorIndex=null===t?-1:t.injectorIndex}return De(i,!0),i}function hs(t,e,n,r){if(0===n)return-1;const s=e.length;for(let i=0;i<n;i++)e.push(r),t.blueprint.push(r),t.data.push(null);return s}function ds(t,e,n){We(e);try{const r=t.viewQuery;null!==r&&zs(1,r,n);const s=t.template;null!==s&&gs(t,e,s,1,n),t.firstCreatePass&&(t.firstCreatePass=!1),t.staticContentQueries&&as(t,e),t.staticViewQueries&&zs(2,t.viewQuery,n);const i=t.components;null!==i&&function(t,e){for(let n=0;n<e.length;n++)Ps(t,e[n])}(e,i)}catch(r){throw t.firstCreatePass&&(t.incompleteFirstPass=!0),r}finally{e[2]&=-5,Ge()}}function fs(t,e,n,r){const s=e[2];if(256==(256&s))return;We(e);const i=Pe();try{Ee(e),ke.lFrame.bindingIndex=t.bindingStartIndex,null!==n&&gs(t,e,n,2,r);const o=3==(3&s);if(!i)if(o){const n=t.preOrderCheckHooks;null!==n&&en(e,n,null)}else{const n=t.preOrderHooks;null!==n&&nn(e,n,0,null),rn(e,0)}if(function(t){for(let e=wr(t);null!==e;e=br(e)){if(!e[2])continue;const t=e[9];for(let e=0;e<t.length;e++){const n=t[e],r=n[3];0==(1024&n[2])&&Se(r,1),n[2]|=1024}}}(e),function(t){for(let e=wr(t);null!==e;e=br(e))for(let t=Xt;t<e.length;t++){const n=e[t],r=n[1];Ce(n)&&fs(r,n,r.template,n[8])}}(e),null!==t.contentQueries&&as(t,e),!i)if(o){const n=t.contentCheckHooks;null!==n&&en(e,n)}else{const n=t.contentHooks;null!==n&&nn(e,n,1),rn(e,1)}!function(t,e){const n=t.hostBindingOpCodes;if(null!==n)try{for(let t=0;t<n.length;t++){const r=n[t];if(r<0)Ye(~r);else{const s=r,i=n[++t],o=n[++t];Fe(i,s),o(2,e[s])}}}finally{Ye(-1)}}(t,e);const l=t.components;null!==l&&function(t,e){for(let n=0;n<e.length;n++)Ds(t,e[n])}(e,l);const a=t.viewQuery;if(null!==a&&zs(2,a,r),!i)if(o){const n=t.viewCheckHooks;null!==n&&en(e,n)}else{const n=t.viewHooks;null!==n&&nn(e,n,2),rn(e,2)}!0===t.firstUpdatePass&&(t.firstUpdatePass=!1),i||(e[2]&=-73),1024&e[2]&&(e[2]&=-1025,Se(e[3],-1))}finally{Ge()}}function ps(t,e,n,r){const s=e[10],i=!Pe(),o=4==(4&e[2]);try{i&&!o&&s.begin&&s.begin(),o&&ds(t,e,r),fs(t,e,n,r)}finally{i&&!o&&s.end&&s.end()}}function gs(t,e,n,r,s){const i=Qe();try{Ye(-1),2&r&&e.length>Kt&&es(t,e,Kt,Pe()),n(r,s)}finally{Ye(i)}}function _s(t,e,n){Ae()&&(function(t,e,n,r){const s=n.directiveStart,i=n.directiveEnd;t.firstCreatePass||vn(n,e),pr(r,e);const o=n.initialInputs;for(let l=s;l<i;l++){const r=t.data[l],i=se(r);i&&Is(e,n,r);const a=Vn(e,t,l,n);pr(a,e),null!==o&&Vs(0,l-s,a,r,0,o),i&&(we(n.index,e)[8]=a)}}(t,e,n,ye(n,e)),128==(128&n.flags)&&function(t,e,n){const r=n.directiveStart,s=n.directiveEnd,i=n.index,o=ke.lFrame.currentDirectiveIndex;try{Ye(i);for(let n=r;n<s;n++){const r=t.data[n],s=e[n];He(n),null===r.hostBindings&&0===r.hostVars&&null===r.hostAttrs||Es(r,s)}}finally{Ye(-1),He(o)}}(t,e,n))}function ms(t,e,n=ye){const r=e.localNames;if(null!==r){let s=e.index+1;for(let i=0;i<r.length;i+=2){const o=r[i+1],l=-1===o?n(e,t):t[o];t[s++]=l}}}function ys(t){const e=t.tView;return null===e||e.incompleteFirstPass?t.tView=vs(1,null,t.template,t.decls,t.vars,t.directiveDefs,t.pipeDefs,t.viewQuery,t.schemas,t.consts):e}function vs(t,e,n,r,s,i,o,l,a,u){const c=Kt+r,h=c+s,d=function(t,e){const n=[];for(let r=0;r<e;r++)n.push(r<t?null:Jr);return n}(c,h),f="function"==typeof u?u():u;return d[1]={type:t,blueprint:d,template:n,queries:null,viewQuery:l,declTNode:e,data:d.slice().fill(null,c),bindingStartIndex:c,expandoStartIndex:h,hostBindingOpCodes:null,firstCreatePass:!0,firstUpdatePass:!0,staticViewQueries:!1,staticContentQueries:!1,preOrderHooks:null,preOrderCheckHooks:null,contentHooks:null,contentCheckHooks:null,viewHooks:null,viewCheckHooks:null,destroyHooks:null,cleanup:null,contentQueries:null,components:null,directiveRegistry:"function"==typeof i?i():i,pipeRegistry:"function"==typeof o?o():o,firstChild:null,schemas:a,consts:f,incompleteFirstPass:!1}}function ws(t,e,n){for(let r in t)if(t.hasOwnProperty(r)){const s=t[r];(n=null===n?{}:n).hasOwnProperty(r)?n[r].push(e,s):n[r]=[e,s]}return n}function bs(t,e,n,r,s,i,o,l){const a=ye(e,n);let u,c=e.inputs;var h;!l&&null!=c&&(u=c[r])?(Zs(t,n,u,r,s),ne(e)&&function(t,e){const n=we(e,t);16&n[2]||(n[2]|=64)}(n,e.index)):3&e.type&&(r="class"===(h=r)?"className":"for"===h?"htmlFor":"formaction"===h?"formAction":"innerHtml"===h?"innerHTML":"readonly"===h?"readOnly":"tabindex"===h?"tabIndex":h,s=null!=o?o(s,e.value||"",r):s,pe(i)?i.setProperty(a,r,s):cn(r)||(a.setProperty?a.setProperty(r,s):a[r]=s))}function Cs(t,e,n,r){let s=!1;if(Ae()){const i=function(t,e,n){const r=t.directiveRegistry;let s=null;if(r)for(let i=0;i<r.length;i++){const o=r[i];Yr(n,o.selectors,!1)&&(s||(s=[]),xn(vn(n,e),t,o.type),se(o)?(Ss(t,n),s.unshift(o)):s.push(o))}return s}(t,e,n),o=null===r?null:{"":-1};if(null!==i){s=!0,As(n,t.data.length,i.length);for(let t=0;t<i.length;t++){const e=i[t];e.providersResolver&&e.providersResolver(e)}let r=!1,l=!1,a=hs(t,e,i.length,null);for(let s=0;s<i.length;s++){const u=i[s];n.mergedAttrs=hn(n.mergedAttrs,u.hostAttrs),Ts(t,n,e,a,u),ks(a,u,o),null!==u.contentQueries&&(n.flags|=8),null===u.hostBindings&&null===u.hostAttrs&&0===u.hostVars||(n.flags|=128);const c=u.type.prototype;!r&&(c.ngOnChanges||c.ngOnInit||c.ngDoCheck)&&((t.preOrderHooks||(t.preOrderHooks=[])).push(n.index),r=!0),l||!c.ngOnChanges&&!c.ngDoCheck||((t.preOrderCheckHooks||(t.preOrderCheckHooks=[])).push(n.index),l=!0),a++}!function(t,e){const n=e.directiveEnd,r=t.data,s=e.attrs,i=[];let o=null,l=null;for(let a=e.directiveStart;a<n;a++){const t=r[a],n=t.inputs,u=null===s||Zr(e)?null:Os(n,s);i.push(u),o=ws(n,a,o),l=ws(t.outputs,a,l)}null!==o&&(o.hasOwnProperty("class")&&(e.flags|=16),o.hasOwnProperty("style")&&(e.flags|=32)),e.initialInputs=i,e.inputs=o,e.outputs=l}(t,n)}o&&function(t,e,n){if(e){const r=t.localNames=[];for(let t=0;t<e.length;t+=2){const s=n[e[t+1]];if(null==s)throw new lt("301",`Export of name '${e[t+1]}' not found!`);r.push(e[t],s)}}}(n,r,o)}return n.mergedAttrs=hn(n.mergedAttrs,n.attrs),s}function xs(t,e,n,r,s,i){const o=i.hostBindings;if(o){let n=t.hostBindingOpCodes;null===n&&(n=t.hostBindingOpCodes=[]);const i=~e.index;(function(t){let e=t.length;for(;e>0;){const n=t[--e];if("number"==typeof n&&n<0)return n}return 0})(n)!=i&&n.push(i),n.push(r,s,o)}}function Es(t,e){null!==t.hostBindings&&t.hostBindings(1,e)}function Ss(t,e){e.flags|=2,(t.components||(t.components=[])).push(e.index)}function ks(t,e,n){if(n){if(e.exportAs)for(let r=0;r<e.exportAs.length;r++)n[e.exportAs[r]]=t;se(e)&&(n[""]=t)}}function As(t,e,n){t.flags|=1,t.directiveStart=e,t.directiveEnd=e+n,t.providerIndexes=e}function Ts(t,e,n,r,s){t.data[r]=s;const i=s.factory||(s.factory=ie(s.type)),o=new an(i,se(s),null);t.blueprint[r]=o,n[r]=o,xs(t,e,0,r,hs(t,n,s.hostVars,Jr),s)}function Is(t,e,n){const r=ye(e,t),s=ys(n),i=t[10],o=Rs(t,us(t,s,null,n.onPush?64:16,r,e,i,i.createRenderer(r,n),null,null));t[e.index]=o}function Vs(t,e,n,r,s,i){const o=i[e];if(null!==o){const t=r.setInput;for(let e=0;e<o.length;){const s=o[e++],i=o[e++],l=o[e++];null!==t?r.setInput(n,l,s,i):n[i]=l}}}function Os(t,e){let n=null,r=0;for(;r<e.length;){const s=e[r];if(0!==s)if(5!==s){if("number"==typeof s)break;t.hasOwnProperty(s)&&(null===n&&(n=[]),n.push(s,t[s],e[r+1])),r+=2}else r+=2;else r+=4}return n}function Ms(t,e,n,r){return new Array(t,!0,!1,e,null,0,r,n,null,null)}function Ds(t,e){const n=we(e,t);if(Ce(n)){const t=n[1];80&n[2]?fs(t,n,t.template,n[8]):n[5]>0&&Ns(n)}}function Ns(t){for(let n=wr(t);null!==n;n=br(n))for(let t=Xt;t<n.length;t++){const e=n[t];if(1024&e[2]){const t=e[1];fs(t,e,t.template,e[8])}else e[5]>0&&Ns(e)}const e=t[1].components;if(null!==e)for(let n=0;n<e.length;n++){const r=we(e[n],t);Ce(r)&&r[5]>0&&Ns(r)}}function Ps(t,e){const n=we(e,t),r=n[1];!function(t,e){for(let n=e.length;n<t.blueprint.length;n++)e.push(t.blueprint[n])}(r,n),ds(r,n,n[8])}function Rs(t,e){return t[13]?t[14][4]=e:t[13]=e,t[14]=e,e}function js(t){for(;t;){t[2]|=64;const e=vr(t);if(0!=(512&t[2])&&!e)return t;t=e}return null}function Fs(t,e,n){const r=e[10];r.begin&&r.begin();try{fs(t,e,t.template,n)}catch(s){throw $s(e,s),s}finally{r.end&&r.end()}}function Hs(t){!function(t){for(let e=0;e<t.components.length;e++){const n=t.components[e],r=be(n),s=r[1];ps(s,r,s.template,n)}}(t[8])}function zs(t,e,n){ze(0),e(t,n)}const Ls=(()=>Promise.resolve(null))();function Bs(t){return t[7]||(t[7]=[])}function Ws(t){return t.cleanup||(t.cleanup=[])}function $s(t,e){const n=t[9],r=n?n.get(fr,null):null;r&&r.handleError(e)}function Zs(t,e,n,r,s){for(let i=0;i<n.length;){const o=n[i++],l=n[i++],a=e[o],u=t.data[o];null!==u.setInput?u.setInput(a,s,r,l):a[l]=s}}function Us(t,e,n){let r=n?t.styles:null,s=n?t.classes:null,i=0;if(null!==e)for(let o=0;o<e.length;o++){const t=e[o];"number"==typeof t?i=t:1==i?s=nt(s,t):2==i&&(r=nt(r,t+": "+e[++o]+";"))}n?t.styles=r:t.stylesWithoutHost=r,n?t.classes=s:t.classesWithoutHost=s}const qs=new Fn("INJECTOR",-1);class Gs{get(t,e=Zn){if(e===Zn){const e=new Error(`NullInjectorError: No provider for ${et(t)}!`);throw e.name="NullInjectorError",e}return e}}const Qs=new Fn("Set Injector scope."),Ys={},Ks={},Xs=[];let Js;function ti(){return void 0===Js&&(Js=new Gs),Js}function ei(t,e=null,n=null,r){return new ni(t,n,e||ti(),r)}class ni{constructor(t,e,n,r=null){this.parent=n,this.records=new Map,this.injectorDefTypes=new Set,this.onDestroy=new Set,this._destroyed=!1;const s=[];e&&Hn(e,n=>this.processProvider(n,t,e)),Hn([t],t=>this.processInjectorType(t,[],s)),this.records.set(qs,ii(void 0,this));const i=this.records.get(Qs);this.scope=null!=i?i.value:null,this.source=r||("object"==typeof t?null:et(t))}get destroyed(){return this._destroyed}destroy(){this.assertNotDestroyed(),this._destroyed=!0;try{this.onDestroy.forEach(t=>t.ngOnDestroy())}finally{this.records.clear(),this.onDestroy.clear(),this.injectorDefTypes.clear()}}get(t,e=Zn,n=wt.Default){this.assertNotDestroyed();const r=Yn(this);try{if(!(n&wt.SkipSelf)){let e=this.records.get(t);if(void 0===e){const n=("function"==typeof(s=t)||"object"==typeof s&&s instanceof Fn)&&ft(t);e=n&&this.injectableDefInScope(n)?ii(ri(t),Ys):null,this.records.set(t,e)}if(null!=e)return this.hydrate(t,e)}return(n&wt.Self?ti():this.parent).get(t,e=n&wt.Optional&&e===Zn?null:e)}catch(i){if("NullInjectorError"===i.name){if((i.ngTempTokenPath=i.ngTempTokenPath||[]).unshift(et(t)),r)throw i;return function(t,e,n,r){const s=t.ngTempTokenPath;throw e[qn]&&s.unshift(e[qn]),t.message=function(t,e,n,r=null){t=t&&"\n"===t.charAt(0)&&"\u0275"==t.charAt(1)?t.substr(2):t;let s=et(e);if(Array.isArray(e))s=e.map(et).join(" -> ");else if("object"==typeof e){let t=[];for(let n in e)if(e.hasOwnProperty(n)){let r=e[n];t.push(n+":"+("string"==typeof r?JSON.stringify(r):et(r)))}s=`{${t.join(", ")}}`}return`${n}${r?"("+r+")":""}[${s}]: ${t.replace(Un,"\n ")}`}("\n"+t.message,s,n,r),t.ngTokenPath=s,t.ngTempTokenPath=null,t}(i,t,"R3InjectorError",this.source)}throw i}finally{Yn(r)}var s}_resolveInjectorDefTypes(){this.injectorDefTypes.forEach(t=>this.get(t))}toString(){const t=[];return this.records.forEach((e,n)=>t.push(et(n))),`R3Injector[${t.join(", ")}]`}assertNotDestroyed(){if(this._destroyed)throw new Error("Injector has already been destroyed.")}processInjectorType(t,e,n){if(!(t=it(t)))return!1;let r=gt(t);const s=null==r&&t.ngModule||void 0,i=void 0===s?t:s,o=-1!==n.indexOf(i);if(void 0!==s&&(r=gt(s)),null==r)return!1;if(null!=r.imports&&!o){let t;n.push(i);try{Hn(r.imports,r=>{this.processInjectorType(r,e,n)&&(void 0===t&&(t=[]),t.push(r))})}finally{}if(void 0!==t)for(let e=0;e<t.length;e++){const{ngModule:n,providers:r}=t[e];Hn(r,t=>this.processProvider(t,n,r||Xs))}}this.injectorDefTypes.add(i),this.records.set(i,ii(r.factory,Ys));const l=r.providers;if(null!=l&&!o){const e=t;Hn(l,t=>this.processProvider(t,e,l))}return void 0!==s&&void 0!==t.providers}processProvider(t,e,n){let r=li(t=it(t))?t:it(t&&t.provide);const s=function(t,e,n){return oi(t)?ii(void 0,t.useValue):ii(si(t),Ys)}(t);if(li(t)||!0!==t.multi)this.records.get(r);else{let e=this.records.get(r);e||(e=ii(void 0,Ys,!0),e.factory=()=>Jn(e.multi),this.records.set(r,e)),r=t,e.multi.push(t)}this.records.set(r,s)}hydrate(t,e){var n;return e.value===Ys&&(e.value=Ks,e.value=e.factory()),"object"==typeof e.value&&e.value&&null!==(n=e.value)&&"object"==typeof n&&"function"==typeof n.ngOnDestroy&&this.onDestroy.add(e.value),e.value}injectableDefInScope(t){return!!t.providedIn&&("string"==typeof t.providedIn?"any"===t.providedIn||t.providedIn===this.scope:this.injectorDefTypes.has(t.providedIn))}}function ri(t){const e=ft(t),n=null!==e?e.factory:ie(t);if(null!==n)return n;const r=gt(t);if(null!==r)return r.factory;if(t instanceof Fn)throw new Error(`Token ${et(t)} is missing a \u0275prov definition.`);if(t instanceof Function)return function(t){const e=t.length;if(e>0){const n=function(t,e){const n=[];for(let r=0;r<t;r++)n.push("?");return n}(e);throw new Error(`Can't resolve all parameters for ${et(t)}: (${n.join(", ")}).`)}const n=function(t){const e=t&&(t[_t]||t[yt]);if(e){const n=function(t){if(t.hasOwnProperty("name"))return t.name;const e=(""+t).match(/^function\s*([^\s(]+)/);return null===e?"":e[1]}(t);return console.warn(`DEPRECATED: DI is instantiating a token "${n}" that inherits its @Injectable decorator but does not provide one itself.\nThis will become an error in a future version of Angular. Please add @Injectable() to the "${n}" class.`),e}return null}(t);return null!==n?()=>n.factory(t):()=>new t}(t);throw new Error("unreachable")}function si(t,e,n){let r;if(li(t)){const e=it(t);return ie(e)||ri(e)}if(oi(t))r=()=>it(t.useValue);else if((s=t)&&s.useFactory)r=()=>t.useFactory(...Jn(t.deps||[]));else if(function(t){return!(!t||!t.useExisting)}(t))r=()=>Xn(it(t.useExisting));else{const e=it(t&&(t.useClass||t.provide));if(!function(t){return!!t.deps}(t))return ie(e)||ri(e);r=()=>new e(...Jn(t.deps))}var s;return r}function ii(t,e,n=!1){return{factory:t,value:e,multi:n?[]:void 0}}function oi(t){return null!==t&&"object"==typeof t&&Gn in t}function li(t){return"function"==typeof t}const ai=function(t,e,n){return function(t,e=null,n=null,r){const s=ei(t,e,n,r);return s._resolveInjectorDefTypes(),s}({name:n},e,t,n)};let ui=(()=>{class t{static create(t,e){return Array.isArray(t)?ai(t,e,""):ai(t.providers,t.parent,t.name||"")}}return t.THROW_IF_NOT_FOUND=Zn,t.NULL=new Gs,t.\u0275prov=ht({token:t,providedIn:"any",factory:()=>Xn(qs)}),t.__NG_ELEMENT_ID__=-1,t})();function ci(t,e){tn(be(t)[1],Oe())}function hi(t){let e=Object.getPrototypeOf(t.type.prototype).constructor,n=!0;const r=[t];for(;e;){let s;if(se(t))s=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new Error("Directives cannot inherit Components");s=e.\u0275dir}if(s){if(n){r.push(s);const e=t;e.inputs=di(t.inputs),e.declaredInputs=di(t.declaredInputs),e.outputs=di(t.outputs);const n=s.hostBindings;n&&gi(t,n);const i=s.viewQuery,o=s.contentQueries;if(i&&fi(t,i),o&&pi(t,o),tt(t.inputs,s.inputs),tt(t.declaredInputs,s.declaredInputs),tt(t.outputs,s.outputs),se(s)&&s.data.animation){const e=t.data;e.animation=(e.animation||[]).concat(s.data.animation)}}const e=s.features;if(e)for(let r=0;r<e.length;r++){const s=e[r];s&&s.ngInherit&&s(t),s===hi&&(n=!1)}}e=Object.getPrototypeOf(e)}!function(t){let e=0,n=null;for(let r=t.length-1;r>=0;r--){const s=t[r];s.hostVars=e+=s.hostVars,s.hostAttrs=hn(s.hostAttrs,n=hn(n,s.hostAttrs))}}(r)}function di(t){return t===Mt?{}:t===Dt?[]:t}function fi(t,e){const n=t.viewQuery;t.viewQuery=n?(t,r)=>{e(t,r),n(t,r)}:e}function pi(t,e){const n=t.contentQueries;t.contentQueries=n?(t,r,s)=>{e(t,r,s),n(t,r,s)}:e}function gi(t,e){const n=t.hostBindings;t.hostBindings=n?(t,r)=>{e(t,r),n(t,r)}:e}let _i=null;function mi(){if(!_i){const t=Ot.Symbol;if(t&&t.iterator)_i=t.iterator;else{const t=Object.getOwnPropertyNames(Map.prototype);for(let e=0;e<t.length;++e){const n=t[e];"entries"!==n&&"size"!==n&&Map.prototype[n]===Map.prototype.entries&&(_i=n)}}}return _i}function yi(t){return!!vi(t)&&(Array.isArray(t)||!(t instanceof Map)&&mi()in t)}function vi(t){return null!==t&&("function"==typeof t||"object"==typeof t)}function wi(t,e,n){return!Object.is(t[e],n)&&(t[e]=n,!0)}function bi(t,e,n,r){return wi(t,je(),n)?e+at(n)+r:Jr}function Ci(t,e,n,r,s,i,o,l){const a=Te(),u=Ie(),c=t+Kt,h=u.firstCreatePass?function(t,e,n,r,s,i,o,l,a){const u=e.consts,c=cs(e,t,4,o||null,xe(u,l));Cs(e,n,c,xe(u,a)),tn(e,c);const h=c.tViews=vs(2,c,r,s,i,e.directiveRegistry,e.pipeRegistry,null,e.schemas,u);return null!==e.queries&&(e.queries.template(e,c),h.queries=e.queries.embeddedTView(c)),c}(c,u,a,e,n,r,s,i,o):u.data[c];De(h,!1);const d=a[11].createComment("");Dr(u,a,d,h),pr(d,a),Rs(a,a[c]=Ms(d,a,d,h)),re(h)&&_s(u,a,h),null!=o&&ms(a,h,l)}function xi(t,e=wt.Default){const n=Te();return null===n?Xn(t,e):kn(Oe(),n,it(t),e)}function Ei(t,e,n){const r=Te();return wi(r,je(),e)&&bs(Ie(),Ke(),r,t,e,r[11],n,!1),Ei}function Si(t,e,n,r,s){const i=s?"class":"style";Zs(t,n,e.inputs[i],i,r)}function ki(t,e,n,r){const s=Te(),i=Ie(),o=Kt+t,l=s[11],a=s[o]=Er(l,e,ke.lFrame.currentNamespace),u=i.firstCreatePass?function(t,e,n,r,s,i,o){const l=e.consts,a=cs(e,t,2,s,xe(l,i));return Cs(e,n,a,xe(l,o)),null!==a.attrs&&Us(a,a.attrs,!1),null!==a.mergedAttrs&&Us(a,a.mergedAttrs,!0),null!==e.queries&&e.queries.elementStart(e,a),a}(o,i,s,0,e,n,r):i.data[o];De(u,!0);const c=u.mergedAttrs;null!==c&&un(l,a,c);const h=u.classes;null!==h&&Lr(l,a,h);const d=u.styles;null!==d&&zr(l,a,d),64!=(64&u.flags)&&Dr(i,s,a,u),0===ke.lFrame.elementDepthCount&&pr(a,s),ke.lFrame.elementDepthCount++,re(u)&&(_s(i,s,u),function(t,e,n){if(ee(e)){const r=e.directiveEnd;for(let s=e.directiveStart;s<r;s++){const e=t.data[s];e.contentQueries&&e.contentQueries(1,n[s],s)}}}(i,u,s)),null!==r&&ms(s,u)}function Ai(){let t=Oe();Ne()?ke.lFrame.isParent=!1:(t=t.parent,De(t,!1));const e=t;ke.lFrame.elementDepthCount--;const n=Ie();n.firstCreatePass&&(tn(n,t),ee(t)&&n.queries.elementEnd(t)),null!=e.classesWithoutHost&&function(t){return 0!=(16&t.flags)}(e)&&Si(n,e,Te(),e.classesWithoutHost,!0),null!=e.stylesWithoutHost&&function(t){return 0!=(32&t.flags)}(e)&&Si(n,e,Te(),e.stylesWithoutHost,!1)}function Ti(t,e,n,r){ki(t,e,n,r),Ai()}function Ii(){return Te()}function Vi(t){return!!t&&"function"==typeof t.then}function Oi(t,e,n=!1,r){const s=Te(),i=Ie(),o=Oe();return function(t,e,n,r,s,i,o=!1,l){const a=re(r),u=t.firstCreatePass&&Ws(t),c=Bs(e);let h=!0;if(3&r.type){const d=ye(r,e),f=l?l(d):Mt,p=f.target||d,g=c.length,_=l?t=>l(_e(t[r.index])).target:r.index;if(pe(n)){let o=null;if(!l&&a&&(o=function(t,e,n,r){const s=t.cleanup;if(null!=s)for(let i=0;i<s.length-1;i+=2){const t=s[i];if(t===n&&s[i+1]===r){const t=e[7],n=s[i+2];return t.length>n?t[n]:null}"string"==typeof t&&(i+=2)}return null}(t,e,s,r.index)),null!==o)(o.__ngLastListenerFn__||o).__ngNextListenerFn__=i,o.__ngLastListenerFn__=i,h=!1;else{i=Di(r,e,i,!1);const t=n.listen(f.name||p,s,i);c.push(i,t),u&&u.push(s,_,g,g+1)}}else i=Di(r,e,i,!0),p.addEventListener(s,i,o),c.push(i),u&&u.push(s,_,g,o)}else i=Di(r,e,i,!1);const d=r.outputs;let f;if(h&&null!==d&&(f=d[s])){const t=f.length;if(t)for(let n=0;n<t;n+=2){const t=e[f[n]][f[n+1]].subscribe(i),o=c.length;c.push(i,t),u&&u.push(s,r.index,o,-(o+1))}}}(i,s,s[11],o,t,e,n,r),Oi}function Mi(t,e,n){try{return!1!==e(n)}catch(r){return $s(t,r),!1}}function Di(t,e,n,r){return function s(i){if(i===Function)return n;const o=2&t.flags?we(t.index,e):e;0==(32&e[2])&&js(o);let l=Mi(e,n,i),a=s.__ngNextListenerFn__;for(;a;)l=Mi(e,a,i)&&l,a=a.__ngNextListenerFn__;return r&&!1===l&&(i.preventDefault(),i.returnValue=!1),l}}function Ni(t=1){return function(t){return(ke.lFrame.contextLView=function(t,e){for(;t>0;)e=e[15],t--;return e}(t,ke.lFrame.contextLView))[8]}(t)}function Pi(t,e,n,r,s){const i=Te(),o=bi(i,e,n,r);return o!==Jr&&bs(Ie(),Ke(),i,t,o,i[11],s,!1),Pi}const Ri=[];function ji(t,e,n,r,s){const i=t[n+1],o=null===e;let l=r?rs(i):is(i),a=!1;for(;0!==l&&(!1===a||o);){const n=t[l+1];Fi(t[l],e)&&(a=!0,t[l+1]=r?ls(n):ss(n)),l=r?rs(n):is(n)}a&&(t[n+1]=r?ss(i):ls(i))}function Fi(t,e){return null===t||null==e||(Array.isArray(t)?t[1]:t)===e||!(!Array.isArray(t)||"string"!=typeof e)&&$n(t,e)>=0}function Hi(t,e,n){return Li(t,e,n,!1),Hi}function zi(t,e){return Li(t,e,null,!0),zi}function Li(t,e,n,r){const s=Te(),i=Ie(),o=function(t){const e=ke.lFrame,n=e.bindingIndex;return e.bindingIndex=e.bindingIndex+2,n}();i.firstUpdatePass&&function(t,e,n,r){const s=t.data;if(null===s[n+1]){const i=s[Qe()],o=function(t,e){return e>=t.expandoStartIndex}(t,n);(function(t,e){return 0!=(t.flags&(e?16:32))})(i,r)&&null===e&&!o&&(e=!1),e=function(t,e,n,r){const s=function(t){const e=ke.lFrame.currentDirectiveIndex;return-1===e?null:t[e]}(t);let i=r?e.residualClasses:e.residualStyles;if(null===s)0===(r?e.classBindings:e.styleBindings)&&(n=Wi(n=Bi(null,t,e,n,r),e.attrs,r),i=null);else{const o=e.directiveStylingLast;if(-1===o||t[o]!==s)if(n=Bi(s,t,e,n,r),null===i){let n=function(t,e,n){const r=n?e.classBindings:e.styleBindings;if(0!==is(r))return t[rs(r)]}(t,e,r);void 0!==n&&Array.isArray(n)&&(n=Bi(null,t,e,n[1],r),n=Wi(n,e.attrs,r),function(t,e,n,r){t[rs(n?e.classBindings:e.styleBindings)]=r}(t,e,r,n))}else i=function(t,e,n){let r;const s=e.directiveEnd;for(let i=1+e.directiveStylingLast;i<s;i++)r=Wi(r,t[i].hostAttrs,n);return Wi(r,e.attrs,n)}(t,e,r)}return void 0!==i&&(r?e.residualClasses=i:e.residualStyles=i),n}(s,i,e,r),function(t,e,n,r,s,i){let o=i?e.classBindings:e.styleBindings,l=rs(o),a=is(o);t[r]=n;let u,c=!1;if(Array.isArray(n)){const t=n;u=t[1],(null===u||$n(t,u)>0)&&(c=!0)}else u=n;if(s)if(0!==a){const e=rs(t[l+1]);t[r+1]=ns(e,l),0!==e&&(t[e+1]=os(t[e+1],r)),t[l+1]=131071&t[l+1]|r<<17}else t[r+1]=ns(l,0),0!==l&&(t[l+1]=os(t[l+1],r)),l=r;else t[r+1]=ns(a,0),0===l?l=r:t[a+1]=os(t[a+1],r),a=r;c&&(t[r+1]=ss(t[r+1])),ji(t,u,r,!0),ji(t,u,r,!1),function(t,e,n,r,s){const i=s?t.residualClasses:t.residualStyles;null!=i&&"string"==typeof e&&$n(i,e)>=0&&(n[r+1]=ls(n[r+1]))}(e,u,t,r,i),o=ns(l,a),i?e.classBindings=o:e.styleBindings=o}(s,i,e,n,o,r)}}(i,t,o,r),e!==Jr&&wi(s,o,e)&&function(t,e,n,r,s,i,o,l){if(!(3&e.type))return;const a=t.data,u=a[l+1];Zi(1==(1&u)?$i(a,e,n,s,is(u),o):void 0)||(Zi(i)||function(t){return 2==(2&t)}(u)&&(i=$i(a,null,n,s,l,o)),function(t,e,n,r,s){const i=pe(t);if(e)s?i?t.addClass(n,r):n.classList.add(r):i?t.removeClass(n,r):n.classList.remove(r);else{let e=-1===r.indexOf("-")?void 0:mr.DashCase;if(null==s)i?t.removeStyle(n,r,e):n.style.removeProperty(r);else{const o="string"==typeof s&&s.endsWith("!important");o&&(s=s.slice(0,-10),e|=mr.Important),i?t.setStyle(n,r,s,e):n.style.setProperty(r,s,o?"important":"")}}}(r,o,me(Qe(),n),s,i))}(i,i.data[Qe()],s,s[11],t,s[o+1]=function(t,e){return null==t||("string"==typeof e?t+=e:"object"==typeof t&&(t=et(ir(t)))),t}(e,n),r,o)}function Bi(t,e,n,r,s){let i=null;const o=n.directiveEnd;let l=n.directiveStylingLast;for(-1===l?l=n.directiveStart:l++;l<o&&(i=e[l],r=Wi(r,i.hostAttrs,s),i!==t);)l++;return null!==t&&(n.directiveStylingLast=l),r}function Wi(t,e,n){const r=n?1:2;let s=-1;if(null!==e)for(let i=0;i<e.length;i++){const o=e[i];"number"==typeof o?s=o:s===r&&(Array.isArray(t)||(t=void 0===t?[]:["",t]),Bn(t,o,!!n||e[++i]))}return void 0===t?null:t}function $i(t,e,n,r,s,i){const o=null===e;let l;for(;s>0;){const e=t[s],i=Array.isArray(e),a=i?e[1]:e,u=null===a;let c=n[s+1];c===Jr&&(c=u?Ri:void 0);let h=u?Wn(c,r):a===r?c:void 0;if(i&&!Zi(h)&&(h=Wn(e,r)),Zi(h)&&(l=h,o))return l;const d=t[s+1];s=o?rs(d):is(d)}if(null!==e){let t=i?e.residualClasses:e.residualStyles;null!=t&&(l=Wn(t,r))}return l}function Zi(t){return void 0!==t}function Ui(t,e=""){const n=Te(),r=Ie(),s=t+Kt,i=r.firstCreatePass?cs(r,s,1,e,null):r.data[s],o=n[s]=function(t,e){return pe(t)?t.createText(e):t.createTextNode(e)}(n[11],e);Dr(r,n,o,i),De(i,!1)}function qi(t){return Gi("",t,""),qi}function Gi(t,e,n){const r=Te(),s=bi(r,t,e,n);return s!==Jr&&function(t,e,n){const r=me(e,t);!function(t,e,n){pe(t)?t.setValue(e,n):e.textContent=n}(t[11],r,n)}(r,Qe(),s),Gi}const Qi=void 0;var Yi=["en",[["a","p"],["AM","PM"],Qi],[["AM","PM"],Qi,Qi],[["S","M","T","W","T","F","S"],["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],["Su","Mo","Tu","We","Th","Fr","Sa"]],Qi,[["J","F","M","A","M","J","J","A","S","O","N","D"],["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],["January","February","March","April","May","June","July","August","September","October","November","December"]],Qi,[["B","A"],["BC","AD"],["Before Christ","Anno Domini"]],0,[6,0],["M/d/yy","MMM d, y","MMMM d, y","EEEE, MMMM d, y"],["h:mm a","h:mm:ss a","h:mm:ss a z","h:mm:ss a zzzz"],["{1}, {0}",Qi,"{1} 'at' {0}",Qi],[".",",",";","%","+","-","E","\xd7","\u2030","\u221e","NaN",":"],["#,##0.###","#,##0%","\xa4#,##0.00","#E0"],"USD","$","US Dollar",{},"ltr",function(t){let e=Math.floor(Math.abs(t)),n=t.toString().replace(/^[^.]*\.?/,"").length;return 1===e&&0===n?1:5}];let Ki={};function Xi(t){return t in Ki||(Ki[t]=Ot.ng&&Ot.ng.common&&Ot.ng.common.locales&&Ot.ng.common.locales[t]),Ki[t]}var Ji=function(t){return t[t.LocaleId=0]="LocaleId",t[t.DayPeriodsFormat=1]="DayPeriodsFormat",t[t.DayPeriodsStandalone=2]="DayPeriodsStandalone",t[t.DaysFormat=3]="DaysFormat",t[t.DaysStandalone=4]="DaysStandalone",t[t.MonthsFormat=5]="MonthsFormat",t[t.MonthsStandalone=6]="MonthsStandalone",t[t.Eras=7]="Eras",t[t.FirstDayOfWeek=8]="FirstDayOfWeek",t[t.WeekendRange=9]="WeekendRange",t[t.DateFormat=10]="DateFormat",t[t.TimeFormat=11]="TimeFormat",t[t.DateTimeFormat=12]="DateTimeFormat",t[t.NumberSymbols=13]="NumberSymbols",t[t.NumberFormats=14]="NumberFormats",t[t.CurrencyCode=15]="CurrencyCode",t[t.CurrencySymbol=16]="CurrencySymbol",t[t.CurrencyName=17]="CurrencyName",t[t.Currencies=18]="Currencies",t[t.Directionality=19]="Directionality",t[t.PluralCase=20]="PluralCase",t[t.ExtraData=21]="ExtraData",t}({});const to="en-US";let eo=to;function no(t){var e,n;n="Expected localeId to be defined",null==(e=t)&&function(t,e,n,r){throw new Error(`ASSERTION ERROR: ${t} [Expected=> null != ${e} <=Actual]`)}(n,e),"string"==typeof t&&(eo=t.toLowerCase().replace(/_/g,"-"))}function ro(t,e,n,r,s){if(t=it(t),Array.isArray(t))for(let i=0;i<t.length;i++)ro(t[i],e,n,r,s);else{const i=Ie(),o=Te();let l=li(t)?t:it(t.provide),a=si(t);const u=Oe(),c=1048575&u.providerIndexes,h=u.directiveStart,d=u.providerIndexes>>20;if(li(t)||!t.multi){const r=new an(a,s,xi),f=oo(l,e,s?c:c+d,h);-1===f?(xn(vn(u,o),i,l),so(i,t,e.length),e.push(l),u.directiveStart++,u.directiveEnd++,s&&(u.providerIndexes+=1048576),n.push(r),o.push(r)):(n[f]=r,o[f]=r)}else{const f=oo(l,e,c+d,h),p=oo(l,e,c,c+d),g=f>=0&&n[f],_=p>=0&&n[p];if(s&&!_||!s&&!g){xn(vn(u,o),i,l);const c=function(t,e,n,r,s){const i=new an(t,n,xi);return i.multi=[],i.index=e,i.componentProviders=0,io(i,s,r&&!n),i}(s?ao:lo,n.length,s,r,a);!s&&_&&(n[p].providerFactory=c),so(i,t,e.length,0),e.push(l),u.directiveStart++,u.directiveEnd++,s&&(u.providerIndexes+=1048576),n.push(c),o.push(c)}else so(i,t,f>-1?f:p,io(n[s?p:f],a,!s&&r));!s&&r&&_&&n[p].componentProviders++}}}function so(t,e,n,r){const s=li(e);if(s||e.useClass){const i=(e.useClass||e).prototype.ngOnDestroy;if(i){const o=t.destroyHooks||(t.destroyHooks=[]);if(!s&&e.multi){const t=o.indexOf(n);-1===t?o.push(n,[r,i]):o[t+1].push(r,i)}else o.push(n,i)}}}function io(t,e,n){return n&&t.componentProviders++,t.multi.push(e)-1}function oo(t,e,n,r){for(let s=n;s<r;s++)if(e[s]===t)return s;return-1}function lo(t,e,n,r){return uo(this.multi,[])}function ao(t,e,n,r){const s=this.multi;let i;if(this.providerFactory){const t=this.providerFactory.componentProviders,e=Vn(n,n[1],this.providerFactory.index,r);i=e.slice(0,t),uo(s,i);for(let n=t;n<e.length;n++)i.push(e[n])}else i=[],uo(s,i);return i}function uo(t,e){for(let n=0;n<t.length;n++)e.push((0,t[n])());return e}function co(t,e=[]){return n=>{n.providersResolver=(n,r)=>function(t,e,n){const r=Ie();if(r.firstCreatePass){const s=se(t);ro(n,r.data,r.blueprint,s,!0),ro(e,r.data,r.blueprint,s,!1)}}(n,r?r(t):t,e)}}class ho{}class fo{resolveComponentFactory(t){throw function(t){const e=Error(`No component factory found for ${et(t)}. Did you add it to @NgModule.entryComponents?`);return e.ngComponent=t,e}(t)}}let po=(()=>{class t{}return t.NULL=new fo,t})();function go(...t){}function _o(t,e){return new yo(ye(t,e))}const mo=function(){return _o(Oe(),Te())};let yo=(()=>{class t{constructor(t){this.nativeElement=t}}return t.__NG_ELEMENT_ID__=mo,t})();class vo{}let wo=(()=>{class t{}return t.__NG_ELEMENT_ID__=()=>bo(),t})();const bo=function(){const t=Te(),e=we(Oe().index,t);return function(t){return t[11]}(Jt(e)?e:t)};let Co=(()=>{class t{}return t.\u0275prov=ht({token:t,providedIn:"root",factory:()=>null}),t})();class xo{constructor(t){this.full=t,this.major=t.split(".")[0],this.minor=t.split(".")[1],this.patch=t.split(".").slice(2).join(".")}}const Eo=new xo("11.2.3");class So{constructor(){}supports(t){return yi(t)}create(t){return new Ao(t)}}const ko=(t,e)=>e;class Ao{constructor(t){this.length=0,this._linkedRecords=null,this._unlinkedRecords=null,this._previousItHead=null,this._itHead=null,this._itTail=null,this._additionsHead=null,this._additionsTail=null,this._movesHead=null,this._movesTail=null,this._removalsHead=null,this._removalsTail=null,this._identityChangesHead=null,this._identityChangesTail=null,this._trackByFn=t||ko}forEachItem(t){let e;for(e=this._itHead;null!==e;e=e._next)t(e)}forEachOperation(t){let e=this._itHead,n=this._removalsHead,r=0,s=null;for(;e||n;){const i=!n||e&&e.currentIndex<Oo(n,r,s)?e:n,o=Oo(i,r,s),l=i.currentIndex;if(i===n)r--,n=n._nextRemoved;else if(e=e._next,null==i.previousIndex)r++;else{s||(s=[]);const t=o-r,e=l-r;if(t!=e){for(let n=0;n<t;n++){const r=n<s.length?s[n]:s[n]=0,i=r+n;e<=i&&i<t&&(s[n]=r+1)}s[i.previousIndex]=e-t}}o!==l&&t(i,o,l)}}forEachPreviousItem(t){let e;for(e=this._previousItHead;null!==e;e=e._nextPrevious)t(e)}forEachAddedItem(t){let e;for(e=this._additionsHead;null!==e;e=e._nextAdded)t(e)}forEachMovedItem(t){let e;for(e=this._movesHead;null!==e;e=e._nextMoved)t(e)}forEachRemovedItem(t){let e;for(e=this._removalsHead;null!==e;e=e._nextRemoved)t(e)}forEachIdentityChange(t){let e;for(e=this._identityChangesHead;null!==e;e=e._nextIdentityChange)t(e)}diff(t){if(null==t&&(t=[]),!yi(t))throw new Error(`Error trying to diff '${et(t)}'. Only arrays and iterables are allowed`);return this.check(t)?this:null}onDestroy(){}check(t){this._reset();let e,n,r,s=this._itHead,i=!1;if(Array.isArray(t)){this.length=t.length;for(let e=0;e<this.length;e++)n=t[e],r=this._trackByFn(e,n),null!==s&&Object.is(s.trackById,r)?(i&&(s=this._verifyReinsertion(s,n,r,e)),Object.is(s.item,n)||this._addIdentityChange(s,n)):(s=this._mismatch(s,n,r,e),i=!0),s=s._next}else e=0,function(t,e){if(Array.isArray(t))for(let n=0;n<t.length;n++)e(t[n]);else{const n=t[mi()]();let r;for(;!(r=n.next()).done;)e(r.value)}}(t,t=>{r=this._trackByFn(e,t),null!==s&&Object.is(s.trackById,r)?(i&&(s=this._verifyReinsertion(s,t,r,e)),Object.is(s.item,t)||this._addIdentityChange(s,t)):(s=this._mismatch(s,t,r,e),i=!0),s=s._next,e++}),this.length=e;return this._truncate(s),this.collection=t,this.isDirty}get isDirty(){return null!==this._additionsHead||null!==this._movesHead||null!==this._removalsHead||null!==this._identityChangesHead}_reset(){if(this.isDirty){let t;for(t=this._previousItHead=this._itHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._additionsHead;null!==t;t=t._nextAdded)t.previousIndex=t.currentIndex;for(this._additionsHead=this._additionsTail=null,t=this._movesHead;null!==t;t=t._nextMoved)t.previousIndex=t.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(t,e,n,r){let s;return null===t?s=this._itTail:(s=t._prev,this._remove(t)),null!==(t=null===this._unlinkedRecords?null:this._unlinkedRecords.get(n,null))?(Object.is(t.item,e)||this._addIdentityChange(t,e),this._reinsertAfter(t,s,r)):null!==(t=null===this._linkedRecords?null:this._linkedRecords.get(n,r))?(Object.is(t.item,e)||this._addIdentityChange(t,e),this._moveAfter(t,s,r)):t=this._addAfter(new To(e,n),s,r),t}_verifyReinsertion(t,e,n,r){let s=null===this._unlinkedRecords?null:this._unlinkedRecords.get(n,null);return null!==s?t=this._reinsertAfter(s,t._prev,r):t.currentIndex!=r&&(t.currentIndex=r,this._addToMoves(t,r)),t}_truncate(t){for(;null!==t;){const e=t._next;this._addToRemovals(this._unlink(t)),t=e}null!==this._unlinkedRecords&&this._unlinkedRecords.clear(),null!==this._additionsTail&&(this._additionsTail._nextAdded=null),null!==this._movesTail&&(this._movesTail._nextMoved=null),null!==this._itTail&&(this._itTail._next=null),null!==this._removalsTail&&(this._removalsTail._nextRemoved=null),null!==this._identityChangesTail&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(t,e,n){null!==this._unlinkedRecords&&this._unlinkedRecords.remove(t);const r=t._prevRemoved,s=t._nextRemoved;return null===r?this._removalsHead=s:r._nextRemoved=s,null===s?this._removalsTail=r:s._prevRemoved=r,this._insertAfter(t,e,n),this._addToMoves(t,n),t}_moveAfter(t,e,n){return this._unlink(t),this._insertAfter(t,e,n),this._addToMoves(t,n),t}_addAfter(t,e,n){return this._insertAfter(t,e,n),this._additionsTail=null===this._additionsTail?this._additionsHead=t:this._additionsTail._nextAdded=t,t}_insertAfter(t,e,n){const r=null===e?this._itHead:e._next;return t._next=r,t._prev=e,null===r?this._itTail=t:r._prev=t,null===e?this._itHead=t:e._next=t,null===this._linkedRecords&&(this._linkedRecords=new Vo),this._linkedRecords.put(t),t.currentIndex=n,t}_remove(t){return this._addToRemovals(this._unlink(t))}_unlink(t){null!==this._linkedRecords&&this._linkedRecords.remove(t);const e=t._prev,n=t._next;return null===e?this._itHead=n:e._next=n,null===n?this._itTail=e:n._prev=e,t}_addToMoves(t,e){return t.previousIndex===e||(this._movesTail=null===this._movesTail?this._movesHead=t:this._movesTail._nextMoved=t),t}_addToRemovals(t){return null===this._unlinkedRecords&&(this._unlinkedRecords=new Vo),this._unlinkedRecords.put(t),t.currentIndex=null,t._nextRemoved=null,null===this._removalsTail?(this._removalsTail=this._removalsHead=t,t._prevRemoved=null):(t._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=t),t}_addIdentityChange(t,e){return t.item=e,this._identityChangesTail=null===this._identityChangesTail?this._identityChangesHead=t:this._identityChangesTail._nextIdentityChange=t,t}}class To{constructor(t,e){this.item=t,this.trackById=e,this.currentIndex=null,this.previousIndex=null,this._nextPrevious=null,this._prev=null,this._next=null,this._prevDup=null,this._nextDup=null,this._prevRemoved=null,this._nextRemoved=null,this._nextAdded=null,this._nextMoved=null,this._nextIdentityChange=null}}class Io{constructor(){this._head=null,this._tail=null}add(t){null===this._head?(this._head=this._tail=t,t._nextDup=null,t._prevDup=null):(this._tail._nextDup=t,t._prevDup=this._tail,t._nextDup=null,this._tail=t)}get(t,e){let n;for(n=this._head;null!==n;n=n._nextDup)if((null===e||e<=n.currentIndex)&&Object.is(n.trackById,t))return n;return null}remove(t){const e=t._prevDup,n=t._nextDup;return null===e?this._head=n:e._nextDup=n,null===n?this._tail=e:n._prevDup=e,null===this._head}}class Vo{constructor(){this.map=new Map}put(t){const e=t.trackById;let n=this.map.get(e);n||(n=new Io,this.map.set(e,n)),n.add(t)}get(t,e){const n=this.map.get(t);return n?n.get(t,e):null}remove(t){const e=t.trackById;return this.map.get(e).remove(t)&&this.map.delete(e),t}get isEmpty(){return 0===this.map.size}clear(){this.map.clear()}}function Oo(t,e,n){const r=t.previousIndex;if(null===r)return r;let s=0;return n&&r<n.length&&(s=n[r]),r+e+s}class Mo{constructor(){}supports(t){return t instanceof Map||vi(t)}create(){return new Do}}class Do{constructor(){this._records=new Map,this._mapHead=null,this._appendAfter=null,this._previousMapHead=null,this._changesHead=null,this._changesTail=null,this._additionsHead=null,this._additionsTail=null,this._removalsHead=null,this._removalsTail=null}get isDirty(){return null!==this._additionsHead||null!==this._changesHead||null!==this._removalsHead}forEachItem(t){let e;for(e=this._mapHead;null!==e;e=e._next)t(e)}forEachPreviousItem(t){let e;for(e=this._previousMapHead;null!==e;e=e._nextPrevious)t(e)}forEachChangedItem(t){let e;for(e=this._changesHead;null!==e;e=e._nextChanged)t(e)}forEachAddedItem(t){let e;for(e=this._additionsHead;null!==e;e=e._nextAdded)t(e)}forEachRemovedItem(t){let e;for(e=this._removalsHead;null!==e;e=e._nextRemoved)t(e)}diff(t){if(t){if(!(t instanceof Map||vi(t)))throw new Error(`Error trying to diff '${et(t)}'. Only maps and objects are allowed`)}else t=new Map;return this.check(t)?this:null}onDestroy(){}check(t){this._reset();let e=this._mapHead;if(this._appendAfter=null,this._forEach(t,(t,n)=>{if(e&&e.key===n)this._maybeAddToChanges(e,t),this._appendAfter=e,e=e._next;else{const r=this._getOrCreateRecordForKey(n,t);e=this._insertBeforeOrAppend(e,r)}}),e){e._prev&&(e._prev._next=null),this._removalsHead=e;for(let t=e;null!==t;t=t._nextRemoved)t===this._mapHead&&(this._mapHead=null),this._records.delete(t.key),t._nextRemoved=t._next,t.previousValue=t.currentValue,t.currentValue=null,t._prev=null,t._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(t,e){if(t){const n=t._prev;return e._next=t,e._prev=n,t._prev=e,n&&(n._next=e),t===this._mapHead&&(this._mapHead=e),this._appendAfter=t,t}return this._appendAfter?(this._appendAfter._next=e,e._prev=this._appendAfter):this._mapHead=e,this._appendAfter=e,null}_getOrCreateRecordForKey(t,e){if(this._records.has(t)){const n=this._records.get(t);this._maybeAddToChanges(n,e);const r=n._prev,s=n._next;return r&&(r._next=s),s&&(s._prev=r),n._next=null,n._prev=null,n}const n=new No(t);return this._records.set(t,n),n.currentValue=e,this._addToAdditions(n),n}_reset(){if(this.isDirty){let t;for(this._previousMapHead=this._mapHead,t=this._previousMapHead;null!==t;t=t._next)t._nextPrevious=t._next;for(t=this._changesHead;null!==t;t=t._nextChanged)t.previousValue=t.currentValue;for(t=this._additionsHead;null!=t;t=t._nextAdded)t.previousValue=t.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(t,e){Object.is(e,t.currentValue)||(t.previousValue=t.currentValue,t.currentValue=e,this._addToChanges(t))}_addToAdditions(t){null===this._additionsHead?this._additionsHead=this._additionsTail=t:(this._additionsTail._nextAdded=t,this._additionsTail=t)}_addToChanges(t){null===this._changesHead?this._changesHead=this._changesTail=t:(this._changesTail._nextChanged=t,this._changesTail=t)}_forEach(t,e){t instanceof Map?t.forEach(e):Object.keys(t).forEach(n=>e(t[n],n))}}class No{constructor(t){this.key=t,this.previousValue=null,this.currentValue=null,this._nextPrevious=null,this._next=null,this._prev=null,this._nextAdded=null,this._nextRemoved=null,this._nextChanged=null}}function Po(){return new Ro([new So])}let Ro=(()=>{class t{constructor(t){this.factories=t}static create(e,n){if(null!=n){const t=n.factories.slice();e=e.concat(t)}return new t(e)}static extend(e){return{provide:t,useFactory:n=>t.create(e,n||Po()),deps:[[t,new rr,new nr]]}}find(t){const e=this.factories.find(e=>e.supports(t));if(null!=e)return e;throw new Error(`Cannot find a differ supporting object '${t}' of type '${n=t,n.name||typeof n}'`);var n}}return t.\u0275prov=ht({token:t,providedIn:"root",factory:Po}),t})();function jo(){return new Fo([new Mo])}let Fo=(()=>{class t{constructor(t){this.factories=t}static create(e,n){if(n){const t=n.factories.slice();e=e.concat(t)}return new t(e)}static extend(e){return{provide:t,useFactory:n=>t.create(e,n||jo()),deps:[[t,new rr,new nr]]}}find(t){const e=this.factories.find(e=>e.supports(t));if(e)return e;throw new Error(`Cannot find a differ supporting object '${t}'`)}}return t.\u0275prov=ht({token:t,providedIn:"root",factory:jo}),t})();function Ho(t,e,n,r,s=!1){for(;null!==n;){const i=e[n.index];if(null!==i&&r.push(_e(i)),te(i))for(let t=Xt;t<i.length;t++){const e=i[t],n=e[1].firstChild;null!==n&&Ho(e[1],e,n,r)}const o=n.type;if(8&o)Ho(t,e,n.child,r);else if(32&o){const t=yr(n,e);let s;for(;s=t();)r.push(s)}else if(16&o){const t=Pr(e,n);if(Array.isArray(t))r.push(...t);else{const n=vr(e[16]);Ho(n[1],n,t,r,!0)}}n=s?n.projectionNext:n.next}return r}class zo{constructor(t,e){this._lView=t,this._cdRefInjectingView=e,this._appRef=null,this._attachedToViewContainer=!1}get rootNodes(){const t=this._lView,e=t[1];return Ho(e,t,e.firstChild,[])}get context(){return this._lView[8]}get destroyed(){return 256==(256&this._lView[2])}destroy(){if(this._appRef)this._appRef.detachView(this);else if(this._attachedToViewContainer){const t=this._lView[3];if(te(t)){const e=t[8],n=e?e.indexOf(this):-1;n>-1&&(kr(t,n),Ln(e,n))}this._attachedToViewContainer=!1}Ar(this._lView[1],this._lView)}onDestroy(t){!function(t,e,n,r){const s=Bs(e);s.push(r)}(0,this._lView,0,t)}markForCheck(){js(this._cdRefInjectingView||this._lView)}detach(){this._lView[2]&=-129}reattach(){this._lView[2]|=128}detectChanges(){Fs(this._lView[1],this._lView,this.context)}checkNoChanges(){!function(t,e,n){Re(!0);try{Fs(t,e,n)}finally{Re(!1)}}(this._lView[1],this._lView,this.context)}attachToViewContainerRef(){if(this._appRef)throw new Error("This view is already attached directly to the ApplicationRef!");this._attachedToViewContainer=!0}detachFromAppRef(){var t;this._appRef=null,Fr(this._lView[1],t=this._lView,t[11],2,null,null)}attachToAppRef(t){if(this._attachedToViewContainer)throw new Error("This view is already attached to a Vie
5564wContainer!");this._appRef=t}}class Lo extends zo{constructor(t){super(t),this._view=t}detectChanges(){Hs(this._view)}checkNoChanges(){!function(t){Re(!0);try{Hs(t)}finally{Re(!1)}}(this._view)}get context(){return null}}const Bo=function(t=!1){return function(t,e,n){if(!n&&ne(t)){const n=we(t.index,e);return new zo(n,n)}return 47&t.type?new zo(e[16],e):null}(Oe(),Te(),t)};let Wo=(()=>{class t{}return t.__NG_ELEMENT_ID__=Bo,t.__ChangeDetectorRef__=!0,t})();const $o=[new Mo],Zo=new Ro([new So]),Uo=new Fo($o),qo=function(){return t=Oe(),e=Te(),4&t.type?new Yo(e,t,_o(t,e)):null;var t,e};let Go=(()=>{class t{}return t.__NG_ELEMENT_ID__=qo,t})();const Qo=Go,Yo=class extends Qo{constructor(t,e,n){super(),this._declarationLView=t,this._declarationTContainer=e,this.elementRef=n}createEmbeddedView(t){const e=this._declarationTContainer.tViews,n=us(this._declarationLView,e,t,16,null,e.declTNode,null,null,null,null);n[17]=this._declarationLView[this._declarationTContainer.index];const r=this._declarationLView[19];return null!==r&&(n[19]=r.createEmbeddedView(e)),ds(e,n,t),new zo(n)}};class Ko{}const Xo=function(){return function(t,e){let n;const r=e[t.index];if(te(r))n=r;else{let s;if(8&t.type)s=_e(r);else{const n=e[11];s=n.createComment("");const r=ye(t,e);Ir(n,Mr(n,r),s,function(t,e){return pe(t)?t.nextSibling(e):e.nextSibling}(n,r),!1)}e[t.index]=n=Ms(r,e,s,t),Rs(e,n)}return new el(n,t,e)}(Oe(),Te())};let Jo=(()=>{class t{}return t.__NG_ELEMENT_ID__=Xo,t})();const tl=Jo,el=class extends tl{constructor(t,e,n){super(),this._lContainer=t,this._hostTNode=e,this._hostLView=n}get element(){return _o(this._hostTNode,this._hostLView)}get injector(){return new Dn(this._hostTNode,this._hostLView)}get parentInjector(){const t=Cn(this._hostTNode,this._hostLView);if(fn(t)){const e=gn(t,this._hostLView),n=pn(t);return new Dn(e[1].data[n+8],e)}return new Dn(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(t){const e=nl(this._lContainer);return null!==e&&e[t]||null}get length(){return this._lContainer.length-Xt}createEmbeddedView(t,e,n){const r=t.createEmbeddedView(e||{});return this.insert(r,n),r}createComponent(t,e,n,r,s){const i=n||this.parentInjector;if(!s&&null==t.ngModule&&i){const t=i.get(Ko,null);t&&(s=t)}const o=t.create(i,r,void 0,s);return this.insert(o.hostView,e),o}insert(t,e){const n=t._lView,r=n[1];if(te(n[3])){const e=this.indexOf(t);if(-1!==e)this.detach(e);else{const e=n[3],r=new el(e,e[6],e[3]);r.detach(r.indexOf(t))}}const s=this._adjustIndex(e),i=this._lContainer;!function(t,e,n,r){const s=Xt+r,i=n.length;r>0&&(n[s-1][4]=e),r<i-Xt?(e[4]=n[s],zn(n,Xt+r,e)):(n.push(e),e[4]=null),e[3]=n;const o=e[17];null!==o&&n!==o&&function(t,e){const n=t[9];e[16]!==e[3][3][16]&&(t[2]=!0),null===n?t[9]=[e]:n.push(e)}(o,e);const l=e[19];null!==l&&l.insertView(t),e[2]|=128}(r,n,i,s);const o=Rr(s,i),l=n[11],a=Mr(l,i[7]);return null!==a&&function(t,e,n,r,s,i){r[0]=s,r[6]=e,Fr(t,r,n,1,s,i)}(r,i[6],l,n,a,o),t.attachToViewContainerRef(),zn(rl(i),s,t),t}move(t,e){return this.insert(t,e)}indexOf(t){const e=nl(this._lContainer);return null!==e?e.indexOf(t):-1}remove(t){const e=this._adjustIndex(t,-1),n=kr(this._lContainer,e);n&&(Ln(rl(this._lContainer),e),Ar(n[1],n))}detach(t){const e=this._adjustIndex(t,-1),n=kr(this._lContainer,e);return n&&null!=Ln(rl(this._lContainer),e)?new zo(n):null}_adjustIndex(t,e=0){return null==t?this.length+e:t}};function nl(t){return t[8]}function rl(t){return t[8]||(t[8]=[])}const sl={};class il extends po{constructor(t){super(),this.ngModule=t}resolveComponentFactory(t){const e=Qt(t);return new al(e,this.ngModule)}}function ol(t){const e=[];for(let n in t)t.hasOwnProperty(n)&&e.push({propName:t[n],templateName:n});return e}const ll=new Fn("SCHEDULER_TOKEN",{providedIn:"root",factory:()=>gr});class al extends ho{constructor(t,e){super(),this.componentDef=t,this.ngModule=e,this.componentType=t.type,this.selector=t.selectors.map(Xr).join(","),this.ngContentSelectors=t.ngContentSelectors?t.ngContentSelectors:[],this.isBoundToModule=!!e}get inputs(){return ol(this.componentDef.inputs)}get outputs(){return ol(this.componentDef.outputs)}create(t,e,n,r){const s=(r=r||this.ngModule)?function(t,e){return{get:(n,r,s)=>{const i=t.get(n,sl,s);return i!==sl||r===sl?i:e.get(n,r,s)}}}(t,r.injector):t,i=s.get(vo,ge),o=s.get(Co,null),l=i.createRenderer(null,this.componentDef),a=this.componentDef.selectors[0][0]||"div",u=n?function(t,e,n){if(pe(t))return t.selectRootElement(e,n===kt.ShadowDom);let r="string"==typeof e?t.querySelector(e):e;return r.textContent="",r}
vendor: 49,254 bytes, line 5564
5564(l,n,this.componentDef.encapsulation):Er(i.createRenderer(null,this.componentDef),a,function(t){const e=t.toLowerCase();return"svg"===e?de:"math"===e?"http://www.w3.org/1998/MathML/":null}(a)),c=this.componentDef.onPush?576:528,h={components:[],scheduler:gr,clean:Ls,playerHandler:null,flags:0},d=vs(0,null,null,1,0,null,null,null,null,null),f=us(null,d,h,c,null,null,i,l,o,s);let p,g;We(f);try{const t=function(t,e,n,r,s,i){const o=n[1];n[20]=t;const l=cs(o,20,2,"#host",null),a=l.mergedAttrs=e.hostAttrs;null!==a&&(Us(l,a,!0),null!==t&&(un(s,t,a),null!==l.classes&&Lr(s,t,l.classes),null!==l.styles&&zr(s,t,l.styles)));const u=r.createRenderer(t,e),c=us(n,ys(e),null,e.onPush?64:16,n[20],l,r,u,null,null);return o.firstCreatePass&&(xn(vn(l,n),o,e.type),Ss(o,l),As(l,n.length,1)),Rs(n,c),n[20]=c}(u,this.componentDef,f,i,l);if(u)if(n)un(l,u,["ng-version",Eo.full]);else{const{attrs:t,classes:e}=function(t){const e=[],n=[];let r=1,s=2;for(;r<t.length;){let i=t[r];if("string"==typeof i)2===s?""!==i&&e.push(i,t[++r]):8===s&&n.push(i);else{if(!Gr(s))break;s=i}r++}return{attrs:e,classes:n}}(this.componentDef.selectors[0]);t&&un(l,u,t),e&&e.length>0&&Lr(l,u,e.join(" "))}if(g=ve(d,Kt),void 0!==e){const t=g.projection=[];for(let n=0;n<this.ngContentSelectors.length;n++){const r=e[n];t.push(null!=r?Array.from(r):null)}}p=function(t,e,n,r,s){const i=n[1],o=function(t,e,n){const r=Oe();t.firstCreatePass&&(n.providersResolver&&n.providersResolver(n),Ts(t,r,e,hs(t,e,1,null),n));const s=Vn(e,t,r.directiveStart,r);pr(s,e);const i=ye(r,e);return i&&pr(i,e),s}(i,n,e);if(r.components.push(o),t[8]=o,s&&s.forEach(t=>t(o,e)),e.contentQueries){const t=Oe();e.contentQueries(1,o,t.directiveStart)}const l=Oe();return!i.firstCreatePass||null===e.hostBindings&&null===e.hostAttrs||(Ye(l.index),xs(n[1],l,0,l.directiveStart,l.directiveEnd,e),Es(e,o)),o}(t,this.componentDef,f,h,[ci]),ds(d,f,null)}finally{Ge()}return new ul(this.componentType,p,_o(g,f),f,g)}}class ul extends class{}{constructor(t,e,n,r,s){super(),this.location=n,this._rootLView=r,this._tNode=s,this.instance=e,this.hostView=this.changeDetectorRef=new Lo(r),this.componentType=t}get injector(){return new Dn(this._tNode,this._rootLView)}destroy(){this.hostView.destroy()}onDestroy(t){this.hostView.onDestroy(t)}}const cl=new Map;class hl extends Ko{constructor(t,e){super(),this._parent=e,this._bootstrapComponents=[],this.injector=this,this.destroyCbs=[],this.componentFactoryResolver=new il(this);const n=Yt(t),r=t[Ft]||null;r&&no(r),this._bootstrapComponents=_r(n.bootstrap),this._r3Injector=ei(t,e,[{provide:Ko,useValue:this},{provide:po,useValue:this.componentFactoryResolver}],et(t)),this._r3Injector._resolveInjectorDefTypes(),this.instance=this.get(t)}get(t,e=ui.THROW_IF_NOT_FOUND,n=wt.Default){return t===ui||t===Ko||t===qs?this:this._r3Injector.get(t,e,n)}destroy(){const t=this._r3Injector;!t.destroyed&&t.destroy(),this.destroyCbs.forEach(t=>t()),this.destroyCbs=null}onDestroy(t){this.destroyCbs.push(t)}}class dl extends class{}{constructor(t){super(),this.moduleType=t,null!==Yt(t)&&function(t){const e=new Set;!function t(n){const r=Yt(n,!0),s=r.id;null!==s&&(function(t,e,n){if(e&&e!==n)throw new Error(`Duplicate module registered for ${t} - ${et(e)} vs ${et(e.name)}`)}(s,cl.get(s),n),cl.set(s,n));const i=_r(r.imports);for(const o of i)e.has(o)||(e.add(o),t(o))}(t)}(t)}create(t){return new hl(this.moduleType,t)}}const fl=class extends x{constructor(t=!1){super(),this.__isAsync=t}emit(t){super.next(t)}subscribe(t,e,n){let r,s=t=>null,i=()=>null;t&&"object"==typeof t?(r=this.__isAsync?e=>{setTimeout(()=>t.next(e))}:e=>{t.next(e)},t.error&&(s=this.__isAsync?e=>{setTimeout(()=>t.error(e))}:e=>{t.error(e)}),t.complete&&(i=this.__isAsync?()=>{setTimeout(()=>t.complete())}:()=>{t.complete()})):(r=this.__isAsync?e=>{setTimeout(()=>t(e))}:e=>{t(e)},e&&(s=this.__isAsync?t=>{setTimeout(()=>e(t))}:t=>{e(t)}),n&&(i=this.__isAsync?()=>{setTimeout(()=>n())}:()=>{n()}));const o=super.subscribe(r,s,i);return t instanceof h&&t.add(o),o}},pl=new Fn("Application Initializer");let gl=(()=>{class t{constructor(t){this.appInits=t,this.resolve=go,this.reject=go,this.initialized=!1,this.done=!1,this.donePromise=new Promise((t,e)=>{this.resolve=t,this.reject=e})}runInitializers(){if(this.initialized)return;const t=[],e=()=>{this.done=!0,this.resolve()};if(this.appInits)for(let n=0;n<this.appInits.length;n++){const e=this.appInits[n]();Vi(e)&&t.push(e)}Promise.all(t).then(()=>{e()}).catch(t=>{this.reject(t)}),0===t.length&&e(),this.initialized=!0}}return t.\u0275fac=function(e){return new(e||t)(Xn(pl,8))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const _l=new Fn("AppId"),ml={provide:_l,useFactory:function(){return`${yl()}${yl()}${yl()}`},deps:[]};function yl(){return String.fromCharCode(97+Math.floor(25*Math.random()))}const vl=new Fn("Platform Initializer"),wl=new Fn("Platform ID"),bl=new Fn("appBootstrapListener");let Cl=(()=>{class t{log(t){console.log(t)}warn(t){console.warn(t)}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const xl=new Fn("LocaleId"),El=new Fn("DefaultCurrencyCode");class Sl{constructor(t,e){this.ngModuleFactory=t,this.componentFactories=e}}const kl=function(t){return new dl(t)},Al=kl,Tl=function(t){return Promise.resolve(kl(t))},Il=function(t){const e=kl(t),n=_r(Yt(t).declarations).reduce((t,e)=>{const n=Qt(e);return n&&t.push(new al(n)),t},[]);return new Sl(e,n)},Vl=Il,Ol=function(t){return Promise.resolve(Il(t))};let Ml=(()=>{class t{constructor(){this.compileModuleSync=Al,this.compileModuleAsync=Tl,this.compileModuleAndAllComponentsSync=Vl,this.compileModuleAndAllComponentsAsync=Ol}clearCache(){}clearCacheFor(t){}getModuleId(t){}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const Dl=(()=>Promise.resolve(0))();function Nl(t){"undefined"==typeof Zone?Dl.then(()=>{t&&t.apply(null,null)}):Zone.current.scheduleMicroTask("scheduleMicrotask",t)}class Pl{constructor({enableLongStackTrace:t=!1,shouldCoalesceEventChangeDetection:e=!1,shouldCoalesceRunChangeDetection:n=!1}){if(this.hasPendingMacrotasks=!1,this.hasPendingMicrotasks=!1,this.isStable=!0,this.onUnstable=new fl(!1),this.onMicrotaskEmpty=new fl(!1),this.onStable=new fl(!1),this.onError=new fl(!1),"undefined"==typeof Zone)throw new Error("In this configuration Angular requires Zone.js");Zone.assertZonePatched();const r=this;r._nesting=0,r._outer=r._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(r._inner=r._inner.fork(new Zone.TaskTrackingZoneSpec)),t&&Zone.longStackTraceZoneSpec&&(r._inner=r._inner.fork(Zone.longStackTraceZoneSpec)),r.shouldCoalesceEventChangeDetection=!n&&e,r.shouldCoalesceRunChangeDetection=n,r.lastRequestAnimationFrameId=-1,r.nativeRequestAnimationFrame=function(){let t=Ot.requestAnimationFrame,e=Ot.cancelAnimationFrame;if("undefined"!=typeof Zone&&t&&e){const n=t[Zone.__symbol__("OriginalDelegate")];n&&(t=n);const r=e[Zone.__symbol__("OriginalDelegate")];r&&(e=r)}return{nativeRequestAnimationFrame:t,nativeCancelAnimationFrame:e}}().nativeRequestAnimationFrame,function(t){const e=()=>{!function(t){-1===t.lastRequestAnimationFrameId&&(t.lastRequestAnimationFrameId=t.nativeRequestAnimationFrame.call(Ot,()=>{t.fakeTopEventTask||(t.fakeTopEventTask=Zone.root.scheduleEventTask("fakeTopEventTask",()=>{t.lastRequestAnimationFrameId=-1,Fl(t),jl(t)},void 0,()=>{},()=>{})),t.fakeTopEventTask.invoke()}),Fl(t))}(t)};t._inner=t._inner.fork({name:"angular",properties:{isAngularZone:!0},onInvokeTask:(n,r,s,i,o,l)=>{try{return Hl(t),n.invokeTask(s,i,o,l)}finally{(t.shouldCoalesceEventChangeDetection&&"eventTask"===i.type||t.shouldCoalesceRunChangeDetection)&&e(),zl(t)}},onInvoke:(n,r,s,i,o,l,a)=>{try{return Hl(t),n.invoke(s,i,o,l,a)}finally{t.shouldCoalesceRunChangeDetection&&e(),zl(t)}},onHasTask:(e,n,r,s)=>{e.hasTask(r,s),n===r&&("microTask"==s.change?(t._hasPendingMicrotasks=s.microTask,Fl(t),jl(t)):"macroTask"==s.change&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(e,n,r,s)=>(e.handleError(r,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}(r)}static isInAngularZone(){return!0===Zone.current.get("isAngularZone")}static assertInAngularZone(){if(!Pl.isInAngularZone())throw new Error("Expected to be in Angular Zone, but it is not!")}static assertNotInAngularZone(){if(Pl.isInAngularZone())throw new Error("Expected to not be in Angular Zone, but it is!")}run(t,e,n){return this._inner.run(t,e,n)}runTask(t,e,n,r){const s=this._inner,i=s.scheduleEventTask("NgZoneEvent: "+r,t,Rl,go,go);try{return s.runTask(i,e,n)}finally{s.cancelTask(i)}}runGuarded(t,e,n){return this._inner.runGuarded(t,e,n)}runOutsideAngular(t){return this._outer.run(t)}}const Rl={};function jl(t){if(0==t._nesting&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function Fl(t){t.hasPendingMicrotasks=!!(t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&-1!==t.lastRequestAnimationFrameId)}function Hl(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function zl(t){t._nesting--,jl(t)}class Ll{constructor(){this.hasPendingMicrotasks=!1,this.hasPendingMacrotasks=!1,this.isStable=!0,this.onUnstable=new fl,this.onMicrotaskEmpty=new fl,this.onStable=new fl,this.onError=new fl}run(t,e,n){return t.apply(e,n)}runGuarded(t,e,n){return t.apply(e,n)}runOutsideAngular(t){return t()}runTask(t,e,n,r){return t.apply(e,n)}}let Bl=(()=>{class t{constructor(t){this._ngZone=t,this._pendingCount=0,this._isZoneStable=!0,this._didWork=!1,this._callbacks=[],this.taskTrackingZone=null,this._watchAngularEvents(),t.run(()=>{this.taskTrackingZone="undefined"==typeof Zone?null:Zone.current.get("TaskTrackingZone")})}_watchAngularEvents(){this._ngZone.onUnstable.subscribe({next:()=>{this._didWork=!0,this._isZoneStable=!1}}),this._ngZone.runOutsideAngular(()=>{this._ngZone.onStable.subscribe({next:()=>{Pl.assertNotInAngularZone(),Nl(()=>{this._isZoneStable=!0,this._runCallbacksIfReady()})}})})}increasePendingRequestCount(){return this._pendingCount+=1,this._didWork=!0,this._pendingCount}decreasePendingRequestCount(){if(this._pendingCount-=1,this._pendingCount<0)throw new Error("pending async requests below zero");return this._runCallbacksIfReady(),this._pendingCount}isStable(){return this._isZoneStable&&0===this._pendingCount&&!this._ngZone.hasPendingMacrotasks}_runCallbacksIfReady(){if(this.isStable())Nl(()=>{for(;0!==this._callbacks.length;){let t=this._callbacks.pop();clearTimeout(t.timeoutId),t.doneCb(this._didWork)}this._didWork=!1});else{let t=this.getPendingTasks();this._callbacks=this._callbacks.filter(e=>!e.updateCb||!e.updateCb(t)||(clearTimeout(e.timeoutId),!1)),this._didWork=!0}}getPendingTasks(){return this.taskTrackingZone?this.taskTrackingZone.macroTasks.map(t=>({source:t.source,creationLocation:t.creationLocation,data:t.data})):[]}addCallback(t,e,n){let r=-1;e&&e>0&&(r=setTimeout(()=>{this._callbacks=this._callbacks.filter(t=>t.timeoutId!==r),t(this._didWork,this.getPendingTasks())},e)),this._callbacks.push({doneCb:t,timeoutId:r,updateCb:n})}whenStable(t,e,n){if(n&&!this.taskTrackingZone)throw new Error('Task tracking zone is required when passing an update callback to whenStable(). Is "zone.js/dist/task-tracking.js" loaded?');this.addCallback(t,e,n),this._runCallbacksIfReady()}getPendingRequestCount(){return this._pendingCount}findProviders(t,e,n){return[]}}return t.\u0275fac=function(e){return new(e||t)(Xn(Pl))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})(),Wl=(()=>{class t{constructor(){this._applications=new Map,Ul.addToWindow(this)}registerApplication(t,e){this._applications.set(t,e)}unregisterApplication(t){this._applications.delete(t)}unregisterAllApplications(){this._applications.clear()}getTestability(t){return this._applications.get(t)||null}getAllTestabilities(){return Array.from(this._applications.values())}getAllRootElements(){return Array.from(this._applications.keys())}findTestabilityInTree(t,e=!0){return Ul.findTestabilityInTree(this,t,e)}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();class $l{addToWindow(t){}findTestabilityInTree(t,e,n){return null}}let Zl,Ul=new $l,ql=!0,Gl=!1;function Ql(){return Gl=!0,ql}const Yl=new Fn("AllowMultipleToken");function Kl(t,e,n=[]){const r=`Platform: ${e}`,s=new Fn(r);return(e=[])=>{let i=Xl();if(!i||i.injector.get(Yl,!1))if(t)t(n.concat(e).concat({provide:s,useValue:!0}));else{const t=n.concat(e).concat({provide:s,useValue:!0},{provide:Qs,useValue:"platform"});!function(t){if(Zl&&!Zl.destroyed&&!Zl.injector.get(Yl,!1))throw new Error("There can be only one platform. Destroy the previous one to create a new one.");Zl=t.get(Jl);const e=t.get(vl,null);e&&e.forEach(t=>t())}(ui.create({providers:t,name:r}))}return function(t){const e=Xl();if(!e)throw new Error("No platform exists!");if(!e.injector.get(t,null))throw new Error("A platform with a different configuration has been created. Please destroy it first.");return e}(s)}}function Xl(){return Zl&&!Zl.destroyed?Zl:null}let Jl=(()=>{class t{constructor(t){this._injector=t,this._modules=[],this._destroyListeners=[],this._destroyed=!1}bootstrapModuleFactory(t,e){const n=function(t,e){let n;return n="noop"===t?new Ll:("zone.js"===t?void 0:t)||new Pl({enableLongStackTrace:Ql(),shouldCoalesceEventChangeDetection:!!(null==e?void 0:e.ngZoneEventCoalescing),shouldCoalesceRunChangeDetection:!!(null==e?void 0:e.ngZoneRunCoalescing)}),n}(e?e.ngZone:void 0,{ngZoneEventCoalescing:e&&e.ngZoneEventCoalescing||!1,ngZoneRunCoalescing:e&&e.ngZoneRunCoalescing||!1}),r=[{provide:Pl,useValue:n}];return n.run(()=>{const e=ui.create({providers:r,parent:this.injector,name:t.moduleType.name}),s=t.create(e),i=s.injector.get(fr,null);if(!i)throw new Error("No ErrorHandler. Is platform module (BrowserModule) included?");return n.runOutsideAngular(()=>{const t=n.onError.subscribe({next:t=>{i.handleError(t)}});s.onDestroy(()=>{na(this._modules,s),t.unsubscribe()})}),function(t,e,n){try{const r=n();return Vi(r)?r.catch(n=>{throw e.runOutsideAngular(()=>t.handleError(n)),n}):r}catch(r){throw e.runOutsideAngular(()=>t.handleError(r)),r}}(i,n,()=>{const t=s.injector.get(gl);return t.runInitializers(),t.donePromise.then(()=>(no(s.injector.get(xl,to)||to),this._moduleDoBootstrap(s),s))})})}bootstrapModule(t,e=[]){const n=ta({},e);return function(t,e,n){const r=new dl(n);return Promise.resolve(r)}(0,0,t).then(t=>this.bootstrapModuleFactory(t,n))}_moduleDoBootstrap(t){const e=t.injector.get(ea);if(t._bootstrapComponents.length>0)t._bootstrapComponents.forEach(t=>e.bootstrap(t));else{if(!t.instance.ngDoBootstrap)throw new Error(`The module ${et(t.instance.constructor)} was bootstrapped, but it does not declare "@NgModule.bootstrap" components nor a "ngDoBootstrap" method. Please define one of these.`);t.instance.ngDoBootstrap(e)}this._modules.push(t)}onDestroy(t){this._destroyListeners.push(t)}get injector(){return this._injector}destroy(){if(this._destroyed)throw new Error("The platform has already been destroyed!");this._modules.slice().forEach(t=>t.destroy()),this._destroyListeners.forEach(t=>t()),this._destroyed=!0}get destroyed(){return this._destroyed}}return t.\u0275fac=function(e){return new(e||t)(Xn(ui))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();function ta(t,e){return Array.isArray(e)?e.reduce(ta,t):Object.assign(Object.assign({},t),e)}let ea=(()=>{class t{constructor(t,e,n,r,s){this._zone=t,this._injector=e,this._exceptionHandler=n,this._componentFactoryResolver=r,this._initStatus=s,this._bootstrapListeners=[],this._views=[],this._runningTick=!1,this._stable=!0,this.componentTypes=[],this.components=[],this._onMicrotaskEmptySubscription=this._zone.onMicrotaskEmpty.subscribe({next:()=>{this._zone.run(()=>{this.tick()})}});const i=new y(t=>{this._stable=this._zone.isStable&&!this._zone.hasPendingMacrotasks&&!this._zone.hasPendingMicrotasks,this._zone.runOutsideAngular(()=>{t.next(this._stable),t.complete()})}),o=new y(t=>{let e;this._zone.runOutsideAngular(()=>{e=this._zone.onStable.subscribe(()=>{Pl.assertNotInAngularZone(),Nl(()=>{this._stable||this._zone.hasPendingMacrotasks||this._zone.hasPendingMicrotasks||(this._stable=!0,t.next(!0))})})});const n=this._zone.onUnstable.subscribe(()=>{Pl.assertInAngularZone(),this._stable&&(this._stable=!1,this._zone.runOutsideAngular(()=>{t.next(!1)}))});return()=>{e.unsubscribe(),n.unsubscribe()}});this.isStable=Z(i,o.pipe(t=>{return U()((e=X,function(t){let n;n="function"==typeof e?e:function(){return e};const r=Object.create(t,Y);return r.source=t,r.subjectFactory=n,r})(t));var e}))}bootstrap(t,e){if(!this._initStatus.done)throw new Error("Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.");let n;n=t instanceof ho?t:this._componentFactoryResolver.resolveComponentFactory(t),this.componentTypes.push(n.componentType);const r=n.isBoundToModule?void 0:this._injector.get(Ko),s=n.create(ui.NULL,[],e||n.selector,r),i=s.location.nativeElement,o=s.injector.get(Bl,null),l=o&&s.injector.get(Wl);return o&&l&&l.registerApplication(i,o),s.onDestroy(()=>{this.detachView(s.hostView),na(this.components,s),l&&l.unregisterApplication(i)}),this._loadComponent(s),s}tick(){if(this._runningTick)throw new Error("ApplicationRef.tick is called recursively");try{this._runningTick=!0;for(let t of this._views)t.detectChanges()}catch(t){this._zone.runOutsideAngular(()=>this._exceptionHandler.handleError(t))}finally{this._runningTick=!1}}attachView(t){const e=t;this._views.push(e),e.attachToAppRef(this)}detachView(t){const e=t;na(this._views,e),e.detachFromAppRef()}_loadComponent(t){this.attachView(t.hostView),this.tick(),this.components.push(t),this._injector.get(bl,[]).concat(this._bootstrapListeners).forEach(e=>e(t))}ngOnDestroy(){this._views.slice().forEach(t=>t.destroy()),this._onMicrotaskEmptySubscription.unsubscribe()}get viewCount(){return this._views.length}}return t.\u0275fac=function(e){return new(e||t)(Xn(Pl),Xn(ui),Xn(fr),Xn(po),Xn(gl))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();function na(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const ra=Kl(null,"core",[{provide:wl,useValue:"unknown"},{provide:Jl,deps:[ui]},{provide:Wl,deps:[]},{provide:Cl,deps:[]}]),sa=[{provide:ea,useClass:ea,deps:[Pl,ui,fr,po,gl]},{provide:ll,deps:[Pl],useFactory:function(t){let e=[];return t.onStable.subscribe(()=>{for(;e.length;)e.pop()()}),function(t){e.push(t)}}},{provide:gl,useClass:gl,deps:[[new nr,pl]]},{provide:Ml,useClass:Ml,deps:[]},ml,{provide:Ro,useFactory:function(){return Zo},deps:[]},{provide:Fo,useFactory:function(){return Uo},deps:[]},{provide:xl,useFactory:function(t){return no(t=t||"undefined"!=typeof $localize&&$localize.locale||to),t},deps:[[new er(xl),new nr,new rr]]},{provide:El,useValue:"USD"}];let ia=(()=>{class t{constructor(t){}}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)(Xn(ea))},providers:sa}),t})(),oa=null;function la(){return oa}const aa=new Fn("DocumentToken");var ua=function(t){return t[t.Zero=0]="Zero",t[t.One=1]="One",t[t.Two=2]="Two",t[t.Few=3]="Few",t[t.Many=4]="Many",t[t.Other=5]="Other",t}({});class ca{}let ha=(()=>{class t extends ca{constructor(t){super(),this.locale=t}getPluralCategory(t,e){switch(function(t){return function(t){const e=function(t){return t.toLowerCase().replace(/_/g,"-")}(t);let n=Xi(e);if(n)return n;const r=e.split("-")[0];if(n=Xi(r),n)return n;if("en"===r)return Yi;throw new Error(`Missing locale data for the locale "${t}".`)}(t)[Ji.PluralCase]}(e||this.locale)(t)){case ua.Zero:return"zero";case ua.One:return"one";case ua.Two:return"two";case ua.Few:return"few";case ua.Many:return"many";default:return"other"}}}return t.\u0275fac=function(e){return new(e||t)(Xn(xl))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})(),da=(()=>{class t{constructor(t,e,n,r){this._iterableDiffers=t,this._keyValueDiffers=e,this._ngEl=n,this._renderer=r,this._iterableDiffer=null,this._keyValueDiffer=null,this._initialClasses=[],this._rawClass=null}set klass(t){this._removeClasses(this._initialClasses),this._initialClasses="string"==typeof t?t.split(/\s+/):[],this._applyClasses(this._initialClasses),this._applyClasses(this._rawClass)}set ngClass(t){this._removeClasses(this._rawClass),this._applyClasses(this._initialClasses),this._iterableDiffer=null,this._keyValueDiffer=null,this._rawClass="string"==typeof t?t.split(/\s+/):t,this._rawClass&&(yi(this._rawClass)?this._iterableDiffer=this._iterableDiffers.find(this._rawClass).create():this._keyValueDiffer=this._keyValueDiffers.find(this._rawClass).create())}ngDoCheck(){if(this._iterableDiffer){const t=this._iterableDiffer.diff(this._rawClass);t&&this._applyIterableChanges(t)}else if(this._keyValueDiffer){const t=this._keyValueDiffer.diff(this._rawClass);t&&this._applyKeyValueChanges(t)}}_applyKeyValueChanges(t){t.forEachAddedItem(t=>this._toggleClass(t.key,t.currentValue)),t.forEachChangedItem(t=>this._toggleClass(t.key,t.currentValue)),t.forEachRemovedItem(t=>{t.previousValue&&this._toggleClass(t.key,!1)})}_applyIterableChanges(t){t.forEachAddedItem(t=>{if("string"!=typeof t.item)throw new Error(`NgClass can only toggle CSS classes expressed as strings, got ${et(t.item)}`);this._toggleClass(t.item,!0)}),t.forEachRemovedItem(t=>this._toggleClass(t.item,!1))}_applyClasses(t){t&&(Array.isArray(t)||t instanceof Set?t.forEach(t=>this._toggleClass(t,!0)):Object.keys(t).forEach(e=>this._toggleClass(e,!!t[e])))}_removeClasses(t){t&&(Array.isArray(t)||t instanceof Set?t.forEach(t=>this._toggleClass(t,!1)):Object.keys(t).forEach(t=>this._toggleClass(t,!1)))}_toggleClass(t,e){(t=t.trim())&&t.split(/\s+/g).forEach(t=>{e?this._renderer.addClass(this._ngEl.nativeElement,t):this._renderer.removeClass(this._ngEl.nativeElement,t)})}}return t.\u0275fac=function(e){return new(e||t)(xi(Ro),xi(Fo),xi(yo),xi(wo))},t.\u0275dir=Gt({type:t,selectors:[["","ngClass",""]],inputs:{klass:["class","klass"],ngClass:"ngClass"}}),t})();class fa{constructor(t,e,n,r){this.$implicit=t,this.ngForOf=e,this.index=n,this.count=r}get first(){return 0===this.index}get last(){return this.index===this.count-1}get even(){return this.index%2==0}get odd(){return!this.even}}let pa=(()=>{class t{constructor(t,e,n){this._viewContainer=t,this._template=e,this._differs=n,this._ngForOf=null,this._ngForOfDirty=!0,this._differ=null}set ngForOf(t){this._ngForOf=t,this._ngForOfDirty=!0}set ngForTrackBy(t){this._trackByFn=t}get ngForTrackBy(){return this._trackByFn}set ngForTemplate(t){t&&(this._template=t)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;const n=this._ngForOf;if(!this._differ&&n)try{this._differ=this._differs.find(n).create(this.ngForTrackBy)}catch(e){throw new Error(`Cannot find a differ supporting object '${n}' of type '${t=n,t.name||typeof t}'. NgFor only supports binding to Iterables such as Arrays.`)}}var t;if(this._differ){const t=this._differ.diff(this._ngForOf);t&&this._applyChanges(t)}}_applyChanges(t){const e=[];t.forEachOperation((t,n,r)=>{if(null==t.previousIndex){const n=this._viewContainer.createEmbeddedView(this._template,new fa(null,this._ngForOf,-1,-1),null===r?void 0:r),s=new ga(t,n);e.push(s)}else if(null==r)this._viewContainer.remove(null===n?void 0:n);else if(null!==n){const s=this._viewContainer.get(n);this._viewContainer.move(s,r);const i=new ga(t,s);e.push(i)}});for(let n=0;n<e.length;n++)this._perViewChange(e[n].view,e[n].record);for(let n=0,r=this._viewContainer.length;n<r;n++){const t=this._viewContainer.get(n);t.context.index=n,t.context.count=r,t.context.ngForOf=this._ngForOf}t.forEachIdentityChange(t=>{this._viewContainer.get(t.currentIndex).context.$implicit=t.item})}_perViewChange(t,e){t.context.$implicit=e.item}static ngTemplateContextGuard(t,e){return!0}}return t.\u0275fac=function(e){return new(e||t)(xi(Jo),xi(Go),xi(Ro))},t.\u0275dir=Gt({type:t,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}}),t})();class ga{constructor(t,e){this.record=t,this.view=e}}let _a=(()=>{class t{constructor(t,e){this._viewContainer=t,this._context=new ma,this._thenTemplateRef=null,this._elseTemplateRef=null,this._thenViewRef=null,this._elseViewRef=null,this._thenTemplateRef=e}set ngIf(t){this._context.$implicit=this._context.ngIf=t,this._updateView()}set ngIfThen(t){ya("ngIfThen",t),this._thenTemplateRef=t,this._thenViewRef=null,this._updateView()}set ngIfElse(t){ya("ngIfElse",t),this._elseTemplateRef=t,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngTemplateContextGuard(t,e){return!0}}return t.\u0275fac=function(e){return new(e||t)(xi(Jo),xi(Go))},t.\u0275dir=Gt({type:t,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}}),t})();class ma{constructor(){this.$implicit=null,this.ngIf=null}}function ya(t,e){if(e&&!e.createEmbeddedView)throw new Error(`${t} must be a TemplateRef, but received '${et(e)}'.`)}let va=(()=>{class t{}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)},providers:[{provide:ca,useClass:ha}]}),t})();class wa extends class extends class{}{constructor(){super()}supportsDOMEvents(){return!0}}{static makeCurrent(){var t;t=new wa,oa||(oa=t)}getProperty(t,e){return t[e]}log(t){window.console&&window.console.log&&window.console.log(t)}logGroup(t){window.console&&window.console.group&&window.console.group(t)}logGroupEnd(){window.console&&window.console.groupEnd&&window.console.groupEnd()}onAndCancel(t,e,n){return t.addEventListener(e,n,!1),()=>{t.removeEventListener(e,n,!1)}}dispatchEvent(t,e){t.dispatchEvent(e)}remove(t){return t.parentNode&&t.parentNode.removeChild(t),t}getValue(t){return t.value}createElement(t,e){return(e=e||this.getDefaultDocument()).createElement(t)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(t){return t.nodeType===Node.ELEMENT_NODE}isShadowRoot(t){return t instanceof DocumentFragment}getGlobalEventTarget(t,e){return"window"===e?window:"document"===e?t:"body"===e?t.body:null}getHistory(){return window.history}getLocation(){return window.location}getBaseHref(t){const e=Ca||(Ca=document.querySelector("base"),Ca)?Ca.getAttribute("href"):null;return null==e?null:(n=e,ba||(ba=document.createElement("a")),ba.setAttribute("href",n),"/"===ba.pathname.charAt(0)?ba.pathname:"/"+ba.pathname);var n}resetBaseElement(){Ca=null}getUserAgent(){return window.navigator.userAgent}performanceNow(){return window.performance&&window.performance.now?window.performance.now():(new Date).getTime()}supportsCookies(){return!0}getCookie(t){return function(t,e){e=encodeURIComponent(e);for(const n of t.split(";")){const t=n.indexOf("="),[r,s]=-1==t?[n,""]:[n.slice(0,t),n.slice(t+1)];if(r.trim()===e)return decodeURIComponent(s)}return null}(document.cookie,t)}}let ba,Ca=null;const xa=new Fn("TRANSITION_ID"),Ea=[{provide:pl,useFactory:function(t,e,n){return()=>{n.get(gl).donePromise.then(()=>{const n=la();Array.prototype.slice.apply(e.querySelectorAll("style[ng-transition]")).filter(e=>e.getAttribute("ng-transition")===t).forEach(t=>n.remove(t))})}},deps:[xa,aa,ui],multi:!0}];class Sa{static init(){var t;t=new Sa,Ul=t}addToWindow(t){Ot.getAngularTestability=(e,n=!0)=>{const r=t.findTestabilityInTree(e,n);if(null==r)throw new Error("Could not find testability for element.");return r},Ot.getAllAngularTestabilities=()=>t.getAllTestabilities(),Ot.getAllAngularRootElements=()=>t.getAllRootElements(),Ot.frameworkStabilizers||(Ot.frameworkStabilizers=[]),Ot.frameworkStabilizers.push(t=>{const e=Ot.getAllAngularTestabilities();let n=e.length,r=!1;const s=function(e){r=r||e,n--,0==n&&t(r)};e.forEach(function(t){t.whenStable(s)})})}findTestabilityInTree(t,e,n){if(null==e)return null;const r=t.getTestability(e);return null!=r?r:n?la().isShadowRoot(e)?this.findTestabilityInTree(t,e.host,!0):this.findTestabilityInTree(t,e.parentElement,!0):null}}const ka=new Fn("EventManagerPlugins");let Aa=(()=>{class t{constructor(t,e){this._zone=e,this._eventNameToPlugin=new Map,t.forEach(t=>t.manager=this),this._plugins=t.slice().reverse()}addEventListener(t,e,n){return this._findPluginFor(e).addEventListener(t,e,n)}addGlobalEventListener(t,e,n){return this._findPluginFor(e).addGlobalEventListener(t,e,n)}getZone(){return this._zone}_findPluginFor(t){const e=this._eventNameToPlugin.get(t);if(e)return e;const n=this._plugins;for(let r=0;r<n.length;r++){const e=n[r];if(e.supports(t))return this._eventNameToPlugin.set(t,e),e}throw new Error(`No event manager plugin found for event ${t}`)}}return t.\u0275fac=function(e){return new(e||t)(Xn(ka),Xn(Pl))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();class Ta{constructor(t){this._doc=t}addGlobalEventListener(t,e,n){const r=la().getGlobalEventTarget(this._doc,t);if(!r)throw new Error(`Unsupported event target ${r} for event ${e}`);return this.addEventListener(r,e,n)}}let Ia=(()=>{class t{constructor(){this._stylesSet=new Set}addStyles(t){const e=new Set;t.forEach(t=>{this._stylesSet.has(t)||(this._stylesSet.add(t),e.add(t))}),this.onStylesAdded(e)}onStylesAdded(t){}getAllStyles(){return Array.from(this._stylesSet)}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})(),Va=(()=>{class t extends Ia{constructor(t){super(),this._doc=t,this._hostNodes=new Set,this._styleNodes=new Set,this._hostNodes.add(t.head)}_addStylesToHost(t,e){t.forEach(t=>{const n=this._doc.createElement("style");n.textContent=t,this._styleNodes.add(e.appendChild(n))})}addHost(t){this._addStylesToHost(this._stylesSet,t),this._hostNodes.add(t)}removeHost(t){this._hostNodes.delete(t)}onStylesAdded(t){this._hostNodes.forEach(e=>this._addStylesToHost(t,e))}ngOnDestroy(){this._styleNodes.forEach(t=>la().remove(t))}}return t.\u0275fac=function(e){return new(e||t)(Xn(aa))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const Oa={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Ma=/%COMP%/g;function Da(t,e,n){for(let r=0;r<e.length;r++){let s=e[r];Array.isArray(s)?Da(t,s,n):(s=s.replace(Ma,t),n.push(s))}return n}function Na(t){return e=>{if("__ngUnwrap__"===e)return t;!1===t(e)&&(e.preventDefault(),e.returnValue=!1)}}let Pa=(()=>{class t{constructor(t,e,n){this.eventManager=t,this.sharedStylesHost=e,this.appId=n,this.rendererByCompId=new Map,this.defaultRenderer=new Ra(t)}createRenderer(t,e){if(!t||!e)return this.defaultRenderer;switch(e.encapsulation){case kt.Emulated:{let n=this.rendererByCompId.get(e.id);return n||(n=new ja(this.eventManager,this.sharedStylesHost,e,this.appId),this.rendererByCompId.set(e.id,n)),n.applyToHost(t),n}case 1:case kt.ShadowDom:return new Fa(this.eventManager,this.sharedStylesHost,t,e);default:if(!this.rendererByCompId.has(e.id)){const t=Da(e.id,e.styles,[]);this.sharedStylesHost.addStyles(t),this.rendererByCompId.set(e.id,this.defaultRenderer)}return this.defaultRenderer}}begin(){}end(){}}return t.\u0275fac=function(e){return new(e||t)(Xn(Aa),Xn(Va),Xn(_l))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();class Ra{constructor(t){this.eventManager=t,this.data=Object.create(null)}destroy(){}createElement(t,e){return e?document.createElementNS(Oa[e]||e,t):document.createElement(t)}createComment(t){return document.createComment(t)}createText(t){return document.createTextNode(t)}appendChild(t,e){t.appendChild(e)}insertBefore(t,e,n){t&&t.insertBefore(e,n)}removeChild(t,e){t&&t.removeChild(e)}selectRootElement(t,e){let n="string"==typeof t?document.querySelector(t):t;if(!n)throw new Error(`The selector "${t}" did not match any elements`);return e||(n.textContent=""),n}parentNode(t){return t.parentNode}nextSibling(t){return t.nextSibling}setAttribute(t,e,n,r){if(r){e=r+":"+e;const s=Oa[r];s?t.setAttributeNS(s,e,n):t.setAttribute(e,n)}else t.setAttribute(e,n)}removeAttribute(t,e,n){if(n){const r=Oa[n];r?t.removeAttributeNS(r,e):t.removeAttribute(`${n}:${e}`)}else t.removeAttribute(e)}addClass(t,e){t.classList.add(e)}removeClass(t,e){t.classList.remove(e)}setStyle(t,e,n,r){r&(mr.DashCase|mr.Important)?t.style.setProperty(e,n,r&mr.Important?"important":""):t.style[e]=n}removeStyle(t,e,n){n&mr.DashCase?t.style.removeProperty(e):t.style[e]=""}setProperty(t,e,n){t[e]=n}setValue(t,e){t.nodeValue=e}listen(t,e,n){return"string"==typeof t?this.eventManager.addGlobalEventListener(t,e,Na(n)):this.eventManager.addEventListener(t,e,Na(n))}}class ja extends Ra{constructor(t,e,n,r){super(t),this.component=n;const s=Da(r+"-"+n.id,n.styles,[]);e.addStyles(s),this.contentAttr="_ngcontent-%COMP%".replace(Ma,r+"-"+n.id),this.hostAttr="_nghost-%COMP%".replace(Ma,r+"-"+n.id)}applyToHost(t){super.setAttribute(t,this.hostAttr,"")}createElement(t,e){const n=super.createElement(t,e);return super.setAttribute(n,this.contentAttr,""),n}}class Fa extends Ra{constructor(t,e,n,r){super(t),this.sharedStylesHost=e,this.hostEl=n,this.shadowRoot=n.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);const s=Da(r.id,r.styles,[]);for(let i=0;i<s.length;i++){const t=document.createElement("style");t.textContent=s[i],this.shadowRoot.appendChild(t)}}nodeOrShadowRoot(t){return t===this.hostEl?this.shadowRoot:t}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}appendChild(t,e){return super.appendChild(this.nodeOrShadowRoot(t),e)}insertBefore(t,e,n){return super.insertBefore(this.nodeOrShadowRoot(t),e,n)}removeChild(t,e){return super.removeChild(this.nodeOrShadowRoot(t),e)}parentNode(t){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(t)))}}let Ha=(()=>{class t extends Ta{constructor(t){super(t)}supports(t){return!0}addEventListener(t,e,n){return t.addEventListener(e,n,!1),()=>this.removeEventListener(t,e,n)}removeEventListener(t,e,n){return t.removeEventListener(e,n)}}return t.\u0275fac=function(e){return new(e||t)(Xn(aa))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const za=["alt","control","meta","shift"],La={"\b":"Backspace","\t":"Tab","\x7f":"Delete","\x1b":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},Ba={A:"1",B:"2",C:"3",D:"4",E:"5",F:"6",G:"7",H:"8",I:"9",J:"*",K:"+",M:"-",N:".",O:"/","`":"0","\x90":"NumLock"},Wa={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey};let $a=(()=>{class t extends Ta{constructor(t){super(t)}supports(e){return null!=t.parseEventName(e)}addEventListener(e,n,r){const s=t.parseEventName(n),i=t.eventCallback(s.fullKey,r,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>la().onAndCancel(e,s.domEventName,i))}static parseEventName(e){const n=e.toLowerCase().split("."),r=n.shift();if(0===n.length||"keydown"!==r&&"keyup"!==r)return null;const s=t._normalizeKey(n.pop());let i="";if(za.forEach(t=>{const e=n.indexOf(t);e>-1&&(n.splice(e,1),i+=t+".")}),i+=s,0!=n.length||0===s.length)return null;const o={};return o.domEventName=r,o.fullKey=i,o}static getEventFullKey(t){let e="",n=function(t){let e=t.key;if(null==e){if(e=t.keyIdentifier,null==e)return"Unidentified";e.startsWith("U+")&&(e=String.fromCharCode(parseInt(e.substring(2),16)),3===t.location&&Ba.hasOwnProperty(e)&&(e=Ba[e]))}return La[e]||e}(t);return n=n.toLowerCase()," "===n?n="space":"."===n&&(n="dot"),za.forEach(r=>{r!=n&&(0,Wa[r])(t)&&(e+=r+".")}),e+=n,e}static eventCallback(e,n,r){return s=>{t.getEventFullKey(s)===e&&r.runGuarded(()=>n(s))}}static _normalizeKey(t){switch(t){case"esc":return"escape";default:return t}}}return t.\u0275fac=function(e){return new(e||t)(Xn(aa))},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})();const Za=Kl(ra,"browser",[{provide:wl,useValue:"browser"},{provide:vl,useValue:function(){wa.makeCurrent(),Sa.init()},multi:!0},{provide:aa,useFactory:function(){return function(t){fe=t}(document),document},deps:[]}]),Ua=[[],{provide:Qs,useValue:"root"},{provide:fr,useFactory:function(){return new fr},deps:[]},{provide:ka,useClass:Ha,multi:!0,deps:[aa,Pl,wl]},{provide:ka,useClass:$a,multi:!0,deps:[aa]},[],{provide:Pa,useClass:Pa,deps:[Aa,Va,_l]},{provide:vo,useExisting:Pa},{provide:Ia,useExisting:Va},{provide:Va,useClass:Va,deps:[aa]},{provide:Bl,useClass:Bl,deps:[Pl]},{provide:Aa,useClass:Aa,deps:[ka,Pl]},[]];let qa=(()=>{class t{constructor(t){if(t)throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.")}static withServerTransition(e){return{ngModule:t,providers:[{provide:_l,useValue:e.appId},{provide:xa,useExisting:_l},Ea]}}}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)(Xn(t,12))},providers:Ua,imports:[va,ia]}),t})();"undefined"!=typeof window&&window;class Ga extends h{constructor(t,e){super()}schedule(t,e=0){return this}}class Qa extends Ga{constructor(t,e){super(t,e),this.scheduler=t,this.work=e,this.pending=!1}schedule(t,e=0){if(this.closed)return this;this.state=t;const n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,e)),this.pending=!0,this.delay=e,this.id=this.id||this.requestAsyncId(r,this.id,e),this}requestAsyncId(t,e,n=0){return setInterval(t.flush.bind(t,this),n)}recycleAsyncId(t,e,n=0){if(null!==n&&this.delay===n&&!1===this.pending)return e;clearInterval(e)}execute(t,e){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;const n=this._execute(t,e);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}_execute(t,e){let n,r=!1;try{this.work(t)}catch(s){r=!0,n=!!s&&s||new Error(s)}if(r)return this.unsubscribe(),n}_unsubscribe(){const t=this.id,e=this.scheduler,n=e.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=t&&(this.id=this.recycleAsyncId(e,t,null)),this.delay=null}}class Ya extends Qa{constructor(t,e){super(t,e),this.scheduler=t,this.work=e}schedule(t,e=0){return e>0?super.schedule(t,e):(this.delay=e,this.state=t,this.scheduler.flush(this),this)}execute(t,e){return e>0||this.closed?super.execute(t,e):this._execute(t,e)}requestAsyncId(t,e,n=0){return null!==n&&n>0||null===n&&this.delay>0?super.requestAsyncId(t,e,n):t.flush(this)}}let Ka=(()=>{class t{constructor(e,n=t.now){this.SchedulerAction=e,this.now=n}schedule(t,e=0,n){return new this.SchedulerAction(this,t).schedule(n,e)}}return t.now=()=>Date.now(),t})();class Xa extends Ka{constructor(t,e=Ka.now){super(t,()=>Xa.delegate&&Xa.delegate!==this?Xa.delegate.now():e()),this.actions=[],this.active=!1,this.scheduled=void 0}schedule(t,e=0,n){return Xa.delegate&&Xa.delegate!==this?Xa.delegate.schedule(t,e,n):super.schedule(t,e,n)}flush(t){const{actions:e}=this;if(this.active)return void e.push(t);let n;this.active=!0;do{if(n=t.execute(t.state,t.delay))break}while(t=e.shift());if(this.active=!1,n){for(;t=e.shift();)t.unsubscribe();throw n}}}class Ja extends Xa{}const tu=new Ja(Ya),eu=new y(t=>t.complete());let nu=(()=>{class t{constructor(t,e,n){this.kind=t,this.value=e,this.error=n,this.hasValue="N"===t}observe(t){switch(this.kind){case"N":return t.next&&t.next(this.value);case"E":return t.error&&t.error(this.error);case"C":return t.complete&&t.complete()}}do(t,e,n){switch(this.kind){case"N":return t&&t(this.value);case"E":return e&&e(this.error);case"C":return n&&n()}}accept(t,e,n){return t&&"function"==typeof t.next?this.observe(t):this.do(t,e,n)}toObservable(){switch(this.kind){case"N":return function(...t){let e=t[t.length-1];return S(e)?(t.pop(),P(t,e)):$(t)}(this.value);case"E":return t=this.error,new y(e=>e.error(t));case"C":return eu}var t;throw new Error("unexpected notification kind value")}static createNext(e){return void 0!==e?new t("N",e):t.undefinedValueNotification}static createError(e){return new t("E",void 0,e)}static createComplete(){return t.completeNotification}}return t.completeNotification=new t("C"),t.undefinedValueNotification=new t("N",void 0),t})();class ru extends p{constructor(t,e,n=0){super(t),this.scheduler=e,this.delay=n}static dispatch(t){const{notification:e,destination:n}=t;e.observe(n),this.unsubscribe()}scheduleMessage(t){this.destination.add(this.scheduler.schedule(ru.dispatch,this.delay,new su(t,this.destination)))}_next(t){this.scheduleMessage(nu.createNext(t))}_error(t){this.scheduleMessage(nu.createError(t)),this.unsubscribe()}_complete(){this.scheduleMessage(nu.createComplete()),this.unsubscribe()}}class su{constructor(t,e){this.notification=t,this.destination=e}}class iu extends x{constructor(t=Number.POSITIVE_INFINITY,e=Number.POSITIVE_INFINITY,n){super(),this.scheduler=n,this._events=[],this._infiniteTimeWindow=!1,this._bufferSize=t<1?1:t,this._windowTime=e<1?1:e,e===Number.POSITIVE_INFINITY?(this._infiniteTimeWindow=!0,this.next=this.nextInfiniteTimeWindow):this.next=this.nextTimeWindow}nextInfiniteTimeWindow(t){if(!this.isStopped){const e=this._events;e.push(t),e.length>this._bufferSize&&e.shift()}super.next(t)}nextTimeWindow(t){this.isStopped||(this._events.push(new ou(this._getNow(),t)),this._trimBufferThenGetEvents()),super.next(t)}_subscribe(t){const e=this._infiniteTimeWindow,n=e?this._events:this._trimBufferThenGetEvents(),r=this.scheduler,s=n.length;let i;if(this.closed)throw new w;if(this.isStopped||this.hasError?i=h.EMPTY:(this.observers.push(t),i=new b(this,t)),r&&t.add(t=new ru(t,r)),e)for(let o=0;o<s&&!t.closed;o++)t.next(n[o]);else for(let o=0;o<s&&!t.closed;o++)t.next(n[o].value);return this.hasError?t.error(this.thrownError):this.isStopped&&t.complete(),i}_getNow(){return(this.scheduler||tu).now()}_trimBufferThenGetEvents(){const t=this._getNow(),e=this._bufferSize,n=this._windowTime,r=this._events,s=r.length;let i=0;for(;i<s&&!(t-r[i].time<n);)i++;return s>e&&(i=Math.max(i,s-e)),i>0&&r.splice(0,i),r}}class ou{constructor(t,e){this.time=t,this.value=e}}function lu(t,e){return"function"==typeof e?n=>n.pipe(lu((n,r)=>R(t(n,r)).pipe(k((t,s)=>e(n,t,r,s))))):e=>e.lift(new au(t))}class au{constructor(t){this.project=t}call(t,e){return e.subscribe(new uu(t,this.project))}}class uu extends F{constructor(t,e){super(t),this.project=e,this.index=0}_next(t){let e;const n=this.index++;try{e=this.project(t,n)}catch(r){return void this.destination.error(r)}this._innerSub(e)}_innerSub(t){const e=this.innerSubscription;e&&e.unsubscribe();const n=new j(this),r=this.destination;r.add(n),this.innerSubscription=H(t,n),this.innerSubscription!==n&&r.add(this.innerSubscription)}_complete(){const{innerSubscription:t}=this;t&&!t.closed||super._complete(),this.unsubscribe()}_unsubscribe(){this.innerSubscription=void 0}notifyComplete(){this.innerSubscription=void 0,this.isStopped&&super._complete()}notifyNext(t){this.destination.next(t)}}const cu={schedule(t,e){const n=setTimeout(t,e);return()=>clearTimeout(n)},scheduleBeforeRender(t){if("undefined"==typeof window)return cu.schedule(t,0);if(void 0===window.requestAnimationFrame)return cu.schedule(t,16);const e=window.requestAnimationFrame(t);return()=>window.cancelAnimationFrame(e)}};let hu;function du(t,e,n){let r=n;return function(t){return!!t&&t.nodeType===Node.ELEMENT_NODE}(t)&&e.some((e,n)=>!("*"===e||!function(t,e){if(!hu){const t=Element.prototype;hu=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector}return t.nodeType===Node.ELEMENT_NODE&&hu.call(t,e)}(t,e)||(r=n,0))),r}class fu{constructor(t,e){this.componentFactory=e.get(po).resolveComponentFactory(t)}create(t){return new pu(this.componentFactory,t)}}class pu{constructor(t,e){this.componentFactory=t,this.injector=e,this.eventEmitters=new iu(1),this.events=this.eventEmitters.pipe(lu(t=>Z(...t))),this.componentRef=null,this.viewChangeDetectorRef=null,this.inputChanges=null,this.hasInputChanges=!1,this.implementsOnChanges=!1,this.scheduledChangeDetectionFn=null,this.scheduledDestroyFn=null,this.initialInputValues=new Map,this.unchangedInputs=new Set(this.componentFactory.inputs.map(({propName:t})=>t)),this.ngZone=this.injector.get(Pl),this.elementZone="undefined"==typeof Zone?null:this.ngZone.run(()=>Zone.current)}connect(t){this.runInZone(()=>{if(null!==this.scheduledDestroyFn)return this.scheduledDestroyFn(),void(this.scheduledDestroyFn=null);null===this.componentRef&&this.initializeComponent(t)})}disconnect(){this.runInZone(()=>{null!==this.componentRef&&null===this.scheduledDestroyFn&&(this.scheduledDestroyFn=cu.schedule(()=>{null!==this.componentRef&&(this.componentRef.destroy(),this.componentRef=null,this.viewChangeDetectorRef=null)},10))})}getInputValue(t){return this.runInZone(()=>null===this.componentRef?this.initialInputValues.get(t):this.componentRef.instance[t])}setInputValue(t,e){this.runInZone(()=>{var n,r;null!==this.componentRef?((n=e)!==(r=this.getInputValue(t))&&(n==n||r==r)||void 0===e&&this.unchangedInputs.has(t))&&(this.recordInputChange(t,e),this.unchangedInputs.delete(t),this.hasInputChanges=!0,this.componentRef.instance[t]=e,this.scheduleDetectChanges()):this.initialInputValues.set(t,e)})}initializeComponent(t){const e=ui.create({providers:[],parent:this.injector}),n=function(t,e){const n=t.childNodes,r=e.map(()=>[]);let s=-1;e.some((t,e)=>"*"===t&&(s=e,!0));for(let i=0,o=n.length;i<o;++i){const t=n[i],o=du(t,e,s);-1!==o&&r[o].push(t)}return r}(t,this.componentFactory.ngContentSelectors);this.componentRef=this.componentFactory.create(e,n,t),this.viewChangeDetectorRef=this.componentRef.injector.get(Wo),this.implementsOnChanges="function"==typeof this.componentRef.instance.ngOnChanges,this.initializeInputs(),this.initializeOutputs(this.componentRef),this.detectChanges(),this.injector.get(ea).attachView(this.componentRef.hostView)}initializeInputs(){this.componentFactory.inputs.forEach(({propName:t})=>{this.initialInputValues.has(t)&&this.setInputValue(t,this.initialInputValues.get(t))}),this.initialInputValues.clear()}initializeOutputs(t){const e=this.componentFactory.outputs.map(({propName:e,templateName:n})=>t.instance[e].pipe(k(t=>({name:n,value:t}))));this.eventEmitters.next(e)}callNgOnChanges(t){if(!this.implementsOnChanges||null===this.inputChanges)return;const e=this.inputChanges;this.inputChanges=null,t.instance.ngOnChanges(e)}markViewForCheck(t){this.hasInputChanges&&(this.hasInputChanges=!1,t.markForCheck())}scheduleDetectChanges(){this.scheduledChangeDetectionFn||(this.scheduledChangeDetectionFn=cu.scheduleBeforeRender(()=>{this.scheduledChangeDetectionFn=null,this.detectChanges()}))}recordInputChange(t,e){if(!this.implementsOnChanges)return;null===this.inputChanges&&(this.inputChanges={});const n=this.inputChanges[t];if(n)return void(n.currentValue=e);const r=this.unchangedInputs.has(t),s=r?void 0:this.getInputValue(t);this.inputChanges[t]=new oe(s,e,r)}detectChanges(){null!==this.componentRef&&(this.callNgOnChanges(this.componentRef),this.markViewForCheck(this.viewChangeDetectorRef),this.componentRef.changeDetectorRef.detectChanges())}runInZone(t){return this.elementZone&&Zone.current!==this.elementZone?this.ngZone.run(t):t()}}class gu extends HTMLElement{constructor(){super(...arguments),this.ngElementEventsSubscription=null}}function _u(t,e){const n=function(t,e){return e.get(po).resolveComponentFactory(t).inputs}(t,e.injector),r=e.strategyFactory||new fu(t,e.injector),s=function(t){const e={};return t.forEach(({propName:t,templateName:n})=>{var r;e[(r=n,r.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`))]=t}),e}(n);class i extends gu{constructor(t){super(),this.injector=t}get ngElementStrategy(){if(!this._ngElementStrategy){const t=this._ngElementStrategy=r.create(this.injector||e.injector);n.forEach(({propName:e})=>{if(!this.hasOwnProperty(e))return;const n=this[e];delete this[e],t.setInputValue(e,n)})}return this._ngElementStrategy}attributeChangedCallback(t,e,n,r){this.ngElementStrategy.setInputValue(s[t],n)}connectedCallback(){let t=!1;this.ngElementStrategy.events&&(this.subscribeToEvents(),t=!0),this.ngElementStrategy.connect(this),t||this.subscribeToEvents()}disconnectedCallback(){this._ngElementStrategy&&this._ngElementStrategy.disconnect(),this.ngElementEventsSubscription&&(this.ngElementEventsSubscription.unsubscribe(),this.ngElementEventsSubscription=null)}subscribeToEvents(){this.ngElementEventsSubscription=this.ngElementStrategy.events.subscribe(t=>{const e=function(t,e,n){if("function"!=typeof CustomEvent){const r=t.createEvent("CustomEvent");return r.initCustomEvent(e,!1,!1,n),r}return new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:n})}(this.ownerDocument,t.name,t.value);this.dispatchEvent(e)})}}
5564return i.observedAttributes=Object.keys(s),n.forEach(({propName:t})=>{Object.defineProperty(i.prototype,t,{get(){return this.ngElementStrategy.getInputValue(t)},set(e){this.ngElementStrategy.setInputValue(t,e)},configurable:!0,enumerable:!0})}),i}new xo("11.2.3");class mu{constructor(){this.cloudRadians=Math.PI/180,this.cw=64,this.ch=2048,this._timeInterval=1/0,this._words=[],this._size=[256,256],this._font=()=>"serif",this._fontStyle=()=>"normal",this._fontWeight=()=>"normal",this._rotate=()=>30*(~~(6*Math.random())-3),this._text=t=>t.text||"",this._spiral=this.archimedeanSpiral,this._fontSize=t=>t.value||0,this._padding=()=>1,this._random=Math.random,this._canvas=()=>document.createElement("canvas"),this.timer=void 0,this.spirals={archimedean:this.archimedeanSpiral,rectangular:this.rectangularSpiral},this.event={word:t=>{},end:(t,e)=>{}}}start(){let t=this.getContext(this._canvas()),e=this.zeroArray((this._size[0]>>5)*this._size[1]),n=null,r=this._words.length,s=-1,i=[],o=this._words.map((t,e)=>(t.text=this._text(t,e),t.font=this._font(t,e),t.style=this._fontStyle(t,e),t.weight=this._fontWeight(t,e),t.rotate=this._rotate(t,e),t.size=~~this._fontSize(t,e),t.padding=this._padding(t,e),t)).sort((t,e)=>(e.size||0)-(t.size||0)),l=()=>{let l=Date.now();for(;Date.now()-l<this._timeInterval&&++s<r&&this.timer;){let r=o[s];r.x=this._size[0]*(this._random()+.5)>>1,r.y=this._size[1]*(this._random()+.5)>>1,this.cloudSprite(t,r,o,s),r.hasText&&this.place(e,r,n)&&(i.push(r),this.event.word(r),n?this.cloudBounds(n,r):n=[{x:r.x+(r.x0||0),y:r.y+(r.y0||0)},{x:r.x+(r.x1||0),y:r.y+(r.y1||0)}],r.x-=this._size[0]>>1,r.y-=this._size[1]>>1)}s>=r&&(this.stop(),this.event.end(i,n))};return this.timer&&clearInterval(this.timer),this.timer=window.setInterval(l,0),l(),this}stop(){return this.timer&&(clearInterval(this.timer),this.timer=void 0),this}getContext(t){let e=t.getContext("2d");if(!e)throw new Error("Cannot get canvas context");t.width=t.height=1;let n=Math.sqrt(e.getImageData(0,0,1,1).data.length>>2);return t.width=(this.cw<<5)/n,t.height=this.ch/n,e.fillStyle=e.strokeStyle="red",e.textAlign="center",{context:e,ratio:n}}place(t,e,n){let r,s,i,o=e.x,l=e.y,a=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),u=this._spiral(this._size),c=this._random()<.5?1:-1,h=-c;for(;(r=u(h+=c))&&(s=~~r[0],i=~~r[1],!(Math.min(Math.abs(s),Math.abs(i))>=a));)if(e.x=o+s,e.y=l+i,!(e.x+e.x0<0||e.y+e.y0<0||e.x+e.x1>this._size[0]||e.y+e.y1>this._size[1])&&(!n||!this.cloudCollide(e,t,this._size[0]))&&(!n||this.collideRects(e,n))){let n,r=e.sprite,s=e.width>>5,i=this._size[0]>>5,o=e.x-(s<<4),l=127&o,a=32-l,u=e.y1-e.y0,c=(e.y+e.y0)*i+(o>>5);for(let e=0;e<u;e++){n=0;for(let i=0;i<=s;i++)t[c+i]|=n<<a|(i<s?(n=r[e*s+i])>>>l:0);c+=i}return delete e.sprite,!0}return!1}timeInterval(t){return arguments.length?(this._timeInterval=null==t?1/0:t,this):this._timeInterval}words(t){return arguments.length?(this._words=t,this):this._words}size(t){return arguments.length?(this._size=[+t[0],+t[1]],this):this._size}font(t){return arguments.length?(this._font=this.functor(t),this):this._font}fontStyle(t){return arguments.length?(this._fontStyle=this.functor(t),this):this._fontStyle}fontWeight(t){return arguments.length?(this._fontWeight=this.functor(t),this):this._fontWeight}rotate(t){return arguments.length?(this._rotate=this.functor(t),this):this._rotate}text(t){return arguments.length?(this._text=this.functor(t),this):this._text}spiral(t){return arguments.length?(this._spiral=this.spirals[t]||t,this):this._spiral}fontSize(t){return arguments.length?(this._fontSize=this.functor(t),this):this._fontSize}padding(t){return arguments.length?(this._padding=this.functor(t),this):this._padding}random(t){return arguments.length?(this._random=t,this):this._random}canvas(t){return arguments.length?(this._canvas=this.functor(t),this):this._canvas}on(t,e){return 1===arguments.length?"word"===t?this.event.word:"end"===t?this.event.end:this:("word"===t?this.event.word=e:"end"===t&&(this.event.end=e),this)}cloudSprite(t,e,n,r){if(e.sprite)return;let s=t.context,i=t.ratio;s.clearRect(0,0,(this.cw<<5)/i,this.ch/i);let o=0,l=0,a=0,u=n.length;for(--r;++r<u;){if(void 0===(e=n[r]).size)continue;s.save(),s.font=e.style+" "+e.weight+" "+~~((e.size+1)/i)+"px "+e.font;let t=s.measureText(e.text+"m").width*i,u=e.size<<1;if(e.rotate){let n=Math.sin(e.rotate*this.cloudRadians),r=Math.cos(e.rotate*this.cloudRadians),s=t*r,i=t*n,o=u*r,l=u*n;t=Math.max(Math.abs(s+l),Math.abs(s-l))+31>>5<<5,u=~~Math.max(Math.abs(i+o),Math.abs(i-o))}else t=t+31>>5<<5;if(u>a&&(a=u),o+t>
5564=this.cw<<5&&(o=0,l+=a,a=0),l+u>=this.ch)break;s.translate((o+(t>>1))/i,(l+(u>>1))/i),e.rotate&&s.rotate(e.rotate*this.cloudRadians),s.fillText(e.text,0,0),e.padding&&(s.lineWidth=2*e.padding,s.strokeText(e.text,0,0)),s.restore(),e.width=t,e.height=u,e.xoff=o,e.yoff=l,e.x1=t>>1,e.y1=u>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,o+=t}let c=s.getImageData(0,0,(this.cw<<5)/i,this.ch/i).data,h=[];for(;--r>=0;){if(!(e=n[r]).hasText)continue;let t=e.width,s=t>>5,i=e.y1-e.y0;for(let e=0;e<i*s;e++)h[e]=0;if(o=e.xoff,null==o)return;l=e.yoff;let a=0,u=-1;for(let n=0;n<i;n++){for(let e=0;e<t;e++){let t=c[(l+n)*(this.cw<<5)+(o+e)<<2]?1<<31-e%32:0;h[s*n+(e>>5)]|=t,a|=t}a?u=n:(e.y0++,i--,n--,l++)}e.y1=e.y0+u,e.sprite=h.slice(0,(e.y1-e.y0)*s)}}cloudCollide(t,e,n){let r,s=t.sprite,i=t.width>>5,o=t.x-(i<<4),l=127&o,a=32-l,u=t.y1-t.y0,c=(t.y+t.y0)*(n>>=5)+(o>>5);for(let h=0;h<u;h++){r=0;for(let t=0;t<=i;t++)if((r<<a|(t<i?(r=s[h*i+t])>>>l:0))&e[c+t])return!0;c+=n}return!1}cloudBounds(t,e){let n=t[0],r=t[1];e.x+e.x0<n.x&&(n.x=e.x+e.x0),e.y+e.y0<n.y&&(n.y=e.y+e.y0),e.x+e.x1>r.x&&(r.x=e.x+e.x1),e.y+e.y1>r.y&&(r.y=e.y+e.y1)}collideRects(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0<e[1].x&&t.y+t.y1>
vendor: 20,015 bytes, line 5564
5564e[0].y&&t.y+t.y0<e[1].y}archimedeanSpiral(t){let e=t[0]/t[1];return t=>[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]}rectangularSpiral(t){let e=4*t[0]/t[1],n=0,r=0;return t=>{let s=t<0?-1:1;switch(Math.sqrt(1+4*s*t)-s&3){case 0:n+=e;break;case 1:r+=4;break;case 2:n-=e;break;default:r-=4}return[n,r]}}zeroArray(t){let e=[],n=-1;for(;++n<t;)e[n]=0;return e}functor(t){return"function"==typeof t?t:()=>t}}var yu={value:()=>{}};function vu(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new wu(r)}function wu(t){this._=t}function bu(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}function Cu(t,e){for(var n,r=0,s=t.length;r<s;++r)if((n=t[r]).name===e)return n.value}function xu(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=yu,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}wu.prototype=vu.prototype={constructor:wu,on:function(t,e){var n,r=this._,s=bu(t+"",r),i=-1,o=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++i<o;)if(n=(t=s[i]).type)r[n]=xu(r[n],t.name,e);else if(null==e)for(n in r)r[n]=xu(r[n],t.name,null);return this}for(;++i<o;)if((n=(t=s[i]).type)&&(n=Cu(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wu(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,s=new Array(n),i=0;i<n;++i)s[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(r=this._[t]).length;i<n;++i)r[i].value.apply(e,s)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,i=r.length;s<i;++s)r[s].value.apply(e,n)}};var Eu=vu;function Su(){}var ku=function(t){return null==t?Su:function(){return this.querySelector(t)}},Au=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)};function Tu(){return[]}var Iu=function(t){return null==t?Tu:function(){return this.querySelectorAll(t)}},Vu=function(t){return function(){return this.matches(t)}};function Ou(t){return function(e){return e.matches(t)}}var Mu=Array.prototype.find;function Du(){return this.firstElementChild}var Nu=Array.prototype.filter;function Pu(){return this.children}var Ru=function(t){return new Array(t.length)};function ju(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}ju.prototype={constructor:ju,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var Fu=function(t){return function(){return t}};function Hu(t,e,n,r,s,i){for(var o,l=0,a=e.length,u=i.length;l<u;++l)(o=e[l])?(o.__data__=i[l],r[l]=o):n[l]=new ju(t,i[l]);for(;l<a;++l)(o=e[l])&&(s[l]=o)}function zu(t,e,n,r,s,i,o){var l,a,u,c=new Map,h=e.length,d=i.length,f=new Array(h);for(l=0;l<h;++l)(a=e[l])&&(f[l]=u=o.call(a,a.__data__,l,e)+"",c.has(u)?s[l]=a:c.set(u,a));for(l=0;l<d;++l)u=o.call(t,i[l],l,i)+"",(a=c.get(u))?(r[l]=a,a.__data__=i[l],c.delete(u)):n[l]=new ju(t,i[l]);for(l=0;l<h;++l)(a=e[l])&&c.get(f[l])===a&&(s[l]=a)}function Lu(t){return t.__data__}function Bu(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var Wu="http://www.w3.org/1999/xhtml",$u={svg:"http://www.w3.org/2000/svg",xhtml:Wu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},Zu=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),$u.hasOwnProperty(e)?{space:$u[e],local:t}:t};function Uu(t){return function(){this.removeAttribute(t)}}function qu(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Gu(t,e){return function(){this.setAttribute(t,e)}}function Qu(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Yu(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Ku(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}var Xu=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function Ju(t){return function(){this.style.removeProperty(t)}}function tc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ec(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function nc(t,e){return t.style.getPropertyValue(e)||Xu(t).getComputedStyle(t,null).getPropertyValue(e)}function rc(t){return function(){delete this[t]}}function sc(t,e){return function(){this[t]=e}}function ic(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function oc(t){return t.trim().split(/^|\s+/)}function lc(t){return t.classList||new ac(t)}function ac(t){this._node=t,this._names=oc(t.getAttribute("class")||"")}function uc(t,e){for(var n=lc(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function cc(t,e){for(var n=lc(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function hc(t){return function(){uc(this,t)}}function dc(t){return function(){cc(this,t)}}function fc(t,e){return function(){(e.apply(this,arguments)?uc:cc)(this,t)}}function pc(){this.textContent=""}function gc(t){return function(){this.textContent=t}}function _c(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function mc(){this.innerHTML=""}function yc(t){return function(){this.innerHTML=t}}function vc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function wc(){this.nextSibling&&this.parentNode.appendChild(this)}function bc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Cc(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Wu&&e.documentElement.namespaceURI===Wu?e.createElement(t):e.createElementNS(n,t)}}function xc(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}ac.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Ec=function(t){var e=Zu(t);return(e.local?xc:Cc)(e)};function Sc(){return null}function kc(){var t=this.parentNode;t&&t.removeChild(this)}function Ac(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Tc(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ic(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}function Vc(t){return function(){var e=this.__on;if(e){for(var n,r=0,s=-1,i=e.length;r<i;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++s]=n:this.removeEventListener(n.type,n.listener,n.options);++s?e.length=s:delete this.__on}}}function Oc(t,e,n){return function(){var r,s=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(s)for(var o=0,l=s.length;o<l;++o)if((r=s[o]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),void(r.value=e);this.addEventListener(t.type,i,n),r={type:t.type,name:t.name,value:e,listener:i,options:n},s?s.push(r):this.__on=[r]}}function Mc(t,e,n){var r=Xu(t),s=r.CustomEvent;"function"==typeof s?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function Dc(t,e){return function(){return Mc(this,t,e)}}function Nc(t,e){return function(){return Mc(this,t,e.apply(this,arguments))}}var Pc=[null];function Rc(t,e){this._groups=t,this._parents=e}function jc(){return new Rc([[document.documentElement]],Pc)}Rc.prototype=jc.prototype={constructor:Rc,select:function(t){"function"!=typeof t&&(t=ku(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i,o,l=e[s],a=l.length,u=r[s]=new Array(a),c=0;c<a;++c)(i=l[c])&&(o=t.call(i,i.__data__,c,l))&&("__data__"in i&&(o.__data__=i.__data__),u[c]=o);return new Rc(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:Au(e)}}(t):Iu(t);for(var e=this._groups,n=e.length,r=[],s=[],i=0;i<n;++i)for(var o,l=e[i],a=l.length,u=0;u<a;++u)(o=l[u])&&(r.push(t.call(o,o.__data__,u,l)),s.push(o));return new Rc(r,s)},selectChild:function(t){return this.select(null==t?Du:function(t){return function(){return Mu.call(this.children,t)}}("function"==typeof t?t:Ou(t)))},selectChildren:function(t){return this.selectAll(null==t?Pu:function(t){return function(){return Nu.call(this.children,t)}}("function"==typeof t?t:Ou(t)))},filter:function(t){"function"!=typeof t&&(t=Vu(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i,o=e[s],l=o.length,a=r[s]=[],u=0;u<l;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&a.push(i);return new Rc(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Lu);var n=e?zu:Hu,r=this._parents,s=this._groups;"function"!=typeof t&&(t=Fu(t));for(var i=s.length,o=new Array(i),l=new Array(i),a=new Array(i),u=0;u<i;++u){var c=r[u],h=s[u],d=h.length,f=Au(t.call(c,c&&c.__data__,u,r)),p=f.length,g=l[u]=new Array(p),_=o[u]=new Array(p),m=a[u]=new Array(d);n(c,h,g,_,m,f,e);for(var y,v,w=0,b=0;w<p;++w)if(y=g[w]){for(w>=b&&(b=w+1);!(v=_[b])&&++b<p;);y._next=v||null}}return(o=new Rc(o,r))._enter=l,o._exit=a,o},enter:function(){return new Rc(this._enter||this._groups.map(Ru),this._parents)},exit:function(){return new Rc(this._exit||this._groups.map(Ru),this._parents)},join:function(t,e,n){var r=this.enter(),s=this,i=this.exit();return r="function"==typeof t?t(r):r.append(t+""),null!=e&&(s=e(s)),null==n?i.remove():n(i),r&&s?r.merge(s).order():s},merge:function(t){if(!(t instanceof Rc))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,r=e.length,s=Math.min(r,n.length),i=new Array(r),o=0;o<s;++o)for(var l,a=e[o],u=n[o],c=a.length,h=i[o]=new Array(c),d=0;d<c;++d)(l=a[d]||u[d])&&(h[d]=l);for(;o<r;++o)i[o]=e[o];return new Rc(i,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,s=t[e],i=s.length-1,o=s[i];--i>=0;)(r=s[i])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Bu);for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o,l=n[i],a=l.length,u=s[i]=new Array(a),c=0;c<a;++c)(o=l[c])&&(u[c]=o);u.sort(e)}return new Rc(s,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s,i=e[n],o=0,l=i.length;o<l;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this},attr:function(t,e){var n=Zu(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?qu:Uu:"function"==typeof e?n.local?Ku:Yu:n.local?Qu:Gu)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Ju:"function"==typeof e?ec:tc)(t,e,null==n?"":n)):nc(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?rc:"function"==typeof e?ic:sc)(t,e)):this.node()[t]},classed:function(t,e){var n=oc(t+"");if(arguments.length<2){for(var r=lc(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each(("function"==typeof e?fc:e?hc:dc)(n,e))},text:function(t){return arguments.length?this.each(null==t?pc:("function"==typeof t?_c:gc)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?mc:("function"==typeof t?vc:yc)(t)):this.node().innerHTML},raise:function(){return this.each(wc)},lower:function(){return this.each(bc)},append:function(t){var e="function"==typeof t?t:Ec(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Ec(t),r=null==e?Sc:"function"==typeof e?e:ku(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(kc)},clone:function(t){return this.select(t?Tc:Ac)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,s,i=Ic(t+""),o=i.length;if(!(arguments.length<2)){for(l=e?Oc:Vc,r=0;r<o;++r)this.each(l(i[r],e,n));return this}var l=this.node().__on;if(l)for(var a,u=0,c=l.length;u<c;++u)for(r=0,a=l[u];r<o;++r)if((s=i[r]).type===a.type&&s.name===a.name)return a.value},dispatch:function(t,e){return this.each(("function"==typeof e?Nc:Dc)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,s=t[e],i=0,o=s.length;i<o;++i)(r=s[i])&&(yield r)}};var Fc=jc,Hc=function(t,e,n){t.prototype=e.prototype=n,n.constructor=t};function zc(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Lc(){}var Bc=.7,Wc=1/Bc,$c="\\s*([+-]?\\d+)\\s*",Zc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",Uc="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qc=/^#([0-9a-f]{3,8})$/,Gc=new RegExp("^rgb\\("+[$c,$c,$c]+"\\)$"),Qc=new RegExp("^rgb\\("+[Uc,Uc,Uc]+"\\)$"),Yc=new RegExp("^rgba\\("+[$c,$c,$c,Zc]+"\\)$"),Kc=new RegExp("^rgba\\("+[Uc,Uc,Uc,Zc]+"\\)$"),Xc=new RegExp("^hsl\\("+[Zc,Uc,Uc]+"\\)$"),Jc=new RegExp("^hsla\\("+[Zc,Uc,Uc,Zc]+"\\)$"),th={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function eh(){return this.rgb().formatHex()}function nh(){return this.rgb().formatRgb()}function rh(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=qc.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?sh(e):3===n?new ah(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?ih(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?ih(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=Gc.exec(t))?new ah(e[1],e[2],e[3],1):(e=Qc.exec(t))?new ah(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=Yc.exec(t))?ih(e[1],e[2],e[3],e[4]):(e=Kc.exec(t))?ih(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Xc.exec(t))?dh(e[1],e[2]/100,e[3]/100,1):(e=Jc.exec(t))?dh(e[1],e[2]/100,e[3]/100,e[4]):th.hasOwnProperty(t)?sh(th[t]):"transparent"===t?new ah(NaN,NaN,NaN,0):null}function sh(t){return new ah(t>>16&255,t>>8&255,255&t,1)}function ih(t,e,n,r){return r<=0&&(t=e=n=NaN),new ah(t,e,n,r)}function oh(t){return t instanceof Lc||(t=rh(t)),t?new ah((t=t.rgb()).r,t.g,t.b,t.opacity):new ah}function lh(t,e,n,r){return 1===arguments.length?oh(t):new ah(t,e,n,null==r?1:r)}function ah(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function uh(){return"#"+hh(this.r)+hh(this.g)+hh(this.b)}function ch(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===t?")":", "+t+")")}function hh(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function dh(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ph(t,e,n,r)}function fh(t){if(t instanceof ph)return new ph(t.h,t.s,t.l,t.opacity);if(t instanceof Lc||(t=rh(t)),!t)return new ph;if(t instanceof ph)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,l=i-s,a=(i+s)/2;return l?(o=e===i?(n-r)/l+6*(n<r):n===i?(r-e)/l+2:(e-n)/l+4,l/=a<.5?i+s:2-i-s,o*=60):l=a>0&&a<1?0:o,new ph(o,l,a,t.opacity)}function ph(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function gh(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}function _h(t,e,n,r,s){var i=t*t,o=i*t;return((1-3*t+3*i-o)*e+(4-6*i+3*o)*n+(1+3*t+3*i-3*o)*r+o*s)/6}Hc(Lc,rh,{copy:function(t){return Object.assign(new this.constructor,this,t)},displayable:function(){return this.rgb().displayable()},hex:eh,formatHex:eh,formatHsl:function(){return fh(this).formatHsl()},formatRgb:nh,toString:nh}),Hc(ah,lh,zc(Lc,{brighter:function(t){return t=null==t?Wc:Math.pow(Wc,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?Bc:Math.pow(Bc,t),new ah(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1}
vendor: 4,934 bytes, line 5564
5564,hex:uh,formatHex:uh,formatRgb:ch,toString:ch})),Hc(ph,function(t,e,n,r){return 1===arguments.length?fh(t):new ph(t,e,n,null==r?1:r)},zc(Lc,{brighter:function(t){return t=null==t?Wc:Math.pow(Wc,t),new ph(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?Bc:Math.pow(Bc,t),new ph(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new ah(gh(t>=240?t-240:t+120,s,r),gh(t,s,r),gh(t<120?t+240:t-120,s,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var t=this.opacity;return(1===(t=isNaN(t)?1:Math.max(0,Math.min(1,t)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===t?")":", "+t+")")}}));var mh=t=>()=>t;function yh(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):mh(isNaN(t)?e:t)}var vh=function t(e){var n=function(t){return 1==(t=+t)?yh:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):mh(isNaN(e)?n:e)}}(e);function r(t,e){var r=n((t=lh(t)).r,(e=lh(e)).r),s=n(t.g,e.g),i=n(t.b,e.b),o=yh(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=s(e),t.b=i(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function wh(t){return function(e){var n,r,s=e.length,i=new Array(s),o=new Array(s),l=new Array(s);for(n=0;n<s;++n)r=lh(e[n]),i[n]=r.r||0,o[n]=r.g||0,l[n]=r.b||0;return i=t(i),o=t(o),l=t(l),r.opacity=1,function(t){return r.r=i(t),r.g=o(t),r.b=l(t),r+""}}}wh(function(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),s=t[r],i=t[r+1];return _h((n-r/e)*e,r>0?t[r-1]:2*s-i,s,i,r<e-1?t[r+2]:2*i-s)}}),wh(function(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e);return _h((n-r/e)*e,t[(r+e-1)%e],t[r%e],t[(r+1)%e],t[(r+2)%e])}});var bh,Ch,xh=function(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}},Eh=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Sh=new RegExp(Eh.source,"g"),kh=function(t,e){var n,r,s,i=Eh.lastIndex=Sh.lastIndex=0,o=-1,l=[],a=[];for(t+="",e+="";(n=Eh.exec(t))&&(r=Sh.exec(e));)(s=r.index)>i&&(s=e.slice(i,s),l[o]?l[o]+=s:l[++o]=s),(n=n[0])===(r=r[0])?l[o]?l[o]+=r:l[++o]=r:(l[++o]=null,a.push({i:o,x:xh(n,r)})),i=Sh.lastIndex;return i<e.length&&(s=e.slice(i),l[o]?l[o]+=s:l[++o]=s),l.length<2?a[0]?function(t){return function(e){return t(e)+""}}(a[0].x):function(t){return function(){return t}}(e):(e=a.length,function(t){for(var n,r=0;r<e;++r)l[(n=a[r]).i]=n.x(t);return l.join("")})},Ah=0,Th=0,Ih=0,Vh=0,Oh=0,Mh=0,Dh="object"==typeof performance&&performance.now?performance:Date,Nh="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ph(){return Oh||(Nh(Rh),Oh=Dh.now()+Mh)}function Rh(){Oh=0}function jh(){this._call=this._time=this._next=null}function Fh(t,e,n){var r=new jh;return r.restart(t,e,n),r}function Hh(){Oh=(Vh=Dh.now())+Mh,Ah=Th=0;try{!function(){Ph(),++Ah;for(var t,e=bh;e;)(t=Oh-e._time)>=0&&e._call.call(null,t),e=e._next;--Ah}()}finally{Ah=0,function(){for(var t,e,n=bh,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:bh=e);Ch=t,Lh(r)}(),Oh=0}}function zh(){var t=Dh.now(),e=t-Vh;e>1e3&&(Mh-=e,Vh=t)}function Lh(t){Ah||(Th&&(Th=clearTimeout(Th)),t-Oh>24?(t<1/0&&(Th=setTimeout(Hh,t-Dh.now()-Mh)),Ih&&(Ih=clearInterval(Ih))):(Ih||(Vh=Dh.now(),Ih=setInterval(zh,1e3)),Ah=1,Nh(Hh)))}jh.prototype=Fh.prototype={constructor:jh,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?Ph():+n)+(null==e?0:+e),this._next||Ch===this||(Ch?Ch._next=this:bh=this,Ch=this),this._call=t,this._time=n,Lh()},stop:function(){this._call&&(this._call=null,this._time=1/0,Lh())}};var Bh=function(t,e,n){var r=new jh;return r.restart(n=>{r.stop(),t(n+e)},e=null==e?0:+e,n),r},Wh=Eu("start","end","cancel","interrupt"),$h=[],Zh=function(t,e,n,r,s,i){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,s=t.__transition;function i(a){var u,c,h,d;if(1!==n.state)return l();for(u in s)if((d=s[u]).name===n.name){if(3===d.state)return Bh(i);4===d.state?(d.state=6,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete s[u]):+u<e&&(d.state=6,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete s[u])}if(Bh(function(){3===n.state&&(n.state=4,n.timer.restart(o,n.delay,n.time),o(a))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),u=0,c=-1;u<h;++u)(d=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(r[++c]=d);r.length=c+1}}function o(e){for(var s=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1
vendor: 4,830 bytes, line 5564
5564),i=-1,o=r.length;++i<o;)r[i].call(t,s);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete s[e],s)return;delete t.__transition}s[e]=n,n.timer=Fh(function(t){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=t&&i(t-n.delay)},0,n.time)}(t,n,{name:e,index:r,group:s,on:Wh,tween:$h,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})};function Uh(t,e){var n=Gh(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function qh(t,e){var n=Gh(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Gh(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}var Qh,Yh=180/Math.PI,Kh={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},Xh=function(t,e,n,r,s,i){var o,l,a;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(a=t*n+e*r)&&(n-=t*a,r-=e*a),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,a/=l),t*r<e*n&&(t=-t,e=-e,a=-a,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(e,t)*Yh,skewX:Math.atan(a)*Yh,scaleX:o,scaleY:l}};function Jh(t,e,n,r){function s(t){return t.length?t.pop()+" ":""}return function(i,o){var l=[],a=[];return i=t(i),o=t(o),function(t,r,s,i,o,l){if(t!==s||r!==i){var a=o.push("translate(",null,e,null,n);l.push({i:a-4,x:xh(t,s)},{i:a-2,x:xh(r,i)})}else(s||i)&&o.push("translate("+s+e+i+n)}(i.translateX,i.translateY,o.translateX,o.translateY,l,a),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(s(n)+"rotate(",null,r)-2,x:xh(t,e)})):e&&n.push(s(n)+"rotate("+e+r)}(i.rotate,o.rotate,l,a),function(t,e,n,i){t!==e?i.push({i:n.push(s(n)+"skewX(",null,r)-2,x:xh(t,e)}):e&&n.push(s(n)+"skewX("+e+r)}(i.skewX,o.skewX,l,a),function(t,e,n,r,i,o){if(t!==n||e!==r){var l=i.push(s(i)+"scale(",null,",",null,")");o.push({i:l-4,x:xh(t,n)},{i:l-2,x:xh(e,r)})}else 1===n&&1===r||i.push(s(i)+"scale("+n+","+r+")")}(i.scaleX,i.scaleY,o.scaleX,o.scaleY,l,a),i=o=null,function(t){for(var e,n=-1,r=a.length;++n<r;)l[(e=a[n]).i]=e.x(t);return l.join("")}}}var td=Jh(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Kh:Xh(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),ed=Jh(function(t){return null==t?Kh:(Qh||(Qh=document.createElementNS("http://www.w3.org/2000/svg","g")),Qh.setAttribute("transform",t),(t=Qh.transform.baseVal.consolidate())?Xh((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Kh)},", ",")",")");function nd(t,e){var n,r;return function(){var s=qh(this,t),i=s.tween;if(i!==n)for(var o=0,l=(r=n=i).length;o<l;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}s.tween=r}}function rd(t,e,n){var r,s;if("function"!=typeof n)throw new Error;return function(){var i=qh(this,t),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:e,value:n},a=0,u=s.length;a<u;++a)if(s[a].name===e){s[a]=l;break}a===u&&s.push(l)}i.tween=s}}function sd(t,e,n){var r=t._id;return t.each(function(){var t=qh(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Gh(t,r).value[e]}}var id=function(t,e){var n;return("number"==typeof e?xh:e instanceof rh?vh:(n=rh(e))?(e=n,vh):kh)(t,e)};function od(t){return function(){this.removeAttribute(t)}}function ld(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ad(t,e,n){var r,s,i=n+"";return function(){var o=this.getAttribute(t);return o===i?null:o===r?s:s=e(r=o,n)}}function ud(t,e,n){var r,s,i=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===i?null:o===r?s:s=e(r=o,n)}}function cd(t,e,n){var r,s,i;return function(){var o,l,a=n(this);if(null!=a)return(o=this.getAttribute(t))===(l=a+"")?null:o===r&&l===s?i:(s=l,i=e(r=o,a));this.removeAttribute(t)}}function hd(t,e,n){var r,s,i;return function(){var o,l,a=n(this);if(null!=a)return(o=this.getAttributeNS(t.space,t.local))===(l=a+"")?null:o===r&&l===s?i:(s=l,i=e(r=o,a));this.removeAttributeNS(t.space,t.local)}}function dd(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function fd(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function pd(t,e){var n,r;function s(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&fd(t,s)),n}return s._value=e,s}function gd(t,e){var n,r;function s(){var s=e.apply(this,arguments);return s!==r&&(n=(r=s)&&dd(t,s)),n}return s._value=e,s}function _d(t,e){return function(){Uh(this,t).delay=+e.apply(this,arguments)}}function md(t,e){return e=+e,function(){Uh(this,t).delay=e}}function yd(t,e){return function(){qh(this,t).duration=+e.apply(this,arguments)}}function vd(t,e){return e=+e,function(){qh(this,t).duration=e}}function wd(t,e){if("function"!=typeof e)throw new Error;return function(){qh(this,t).ease=e}}function bd(t,e,n){var r,s,i=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>
vendor: 6,943 bytes, line 5564
5564=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Uh:qh;return function(){var o=i(this,t),l=o.on;l!==r&&(s=(r=l).copy()).on(e,n),o.on=s}}var Cd=Fc.prototype.constructor;function xd(t){return function(){this.style.removeProperty(t)}}function Ed(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Sd(t,e,n){var r,s;function i(){var i=e.apply(this,arguments);return i!==s&&(r=(s=i)&&Ed(t,i,n)),r}return i._value=e,i}function kd(t){return function(e){this.textContent=t.call(this,e)}}function Ad(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&kd(r)),e}return r._value=t,r}var Td=0;function Id(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function Vd(){return++Td}var Od=Fc.prototype;Id.prototype=(function(t){return Fc().transition(t)}).prototype={constructor:Id,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=ku(t));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l,a,u=r[o],c=u.length,h=i[o]=new Array(c),d=0;d<c;++d)(l=u[d])&&(a=t.call(l,l.__data__,d,u))&&("__data__"in l&&(a.__data__=l.__data__),h[d]=a,Zh(h[d],e,n,d,h,Gh(l,n)));return new Id(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Iu(t));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var a,u=r[l],c=u.length,h=0;h<c;++h)if(a=u[h]){for(var d,f=t.call(a,a.__data__,h,u),p=Gh(a,n),g=0,_=f.length;g<_;++g)(d=f[g])&&Zh(d,e,n,g,f,p);i.push(f),o.push(a)}return new Id(i,o,e,n)},filter:function(t){"function"!=typeof t&&(t=Vu(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i,o=e[s],l=o.length,a=r[s]=[],u=0;u<l;++u)(i=o[u])&&t.call(i,i.__data__,u,o)&&a.push(i);return new Id(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=Math.min(r,n.length),i=new Array(r),o=0;o<s;++o)for(var l,a=e[o],u=n[o],c=a.length,h=i[o]=new Array(c),d=0;d<c;++d)(l=a[d]||u[d])&&(h[d]=l);for(;o<r;++o)i[o]=e[o];return new Id(i,this._parents,this._name,this._id)},selection:function(){return new Cd(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=Vd(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o,l=r[i],a=l.length,u=0;u<a;++u)if(o=l[u]){var c=Gh(o,e);Zh(o,t,n,u,l,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Id(r,this._parents,t,n)},call:Od.call,nodes:Od.nodes,node:Od.node,size:Od.size,empty:Od.empty,each:Od.each,on:function(t,e){var n=this._id;return arguments.length<2?Gh(this.node(),n).on.on(t):this.each(bd(n,t,e))},attr:function(t,e){var n=Zu(t),r="transform"===n?ed:id;return this.attrTween(t,"function"==typeof e?(n.local?hd:cd)(n,r,sd(this,"attr."+t,e)):null==e?(n.local?ld:od)(n):(n.local?ud:ad)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Zu(t);return this.tween(n,(r.local?pd:gd)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?td:id;return null==e?this.styleTween(t,function(t,e){var n,r,s;return function(){var i=nc(this,t),o=(this.style.removeProperty(t),nc(this,t));return i===o?null:i===n&&o===r?s:s=e(n=i,r=o)}}(t,r)).on("end.style."+t,xd(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,s,i;return function(){var o=nc(this,t),l=n(this),a=l+"";return null==l&&(this.style.removeProperty(t),a=l=nc(this,t)),o===a?null:o===r&&a===s?i:(s=a,i=e(r=o,l))}}(t,r,sd(this,"style."+t,e))).each(function(t,e){var n,r,s,i,o="style."+e,l="end."+o;return function(){var a=qh(this,t),u=a.on,c=null==a.value[o]?i||(i=xd(e)):void 0;u===n&&s===c||(r=(n=u).copy()).on(l,s=c),a.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,s,i=n+"";return function(){var o=nc(this,t);return o===i?null:o===r?s:s=e(r=o,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,Sd(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(sd(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,Ad(t))},remove:function(){return this.on("end.remove",(t=this._id,function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}));var t},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,s=Gh(this.node(),n).tween,i=0,o=s.length;i<o;++i)if((r=s[i]).name===t)return r.value;return null}return this.each((null==e?nd:rd)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?_d:md)(e,t)):Gh(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?yd:vd)(e,t)):Gh(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(wd(e,t)):Gh(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;qh(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},a={value:function(){0==--s&&i()}};n.each(function(){var n=qh(this,r),s=n.on;s!==t&&((e=(t=s).copy())._.cancel.push(l),e._.interrupt.push(l),e._.end.push(a)),n.on=e}),0===s&&i()})},[Symbol.iterator]:Od[Symbol.iterator]};var Md={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function Dd(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Nd(t){return{type:t}}function Pd(t){return((t=Math.exp(t))+1/t)/2}function Rd(t,e,n){this.k=t,this.x=e,this.y=n}Fc.prototype.interrupt=function(t){return this.each(function(){!function(t,e){var n,r,s,i=t.__transition,o=!0;if(i){for(s in e=null==e?null:e+"",i)(n=i[s]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[s]):o=!1;o&&delete t.__transition}}(this,t)})},Fc.prototype.transition=function(t){var e,n;t instanceof Id?(e=t._id,t=t._name):(e=Vd(),(n=Md).time=Ph(),t=null==t?null:t+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o,l=r[i],a=l.length,u=0;u<a;++u)(o=l[u])&&Zh(o,t,e,u,l,n||Dd(o,e));return new Id(r,this._parents,t,e)},Math,["w","e"].map(Nd),["n","s"].map(Nd),["n","w","e","s","nw","ne","sw","se"].map(Nd),function t(e,n,r){function s(t,
5564s){var i,o,l=t[0],a=t[1],u=t[2],c=s[2],h=s[0]-l,d=s[1]-a,f=h*h+d*d;if(f<1e-12)o=Math.log(c/u)/e,i=function(t){return[l+t*h,a+t*d,u*Math.exp(e*t*o)]};else{var p=Math.sqrt(f),g=(c*c-u*u+r*f)/(2*u*n*p),_=(c*c-u*u-r*f)/(2*c*n*p),m=Math.log(Math.sqrt(g*g+1)-g),y=Math.log(Math.sqrt(_*_+1)-_);o=(y-m)/e,i=function(t){var r,s=t*o,i=Pd(m),c=u/(n*p)*(i*(r=e*s+m,((r=Math.exp(2*r))-1)/(r+1))-function(t){return((t=Math.exp(t))-1/t)/2}(m));return[l+c*h,a+c*d,u*i/Pd(e*s+m)]}}return i.duration=1e3*o*e/Math.SQRT2,i}return s.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},s}(Math.SQRT2,2,4),Rd.prototype={constructor:Rd,scale:function(t){return 1===t?this:new Rd(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new Rd(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}},new Rd(1,0,0);const jd=new Xa(Qa),Fd={leading:!0,trailing:!1};class Hd{constructor(t,e,n,r){this.duration=t,this.scheduler=e,this.leading=n,this.trailing=r}call(t,e){return e.subscribe(new zd(t,this.duration,this.scheduler,this.leading,this.trailing))}}class zd extends p{constructor(t,e,n,r,s){super(t),this.duration=e,this.scheduler=n,this.leading=r,this.trailing=s,this._hasTrailingValue=!1,this._trailingValue=null}_next(t){this.throttled?this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Ld,this.duration,{subscriber:this})),this.leading?this.destination.next(t):this.trailing&&(this._trailingValue=t,this._hasTrailingValue=!0))}_complete(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()}clearThrottle(){const t=this.throttled;t&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),t.unsubscribe(),this.remove(t),this.throttled=null)}}function Ld(t){const{subscriber:e}=t;e.clearThrottle()}class Bd{constructor(t,e){this.compare=t,this.keySelector=e}call(t,e){return e.subscribe(new Wd(t,this.compare,this.keySelector))}}class Wd extends p{constructor(t,e,n){super(t),this.keySelector=n,this.hasKey=!1,"function"==typeof e&&(this.compare=e)}compare(t,e){return t===e}_next(t){let e;try{const{keySelector:n}=this;e=n?n(t):t}catch(r){return this.destination.error(r)}let n=!1;if(this.hasKey)try{const{compare:t}=this;n=t(this.key,e)}catch(r){return this.destination.error(r)}else this.hasKey=!0;n||(this.key=e,this.destination.next(t))}}function $d(t,e){return new y(n=>{const r=t.length;if(0===r)return void n.complete();const s=new Array(r);let i=0,o=0;for(let l=0;l<r;l++){const a=R(t[l]);let u=!1;n.add(a.subscribe({next:t=>{u||(u=!0,o++),s[l]=t},error:t=>n.error(t),complete:()=>{i++,i!==r&&u||(o===r&&n.next(e?e.reduce((t,e,n)=>(t[e]=s[n],t),{}):s),n.complete())}}))}})}const Zd=new Fn("NgValueAccessor"),Ud={provide:Zd,useExisting:st(()=>qd),multi:!0};let qd=(()=>{class t{constructor(t,e){this._renderer=t,this._elementRef=e,this.onChange=t=>{},this.onTouched=()=>{}}writeValue(t){this._renderer.setProperty(this._elementRef.nativeElement,"checked",t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo))},t.\u0275dir=Gt({type:t,selectors:[["input","type","checkbox","formControlName",""],["input","type","checkbox","formControl",""],["input","type","checkbox","ngModel",""]],hostBindings:function(t,e){1&t&&Oi("change",function(t){return e.onChange(t.target.checked)})("blur",function(){return e.onTouched()})},features:[co([Ud])]}),t})();const Gd={provide:Zd,useExisting:st(()=>Yd),multi:!0},Qd=new Fn("CompositionEventMode");let Yd=(()=>{class t{constructor(t,e,n){this._renderer=t,this._elementRef=e,this._compositionMode=n,this.onChange=t=>{},this.onTouched=()=>{},this._composing=!1,null==this._compositionMode&&(this._compositionMode=!function(){const t=la()?la().getUserAgent():"";return/android (\d+)/.test(t.toLowerCase())}())}writeValue(t){this._renderer.setProperty(this._elementRef.nativeElement,"value",null==t?"":t)}registerOnChange(t){this.onChange=t}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}_handleInput(t){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(t)}
5564_compositionStart(){this._composing=!0}_compositionEnd(t){this._composing=!1,this._compositionMode&&this.onChange(t)}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo),xi(Qd,8))},t.\u0275dir=Gt({type:t,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(t,e){1&t&&Oi("input",function(t){return e._handleInput(t.target.value)})("blur",function(){return e.onTouched()})("compositionstart",function(){return e._compositionStart()})("compositionend",function(t){return e._compositionEnd(t.target.value)})},features:[co([Gd])]}),t})();function Kd(t){return null==t||0===t.length}function Xd(t){return null!=t&&"number"==typeof t.length}const Jd=new Fn("NgValidators"),tf=new Fn("NgAsyncValidators"),ef=/^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;class nf{static min(t){return e=>{if(Kd(e.value)||Kd(t))return null;const n=parseFloat(e.value);return!isNaN(n)&&n<t?{min:{min:t,actual:e.value}}:null}}static max(t){return e=>{if(Kd(e.value)||Kd(t))return null;const n=parseFloat(e.value);return!isNaN(n)&&n>t?{max:{max:t,actual:e.value}}:null}}static required(t){return Kd(t.value)?{required:!0}:null}static requiredTrue(t){return!0===t.value?null:{required:!0}}static email(t){return Kd(t.value)||ef.test(t.value)?null:{email:!0}}static minLength(t){return e=>Kd(e.value)||!Xd(e.value)?null:e.value.length<t?{minlength:{requiredLength:t,actualLength:e.value.length}}:null}static maxLength(t){return e=>Xd(e.value)&&e.value.length>t?{maxlength:{requiredLength:t,actualLength:e.value.length}}:null}static pattern(t){if(!t)return nf.nullValidator;let e,n;return"string"==typeof t?(n="","^"!==t.charAt(0)&&(n+="^"),n+=t,"$"!==t.charAt(t.length-1)&&(n+="$"),e=new RegExp(n)):(n=t.toString(),e=t),t=>{if(Kd(t.value))return null;const r=t.value;return e.test(r)?null:{pattern:{requiredPattern:n,actualValue:r}}}}static nullValidator(t){return null}static compose(t){if(!t)return null;const e=t.filter(rf);return 0==e.length?null:function(t){return of(lf(t,e))}}static composeAsync(t){if(!t)return null;const e=t.filter(rf);return 0==e.length?null:function(t){return function(...t){if(1===t.length){const e=t[0];if(a(e))return $d(e,null);if(u(e)&&Object.getPrototypeOf(e)===Object.prototype){const t=Object.keys(e);return $d(t.map(t=>e[t]),t)}}if("function"==typeof t[t.length-1]){const e=t.pop();return $d(t=1===t.length&&a(t[0])?t[0]:t,null).pipe(k(t=>e(...t)))}return $d(t,null)}(lf(t,e).map(sf)).pipe(k(of))}}}function rf(t){return null!=t}function sf(t){const e=Vi(t)?R(t):t;return e,e}function of(t){let e={};return t.forEach(t=>{e=null!=t?Object.assign(Object.assign({},e),t):e}),0===Object.keys(e).length?null:e}function lf(t,e){return e.map(e=>e(t))}function af(t){return t.map(t=>function(t){return!t.validate}(t)?t:e=>t.validate(e))}function uf(t){return null!=t?nf.compose(af(t)):null}function cf(t){return null!=t?nf.composeAsync(af(t)):null}function hf(t,e){return null===t?[e]:Array.isArray(t)?[...t,e]:[t,e]}let df=(()=>{class t{constructor(){this._rawValidators=[],this._rawAsyncValidators=[],this._onDestroyCallbacks=[]}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(t){this._rawValidators=t||[],this._composedValidatorFn=uf(this._rawValidators)}_setAsyncValidators(t){this._rawAsyncValidators=t||[],this._composedAsyncValidatorFn=cf(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(t){this._onDestroyCallbacks.push(t)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(t=>t()),this._onDestroyCallbacks=[]}reset(t){this.control&&this.control.reset(t)}hasError(t,e){return!!this.control&&this.control.hasError(t,e)}getError(t,e){return this.control?this.control.getError(t,e):null}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275dir=Gt({type:t}),t})(),ff=(()=>{class t extends df{get formDirective(){return null}get path(){return null}}return t.\u0275fac=function(e){return pf(e||t)},t.\u0275dir=Gt({type:t,features:[hi]}),t})();const pf=Pn(ff);class gf extends df{constructor(){super(...arguments),this._parent=null,this.name=null,this.valueAccessor=null}}let _f=(()=>{class t extends class{constructor(t){this._cd=t}is(t){var e,n;return!!(null===(n=null===(e=this._cd)||void 0===e?void 0:e.control)||void 0===n?void 0:n[t])}}{constructor(t){super(t)}}return t.\u0275fac=function(e){return new(e||t)(xi(gf,2))},t.\u0275dir=Gt({type:t,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(t,e){2&t&&zi("ng-untouched",e.is("untouched"))("ng-touched",e.is("touched"))("ng-pristine",e.is("pristine"))("ng-dirty",e.is("dirty"))("ng-valid",e.is("valid"))("ng-invalid",e.is("invalid"))("ng-pending",e.is("pending"))},features:[hi]}),t})();const mf={provide:Zd,useExisting:st(()=>yf),multi:!0};let yf=(()=>{class t{constructor(t,e){this._renderer=t,this._elementRef=e,this.onChange=t=>{},this.onTouched=()=>{}}writeValue(t){this._renderer.setProperty(this._elementRef.nativeElement,"value",null==t?"":t)}registerOnChange(t){this.onChange=e=>{t(""==e?null:parseFloat(e))}}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo))},t.\u0275dir=Gt({type:t,selectors:[["input","type","number","formControlName",""],["input","type","number","formControl",""],["input","type","number","ngModel",""]],hostBindings:function(t,e){1&t&&Oi("input",function(t){return e.onChange(t.target.value)})("blur",function(){return e.onTouched()})},features:[co([mf])]}),t})();const vf={provide:Zd,useExisting:st(()=>bf),multi:!0};let wf=(()=>{class t{constructor(){this._accessors=[]}add(t,e){this._accessors.push([t,e])}remove(t){for(let e=this._accessors.length-1;e>=0;--e)if(this._accessors[e][1]===t)return void this._accessors.splice(e,1)}
5564select(t){this._accessors.forEach(e=>{this._isSameGroup(e,t)&&e[1]!==t&&e[1].fireUncheck(t.value)})}_isSameGroup(t,e){return!!t[0].control&&t[0]._parent===e._control._parent&&t[1].name===e.name}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275prov=ht({token:t,factory:t.\u0275fac}),t})(),bf=(()=>{class t{constructor(t,e,n,r){this._renderer=t,this._elementRef=e,this._registry=n,this._injector=r,this.onChange=()=>{},this.onTouched=()=>{}}ngOnInit(){this._control=this._injector.get(gf),this._checkName(),this._registry.add(this._control,this)}ngOnDestroy(){this._registry.remove(this)}writeValue(t){this._state=t===this.value,this._renderer.setProperty(this._elementRef.nativeElement,"checked",this._state)}registerOnChange(t){this._fn=t,this.onChange=()=>{t(this.value),this._registry.select(this)}}fireUncheck(t){this.writeValue(t)}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}_checkName(){!this.name&&this.formControlName&&(this.name=this.formControlName)}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo),xi(wf),xi(ui))},t.\u0275dir=Gt({type:t,selectors:[["input","type","radio","formControlName",""],["input","type","radio","formControl",""],["input","type","radio","ngModel",""]],hostBindings:function(t,e){1&t&&Oi("change",function(){return e.onChange()})("blur",function(){return e.onTouched()})},inputs:{name:"name",formControlName:"formControlName",value:"value"},features:[co([vf])]}),t})();const Cf={provide:Zd,useExisting:st(()=>xf),multi:!0};let xf=(()=>{class t{constructor(t,e){this._renderer=t,this._elementRef=e,this.onChange=t=>{},this.onTouched=()=>{}}writeValue(t){this._renderer.setProperty(this._elementRef.nativeElement,"value",parseFloat(t))}registerOnChange(t){this.onChange=e=>{t(""==e?null:parseFloat(e))}}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo))},t.\u0275dir=Gt({type:t,selectors:[["input","type","range","formControlName",""],["input","type","range","formControl",""],["input","type","range","ngModel",""]],hostBindings:function(t,e){1&t&&Oi("change",function(t){return e.onChange(t.target.value)})("input",function(t){return e.onChange(t.target.value)})("blur",function(){return e.onTouched()})},features:[co([Cf])]}),t})();const Ef={provide:Zd,useExisting:st(()=>kf),multi:!0};function Sf(t,e){return null==t?`${e}`:(e&&"object"==typeof e&&(e="Object"),`${t}: ${e}`.slice(0,50))}let kf=(()=>{class t{constructor(t,e){this._renderer=t,this._elementRef=e,this._optionMap=new Map,this._idCounter=0,this.onChange=t=>{},this.onTouched=()=>{},this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){this.value=t;const e=this._getOptionId(t);null==e&&this._renderer.setProperty(this._elementRef.nativeElement,"selectedIndex",-1);const n=Sf(e,t);this._renderer.setProperty(this._elementRef.nativeElement,"value",n)}registerOnChange(t){this.onChange=e=>{this.value=this._getOptionValue(e),t(this.value)}}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}_registerOption(){return(this._idCounter++).toString()}_getOptionId(t){for(const e of Array.from(this._optionMap.keys()))if(this._compareWith(this._optionMap.get(e),t))return e;return null}_getOptionValue(t){const e=function(t){return t.split(":")[0]}(t);return this._optionMap.has(e)?this._optionMap.get(e):t}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo))},t.\u0275dir=Gt({type:t,selectors:[["select","formControlName","",3,"multiple",""],["select","formControl","",3,"multiple",""],["select","ngModel","",3,"multiple",""]],hostBindings:function(t,e){1&t&&Oi("change",function(t){return e.onChange(t.target.value)})("blur",function(){return e.onTouched()})},inputs:{compareWith:"compareWith"},features:[co([Ef])]}),t})(),Af=(()=>{class t{constructor(t,e,n){this._element=t,this._renderer=e,this._select=n,this._select&&(this.id=this._select._registerOption())}set ngValue(t){null!=this._select&&(this._select._optionMap.set(this.id,t),this._setElementValue(Sf(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._setElementValue(t),this._select&&this._select.writeValue(this._select.value)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id
5564),this._select.writeValue(this._select.value))}}return t.\u0275fac=function(e){return new(e||t)(xi(yo),xi(wo),xi(kf,9))},t.\u0275dir=Gt({type:t,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}}),t})();const Tf={provide:Zd,useExisting:st(()=>Vf),multi:!0};function If(t,e){return null==t?`${e}`:("string"==typeof e&&(e=`'${e}'`),e&&"object"==typeof e&&(e="Object"),`${t}: ${e}`.slice(0,50))}let Vf=(()=>{class t{constructor(t,e){this._renderer=t,this._elementRef=e,this._optionMap=new Map,this._idCounter=0,this.onChange=t=>{},this.onTouched=()=>{},this._compareWith=Object.is}set compareWith(t){this._compareWith=t}writeValue(t){let e;if(this.value=t,Array.isArray(t)){const n=t.map(t=>this._getOptionId(t));e=(t,e)=>{t._setSelected(n.indexOf(e.toString())>-1)}}else e=(t,e)=>{t._setSelected(!1)};this._optionMap.forEach(e)}registerOnChange(t){this.onChange=e=>{const n=[];if(void 0!==e.selectedOptions){const t=e.selectedOptions;for(let e=0;e<t.length;e++){const r=t.item(e),s=this._getOptionValue(r.value);n.push(s)}}else{const t=e.options;for(let e=0;e<t.length;e++){const r=t.item(e);if(r.selected){const t=this._getOptionValue(r.value);n.push(t)}}}this.value=n,t(n)}}registerOnTouched(t){this.onTouched=t}setDisabledState(t){this._renderer.setProperty(this._elementRef.nativeElement,"disabled",t)}_registerOption(t){const e=(this._idCounter++).toString();return this._optionMap.set(e,t),e}_getOptionId(t){for(const e of Array.from(this._optionMap.keys()))if(this._compareWith(this._optionMap.get(e)._value,t))return e;return null}_getOptionValue(t){const e=function(t){return t.split(":")[0]}(t);return this._optionMap.has(e)?this._optionMap.get(e)._value:t}}return t.\u0275fac=function(e){return new(e||t)(xi(wo),xi(yo))},t.\u0275dir=Gt({type:t,selectors:[["select","multiple","","formControlName",""],["select","multiple","","formControl",""],["select","multiple","","ngModel",""]],hostBindings:function(t,e){1&t&&Oi("change",function(t){return e.onChange(t.target)})("blur",function(){return e.onTouched()})},inputs:{compareWith:"compareWith"},features:[co([Tf])]}),t})(),Of=(()=>{class t{constructor(t,e,n){this._element=t,this._renderer=e,this._select=n,this._select&&(this.id=this._select._registerOption(this))}set ngValue(t){null!=this._select&&(this._value=t,this._setElementValue(If(this.id,t)),this._select.writeValue(this._select.value))}set value(t){this._select?(this._value=t,this._setElementValue(If(this.id,t)),this._select.writeValue(this._select.value)):this._setElementValue(t)}_setElementValue(t){this._renderer.setProperty(this._element.nativeElement,"value",t)}_setSelected(t){this._renderer.setProperty(this._element.nativeElement,"selected",t)}ngOnDestroy(){this._select&&(this._select._optionMap.delete(this.id),this._select.writeValue(this._select.value))}}return t.\u0275fac=function(e){return new(e||t)(xi(yo),xi(wo),xi(Vf,9))},t.\u0275dir=Gt({type:t,selectors:[["option"]],inputs:{ngValue:"ngValue",value:"value"}}),t})();function Mf(t,e){t.forEach(t=>{t.registerOnValidatorChange&&t.registerOnValidatorChange(e)})}function Df(t,e){t._pendingDirty&&t.markAsDirty(),t.setValue(t._pendingValue,{emitModelToViewChange:!1}),e.viewToModelUpdate(t._pendingValue),t._pendingChange=!1}const Nf=[qd,xf,yf,kf,Vf,bf];function Pf(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Rf="VALID",jf="INVALID",Ff="PENDING",Hf="DISABLED";function zf(t){return($f(t)?t.validators:t)||null}function Lf(t){return Array.isArray(t)?uf(t):t||null}function Bf(t,e){return($f(e)?e.asyncValidators:t)||null}function Wf(t){return Array.isArray(t)?cf(t):t||null}function $f(t){return null!=t&&!Array.isArray(t)&&"object"==typeof t}class Zf{constructor(t,e){this._hasOwnPendingAsyncValidator=!1,this._onCollectionChange=()=>{},this._parent=null,this.pristine=!0,this.touched=!1,this._onDisabledChange=[],this._rawValidators=t,this._rawAsyncValidators=e,this._composedValidatorFn=Lf(this._rawValidators),this._composedAsyncValidatorFn=Wf(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn}set validator(t){this._rawValidators=this._composedValidatorFn=t}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(t){this._rawAsyncValidators=this._composedAsyncValidatorFn=t}get parent(){return this._parent}get valid(){return this.status===Rf}get invalid(){return this.status===jf}get pending(){return this.status==Ff}get disabled(){return this.status===Hf}get enabled(){return this.status!==Hf}get dirty(){return!this.pristine}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(t){this._rawValidators=t,this._composedValidatorFn=Lf(t)}setAsyncValidators(t){this._rawAsyncValidators=t,this._composedAsyncValidatorFn=Wf(t)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(t={}){this.touched=!0,this._parent&&!t.onlySelf&&this._parent.markAsTouched(t)}markAllAsTouched(){this.markAsTouched({onlySelf:!0}
vendor: 14,919 bytes, line 5564
5564),this._forEachChild(t=>t.markAllAsTouched())}markAsUntouched(t={}){this.touched=!1,this._pendingTouched=!1,this._forEachChild(t=>{t.markAsUntouched({onlySelf:!0})}),this._parent&&!t.onlySelf&&this._parent._updateTouched(t)}markAsDirty(t={}){this.pristine=!1,this._parent&&!t.onlySelf&&this._parent.markAsDirty(t)}markAsPristine(t={}){this.pristine=!0,this._pendingDirty=!1,this._forEachChild(t=>{t.markAsPristine({onlySelf:!0})}),this._parent&&!t.onlySelf&&this._parent._updatePristine(t)}markAsPending(t={}){this.status=Ff,!1!==t.emitEvent&&this.statusChanges.emit(this.status),this._parent&&!t.onlySelf&&this._parent.markAsPending(t)}disable(t={}){const e=this._parentMarkedDirty(t.onlySelf);this.status=Hf,this.errors=null,this._forEachChild(e=>{e.disable(Object.assign(Object.assign({},t),{onlySelf:!0}))}),this._updateValue(),!1!==t.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(Object.assign(Object.assign({},t),{skipPristineCheck:e})),this._onDisabledChange.forEach(t=>t(!0))}enable(t={}){const e=this._parentMarkedDirty(t.onlySelf);this.status=Rf,this._forEachChild(e=>{e.enable(Object.assign(Object.assign({},t),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:t.emitEvent}),this._updateAncestors(Object.assign(Object.assign({},t),{skipPristineCheck:e})),this._onDisabledChange.forEach(t=>t(!1))}_updateAncestors(t){this._parent&&!t.onlySelf&&(this._parent.updateValueAndValidity(t),t.skipPristineCheck||this._parent._updatePristine(),this._parent._updateTouched())}setParent(t){this._parent=t}updateValueAndValidity(t={}){this._setInitialStatus(),this._updateValue(),this.enabled&&(this._cancelExistingSubscription(),this.errors=this._runValidator(),this.status=this._calculateStatus(),this.status!==Rf&&this.status!==Ff||this._runAsyncValidator(t.emitEvent)),!1!==t.emitEvent&&(this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!t.onlySelf&&this._parent.updateValueAndValidity(t)}_updateTreeValidity(t={emitEvent:!0}){this._forEachChild(e=>e._updateTreeValidity(t)),this.updateValueAndValidity({onlySelf:!0,emitEvent:t.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?Hf:Rf}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(t){if(this.asyncValidator){this.status=Ff,this._hasOwnPendingAsyncValidator=!0;const e=sf(this.asyncValidator(this));this._asyncValidationSubscription=e.subscribe(e=>{this._hasOwnPendingAsyncValidator=!1,this.setErrors(e,{emitEvent:t})})}}_cancelExistingSubscription(){this._asyncValidationSubscription&&(this._asyncValidationSubscription.unsubscribe(),this._hasOwnPendingAsyncValidator=!1)}setErrors(t,e={}){this.errors=t,this._updateControlsErrors(!1!==e.emitEvent)}get(t){return function(t,e,n){if(null==e)return null;if(Array.isArray(e)||(e=e.split(".")),Array.isArray(e)&&0===e.length)return null;let r=t;return e.forEach(t=>{r=r instanceof qf?r.controls.hasOwnProperty(t)?r.controls[t]:null:r instanceof Gf&&r.at(t)||null}),r}(this,t)}getError(t,e){const n=e?this.get(e):this;return n&&n.errors?n.errors[t]:null}hasError(t,e){return!!this.getError(t,e)}get root(){let t=this;for(;t._parent;)t=t._parent;return t}_updateControlsErrors(t){this.status=this._calculateStatus(),t&&this.statusChanges.emit(this.status),this._parent&&this._parent._updateControlsErrors(t)}_initObservables(){this.valueChanges=new fl,this.statusChanges=new fl}_calculateStatus(){return this._allControlsDisabled()?Hf:this.errors?jf:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(Ff)?Ff:this._anyControlsHaveStatus(jf)?jf:Rf}_anyControlsHaveStatus(t){return this._anyControls(e=>e.status===t)}_anyControlsDirty(){return this._anyControls(t=>t.dirty)}_anyControlsTouched(){return this._anyControls(t=>t.touched)}_updatePristine(t={}){this.pristine=!this._anyControlsDirty(),this._parent&&!t.onlySelf&&this._parent._updatePristine(t)}_updateTouched(t={}){this.touched=this._anyControlsTouched(),this._parent&&!t.onlySelf&&this._parent._updateTouched(t)}_isBoxedValue(t){return"object"==typeof t&&null!==t&&2===Object.keys(t).length&&"value"in t&&"disabled"in t}_registerOnCollectionChange(t){this._onCollectionChange=t}_setUpdateStrategy(t){$f(t)&&null!=t.updateOn&&(this._updateOn=t.updateOn)}_parentMarkedDirty(t){return!t&&!(!this._parent||!this._parent.dirty)&&!this._parent._anyControlsDirty()}}class Uf extends Zf{constructor(t=null,e,n){super(zf(e),Bf(n,e)),this._onChange=[],this._applyFormState(t),this._setUpdateStrategy(e),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!n})}setValue(t,e={}){this.value=this._pendingValue=t,this._onChange.length&&!1!==e.emitModelToViewChange&&this._onChange.forEach(t=>t(this.value,!1!==e.emitViewToModelChange)),this.updateValueAndValidity(e)}patchValue(t,e={}){this.setValue(t,e)}reset(t=null,e={}){this._applyFormState(t),this.markAsPristine(e),this.markAsUntouched(e),this.setValue(this.value,e),this._pendingChange=!1}_updateValue(){}_anyControls(t){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(t){this._onChange.push(t)}_unregisterOnChange(t){Pf(this._onChange,t)}registerOnDisabledChange(t){this._onDisabledChange.push(t)}_unregisterOnDisabledChange(t){Pf(this._onDisabledChange,t)}_forEachChild(t){}_syncPendingControls(){return!("submit"!==this.updateOn||(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),!this._pendingChange)||(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),0))}_applyFormState(t){this._isBoxedValue(t)?(this.value=this._pendingValue=t.value,t.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=t}}class qf extends Zf{constructor(t,e,n){super(zf(e),Bf(n,e)),this.controls=t,this._initObservables(),this._setUpdateStrategy(e),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!n})}registerControl(t,e){return this.controls[t]?this.controls[t]:(this.controls[t]=e,e.setParent(this),e._registerOnCollectionChange(this._onCollectionChange),e)}addControl(t,e){this.registerControl(t,e),this.updateValueAndValidity(),this._onCollectionChange()}removeControl(t){this.controls[t]&&this.controls[t]._registerOnCollectionChange(()=>{}),delete this.controls[t],this.updateValueAndValidity(),this._onCollectionChange()}setControl(t,e){this.controls[t]&&this.controls[t]._registerOnCollectionChange(()=>{}),delete this.controls[t],e&&this.registerControl(t,e),this.updateValueAndValidity(),this._onCollectionChange()}contains(t){return this.controls.hasOwnProperty(t)&&this.controls[t].enabled}setValue(t,e={}){this._checkAllValuesPresent(t),Object.keys(t).forEach(n=>{this._throwIfControlMissing(n),this.controls[n].setValue(t[n],{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)}patchValue(t,e={}){null!=t&&(Object.keys(t).forEach(n=>{this.controls[n]&&this.controls[n].patchValue(t[n],{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e))}reset(t={},e={}){this._forEachChild((n,r)=>{n.reset(t[r],{onlySelf:!0,emitEvent:e.emitEvent})}),this._updatePristine(e),this._updateTouched(e),this.updateValueAndValidity(e)}getRawValue(){return this._reduceChildren({},(t,e,n)=>(t[n]=e instanceof Uf?e.value:e.getRawValue(),t))}_syncPendingControls(){let t=this._reduceChildren(!1,(t,e)=>!!e._syncPendingControls()||t);return t&&this.updateValueAndValidity({onlySelf:!0}),t}_throwIfControlMissing(t){if(!Object.keys(this.controls).length)throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.controls[t])throw new Error(`Cannot find form control with name: ${t}.`)}_forEachChild(t){Object.keys(this.controls).forEach(e=>{const n=this.controls[e];n&&t(n,e)})}_setUpControls(){this._forEachChild(t=>{t.setParent(this),t._registerOnCollectionChange(this._onCollectionChange)})}_updateValue(){this.value=this._reduceValue()}_anyControls(t){for(const e of Object.keys(this.controls)){const n=this.controls[e];if(this.contains(e)&&t(n))return!0}return!1}_reduceValue(){return this._reduceChildren({},(t,e,n)=>((e.enabled||this.disabled)&&(t[n]=e.value),t))}_reduceChildren(t,e){let n=t;return this._forEachChild((t,r)=>{n=e(n,t,r)}),n}_allControlsDisabled(){for(const t of Object.keys(this.controls))if(this.controls[t].enabled)return!1;return Object.keys(this.controls).length>0||this.disabled}_checkAllValuesPresent(t){this._forEachChild((e,n)=>{if(void 0===t[n])throw new Error(`Must supply a value for form control with name: '${n}'.`)})}}class Gf extends Zf{constructor(t,e,n){super(zf(e),Bf(n,e)),this.controls=t,this._initObservables(),this._setUpdateStrategy(e),this._setUpControls(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!n})}at(t){return this.controls[t]}push(t){this.controls.push(t),this._registerControl(t),this.updateValueAndValidity(),this._onCollectionChange()}insert(t,e){this.controls.splice(t,0,e),this._registerControl(e),this.updateValueAndValidity()}removeAt(t){this.controls[t]&&this.controls[t]._registerOnCollectionChange(()=>{}),this.controls.splice(t,1),this.updateValueAndValidity()}setControl(t,e){this.controls[t]&&this.controls[t]._registerOnCollectionChange(()=>{}),this.controls.splice(t,1),e&&(this.controls.splice(t,0,e),this._registerControl(e)),this.updateValueAndValidity(),this._onCollectionChange()}get length(){return this.controls.length}setValue(t,e={}){this._checkAllValuesPresent(t),t.forEach((t,n)=>{this._throwIfControlMissing(n),this.at(n).setValue(t,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e)}patchValue(t,e={}){null!=t&&(t.forEach((t,n)=>{this.at(n)&&this.at(n).patchValue(t,{onlySelf:!0,emitEvent:e.emitEvent})}),this.updateValueAndValidity(e))}reset(t=[],e={}){this._forEachChild((n,r)=>{n.reset(t[r],{onlySelf:!0,emitEvent:e.emitEvent})}),this._updatePristine(e),this._updateTouched(e),this.updateValueAndValidity(e)}getRawValue(){return this.controls.map(t=>t instanceof Uf?t.value:t.getRawValue())}clear(){this.controls.length<1||(this._forEachChild(t=>t._registerOnCollectionChange(()=>{})),this.controls.splice(0),this.updateValueAndValidity())}_syncPendingControls(){let t=this.controls.reduce((t,e)=>!!e._syncPendingControls()||t,!1);return t&&this.updateValueAndValidity({onlySelf:!0}),t}_throwIfControlMissing(t){if(!this.controls.length)throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");if(!this.at(t))throw new Error(`Cannot find form control at index ${t}`)}_forEachChild(t){this.controls.forEach((e,n)=>{t(e,n)})}_updateValue(){this.value=this.controls.filter(t=>t.enabled||this.disabled).map(t=>t.value)}_anyControls(t){return this.controls.some(e=>e.enabled&&t(e))}_setUpControls(){this._forEachChild(t=>this._registerControl(t))}_checkAllValuesPresent(t){this._forEachChild((e,n)=>{if(void 0===t[n])throw new Error(`Must supply a value for form control at index: ${n}.`)})}_allControlsDisabled(){for(const t of this.controls)if(t.enabled)return!1;return this.controls.length>0||this.disabled}_registerControl(t){t.setParent(this),t._registerOnCollectionChange(this._onCollectionChange)}}const Qf={provide:gf,useExisting:st(()=>Kf)},Yf=(()=>Promise.resolve(null))();let Kf=(()=>{class t extends gf{constructor(t,e,n,r){super(),this.control=new Uf,this._registered=!1,this.update=new fl,this._parent=t,this._setValidators(e),this._setAsyncValidators(n),this.valueAccessor=function(t,e){if(!e)return null;let n,r,s;return Array.isArray(e),e.forEach(t=>{var e;t.constructor===Yd?n=t:(e=t,Nf.some(t=>e.constructor===t)?r=t:s=t)}),s||r||n||null}(0,r)}ngOnChanges(t){this._checkForErrors(),this._registered||this._setUpControl(),"isDisabled"in t&&this._updateDisabled(t),function(t,e){if(!t.hasOwnProperty("model"))return!1;const n=t.model;return!!n.isFirstChange()||!Object.is(e,n.currentValue)}(t,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._parent?[...this._parent.path,this.name]:[this.name]}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(t){this.viewModel=t,this.update.emit(t)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&null!=this.options.updateOn&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!(!this.options||!this.options.standalone)}_setUpStandalone(){var t,e;(function(t,e,n){const r=function(t){return t._rawValidators}(t);null!==e.validator?t.setValidators(hf(r,e.validator)):"function"==typeof r&&t.setValidators([r]);const s=function(t){return t._rawAsyncValidators}(t);null!==e.asyncValidator?t.setAsyncValidators(hf(s,e.asyncValidator)):"function"==typeof s&&t.setAsyncValidators([s]);{const n=()=>t.updateValueAndValidity();Mf(e._rawValidators,n),Mf(e._rawAsyncValidators,n)}})(t=this.control,e=this),e.valueAccessor.writeValue(t.value),function(t,e){e.valueAccessor.registerOnChange(n=>{t._pendingValue=n,t._pendingChange=!0,t._pendingDirty=!0,"change"===t.updateOn&&Df(t,e)})}(t,e),function(t,e){const n=(t,n)=>{e.valueAccessor.writeValue(t),n&&e.viewToModelUpdate(t)};t.registerOnChange(n),e._registerOnDestroy(()=>{t._unregisterOnChange(n)})}(t,e),function(t,e){e.valueAccessor.registerOnTouched(()=>{t._pendingTouched=!0,"blur"===t.updateOn&&t._pendingChange&&Df(t,e),"submit"!==t.updateOn&&t.markAsTouched()})}(t,e),function(t,e){if(e.valueAccessor.setDisabledState){const n=t=>{e.valueAccessor.setDisabledState(t)};t.registerOnDisabledChange(n),e._registerOnDestroy(()=>{t._unregisterOnDisabledChange(n)})}}(t,e),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),this._isStandalone()}_updateValue(t){Yf.then(()=>{this.control.setValue(t,{emitViewToModelChange:!1})})}_updateDisabled(t){const e=t.isDisabled.currentValue,n=""===e||e&&"false"!==e;Yf.then(()=>{n&&!this.control.disabled?this.control.disable():!n&&this.control.disabled&&this.control.enable()})}}return t.\u0275fac=function(e){return new(e||t)(xi(ff,9),xi(Jd,10),xi(tf,10),xi(Zd,10))},t.\u0275dir=Gt({type:t,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:["disabled","isDisabled"],model:["ngModel","model"],options:["ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],features:[co([Qf]),hi,le]}),t})(),Xf=(()=>{class t{}return t.\u0275mod=Ut({type:t}
5564),t.\u0275inj=dt({factory:function(e){return new(e||t)}}),t})(),Jf=(()=>{class t{}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)},providers:[wf],imports:[Xf]}),t})();function tp(t,e){if(1&t&&(ki(0,"option",21),Ui(1),Ai()),2&t){const t=e.$implicit;Pi("value","'",t,"'"),ts(1),qi(t)}}function ep(t,e){if(1&t){const t=Ii();ki(0,"input",22),Oi("ngModelChange",function(n){Ve(t);const r=e.index;return Ni(2)._bleed[r]=n}),Ai()}if(2&t){const t=e.index;Ei("ngModel",Ni(2)._bleed[t])}}function np(t,e){if(1&t){const t=Ii();ki(0,"input",23),Oi("ngModelChange",function(n){Ve(t);const r=e.index;return Ni(2)._fontSizes[r]=n}),Ai()}if(2&t){const t=e.index,n=Ni(2);Hi("width",100/n._fontSizes.length+"%"),Ei("ngModel",n._fontSizes[t])}}function rp(t,e){if(1&t){const t=Ii();Xe(),Je(),ki(0,"div",5),ki(1,"fieldset"),ki(2,"legend"),Ui(3,"Actions:"),Ai(),ki(4,"button",6),Oi("click",function(){return Ve(t),Ni().generate()}),Ui(5,"Generate"),Ai(),ki(6,"button",6),Oi("click",function(){return Ve(t),Ni().export()}),Ui(7,"Export"),Ai(),Ai(),ki(8,"fieldset"),ki(9,"legend"),Ui(10,"Canvas:"),Ai(),ki(11,"label"),Ui(12,"Width: "),ki(13,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().canvasWidth=e}),Ai(),Ai(),ki(14,"label"),Ui(15,"Height: "),ki(16,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().canvasHeight=e}),Ai(),Ai(),ki(17,"span"),Ui(18),Ai(),ki(19,"label"),Ui(20,"Scale: "),ki(21,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().onModelChange(e)}),Ai(),Ui(22),Ai(),ki(23,"label"),Ui(24,"Color: "),ki(25,"input",8),Oi("ngModelChange",function(e){return Ve(t),Ni().bgColor=e}),Ai(),ki(26,"input",9),Oi("ngModelChange",function(e){return Ve(t),Ni().hasBgColor=e})("ngModelChange",function(){Ve(t);const e=Ni();
5564return e.bgColor=e.hasBgColor?"#ffffff":""}),Ai(),Ai(),Ai(),ki(27,"fieldset"),ki(28,"legend"),Ui(29,"Words:"),Ai(),ki(30,"label"),Ui(31,"Name: "),ki(32,"input",10),Oi("ngModelChange",function(e){return Ve(t),Ni().words=e}),Ai(),Ai(),ki(33,"label"),Ui(34,"Padding: "),ki(35,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().padding=e}),Ai(),Ai(),ki(36,"label"),Ui(37,"Font: "),ki(38,"select",11),Oi("ngModelChange",function(e){return Ve(t),Ni().font=e}),Ci(39,tp,2,2,"option",12),Ai(),Ai(),ki(40,"label"),Ui(41,"Max number of words: "),ki(42,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().maxNames=e}),Ai(),Ai(),ki(43,"label"),Ui(44,"Color: "),ki(45,"input",13),Oi("ngModelChange",function(e){return Ve(t),Ni().fontColor=e}),Ai(),Ai(),ki(46,"label"),Ui(47,"Angle: "),ki(48,"input",14),Oi("ngModelChange",function(e){return Ve(t),Ni().angle=e}),Ai(),Ui(49),Ai(),Ai(),ki(50,"fieldset"),ki(51,"legend"),Ui(52,"System:"),Ai(),ki(53,"label"),Ui(54,"Max canvas width: "),ki(55,"input",7),Oi("ngModelChange",function(e){return Ve(t),Ni().maxCanvasWidth=e}),Ai(),Ai(),ki(56,"label"),Ui(57,"Spiral: "),ki(58,"select",11),Oi("ngModelChange",function(e){return Ve(t),Ni().spiral=e}),ki(59,"option"),Ui(60,"rectangular"),Ai(),ki(61,"option"),Ui(62,"archimedean"),Ai(),ki(63,"option"),Ui(64,"parallel"),Ai(),Ai(),Ai(),ki(65,"label",15),Ui(66,"Bleed: "),ki(67,"span",15),Ci(68,ep,1,1,"input",16),Ai(),Ai(),ki(69,"label"),Ui(70,"Font scale: "),ki(71,"input",17),Oi("ngModelChange",function(e){return Ve(t),Ni().fontScale=e}),Ai(),Ai(),ki(72,"label",15),Ui(73,"Sizes: "),ki(74,"span",15),Ci(75,np,1,3,"input",18),Ai(),Ai(),Ai(),ki(76,"fieldset"),ki(77,"button",6),Oi("click",function(){Ve(t);const e=ke.lFrame.contextLView[100];return Ni().updateSettings(e)}),Ui(78,"Get Settings"),Ai(),Ti(79,"textarea",19,20),Ai(),Ai()}if(2&t){const t=Ni();ts(13),Ei("ngModel",t.canvasWidth),ts(3),Ei("ngModel",t.canvasHeight),ts(2),Gi("Aspect Ratio: ",((t.canvasWidth||1)/(t.canvasHeight||1)).toFixed(2),""),ts(3),Ei("ngModel",t.zoom),ts(1),qi(t.zoom),ts(3),Ei("ngModel",t.bgColor)("disabled",!t.hasBgColor),ts(1),Ei("ngModel",t.hasBgColor),ts(6),Ei("ngModel",t.words),ts(3),Ei("ngModel",t.padding),ts(3),Ei("ngModel",t.font),ts(1),Ei("ngForOf",t.fonts),ts(3),Ei("ngModel",t.maxNames),ts(3),Ei("ngModel",t.fontColor),ts(3),Ei("ngModel",t.angle),ts(1),qi(t.angle),ts(6),Ei("ngModel",t.maxCanvasWidth),ts(3),Ei("ngModel",t.spiral),ts(10),Ei("ngForOf",t._bleed)("ngForTrackBy",t.indexTracker),ts(3),Ei("ngModel",t.fontScale),ts(4),Ei("ngForOf",t._fontSizes)("ngForTrackBy",t.indexTracker)}}function sp(t,e){if(1&t&&(Xe(),Je(),ki(0,"div",24),ki(1,"span",25),Ui(2),Ai(),Ai()),2&t){const t=Ni();ts(1),Hi("width",t.progress/t.maxNames/t.fontScale*100,"%"),Ei("hidden",!t.progress),ts(1),Gi("",(t.progress/t.maxNames/t.fontScale*100).toFixed(),"%")}}function ip(t,e){if(1&t&&(Xe(),Je(),ki(0,"div"),Ti(1,"img",26),Ai()),2&t){const t=Ni();ts(1),Ei("src",t.respng,ur)}}const op=function(t){return{busy:t}};let lp,ap=(()=>{class t{constructor(t,e){this.cd=t,this.elem=e,this.id="",this.words="Alexandro",this.canvasWidth=360,this.canvasHeight=360,this.font="'Wiffles'",this.zoom=1,this.zoomChange=new fl,this.padding=0,this.angle=360,this._autoStart=!1,this._bleed=[-.1,-.1,-.1,-.1],this._fontSizes=[600,200,100,72],this.hasBgColor=!0,this._bgColor="#F0F0F0",this._fontColorSubject=new x,this._fontColor="#000000",this.done=new fl,this.showControls=!1,this.canvasSize=[360,360],this.processing=!1,this.progress=0,this.fonts=["Wiffles","Bad Script","Castellar","08 Underground"],this.maxNames=100,this.maxCanvasWidth=360,this.spiral="rectangular",this.fontScale=this.canvasWidth/this.maxCanvasWidth,this.boundries=[],this.respng="",this.firstWordScale=1,this.bleedsPxScaled=[0,0,0,0],this.successfullWords=[],this.layout=new mu,this._fontColorSubject.pipe(function(t,e=jd,n=Fd){return r=>r.lift(new Hd(t,e,n.leading,n.trailing))}(500),t=>t.lift(new Bd(void 0,void 0))).subscribe(t=>{this._fontColor=t,this.texts&&this.texts.attr("fill",this.fontColor)})}set autoStart(t){this._autoStart=this.getBoolean(t)}get autoStart(){return this._autoStart}set bleed(t){this._bleed=this.getArray(t)}get bleed(){return this._bleed}set fontSizes(t){this._fontSizes=this.getArray(t)}get fontSizes(){return this._fontSizes}set bgColor(t){this._bgColor=t,this.bgRect&&this.bgRect.attr("fill",this._bgColor||"transparent")}get bgColor(){return this._bgColor}set fontColor(t){this._fontColorSubject.next(t)}get fontColor(){return this._fontColor}get start(){return()=>this.generate()}get getUrl(){return()=>this.export()}get stop(){return()=>this.layout.stop()}get getSettings(){return()=>({names:this.words.split(","),font:this.font,bgColor:this.bgColor,textColor:this.fontColor,zoom:this.zoom,padding:this.padding,angle:this.angle})}onModelChange(t){this.zoomChange.emit(t)}ngOnInit(){this.layout.on("end",this.draw.bind(this)).on("word",t=>{this.progress++,this.cd.detectChanges()}),this.canvasSize=[this.maxCanvasWidth,this.maxCanvasWidth*this.canvasHeight/this.canvasWidth]}ngAfterViewInit(){this.autoStart&&setTimeout(()=>{this.generate()},100)}generate(){return t=this,void 0,n=function*(){this.progress=0,this.fontScale=this.canvasWidth/this.maxCanvasWidth/this.zoom,this.firstWordScale=1;let t=this.generateBaseWords(this.words,this.maxNames*this.fontScale);this.processing=!0,this.canvasSize=[this.maxCanvasWidth,this.maxCanvasWidth*this.canvasHeight/this.canvasWidth],this.bleedsPxScaled=this._bleed.map((t,e)=>e%2?this.canvasSize[0]*t:this.canvasSize[1]*t),yield this.fitFirstWord(),this.layout&&this.layout.stop().timeInterval(10).size([this.canvasSize[0]-this.bleedsPxScaled[1]-this.bleedsPxScaled[3],this.canvasSize[1]-this.bleedsPxScaled[0]-this.bleedsPxScaled[2]]).words(t.map((t,e,n)=>({text:t,size:this.calcSize(e,n.length)/this.fontScale,test:e}))).padding(this.padding).spiral(this.getSpiral()).font(this.font).rotate(this.getAngle.bind(this)).fontSize(t=>{var e;return null!==(e=t.size)&&void 0!==e?e:0}).start()},new((e=void 0)||(e=Promise))(function(r,s){function i(t){try{l(n.next(t))}catch(e){s(e)}}function o(t){try{l(n.throw(t))}catch(e){s(e)}}function l(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e(function(t){t(n)})).then(i,o)}l((n=n.apply(t,[])).next())});var t,e,n}export(){const t=this.downloadPNG(this.canvasWidth);return this.respng=null!=t?t:"",this.cd.detectChanges(),t}updateSettings(t){t.value=JSON.stringify(this.getSettings(),null,4)}fitFirstWord(){return new Promise((t,e)=>{this.testFirstWordSize(t)})}testFirstWordSize(t){(new mu).on("end",e=>{e.length?t():(this.firstWordScale-=.1,this.firstWordScale<=.1?(this.firstWordScale=1,t()):this.testFirstWordSize(t))}).stop().timeInterval(10).size([this.maxCanvasWidth,this.maxCanvasWidth*this.canvasHeight/this.canvasWidth]).words([{text:this.words.split(",")[0],size:this.calcSize(0,1)/this.fontScale}]).padding(this.padding).spiral(this.getSpiral()).font(this.font).rotate(this.getAngle.bind(this)).fontSize(t=>{var e;return null!==(e=t.size)&&void 0!==e?e:0}).start()}draw(t,e){this.successfullWords=t,this.boundries=e;const n=this.elem.nativeElement.querySelector("#main-svg");if(n){if(this.svg=(r=n,"string"==typeof r?new Rc([[document.querySelector(r)]],[document.documentElement]):new Rc([[r]],Pc)).attr("viewBox",`0 0 ${this.canvasSize[0]} ${this.canvasSize[1]}`),this.svg.selectAll("*").remove(),this.bgRect=this.svg.append("rect").attr("width",this.canvasSize[0]).attr("height",this.canvasSize[1]).attr("fill",this.bgColor||"transparent").attr("stroke","transparent").attr("stroke-width",0),t.length&&e.length){let n=e[1].x-e[0].x,r=e[1].y-e[0].y;this.svg.append("defs").append("clipPath").attr("id","clipper").append("rect").attr("transform","translate("+-(n/2+this.bleedsPxScaled[3])+","+-(r/2+this.bleedsPxScaled[0])+")").attr("x",0).attr("y",0).attr("width",this.canvasSize[0]).attr("height",this.canvasSize[1]),this.texts=this.svg.append("g").attr("clip-path","url(#clipper)").attr("transform","translate("+(n/2+this.bleedsPxScaled[3])+","+(r/2+this.bleedsPxScaled[0])+")").selectAll("text").data(t.filter(t=>t.size>=0)).enter().append("text").style("font-size",t=>t.size+"px").style("font-family",t=>t.font).attr("fill",this.fontColor).attr("text-anchor","middle").attr("transform",t=>"translate("+[t.x,t.y]+")rotate("+t.rotate+")").text(t=>t.text)}this.processing=!1,this.cd.detectChanges(),this.done.emit(t.length)}var r}calcSize(t,e){let n=this.fontSizes;if(0===t)return this.points2pixles(n[0])*this.firstWordScale;const r=n.slice(1).filter(t=>t).map(t=>this.points2pixles(t));let s=r.map((t,n)=>(n+1)*(e/r.length)).findIndex(e=>t<=e);return r[s]}getAngle(t,e){if(0===e)return 0;const n=this.angle;return Math.floor(Math.random()*n)+-n/2}generateBaseWords(t,e){let n=[];const r=t.split(",").map(t=>t.trim()).filter(t=>t.length>0);if(0===r.length)return n;for(let s=0;s<e;s++)n.push(r[s%r.length]);return n}downloadPNG(t){let e=t/this.maxCanvasWidth,n=document.createElement("canvas"),r=n.getContext("2d");if(!r||this.words.length<=0)return;let s=this.canvasSize[0]*e,i=this.canvasSize[1]*e,o=((this.boundries[1].x-this.boundries[0].x)/2+this.bleedsPxScaled[3])*e,l=((this.boundries[1].y-this.boundries[0].y)/2+this.bleedsPxScaled[0])*e;return n.width=s,n.height=i,r.fillStyle=this.bgColor||"transparent",r.fillRect(0,0,s,i),r.translate(o,l),r.scale(e,e),this.successfullWords.forEach(t=>{!r||t.size<=0||(r.save(),r.translate(t.x,t.y),r.rotate(t.rotate*Math.PI/180),r.textAlign="center",r.fillStyle=this.fontColor,r.font=t.size+"px "+t.font,r.fillText(t.text,0,0
5564),r.restore())}),n.toDataURL()}getBoolean(t){switch("string"==typeof t&&(t=t.toLowerCase()),t){case!0:case"true":case 1:case"1":case"on":case"yes":case"":return!0;default:return!1}}getArray(t){try{return(t=t.toString()).split(",",4).map(t=>+t)}catch(e){return[0,0,0,0]}}points2pixles(t){return t/.75}indexTracker(t){return t}getSpiral(){switch(this.spiral){case"parallel":return t=>e=>[t[0]/5*e,t[1]/5*e];default:return this.spiral}}}return t.\u0275fac=function(e){return new(e||t)(xi(Wo),xi(yo))},t.\u0275cmp=Bt({type:t,selectors:[["lib-canvas"]],inputs:{id:"id",words:"words",canvasWidth:"canvasWidth",canvasHeight:"canvasHeight",font:"font",zoom:"zoom",padding:"padding",angle:"angle",autoStart:"autoStart",bleed:"bleed",fontSizes:"fontSizes",bgColor:"bgColor",fontColor:"fontColor",start:"start",getUrl:"getUrl",showControls:"showControls",stop:"stop",getSettings:"getSettings"},outputs:{zoomChange:"zoomChange",done:"done"},decls:5,vars:6,consts:[["id","container"],["id","main-svg",3,"ngClass"],["id","controls",4,"ngIf"],["id","progress",4,"ngIf"],[4,"ngIf"],["id","controls"],[3,"click"],["type","number",3,"ngModel","ngModelChange"],["type","color",3,"ngModel","disabled","ngModelChange"],["type","checkbox",3,"ngModel","ngModelChange"],["type","text",3,"ngModel","ngModelChange"],[3,"ngModel","ngModelChange"],[3,"value",4,"ngFor","ngForOf"],["type","color",3,"ngModel","ngModelChange"],["type","range","min","0","max","360",3,"ngModel","ngModelChange"],[2,"display","flex"],["type","number","min","-1","max","1","step","0.1","style","width: 25%;",3,"ngModel","ngModelChange",4,"ngFor","ngForOf","ngForTrackBy"],["type","number","readonly","",3,"ngModel","ngModelChange"],["type","number","min","10","max","600","step","1",3,"ngModel","width","ngModelChange",4,"ngFor","ngForOf","ngForTrackBy"],[2,"width","100%","height","200px"],["settignsJson",""],[3,"value"],["type","number","min","-1","max","1","step","0.1",2,"width","25%",3,"ngModel","ngModelChange"],["type","number","min","10","max","600","step","1",3,"ngModel","ngModelChange"],["id","progress"],[3,"hidden"],["id","respng",3,"src"]],template:function(t,e){var n,r,s,i;1&t&&(ki(0,"div",0),Xe(),Ti(1,"svg",1),Ci(2,rp,81,23,"div",2),Ai(),Ci(3,sp,3,4,"div",3),Ci(4,ip,2,1,"div",4)),2&t&&(ts(1),Ei("ngClass",(n=4,r=op,s=e.processing,function(t,e,n,r,s,i){const o=e+n;return wi(t,o,s)?function(t,e,n){return t[e]=n}(t,o+1,i?r.call(i,s):r(s)):function(t,e){const n=t[e];return n===Jr?void 0:n}(t,o+1)}(Te(),function(){const t=ke.lFrame;let e=t.bindingRootIndex;return-1===e&&(e=t.bindingRootIndex=t.tView.bindingStartIndex),e}(),n,r,s,i))),ts(1),Ei("ngIf",e.showControls),ts(1),Ei("ngIf",e.showControls),ts(1),Ei("ngIf",e.showControls))},directives:[da,_a,yf,Yd,_f,Kf,qd,kf,pa,xf,Af,Of],styles:["#container[_ngcontent-%COMP%]{display:flex;height:100%;position:absolute;width:100%}svg[_ngcontent-%COMP%]{width:100%;height:auto;max-height:100%}.busy[_ngcontent-%COMP%]{opacity:.5}#controls[_ngcontent-%COMP%]{padding:10px;width:33%}#controls[_ngcontent-%COMP%] label[_ngcontent-%COMP%]{display:block}#progress[_ngcontent-%COMP%]{height:calc(1em + 2px)}#progress[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{background-color:#00f;position:absolute;text-align:center;color:wheat}"]}),t})(),up=(()=>{class t{constructor(){this.zoom=1,this.zoomChange=new fl}ngOnInit(){}onModelChange(t){this.zoomChange.emit(t)}}return t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=Bt({type:t,selectors:[["lib-settings"]],inputs:{zoom:"zoom"},outputs:{zoomChange:"zoomChange"},decls:2,vars:2,consts:[["type","range","min","1","max","5","step","1",3,"ngModel","ngModelChange"]],template:function(t,e){1&t&&(ki(0,"input",0),Oi("ngModelChange",function(t){return e.onModelChange(t)}),Ai(),Ui(1)),2&t&&(Ei("ngModel",e.zoom),ts(1),qi(e.zoom))},directives:[xf,Yd,_f,Kf],styles:[""]}),t})();try{lp="undefined"!=typeof Intl&&Intl.v8BreakIterator}catch(Ip){lp=!1}let cp=(()=>{class t{constructor(t){this._platformId=t,this.isBrowser=this._platformId?"browser"===this._platformId:"object"==typeof document&&!!document,this.EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent),this.TRIDENT=this.isBrowser&&/(m
5564sie|trident)/i.test(navigator.userAgent),this.BLINK=this.isBrowser&&!(!window.chrome&&!lp)&&"undefined"!=typeof CSS&&!this.EDGE&&!this.TRIDENT,this.WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT,this.IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window),this.FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent),this.ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT,this.SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT}}return t.\u0275fac=function(e){return new(e||t)(Xn(wl))},t.\u0275prov=ht({factory:function(){return new t(Xn(wl))},token:t,providedIn:"root"}),t})();"undefined"!=typeof Element&∈const hp="cdk-high-contrast-black-on-white",dp="cdk-high-contrast-white-on-black",fp="cdk-high-contrast-active";let pp=(()=>{class t{constructor(t,e){this._platform=t,this._document=e}getHighContrastMode(){if(!this._platform.isBrowser)return 0;const t=this._document.createElement("div");t.style.backgroundColor="rgb(1,2,3)",t.style.position="absolute",this._document.body.appendChild(t);const e=this._document.defaultView||window,n=e&&e.getComputedStyle?e.getComputedStyle(t):null,r=(n&&n.backgroundColor||"").replace(/ /g,"");switch(this._document.body.removeChild(t),r){case"rgb(0,0,0)":return 2;case"rgb(255,255,255)":return 1}return 0}_applyBodyHighContrastModeCssClasses(){if(this._platform.isBrowser&&this._document.body){const t=this._document.body.classList;t.remove(fp),t.remove(hp),t.remove(dp);const e=this.getHighContrastMode();1===e?(t.add(fp),t.add(hp)):2===e&&(t.add(fp),t.add(dp))}}}return t.\u0275fac=function(e){return new(e||t)(Xn(cp),Xn(aa))},t.\u0275prov=ht({factory:function(){return new t(Xn(cp),Xn(aa))},token:t,providedIn:"root"}),t})(),gp=(()=>{class t{}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)}}),t})();const _p=new xo("11.2.2");function mp(){return"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)}let yp=(t,e)=>!1,vp=(t,e)=>!1,wp=(t,e,n)=>[];const bp=mp();(bp||"undefined"!=typeof Element)&&((t,e)=>t.contains(e),vp=(()=>
5564{if(bp||Element.prototype.matches)return(t,e)=>t.matches(e);{const t=Element.prototype,e=t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;return e?(t,n)=>e.apply(t,[n]):vp}})());const Cp=new xo("11.2.2"),xp=new Fn("mat-sanity-checks",{providedIn:"root",factory:function(){return!0}});let Ep,Sp=(()=>{class t{constructor(t,e,n){this._hasDoneGlobalChecks=!1,this._document=n,t._applyBodyHighContrastModeCssClasses(),this._sanityChecks=e,this._hasDoneGlobalChecks||(this._checkDoctypeIsDefined(),this._checkThemeIsPresent(),this._checkCdkVersionMatch(),this._hasDoneGlobalChecks=!0)}_getWindow(){const t=this._document.defaultView||window;return"object"==typeof t&&t?t:null}_checksAreEnabled(){return Ql()&&!this._isTestEnv()}_isTestEnv(){const t=this._getWindow();return t&&(t.__karma__||t.jasmine)}_checkDoctypeIsDefined(){this._checksAreEnabled()&&(!0===this._sanityChecks||this._sanityChecks.doctype)&&!this._document.doctype&&console.warn("Current document does not have a doctype. This may cause some Angular Material components not to behave as expected.")}_checkThemeIsPresent(){if(!this._checksAreEnabled()||!1===this._sanityChecks||!this._sanityChecks.theme||!this._document.body||"function"!=typeof getComputedStyle)return;const t=this._document.createElement("div");t.classList.add("mat-theme-loaded-marker"),this._document.body.appendChild(t);const e=getComputedStyle(t);e&&"none"!==e.display&&console.warn("Could not find Angular Material core theme. Most Material components may not work as expected. For more info refer to the theming guide: https://material.angular.io/guide/theming"),this._document.body.removeChild(t)}_checkCdkVersionMatch(){this._checksAreEnabled()&&(!0===this._sanityChecks||this._sanityChecks.version)&&Cp.full!==_p.full&&console.warn("The Angular Material version ("+Cp.full+") does not match the Angular CDK version ("+_p.full+").\nPlease ensure the versions of these two packages exactly match.")}}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)(Xn(pp),Xn(xp,8),Xn(aa))},imports:[[gp],gp]}),t})();try{Ep="undefined"!=typeof Intl}catch(Ip){Ep=!1}let kp=(()=>{class t{}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)},imports:[[va,Sp],Sp]}),t})(),Ap=(()=>{class t{}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)},imports:[[qa,Jf,kp]]}),t})(),Tp=(()=>{class t{constructor(t){this.injector=t}ngDoBootstrap(){if(customElements.get("cdo-wordart"))return;const t=_u(ap,{injector:this.injector});if(customElements.define("cdo-wordart",t),customElements.get("cdo-wordart-settings"))return;const e=_u(up,{injector:this.injector});customElements.define("cdo-wordart-settings",e)}}return t.\u0275mod=Ut({type:t}),t.\u0275inj=dt({factory:function(e){return new(e||t)(Xn(ui))},providers:[],imports:[[qa,Ap]]}),t})();(function(){if(Gl)throw new Error("Cannot enable prod mode after platform setup.");ql=!1})(),Za().bootstrapModule(Tp,{}).catch(t=>console.error(t))},zn8P:function(t,e){function n(t){return Promise.resolve().then(function(){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e})}n.keys=function(){return[]},n.resolve=n,t.exports=n,n.id="zn8P"}});; 5565var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)Object.prototype.hasOwnProperty.call(b,p)&&(d[p]=b[p])},extendStatics(d,b)};return function(d,b){function __(){this.constructor=d}if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){function adopt(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):adopt(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=op[0]&2?y["return"]:op[0]?y["throw"]||((t=y["return"])&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;(y=0,t)&&(op=[op[0]&2,t.value]);switch(op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break}if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break}t[2]&&_.ops.pop();_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e];y=0}finally{f=t=0}if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]}
5565,trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol=="function"&&(g[Symbol.iterator]=function(){return this}),g},Estore;(function(Estore){var Gallery;(function(Gallery){var WordArtController=function(_super){function WordArtController(){var _this=_super.call(this)||this;return _this.route("/gallery/init",_this.initFromGallery),_this}return __extends(WordArtController,_super),WordArtController.prototype.init=function(){this.component=application.getComponent("WordArtComponent")},WordArtController.prototype.initFromGallery=function(){this.component.init()},WordArtController}(Controller),WordArtComponent;Gallery.WordArtController=WordArtController;application.addController(new WordArtController);WordArtComponent=function(){function WordArtComponent(){this._fieldsService=null;this._galleryViewModel=null;this._designObjectService=null;this._uploadDialogue=null;this._presets={uploadChunkSizeInKb:500,imgType:"png",galleryId:presets.galleryId,uploadUrl:"/estore/handlers/plupload.ashx",antiforgeryToken:presets.mobileAntiforgeryToken,buildThumbUrl:"/estore/mvcupload/buildthumbnail"};this.fonts=["Wiffles","Bad Script","Hachi Maru Pop","Chewy","Underground"];this.font="Wiffles"}return WordArtComponent.prototype.init=function(){var _this=this,words,svgVals,bgSVG;this.namesSort=$("#names-list").find(".add").on("click",function(){_this.addNewWord("")}).end().find("ul").on("click",".delete",function(e){$(e.target).parents("li").hide("slow",function(){$(e.target).parents("li").remove();$("#names-list ul li").length===1&&_this.namesSort.sortable("disable");_this.start(_this.comp,_this.fieldset,words)})}).sortable({axis:"y",cursor:"row-resize",handle:".handle",tolerance:"pointer",disabled:!0,stop:function(e){_this.start(_this.comp,_this.fieldset,e.srcElement.parentElement.getElementsByTagName("input")[0])}});this._fieldsService=application.getModel("Product").fieldsService;this._designObjectService=application.getModel("Product").designObjectService;this._galleryViewModel=application.getViewModel("GalleryViewModel");this._uploadDialogue=application.getComponent("UploadDialogue");this.fieldset=document.getElementById("settings-fieldset");this.comp=document.getElementsByTagName("cdo-wordart")[0];this.comp.addEventListener("done",function(){$("#wordart .contents").removeClass("busy");_this.fieldset.disabled=!1;$("#names-list ul li").length>1&&_this.namesSort.sortable("enable");(_this.lastActiveField.id==="padding"||_this.lastActiveField.id==="angle")&&$(".settings-controls-container.collapsed").length>0||_this.lastActiveField&&_this.lastActiveField.focus()});words=this.fieldset.querySelector(".word-art-name");words.addEventListener("input",this.debounce(function(e){_this.start(_this.comp,_this.fieldset,e.target)},500));this._zoom=this.fieldset.querySelector("#zoom");this._zoom.addEventListener("change",this.debounce(function(e){_this.comp.zoom=+e.target.value;_this.start(_this.comp,_this.fieldset,e.target)},500));this._padding=this.fieldset.querySelector("#padding");this._padding.addEventListener("change",this.debounce(function(e){_this.comp.padding=+e.target.value;_this.start(_this.comp,_this.fieldset,e.target)},500));this._font=this.fieldset.querySelector("#font");this._font.addEventListener("change",function(e){_this.comp.font=e.target.value;_this.font=e.target.value;_this.start(_this.comp,_this.fieldset,e.target)});this._font.addEventListener("change",function(e){e.target.setAttribute("style",'font-family: "'+e.target.value+'" !important')});this._fontColor=this.fieldset.querySelector("#font-color");this._fontColor.addEventListener("input",function(e){_this.comp.fontColor=e.target.value;$(".color-selection li").removeClass("selected")});this._bgColor=this.fieldset.querySelector("#bg-color");this._bgColor.addEventListener("input",function(e){_this.maskBackground.attr("fill",e.target.value);$(".color-selection li").removeClass("selected")});this._angle=this.fieldset.querySelector("#angle");this._angle.addEventListener("input",this.debounce(function(e){_this.comp.angle=+e.target.value;_this.start(_this.comp,_this.fieldset,e.target)},500));$(".word-art-name").val(this.comp.words.trim());$(".open-word-art").on("click",function(){_this.showComponent(null)});$("#mix-word-art, #update-word-art").on("click",function(e){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(){return this.start(this.comp,this.fieldset,e.target),[2]})})});$("#add-word-art").on("click",function(){_this.comp.bgColor=_this.maskBackgroun
5565d.attr("fill");var url=_this.comp.getUrl.call(_this.comp);url&&_this.upload(url).then(function(galleryItem){_this._uploadDialogue.returnData={editorSettings:_this.comp.getSettings()};_this._galleryViewModel.AddWordArt(galleryItem,_this.comp.getSettings())})});$(".collapsable").on("click",".h4, button",function(e){$(e.delegateTarget).toggleClass("collapsed")});$(".color-selection li").on("click",function(e){var textColor=e.target.style.backgroundColor,backColor=e.target.style.borderColor;_this._fontColor.value=_this.comp.fontColor=_this.rgb2hex(textColor);_this._bgColor.value=_this.rgb2hex(backColor);_this.maskBackground.attr("fill",_this._bgColor.value);$(".color-selection li").removeClass("selected");$(e.target).addClass("selected")});svgVals=this.getSvgVals();bgSVG='<svg viewBox="0 0 '+svgVals.w+" "+svgVals.h+'" style="position: absolute; left: 0; width: 100%; height: 100%;">\n <rect id="mask-background" x="'+svgVals.x+'" y="'+svgVals.y+'" width="'+svgVals.size+'" height="'+svgVals.size+'" fill="transparent"/>\n <image href="'+svgVals.href+'" x="'+svgVals.x+'" y="'+svgVals.y+'" width="'+svgVals.size+'" height="'+svgVals.size+'"><\/image>\n <\/svg>';this.maskBackground=$("#wordart .contents").prepend(bgSVG).find("#mask-background")},WordArtComponent.prototype.addNewWord=function(wordVal){var _this=this,first=$("#names-list ul li:first").clone(),words=first.find(".word-art-name").val(wordVal).get(0);words.addEventListener("input",this.debounce(function(e){_this.start(_this.comp,_this.fieldset,e.target)},500));$("#names-list ul").append(first);words.focus();this.namesSort.sortable("enable")},WordArtComponent.prototype.setDefaultValues=function(selectedObject){var _this=this,settings;selectedObject&&this._designObjectService.get(selectedObject)&&this._designObjectService.get(selectedObject).wordArt&&(settings=this._designObjectService.get(selectedObject).wordArt,this.namesSort.sortable("disable"),$("#names-list ul li:not(:first)").remove(),settings.names.forEach(function(name,i){i===0?$("#names-list ul li:first").find(".word-art-name").val(name):_this.addNewWord(name)}),this._zoom.value=settings.zoom.toString(),this._zoom.dispatchEvent(new Event("change")),this._padding.value=settings.padding.toString(),this._padding.dispatchEvent(new Event("change")),this._font.value=settings.font,this._font.dispatchEvent(new Event("change")),this._fontColor.value=settings.textColor,this._fontColor.dispatchEvent(new Event("input")),settings.bgColor!=="transparent"&&(this._bgColor.value=settings.bgColor,this._bgColor.dispatchEvent(new Event("input"))),this._angle.value=settings.angle.toString(),this._angle.dispatchEvent(new Event("input")))},WordArtComponent.prototype.showComponent=function(selectedObject){var dim,minq,fieldBgColor;this.setDefaultValues(selectedObject);dim=this._fieldsService.getCanvasDimension(1);minq=this._fieldsService.getCurrentMinq();minq=minq*1.01;this.comp.canvasWidth=dim.width*minq;this.comp.canvasHeight=dim.height*minq;this.comp.bleed=this.getBleed();fieldBgColor=this._fieldsService.getCurrent().editablefield.backgroundColour;fieldBgColor&&this.maskBackground.attr("fill")==="transparent"&&(this.maskBackground.attr("fill","#"+fieldBgColor),$("#bg-color").val("#"+fieldBgColor));this.comp.bgColor=null;$("#names-list ul li").length>1?this.namesSort.sortable("enable"):this.namesSort.sortable("disable");this.fieldset.querySelector(".word-art-name").focus()},WordArtComponent.prototype.start=function(comp,fieldset,source){var _this=this;comp.words=$(".word-art-name").map(function(i,elm){var val1=$(elm).val(),val=val1.replace(/[,\s]+/g," ");return _this.font.toLowerCase()==="underground"&&(val=val.toLocaleLowerCase()),val}).get().join();comp.font=this.font;this.lastActiveField=source;$("#wordart .contents").addClass("busy");comp.stop();comp.start.call(comp)},WordArtComponent.prototype.debounce=function(func,duration){var _this=this,timeout;return function(){for(var effect,args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];effect=function(){return timeout=null,func.apply(_this,args)};clearTimeout(timeout);timeout=window.setTimeout(effect,duration)}},WordArtComponent.prototype.upload=function(dataurl){return __awaiter(this,void 0,void 0,function(){var fileName,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return fileName=WordArtComponent.uniqueId("WordArt-",0,!1),[4,new Promise(function(resolve){_this.createBlob(dataurl).then(function(blob){return __awaiter(_this,void 0,void 0,function(){var res;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.uploadChunk(blob,fileName)];case 1:return _a.sent(),[4,this.createThumb(fileName)];case 2:return res=_a.sent(),resolve(res),[2]}})})})})];case 1:return[2,_a.sent()]}})})},WordArtComponent.uniqueId=function(prefix,numOfsigments,addCounter){var guid,i;for(numOfsigments===void 0&&(numOfsigments=5),addCounter===void 0&&(addCounter=!0),guid=(new Date).getTime().toString(32),i=0;i<numOfsigments;i++)guid+=Math.floor(Math.random()*65535).toString(32);return prefix+guid+(addCounter?(this.counter++).toString(32):"")},WordArtComponent.prototype.createBlob=function(dataURI){return new Promise(function(resolve){for(var byteString=atob(dataURI.split(",")[1]),mimeString=dataURI.split(",")[0].split(":")[1].split(";")[0],ab=new ArrayBuffer(byteString.length),dw=new DataView(ab),i=0;i<byteString.length;i++)dw.setUint8(i,byteString.charCodeAt(i));resolve(new Blob([ab],{type:mimeString}))})},WordArtComponent.prototype.uploadChunk=function(blob,fileName){return __awaiter(this,void 0,void 0,function(){var chunkSize,chunksCount,_loop_1,this_1,chunk,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:chunkSize=this._presets.uploadChunkSizeInKb*1024;chunksCount=Math.ceil(blob.size/chunkSize);_loop_1=function(chunk){var offset,formData;return __generator(this,function(_b){switch(_b.label){case 0:return offset=chunkSize*chunk,formData=new FormData,formData.append("name",fileName+"."+this_1._presets.imgType),formData.append("offset",offset.toString()),formData.append("total",blob.size.toString()),formData.append("galleryId",this_1._presets.galleryId),formData.append("file",blob.slice(offset,offset+chunkSize),fileName),[4,new Promise(function(resolve){$.ajax({url:_this._presets.uploadUrl,headers:_this.getHeaders(),data:formData,t
5565ype:"post",dataType:"text",processData:!1,contentType:!1,success:function(response){resolve(response)}})})];case 1:return _b.sent(),[2]}})};this_1=this;chunk=0;_a.label=1;case 1:return(chunk<chunksCount)?[5,_loop_1(chunk)]:[3,4];case 2:_a.sent();_a.label=3;case 3:return chunk++,[3,1];case 4:return[2]}})})},WordArtComponent.prototype.createThumb=function(fileId){return __awaiter(this,void 0,void 0,function(){var postData_1,ex_1,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,3]),postData_1={galleryId:this._presets.galleryId,fileName:fileId,clientFileName:fileId+"."+this._presets.imgType,uploadSource:"WordArt"},[4,new Promise(function(resolve){$.ajax({url:_this._presets.buildThumbUrl,headers:_this.getHeaders(),dataType:"json",data:postData_1,type:"post",success:function(response){resolve(response)}})})];case 1:return[2,_a.sent()];case 2:return ex_1=_a.sent(),[2,Promise.resolve(ex_1)];case 3:return[2]}})})},WordArtComponent.prototype.getHeaders=function(){var headers={};return headers.requestverificationtoken_mobilepreviwe=this._presets.antiforgeryToken,headers},WordArtComponent.prototype.getSvgVals=function(){var productOptions=application.getComponent("ProductOptions",[]),field=this._fieldsService.getCurrent(),url=presets.productDesign.MaskUrl+"?productId="+presets.productId+"&productName="+presets.productName+"¤tFieldIndex="+this._fieldsService.getCurrentEditableFieldId()+"&systemName="+presets.systemName+"&listOfOptionValues="+productOptions.getOptionsAsString()+"&pvers="+preset
5565s.pvers+"&tid="+presets.tid+"&size="+this._fieldsService.getPreviewSize().width+"&editablefieldVersion="+field.editablefield.version+"¤tOrientation="+field.editablefield.currentOrientation,mask=this._fieldsService.getCurrent().editablefield.mask;return{w:mask.width,h:mask.height,x:-mask.x0,y:-mask.y0,href:url,size:this._fieldsService.getPreviewSize().width}},WordArtComponent.prototype.getBleed=function(){return[-.1,-.1,-.1,-.1].toString()},WordArtComponent.prototype.randomize=function(){return __awaiter(this,void 0,void 0,function(){var font,f;return __generator(this,function(_a){switch(_a.label){case 0:return font=this.fonts[Math.floor(Math.random()*this.fonts.length)],f=new FontFaceObserver(font),[4,f.load()];case 1:return _a.sent(),this.font=font,[2]}})})},WordArtComponent.prototype.rgb2hex=function(orig){var a,isPercent,rgb=orig.replace(/\s/g,"").match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i),alpha=(rgb&&rgb[4]||"").trim(),hex=rgb?"#"+(rgb[1]|256).toString(16).slice(1)+(rgb[2]|256).toString(16).slice(1)+(rgb[3]|256).toString(16).slice(1):orig;return alpha!==""&&(isPercent=alpha.indexOf("%")>-1,a=parseFloat(alpha),a=!isPercent&&a>=0&&a<=1?Math.round(255*a):isPercent&&a>=0&&a<=100?Math.round(255*a/100):""),a&&(hex+=(a|256).toString(16).slice(1)),hex},WordArtComponent.counter=0,WordArtComponent}();Gallery.WordArtComponent=WordArtComponent;application.addComponent(new WordArtComponent,"WordArtComponent")})(Gallery=Estore.Gallery||(Estore.Gallery={}))})(Estore||(Estore={}))
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.