1var docCookies={getItem:function(e){return e&&decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},setItem:function(e,o,n,t,r,c){if(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))return!1;var s="";if(n)switch(n.constructor){case Number:s=n===1/0?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+n;break;case String:s="; expires="+n;break;case Date:s="; expires="+n.toUTCString()}return document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(o)+s+(r?"; domain="+r:"")+(t?"; path="+t:"")+(c?"; secure":""),!0},removeItem:function(e,o,n){return!!this.hasItem(e)&&(document.cookie=encodeURIComponent(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(n?"; domain="+n:"")+(o?"; path="+o:""),!0)},hasItem:function(e){return!(!e||/^(?:expires|max\-age|path|domain|secure)$/i.test(e))&&new RegExp("(?:^|;\\s*)"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},keys:function(){for(var e=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),o=e.length,n=0;n<o;n++)e[n]=decodeURIComponent(e[n]);return e}}; 2 3 4!function(e){"use strict";function t(e,i,o){var a,n=document.createElement("img");return n.onerror=function(a){return t.onerror(n,a,e,i,o)},n.onload=function(a){return t.onload(n,a,e,i,o)},"string"==typeof e?(t.fetchBlob(e,function(i){i?(e=i,a=t.createObjectURL(e)):(a=e,o&&o.crossOrigin&&(n.crossOrigin=o.crossOrigin)),n.src=a},o),n):t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e)?(a=n._objectURL=t.createObjectURL(e),a?(n.src=a,n):t.readFile(e,function(e){var t=e.target;t&&t.result?n.src=t.result:i&&i(e)})):void 0}function i(e,i){!e._objectURL||i&&i.noRevoke||(t.revokeObjectURL(e._objectURL),delete e._objectURL)}var o=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;t.fetchBlob=function(e,t,i){t()},t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transform=function(e,t,i,o,a){i(e,a)},t.onerror=function(e,t,o,a,n){i(e,n),a&&a.call(e,t)},t.onload=function(e,o,a,n,r){i(e,r),n&&t.transform(e,r,n,a,{})},t.createObjectURL=function(e){return!!o&&o.createObjectURL(e)},t.revokeObjectURL=function(e){return!!o&&o.revokeObjectURL(e)},t.readFile=function(e,t,i){if(window.FileReader){var o=new FileReader;if(o.onload=o.onerror=t,i=i||"readAsDataURL",o[i])return o[i](e),o}return!1},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.loadImage=t}(window),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=e.transform;e.transform=function(i,o,a,n,r){t.call(e,e.scale(i,o,r),o,a,n,r)},e.transformCoordinates=function(){},e.getTransformedOptions=function(e,t){var i,o,a,n,r=t.aspectRatio;if(!r)return t;i={};for(o in t)t.hasOwnProperty(o)&&(i[o]=t[o]);return i.crop=!0,a=e.naturalWidth||e.width,n=e.naturalHeight||e.height,a/n>r?(i.maxWidth=n*r,i.maxHeight=n):(i.maxWidth=a,i.maxHeight=a/r),i},e.renderImageToCanvas=function(e,t,i,o,a,n,r,s,l,d){return e.getContext("2d").drawImage(t,i,o,a,n,r,s,l,d),e},e.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},e.scale=function(t,i,o){function a(){var e=Math.max((l||v)/v,(d||w)/w);e>1&&(v*=e,w*=e)}function n(){var e=Math.min((r||v)/v,(s||w)/w);e<1&&(v*=e,w*=e)}i=i||{};var r,s,l,d,c,u,f,g,h,m,p,S=document.createElement("canvas"),b=t.getContext||e.hasCanvasOption(i)&&S.getContext,x=t.naturalWidth||t.width,y=t.naturalHeight||t.height,v=x,w=y;if(b&&(i=e.getTransformedOptions(t,i,o),f=i.left||0,g=i.top||0,i.sourceWidth?(c=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=x-c-i.right)):c=x-f-(i.right||0),i.sourceHeight?(u=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(g=y-u-i.bottom)):u=y-g-(i.bottom||0),v=c,w=u),r=i.maxWidth,s=i.maxHeight,l=i.minWidth,d=i.minHeight,b&&r&&s&&i.crop?(v=r,w=s,p=c/u-r/s,p<0?(u=s*c/r,void 0===i.top&&void 0===i.bottom&&(g=(y-u)/2)):p>0&&(c=r*u/s,void 0===i.left&&void 0===i.right&&(f=(x-c)/2))):((i.contain||i.cover)&&(l=r=r||l,d=s=s||d),i.cover?(n(),a()):(a(),n())),b){if(h=i.pixelRatio,h>1&&(S.style.width=v+"px",S.style.height=w+"px",v*=h,w*=h,S.getContext("2d").scale(h,h)),m=i.downsamplingRatio,m>0&&m<1&&v<c&&w<u)for(;c*m>v;)S.width=c*m,S.height=u*m,e.renderImageToCanvas(S,t,f,g,c,u,0,0,S.width,S.height),f=0,g=0,c=S.width,u=S.height,t=document.createElement("canvas"),t.width=c,t.height=u,e.renderImageToCanvas(t,S,0,0,c,u,0,0,c,u);return S.width=v,S.height=w,e.transformCoordinates(S,i),e.renderImageToCanvas(S,t,f,g,c,u,0,0,v,w)}return t.width=v,t.height=w,t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){var e=this.slice||this.webkitSlice||this.mozSlice;return e.apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,o,a){o=o||{},a=a||{};var n=this,r=o.maxMetaDataSize||262144,s=!(window.DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice);!s&&e.readFile(e.blobSlice.call(t,0,r),function(t){if(t.target.error)return console.log(t.target.error),void i(a);var r,s,l,d,c=t.target.result,u=new DataView(c),f=2,g=u.byteLength-4,h=f;if(65496===u.getUint16(0)){for(;f<g&&(r=u.getUint16(f),r>=65504&&r<=65519||65534===r);){if(s=u.getUint16(f+2)+2,f+s>u.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(l=e.metaDataParsers.jpeg[r])for(d=0;d<l.length;
4d+=1)l[d].call(n,u,f,s,a,o);f+=s,h=f}!o.disableImageHead&&h>6&&(c.slice?a.imageHead=c.slice(0,h):a.imageHead=new Uint8Array(c).subarray(0,h))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(a)},"readAsArrayBuffer")||i(a)},e.hasMetaOption=function(e){return e&&e.meta};var i=e.transform;e.transform=function(t,o,a,n,r){e.hasMetaOption(o)?e.parseMetaData(n,function(r){i.call(e,t,o,a,n,r)},o,r):i.apply(e,arguments)}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";"fetch"in window&&"Request"in window&&(e.fetchBlob=function(t,i,o){return e.hasMetaOption(o)?fetch(new Request(t,o)).then(function(e){return e.blob()}).then(i).catch(function(e){console.log(e),i()}):void i()})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";e.ExifMap=function(){return this},e.ExifMap.prototype.map={Orientation:274},e.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.getExifThumbnail=function(e,t,i){var o,a,n;if(!i||t+i>e.byteLength)return void console.log("Invalid Exif data: Invalid thumbnail data.");for(o=[],a=0;a<i;a+=1)n=e.getUint8(t+a),o.push((n<16?"0":"")+n.toString(16));return"data:image/jpeg,%"+o.join("%")},e.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},e.exifTagTypes[7]=e.exifTagTypes[1],e.getExifValue=function(t,i,o,a,n,r){var s,l,d,c,u,f,g=e.exifTagTypes[a];if(!g)return void console.log("Invalid Exif data: Invalid tag type.");if(s=g.size*n,l=s>4?i+t.getUint32(o+8,r):o+8,l+s>t.byteLength)return void console.log("Invalid Exif data: Invalid data offset.");if(1===n)return g.getValue(t,l,r);for(d=[],c=0;c<n;c+=1)d[c]=g.getValue(t,l+c*g.size,r);if(g.ascii){for(u="",c=0;c<d.length&&(f=d[c],"\0"!==f);c+=1)u+=f;return u}return d},e.parseExifTag=function(t,i,o,a,n){var r=t.getUint16(o,a);n.exif[r]=e.getExifValue(t,i,o,t.getUint16(o+2,a),t.getUint32(o+4,a),a)},e.parseExifTags=function(e,t,i,o,a){var n,r,s;if(i+6>e.byteLength)return void console.log("Invalid Exif data: Invalid directory offset.");if(n=e.getUint16(i,o),r=i+2+12*n,r+4>e.byteLength)return void console.log("Invalid Exif data: Invalid directory size.");for(s=0;s<n;s+=1)this.parseExifTag(e,t,i+2+12*s,o,a);return e.getUint32(r,o)},e.parseExifData=function(t,i,o,a,n){if(!n.disableExif){var r,s,l,d=i+10;if(1165519206===t.getUint32(i+4)){if(d+8>t.byteLength)return void console.log("Invalid Exif data: Invalid segment size.");if(0!==t.getUint16(i+8))return void console.log("Invalid Exif data: Missing byte alignment offset.");switch(t.getUint16(d)){case 18761:r=!0;break;case 19789:r=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==t.getUint16(d+2,r))return void console.log("Invalid Exif data: Missing TIFF marker.");s=t.getUint32(d+4,r),a.exif=new e.ExifMap,s=e.parseExifTags(t,d,d+s,r,a),s&&!n.disableExifThumbnail&&(l={exif:{}},s=e.parseExifTags(t,d,d+s,r,l),l.exif[513]&&(a.exif.Thumbnail=e.getExifThumbnail(t,d+l.exif[513],l.exif[514]))),a.exif[34665]&&!n.disableExifSub&&e.parseExifTags(t,d,d+a.exif[34665],r,a),a.exif[34853]&&!n.disableExifGps&&e.parseExifTags(t,d,d+a.exif[34853],r,a)}}},e.metaDataParsers.jpeg[65505].push(e.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-exif"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-exif")):e(window.loadImage)}(function(e){"use strict";e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",3
406:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"E
4xposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}
4,Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":if(!t)return;return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":if(!t)return;return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":if(!t)return;return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return String(t)},function(e){var t,i=e.tags,o=e.map;for(t in i)i.hasOwnProperty(t)&&(o[i[t]]=t)}(e.ExifMap.prototype),e.ExifMap.prototype.getAll=function(){var e,t,i={};for(e in this)this.hasOwnProperty(e)&&(t=this.tags[e],t&&(i[t]=this.getText(t)));return i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-scale","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-scale"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";var t=e.hasCanvasOption,i=e.hasMetaOption,o=e.transformCoordinates,a=e.getTransformedOptions;e.hasCanvasOption=function(i){return!!i.orientation||t.call(e,i)},e.hasMetaOption=function(t){return t&&t.orientation===!0||i.call(e,t)},e.transformCoordinates=function(t,i){o.call(e,t,i);var a=t.getContext("2d"),n=t.width,r=t.height,s=t.style.width,l=t.style.height,d=i.orientation;if(d&&!(d>8))switch(d>4&&(t.width=r,t.height=n,t.style.width=l,t.style.height=s),d){case 2:a.translate(n,0),a.scale(-1,1);break;case 3:a.translate(n,r),a.rotate(Math.PI);break;case 4:a.translate(0,r),a.scale(1,-1);break;case 5:a.rotate(.5*Math.PI),a.scale(1,-1);break;case 6:a.rotate(.5*Math.PI),a.translate(0,-r);break;case 7:a.rotate(.5*Math.PI),a.translate(n,-r),a.scale(-1,1);break;case 8:a.rotate(-.5*Math.PI),a.translate(-n,0)}},e.getTransformedOptions=function(t,i,o){var n,r,s=a.call(e,t,i),l=s.orientation;if(l===!0&&o&&o.exif&&(l=o.exif.get("Orientation")),!l||l>8||1===l)return s;n={};for(r in s)s.hasOwnProperty(r)&&(n[r]=s[r]);switch(n.orientation=l,l){case 2:n.left=s.right,n.right=s.left;break;case 3:n.left=s.right,n.top=s.bottom,n.right=s.left,n.bottom=s.top;break;case 4:n.top=s.bottom,n.bottom=s.top;break;case 5:n.left=s.top,n.top=s.left,n.right=s.bottom,n.bottom=s.right;break;case 6:n.left=s.top,n.top=s.right,n.right=s.bottom,n.bottom=s.left;break;case 7:n.left=s.bottom,n.top=s.right,n.right=s.top,n.bottom=s.left;break;case 8:n.left=s.bottom,n.top=s.left,n.right=s.top,n.bottom=s.right}return n.orientation>4&&(n.maxWidth=s.maxHeight,n.maxHeight=s.maxWidth,n.minWidth=s.minHeight,n.minHeight=s.minWidth,n.sourceWidth=s.sourceHeight,n.sourceHeight=s.sourceWidth),n}}); 5//# sourceMappingURL=load-image.all.min.js.map 6 7 8 9//PNotify.js 10var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},PNotify=function(){"use strict";function t(){h.defaultStack.context=document.body,window.addEventListener("resize",function(){n&&clearTimeout(n),n=setTimeout(function(){h.positionAll()},10)})}function m(t){t.overlay.parentNode&&t.overlay.parentNode.removeChild(t.overlay)}function e(t,e){return"object"!==(void 0===t?"undefined":_typeof(t))&&(t={text:t}),e&&(t.type=e),{target:document.body,data:t}}var h=void 0,n=void 0;var i={runModules:function(t){if("init"===t){for(var e in h.modules)if(h.modules.hasOwnProperty(e)&&"function"==typeof h.modules[e].init){var i=h.modules[e].init(this);this.initModule(i)}}else{var n=this.get()._modules;for(var o in n)if(n.hasOwnProperty(o)){var s=_extends({_notice:this,_options:this.get()},this.get().modules[o]);n[o].set(s),"function"==typeof n[o][t]&&n[o][t]()}}},initModule:function(t){var e=this.get().modules;e.hasOwnProperty(t.constructor.key)||(e[t.constructor.key]={});var i=_extends({_notice:this,_options:this.get()},e[t.constructor.key]);t.initModule(i),this.get()._modules[t.constructor.key]=t},update:function(t){var e=this.get().hide,i=this.get().icon;this.set(t),this.runModules("update"),this.get().hide?e||this.queueClose():this.cancelClose(),this.queuePosition();var n=this.get().icon;return n!==i&&(!0===n&&"fontawesome5"===this.get().icons||"string"==typeof n&&n.match(/(^| )fa[srlb]($| )/))&&(this.set({icon:!1}),this.set({icon:n})),this},open:function(){var t=this,e=this.get(),i=e._state,n=e.hide;if("opening"!==i){if("open"!==i){this.set({_state:"opening",_animatingClass:"ui-pnotify-initial-hidden"}),this.runModules("beforeOpen");var o=this.get().stack;if(!this.refs.elem.parentNode||o&&o.context&&o.context!==this.refs.elem.parentNode)if(
vendor: 10,374 bytes, line 10
10o&&o.context)o.context.appendChild(this.refs.elem);else{if(!document.body)throw new Error("No context to open this notice in.");document.body.appendChild(this.refs.elem)}return setTimeout(function(){o&&(o.animation=!1,h.positionAll(),o.animation=!0),t.animateIn(function(){t.get().hide&&t.queueClose(),t.set({_state:"open"}),t.runModules("afterOpen")})},0),this}n&&this.queueClose()}},remove:function(t){return this.close(t)},close:function(t){var e=this,i=this.get()._state;if("closing"!==i&&"closed"!==i){this.set({_state:"closing",_timerHide:!!t}),this.runModules("beforeClose");var n=this.get()._timer;return n&&clearTimeout&&(clearTimeout(n),this.set({_timer:null})),this.animateOut(function(){if(e.set({_state:"closed"}),e.runModules("afterClose"),e.queuePosition(),e.get().remove&&e.refs.elem.parentNode.removeChild(e.refs.elem),e.runModules("beforeDestroy"),e.get().destroy&&null!==h.notices){var t=h.notices.indexOf(e);-1!==t&&h.notices.splice(t,1)}e.runModules("afterDestroy")}),this}},animateIn:function(a){var c=this;this.set({_animating:"in"});function l(){c.refs.elem.removeEventListener("transitionend",l);var t=c.get(),e=t._animTimer,i=t._animating,n=t._moduleIsNoticeOpen;if(e&&clearTimeout(e),"in"===i){var o=n;if(!o){var s=c.refs.elem.getBoundingClientRect();for(var r in s)if(0<s[r]){o=!0;break}}o?(a&&a.call(),c.set({_animating:!1})):c.set({_animTimer:setTimeout(l,40)})}}"fade"===this.get().animation?(this.refs.elem.addEventListener("transitionend",l),this.set({_animatingClass:"ui-pnotify-in"}),this.refs.elem.style.opacity,this.set({_animatingClass:"ui-pnotify-in ui-pnotify-fade-in"}),this.set({_animTimer:setTimeout(l,650)})):(this.set({_animatingClass:"ui-pnotify-in"}),l())},animateOut:function(f){var d=this;this.set({_animating:"out"});function p(){d.refs.elem.removeEventListener("transitionend",p);var t=d.get(),e=t._animTimer,i=t._animating,n=t._moduleIsNoticeOpen;if(e&&clearTimeout(e),"out"===i){var o=n;if(!o){var s=d.refs.elem.getBoundingClientRect();for(var r in s)if(0<s[r]){o=!0;break}}if(d.refs.elem.style.opacity&&"0"!==d.refs.elem.style.opacity&&o)d.set({_animTimer:setTimeout(p,40)});else{d.set({_animatingClass:""});var a=d.get().stack;if(a&&a.overlay){for(var c=!1,l=0;l<h.notices.length;l++){var u=h.notices[l];if(u!==d&&u.get().stack===a&&"closed"!==u.get()._state){c=!0;break}}c||m(a)}f&&f.call(),d.set({_animating:!1})}}}"fade"===this.get().animation?(this.refs.elem.addEventListener("transitionend",p),this.set({_animatingClass:"ui-pnotify-in"}),this.set({_animTimer:setTimeout(p,650)})):(this.set({_animatingClass:""}),p())},position:function(){var t=this.get().stack,e=this.refs.elem;if(t){if(t.context||(t.context=document.body),"number"!=typeof t.nextpos1&&(t.nextpos1=t.firstpos1),"number"!=typeof t.nextpos2&&(t.nextpos2=t.firstpos2),"number"!=typeof t.addpos2&&(t.addpos2=0),!e.classList.contains("ui-pnotify-in")&&!e.classList.contains("ui-pnotify-initial-hidden"))return this;t.modal&&(t.overlay||function(t){var e=document.createElement("div");e.classList.add("ui-pnotify-modal-overlay"),t.context!==document.body&&(e.style.height=t.context.scrollHeight+"px",e.style.width=t.context.scrollWidth+"px"),e.addEventListener("click",function(){t.overlayClose&&h.closeStack(t)}),t.overlay=e}(t),function(t){t.overlay.parentNode!==t.context&&(t.overlay=t.context.insertBefore(t.overlay,t.context.firstChild))}(t)),e.getBoundingClientRect(),t.animation&&this.set({_moveClass:"ui-pnotify-move"});var i=t.context===document.body?window.innerHeight:t.context.scrollHeight,n=t.context===document.body?window.innerWidth:t.context.scrollWidth,o=void 0;if(t.dir1){o={down:"top",up:"bottom",left:"right",right:"left"}[t.dir1];var s=void 0;switch(t.dir1){case"down":s=e.offsetTop;break;case"up":s=i-e.scrollHeight-e.offsetTop;break;case"left":s=n-e.scrollWidth-e.offsetLeft;break;case"right":s=e.offsetLeft}void 0===t.firstpos1&&(t.firstpos1=s,t.nextpos1=t.firstpos1)}if(t.dir1&&t.dir2){var r={down:"top",up:"bottom",left:"right",right:"left"}[t.dir2],a=void 0;switch(t.dir2){case"down":a=e.offsetTop;break;case"up":a=i-e.scrollHeight-e.offsetTop;break;case"left":a=n-e.scrollWidth-e.offsetLeft;break;case"right":a=e.offsetLeft}void 0===t.firstpos2&&(t.firstpos2=a,t.nextpos2=t.firstpos2);var c=t.nextpos1+e.offsetHeight+(void 0===t.spacing1?25:t.spacing1),l=t.nextpos1+e.offsetWidth+(void 0===t.spacing1?25:t.spacing1);switch((("down"===t.dir1||"up"===t.dir1)&&i<c||("left"===t.dir1||"right"===t.dir1)&&n<l)&&(t.nextpos1=t.firstpos1,t.nextpos2+=t.addpos2+(void 0===t.spacing2?25:t.spacing2),t.addpos2=0),"number"==typeof t.nextpos2&&(e.style[r]=t.nextpos2+"px",t.animation||e.style[r]),t.dir2){case"down":case"up":e.offsetHeight+(parseFloat(e.style.marginTop,10)||0)+(parseFloat(e.style.marginBottom,10)||0)>t.addpos2&&(t.addpos2=e.offsetHeight);break;case"left":case"right":e.offsetWidth+(parseFloat(e.style.marginLeft,10)||0)+(parseFloat(e.style.marginRight,10)||0)>t.addpos2&&(t.addpos2=e.offsetWidth)}}else if(t.dir1){var u=void 0,f=void 0;switch(t.dir1){case"down":case"up":f=["left","right"],u=t.context.scrollWidth/2-e.offsetWidth/2;break;case"left":case"right":f=["top","bottom"],u=i/2-e.offsetHeight/2}e.style[f[0]]=u+"px",e.style[f[1]]="auto",t.animation||e.style[f[0]]}if(t.dir1)switch("number"==typeof t.nextpos1&&(e.style[o]=t.nextpos1+"px",t.animation||e.style[o]),t.dir1){case"down":case"up":t.nextpos1+=e.offsetHeight+(void 0===t.spacing1?25:t.spacing1);break;case"left":case"right":t.nextpos1+=e.offsetWidth+(void 0===t.spacing1?25:t.spacing1)}else{var d=n/2-e.offsetWidth/2,p=i/2-e.offsetHeight/2;e.style.left=d+"px",e.style.top=p+"px",t.animation||e.style.left}return this}},queuePosition:function(t){return n&&clearTimeout(n),t||(t=10),n=setTimeout(function(){h.positionAll()},t),this},cancelRemove:function(){return this.cancelClose()},cancelClose:function(){var t=this.get(),e=t._timer,i=t._animTimer,n=t._state,o=t.animation;return e&&clearTimeout(e),i&&clearTimeout(i),"closing"===n&&this.set({_state:"open",_animating:!1,_animatingClass:"fade"===o?"ui-pnotify-in ui-pnotify-fade-in":"ui-pnotify-in"}),this},queueRemove:function(){return this.queueClose()},queueClose:function(){var t=this;return this.cancelClose(),this.set({_timer:setTimeout(function(){return t.close(!0)},isNaN(this.get().delay)?0:this.get().delay)}),this},addModuleClass:function(){for(var t=this.get()._moduleClasses,e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var o=0;o<i.length;o++){var s=i[o];-1===t.indexOf(s)&&t.push(s)}this.set({_moduleClasses:t})},removeModuleClass:function(){for(var t=this.get()._moduleClasses,e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var o=0;o<i.length;o++){var s=i[o],r=t.indexOf(s);-1!==r&&t.splice(r,1)}this.set({_moduleClasses:t})},hasModuleClass:function(){for(var t=this.get()._moduleClasses,e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];for(var o=0;o<i.length;o++){var s=i[o];if(-1===t.indexOf(s))return!1}return!0}};function D(t,e,i){var n=Object.create(t);return n.module=e[i],n}function F(t,e,i){var n=Object.create(t);return n.module=e[i],n}function V(e,t,i){var n,o,s=i.module;function r(t){return{root:e.root,store:e.store}}if(s)var a=new s(r());function c(t){e.initModule(t.module)}return a&&a.on("init",c),{key:t,first:null,c:function(){n=d(),a&&a._fragment.c(),o=d(),this.first=n},m:function(t,e){et(t,n,e),a&&a._mount(t,e),et(t,o,e)},p:function(t,e){s!==(s=e.module)&&(a&&a.destroy(),s?((a=new s(r()))._fragment.c(),a._mount(o.parentNode,o),a.on("init",c)):a=null)},d:function(t){t&&(ot(n),ot(o)),a&&a.destroy(t)}}}function $(i,t){var n,o,s,r;return{c:function(){n=Q("div"),(o=Q("span")).className=s=!0===t.icon?t._icons[t.type]?t._icons[t.type]:"":t.icon,n.className=r="ui-pnotify-icon "+(t._styles.icon?t._styles.icon:"")},m:function(t,e){et(t,n,e),U(n,o),i.refs.iconContainer=n},p:function(t,e){(t.icon||t._icons||t.type)&&s!==(s=!0===e.icon?e._icons[e.type]?e._icons[e.type]:"":e.icon)&&(o.className=s),t._styles&&r!==(r="ui-pnotify-icon "+(e._styles.icon?e._styles.icon:""))&&(n.className=r)},d:function(t){t&&ot(n),i.refs.iconContainer===n&&(i.refs.iconContainer=null)}}}function G(i,t){var n,o;function s(t){return t.titleTrusted?l:c}var r=s(t),a=r(i,t);return{c:function(){n=Q("h4"),a.c(),n.className=o="ui-pnotify-title "+(t._styles.title?t._styles.title:"")},m:function(t,e){et(t,n,e),a.m(n,null),i.refs.titleContainer=n},p:function(t,e){r===(r=s(e))&&a?a.p(t,e):(a.d(1),(a=r(i,e)).c(),a.m(n,null)),t._styles&&o!==(o="ui-pnotify-title "+(e._styles.title?e._styles.title:""))&&(n.className=o)},d:function(t){t&&ot(n),a.d(),i.refs.titleContainer===n&&(i.refs.titleContainer=null)}}}function c(t,e){var i;return{c:function(){i=Y(e.title)},m:function(t,e){et(t,i,e)},p:function(t,e){t.title&&s(i,e.title)},d:function(t){t&&ot(i)}}}function l(t,i){var n,o;return{c:function(){n=Q("noscript"),o=Q("noscript")},m:function(t,e){et(t,n,e),n.insertAdjacentHTML("afterend",i.title),et(t,o,e)},p:function(t,e){t.title&&(r(n,o),n.insertAdjacentHTML("afterend",e.title))},d:function(t){t&&(r(n,o),ot(n),ot(o))}}}function J(i,t){var n,o;function s(t){return t.textTrusted?f:u}var r=s(t),a=r(i,t);return{c:function(){n=Q("div"),a.c(),n.className=o="ui-pnotify-text "+(t._styles.text?t._styles.text:""),Z(n,"role","alert")},m:function(t,e){et(t,n,e),a.m(n,null),i.refs.textContainer=n},p:function(t,e){r===(r=s(e))&&a?a.p(t,e):(a.d(1),(a=r(i,e)).c(),a.m(n,null)),t._styles&&o!==(o="ui-pnotify-text "+(e._styles.text?e._styles.text:""))&&(n.className=o)},d:function(t){t&&ot(n),a.d(),i.refs.textContainer===n&&(i.refs.textContainer=null)}}}function u(t,e){var i;return{c:function(){i=Y(e.text)},m:function(t,e){et(t,i,e)},p:function(t,e){t.text&&s(i,e.text)},d:function(t){t&&ot(i)}}}function f(t,i){var n,o;return{c:function(){n=Q("noscript"),o=Q("noscript")},m:function(t,e){et(t,n,e),n.insertAdjacentHTML("afterend",i.text),et(t,o,e)},p:function(t,e){t.text&&(r(n,o),n.insertAdjacentHTML("afterend",e.text))},d:function(t){t&&(r(n,o),ot(n),ot(o))}}}function K(e,t,i){var n,o,s=i.module;function r(t){return{root:e.root,store:e.store}}if(s)var a=new s(r());function c(t){e.initModule(t.module)}return a&&a.on("init",c),{key:t,first:null,c:function(){n=d(),a&&a._fragment.c(),o=d(),this.first=n},m:function(t,e){et(t,n,e),a&&a._mount(t,e),et(t,o,e)},p:function(t,e){s!==(s=e.module)&&(a&&a.destroy(),s?((a=new s(r()))._fragment.c(),a._mou
10nt(o.parentNode,o),a.on("init",c)):a=null)},d:function(t){t&&(ot(n),ot(o)),a&&a.destroy(t)}}}function o(t){var e=this;!function(t,e){t._handlers=X(),t._slots=X(),t._bind=e._bind,t._staged={},t.options=e,t.root=e.root||t,t.store=e.store||t.root.store,e.root||(t._beforecreate=[],t._oncreate=[],t._aftercreate=[])}(this,t),this.refs={},this._state=a(function(){var t=_extends({_state:"initializing",_timer:null,_animTimer:null,_animating:!1,_animatingClass:"",_moveClass:"",_timerHide:!1,_moduleClasses:[],_moduleIsNoticeOpen:!1,_modules:{},_modulesPrependContainer:h.modulesPrependContainer,_modulesAppendContainer:h.modulesAppendContainer},h.defaults);return t.modules=_extends({},h.defaults.modules),t}(),t.data),this._recompute({styling:1,icons:1,width:1,minHeight:1},this._state),this._intro=!0,document.getElementById("svelte-1eldsjg-style")||function(){var t=Q("style");t.id="svelte-1eldsjg-style",t.textContent='body > .ui-pnotify{position:fixed;z-index:100040}body > .ui-pnotify.ui-pnotify-modal{z-index:100042}.ui-pnotify{position:absolute;height:auto;z-index:1;display:none}.ui-pnotify.ui-pnotify-modal{z-index:3}.ui-pnotify.ui-pnotify-in{display:block}.ui-pnotify.ui-pnotify-initial-hidden{display:block;visibility:hidden}.ui-pnotify.ui-pnotify-move{transition:left .5s ease, top .5s ease, right .5s ease, bottom .5s ease}.ui-pnotify.ui-pnotify-fade-slow{transition:opacity .4s linear;opacity:0}.ui-pnotify.ui-pnotify-fade-slow.ui-pnotify.ui-pnotify-move{transition:opacity .4s linear, left .5s ease, top .5s ease, right .5s ease, bottom .5s ease}.ui-pnotify.ui-pnotify-fade-normal{transition:opacity .25s linear;opacity:0}.ui-pnotify.ui-pnotify-fade-normal.ui-pnotify.ui-pnotify-move{transition:opacity .25s linear, left .5s ease, top .5s ease, right .5s ease, bottom .5s ease}.ui-pnotify.ui-pnotify-fade-fast{transition:opacity .1s linear;opacity:0}.ui-pnotify.ui-pnotify-fade-fast.ui-pnotify.ui-pnotify-move{transition:opacity .1s linear, left .5s ease, top .5s ease, right .5s ease, bottom .5s ease}.ui-pnotify.ui-pnotify-fade-in{opacity:1}
10.ui-pnotify .ui-pnotify-shadow{-webkit-box-shadow:0px 6px 28px 0px rgba(0,0,0,0.1);-moz-box-shadow:0px 6px 28px 0px rgba(0,0,0,0.1);box-shadow:0px 6px 28px 0px rgba(0,0,0,0.1)}.ui-pnotify-container{background-position:0 0;padding:.8em;height:100%;margin:0}.ui-pnotify-container:after{content:" ";visibility:hidden;display:block;height:0;clear:both}.ui-pnotify-container.ui-pnotify-sharp{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.ui-pnotify-title{display:block;white-space:pre-line;margin-bottom:.4em;margin-top:0}.ui-pnotify.ui-pnotify-with-icon .ui-pnotify-title,.ui-pnotify.ui-pnotify-with-icon .ui-pnotify-text{margin-left:24px}[dir=rtl] .ui-pnotify.ui-pnotify-with-icon .ui-pnotify-title,[dir=rtl] .ui-pnotify.ui-pnotify-with-icon .ui-pnotify-text{margin-right:24px;margin-left:0}.ui-pnotify-title-bs4{font-size:1.2rem}.ui-pnotify-text{display:block;white-space:pre-line}.ui-pnotify-icon,.ui-pnotify-icon span{display:block;float:left}[dir=rtl] .ui-pnotify-icon,[dir=rtl] .ui-pnotify-icon span{float:right}.ui-pnotify-icon-bs3 > span{position:relative;top:2px}.ui-pnotify-icon-bs4 > span{position:relative;top:4px}.ui-pnotify-modal-overlay{background-color:rgba(0, 0, 0, .4);top:0;left:0;position:absolute;height:100%;width:100%;z-index:2}body > .ui-pnotify-modal-overlay{position:fixed;z-index:100041}',U(document.head,t)}(),this._fragment=function(o,t){for(var s,r,a,c,l,u,f,d,p,m=[],h=X(),y=[],g=X(),e=t._modulesPrependContainer,_=function(t){return t.module.key},i=0;i<e.length;i+=1){var n=F(t,e,i),v=_(n);m[i]=h[v]=V(o,v,n)}var b=!1!==t.icon&&$(o,t),x=!1!==t.title&&G(o,t),C=!1!==t.text&&J(o,t),w=t._modulesAppendContainer,k=function(t){return t.module.key};for(i=0;i<w.length;i+=1){var T=D(t,w,i),S=k(T);y[i]=g[S]=K(o,S,T)}function N(t){o.fire("mouseover",t)}function H(t){o.fire("mouseout",t)}function M(t){o.fire("mouseenter",t)}function O(t){o.fire("mouseleave",t)}function A(t){o.fire("mousemove",t)}function L(t){o.fire("mousedown",t)}function j(t){o.fire("mouseup",t)}function E(t){o.fire("click",t)}function P(t){o.fire("dblclick",t)}function W(t){o.fire("focus",t)}function z(t){o.fire("blur",t)}function R(t){o.fire("touchstart",t)}function q(t){o.fire("touchmove",t)}function B(t){o.fire("touchend",t)}function I(t){o.fire("touchcancel",t)}return{c:function(){for(s=Q("div"),r=Q("div"),i=0;i<m.length;i+=1)m[i].c();for(a=Y("\n "),b&&b.c(),c=Y("\n "),x&&x.c(),l=Y("\n "),C&&C.c(),u=Y("\n "),i=0;i<y.length;i+=1)y[i].c();r.className=f="\n ui-pnotify-container\n "+(t._styles.container?t._styles.container:"")+"\n "+(t._styles[t.type]?t._styles[t.type]:"")+"\n "+t.cornerClass+"\n "+(t.shadow?"ui-pnotify-sha
10dow":"")+"\n ",r.style.cssText=d=t._widthStyle+" "+t._minHeightStyle,Z(r,"role","alert"),tt(s,"mouseover",N),tt(s,"mouseout",H),tt(s,"mouseenter",M),tt(s,"mouseleave",O),tt(s,"mousemove",A),tt(s,"mousedown",L),tt(s,"mouseup",j),tt(s,"click",E),tt(s,"dblclick",P),tt(s,"focus",W),tt(s,"blur",z),tt(s,"touchstart",R),tt(s,"touchmove",q),tt(s,"touchend",B),tt(s,"touchcancel",I),s.className=p="\n ui-pnotify\n "+(!1!==t.icon?"ui-pnotify-with-icon":"")+"\n "+(t._styles.element?t._styles.element:"")+"\n "+t.addClass+"\n "+t._animatingClass+"\n "+t._moveClass+"\n "+("fade"===t.animation?"ui-pnotify-fade-"+t.animateSpeed:"")+"\n "+(t.stack&&t.stack.modal?"ui-pnotify-modal":"")+"\n "+t._moduleClasses.join(" ")+"\n ",Z(s,"aria-live","assertive"),Z(s,"role","alertdialog"),Z(s,"ui-pnotify",!0)},m:function(t,e){for(et(t,s,e),U(s,r),i=0;i<m.length;i+=1)m[i].m(r,null);for(U(r,a),b&&b.m(r,null),U(r,c),x&&x.m(r,null),U(r,l),C&&C.m(r,null),U(r,u),i=0;i<y.length;i+=1)y[i].m(r,null);o.refs.container=r,o.refs.elem=s},p:function(t,e){var i=e._modulesPrependContainer;m=it(m,o,t,_,1,e,i,h,r,nt,V,"m",a,F),!1!==e.icon?b?b.p(t,e):((b=$(o,e)).c(),b.m(r,c)):b&&(b.d(1),b=null),!1!==e.title?x?x.p(t,e):((x=G(o,e)).c(),x.m(r,l)):x&&(x.d(1),x=null),!1!==e.text?C?C.p(t,e):((C=J(o,e)).c(),C.m(r,u)):C&&(C.d(1),C=null);var n=e._modulesAppendContainer;y=it(y,o,t,k,1,e,n,g,r,nt,K,"m",null,D),(t._styles||t.type||t.cornerClass||t.shadow)&&f!==(f="\n ui-pnotify-container\n "+(e._styles.container?e._styles.container:"")+"\n "+(e._styles[e.type]?e._styles[e.type]:"")+"\n "+e.cornerClass+"\n "+(e.shadow?"ui-pnotify-sha
10dow":"")+"\n ")&&(r.className=f),(t._widthStyle||t._minHeightStyle)&&d!==(d=e._widthStyle+" "+e._minHeightStyle)&&(r.style.cssText=d),(t.icon||t._styles||t.addClass||t._animatingClass||t._moveClass||t.animation||t.animateSpeed||t.stack||t._moduleClasses)&&p!==(p="\n ui-pnotify\n "+(!1!==e.icon?"ui-pnotify-with-icon":"")+"\n "+(e._styles.element?e._styles.element:"")+"\n "+e.addClass+"\n "+e._animatingClass+"\n "+e._moveClass+"\n "+("fade"===e.animation?"ui-pnotify-fade-"+e.animateSpeed:"")+"\n "+(e.stack&&e.stack.modal?"ui-pnotify-modal":"")+"\n "+e._moduleClasses.join(" ")+"\n ")&&(s.className=p)},d:function(t){for(t&&ot(s),i=0;i<m.length;i+=1)m[i].d();for(b&&b.d(),x&&x.d(),C&&C.d(),i=0;i<y.length;i+=1)y[i].d();o.refs.container===r&&(o.refs.container=null),st(s,"mouseover",N),st(s,"mouseout",H),st(s,"mouseenter",M),st(s,"mouseleave",O),st(s,"mousemove",A),st(s,"mousedown",L),st(s,"mouseup",j),st(s,"click",E),st(s,"dblclick",P),st(s,"focus",W),st(s,"blur",z),st(s,"touchstart",R),st(s,"touchmove",q),st(s,"touchend",B),st(s,"touchcancel",I),o.refs.elem===s&&(o.refs.elem=null)}}}(this,this._state),this.root._oncreate.push(function(){(function(){var e=this;this.on("mouseenter",function(t){if(e.get().mouseReset&&"out"===e.get()._animating){if(!e.get()._timerHide)return;e.cancelClose()}e.get().hide&&e.get().mouseReset&&e.cancelClose()}),this.on("mouseleave",function(t){e.get().hide&&e.get().mouseReset&&"out"!==e.get()._animating&&e.queueClose(),h.positionAll()});var t=this.get().stack;t&&"top"===t.push?h.notices.splice(0,0,this):h.notices.push(this),this.runModules("init"),this.set({_state:"closed"}),this.get().autoDisplay&&this.open()}).call(e),e.fire("update",{changed:function(t,e){for(var i in e)t[i]=1;return t}({},e._state),current:e._state})}),t.target&&(this._fragment.c(),this._mount(t.target,t.anchor),p(this))}function Q(t){return document.createElement(t)}function U(t,e){t.appendChild(e)}function X(){return Object.create(null)}function Y(t){return document.createTextNode(t)}function Z(t,e,i){null==i?t.removeAttribute(e):t.setAttribute(e,i)}function tt(t,e,i,n){t.addEventListener(e,i,n)}function et(t,e,i){t.insertBefore(e,i)}function it(t,e,i,n,o,s,r,a,c,l,u,f,d,p){for(var m=t.length,h=r.length,y=m,g={};y--;)g[t[y].key]=y;var _=[],v={},b={};for(y=h;y--;){var x=p(s,r,y),C=n(x),w=a[C];w?o&&w.p(i,x):(w=u(e,C,x)).c(),_[y]=v[C]=w,C in g&&(b[C]=Math.abs(y-g[C]))}var k={},T={};function S(t){t[f](c,d),a[t.key]=t,d=t.first,h--}for(;m&&h;){var N=_[h-1],H=t[m-1],M=N.key,O=H.key;N===H?(d=N.first,m--,h--):v[O]?!a[M]||k[M]?S(N):T[O]?m--:b[M]>b[O]?(T[M]=!0,S(N)):(k[O]=!0,m--):(l(H,a),m--)}for(;m--;){v[(H=t[m]).key]||l(H,a)}for(;h;)S(_[h-1]);return _}function nt(t,e){t.d(1),e[t.key]=null}function ot(t){t.parentNode.removeChild(t)}function st(t,e,i,n){t.removeEventListener(e,i,n)}function d(){return document.createComment("")}function s(t,e){t.data=""+e}function r(t,e){for(;t.nextSibling&&t.nextSibling!==e;)t.parentNode.removeChild(t.nextSibling)}function a(t,e){for(var i in e)t[i]=e[i];return t}function p(t){t._lock=!0,y(t._beforecreate),y(t._oncreate),y(t._aftercreate),t._lock=!1}function y(t){for(;t&&t.length;)t.shift()()}function g(){}return a(o.prototype,{destroy:function(t){this.destroy=g,this.fire("destroy"),this.set=g,this._fragment.d(!1!==t),this._fragment=null,this._state={}},get:function(){return this._state},fire:function(t,e){var i=t in this._handlers&&this._handlers[t].slice();if(!i)return;for(var n=0;n<i.length;n+=1){var o=i[n];if(!o.__calling)try{o.__calling=!0,o.call(this,e)}finally{o.__calling=!1}}},on:function(t,e){var i=this._handlers[t]||(this._handlers[t]=[]);return i.push(e),{cancel:function(){var t=i.indexOf(e);~t&&i.splice(t,1)}}},set:function(t){if(this._set(a({},t)),this.root._lock)return;p(this.root)},_set:function(t){var e=this._state,i={},n=!1;for(var o in t=a(this._staged,t),this._staged={},t)this._differs(t[o],e[o])&&(i[o]=n=!0);if(!n)return;this._state=a(a({},e),t),this._recompute(i,this._state),this._bind&&this._bind(i,this._state);this._fragment&&(this.fire("state",{changed:i,current:this._state,previous:e}),this._fragment.p(i,this._state),this.fire("update",{changed:i,current:this._state,previous:e}))},_stage:function(t){a(this._staged,t)},_mount:function(t,e){this._fragment[this._fragment.i?"i":"m"](t,e||null)},_differs:function(t,e){return t!=t?e==e:t!==e||t&&"object"===(void 0===t?"undefined":_typeof(t))||"function"==typeof t}}
10),a(o.prototype,i),o.prototype._recompute=function(t,e){t.styling&&this._differs(e._styles,e._styles=function(t){var e=t.styling;return"object"===(void 0===e?"undefined":_typeof(e))?e:h.styling[e]}(e))&&(t._styles=!0),t.icons&&this._differs(e._icons,e._icons=function(t){var e=t.icons;return"object"===(void 0===e?"undefined":_typeof(e))?e:h.icons[e]}(e))&&(t._icons=!0),t.width&&this._differs(e._widthStyle,e._widthStyle=function(t){var e=t.width;return"string"==typeof e?"width: "+e+";":""}(e))&&(t._widthStyle=!0),t.minHeight&&this._differs(e._minHeightStyle,e._minHeightStyle=function(t){var e=t.minHeight;return"string"==typeof e?"min-height: "+e+";":""}(e))&&(t._minHeightStyle=!0)},(h=o).VERSION="4.0.0",h.defaultStack={dir1:"down",dir2:"left",firstpos1:25,firstpos2:25,spacing1:36,spacing2:36,push:"bottom",context:window&&document.body},h.defaults={title:!1,titleTrusted:!1,text:!1,textTrusted:!1,styling:"brighttheme",icons:"brighttheme",addClass:"",cornerClass:"",autoDisplay:!0,width:"360px",minHeight:"16px",type:"notice",icon:!0,animation:"fade",animateSpeed:"normal",shadow:!0,hide:!0,delay:8e3,mouseReset:!0,remove:!0,destroy:!0,stack:h.defaultStack,modules:{}},h.notices=[],h.modules={},h.modulesPrependContainer=[],h.modulesAppendContainer=[],h.alert=function(t){return new h(e(t))},h.notice=function(t){return new h(e(t,"notice"))},h.info=function(t){return new h(e(t,"info"))},h.success=function(t){return new h(e(t,"success"))},h.error=function(t){return new h(e(t,"error"))},h.removeAll=function(){h.closeAll()},h.closeAll=function(){for(var t=0;t<h.notices.length;t++)h.notices[t].close&&h.notices[t].close(!1)},h.removeStack=function(t){h.closeStack(t)},h.closeStack=function(t){if(!1!==t)for(var e=0;e<h.notices.length;e++)h.notices[e].close&&h.notices[e].get().stack===t&&h.notices[e].close(!1)},h.positionAll=function(){if(n&&clearTimeout(n),n=null,0<h.notices.length){for(var t=0;t<h.notices.length;t++){var e=h.notices[t].get().stack;e&&(e.overlay&&m(e),e.nextpos1=e.firstpos1,e.nextpos2=e.firstpos2,e.addpos2=0)}for(var i=0;i<h.notices.length;i++)h.notices[i].position()}else delete h.defaultStack.nextpos1,delete h.defaultStack.nextpos2},h.styling={brighttheme:{container:"brighttheme",notice:"brighttheme-notice",info:"brighttheme-info",success:"brighttheme-success",error:"brighttheme-error"},bootstrap3:{container:"alert",notice:"alert-warning",info:"alert-info",success:"alert-success",error:"alert-danger",icon:"ui-pnotify-icon-bs3"},bootstrap4:{container:"alert",notice:"alert-warning",info:"alert-info",success:"alert-success",error:"alert-danger",icon:"ui-pnotify-icon-bs4",title:"ui-pnotify-title-bs4"}},h.icons={brighttheme:{notice:"brighttheme-icon-notice",info:"brighttheme-icon-info",success:"brighttheme-icon-success",error:"brighttheme-icon-error"},bootstrap3:{notice:"glyphicon glyphicon-exclamation-sign",info:"glyphicon glyphicon-info-sign",success:"glyphicon glyphicon-ok-sign",error:"glyphicon glyphicon-warning-sign"},fontawesome4:{notice:"fa fa-exclamation-circle",info:"fa fa-info-circle",success:"fa fa-check-circle",error:"fa fa-exclamation-triangle"},fontawesome5:{notice:"fas fa-exclamation-circle",info:"fas fa-info-circle",success:"fas fa-check-circle",error:"fas fa-exclamation-triangle"}},window&&document.body?t():document.addEventListener("DOMContentLoaded",t),o}(); 11 12//PNotify.js 13var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},PNotifyAnimate=function(t){"use strict";t=t&&t.__esModule?t.default:t;var e;function n(e){!function(e,t){e._handlers=a(),e._slots=a(),e._bind=t._bind,e._staged={},e.options=t,e.root=t.root||e,e.store=t.store||e.root.store,t.root||(e._beforecreate=[],e._oncreate=[],e._aftercreate=[])}(this,e),this._state=s(_extends({_notice:null,_options:{}},t.modules.Animate.defaults),e.data),this._intro=!0,this._fragment=(this._state,{c:i,m:i,p:i,d:i}),e.target&&(this._fragment.c(),this._mount(e.target,e.anchor))}function i(){}function s(e,t){for(var n in t)e[n]=t[n];return e}function a(){return Object.create(null)}function o(e){for(;e&&e.length;)e.shift()()}return s(n.prototype,{destroy:function(e){this.destroy=i,this.fire("destroy"),this.set=i,this._fragment.d(!1!==e),this._fragment=null,this._state={}},get:function(){return this._state},fire:function(e,t){var n=e in this._handlers&&this._handlers[e].slice();if(!n)return;for(var i=0;i<n.length;i+=1){var a=n[i];if(!a.__calling)try{a.__calling=!0,a.call(this,t)}finally{a.__calling=!1}}},on:function(e,t){var n=this._handlers[e]||(this._handlers[e]=[]);return n.push(t),{cancel:function(){var e=n.indexOf(t);~e&&n.splice(e,1)}}},set:function(e){if(this._set(s({},e)),this.root._lock)return;!function(e){e._lock=!0,o(e._beforecreate),o(e._oncreate),o(e._aftercreate),e._lock=!1}(this.root)},_set:function(e){var t=this._state,n={},i=!1;for(var a in e=s(this._staged,e),this._staged={},e)this._differs(e[a],t[a])&&(n[a]=i=!0);if(!i)return;this._state=s(s({},t),e),this._recompute(n,this._state),this._bind&&this._bind(n,this._state);this._fragment&&(this.fire("state",{changed:n,current:this._state,previous:t}),this._fragment.p(n,this._state),this.fire("update",{changed:n,current:this._state,previous:t}))},_stage:function(e){s(this._staged,e)},_mount:function(e,t){this._fragment[this._fragment.i?"i":"m"](e,t||null)},_differs:function(e,t){return e!=e?t==t:e!==t||e&&"object"===(void 0===e?"undefined":_typeof(e))||"function"==typeof e}}),s(n.prototype,{initModule:function(e){this.set(e),this.setUpAnimations()},update:function(){this.setUpAnimations()},setUpAnimations:function(){var e=this.get(),t=e._notice,n=e._options;if(e.animate){t.set({animation:"none"}),t._animateIn||(t._animateIn=t.animateIn),t._animateOut||(t._animateOut=t.animateOut),t.animateIn=this.animateIn.bind(this),t.animateOut=this.animateOut.bind(this);var i=250;"slow"===n.animateSpeed?i=400:"fast"===n.animateSpeed?i=100:0<n.animateSpeed&&(i=n.animateSpeed),i/=1e3,t.refs.elem.style.WebkitAnimationDuration=i+"s",t.refs.elem.style.MozAnimationDuration=i+"s",t.refs.elem.style.animationDuration=i+"s"}else t._animateIn&&t._animateOut&&(t.animateIn=t._animateIn,delete t._animateIn,t.animateOut=t._animateOut,delete t._animateOut)},animateIn:function(e){var t=this.get()._notice;function n(){t.refs.elem.removeEventListener("webkitAnimationEnd",n),t.refs.elem.removeEventListener("mozAnimationEnd",n),t.refs.elem.removeEventListener("MSAnimationEnd",n),t.refs.elem.removeEventListener("oanimationend",n),t.refs.elem.removeEventListener("animationend",n),t.set({_animatingClass:"ui-pnotify-in animated"}),e&&e.call(),t.set({_animating:!1})}t.set({_animating:"in"}),t.refs.elem.addEventListener("webkitAnimationEnd",n),t.refs.elem.addEventListener("mozAnimationEnd",n),t.refs.elem.addEventListener("MSAnimationEnd",n),t.refs.elem.addEventListener("oanimationend",n),t.refs.elem.addEventListener("animationend",n),t.set({_animatingClass:"ui-pnotify-in animated "+this.get().inClass})},animateOut:function(e){var t=this.get()._notice;function n(){t.refs.elem.removeEventListener("webkitAnimationEnd",n),t.refs.elem.removeEventListener("mozAnimationEnd",n),t.refs.elem.removeEventListener("MSAnimationEnd",n),t.refs.elem.removeEventListener("oanimationend",n),t.refs.elem.removeEventListener("animationend",n),t.set({_animatingClass:"animated"}),e&&e.call(),t.set({_animating:!1})}t.set({_animating:"out"}),t.refs.elem.addEventListener("webkitAnimationEnd",n),t.refs.elem.addEventListener("mozAnimationEnd",n),t.refs.elem.addEventListener("MSAnimationEnd",n),t.refs.elem.addEventListener("oanimationend",n),t.refs.elem.addEventListener("animationend",n),t.set({_animatingClass:"ui-pnotify-in animated "+this.get().outClass})}}),n.prototype._recompute=i,(e=n).key="Animate",e.defaults={animate:!1,inClass:"",outClass:""},e.init=function(i){return i.attention=function(e,t){function n(){i.refs.container.removeEventListener("webkitAnimationEnd",n),i.refs.container.removeEventListener("mozAnimationEnd",n),i.refs.container.removeEventListener("MSAnimationEnd",n),i.refs.container.removeEventListener("oanimationend",n),i.refs.container.removeEventListener("animationend",n),i.refs.container.classList.remove(e),t&&t.call(i)}i.refs.container.addEventListener("webkitAnimationEnd",n),i.refs.container.addEventListener("mozAnimationEnd",n),i.refs.container.addEventListener("MSAnimationEnd",n),i.refs.container.addEventListener("oanimationend",n),i.refs.container.addEventListener("animationend",n),i.refs.container.classList.add("animated"),i.refs.container.classList.add(e)},new e({target:document.body})},t.modules.Animate=e,n}(PNotify); 14 15 16 17//emoji-mart.js 18!function(e){var t={};function n(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}
18),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(i,o,function(t){return e[t]}.bind(null,o));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=13)}([function(e,t,n){var i=n(6),o=n(16),r="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,s=/^(?:accent|alignment|arabic|baseline|cap|clip|color|fill|flood|font|glyph|horiz|marker|overline|paint|stop|strikethrough|stroke|text|underline|unicode|units|v|vector|vert|word|writing|x)[A-Z]/,a=i.options.event;function l(e){return p.bind(null,e)}function u(e,t,n){return i.render(e,t),"function"==typeof n&&n(),null!=e?e.__c:null}i.options.event=function(e){return a&&(e=a(e)),e.persist=Object,e.nativeEvent=e,e};var c=function(){};function d(e){return u(i.h(c,{context:this.context},e.vnode),e.container),null}function h(e,t){return i.h(d,{vnode:e,container:t})}c.prototype.getChildContext=function(){return this.props.context},c.prototype.render=function(e){return e.children};var f=function(e,t){return null==e?null:(e=i.toChildArray(e)).map(t)},m={map:f,forEach:f,count:function(e){return e?i.toChildArray(e).length:0},only:function(e){if(1!==(e=i.toChildArray(e)).length)throw new Error("Children.only() expects only one child.");return e[0]},toArray:i.toChildArray};function p(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];var n=i.h.apply(void 0,e),o=n.type,r=n.props;return"function"!=typeof o&&(r.defaultValue&&(r.value||0===r.value||(r.value=r.defaultValue),delete r.defaultValue),Array.isArray(r.value)&&r.multiple&&"select"===o&&(i.toChildArray(r.children).forEach(function(e){-1!==r.value.indexOf(e.props.value)&&(e.props.selected=!0)}),delete r.value),function(e,t){var n,i,o;for(o in t)if(n=s.test(o))break;if(n)for(o in i=e.props={},t)i[s.test(o)?o.replace(/([A-Z0-9])/,"-$1").toLowerCase():o]=t[o]}(n,r)),n.preactCompatNormalized=!1,g(n)}function g(e){return e.preactCompatNormalized=!0,function(e){var t=e.props;(t.class||t.className)&&(w.enumerable="className"in t,t.className&&(t.class=t.className),Object.defineProperty(t,"className",w))}(e),function(t){var n=e.type,i=e.props;if(i&&"string"==typeof n){var o={};for(var r in i)o[r.toLowerCase()]=r;if(o.ondoubleclick&&(i.ondblclick=i[o.ondoubleclick],delete i[o.ondoubleclick]),o.onbeforeinput&&(i.onbeforeinput=i[o.onbeforeinput],delete i[o.onbeforeinput]),o.onchange&&("textarea"===n||"input"===n.toLowerCase()&&!/^fil|che|rad/i.test(i.type))){var s=o.oninput||"oninput";i[s]||(i[s]=i[o.onchange],delete i[o.onchange])}}}(),e}function v(e){if(!_(e))return e;var t=g(i.cloneElement.apply(null,arguments));return t.$$typeof=r,t}function _(e){return null!=e&&e.$$typeof===r}function y(e){return null!=e.__t&&(i.render(null,e),!0)}var w={configurable:!0,get:function(){return this.class}};function b(e,t){for(var n in e)if(!(n in t))return!0;for(var i in t)if(e[i]!==t[i])return!0;return!1}function j(e){return e&&(e.base||1===e.nodeType&&e)||null}var k=function(e){function t(t){e.call(this,t),this.isPureReactComponent=!0}return e&&(t.__proto__=e),(t.prototype=Object.create(e&&e.prototype)).constructor=t,t.prototype.shouldComponentUpdate=function(e,t){return b(this.props,e)||b(this.state,t)},t}(i.Component);function E(e,t){function n(e){var n=this.props.ref,i=n==e.ref;return i||(n.call?n(null):n.current=null),(null==t?b(this.props,e):!t(this.props,e))||!i}function o(t){return this.shouldComponentUpdate=n,i.h(e,Object.assign({},t))}return o.displayName="Memo("+(e.displayName||e.name)+")",o.n=!0,o}function C(e,t){Object.defineProperty(e.prototype,"UNSAFE_"+t,{configurable:!0,get:function(){return this[t]},set:function(e){this[t]=e}})}function S(e){function t(t){var n=t.ref;return delete t.ref,e(t,n)}return t.n=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}i.Component.prototype.isReactComponent={},C(i.Component,"componentWillMount"),C(i.Component,"componentWillReceiveProps"),C(i.Component,"componentWillUpdate");var P=i.options.vnode;i.options.vnode=function(e){e.$$typeof=r;var t=e.type;null!=t&&t.n&&null!=e.ref&&(e.props.ref=e.ref,e.ref=null),P&&P(e)};var R=Object.assign({},o,{version:"16.8.0",Children:m,render:u,hydrate:u,unmountComponentAtNode:y,
18createPortal:h,createElement:p,createContext:i.createContext,createFactory:l,cloneElement:v,createRef:i.createRef,Fragment:i.Fragment,isValidElement:_,findDOMNode:j,Component:i.Component,PureComponent:k,memo:E,forwardRef:S});Object.keys(o).forEach(function(e){t[e]=o[e]}),t.createContext=i.createContext,t.createRef=i.createRef,t.Fragment=i.Fragment,t.Component=i.Component,t.version="16.8.0",t.Children=m,t.render=u,t.hydrate=u,t.unmountComponentAtNode=y,t.createPortal=h,t.createElement=p,t.createFactory=l,t.cloneElement=v,t.isValidElement=_,t.findDOMNode=j,t.PureComponent=k,t.memo=E,t.forwardRef=S,t.default=R},function(e,t,n){e.exports=n(17)()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=Object;t.default=i.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.throttleIdleTask=t.measureScrollbar=t.unifiedToNative=t.deepMerge=t.intersect=t.uniq=t.getSanitizedData=t.getData=void 0;var i=s(n(19)),o=n(5),r=s(n(20));function s(e){return e&&e.__esModule?e:{default:e}}const a=JSON,l=/^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/,u=["1F3FA","1F3FB","1F3FC","1F3FD","1F3FE","1F3FF"];function c(e){var t=e.split("-").map(e=>`0x${e}`);return r.default.apply(null,t)}function d(e,t,n,r){var s={};if("string"==typeof e){let n=e.match(l);if(n&&(e=n[1],n[2]&&(t=parseInt(n[2],10))),r.aliases.hasOwnProperty(e)&&(e=r.aliases[e]),!r.emojis.hasOwnProperty(e))return null;s=r.emojis[e]}else e.id&&(r.aliases.hasOwnProperty(e.id)&&(e.id=r.aliases[e.id]),r.emojis.hasOwnProperty(e.id)&&(s=r.emojis[e.id],t||(t=e.skin)));if((0,i.default)(s).length||((s=e).custom=!0,s.search||(s.search=(0,o.buildSearch)(e))),s.emoticons||(s.emoticons=[]),s.variations||(s.variations=[]),s.skin_variations&&t>1&&n){s=JSON.parse(a.stringify(s));var c=u[t-1],d=s.skin_variations[c];if(!d.variations&&s.variations&&delete s.variations,null==d[`has_img_${n}`]||d[`has_img_${n}`]){s.skin_tone=t;for(let e in d){let t=d[e];s[e]=t}}}return s.variations&&s.variations.length&&((s=JSON.parse(a.stringify(s))).unified=s.variations.shift()),s}function h(e){return e.reduce((e,t)=>(-1===e.indexOf(t)&&e.push(t),e),[])}t.getData=d,t.getSanitizedData=function(){return function(e){var{name:t,short_names:n,skin_tone:i,skin_variations:o,emoticons:r,unified:s,custom:a,imageUrl:l}=e,u=e.id||n[0],d=`:${u}:`;return a?{id:u,name:t,colons:d,emoticons:r,custom:a,imageUrl:l}:(i&&(d+=`:skin-tone-${i}:`),{id:u,name:t,colons:d,emoticons:r,unified:s.toLowerCase(),skin:i||(o?1:null),native:c(s)})}(d(...arguments))},t.uniq=h,t.intersect=function(e,t){const n=h(e),i=h(t);return n.filter(e=>i.indexOf(e)>=0)},t.deepMerge=function e(t,n){var i={};for(let o in t){let r=t[o],s=r;n.hasOwnProperty(o)&&(s=n[o]),"object"==typeof s&&(s=e(r,s)),i[o]=s}return i},t.unifiedToNative=c,t.measureScrollbar=function(){if("undefined"==typeof document)return 0;const e=document.createElement("div");e.style.width="100px",e.style.height="100px",e.style.overflow="scroll",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);const t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t},t.throttleIdleTask=function(e){const t="function"==typeof requestIdleCallback?requestIdleCallback:setTimeout;let n=!1;return function(){n||(n=!0,t(()=>{n=!1,e()}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=c(n(2)),o=c(n(0)),r=c(n(1)),s=n(3),a=n(5),l=n(10),u=n(11);function c(e){return e&&e.__esModule?e:{default:e}}const d=e=>{var{emoji:t,skin:n,set:i,data:o}=e;return(0,s.getData)(t,n,i,o)},h=e=>{var{sheet_x:t,sheet_y:n}=d(e);return`${100/(e.sheetColumns-1)*t}% ${100/(e.sheetRows-1)*n}%`},f=e=>{var{emoji:t,skin:n,set:i,data:o}=e;return(0,s.getSanitizedData)(t,n,i,o)},m=e=>!isNaN(e-parseFloat(e)),p=e=>{e.data.compressed&&(0,a.uncompress)(e.data);for(let t in p.defaultProps)null==e[t]&&null!=p.defaultProps[t]&&(e[t]=p.defaultProps[t]);let t=d(e);if(!t)return e.fallback?e.fallback(null,e):null;let{unified:n,custom:r,short_names:l,imageUrl:u}=t,c={},g=e.children,v="emoji-mart-emoji",_=n&&(0,s.unifiedToNative)(n),y=[_].concat(l).filter(
18Boolean).join(", "),w=null;if(!n&&!r)return e.fallback?e.fallback(t,e):null;if(e.tooltip&&(w=l[0]),e.native&&n)v+=" emoji-mart-emoji-native",c={fontSize:e.size},g=_,e.forceSize&&(c.display="inline-block",c.width=e.size,c.height=e.size,c.wordBreak="keep-all");else if(r)v+=" emoji-mart-emoji-custom",c={width:e.size,height:e.size,display:"inline-block"},c=t.spriteUrl?(0,i.default)({},c,{backgroundImage:`url(${t.spriteUrl})`,backgroundSize:`${100*e.sheetColumns}% ${100*e.sheetRows}%`,backgroundPosition:h(e)}):(0,i.default)({},c,{backgroundImage:`url(${u})`,backgroundSize:"contain"});else{if(!(null==t[`has_img_${e.set}`]||t[`has_img_${e.set}`]))return e.fallback?e.fallback(t,e):null;c={width:e.size,height:e.size,display:"inline-block",backgroundImage:`url(${e.backgroundImageFn(e.set,e.sheetSize)})`,backgroundSize:`${100*e.sheetColumns}% ${100*e.sheetRows}%`,backgroundPosition:h(e)}}return e.php?`<button style='${c=(e=>{let t=document.createElement("div");for(let n in e){let i=e[n];m(i)&&(i+="px"),t.style[n]=i}return t.getAttribute("style")})(c)}' aria-label='${y}' ${w?`title='${w}'`:""} class='${v}'>${g||""}</button>`:o.default.createElement("button",{onClick:t=>((e,t)=>{if(t.onClick){var{onClick:n}=t;n(f(t),e)}})(t,e),onMouseEnter:t=>((e,t)=>{if(t.onOver){var{onOver:n}=t;n(f(t),e)}})(t,e),onMouseLeave:t=>((e,t)=>{if(t.onLeave){var{onLeave:n}=t;n(f(t),e)}})(t,e),"aria-label":y,title:w,className:v},o.default.createElement("span",{style:c},g))};p.propTypes=(0,i.default)({},l.EmojiPropTypes,{data:r.default.object.isRequired}),p.defaultProps=u.EmojiDefaultProps,t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i={name:"a",unified:"b",non_qualified:"c",has_img_apple:"d",has_img_google:"e",has_img_twitter:"f",has_img_emojione:"g",has_img_facebook:"h",has_img_messenger:"i",keywords:"j",sheet:"k",emoticons:"l",text:"m",short_names:"n",added_in:"o"},o=e=>{const t=[];var n=(e,n)=>{e&&(Array.isArray(e)?e:[e]).forEach(e=>{(n?e.split(/[-|_|\s]+/):[e]).forEach(e=>{e=e.toLowerCase(),-1==t.indexOf(e)&&t.push(e)})})};return n(e.short_names,!0),n(e.name,!0),n(e.keywords,!1),n(e.emoticons,!1),t.join(",")};t.buildSearch=o,t.compress=(e=>{e.short_names=e.short_names.filter(t=>t!==e.short_name),delete e.short_name,e.sheet=[e.sheet_x,e.sheet_y],delete e.sheet_x,delete e.sheet_y,e.added_in=parseInt(e.added_in),6===e.added_in&&delete e.added_in;for(let t in i)e[i[t]]=e[t],delete e[t];for(let t in e){let n=e[t];Array.isArray(n)&&!n.length?delete e[t]:"string"!=typeof n||n.length?null===n&&delete e[t]:delete e[t]}}),t.uncompress=(e=>{e.compressed=!1;for(let t in e.emojis){let n=e.emojis[t];for(let e in i)n[e]=n[i[e]],delete n[i[e]];n.short_names||(n.short_names=[]),n.short_names.unshift(t),n.sheet_x=n.sheet[0],n.sheet_y=n.sheet[1],delete n.sheet,n.text||(n.text=""),n.added_in||(n.added_in=6),n.added_in=n.added_in.toFixed(1),n.search=o(n)}})},function(e,t,n){"use strict";n.r(t),n.d(t,"render",function(){return M}),n.d(t,"hydrate",function(){return A}),n.d(t,"createElement",function(){return f}),n.d(t,"h",function(){return f}),n.d(t,"Fragment",function(){return g}),n.d(t,"createRef",function(){return p}),n.d(t,"Component",function(){return _}),n.d(t,"cloneElement",function(){return F}),n.d(t,"createContext",function(){return N}),n.d(t,"toChildArray",function(){return j}),n.d(t,"options",function(){return i});var i,o,r,s,a,l={},u=[],c=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function d(e,t){for(var n in t)e[n]=t[n];return e}function h(e){var t=e.parentNode;t&&t.removeChild(e)}function f(e,t,n){var i,o,r,s,a=arguments;if(null==t&&(t={}),arguments.length>3)for(n=[n],i=3;i<arguments.length;i++)n.push(a[i]);if(null!=n&&(t.children=n),null!=e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===t[o]&&(t[o]=e.defaultProps[o]);return(r=t.ref)&&delete t.ref,(s=t.key)&&delete t.key,m(e,t,null,s,r)}function m(e,t,n,o,r){var s={type:e,props:t,text:n,key:o,ref:r,__k:null,__e:null,n:null,__c:null};return i.vnode&&i.vnode(s),s}function p(){return{}}function g(){}function v(e){return null==e||"boolean"==typeof e?null:"string"==typeof e||"number"==typeof e?m(null,null,e,null,null):Array.isArray(e)?f(g,null,e):null!=e.__e?m(e.type,e.props,e.text,e.key,null):e}function _(e,t){this.props=e,this.context=t}function y(e){!e.__d&&(e.__d=!0)&&1===o.push(e)&&(i.debounceRendering||r)(w)}function w(){for(var e;e=o.pop();)e.__d&&e.forceUpdate(!1)}function b(e,t,n,i,o,r,s,a){var c,d,f,m,p,_,y,w,b,k,E=t.__k||j(t.props.children,t.__k=[],v),S=null!=n&&n!=l&&n.__k||u,P=S.length,R=P?S[0]&&S[0].__e:null;if(null!=r)for(d=0;d<r.length;d++)if(null!=r[d]){R=r[d];break}for(d=0;d<E.length;d++){if(c=E[d]=v(E[d]),_=p=null,null!=(m=S[d])&&(null==c.key&&null==m.key?c.type===m.type:c.key===m.key))p=d;else for(f=0;f<P;f++)if(null!=(m=S[f])&&(null==c.key&&null==m.key?c.type===m.type:c.key===m.key)){p=f;break}if(null!=p&&(_=S[p],S[p]=null),w=null!=R&&R.nextSibling,y=C(null==_?null:_.__e,e,c,_,i,o,r,s,a,null),null!=c&&null!=y){if(k=document.activeElement,null!=c.n)y=c.n;else if(r==_||y!=R||null==y.parentNode)e:if(null==R||R.parentNode!==e)e.appendChild(y);else{for(b=R,f=0;(b=b.nextSibling)&&f++<P/2;)if(b===y)break e;e.insertBefore(y,R)}k!==document.activeElement&&k.focus(),R=null!=y?y.nextSibling:w}}
18if(null!=r&&t.type!==g)for(d=r.length;d--;)null!=r[d]&&h(r[d]);for(d=P;d--;)null!=S[d]&&x(S[d],a)}function j(e,t,n){if(null==t&&(t=[]),null==e||"boolean"==typeof e);else if(Array.isArray(e))for(var i=0;i<e.length;i++)j(e[i],t);else t.push(n?n(e):e);return t}function k(e,t,n,i,o){var r,a,l,u,d,h;if("class"!==t&&"className"!==t||(t=o?"class":"className"),"style"===t)if(a=e.style,"string"==typeof n)a.cssText=n;else{for(l in"string"==typeof i&&(a.cssText=""),i)null!=n&&l in n||a.setProperty(l.replace(s,"-"),"");for(u in n)r=n[u],null!=i&&r===i[u]||a.setProperty(u.replace(s,"-"),"number"==typeof r&&!1===c.test(u)?r+"px":r)}else{if("dangerouslySetInnerHTML"===t)return;"o"===t[0]&&"n"===t[1]?(d=t!==(t=t.replace(/Capture$/,"")),h=t.toLowerCase(),t=(h in e?h:t).substring(2),n?i||e.addEventListener(t,E,d):e.removeEventListener(t,E,d),(e.l||(e.l={}))[t]=n):"list"!==t&&!o&&t in e?e[t]=null==n?"":n:null==n||!1===n?e.removeAttribute(t):"function"!=typeof n&&e.setAttribute(t,n)}}function E(e){return this.l[e.type](i.event?i.event(e):e)}function C(e,t,n,o,r,s,a,u,c,h){var f,m,p,y,w,j,k,E,S,M,A,F,N,z;if(null==o||null==n||o.type!==n.type){if(null!=o&&x(o,c),null==n)return null;e=null,o=l}i.diff&&i.diff(n),p=!1,k=n.type;try{e:if(o.type===g||k===g)b(t,n,o,r,s,a,u,f),n.__k.length&&(e=n.__k[0].__e,n.n=n.__k[n.__k.length-1].__e);else if("function"==typeof k){if(M=(S=k.contextType)&&r[S.__c],A=null!=S?M?M.props.value:S.__p:r,o.__c?E=(f=n.__c=o.__c).__p:(p=!0,k.prototype&&k.prototype.render?n.__c=f=new k(n.props,A):(n.__c=f=new _(n.props,A),f.constructor=k,f.render=O),f.__a=c,M&&M.sub(f),f.props=n.props,f.state||(f.state={}),f.context=A,f.__n=r,f.__d=!0,f.__h=[]),f.__v=n,F=f.__s||f.state,null!=k.getDerivedStateFromProps&&(w=d({},f.state),F===f.state&&(F=d({},F)),d(F,k.getDerivedStateFromProps(n.props,F))),p)null==k.getDerivedStateFromProps&&null!=f.componentWillMount&&f.componentWillMount(),null!=f.componentDidMount&&u.push(f);else{if(null==k.getDerivedStateFromProps&&null==h&&null!=f.componentWillReceiveProps&&(f.componentWillReceiveProps(n.props,A),F=f.__s||f.state),!h&&null!=f.shouldComponentUpdate&&!1===f.shouldComponentUpdate(n.props,F,A)){f.props=n.props,f.state=F,f.__d=!1;break e}null!=f.componentWillUpdate&&f.componentWillUpdate(n.props,F,A)}y=f.props,w||(w=f.state),j=f.context=A,f.props=n.props,f.state=F,i.render&&i.render(n),N=f.__t,z=f.__t=v(f.render(f.props,f.state,f.context)),f.__d=!1,null!=f.getChildContext&&(r=d(d({},r),f.getChildContext())),p||null==f.getSnapshotBeforeUpdate||(j=f.getSnapshotBeforeUpdate(y,w)),f.base=e=C(e,t,z,N,r,s,a,u,f,null),null!=z&&(n.n=z.n),f.__P=t,n.ref&&R(n.ref,f,c)}else e=P(e,n,o,r,s,a,u,c),n.ref&&o.ref!==n.ref&&R(n.ref,e,c);if(n.__e=e,null!=f){for(;m=f.__h.pop();)m.call(f);p||null==y||null==f.componentDidUpdate||f.componentDidUpdate(y,w,j)}E&&(f.__p=null),i.diffed&&i.diffed(n)}catch(e){T(e,c)}return e}function S(e,t){for(var n;n=e.pop();)try{n.componentDidMount()}catch(e){T(e,n.__a)}i.commit&&i.commit(t)}function P(e,t,n,i,o,r,s,a){var l,c,d,h,f,m,p=e;if(o="svg"===t.type||o,null==e&&null!=r)for(l=0;l<r.length;l++)if(null!=(c=r[l])&&(null===t.type?3===c.nodeType:c.localName===t.type)){e=c,r[l]=null;break}if(null==e&&(e=null===t.type?document.createTextNode(t.text):o?document.createElementNS("http://www.w3.org/2000/svg",t.type):document.createElement(t.type),r=null),t.__e=e,null===t.type)null!==p&&e!==p||t.text===n.text||(e.data=t.text);else if(null!=r&&null!=e.childNodes&&(r=u.slice.call(e.childNodes)),t!==n){if(null==(d=n.props)&&(d={},null!=r))for(h=0;h<e.attributes.length;h++)d[e.attributes[h].name]=e.attributes[h].value;f=d.dangerouslySetInnerHTML,((m=t.props.dangerouslySetInnerHTML)||f)&&(m&&f&&m.__html==f.__html||(e.innerHTML=m&&m.__html||"")),t.props.multiple&&(e.multiple=t.props.multiple),b(e,t,n,i,"foreignObject"!==t.type&&o,r,s,a),function(e,t,n,i){var o,r;for(o in t)"children"===o||"key"===o||n&&n[o]==t[o]||k(e,o,t[o],n[o],i);for(r in n)"children"===r||"key"===r||t&&r in t||k(e,r,null,n[r],i)}(e,t.props,d,o)}return e}function R(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){T(e,n)}}function x(e,t,n){var o,r;if(i.unmount&&i.unmount(e),(o=e.ref)&&R(o,null,t),!n&&null==e.n&&(n=null!=(o=e.__e))&&h(o),e.__e=e.n=null,null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){T(e,t)}o.base=o.__P=null,(o=o.__t)&&x(o,t,n)}else if(o=e.__k)for(r=0;r<o.length;r++)x(o[r],t,n)}function O(e,t,n){return this.constructor(e,n)}function T(e,t){for(;t;t=t.__a)if(!t.__p)try{if(null!=t.constructor.getDerivedStateFromError)t.setState(t.constructor.getDerivedStateFromError(e));else{if(null==t.componentDidCatch)continue;t.componentDidCatch(e)}return y(t.__p=t)}catch(t){e=t}throw e}function M(e,t){var n,i=t.__t;e=f(g,null,[e]),n=[],b(t,t.__t=e,i,l,void 0!==t.ownerSVGElement,i?null:u.slice.call(t.childNodes),n,e),S(n,e)}function A(e,t){t.__t=null,M(e,t)}function F(e,t){return t=d(d({},e.props),t),arguments.length>2&&(t.children=u.slice.call(arguments,2)),m(e.type,t,null,t.key||e.key,t.ref||e.ref)}function N(e){var t,n="__cC"+a++,i={__c:n,__p:e};function o(e,t){return e.children(t)}return o.contextType=i,i.Consumer=o,(t={})[n]=null,i.Provider=function(e){var i,o;return this.getChildContext||(o=[],(i=this).getChildContext=function(){return t[n]=i,t},i.componentDidUpdate=function(){var e=i.props.value;o.map(function(t){return e!==t.context&&(t.context=e,y(t))})},i.sub=function(e){o.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){o.splice(o.indexOf(e),1),t&&t()}}),e.children},i}i={},_.prototype.setState=function(e,t){var n=this.__s!==this.state&&this.__s||(this.__s=d({},this.state));("function"!=typeof e||(e=e(n,this.props)))&&d(n,e),null!=e&&(t&&this.__h.push(t),y(this))},_.prototype.forceUpdate=function(e){var t,n=this.__v,i=this.__v.__e,o=this.__P;o&&(null!=(i=C(i,o,n,n,this.__n,void 0!==o.ownerSVGElement,null,t=[],this.__a,!1!==e))&&i.parentNode!==o&&o.appendChild(i),S(t,n)),e&&e()},_.prototype.render=g,o=[],r="function"==typeof Promise?Promise.prototype.then.bind(Prom
18ise.resolve()):setTimeout,s=/-?(?=[A-Z])/g,a=0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.search=t.categories=void 0;var i,o=n(0),r=(i=o)&&i.__esModule?i:{default:i};const s={activity:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M12 0C5.373 0 0 5.372 0 12c0 6.627 5.373 12 12 12 6.628 0 12-5.373 12-12 0-6.628-5.372-12-12-12m9.949 11H17.05c.224-2.527 1.232-4.773 1.968-6.113A9.966 9.966 0 0 1 21.949 11M13 11V2.051a9.945 9.945 0 0 1 4.432 1.564c-.858 1.491-2.156 4.22-2.392 7.385H13zm-2 0H8.961c-.238-3.165-1.536-5.894-2.393-7.385A9.95 9.95 0 0 1 11 2.051V11zm0 2v8.949a9.937 9.937 0 0 1-4.432-1.564c.857-1.492 2.155-4.221 2.393-7.385H11zm4.04 0c.236 3.164 1.534 5.893 2.392 7.385A9.92 9.92 0 0 1 13 21.949V13h2.04zM4.982 4.887C5.718 6.227 6.726 8.473 6.951 11h-4.9a9.977 9.977 0 0 1 2.931-6.113M2.051 13h4.9c-.226 2.527-1.233 4.771-1.969 6.113A9.972 9.972 0 0 1 2.051 13m16.967 6.113c-.735-1.342-1.744-3.586-1.968-6.113h4.899a9.961 9.961 0 0 1-2.931 6.113"})),custom:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("g",{transform:"translate(2.000000, 1.000000)"},r.default.createElement("rect",{id:"Rectangle",x:"8",y:"0",width:"3",height:"21",rx:"1.5"}),r.default.createElement("rect",{id:"Rectangle",transform:"translate(9.843, 10.549) rotate(60) translate(-9.843, -10.549) ",x:"8.343",y:"0.049",width:"3",height:"21",rx:"1.5"}),r.default.createElement("rect",{id:"Rectangle",transform:"translate(9.843, 10.549) rotate(-60) translate(-9.843, -10.549) ",x:"8.343",y:"0.049",width:"3",height:"21",rx:"1.5"}))),flags:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M0 0l6.084 24H8L1.916 0zM21 5h-4l-1-4H4l3 12h3l1 4h13L21 5zM6.563 3h7.875l2 8H8.563l-2-8zm8.832 10l-2.856 1.904L12.063 13h3.332zM19 13l-1.5-6h1.938l2 8H16l3-2z"})),foods:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M17 4.978c-1.838 0-2.876.396-3.68.934.513-1.172 1.768-2.934 4.68-2.934a1 1 0 0 0 0-2c-2.921 0-4.629 1.365-5.547 2.512-.064.078-.119.162-.18.244C11.73 1.838 10.798.023 9.207.023 8.579.022 7.85.306 7 .978 5.027 2.54 5.329 3.902 6.492 4.999 3.609 5.222 0 7.352 0 12.969c0 4.582 4.961 11.009 9 11.009 1.975 0 2.371-.486 3-1 .629.514 1.025 1 3 1 4.039 0 9-6.418 9-11 0-5.953-4.055-8-7-8M8.242 2.546c.641-.508.943-.523.965-.523.426.169.975 1.405 1.357 3.055-1.527-.629-2.741-1.352-2.98-1.846.059-.112.241-.356.658-.686M15 21.978c-1.08 0-1.21-.109-1.559-.402l-.176-.146c-.367-.302-.816-.452-1.266-.452s-.898.15-1.266.452l-.176.146c-.347.292-.477.402-1.557.402-2.813 0-7-5.389-7-9.009 0-5.823 4.488-5.991 5-5.991 1.939 0 2.484.471 3.387 1.251l.323.276a1.995 1.995 0 0 0 2.58 0l.323-.276c.902-.78 1.447-1.251 3.387-1.251.512 0 5 .168 5 6 0 3.617-4.187 9-7 9"})),nature:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M15.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 15.5 8M8.5 8a1.5 1.5 0 1 0 .001 3.001A1.5 1.5 0 0 0 8.5 8"}),r.default.createElement("path",{d:"M18.933 0h-.027c-.97 0-2.138.787-3.018 1.497-1.274-.374-2.612-.51-3.887-.51-1.285 0-2.616.133-3.874.517C7.245.79 6.069 0 5.093 0h-.027C3.352 0 .07 2.67.002 7.026c-.039 2.479.276 4.238 1.04 5.013.254.258.882.677 1.295.882.191 3.177.922 5.238 2.536 6.38.897.637 2.187.949 3.2 1.102C8.04 20.6 8 20.795 8 21c0 1.773 2.35 3 4 3 1.648 0 4-1.227 4-3 0-.201-.038-.393-.072-.586 2.573-.385 5.435-1.87
187 5.925-7.587.396-.22.887-.568 1.104-.788.763-.774 1.079-2.534 1.04-5.013C23.929 2.67 20.646 0 18.933 0M3.223 9.135c-.237.281-.837 1.155-.884 1.238-.15-.41-.368-1.349-.337-3.291.051-3.281 2.478-4.972 3.091-5.031.256.015.731.27 1.265.646-1.11 1.171-2.275 2.915-2.352 5.125-.133.546-.398.858-.783 1.313M12 22c-.901 0-1.954-.693-2-1 0-.654.475-1.236 1-1.602V20a1 1 0 1 0 2 0v-.602c.524.365 1 .947 1 1.602-.046.307-1.099 1-2 1m3-3.48v.02a4.752 4.752 0 0 0-1.262-1.02c1.092-.516 2.239-1.334 2.239-2.217 0-1.842-1.781-2.195-3.977-2.195-2.196 0-3.978.354-3.978 2.195 0 .883 1.148 1.701 2.238 2.217A4.8 4.8 0 0 0 9 18.539v-.025c-1-.076-2.182-.281-2.973-.842-1.301-.92-1.838-3.045-1.853-6.478l.023-.041c.496-.826 1.49-1.45 1.804-3.102 0-2.047 1.357-3.631 2.362-4.522C9.37 3.178 10.555 3 11.948 3c1.447 0 2.685.192 3.733.57 1 .9 2.316 2.465 2.316 4.48.313 1.651 1.307 2.275 1.803 3.102.035.058.068.117.102.178-.059 5.967-1.949 7.01-4.902 7.19m6.628-8.202c-.037-.065-.074-.13-.113-.195a7.587 7.587 0 0 0-.739-.987c-.385-.455-.648-.768-.782-1.313-.076-2.209-1.241-3.954-2.353-5.124.531-.376 1.004-.63 1.261-.647.636.071 3.044 1.764 3.096 5.031.027 1.81-.347 3.218-.37 3.235"})),objects:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M12 0a9 9 0 0 0-5 16.482V21s2.035 3 5 3 5-3 5-3v-4.518A9 9 0 0 0 12 0zm0 2c3.86 0 7 3.141 7 7s-3.14 7-7 7-7-3.141-7-7 3.14-7 7-7zM9 17.477c.94.332 1.946.523 3 .523s2.06-.19 3-.523v.834c-.91.436-1.925.689-3 .689a6.924 6.924 0 0 1-3-.69v-.833zm.236 3.07A8.854 8.854 0 0 0 12 21c.965 0 1.888-.167 2.758-.451C14.155 21.173 13.153 22 12 22c-1.102 0-2.117-.789-2.764-1.453z"}),r.default.createElement("path",{d:"M14.745 12.449h-.004c-.852-.024-1.188-.858-1.577-1.824-.421-1.061-.703-1.561-1.182-1.566h-.009c-.481 0-.783.497-1.235 1.537-.436.982-.801 1.811-1.636 1.791l-.276-.043c-.565-.171-.853-.691-1.284-1.794-.125-.313-.202-.632-.27-.913-.051-.213-.127-.53-.195-.634C7.067 9.004 7.039 9 6.99 9A1 1 0 0 1 7 7h.01c1.662.017 2.015 1.373 2.198 2.134.486-.981 1.304-2.058 2.797-2.075 1.531.018 2.28 1.153 2.731 2.141l.002-.008C14.944 8.424 15.327 7 16.979 7h.032A1 1 0 1 1 17 9h-.011c-.149.076-.256.474-.319.709a6.484 6.484 0 0 1-.311.951c-.429.973-.79 1.789-1.614 1.789"})),people:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"}),r.default.createElement("path",{d:"M8 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 8 7M16 7a2 2 0 1 0-.001 3.999A2 2 0 0 0 16 7M15.232 15c-.693 1.195-1.87 2-3.349 2-1.477 0-2.655-.805-3.347-2H15m3-2H6a6 6 0 1 0 12 0"})),places:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M6.5 12C5.122 12 4 13.121 4 14.5S5.122 17 6.5 17 9 15.879 9 14.5 7.878 12 6.5 12m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5M17.5 12c-1.378 0-2.5 1.121-2.5 2.5s1.122 2.5 2.5 2.5 2.5-1.121 2.5-2.5-1.122-2.5-2.5-2.5m0 3c-.275 0-.5-.225-.5-.5s.225-.5.5-.5.5.225.5.5-.225.5-.5.5"}),r.default.createElement("path",{d:"M22.482 9.494l-1.039-.346L21.4 9h.6c.552 0 1-.439 1-.992 0-.006-.003-.008-.003-.008H23c0-1-.889-2-1.984-2h-.642l-.731-1.717C19.262 3.012 18.091 2 16.764 2H7.236C5.909 2 4.738 3.012 4.357 4.283L3.626 6h-.642C1.889 6 1 7 1 8h.003S1 8.002 1 8.008C1 8.561 1.448 9 2 9h.6l-.043.148-1.039.346a2.001 2.001 0 0 0-1.359 2.097l.751 7.508a1 1 0 0 0 .994.901H3v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h6v1c0 1.103.896 2 2 2h2c1.104 0 2-.897 2-2v-1h1.096a.999.999 0 0 0 .994-.901l.751-7.508a2.001 2.001 0 0 0-1.359-2.097M6.273 4.857C6.402 4.43 6.788 4 7.236 4h9.527c.448 0 .834.43.963.857L19.313 9H4.688l1.585-4.143zM7 21H5v-1h2v1zm12 0h-2v-1h2v1zm2.189-3H2.811l-.662-6.607L3 11h18l.852.393L21.189 18z"})),recent:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"},r.default.createElement("path",{d:"M13 4h-2l-.001 7H9v2h2v2h2v-2h4v-2h-4z"}),r.default.createElement("path",{d:"M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12 12-5.373 12-12S18.627 0 12 0m0 22C6.486 22 2 17.514 2 12S6.486 2 12 2s10 4.486 10 10-4.486 10-10 10"})),symbols:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",width:"24",height:"24"}
18,r.default.createElement("path",{d:"M0 0h11v2H0zM4 11h3V6h4V4H0v2h4zM15.5 17c1.381 0 2.5-1.116 2.5-2.493s-1.119-2.493-2.5-2.493S13 13.13 13 14.507 14.119 17 15.5 17m0-2.986c.276 0 .5.222.5.493 0 .272-.224.493-.5.493s-.5-.221-.5-.493.224-.493.5-.493M21.5 19.014c-1.381 0-2.5 1.116-2.5 2.493S20.119 24 21.5 24s2.5-1.116 2.5-2.493-1.119-2.493-2.5-2.493m0 2.986a.497.497 0 0 1-.5-.493c0-.271.224-.493.5-.493s.5.222.5.493a.497.497 0 0 1-.5.493M22 13l-9 9 1.513 1.5 8.99-9.009zM17 11c2.209 0 4-1.119 4-2.5V2s.985-.161 1.498.949C23.01 4.055 23 6 23 6s1-1.119 1-3.135C24-.02 21 0 21 0h-2v6.347A5.853 5.853 0 0 0 17 6c-2.209 0-4 1.119-4 2.5s1.791 2.5 4 2.5M10.297 20.482l-1.475-1.585a47.54 47.54 0 0 1-1.442 1.129c-.307-.288-.989-1.016-2.045-2.183.902-.836 1.479-1.466 1.729-1.892s.376-.871.376-1.336c0-.592-.273-1.178-.818-1.759-.546-.581-1.329-.871-2.349-.871-1.008 0-1.79.293-2.344.879-.556.587-.832 1.181-.832 1.784 0 .813.419 1.748 1.256 2.805-.847.614-1.444 1.208-1.794 1.784a3.465 3.465 0 0 0-.523 1.833c0 .857.308 1.56.924 2.107.616.549 1.423.823 2.42.823 1.173 0 2.444-.379 3.813-1.137L8.235 24h2.819l-2.09-2.383 1.333-1.135zm-6.736-6.389a1.02 1.02 0 0 1 .73-.286c.31 0 .559.085.747.254a.849.849 0 0 1 .283.659c0 .518-.419 1.112-1.257 1.784-.536-.651-.805-1.231-.805-1.742a.901.901 0 0 1 .302-.669M3.74 22c-.427 0-.778-.116-1.057-.349-.279-.232-.418-.487-.418-.766 0-.594.509-1.288 1.527-2.083.968 1.134 1.717 1.946 2.248 2.438-.921.507-1.686.76-2.3.76"}))},a={search:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 20 20",opacity:"0.5"},r.default.createElement("path",{d:"M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"})),delete:()=>r.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"13",height:"13",viewBox:"0 0 20 20",opacity:"0.5"},r.default.createElement("path",{d:"M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z"}))};t.categories=s,t.search=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i="emoji-mart";const o=JSON;var r="undefined"!=typeof window&&"localStorage"in window;let s,a;function l(e,t){if(a)a(e,t);else{if(!r)return;try{window.localStorage[`${i}.${e}`]=o.stringify(t)}catch(e){}}}t.default={update:function(e){for(let t in e)l(t,e[t])},set:l,get:function(e){if(s)return s(e);if(r){try{var t=window.localStorage[`${i}.${e}`]}catch(e){return}return t?JSON.parse(t):void 0}},setNamespace:function(e){i=e},setHandlers:function(e){e||(e={}),s=e.getter,a=e.setter}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i,o=n(8),r=(i=o)&&i.__esModule?i:{default:i};const s=["+1","grinning","kissing_heart","heart_eyes","laughing","stuck_out_tongue_winking_eye","sweat_smile","joy","scream","disappointed","unamused","weary","sob","sunglasses","heart","poop"];let a,l,u={};function c(){l=!0,a=r.default.get("frequently")}t.default={add:function(e){l||c();var{id:t}=e;a||(a=u),a[t]||(a[t]=0),a[t]+=1,r.default.set("last",t),r.default.set("frequently",a)},get:function(e){if(l||c(),!a){u={};const t=[];for(let n=0;n<e;n++)u[s[n]]=e-n,t.push(s[n]);return t}const t=4*e,n=[];for(let e in a)a.hasOwnProperty(e)&&n.push(e);const i=n.sort((e,t)=>a[e]-a[t]).reverse().slice(0,t),o=r.default.get("last");return o&&-1==i.indexOf(o)&&(i.pop(),i.push(o)),i}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PickerPropTypes=t.EmojiPropTypes=void 0;var i,o=n(1),r=(i=o)&&i.__esModule?i:{default:i};const s={data:r.default.object.isRequired,onOver:r.default.func,onLeave:r.default.func,onClick:r.default.func,fallback:r.default.func,backgroundImageFn:r.default.func,native:r.default.bool,forceSize:r.default.bool,tooltip:r.default.bool,skin:r.default.oneOf([1,2,3,4,5,6]),sheetSize:r.default.oneOf([16,20,32,64]),sheetColumns:r.default.number,sheetRows:r.default.number,set:r.default.oneOf(["apple","google","twitter","emojione","messenger","facebook"]),size:r.default.number.isRequired,emoji:r.default.oneOfType([r.default.string,r.default.object]).isRequired},a={onClick:r.default.func,onSelect:r.default.func,onSkinChange:r.default.func,perLine:r.default.number,emojiSize:r.default.number,i18n:r.default.object,style:r.default.object,title:r.default.string,emoji:r.default.string,color:r.default.string,set:s.set,skin:s.skin,native:r.default.bool,backgroundImageFn:s.backgroundImageFn,sheetSize:s.sheetSize,emojisToShowFilter:r.default.func,showPreview:r.default.bool,showSkinTones:r.default.bool,emojiTooltip:s.tooltip,include:r.default.arrayOf(r.default.string),exclude:r.default.arrayOf(r.default.string),recent:r.default.arrayOf(r.default.string),autoFocus:r.default.bool,custom:r.default.arrayOf(r.default.shape({name:r.default.string.isRequired,short_names:r.default.arrayOf(r.default.string).isRequired,emoticons:r.default.arrayOf(r.default.string),keywords:r.default.arrayOf(r.default.string),imageUrl:r.default.string.isRequired})),skinEmoji:r.default.string,notFound:r.default.func,notFoundEmoji:r.default.string,icons:r.default.object};t.EmojiPropTypes=s,t.PickerPropTypes=a},function(e,t,n){"use strict";
18Object.defineProperty(t,"__esModule",{value:!0});const i={skin:1,set:"apple",sheetSize:64,sheetColumns:52,sheetRows:52,native:!1,forceSize:!1,tooltip:!1,backgroundImageFn:(e,t)=>`https://unpkg.com/emoji-datasource-${e}@4.0.4/img/${e}/sheets-256/${t}.png`,onOver:()=>{},onLeave:()=>{},onClick:()=>{}},o={onClick:()=>{},onSelect:()=>{},onSkinChange:()=>{},emojiSize:24,perLine:9,i18n:{},style:{},title:"Emoji Martâ¢",emoji:"department_store",color:"#ae65c5",set:i.set,skin:null,defaultSkin:i.skin,native:i.native,sheetSize:i.sheetSize,backgroundImageFn:i.backgroundImageFn,emojisToShowFilter:null,showPreview:!0,showSkinTones:!0,emojiTooltip:i.tooltip,autoFocus:!1,custom:[],skinEmoji:"",notFound:()=>{},notFoundEmoji:"sleuth_or_spy",icons:{}};t.PickerDefaultProps=o,t.EmojiDefaultProps=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(0)),o=r(n(1));r(n(4));function r(e){return e&&e.__esModule?e:{default:e}}class s extends i.default.PureComponent{constructor(e){super(e),this.state={opened:!1}}handleClick(e){var t=parseInt(e.currentTarget.getAttribute("data-skin")),{onChange:n}=this.props;this.state.opened?(this.setState({opened:!1}),t!=this.props.skin&&n(t)):this.setState({opened:!0})}render(){return null}}t.default=s,s.propTypes={onChange:o.default.func,skin:o.default.number.isRequired},s.defaultProps={onChange:()=>{}}},function(e,t,n){const i=n(14).default,o=n(0),{define:r}=n(29);(async function(){const e=await(await fetch("https://cdn.jsdelivr.net/npm/[email protected]/data/facebook.json")).json();r({"emoji-picker":t=>o.createElement(i,{set:"twitter",data:e,native:!0,onSelect:e=>emojiSeleted(e),title:"Emoji",showPreview:!0,...t})});const t=document.createElement("emoji-picker");document.body.appendChild(t)})().catch(e=>console.error(e))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=v(n(2));n(15);var o=v(n(0)),r=v(n(1)),s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(7)),a=v(n(8)),l=v(n(9)),u=n(3),c=n(5),d=n(10),h=v(n(21)),f=v(n(22)),m=v(n(24)),p=v(n(27)),g=n(11);function v(e){return e&&e.__esModule?e:{default:e}}const _={search:"Search",clear:"Clear",notfound:"No Emoji Found",skintext:"Choose your default skin tone",categories:{search:"Search Results",recent:"Frequently Used",people:"Smileys & People",nature:"Animals & Nature",foods:"Food & Drink",activity:"Activity",places:"Travel & Places",objects:"Objects",symbols:"Symbols",flags:"Flags",custom:"Custom"},categorieslabel:"Emoji categories",skintones:{1:"Default Skin Tone",2:"Light Skin Tone",3:"Medium-Light Skin Tone",4:"Medium Skin Tone",5:"Medium-Dark Skin Tone",6:"Dark Skin Tone"}};class y extends o.default.PureComponent{constructor(e){super(e),this.RECENT_CATEGORY={id:"recent",name:"Recent",emojis:null},this.CUSTOM_CATEGORY={id:"custom",name:"Custom",emojis:[]},this.SEARCH_CATEGORY={id:"search",name:"Search",emojis:null,anchor:!1},e.data.compressed&&(0,c.uncompress)(e.data),this.data=e.data,this.i18n=(0,u.deepMerge)(_,e.i18n),this.icons=(0,u.deepMerge)(s,e.icons),this.state={skin:e.skin||a.default.get("skin")||e.defaultSkin,firstRender:!0},this.categories=[];let t=[].concat(this.data.categories);e.custom.length>0&&(this.CUSTOM_CATEGORY.emojis=e.custom.map(e=>(0,i.default)({},e,{id:e.short_names[0],custom:!0})),t.push(this.CUSTOM_CATEGORY)),this.hideRecent=!0,null!=e.include&&t.sort((t,n)=>e.include.indexOf(t.id)>e.include.indexOf(n.id)?1:-1);for(let n=0;n<t.length;n++){const i=t[n];let o=!e.include||!e.include.length||e.include.indexOf(i.id)>-1,r=!(!e.exclude||!e.exclude.length)&&e.exclude.indexOf(i.id)>-1;if(o&&!r)if(e.emojisToShowFilter){let t=[];const{emojis:n}=i;for(let i=0;i<n.length;i++){const o=n[i];e.emojisToShowFilter(this.data.emojis[o]||o)&&t.push(o)}if(t.length){let e={emojis:t,name:i.name,id:i.id};this.categories.push(e)}}else this.categories.push(i)}let n=!e.include||!e.include.length||e.include.indexOf(this.RECENT_CATEGORY.id)>-1,o=!(!e.exclude||!e.exclude.length)&&e.exclude.indexOf(this.RECENT_CATEGORY.id)>-1;n&&!o&&(this.hideRecent=!1,this.categories.unshift(this.RECENT_CATEGORY)),this.categories[0]&&(this.categories[0].first=!0),this.categories.unshift(this.SEARCH_CATEGORY),this.setAnchorsRef=this.setAnchorsRef.bind(this),this.handleAnchorClick=this.handleAnchorClick.bind(this),this.setSearchRef=this.setSearchRef.bind(this),this.handleSearch=this.handleSearch.bind(this),this.setScrollRef=this.setScrollRef.bind(this),this.handleScroll=this.handleScroll.bind(this),this.handleScrollPaint=this.handleScrollPaint.bind(this),this.handleEmojiOver=this.handleEmojiOver.bind(this),this.handleEmojiLeave=this.handleEmojiLeave.bind(this),this.handleEmojiClick=this.handleEmojiClick.bind(this),this.handleEmojiSelect=this.handleEmojiSelect.bind(this),this.setPreviewRef=this.setPreviewRef.bind(this),this.handleSkinChange=this.handleSkinChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentWillReceiveProps(e){e.skin?this.setState({skin:e.skin}):e.defaultSkin&&!a.default.get("skin")&&this.setState({skin:e.defaultSkin})}
18componentDidMount(){this.state.firstRender&&(this.testStickyPosition(),this.firstRenderTimeout=setTimeout(()=>{this.setState({firstRender:!1})},60))}componentDidUpdate(){this.updateCategoriesSize(),this.handleScroll()}componentWillUnmount(){this.SEARCH_CATEGORY.emojis=null,clearTimeout(this.leaveTimeout),clearTimeout(this.firstRenderTimeout)}testStickyPosition(){const e=document.createElement("div");["","-webkit-","-ms-","-moz-","-o-"].forEach(t=>e.style.position=`${t}sticky`),this.hasStickyPosition=!!e.style.position.length}handleEmojiOver(e){var{preview:t}=this;if(!t)return;const n=this.CUSTOM_CATEGORY.emojis.filter(t=>t.id===e.id)[0];for(let t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);t.setState({emoji:e}),clearTimeout(this.leaveTimeout)}handleEmojiLeave(e){var{preview:t}=this;t&&(this.leaveTimeout=setTimeout(()=>{t.setState({emoji:null})},16))}handleEmojiClick(e,t){this.props.onClick(e,t),this.handleEmojiSelect(e)}handleEmojiSelect(e){this.props.onSelect(e),this.hideRecent||this.props.recent||l.default.add(e);var t=this.categoryRefs["category-1"];if(t){let e=t.maxMargin;t.forceUpdate(),window.requestAnimationFrame(()=>{this.scroll&&(t.memoizeSize(),e!=t.maxMargin&&(this.updateCategoriesSize(),this.handleScrollPaint(),this.SEARCH_CATEGORY.emojis&&t.updateDisplay("none")))})}}handleScroll(){this.waitingForPaint||(this.waitingForPaint=!0,window.requestAnimationFrame(this.handleScrollPaint))}handleScrollPaint(){if(this.waitingForPaint=!1,!this.scroll)return;let e=null;if(this.SEARCH_CATEGORY.emojis)e=this.SEARCH_CATEGORY;else{var t=this.scroll.scrollTop,n=t>(this.scrollTop||0),i=0;for(let o=0,r=this.categories.length;o<r;o++){let r=n?this.categories.length-1-o:o,s=this.categories[r],a=this.categoryRefs[`category-${r}`];if(a){let n=a.handleScroll(t);(!i||a.top<i)&&a.top>0&&(i=a.top),n&&!e&&(e=s)}}t<i?e=this.categories.filter(e=>!(!1===e.anchor))[0]:t+this.clientHeight>=this.scrollHeight&&(e=this.categories[this.categories.length-1])}if(e){let{anchors:t}=this,{name:n}=e;t.state.selected!=n&&t.setState({selected:n})}this.scrollTop=t}handleSearch(e){this.SEARCH_CATEGORY.emojis=e;for(let t=0,n=this.categories.length;t<n;t++){let n=this.categoryRefs[`category-${t}`];if(n&&"Search"!=n.props.name){let t=e?"none":"inherit";n.updateDisplay(t)}}this.forceUpdate(),this.scroll.scrollTop=0,this.handleScroll()}handleAnchorClick(e,t){var n,i=this.categoryRefs[`category-${t}`],{scroll:o,anchors:r}=this;n=(()=>{if(i){let{top:t}=i;e.first?t=0:t+=1,o.scrollTop=t}}),this.SEARCH_CATEGORY.emojis?(this.handleSearch(null),this.search.clear(),window.requestAnimationFrame(n)):n()}handleSkinChange(e){var t={skin:e},{onSkinChange:n}=this.props;this.setState(t),a.default.update(t),n(e)}handleKeyDown(e){let t=!1;switch(e.keyCode){case 13:let n;this.SEARCH_CATEGORY.emojis&&this.SEARCH_CATEGORY.emojis.length&&(n=(0,u.getSanitizedData)(this.SEARCH_CATEGORY.emojis[0],this.state.skin,this.props.set,this.props.data))&&this.handleEmojiSelect(n),t=!0}t&&e.preventDefault()}updateCategoriesSize(){for(let e=0,t=this.categories.length;e<t;e++){let t=this.categoryRefs[`category-${e}`];t&&t.memoizeSize()}if(this.scroll){let e=this.scroll;this.scrollHeight=e.scrollHeight,this.clientHeight=e.clientHeight}}
18getCategories(){return this.state.firstRender?this.categories.slice(0,3):this.categories}setAnchorsRef(e){this.anchors=e}setSearchRef(e){this.search=e}setPreviewRef(e){this.preview=e}setScrollRef(e){this.scroll=e}setCategoryRef(e,t){this.categoryRefs||(this.categoryRefs={}),this.categoryRefs[e]=t}render(){var{perLine:e,emojiSize:t,set:n,sheetSize:r,sheetColumns:s,sheetRows:a,style:l,title:c,emoji:d,color:g,native:v,backgroundImageFn:_,emojisToShowFilter:y,showPreview:w,showSkinTones:b,emojiTooltip:j,include:k,exclude:E,recent:C,autoFocus:S,skinEmoji:P,notFound:R,notFoundEmoji:x}=this.props,{skin:O}=this.state,T=e*(t+12)+12+2+(0,u.measureScrollbar)();return o.default.createElement("section",{style:(0,i.default)({width:T},l),className:"emoji-mart kkk","aria-label":c,onKeyDown:this.handleKeyDown},o.default.createElement("div",{className:"emoji-mart-bar"},o.default.createElement(h.default,{ref:this.setAnchorsRef,data:this.data,i18n:this.i18n,color:g,categories:this.categories,onAnchorClick:this.handleAnchorClick,icons:this.icons})),o.default.createElement(p.default,{ref:this.setSearchRef,onSearch:this.handleSearch,data:this.data,i18n:this.i18n,emojisToShowFilter:y,include:k,exclude:E,custom:this.CUSTOM_CATEGORY.emojis,autoFocus:S}),o.default.createElement("div",{ref:this.setScrollRef,className:"emoji-mart-scroll",onScroll:this.handleScroll},this.getCategories().map((i,l)=>o.default.createElement(f.default,{ref:this.setCategoryRef.bind(this,`category-${l}`),key:i.name,id:i.id,name:i.name,emojis:i.emojis,perLine:e,native:v,hasStickyPosition:this.hasStickyPosition,data:this.data,i18n:this.i18n,recent:i.id==this.RECENT_CATEGORY.id?C:void 0,custom:i.id==this.RECENT_CATEGORY.id?this.CUSTOM_CATEGORY.emojis:void 0,emojiProps:{native:v,skin:O,size:t,set:n,sheetSize:r,sheetColumns:s,sheetRows:a,forceSize:v,tooltip:j,backgroundImageFn:_,onOver:this.handleEmojiOver,onLeave:this.handleEmojiLeave,onClick:this.handleEmojiClick},notFound:R,notFoundEmoji:x}))),(w||b)&&o.default.createElement("div",{className:"emoji-mart-bar"},o.default.createElement(m.default,{ref:this.setPreviewRef,data:this.data,title:c,emoji:d,showSkinTones:b,showPreview:w,emojiProps:{native:v,size:38,skin:O,set:n,sheetSize:r,sheetColumns:s,sheetRows:a,backgroundImageFn:_},skinsProps:{skin:O,onChange:this.handleSkinChange,skinEmoji:P},i18n:this.i18n})))}}t.default=y,y.propTypes=(0,i.default)({},d.PickerPropTypes,{data:r.default.object.isRequired}),y.defaultProps=(0,i.default)({},g.PickerDefaultProps)},function(e,t,n){"use strict";"undefined"!=typeof window&&function(){for(var e=0,t=["ms","moz","webkit","o"],n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var i=(new Date).getTime(),o=Math.max(0,16-(i-e)),r=window.setTimeout(function(){t(i+o)},o);return e=i+o,r}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}()},function(e,t,n){var i,o,r=n(6),s=[],a=r.options.render;r.options.render=function(e){a&&a(e),i=0,(o=e.__c).__H&&(o.__H.n.forEach(g),o.__H.n=[])};var l=r.options.diffed;r.options.diffed=function(e){l&&l(e);var t=e.__c;if(t){var n=t.__H;n&&(n.t.forEach(g),n.t=[])}};var u=r.options.unmount;function c(e){var t=o.__H||(o.__H={r:[],n:[],t:[]});return e>=t.r.length&&t.r.push({}),t.r[e]}function d(e,t,n){var r=c(i++);return null==r.__c&&(r.__c=o,r.u=[null==n?_(null,t):n(t),function(t){r.u[0]=e(r.u[0],t),r.__c.setState({})}]),r.u}function h(e,t){var n=c(i++);return v(n.o,t)?(n.o=t,n.e=e,n.u=e()):n.u}r.options.unmount=function(e){u&&u(e);var t=e.__c;if(t){var n=t.__H;n&&n.r.forEach(function(e){return e.i&&e.i()})}};var f=function(){};function m(){s.forEach(function(e){e.f=!1,e.__P&&(e.__H.n.forEach(g),e.__H.n=[])}),s=[]}function p(){setTimeout(m,0)}function g(e){e.i&&e.i();var t=e.u();"function"==typeof t&&(e.i=t)}function v(e,t){return null==e||t.some(function(t,n){return t!==e[n]})}function _(e,t){return"function"==typeof t?t(e):t}"undefined"!=typeof window&&(f=function(e){!e.f&&(e.f=!0)&&1===s.push(e)&&(r.options.requestAnimationFrame?r.options.requestAnimationFrame(m):requestAnimationFrame(p))}),t.useState=function(e){return d(_,e)},t.useReducer=d,t.useEffect=function(e,t){var n=c(i++);v(n.o,t)&&(n.u=e,n.o=t,o.__H.n.push(n),f(o))},t.useLayoutEffect=function(e,t){var n=c(i++);v(n.o,t)&&(n.u=e,n.o=t,o.__H.t.push(n))},t.useRef=function(e){var t=c(i++);return null==t.u&&(t.u={current:e}),t.u},t.useMemo=h,t.useCallback=function(e,t){return h(function(){return e},t)},t.useContext=function(e){var t=o.context[e.__c];if(null==t)return e.__p;var n=c(i++);return null==n.u&&(n.u=!0,t.sub(o)),t.props.value}},function(e,t,n){"use strict";var i=n(18);function o(){}function r(){}r.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,r,s){if(s!==i){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;
18var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:r,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("function"!=typeof e&&("object"!=typeof e||null===e))throw new TypeError("Object.keys called on non-object");var t,n,a=[];for(t in e)i.call(e,t)&&a.push(t);if(o)for(n=0;n<s;n++)i.call(e,r[n])&&a.push(r[n]);return a};var i=Object.prototype.hasOwnProperty,o=!{toString:null}.propertyIsEnumerable("toString"),r=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],s=r.length},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=String;t.default=i.fromCodePoint||function(){var e,t,n=[],i=-1,o=arguments.length;if(!o)return"";for(var r="";++i<o;){var s=Number(arguments[i]);if(!isFinite(s)||s<0||s>1114111||Math.floor(s)!=s)throw RangeError("Invalid code point: "+s);s<=65535?n.push(s):(e=55296+((s-=65536)>>10),t=s%1024+56320,n.push(e,t)),(i+1===o||n.length>16384)&&(r+=String.fromCharCode.apply(null,n),n.length=0)}return r}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(0)),o=r(n(1));function r(e){return e&&e.__esModule?e:{default:e}}class s extends i.default.PureComponent{constructor(e){super(e);let t=e.categories.filter(e=>e.first)[0];this.state={selected:t.name},this.handleClick=this.handleClick.bind(this)}handleClick(e){var t=e.currentTarget.getAttribute("data-index"),{categories:n,onAnchorClick:i}=this.props;i(n[t],t)}render(){var{categories:e,color:t,i18n:n,icons:o}=this.props,{selected:r}=this.state;return i.default.createElement("nav",{className:"emoji-mart-anchors","aria-label":n.categorieslabel},e.map((e,s)=>{var{id:a,name:l,anchor:u}=e,c=l==r;return!1===u?null:i.default.createElement("button",{key:a,"aria-label":n.categories[a],title:n.categories[a],"data-index":s,onClick:this.handleClick,className:`emoji-mart-anchor ${c?"emoji-mart-anchor-selected":""}`,style:{color:c?t:null}},i.default.createElement("div",{className:"emoji-mart-anchor-icon"},o.categories[a]()),i.default.createElement("span",{className:"emoji-mart-anchor-bar",style:{backgroundColor:t}}))}))}}t.default=s,s.propTypes={categories:o.default.array,onAnchorClick:o.default.func,icons:o.default.object},s.defaultProps={categories:[],onAnchorClick:()=>{},icons:{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=c(n(2)),o=c(n(0)),r=c(n(1)),s=c(n(9)),a=n(3),l=c(n(4)),u=c(n(23));function c(e){return e&&e.__esModule?e:{default:e}}class d extends o.default.Component{constructor(e){super(e),this.data=e.data,this.setContainerRef=this.setContainerRef.bind(this),this.setLabelRef=this.setLabelRef.bind(this)}componentDidMount(){this.margin=0,this.minMargin=0,this.memoizeSize()}shouldComponentUpdate(e,t){var{name:n,perLine:i,native:o,hasStickyPosition:r,emojis:s,emojiProps:a}=this.props,{skin:l,size:u,set:c}=a,{perLine:d,native:h,hasStickyPosition:f,emojis:m,emojiProps:p}=e,{skin:g,size:v,set:_}=p,y=!1;return"Recent"==n&&i!=d&&(y=!0),"Search"==n&&(y=!(s==m)),l==g&&u==v&&o==h&&c==_&&r==f||(y=!0),y}memoizeSize(){if(!this.container)return this.top=0,void(this.maxMargin=0);var e=this.container.parentElement,{top:t,height:n}=this.container.getBoundingClientRect(),{top:i}=e.getBoundingClientRect(),{height:o}=this.label.getBoundingClientRect();this.top=t-i+e.scrollTop,this.maxMargin=0==n?0:n-o}handleScroll(e){var t=e-this.top;if((t=(t=t<this.minMargin?this.minMargin:t)>this.maxMargin?this.maxMargin:t)!=this.margin)return this.props.hasStickyPosition||(this.label.style.top=`${t}px`),this.margin=t,!0}getEmojis(){var{name:e,emojis:t,recent:n,perLine:i}=this.props;if("Recent"==e){let{custom:e}=this.props,o=n||s.default.get(i);if(o.length&&(t=o.map(t=>{const n=e.filter(e=>e.id===t)[0];return n||t}).filter(e=>!!(0,a.getData)(e,null,null,this.data))),0===t.length&&o.length>0)return null}return t&&(t=t.slice(0)),t}updateDisplay(e){this.getEmojis()&&(this.container.style.display=e)}setContainerRef(e){this.container=e}setLabelRef(e){this.label=e}render(){var{id:e,name:t,hasStickyPosition:n,emojiProps:r,i18n:s,notFound:a,notFoundEmoji:c}=this.props,d=this.getEmojis(),h={},f={},m={};return d||(m={display:"none"}),n||(h={height:28},f={position:"absolute"}),o.default.createElement("section",{ref:this.setContainerRef,className:"emoji-mart-category","aria-label":s.categories[e],style:m},o.default.createElement("div",{style:h,"data-name":t,className:"emoji-mart-category-label"},o.default.createElement("span",{style:f,ref:this.setLabelRef,"aria-hidden":!0},s.categories[e])),o.default.createElement("ul",{className:"emoji-mart-category-list"},d&&d.map(e=>o.default.createElement("li",{key:e.id||e},(0,l.default)((0,i.default)({emoji:e,data:this.data},r))))),d&&!d.length&&o.default.createElement(u.default,{i18n:s,notFound:a,notFoundEmoji:c,data:this.data,emojiProps:r}))}}t.default=d,d.propTypes={emojis:r.default.array,hasStickyPosition:r.default.bool,name:r.default.string.isRequired,native:r.default.bool.isRequired,perLine:r.default.number.isRequired,emojiProps:r.default.object.isRequired,recent:r.default.arrayOf(r.default.string),notFound:r.default.func,notFoundEmoji:r.default.string.isRequired},d.defaultProps={emojis:[],hasStickyPosition:!0}},function(e,t,n){"use strict";
18Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(2)),o=a(n(0)),r=a(n(1)),s=a(n(4));function a(e){return e&&e.__esModule?e:{default:e}}class l extends o.default.PureComponent{render(){const{data:e,emojiProps:t,i18n:n,notFound:r,notFoundEmoji:a}=this.props;return r&&r()||o.default.createElement("div",{className:"emoji-mart-no-results"},(0,s.default)((0,i.default)({data:e},t,{size:38,emoji:a,onOver:null,onLeave:null,onClick:null})),o.default.createElement("div",{className:"emoji-mart-no-results-label"},n.notfound))}}t.default=l,l.propTypes={notFound:r.default.func.isRequired,emojiProps:r.default.object.isRequired}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=c(n(2)),o=c(n(0)),r=c(n(1)),s=n(3),a=c(n(4)),l=c(n(25)),u=c(n(26));function c(e){return e&&e.__esModule?e:{default:e}}class d extends o.default.PureComponent{constructor(e){super(e),this.data=e.data,this.state={emoji:null}}render(){var{emoji:e}=this.state,{emojiProps:t,skinsProps:n,showSkinTones:r,title:c,emoji:d,i18n:h,showPreview:f}=this.props;if(e&&f){var m=(0,s.getData)(e,null,null,this.data),{emoticons:p=[]}=m,g=[],v=[];return p.forEach(e=>{g.indexOf(e.toLowerCase())>=0||(g.push(e.toLowerCase()),v.push(e))}),o.default.createElement("div",{className:"emoji-mart-preview"},o.default.createElement("div",{className:"emoji-mart-preview-emoji","aria-hidden":"true"},(0,a.default)((0,i.default)({key:e.id,emoji:e,data:this.data},t))),o.default.createElement("div",{className:"emoji-mart-preview-data","aria-hidden":"true"},o.default.createElement("div",{className:"emoji-mart-preview-name"},e.name),o.default.createElement("div",{className:"emoji-mart-preview-shortnames"},m.short_names.map(e=>o.default.createElement("span",{key:e,className:"emoji-mart-preview-shortname"},":",e,":"))),o.default.createElement("div",{className:"emoji-mart-preview-emoticons"},v.map(e=>o.default.createElement("span",{key:e,className:"emoji-mart-preview-emoticon"},e)))))}return o.default.createElement("div",{className:"emoji-mart-preview"},o.default.createElement("div",{className:"emoji-mart-preview-emoji","aria-hidden":"true"},d&&d.length&&(0,a.default)((0,i.default)({emoji:d,data:this.data},t))),o.default.createElement("div",{className:"emoji-mart-preview-data","aria-hidden":"true"},o.default.createElement("span",{className:"emoji-mart-title-label"},c)),r&&o.default.createElement("div",{className:`emoji-mart-preview-skins${n.skinEmoji?" custom":""}`},n.skinEmoji?o.default.createElement(l.default,{skin:n.skin,emojiProps:t,data:this.data,skinEmoji:n.skinEmoji,i18n:h,onChange:n.onChange}):o.default.createElement(u.default,{skin:n.skin,i18n:h,onChange:n.onChange})))}}t.default=d,d.propTypes={showSkinTones:r.default.bool,title:r.default.string.isRequired,emoji:r.default.string.isRequired,emojiProps:r.default.object.isRequired,skinsProps:r.default.object.isRequired},d.defaultProps={showSkinTones:!0,onChange:()=>{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(0)),o=a(n(1)),r=a(n(4)),s=a(n(12));function a(e){return e&&e.__esModule?e:{default:e}}class l extends s.default{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}render(){const{skin:e,emojiProps:t,data:n,skinEmoji:o,i18n:s}=this.props,{opened:a}=this.state,l=[];for(let s=1;s<=6;s++){const a=s===e;l.push(i.default.createElement("span",{key:`skin-tone-${s}`,className:`emoji-mart-skin-swatch custom${a?" selected":""}`},i.default.createElement("span",{onClick:this.handleClick,"data-skin":s,className:`emoji-mart-skin-tone-${s}`},(0,r.default)({emoji:o,data:n,skin:s,backgroundImageFn:t.backgroundImageFn,native:t.native,set:t.set,sheetSize:t.sheetSize,size:23}))))}return i.default.createElement("div",{className:`emoji-mart-skin-swatches custom${a?" opened":""}`},i.default.createElement("div",{className:`emoji-mart-skin-text${a?" opened":""}`},s.skintext),l)}}t.default=l,l.propTypes={onChange:o.default.func,skin:o.default.number.isRequired,emojiProps:o.default.object.isRequired,skinTone:o.default.number,skinEmoji:o.default.string.isRequired,i18n:o.default.object}
18,l.defaultProps={onChange:()=>{},skinTone:null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=a(n(2)),o=a(n(0)),r=a(n(1)),s=a(n(12));function a(e){return e&&e.__esModule?e:{default:e}}class l extends s.default{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}handleKeyDown(e){13!==e.keyCode&&32!==e.keyCode||this.handleClick(e)}render(){const{skin:e,i18n:t}=this.props,{opened:n}=this.state,r=[];for(let s=1;s<=6;s++){const a=s===e,l=n||a;r.push(o.default.createElement("span",(0,i.default)({key:`skin-tone-${s}`,className:`emoji-mart-skin-swatch${a?" selected":""}`,"aria-label":t.skintones[s],"aria-hidden":!l},n?{role:"menuitem"}:{}),o.default.createElement("span",(0,i.default)({onClick:this.handleClick,onKeyDown:this.handleKeyDown,role:"button"},a?{"aria-haspopup":!0,"aria-expanded":!!n}:{},n?{"aria-pressed":!!a}:{},{tabIndex:l?"0":"","aria-label":t.skintones[s],title:t.skintones[s],"data-skin":s,className:`emoji-mart-skin emoji-mart-skin-tone-${s}`}))))}return o.default.createElement("section",{className:`emoji-mart-skin-swatches${n?" opened":""}`,"aria-label":t.skintext},o.default.createElement("div",n?{role:"menubar"}:{},r))}}t.default=l,l.propTypes={onChange:r.default.func,skin:r.default.number.isRequired,i18n:r.default.object},l.defaultProps={onChange:()=>{}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=l(n(0)),o=l(n(1)),r=n(7),s=l(n(28)),a=n(3);function l(e){return e&&e.__esModule?e:{default:e}}let u=0;class c extends i.default.PureComponent{constructor(e){super(e),this.state={icon:r.search.search,isSearching:!1,id:++u},this.data=e.data,this.emojiIndex=new s.default(this.data),this.setRef=this.setRef.bind(this),this.clear=this.clear.bind(this),this.handleKeyUp=this.handleKeyUp.bind(this),this.handleChange=(0,a.throttleIdleTask)(this.handleChange.bind(this))}componentDidMount(){this.input&&this.input.value&&this.search(this.input.value)}search(e){""==e?this.setState({icon:r.search.search,isSearching:!1}):this.setState({icon:r.search.delete,isSearching:!0}),this.props.onSearch(this.emojiIndex.search(e,{emojisToShowFilter:this.props.emojisToShowFilter,maxResults:this.props.maxResults,include:this.props.include,exclude:this.props.exclude,custom:this.props.custom}))}clear(){""!=this.input.value&&(this.input.value="",this.input.focus(),this.search(""))}handleChange(){this.search(this.input.value)}handleKeyUp(e){13===e.keyCode&&this.clear()}setRef(e){this.input=e}render(){const{i18n:e,autoFocus:t}=this.props,{icon:n,isSearching:o,id:r}=this.state,s=`emoji-mart-search-${r}`;return i.default.createElement("section",{className:"emoji-mart-search","aria-label":e.search},i.default.createElement("input",{id:s,ref:this.setRef,type:"search",onChange:this.handleChange,placeholder:e.search,autoFocus:t}),i.default.createElement("label",{className:"emoji-mart-sr-only",htmlFor:s},e.search),i.default.createElement("button",{className:"emoji-mart-search-icon",onClick:this.clear,onKeyUp:this.handleKeyUp,"aria-label":e.clear,disabled:!o},n()))}}t.default=c,c.propTypes={onSearch:o.default.func,maxResults:o.default.number,emojisToShowFilter:o.default.func,autoFocus:o.default.bool},c.defaultProps={onSearch:()=>{},maxResults:75,emojisToShowFilter:null,autoFocus:!1}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=n(3),o=n(5);t.default=class{constructor(e){e.compressed&&(0,o.uncompress)(e),this.data=e||{},this.originalPool={},this.index={},this.emojis={},this.emoticons={},this.customEmojisList=[],this.buildIndex()}buildIndex(){for(let e in this.data.emojis){let t=this.data.emojis[e],{short_names:n,emoticons:o}=t,r=n[0];o&&o.forEach(e=>{this.emoticons[e]||(this.emoticons[e]=r)}),this.emojis[r]=(0,i.getSanitizedData)(r,null,null,this.data),this.originalPool[r]=t}}clearCustomEmojis(e){this.customEmojisList.forEach(t=>{let n=t.id||t.short_names[0];delete e[n],delete this.emojis[n]})}addCustomToPool(e,t){this.customEmojisList.length&&this.clearCustomEmojis(t),e.forEach(e=>{let n=e.id||e.short_names[0];n&&!t[n]&&(t[n]=(0,i.getData)(e,null,null,this.data),this.emojis[n]=(0,i.getSanitizedData)(e,null,null,this.data))}),this.customEmojisList=e,this.index={}}search(e,{emojisToShowFilter:t,maxResults:n,include:o,exclude:r,custom:s=[]}={}){this.customEmojisList!=s&&this.addCustomToPool(s,this.originalPool),n||(n=75),o||(o=[]),r||(r=[]);var a=null,l=this.originalPool;if(e.length){if("-"==e||"-1"==e)return[this.emojis[-1]];var u,c=e.toLowerCase().split(/[\s|,|\-|_]+/);if(c.length>
182&&(c=[c[0],c[1]]),(o.length||r.length)&&(l={},this.data.categories.forEach(e=>{let t=!o||!o.length||o.indexOf(e.id)>-1,n=!(!r||!r.length)&&r.indexOf(e.id)>-1;t&&!n&&e.emojis.forEach(e=>l[e]=this.data.emojis[e])}),s.length)){let e=!o||!o.length||o.indexOf("custom")>-1,t=!(!r||!r.length)&&r.indexOf("custom")>-1;e&&!t&&this.addCustomToPool(s,l)}a=(u=c.map(e=>{var t=l,n=this.index,i=0;for(let o=0;o<e.length;o++){const r=e[o];if(i++,n[r]||(n[r]={}),!(n=n[r]).results){let o={};n.results=[],n.pool={};for(let r in t){let s=t[r],{search:a}=s,l=e.substr(0,i),u=a.indexOf(l);if(-1!=u){let e=u+1;l==r&&(e=0),n.results.push(this.emojis[r]),n.pool[r]=s,o[r]=e}}n.results.sort((e,t)=>o[e.id]-o[t.id])}t=n.pool}return n.results}).filter(e=>e)).length>1?i.intersect.apply(null,u):u.length?u[0]:[]}return a&&(t&&(a=a.filter(e=>t(l[e.id]))),a&&a.length>n&&(a=a.slice(0,n))),a}}},function(e,t,n){e.exports=n(30)},function(e,t,n){!function(e,t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;var i=Object.freeze({name:"CustomElements",defineElement:function(e,t,{onUpdate:n,onUnmount:i,onMount:o}){!function(){if(window.HTMLElement&&window.HTMLElement._babelES5Adapter||void 0===window.Reflect||void 0===window.customElements||window.customElements.hasOwnProperty("polyfillWrapFlushCallback"))return;const e=HTMLElement;window.HTMLElement=function(){return Reflect.construct(e,[],this.constructor)},HTMLElement.prototype=e.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,e),HTMLElement._babelES5Adapter=!0}();const r=e.attributes||[];e.quiet&&window.customElements.get(t)||window.customElements.define(t,class extends window.HTMLElement{static get observedAttributes(){return["props-json",...r]}connectedCallback(){this._mountPoint=function(e,{shadow:t}){if(t&&e.attachShadow){const t=document.createElement("span");return e.attachShadow({mode:"open"}).appendChild(t),t}return e}(this,e),o(this,this._mountPoint)}disconnectedCallback(){this._mountPoint&&i(this,this._mountPoint)}attributeChangedCallback(){this._mountPoint&&n(this,this._mountPoint)}})},isSupported:function(){return window.customElements&&window.customElements.define},supportsShadow:function(){return!!(document&&document.body&&document.body.attachShadow)}});const o={};function r(e,t,n){e.nodeName.toLowerCase()===t?(n.onMount(e,e),function(e,{onUpdate:t}){new window.MutationObserver(e=>{s(e,e=>{const n=e.target;t(n,n)})}).observe(e,{attributes:!0})}(e,n),function(e,{onUnmount:t}){const n=e.parentNode,i=new window.MutationObserver(o=>{s(o,o=>{s(o.removedNodes,o=>{e===o&&(i.disconnect(n),t(e,e))})})});i.observe(n,{childList:!0,subtree:!0})}(e,n)):e.children&&e.children.length&&s(e.children,e=>{r(e,t,n)})}function s(e,t){for(let n=0,i=e.length;n<i;n++)t(e[n])}var a=Object.freeze({name:"MutationObserver",observers:o,isSupported:function(){return!!window.MutationObserver},defineElement:function(e,t,n){if(!function(e){return!(-1===e.indexOf("-")||!e.match(/^[a-z][a-z0-9-]*$/))}(t=t.toLowerCase())){if(e.quiet)return;throw new Error(`Remount: "${t}" is not a valid custom element name`)}if(o[t]){if(e.quiet)return;throw new Error(`Remount: "${t}" is already registered`)}new window.MutationObserver(e=>{s(e,e=>{s(e.addedNodes,e=>{r(e,t,n)})})}).observe(document.body,{childList:!0,subtree:!0}),o[t]=!0,window.addEventListener("DOMContentLoaded",()=>{const e=document.getElementsByTagName(t);[...e].forEach(e=>r(e,t,n))})},supportsShadow:function(){return!1}});function l({component:e},i,o){const r=t.createElement(e,o);n.render(r,i)}var u=Object.freeze({mount:function(e,t,n){return l(e,t,n)},update:l,unmount:function(e,t){n.unmountComponentAtNode(t)}});function c(){if(void 0!==c._result)return c._result;const e=[i,a].reduce((e,t)=>e||t.isSupported()&&t,null);return e||console.warn("Remount: This browser doesn't support the MutationObserver API or the Custom Elements API. Including polyfills might fix this. Remount elements will not work. https://github.com/rstacruz/remount"),c._result=e,e}function d(e,t){const n=e.getAttribute("props-json");if(n)return JSON.parse(n);const i=t||[];return i.reduce((t,n)=>(t[n]=e.getAttribute(n),t),{})}e.getStrategy=c,e.define=function(e,t){const n=c();n&&Object.keys(e).forEach(i=>
18{const o=Object.assign({},t,function(e){return"object"==typeof e&&e.component?e:{component:e}}(e[i])),r=o.adapter||u;n.defineElement(o,i,{onMount(e,t){const n=d(e,o.attributes);r.mount(o,t,n)},onUpdate(e,t){const n=d(e,o.attributes);r.update(o,t,n)},onUnmount(e,t){r.unmount(o,t)}})})},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(0),n(0))}]); 19 20/*! 21 * bootstra-suggest - v2.0.1 (https://github.com/lodev09/bootstrap-suggest#readme) 22 * Copyright 2013-2019 Jovanni Lo ([email protected]) 23 * Licensed under MIT (https://github.com/lodev09/bootstrap-suggest/blob/master/LICENSE) 24 */ 25 26(function(a){"use strict";var b=function(b,c,d){this;this.$element=a(b),this.$items=void 0,this.options=a.extend(!0,{},a.fn.suggest.defaults,d,this.$element.data(),this.$element.data("options")),this.key=c,this.isShown=!1,this.query="",this._queryPos=[],this._keyPos=-1,this.$dropdown=a("<div />",{class:"dropdown suggest "+this.options.dropdownClass,html:a("<div />",{class:"dropdown-menu",role:"menu"}),"data-key":this.key}),this.load()};b.prototype={__setListener:function(){return this.$element.on("suggest.show",a.proxy(this.options.onshow,this)).on("suggest.select",a.proxy(this.options.onselect,this)).on("suggest.lookup",a.proxy(this.options.onlookup,this)).on("keyup",a.proxy(this.__keyup,this)),this},__getCaretPos:function(b){var c=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],d=null!=window.mozInnerScreenX;return function(b,e){var f=document.createElement("div");f.id="input-textarea-caret-position-mirror-div",document.body.appendChild(f);var g=f.style,h=window.getComputedStyle?getComputedStyle(b):b.currentStyle;g.whiteSpace="pre-wrap","INPUT"!==b.nodeName&&(g.wordWrap="break-word"),g.position="absolute",g.visibility="hidden",a.each(c,function(a,b){g[b]=h[b]}),d?(g.width=parseInt(h.width)-2+"px",b.scrollHeight>parseInt(h.height)&&(g.overflowY="scroll")):g.overflow="hidden",f.textContent=b.value.substring(0,e),"INPUT"===b.nodeName&&(f.textContent=f.textContent.replace(/\s/g,"\xA0"));var i=document.createElement("span");i.textContent=b.value.substring(e)||".",f.appendChild(i);var j={top:i.offsetTop+parseInt(h.borderTopWidth),left:i.offsetLeft+parseInt(h.borderLeftWidth)};return document.body.removeChild(f),j}(this.$element.get(0),b)},__keyup:function(b){switch(b.keyCode){case 27:return void this.hide();case 13:return!0;}if(-1===a.inArray(b.keyCode,[38,40,37,39,17,18,9,16,20,91,93,36,35,45,33,34,144,112,113,114,115,116,117,118,119,120,121,122,123,145,19]))for(var c,d=this.$element,e=d.val(),f=this.__getSelection(d.get(0)).start,g=f;0<=g;g--){if(c=a.trim(e.substring(g-1,g)),!c){this.hide();break}if(c===this.key){this.query=e.substring(g,f),this._queryPos=[g,f],this._keyPos=g,this.lookup(this.query);break}}},__getVisibleItems:function(){return this.$items?this.$items.not(".d-none"):a()},__build:function(){var b=this.$dropdown,c=this,d=function(){c.hide()};b.on("click","a.dropdown-item",function(b){b.preventDefault(),c.__select(a(this).index()),c.$element.focus()}).on("mouseover","a.dropdown-item",function(){c.$element.off("blur",d)}).on("mouseout","a.dropdown-item",function(){c.$element.on("blur",d)}),this.$element.before(b).on("blur",d).on("keydown",function(b){var d;if(c.isShown)switch(b.keyCode){case 13:return d=c.__getVisibleItems(),d.each(function(){a(this).is(".active")&&c.__select(a(this).index())}),!1;break;case 40:return(d=c.__getVisibleItems(),!d.last().is(".active"))&&(d.each(function(b){var c=a(this),e=d.eq(b+1);if(c.is(".active"))return e.is(".d-none")||(c.removeClass("active"),e.addClass("active")),!1}),!1);case 38:return(d=c.__getVisibleItems(),!d.first().is(".active"))&&(d.each(function(b){var c=a(this),e=d.eq(b-1);if(c.is(".active"))return e.is(".d-none")||(c.removeClass("active"),e.addClass("active")),!1}),!1);}})},__mapItem:function(b){var c=this,d={text:"",value:""};return!(this.options.map&&(b=this.options.map(b),!b))&&(b instanceof Object?(d.text=b.text||"",d.value=b.value||""):(d.text=b,d.value=b),a("<a />",{class:"dropdown-item","data-value":d.value,href:"#",html:d.text}))},__select:function(b){var c=this.$element,d=c.get(0),e=c.val(),f=this.get(b),g=this._keyPos+f.value.length;if(c.val(e.slice(0,this._keyPos)+f.value+e.slice(this.__getSelection(d).start)),d.setSelectionRange)d.setSelectionRange(g,g);else if(d.createTextRange){var h=d.createTextRange();h.collapse(!0),h.moveEnd("character",g),h.moveStart("character",g),h.select()}c.trigger(a.extend({type:"suggest.select"},this),f),this.hide(),setTimeout(function(){c.focus()},200)},__getSelection:function(a){return a.focus(),{start:a.selectionStart,end:a.selectionEnd}},__buildItems:function(a){var b=this.$dropdown.find(".dropdown-menu");if(b.empty(),a&&a instanceof Array)for(var c in a){var d=this.__mapItem(a[c]);d&&b.append(d)}
26return b.find("a.dropdown-item")},__lookup:function(b,c){c.eq(0).addClass("active");this.$element.trigger(a.extend({type:"suggest.lookup"},this),[b,c]),c&&c.length?this.show():this.hide()},__filterData:function(b){var c=this.options;return this.$items.addClass("d-none"),this.$items.filter(function(d){if(""===b)return d<c.filter.limit;var e=a(this).text();return c.filter.casesensitive||(e=e.toLowerCase(),b=b.toLowerCase()),-1!=e.indexOf(b)}).slice(0,c.filter.limit).removeClass("d-none active"),this.__getVisibleItems()},get:function(a){if(this.$items){var b=this.$items.eq(a);return{text:b.text(),value:b.attr("data-value"),index:a,$element:b}}},lookup:function(a){var b,c=this.options,d=this,e=function(b){-1!==d._keyPos&&(!d.$items&&(d.$items=d.__buildItems(b)),d.__lookup(a,d.__filterData(a,b)))};"function"==typeof this.options.data?(this.$items=void 0,b=this.options.data(a,e)):b=this.options.data,b&&"function"==typeof b.promise?b.done(e):b&&e.call(this,b)},load:function(){this.__setListener(),this.__build()},hide:function(){this.$dropdown.find(".dropdown-menu").removeClass("show"),this.isShown=!1,this.$items&&this.$items.removeClass("active"),this._keyPos=-1},show:function(){var b,c=this.$element,d=this.$dropdown.find(".dropdown-menu"),e=c.get(0),f=this.options,g={top:"auto",bottom:"auto",left:"auto",right:"auto"};if(!this.isShown){if(d.addClass("show"),!1!==f.position){if(b=this.__getCaretPos(this._keyPos),"string"==typeof f.position)switch(f.position){case"bottom":g.top=c.outerHeight()-parseFloat(d.css("margin-top")),g.left=0,g.right=0;break;case"top":g.top=-(d.outerHeight(!0)+parseFloat(d.css("margin-top"))),g.left=0,g.right=0;break;case"caret":g.top=b.top-e.scrollTop,g.left=b.left-e.scrollLeft;}else g=a.extend(g,"function"==typeof f.position?f.position(e,b):f.position);d.css(g)}this.isShown=!0,c.trigger(a.extend({type:"suggest.show"},this))}}};var c=a.fn.suggest;a.fn.suggest=function(c){var d=arguments[1],e=arguments[2],f=function(c,d){var e={};return a.each(d,function(a,d){var f=a.toString().charAt(0);e[f]=new b(c,f,"object"==typeof d&&d)}),e};return this.each(function(){var b=this,g=a(this),h=g.data("suggest"),i={};if(!("string"==typeof c))h?h&&(a.each(c,function(b,c){!1==b in h?i[b]=c:h[b].options=a.extend({},h[b].options,c)}),g.data("suggest",a.extend(h,f(b,i)))):g.data("suggest",f(this,c));else if(1!=c.length)console.error("you're not initializing suggest properly. arg1 should have length == 1");else if(d)if("string"==typeof d){if(c in h&&"undefined"!=typeof h[c][d])return h[c][d].call(h[c],e);console.error(c+" is not a suggest")}else i[c]=a.isArray(d)||"function"==typeof d?{data:d}:d,h&&c in h?h[c].options=a.extend({},h[c].options,i[c]):h=a.extend(h,f(this,i)),g.data("suggest",h)})},a.fn.suggest.defaults={data:[],map:void 0,filter:{casesensitive:!1,limit:5},dropdownClass:"",position:"caret",onshow:function(){},onselect:function(){},onlookup:function(){}},a.fn.suggest.Constructor=b,a.fn.suggest.noConflict=function(){return a.fn.suggest=c,this}})(jQuery); 27 28 29var usState = {"AL":"Alabama","AK":"Alaska","AS":"American Samoa","AZ":"Arizona","AR":"Arkansas","CA":"California","CO":"Colorado","CT":"Connecticut","DE":"Delaware","DC":"District Of Columbia","FM":"Federated States Of Micronesia","FL":"Florida","GA":"Georgia","GU":"Guam","HI":"Hawaii","ID":"Idaho","IL":"Illinois","IN":"Indiana","IA":"Iowa","KS":"Kansas","KY":"Kentucky","LA":"Louisiana","ME":"Maine","MH":"Marshall Islands","MD":"Maryland","MA":"Massachusetts","MI":"Michigan","MN":"Minnesota","MS":"Mississippi","MO":"Missouri","MT":"Montana","NE":"Nebraska","NV":"Nevada","NH":"New Hampshire","NJ":"New Jersey","NM":"New Mexico","NY":"New York","NC":"North Carolina","ND":"North Dakota","MP":"Northern Mariana Islands","OH":"Ohio","OK":"Oklahoma","OR":"Oregon","PW":"Palau","PA":"Pennsylvania","PR":"Puerto Rico","RI":"Rhode Island","SC":"South Carolina","SD":"South Dakota","TN":"Tennessee","TX":"Texas","UT":"Utah","VT":"Vermont","VI":"Virgin Islands","VA":"Virginia","WA":"Washington","WV":"West Virginia","WI":"Wisconsin","WY":"Wyoming"}; 30var allCountries = [{i:4, n:"Afghanistan",c:"AFN"}, {i:248, n:"Ã land",c:"EUR"}, {i:8, n:"Albania",c:"ALL"}, {i:12, n:"Algeria",c:"DZD"}, {i:16, n:"American Samoa",c:"USD"}
30, {i:20, n:"Andorra",c:"EUR"}, {i:24, n:"Angola",c:"AOA"}, {i:660, n:"Anguilla",c:"XCD"}, {i:28, n:"Antigua and Barbuda",c:"XCD"}, {i:32, n:"Argentina",c:"ARS"}, {i:51, n:"Armenia",c:"AMD"}, {i:533, n:"Aruba",c:"AWG"}, {i:36, n:"Australia",c:"AUD"}, {i:40, n:"Austria",c:"EUR"}, {i:31, n:"Azerbaijan",c:"AZN"}, {i:44, n:"Bahamas",c:"BSD"}, {i:48, n:"Bahrain",c:"BHD"}, {i:50, n:"Bangladesh",c:"BDT"}, {i:52, n:"Barbados",c:"BBD"}, {i:112, n:"Belarus",c:"BYN"}, {i:56, n:"Belgium",c:"EUR"}, {i:84, n:"Belize",c:"BZD"}, {i:204, n:"Benin",c:"XOF"}, {i:60, n:"Bermuda",c:"BMD"}, {i:64, n:"Bhutan",c:"BTN"}, {i:68, n:"Bolivia",c:"BOB"}, {i:535, n:"Bonaire",c:"USD"}, {i:70, n:"Bosnia and Herzegovina",c:"BAM"}, {i:72, n:"Botswana",c:"BWP"}, {i:74, n:"Bouvet Island",c:"NOK"}, {i:76, n:"Brazil",c:"BRL"}, {i:86, n:"British Indian Ocean Territory",c:"USD"}, {i:96, n:"Brunei",c:"BND"}, {i:100, n:"Bulgaria",c:"BGN"}, {i:854, n:"Burkina Faso",c:"XOF"}, {i:108, n:"Burundi",c:"BIF"}, {i:132, n:"Cape Verde",c:"CVE"}, {i:116, n:"Cambodia",c:"KHR"}, {i:120, n:"Cameroon",c:"XAF"}, {i:124, n:"Canada",c:"CAD"}, {i:136, n:"Cayman Islands",c:"KYD"}, {i:140, n:"Central African Republic",c:"XAF"}, {i:148, n:"Chad",c:"XAF"}, {i:152, n:"Chile",c:"CLP"}, {i:156, n:"China",c:"CNY"}, {i:162, n:"Christmas Island",c:"AUD"}, {i:166, n:"Cocos [Keeling] Islands",c:"AUD"}, {i:170, n:"Colombia",c:"COP"}, {i:174, n:"Comoros",c:"KMF"}, {i:178, n:"Republic of the Congo",c:"XAF"}, {i:180, n:"Democratic Republic of the Congo",c:"CDF"}, {i:184, n:"Cook Islands",c:"NZD"}, {i:188, n:"Costa Rica",c:"CRC"}, {i:384, n:"Ivory Coast",c:"XOF"}, {i:191, n:"Croatia",c:"HRK"}, {i:192, n:"Cuba",c:"CUP"}, {i:531, n:"Curacao",c:"ANG"}, {i:196, n:"Cyprus",c:"EUR"}, {i:203, n:"Czech Republic",c:"CZK"}, {i:208, n:"Denmark",c:"DKK"}, {i:262, n:"Djibouti",c:"DJF"}, {i:212, n:"Dominica",c:"XCD"}, {i:214, n:"Dominican Republic",c:"DOP"}, {i:218, n:"Ecuador",c:"USD"}, {i:818, n:"Egypt",c:"EGP"}, {i:222, n:"El Salvador",c:"USD"}, {i:226, n:"Equatorial Guinea",c:"XAF"}, {i:232, n:"Eritrea",c:"ERN"}, {i:233, n:"Estonia",c:"EUR"}, {i:748, n:"Eswatini",c:"SZL"}, {i:231, n:"Ethiopia",c:"ETB"}, {i:238, n:"Falkland Islands",c:"FKP"}, {i:234, n:"Faroe Islands",c:"DKK"}, {i:242, n:"Fiji",c:"FJD"}, {i:246, n:"Finland",c:"EUR"}, {i:250, n:"France",c:"EUR"}, {i:254, n:"French Guiana",c:"EUR"}, {i:258, n:"French Polynesia",c:"XPF"}, {i:260, n:"French Southern Territories",c:"EUR"}, {i:266, n:"Gabon",c:"XAF"}, {i:270, n:"Gambia",c:"GMD"}, {i:268, n:"Georgia",c:"GEL"}, {i:276, n:"Germany",c:"EUR"}, {i:288, n:"Ghana",c:"GHS"}, {i:292, n:"Gibraltar",c:"GIP"}, {i:300, n:"Greece",c:"EUR"}, {i:304, n:"Greenland",c:"DKK"}, {i:308, n:"Grenada",c:"XCD"}, {i:312, n:"Guadeloupe",c:"EUR"}, {i:316, n:"Guam",c:"USD"}, {i:320, n:"Guatemala",c:"GTQ"}, {i:831, n:"Guernsey",c:"GBP"}, {i:324, n:"Guinea",c:"GNF"}, {i:624, n:"Guinea-Bissau",c:"XOF"}, {i:328, n:"Guyana",c:"GYD"}, {i:332, n:"Haiti",c:"HTG"}, {i:334, n:"Heard Island and McDonald Islands",c:"AUD"}, {i:336, n:"Vatican City",c:"EUR"}, {i:340, n:"Honduras",c:"HNL"}, {i:344, n:"Hong Kong",c:"HKD"}, {i:348, n:"Hungary",c:"HUF"}, {i:352, n:"Iceland",c:"ISK"}, {i:356, n:"India",c:"INR"}, {i:360, n:"Indonesia",c:"IDR"}, {i:364, n:"Iran",c:"IRR"}, {i:368, n:"Iraq",c:"IQD"}, {i:372, n:"Ireland",c:"EUR"}, {i:833, n:"Isle of Man",c:"GBP"}, {i:376, n:"Israel",c:"ILS"}, {i:380, n:"Italy",c:"EUR"}, {i:388, n:"Jamaica",c:"JMD"}, {i:392, n:"Japan",c:"JPY"}, {i:832, n:"Jersey",c:"GBP"}, {i:400, n:"Jordan",c:"JOD"}, {i:398, n:"Kazakhstan",c:"KZT"}, {i:404, n:"Kenya",c:"KES"}, {i:296, n:"Kiribati",c:"AUD"}, {i:408, n:"North Korea",c:"KPW"}, {i:410, n:"South Korea",c:"KRW"}, {i:414, n:"Kuwait",c:"KWD"}, {i:417, n:"Kyrgyzstan",c:"KGS"}, {i:418, n:"Laos",c:"LAK"}, {i:428, n:"Latvia",c:"EUR"}, {i:422, n:"Lebanon",c:"LBP"}, {i:426, n:"Lesotho",c:"LSL"}, {i:430, n:"Liberia",c:"LRD"}, {i:434, n:"Libya",c:"LYD"}, {i:438, n:"Liechtenstein",c:"CHF"}, {i:440, n:"Lithuania",c:"EUR"}, {i:442, n:"Luxembourg",c:"EUR"}, {i:446, n:"Macao",c:"MOP"}, {i:450, n:"Madagascar",c:"MGA"}, {i:454, n:"Malawi",c:"MWK"}, {i:458, n:"Malaysia",c:"MYR"}, {i:462, n:"Maldives",c:"MVR"}, {i:466, n:"Mali",c:"XOF"}, {i:470, n:"Malta",c:"EUR"}, {i:584, n:"Marshall Islands",c:"USD"}, {i:474, n:"Martinique",c:"EUR"}, {i:478, n:"Mauritania",c:"MRU"}, {i:480, n:"Mauritius",c:"MUR"}, {i:175, n:"Mayotte",c:"EUR"}, {i:484, n:"Mexico",c:"MXN"}, {i:583, n:"Micronesia",c:"USD"}, {i:498, n:"Moldova",c:"MDL"}, {i:492, n:"Monaco",c:"EUR"}, {i:496, n:"Mongolia",c:"MNT"}, {i:499, n:"Montenegro",c:"EUR"}, {i:500, n:"Montserrat",c:"XCD"}, {i:504, n:"Morocco",c:"MAD"}, {i:508, n:"Mozambique",c:"MZN"}, {i:104, n:"Myanmar [Burma]",c:"MMK"}, {i:516, n:"Namibia",c:"NAD"}, {i:520, n:"Nauru",c:"AUD"}, {i:524, n:"Nepal",c:"NPR"}, {i:528, n:"Netherlands",c:"EUR"}, {i:540, n:"New Caledonia",c:"XPF"}, {i:554, n:"New Zealand",c:"NZD"}, {i:558, n:"Nicaragua",c:"NIO"}, {i:562, n:"Niger",c:"XOF"}, {i:566, n:"Nigeria",c:"NGN"}, {i:570, n:"Niue",c:"NZD"}, {i:574, n:"Norfolk Island",c:"AUD"}, {i:807, n:"North Macedonia",c:"MKD"}, {i:580, n:"Northern Mariana Islands",c:"USD"}, {i:578, n:"Norway",c:"NOK"}, {i:512, n:"Oman",c:"OMR"}, {i:586, n:"Pakistan",c:"PKR"}, {i:585, n:"Palau",c:"USD"}, {i:275, n:"Palestine",c:"ILS"}, {i:591, n:"Panama",c:"PAB"}, {i:598, n:"Papua New Guinea",c:"PGK"}, {i:600, n:"Paraguay",c:"PYG"}, {i:604, n:"Peru",c:"PEN"}, {i:608, n:"Philippines",c:"PHP"}, {i:612, n:"Pitcairn Islands",c:"NZD"}, {i:616, n:"Poland",c:"PLN"}, {i:620, n:"Portugal",c:"EUR"}, {i:630, n:"Puerto Rico",c:"USD"}, {i:634, n:"Qatar",c:"QAR"}, {i:638, n:"Réunion",c:"EUR"}, {i:642, n:"Romania",c:"RON"}, {i:643, n:"Russia",c:"RUB"}, {i:646, n:"Rwanda",c:"RWF"}, {i:652, n:"Saint Barthélemy",c:"EUR"}, {i:654, n:"Saint Helena",c:"SHP"}, {i:659, n:"Saint Kitts and Nevis",c:"XCD"}, {i:662, n:"Saint Lucia",c:"XCD"}, {i:663, n:"Saint Martin",c:"EUR"}, {i:666, n:"Saint Pierre and Miquelon",c:"EUR"}, {i:670, n:"Saint Vincent and the Grenadines",c:"XCD"}, {i:882, n:"Samoa",c:"WST"}, {i:674, n:"San Marino",c:"EUR"}, {i:678, n:"São Tomé and PrÃncipe",c:"STN"}, {i:682, n:"Saudi Arabia",c:"SAR"}, {i:686, n:"Senegal",c:"XOF"}, {i:688, n:"Serbia",c:"RSD"}, {i:690, n:"Seychelles",c:"SCR"}, {i:694, n:"Sierra Leone",c:"SLL"}, {i:702, n:"Singapore",c:"SGD"}, {i:534, n:"Sint Maarten",c:"ANG"}, {i:703, n:"Slovakia",c:"EUR"}, {i:705, n:"Slovenia",c:"EUR"}, {i:90, n:"Solomon Islands",c:"SBD"}, {i:706, n:"Somalia",c:"SOS"}, {i:710, n:"South Africa",c:"ZAR"}, {i:239, n:"South Georgia and the South Sandwich Islands",c:"GBP"}, {i:728, n:"South Sudan",c:"SSP"}, {i:724, n:"Spain",c:"EUR"}, {i:144, n:"Sri Lanka",c:"LKR"}, {i:729, n:"Sudan",c:"SDG"}, {i:740, n:"Suriname",c:"SRD"}, {i:744, n:"Svalbard and Jan Mayen",c:"NOK"}, {i:752, n:"Sweden",c:"SEK"}, {i:756, n:"Switzerland",c:"CHF"}, {i:760, n:"Syria",c:"SYP"}, {i:158, n:"Taiwan",c:"TWD"}, {i:762, n:"Tajikistan",c:"TJS"}, {i:834, n:"Tanzania",c:"TZS"}, {i:764, n:"Thailand",c:"THB"}, {i:626, n:"East Timor",c:"USD"}, {i:768, n:"Togo",c:"XOF"}, {i:772, n:"Tokelau",c:"NZD"}, {i:776, n:"Tonga",c:"TOP"}, {i:780, n:"Trinidad and Tobago",c:"TTD"}, {i:788, n:"Tunisia",c:"TND"}, {i:792, n:"Turkey",c:"TRY"}, {i:795, n:"Turkmenistan",c:"TMT"}, {i:796, n:"Turks and Caicos Islands",c:"USD"}, {i:798, n:"Tuvalu",c:"AUD"}, {i:800, n:"Uganda",c:"UGX"}, {i:804, n:"Ukraine",c:"UAH"}, {i:784, n:"United Arab Emirates",c:"AED"}, {i:826, n:"United Kingdom",c:"GBP"}, {i:840, n:"United States",c:"USD"}, {i:581, n:"U.S. Minor Outlying Islands",c:"USD"}, {i:858, n:"Uruguay",c:"UYU"}, {i:860, n:"Uzbekistan",c:"UZS"}, {i:548, n:"Vanuatu",c:"VUV"}, {i:862, n:"Venezuela",c:"VES"}, {i:704, n:"Vietnam",c:"VND"}, {i:92, n:"British Virgin Islands",c:"USD"}, {i:850, n:"U.S. Virgin Islands",c:"USD"}, {i:876, n:"Wallis and Futuna",c:"XPF"}, {i:732, n:"Western Sahara",c:"MAD"}, {i:887, n:"Yemen",c:"YER"}, {i:894, n:"Zambia",c:"ZMW"}, {i:716, n:"Zimbabwe",c:"ZWL"}]; 31 32 33document.documentElement.style.setProperty('--vh', (window.innerHeight * 0.01) + 'px'); 34window.addEventListener('resize', () => { 35 document.documentElement.style.setProperty('--vh', (window.innerHeight * 0.01) + 'px'); 36}), 37 38 39 40$.urlParam = function (name) { 41 var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href); 42 if (results == null) 43 return null; 44 else 45 return results[1] || null; 46} 47 48var cur_table_idx = 0; 49var lastVueUpdated = 0; 50var isSuper = $.urlParam('super'); 51var all_cf_suggestion = null; 52var max_level = 3, my_pages = null, activeFolder = $.urlParam('folder'); 53activeFolder = {id: activeFolder !== null ? activeFolder : 0}; 54createFolder = true, visibleFolders = null; 55myi18n = null; 56 57 58 59 60var dateRanges = [ 61 { id: 'today', name: 'today' }, 62 { id: 'yesterday', name: 'yesterday' }, 63 { id: 'thisWeek', name: 'thisWeek' }, 64 { id: 'lastWeek', name: 'lastWeek' }, 65 { id: 'thisMonth', name: 'thisMonth' }, 66 { id: 'lastMonth', name: 'lastMonth' }, 67 { id: 'last7days', name: 'last7days' }, 68 { id: 'last14days', name: 'last14days' }, 69 { id: 'last30days', name: 'last30days' }, 70 { id: 'thisYear', name: 'thisYear' }, 71 { id: 'lastYear', name: 'lastYear' }, 72 { id: 'allTime', name: 'allTime' }, 73 { id: 'custom', name: 'customRange' } 74]; 75 76 77 78var total_checked = null, searchContent = null, mainApp = null; 79var mainData = { 80 pageName: window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1).replace('.php', ''), 81 sendProduct: {easyMode: true, channel: 0, value: [], body: '', header: {type:'text', text: ''}, footer: '', sessions: [{title:'', value:[]}], max: 10, options: [], props:{multiple: true, checkStrictly: true}}, 82 flows: [], 83 boards: null, 84 products: null, 85 backURL: null, 86 navInfo: null, 87 pageTitle: "...", 88 wt: {name: ''}, 89 me: null, 90 bot: null, 91 cur_page: null, 92 my_pages: null, 93 breadcrumb: null, 94 searchPage: "", 95 searchGlobal: "", 96 searchBar: false, 97 help: [], 98 custom_tabs: [], 99 newbotbtt: true, 100 folders: null, 101 selectFolder:{selectedFolder: null, currentFolders: [], parents: [], action: 'Move', loading: false, notAllowed: []}, 102 form: {title: '', rows: [], data: {}, loading: false, allowEdit: true, keepOnDone: false}, 103 loading:{ 104 stauts: true, 105 msg: "Loading..." 106 }, 107 quicksave: { 108 visible: false, 109 positive: "Save", 110 positiveDisabled: false, 111 negative: { 112 url: "", 113 caption: "Cancel" 114 }, 115 }, 116 op: null, 117 activeFolder: activeFolder, 118 locale: getCookies("lang", "en"), 119 lngs: {en:{}}, 120 data:{learnMore: null}, 121 channelSelector: {data: [], callback: null}, 122 channelPreview:{qr_code: null, url:null, message:null, channelName: null}, 123 newLogo: {file: null, previewURL: null, modalM: null, uploading: false, callback: null, close: function(){ 124 mainData.newLogo.uploading = false;
125 mainData.newLogo.modalM.modal('hide'); 126 }}, 127 navMenu:[], 128 selectedTab: 'general', 129 admins: null, 130 iframe: null, 131 tabaleActions: false, 132 accountSettings: null, 133 hasNav: $.urlParam("no-nav") ? false : true, 134 customFields: [], 135 tags: null, 136 table1: {draw: 1, search: false, deepResults: [], searchResquest: null}, 137 table2: {draw: 1, search: false, deepResults: [], searchResquest: null}, 138 advancedMode: false, 139 pageshowReload: false, 140 theme: localStorage.getItem('theme') ?? 'light' 141} 142 143 144try{ 145 if(typeof moreLangs === 'undefined') 146 moreLangs = {} 147 148 149 mainLangs = MergeObjects(mainLangs, moreLangs); 150 if(document.location.href.includes('/s/')){ 151 mainLangs.en.flows = 'Funnels'; 152 mainLangs.en.flow = 'Funnel'; 153 mainLangs.en.selectFlow = "Select Funnel"; 154 mainLangs.en.send_flow = "Send Funnel"; 155 mainLangs.en.send_flow = "Send Funnel"; 156 mainLangs.en.set_custom_field = "Set Customer Field"; 157 mainLangs.en.clear_custom_field = "Clear Customer Field"; 158 mainLangs.en.sequences = 'Drip Campaigns'; 159 mainLangs.en.c_field = 'Customer Field'; 160 mainLangs.en.c_fields = 'Customer Fields'; 161 mainLangs.en.tools = 'Marketing'; 162 163 if(mainLangs.en.f){ 164 mainLangs.en.f.startFlow = "Start Funnel"; 165 mainLangs.en.f.flowVersions = "Funnel Versions"; 166 mainLangs.en.f.msg7 = 'Subscribe to Drip Campaign'; 167 mainLangs.en.f.msg8 = 'Unsubscribe From Drip Campaign'; 168 } 169 170 if(mainLangs.en.i) 171 mainLangs.en.i.subSequences = 'Subscribed Drip Campaigns'; 172 173 if(mainLangs.en.u){ 174 mainLangs.en.u.msg0 = 'Customer Fields With Value'; 175 mainLangs.en.u.msg1 = 'Customer Fields With no Value'; 176 mainLangs.en.u.msg3 = 'Viewed Funnels/Steps' 177 } 178 179 } 180 181 myi18n = new VueI18n({ 182 locale: mainData.locale, 183 fallbackLocale: "en", 184 messages: mainLangs, 185 silentFallbackWarn: true 186 }); 187 188 mainData.loading.msg = myi18n.t('loading'); 189 mainData.quicksave.positive = myi18n.t('save'); 190 mainData.quicksave.negative.caption = myi18n.t('cancel'); 191 192 if(typeof dtb_lng !== 'undefined' ) 193 dtb_lng.search = "_INPUT_"; 194 195 196 197 198 renderI18n('[data-v-t]'); 199}catch(ex){} 200 201var vueMethods = { 202 goBack(timeout){ 203 if(timeout){ 204 setTimeout(function(){window.location.href = mainData.quicksave.negative.url}, timeout) 205 }else 206 window.location.href = mainData.quicksave.negative.url; 207 }, 208 showDivChange(e){ 209 div_save_changes(true); 210 }, 211 changeLanguage(){ 212 setCookies("lang", mainData.locale); 213 location.reload(); 214 } 215} 216 217window.addEventListener('load', function() { 218 $vueapp = $('.vueapp'); 219 220 try{ 221 //myi18n.t('syncMessage') 222 //myi18n.locale="pt" 223 224 for(i = 0; i < $vueapp.length; i++){ 225 mainApp = new Vue({ 226 el: $vueapp[i] , 227 data: mainData, 228 i18n: myi18n, 229 components: myComponets, 230 methods: vueMethods, 231 mounted: function () { 232 if(!lastVueUpdated) 233 listenEventsAfterVue(); 234 235 lastVueUpdated = getTimestamp(true); 236 this.$nextTick(function () { 237 setTimeout(() => { 238 if(getTimestamp(true) - lastVueUpdated >= 1000){ 239 lastVueUpdated =getTimestamp(true); 240 listenEventsAfterVue(); 241 } 242 }, 1000); 243 244 }) 245 }, 246 updated: function () { 247 lastVueUpdated = getTimestamp(true); 248 this.$nextTick(function () { 249 setTimeout(() => { 250 if(getTimestamp(true) - lastVueUpdated > 1){ 251 lastVueUpdated =getTimestamp(true); 252 listenEventsAfterVue(); 253 } 254 }, 1000); 255 }) 256 } 257 }) 258 } 259 260 }catch(ex){ 261 for(i = 0; i < $vueapp.length; i++){ 262 mainApp = new Vue({ 263 el: $vueapp[i] , 264 data: mainData, 265 methods:{ 266 showDivChange(e){ 267 div_save_changes(true); 268 } 269 } 270 }) 271 } 272 } 273 274 275 276 setTimeout(() => { 277 $('[data-toggle="tooltip"], [data-toggle-second="tooltip"]').tooltip(); 278 }, 3000); 279 280 init_search_bar(); 281 282 $("emoji-picker").css({display: 'none'}); 283}) 284 285function listenEventsAfterVue(){ 286 handleCbxAll(); 287 if(all_cf_suggestion){ 288 cf_enable_suggestions('.vueapp .cf_suggestions', all_cf_suggestion); 289 emojiEvents('.vueapp'); 290 } 291} 292 293 294 295
296function testForm(){ 297 let form = {title: myi18n.t('edit'), rows: [ 298 {id:"country", label: "country", value:""}, 299 { 300 id:"player", 301 checkNested: true, 302 type:"select", label: "Test Select", value: null, multiple: false, keyId:'id', keyLabel:'name', 303 options: [ 304 {id: 12, name: "Messi"}, 305 { 306 id: 13, name: "CR7", nested:[{id: 'age', label: "Age", value:"", parent: 'player'}] 307 } 308 ] 309 }, 310 {id:"team", label: "Team", value:""}, 311 { 312 id:"player1", 313 checkNested: true, 314 type:"select", label: "Test Select 1", value: null, multiple: false, keyId:'id', keyLabel:'name', 315 options: [ 316 {id: 12, name: "Messi"}, 317 { 318 id: 14, name: "CR7", nested:[{id: 'age1', label: "Age", value:"", parent: 'player1'}] 319 }, 320 {id: 14, name: "Neymar"}, 321 ] 322 } 323 ] 324 } 325 326 327 showForms(form, function(data){ 328 console.log(JSON.stringify(data)); 329 }) 330} 331 332 333function preInputForm(item){ 334 if(!item.placeholder) 335 item.placeholder = ''; 336 337 if(item.required === undefined) 338 item.required = true; 339 340 if(!item.type) 341 item.type = 'text'; 342 343 if(item.type == 'select'){ 344 if(item.multiple === undefined) 345 item.multiple = false; 346 347 if(!item.keyId) 348 item.keyId = 'id'; 349 350 if(!item.keyLabel) 351 item.keyLabel = 'name'; 352 } 353 354 if(!item.maxrows) 355 item.maxrows = 5; 356 357 return item; 358} 359 360function formChanged(item){ 361 if(item && item.onChange !== undefined){ 362 item.onChange(item); 363 } 364 365 366 if(!item || item.checkNested){ 367 368 369 370 371 let rows = cloneObj(mainData.form.initialRows); 372 373 let finalRows = []; 374 let curRows = mainData.form.rows; 375 376 377 378 for(let m = 0; m < rows.length; ++m){ 379 for(let p = 0; p < curRows.length; ++p){ 380 if(!rows[m] || !curRows[p]) 381 continue 382 383 if(rows[m].id == curRows[p].id){ 384 rows[m].value = curRows[p].value; 385 finalRows.push(rows[m]); 386 387 388 if(rows[m].checkNested){ 389 for(let a = 0; a < rows[m].options.length; ++a){ 390 for(let b = p; b < curRows.length; ++b){ 391 if(curRows[b].id == rows[m].id && rows[m].options[a].id == curRows[b].value){ 392 if(rows[m].options[a].nested){ 393 for(let i = 0; i < rows[m].options[a].nested.length; ++i){ 394 let nestedRows = []; 395 for(let j = p; j < curRows.length; ++j){ 396 if(rows[m].options[a].nested[i].id == curRows[j].id && (!item || item.id != rows[m].id)){ 397 rows[m].options[a].nested[i].value = curRows[j].value; 398 399 if(rows[m].options[a].nested[i].checkNested && rows[m].options[a].nested[i].value !== null){ 400 401 for(let t = 0; t < rows[m].options[a].nested[i].options.length; ++t){ 402 if(rows[m].options[a].nested[i].options[t].id == rows[m].options[a].nested[i].value){ 403 404 for(let y = 0; y < curRows.length; ++y){ 405 if(rows[m].options[a].nested[i].options[t].id == curRows[j].id && (!item || item.id != rows[m].id && item.id != rows[m].options[a].id)){ 406 rows[m].options[a].nested[i].options[t].value = curRows[y].value; 407 } 408 } 409 410 nestedRows = rows[m].options[a].nested[i].options[t].nested; 411 } 412 } 413 } 414 415 } 416 } 417 418 if(rows[m].options[a].nested[i]) 419 finalRows.push(preInputForm(rows[m].options[a].nested[i])); 420 421 for(let ii = 0; ii < nestedRows.length; ++ii){ 422 if(nestedRows[ii]) 423 finalRows.push(preInputForm(nestedRows[ii])); 424 } 425 426 } 427 } 428 } 429 } 430 } 431 } 432 } 433 434 } 435 } 436 437 mainData.form.rows = finalRows; 438 439 if(item) 440 formChanged(null); 441 } 442} 443 444function showForms(data, callback, checkFormChange){ 445 mainData.form.rows = []; 446 mainData.form.allowEdit = true; 447 448 let rows = [] 449 for(let i = 0; i < data.rows.length; i++){ 450 if(data.rows[i]) 451 rows.push(preInputForm(data.rows[i])); 452 } 453 454 data.rows = rows; 455 456 mainData.form.initialRows = cloneObj(data.rows); 457 458 for(let i = 0; i < data.rows.length; i++){ 459 data.rows[i] = preInputForm(data.rows[i]); 460 if(data.rows[i].loading && data.rows[i].options === null){ 461 mainData.form.allowEdit = false;
462 execute_request(data.rows[i].requestParam, null, null, false, function (r) { 463 if (r.status == "OK"){ 464 mainData.form.allowEdit = true; 465 data.rows[i].loading = false; 466 467 let options; 468 if(r.data !== undefined) 469 options = r.data; 470 else 471 options = r.results; 472 473 data.rows[i].options = options; 474 475 476 if(data.rows[i].firstRows) 477 data.rows[i].options = data.rows[i].firstRows.concat(data.rows[i].options); 478 479 let value = data.rows[i].value; 480 if(value && options.length && data.rows[i].forceValue){ 481 let findValue = false; 482 for(let ii = 0; ii < options.length; ++ii){ 483 if(options[ii].id === value){ 484 findValue = true; 485 break; 486 } 487 } 488 489 if(!findValue) 490 data.rows[i].value = options[0].id; 491 } 492 493 mainData.form.initialRows = cloneObj(data.rows); 494 mainData.form.rows = data.rows; 495 if(checkFormChange) 496 formChanged(null); 497 } 498 }); 499 } 500 501 502 if(data.rows[i].checkNested){ 503 for(let j = 0; j < data.rows[i].options.length; j++){ 504 if(!data.rows[i].options[j]) 505 continue 506 507 if(data.rows[i].options[j].nested){ 508 for(let m = 0; m < data.rows[i].options[j].nested.length; m++){ 509 if(!data.rows[i].options[j].nested[m]) 510 continue 511 512 if(data.rows[i].options[j].nested[m].loading && data.rows[i].options[j].nested[m].options === null){ 513 mainData.form.allowEdit = false; 514 execute_request(data.rows[i].options[j].nested[m].requestParam, null, null, false, function (r) { 515 if (r.status == "OK"){ 516 mainData.form.allowEdit = true; 517 data.rows[i].options[j].nested[m].loading = false; 518 519 let options; 520 if(r.data !== undefined) 521 options = r.data; 522 else 523 options = r.results; 524 525 data.rows[i].options[j].nested[m].options =options 526 527 if(data.rows[i].options[j].nested[m].firstRows) 528 data.rows[i].options[j].nested[m].options = data.rows[i].options[j].nested[m].firstRows.concat(data.rows[i].options[j].nested[m].options); 529 530 let value = data.rows[i].options[j].nested[m].value; 531 if(value && options.length && data.rows[i].options[j].nested[m].forceValue){ 532 let findValue = false; 533 for(let ii = 0; ii < options.length; ++ii){ 534 if(options[ii].id === value){ 535 findValue = true; 536 break; 537 } 538 } 539 540 if(!findValue) 541 data.rows[i].options[j].nested[m].value = options[0].id; 542 } 543 544 545 mainData.form.rows = data.rows; 546 mainData.form.initialRows = cloneObj(data.rows); 547 if(checkFormChange) 548 formChanged(null); 549 } 550 }); 551 } 552 553 if(data.rows[i].options[j].nested[m].checkNested){ 554 555 for(let ii = 0; ii < data.rows[i].options[j].nested[m].options.length; ++ii){ 556 if(data.rows[i].options[j].nested[m].options[ii].id === data.rows[i].options[j].nested[m].value){ 557 for(let jj = 0; jj < data.rows[i].options[j].nested[m].options[ii].nested.length; ++jj){ 558 if(data.rows[i].options[j].nested[m].options[ii].nested[jj]) 559 data.rows.push(data.rows[i].options[j].nested[m].options[ii].nested[jj]); 560 } 561 } 562 } 563 } 564 } 565 } 566 567 } 568 } 569 } 570 571 572 573 574 mainData.form.title = data.title; 575 mainData.form.rows = data.rows; 576 mainData.form.callback = callback; 577 mainData.form.keepOnDone = data.keepOnDone; 578 mainData.form.loading = data.loading !== undefined ? data.loading : false;
579 mainData.form.formWide = data.formWide ? true : false; 580 581 582 if(checkFormChange){ 583 formChanged(null); 584 formChanged(null); 585 } 586 587 588 let modal = $("#mainForm"); 589 if(!mainData.form.keepOnDone) 590 modal.modal('show'); 591 592 modal.find(".positive").off("click").click(function(){ 593 let rows = mainData.form.rows; 594 for(let i = 0; i < rows.length; i++){ 595 if(rows[i].required && (rows[i].value === '' || rows[i].value === null)){ 596 msg_error(myi18n.t('msg10')); 597 return; 598 } 599 } 600 601 602 603 604 if(mainData.form.rows[0].id){ 605 let val = {}; 606 for(let i = 0; i < rows.length; ++i){ 607 let row = rows[i]; 608 if(!row) 609 continue; 610 611 if(row.type == 'saveTocustomField' || row.type == 'customFieldTo'){ 612 val[row.id] = []; 613 let mapping = row.mapping; 614 615 for(let j = 0; j < mapping.length; j++){ 616 if(mapping[j].input !== '' && mapping[j].saveTo) 617 val[row.id].push({input: mapping[j].input, saveTo: mapping[j].saveTo}) 618 } 619 }else if(row.type == 'textToText'){ 620 val[row.id] = []; 621 let mapping = row.mapping; 622 for(let j = 0; j < mapping.length; j++) 623 val[row.id].push({name: mapping[j].name, value: mapping[j].value}) 624 } 625 else if(row.type == 'createOptions'){ 626 let options = []; 627 for(let i = 0; i < row.value.length; i++){ 628 value = row.value[i].value.trim(); 629 if(value !== '') 630 options.push(value); 631 } 632 633 if(options.length < row.mininum){ 634 msg_error(myi18n.t('msg10')); 635 return; 636 } 637 638 val[row.id] = options; 639 640 }else 641 val[row.id] = row.value; 642 } 643 644 if(!mainData.form.keepOnDone) 645 modal.modal('hide'); 646 647 648 callback(val); 649 }else{ 650 if(!mainData.form.keepOnDone) 651 modal.modal('hide'); 652 653 callback(cloneObj(rows)); 654 } 655 656 657 658 659 }) 660 661} 662 663 664 665 666 667 668if (window.location.hash == "#_=_") 669 window.location.hash = ""; 670 671var my_perm = null; 672var cur_page = null; 673var accessToken = null; 674var my_fb_id = null; 675var appDomain = null, appFbId = null, fbRedirect = '', wtID; 676 677 678var whitelabel = null; 679if(docCookies.getItem("wt") && !location.href.includes("/admins/")){ 680 try{ 681 whitelabel = JSON.parse(docCookies.getItem("wt")); 682 }catch(ex){ 683 whitelabel = JSON.parse(urldecode(docCookies.getItem("wt"))); 684 } 685 686 if(!whitelabel.dynamic){ 687 checkWhitelabel(); 688 }else{ 689 mainData.wt = whitelabel; 690 mainData.navMenu = whitelabel.dynamic.menu; 691 appDomain = whitelabel.appdomain; 692 if(whitelabel.fb){ 693 appFbId = whitelabel.fb.app; 694 fbRedirect = whitelabel.fb.redirect; 695 }else{ 696 appFbId = null; 697 fbRedirect = null; 698 } 699 700 wtID = whitelabel.id; 701 sfHideContents(); 702 } 703 704 705}else{ 706 checkWhitelabel(); 707} 708 709 710// ============================================================================== Loading.js ============================================================= // 711 712 713function pb_show(visible, msg) { 714 if (typeof msg !== "undefined") 715 msg = "<pre class\"txt_loading\">" + msg + "</pre>"; 716 else 717 msg = myi18n ? myi18n.t('loading') : myi18n.t('loading'); 718 719 mainData.loading.stauts = visible; 720 mainData.loading.msg = msg; 721 $("#p_pb_info").html(msg); 722} 723 724 725var pgb_load_data_stop = 0; 726function pgb_load_data_show(visible) { 727 if (visible) { 728 $("#pgb_load_data").show(); 729 pb_stop = 0; 730 var pb = $('#pgb_load_data').circleProgress({ 731 value: 1, 732 size: 25, 733 lineCap: "round", 734 reverse: false, 735 thickness: 2, 736 emptyFill: "rgba(0, 0, 0, .2)", 737 fill: { 738 color: "rgba(0, 0, 0, .5)" 739 } 740 }); 741 742 pb.on('circle-animation-end', function (event) { 743 if (pgb_load_data_stop >= 0) { 744 pb.circleProgress('value', pgb_load_data_stop % 2); 745 pgb_load_data_stop++; 746 } 747 }); 748 } else { 749 pgb_load_data_stop = -1; 750 $("#pgb_load_data").hide(); 751 } 752} 753 754 755 756 757 758 759 760 761 762 763function show_fb_error(fb_error){ 764 if(fb_error !== undefined && fb_error.error != undefined){ 765 var error = fb_error.error; 766 if(error.error_user_title !== undefined) 767 show_model(true, error.error_user_title+"<br><br>"+error.error_user_msg, 'OK', ''); 768 else 769 show_model(true, error.message,'OK', ''); 770 }else 771 msg_error(myi18n.t('msg0')); 772} 773 774 775 776// ============================================================================== model.js ============================================================= // 777$("#model").html('<div id="modal_main" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"><div class="modal-header"> <div class="invisible"></div><h5 class="modal-title"></h5> <div class="modal-dismiss" data-dismiss="modal" aria-label="Close"> <i class="fal fa-times"></i> </div></div> <div class="modal-body"> <p id="p_msg" style="max-width: 100% !important; overflow-x: hidden !important"></p></div><div class="modal-footer"> <div class="d-flex px-3 py-2 justify-content-between w-100"> <button id="btt_cancel" data-dismiss="modal" type="button" class="btn btn-outline-secondary nagative">Cancel</button> <button id="btt_yes" data-dismiss="modal" type="button" class="btn btn-primary positive">Continue</button> </div></div></div></div></div>'); 778function show_model(b_visible, smg, str_ok, str_btt_cancel, function_ok, title) { 779 let modalM = $("#modal_main"); 780 if (b_visible) { 781
782 let header = modalM.find('.modal-header'); 783 let footer = modalM.find('.modal-footer'); 784 let btt_yes = modalM.find("#btt_yes"); 785 786 if( title != null && title != undefined){ 787 header.removeClass('hide'); 788 header.find(".modal-title").html(title); 789 }else 790 header.addClass('hide'); 791 792 793 modalM.find("#p_msg").html(smg); 794 if(str_ok != "" && str_ok != undefined){ 795 footer.removeClass('hide'); 796 btt_yes.html(str_ok); 797 }else 798 footer.addClass('hide'); 799 800 let btt_cancel = modalM.find("#btt_cancel") 801 btt_yes.unbind('click'); 802 btt_cancel.unbind('click'); 803 804 805 if (str_btt_cancel != "" && str_btt_cancel != undefined) { 806 btt_cancel.html(str_btt_cancel); 807 btt_cancel.removeClass('invisible'); 808 } else 809 btt_cancel.addClass('invisible'); 810 811 812 813 814 if(function_ok != undefined){ 815 footer.removeClass("hide"); 816 btt_yes.click(function_ok); 817 } 818 819 820 modalM.modal('show'); 821 } else 822 modalM.modal('close'); 823} 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839var simplified = $("body").data("simplified") == "1" || location.href.includes('/s/'); 840 841function msg_success(text, delay, title){ 842 try{ 843 if(!text && !title) 844 mainApp.$notify({title: myi18n.t('success'), message: text, type: 'success'}).$notify({title: myi18n.t('success'), message: text, type: 'success'}) 845 else 846 mainApp.$notify({title: title ? title : null, message: text, type: 'success'}) 847 return 848 }catch(ex){} 849 850 if(text === undefined){ 851 text = myi18n ? myi18n.t('success') : 'Success'; 852 var width = '200px'; 853 }else 854 var width = '360px'; 855 856 857 858 859 if(!delay) 860 delay = 2000; 861 862 PNotify.success({ 863 stack: {'dir1': 'right', 'dir2': 'up', 'firstpos1': 25, 'firstpos2': 25}, 864 text: text, 865 icon: false, 866 delay: delay, 867 width: width, 868 modules: { 869 Animate: { 870 animate: true, 871 inClass: 'rotateInUpRight', 872 outClass: 'bounceOut' 873 } 874 } 875 }); 876} 877 878 879function msg_error(text, delay){ 880 if(text === undefined){ 881 text = myi18n.t('msg0'); 882 var width = '200px'; 883 }else 884 var width = '360px'; 885 886 887 if(delay === undefined) 888 delay = 4000; 889 890 PNotify.error({ 891 stack: {'dir1': 'right', 'dir2': 'up', 'firstpos1': 25, 'firstpos2': 25}, 892 text: text, 893 icon: false, 894 delay: delay, 895 width: width, 896 modules: { 897 Animate: { 898 animate: true, 899 inClass: 'rotateInUpRight', 900 outClass: 'bounceOut' 901 } 902 } 903 }); 904} 905 906 907 908//docCookies.setItem("lang", 'en', Infinity, "/bots/"); 909 910 911 912 $(document).ready(function () { 913 if(!mainData.hasNav) 914 $('body').addClass('no-nav'); 915 916 sfHideContents(); 917 let forder_C_C = $(".forder_C_C"); 918 if(forder_C_C){ 919 forder_C_C.addClass("margen_auto").addClass("mt-5").addClass("mb-5").addClass("px-0"); 920 forder_C_C.append('<div> <nav aria-label="breadcrumb"> <ol class="breadcrumb bfolder mb-0"> </ol> </nav> </div><div class="forder_C row "> </div>'); 921 } 922 923 924 try{ 925 $('[data-toggle="tooltip"], [data-toggle-second="tooltip"]').tooltip(); 926 }catch(ex){} 927 928 929 handleCbxAll(); 930 931 932 try{ 933 if(/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)) 934 $('.selectpicker').selectpicker('mobile'); 935 }catch(ex){} 936 937 var all_div_dismiss_info = $(".div_dismiss_info"); 938 for(var i = 0; i < all_div_dismiss_info.length; i++){ 939 try{ 940 var div = all_div_dismiss_info.eq(i) 941 if(!docCookies.hasItem(div.data("information"))){ 942 get_elem_parent(div, 'margen_auto').removeClass('d-none'); 943 944 div.click(function(e){ 945 e.stopPropagation(); 946 docCookies.setItem(div.data("information"), 1, Infinity, "/"); 947 get_elem_parent(div, 'margen_auto').addClass('d-none'); 948 }) 949 950 } 951 }catch(ex){} 952 } 953 }); 954 955 956 957 function handleCbxAll(){ 958 try{ 959 if(total_checked.length > 0){ 960 $(".tb_cbx_all").off("change").on("change", function(){ 961 var idx = $(this).data("idx"); 962 if(this.checked) 963 total_checked[idx].total = total_checked[idx].total_data; 964 else 965 total_checked[idx].total = 0; 966 967 $('#'+total_checked[idx].table_id+' tr td:first-child input:checkbox').not(this).prop('checked', this.checked); 968 969 update_table_cbx(idx); 970 971 }); 972 } 973 }catch(ex){} 974 } 975 976 function init_search_bar(){ 977 try{ 978 979 var url = getPHPUserScript()+'?op=search-bar&op1=search&op2={query}'; 980 if(cur_page) 981 url+="&acc="+cur_page.page_id; 982 983 if(searchContent) 984 url+="&content="+searchContent; 985 986 987 $('.ui.search').search({ 988 989 apiSettings: { 990 url: url 991 }, 992 fields: { 993 results : 'results', 994 title : 'title', 995 url : 'url' 996 }, 997 minCharacters : 2, 998 searchDelay: 150, 999 maxResults: 300 1000 }); 1001 }catch(ex){} 1002 } 1003 1004 function tb_cbx_recheck(idx){ 1005 1006 total_checked[idx].total = $("#"+total_checked[idx].table_id+" .tb_cbx:checkbox:checked").length; 1007 total_checked[idx].total_data = $("#"+total_checked[idx].table_id+" .tb_cbx:checkbox").length; 1008 tb_cbx_change("#"+total_checked[idx].table_id+" "); 1009 1010 if(total_checked[idx].total != 0 && total_checked[idx].total == total_checked[idx].total_data)
1011 $(".tb_cbx_all[data-idx='"+idx+"'").prop('checked', true); 1012 else 1013 $(".tb_cbx_all[data-idx='"+idx+"'").prop('checked', false); 1014 1015 update_table_cbx(idx); 1016 } 1017 1018 1019 1020 function tb_cbx_change(table_id){ 1021 $(table_id+".tb_cbx").off("change").on("change", function(){ 1022 var idx = $(this).data("idx"); 1023 if(this.checked) 1024 total_checked[idx].total++; 1025 else 1026 total_checked[idx].total--; 1027 1028 if(total_checked[idx].total == total_checked[idx].total_data) 1029 $(".tb_cbx_all[data-idx='"+idx+"'").prop('checked', true); 1030 else 1031 $(".tb_cbx_all[data-idx='"+idx+"'").prop('checked', false); 1032 1033 1034 update_table_cbx(idx); 1035 }); 1036 } 1037 1038 function urldecode(url) { 1039 return decodeURIComponent(url.replace(/\+/g, ' ')); 1040 } 1041 1042 1043 1044 function removeParams(sParam) 1045 { 1046 var url = window.location.href.split('?')[0]+'?'; 1047 var sPageURL = decodeURIComponent(window.location.search.substring(1)), 1048 sURLVariables = sPageURL.split('&'), 1049 sParameterName, 1050 i; 1051 for (i = 0; i < sURLVariables.length; i++) { 1052 sParameterName = sURLVariables[i].split('='); 1053 if (sParameterName[0] != sParam) { 1054 url = url + sParameterName[0] + '=' + sParameterName[1] + '&' 1055 } 1056 } 1057 return url.substring(0,url.length-1); 1058 } 1059 1060 1061 function replaceUrlParam(url, paramName, paramValue) 1062 { 1063 if (paramValue == null) { 1064 paramValue = ''; 1065 } 1066 var pattern = new RegExp('\\b('+paramName+'=).*?(&|#|$)'); 1067 if (url.search(pattern)>=0) { 1068 return url.replace(pattern,'$1' + paramValue + '$2'); 1069 } 1070 url = url.replace(/[?#]$/,''); 1071 return url + (url.indexOf('?')>0 ? '&' : '?') + paramName + '=' + paramValue; 1072 } 1073 1074 1075 function numberWithSpaces(x) { 1076 return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " "); 1077 } 1078 1079 function convertLocalStrToUTC(strdate) { 1080 let d = new Date(strdate); 1081 if(d === 'Invalid Date') 1082 d = new Date(strdate.replace(/ /g,"T")); 1083 1084 return convertDateToUTC(d); 1085 } 1086 1087 1088 function getDateFormat(year){ 1089 if(year) 1090 return 'MMMM dd, yyyy h:mma'; 1091 else 1092 return 'MMMM dd, h:mma'; 1093 } 1094 1095 function convertStrTostrLocal(strdate, format){ 1096 if(format == undefined) 1097 format = myi18n.t('dateTimeFormate'); 1098 1099 let d = new Date(strdate); 1100 if(d === 'Invalid Date') 1101 d = new Date(strdate.replace(/ /g,"T")); 1102 1103 return moment(new Date(d)).format(format); 1104 } 1105 1106 function convertLocalStrToUTCStr(strdate){ 1107 var dt = new Date(strdate); 1108 return moment(convertDateToUTC(dt)).format("YYYY-MM-DD HH:mm:ss"); 1109 } 1110 1111 function convertDateToUTC(date) { 1112 return new Date(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds()); 1113 } 1114 1115 function local_str_to_UTCstr(str_local){ 1116 let d = new Date(str_local); 1117 if(d === 'Invalid Date') 1118 d = new Date(str_local.replace(/ /g,"T")); 1119 1120 return moment(convertDateToUTC(d)).format("YYYY-MM-DD HH:mm:ss"); 1121 } 1122 1123 function getRangeName(start, end, label){ 1124 if(myi18n){ 1125 if(label == myi18n.t('customRange')) 1126 return start.format(myi18n.t('dateFormate'))+ " - "+end.format(myi18n.t('dateFormate')); 1127 else 1128 return label; 1129 }else{ 1130 if(label == 'Custom Range') 1131 return start.format(myi18n.t('dateFormate'))+ " - "+end.format(myi18n.t('dateFormate')); 1132 else 1133 return label; 1134 } 1135 } 1136 1137 function get_daterange_lng(allow_time){ 1138 if(myi18n) 1139 return { 1140 format: allow_time ? myi18n.t('dateTimeFormate') : myi18n.t('dateFormate'), 1141 cancelLabel: myi18n.t('cancel'), 1142 applyLabel: myi18n.t('continue'), 1143 customRangeLabel: myi18n.t('customRange'), 1144 fromLabel: myi18n.t('from'), 1145 toLabel: myi18n.t('to'), 1146 separator: "-", 1147 1148 }; 1149 else 1150 return { 1151 "format": allow_time ? "YYYY-MM-DD HH:mm" : "YYYY-MM-DD", 1152 "separator": "-", 1153 }; 1154 } 1155 1156 function get_dsbd_ranges(){ 1157 if(myi18n){ 1158 var ranges = {} 1159 ranges[myi18n.t('today')] = [moment(), moment()]; 1160 ranges[myi18n.t('yesterday')] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')]; 1161 ranges[myi18n.t('last7days')] = [moment().subtract(6, 'days'), moment()]; 1162 ranges[myi18n.t('last30days')] = [moment().subtract(29, 'days'), moment()]; 1163 ranges[myi18n.t('thisMonth')] = [moment().startOf('month'), moment().endOf('month')]; 1164 ranges[myi18n.t('lastMonth')] = [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')] 1165 ranges[myi18n.t('lifetime')] = [moment('2010-01-01', 'YYYY-MM-DD'), moment()] 1166 1167 return ranges; 1168 }else 1169 return { 1170 'Today': [moment(), moment()], 1171 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')], 1172 'Last 7 days': [moment().subtract(6, 'days'), moment()], 1173 'Last 30 days': [moment().subtract(29, 'days'), moment()], 1174 'This month': [moment().startOf('month'), moment().endOf('month')], 1175 'Last month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')], 1176 'Lifetime': [moment('2010-01-01', 'YYYY-MM-DD'), moment()] 1177 } 1178 } 1179 1180 1181 1182 function date_to_str(date, format){ 1183 if(format === undefined) 1184 format = "YYYY-MM-DD HH:mm:ss"; 1185 1186 return moment(date).format(format); 1187 } 1188 1189 function getTimestamp(milliseconds){ 1190 if(milliseconds) 1191 return new Date().getTime(); 1192 else 1193 return Math.round(new Date().getTime()/1000); 1194 } 1195 1196 function timestamp_to_date(timestamp){ 1197 return moment.utc(new Date(timestamp*1000)); 1198 } 1199 1200 function today_as_timestamp(){ 1201 let now = new Date().getTime()/1000; 1202 return now - now % 86400; 1203 } 1204 1205 function minutesToTime(totalMinutes) { 1206 const hours = Math.floor(totalMinutes / 60); 1207 const minutes = totalMinutes % 60; 1208 return `${String(hours).padStart(2, '0')}
1208:${String(minutes).padStart(2, '0')}`; 1209 } 1210 1211 function timestamp_to_local_date(timestamp){ 1212 return moment.utc(new Date(timestamp*1000)).local(); 1213 } 1214 1215function formatMessageTimestamp(ts) { 1216 const now = new Date(); 1217 const date = new Date(ts); 1218 1219 // Formatters 1220 const timeFormatter = new Intl.DateTimeFormat([], { 1221 hour: '2-digit', 1222 minute: '2-digit' 1223 }); 1224 1225 const weekdayFormatter = new Intl.DateTimeFormat([], { 1226 weekday: 'long' 1227 }); 1228 1229 const dateFormatter = new Intl.DateTimeFormat([], { 1230 year: 'numeric', 1231 month: '2-digit', 1232 day: '2-digit' 1233 }); 1234 1235 function isSameDay(d1, d2) { 1236 return d1.toDateString() === d2.toDateString(); 1237 } 1238 1239 function isYesterday(d, now) { 1240 const yesterday = new Date(now); 1241 yesterday.setDate(now.getDate() - 1); 1242 return d.toDateString() === yesterday.toDateString(); 1243 } 1244 1245 if(isSameDay(date, now)) 1246 return timeFormatter.format(date); 1247 1248 if(isYesterday(date, now)) 1249 return myi18n.t('yesterday'); 1250 1251 const diffMs = now - date; 1252 const oneWeek = 7 * 24 * 60 * 60 * 1000; 1253 1254 if (diffMs < oneWeek) 1255 return weekdayFormatter.format(date); // "Monday" 1256 1257 return dateFormatter.format(date); // "03/10/2026" 1258} 1259 1260 function timestamp_to_local_str(timestamp, format){ 1261 try{ 1262 if(format === undefined) 1263 format = 'L LT'; 1264 1265 return moment.utc(new Date(timestamp*1000)).local().format(format); 1266 }catch(ex){} 1267 return null 1268 } 1269 1270 function local_str_to_timestamp(local_str){ 1271 return parseInt(moment(local_str).format("X")); 1272 1273 } 1274 1275 function strDate_to_short(date){ 1276 return timestampToShort(local_str_to_timestamp(date)); 1277 } 1278 1279 function timestampToShort(timestamp){ 1280 return moment.utc(new Date(timestamp*1000)).fromNow(); 1281 } 1282 1283 function utc_str_to_timestamp(utc_str){ 1284 return parseInt(moment.utc(utc_str).format("X")); 1285 } 1286 1287 1288 function UTC_to_local_strdate(str_utcTime, format, tz_offset) { 1289 if(format == undefined) 1290 format = 'L LT'; 1291 1292 if(tz_offset === undefined) 1293 tz_offset = moment().utcOffset(); 1294 1295 return moment.utc(str_utcTime).utcOffset(tz_offset).format(format); 1296 } 1297 1298 1299 function UTC_to_local_date(str_utcTime) { 1300 return moment.utc(str_utcTime).utcOffset(moment().utcOffset()).toDate(); 1301 } 1302 1303 1304 function reload_dashboard(){ 1305 pb_show(true); 1306 load_all(); 1307 } 1308 1309 function get_profile_pic(img_perfil, url, e) { 1310 img_perfil.src = url; 1311 img_perfil.style.opacity = "1"; 1312 img_perfil.style.pointerEvents = "none"; 1313 1314 if(e !== undefined) 1315 e.stopPropagation(); 1316 } 1317 1318 1319 1320 var lngs= [ 1321 {"name" : "Afrikaans", "lng": 0, "l": "af_ZA"}, {"name" : "Arabic", "lng": 1, "l": "ar_AR"}, {"name" : "Bengali", "lng": 2, "l": "bn_IN"}, 1322 {"name" : "Bosnian", "lng": 3, "l": "bs_BA"}, {"name" : "Bulgarian", "lng": 46, "l": "bg_BG"}, {"name" : "Chinese (Simplified)", "lng": 4, "l": "zh_CN"},{"name" : "Chinese (Traditional)", "lng": 42, "l": "zh_TW"},{"name" : "Dutch", "lng": 5, "l": "nl_NL"}, 1323 {"name" : "Danish", "lng": 6, "l": "da_DK"}, {"name" : "English GB", "lng": 7, "l": "en_GB"}, {"name" : "English US", "lng": 8, "l": "en_US"}, 1324 {"name" : "English", "lng": 9, "l": "en"}, {"name" : "Estonian", "lng": 10, "l": "et_EE"}, {"name" : "Filipino", "lng": 11, "l": "tl_PH"}, 1325 {"name" : "Finnish", "lng": 12, "l": "fi_FI"}, {"name" : "French", "lng": 13, "l": "fr_FR"},{"name" : "Georgian", "lng": 14, "l": "ka_GE"}, 1326 {"name" : "German", "lng": 15, "l": "de_DE"}, {"name" : "Greek", "lng": 16, "l": "el_GR"}, {"name" : "Hebrew", "lng": 48, "l": "he_IL"}, {"name" : "Hind", "lng": 17, "l": "hi_IN"}, 1327 {"name" : "Hungarian", "lng": 18, "l": "hu_HU"},{"name" : "Indonesian", "lng": 19, "l": "id_ID"},{"name" : "Italian", "lng": 20, "l": "it_IT"}, 1328 {"name" : "Japanese", "lng": 21, "l": "ja_JP"},{"name" : "Khmer", "lng": 45, "l": "km_KH"},{"name" : "Korean", "lng": 22, "l": "ko_KR"}, {"name" : "Latvian", "lng": 23, "l": "lv_LV"}, 1329 {"name" : "Lithuanian", "lng": 24, "l": "lt_LT"}, {"name" : "Malay", "lng": 25, "l": "ms_MY"}
1329, {"name" : "Norwegian", "lng": 26, "l": "nb_NO"}, 1330 {"name" : "Pashto", "lng": 43, "l": "ps_AF"},{"name" : "Persian", "lng": 44, "l": "fa_IR"},{"name" : "Polish", "lng": 27, "l": "pl_PL"}, {"name" : "Portuguese BR", "lng": 28, "l": "pt_BR"}, {"name" : "Portuguese PT", "lng": 29, "l": "pt_PT"}, 1331 {"name" : "Romanian", "lng": 30, "l": "ro_RO"},{"name" : "Russian", "lng": 31, "l": "ru_RU"}, {"name" : "Serbian", "lng": 32, "l": "sr_RS"}, 1332 {"name" : "Slovak", "lng": 33, "l": "sk_SK"},{"name" : "Slovenian", "lng": 34, "l": "sl_SI"}, {"name" : "Spanish", "lng": 35, "l": "es_ES"}, 1333 {"name" : "Swedish", "lng": 36, "l": "sv_SE"}, {"name" : "Thai", "lng": 37, "l": "th_TH"},{"name" : "Turkish", "lng": 38, "l": "tr_TR"}, 1334 {"name" : "Ukrainian", "lng": 39, "l": "uk_UA"}, {"name" : "Urdu", "lng": 40, "l": "ur_PK"}, {"name" : "Vietnamese", "lng": 41, "l": "vi_VN"}, 1335 ] 1336 1337 1338 1339 function lng_tostring(lng, default_name) { 1340 for(var i = 0; i < lngs.length; i++){ 1341 if(lngs[i].lng == lng) 1342 return lngs[i].name; 1343 } 1344 1345 if(default_name !== undefined) 1346 return default_name; 1347 else 1348 return myi18n.t('unknown'); 1349 } 1350 1351 1352 function locale_tostring(locale) { 1353 if(locale === 'default') 1354 return locale; 1355 for(var i = 0; i < lngs.length; i++){ 1356 if(lngs[i].l == locale) 1357 return lngs[i].name; 1358 } 1359 1360 return myi18n.t('unknown'); 1361 } 1362 1363 function get_lngFromlng(lng){ 1364 for(var i = 0; i < lngs.length; i++){ 1365 if(lngs[i].lng == lng) 1366 return lngs[i]; 1367 } 1368 1369 return {"name" : myi18n.t('unknown'), "lng": -1, "l": "_"}; 1370 } 1371 1372 1373 1374 function check_error(json, default_error) { 1375 if(json instanceof Array && json.length){ 1376 for(let i = 1; i < json.length; i++) 1377 check_error(json[i]); 1378 1379 json = json[0]; 1380 } 1381 1382 1383 if (json.status == "OK" && json.code != 99) 1384 return true; 1385 1386 1387 1388 if (json.code == 1) { 1389 let url = ''; 1390 if(whitelabel) 1391 url = whitelabel.appdomain+whitelabel.folder+"/login"; 1392 else 1393 url = '/en/login'; 1394 1395 if(!json.forced) 1396 url+= "?r="+encodeURIComponent(window.location.href); 1397 1398 1399 window.location.href = url; 1400 } else if (json.code == 4 || json.code == 2) { 1401 got_page_error(json.code == 4 ? 0 : 1); 1402 }else if (json.code == 10) { 1403 let data = json.data; 1404 show_connectBotToAdmin(data.ref, data.channel, data.text, 'connect'); 1405 return true; 1406 }else if (json.code == 14) { 1407 let data = json.data; 1408 show_connectBotToAdmin(data.ref, data.channel, data.text, 'interact'); 1409 return true; 1410 }else if (json.code == 403) { 1411 let msg; 1412 1413 if(json.subcode == 1) 1414 msg = myi18n.t('msg47'); 1415 else if(json.data && json.data.i18n) 1416 msg = myi18n.t(json.data.i18n); 1417 else if(json.data && json.data.message) 1418 msg = json.data.message; 1419 else if(json.message) 1420 msg = message 1421 else if(json.subcode == 2) 1422 msg = myi18n.t('msg48'); 1423 else 1424 return false; 1425 1426 setTimeout(function (){ 1427 show_model(true, msg, myi18n.t('ok'), "", ""); 1428 }, 700); 1429 1430 }else if (json.code == 15) { 1431 show_model(true, myi18n.t('msg31'), myi18n.t('errorLog'), myi18n.t('cancel'), ""); 1432 $("#btt_yes").click(function () { 1433 open_link('error-log?acc='+cur_page.page_id, 1); 1434 }); 1435 return true; 1436 }else if (json.code == 71) { 1437 setTimeout(function (){ 1438 show_model(true, myi18n.t('msg32'), myi18n.t('ok'), "", ""); 1439 }, 700); 1440 return true; 1441 }else if (json.code == 73) { 1442 setTimeout(function (){ 1443 show_model(true, myi18n.t('u.msg23'), myi18n.t('ok'), "", ""); 1444 }, 700); 1445 return true; 1446 }else if (json.code == 98 && json.msg) { 1447 setTimeout(function(){ 1448 show_model(true, json.msg, myi18n.t('ok'), "", ""); 1449 }, 700) 1450 return true; 1451 }else if (json.code == 1000) { 1452 let str = myi18n.t('msg14_0'); 1453 if(json.data) 1454 str+="<br><br><b>"+json.data.name+"</b>"; 1455 1456 show_model(true, str, myi18n.t('ok'), "", ""); 1457 return true; 1458 }else if (json.code == 99) { 1459 if(json.url){ 1460 if(json.new_window) 1461 open_link(json.url, 1); 1462 else if(json.iframe) 1463 loadIframe(json.url); 1464 else 1465 window.location.href = json.url; 1466 }else 1467 window.location.reload(); 1468 1469 return true; 1470 }else if (default_error) { 1471 show_model(true, get_str(22, json.code), myi18n.t('ok'), "", ""); 1472 return true; 1473 } 1474 1475 return false;
1476 } 1477 1478 $(".icon_info").click(function () { 1479 var info = $(this).data("info"); 1480 show_model(true, info, myi18n.t('ok'), "", ""); 1481 }); 1482 1483 function got_page_error(code) { 1484 if(whitelabel){ 1485 if(code !== undefined) 1486 window.location.href = whitelabel.appdomain+whitelabel.folder+"/error?code="+code; 1487 else 1488 window.location.href = whitelabel.appdomain+whitelabel.folder+"error"; 1489 }else{ 1490 if(code !== undefined) 1491 window.location.href = "error?code="+code; 1492 else 1493 window.location.href = "error"; 1494 } 1495 1496 } 1497 1498 1499 function isURL(str){ 1500 try { 1501 if(str.startsWith('viber://')) 1502 return true; 1503 1504 if(str.startsWith('data:')){ 1505 show_model(true, 'It seems that you copied the image on Google. You need to click on the image, wait for the image to load, and copy the image address.', 'OK', ''); 1506 return false; 1507 } 1508 1509 new URL(str); 1510 return true; 1511 } catch (_) { 1512 return false; 1513 } 1514 } 1515 1516 1517 1518 function removeParam(key, sourceURL) { 1519 var rtn = sourceURL.split("?")[0], 1520 param, 1521 params_arr = [], 1522 queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : ""; 1523 if (queryString !== "") { 1524 params_arr = queryString.split("&"); 1525 for (var i = params_arr.length - 1; i >= 0; i -= 1) { 1526 param = params_arr[i].split("=")[0]; 1527 if (param === key) { 1528 params_arr.splice(i, 1); 1529 } 1530 } 1531 if(params_arr.length > 1) 1532 rtn = rtn + "?" + params_arr.join("&"); 1533 1534 } 1535 return rtn; 1536 } 1537 1538 1539 1540 function gender_tostring(gender) { 1541 if(myi18n){ 1542 if (gender == 0) 1543 return myi18n.t('female'); 1544 else if (gender == 1) 1545 return myi18n.t('male'); 1546 else 1547 return myi18n.t('unknown'); 1548 }else{ 1549 if (gender == 0) 1550 return myi18n.t('female'); 1551 else if (gender == 1) 1552 return myi18n.t('male'); 1553 else 1554 return get_str(7); 1555 } 1556 1557 } 1558 1559 function info_value(text){ 1560 return "<span class=\"txt_primary_color\">"+text+"</span>"; 1561 } 1562 1563 1564 $(".popup_box_c").click(function (){ 1565 $(this).hide(); 1566 }); 1567 1568 1569 function rank_to_str(rank) { 1570 if (rank == 10) 1571 return myi18n.t('default'); 1572 else 1573 return rank; 1574 } 1575 1576 1577 1578 function replace_boturl(){ 1579 var all_a = $("a[data-boturl='1']"); 1580 for(var i = 0; i < all_a.length; i++){ 1581 var href = all_a.eq(i).attr('href'); 1582 all_a.eq(i).attr('href', href.replace("00000000", my_perm.page_id)); 1583 } 1584 } 1585 1586 1587 1588 function manage_bot(page_id){ 1589 pb_show(true); 1590 let param = { "op": "manage_bot", "page_id": page_id}; 1591 execute_request(param, null, null, false, function (data) { 1592 if(data.status == "OK"){ 1593 window.location.href = replaceUrlParam(window.location.href, 'acc', page_id); 1594 }else if(!check_error(data)) 1595 pb_show(false); 1596 }) 1597 } 1598 1599 function goToInbox(ms_id){ 1600 window.location.href="inbox?id="+ms_id+"&acc="+cur_page.page_id; 1601 } 1602 1603 1604 1605 function delete_one(btt, table_id, id, op) { 1606 show_model(true, myi18n.tc('msg2', 1)+' '+myi18n.t('msg3'), myi18n.t('delete'), myi18n.t('cancel'), ""); 1607 $("#btt_yes").click(function () { 1608 pb_show(true, myi18n.t('processing')); 1609 let param = {op: op, op1: "delete", id: id }; 1610 execute_request(param, null, null, false, function (data) { 1611 pb_show(false); 1612 setTimeout(function () { 1613 if (data.status == "OK") { 1614 $("#t_contextMenu").appendTo("body"); 1615 $(table_id).DataTable().row($("#tr"+id)).remove().draw(); 1616 } 1617 }, 500); 1618 }) 1619 1620 }); 1621 } 1622 1623 1624 1625 function update_table_cbx(idx) { 1626 let bttID = total_checked[idx].bttdel ? total_checked[idx].bttdel : '#btt_tb_global_del'; 1627 if (total_checked[idx].total > 0){ 1628 $(bttID).removeClass("hide"); 1629 mainData.tabaleActions = true; 1630 }else{ 1631 mainData.tabaleActions = false;
1632 $(bttID).addClass("hide"); 1633 } 1634 1635 try{tb_cbx_change1(idx)}catch(ex){} 1636 } 1637 1638 function delete_single(btt, id, op) { 1639 show_model(true, myi18n.tc('msg2')+ ' '+myi18n.t('msg3'), myi18n.t('delete'), myi18n.t('cancel'), ""); 1640 $("#btt_yes").click(function () { 1641 $('#btt_yes').unbind('click'); 1642 pb_show(true, myi18n.t('processing')); 1643 var param = {op: op, op1: "delete", "id": id }; 1644 1645 execute_request(param, null, null, false, function (data) { 1646 pb_show(false); 1647 setTimeout(function () { 1648 if (data.status == "OK") { 1649 btt.closest('tr').remove(); 1650 } 1651 1652 }, 500); 1653 }) 1654 1655 1656 }); 1657 } 1658 1659 function moveItemsToFolder(table_id, type, table_idx){ 1660 if(table_idx === undefined) 1661 cur_table_idx = 0; 1662 else 1663 cur_table_idx = table_idx; 1664 1665 let ids = []; 1666 $all_tb_cbx = $("#"+table_id+" .tb_cbx:checkbox:checked"); 1667 for(let i = 0; i < $all_tb_cbx.length; i++) 1668 ids.push($all_tb_cbx.eq(i).data("id")); 1669 1670 1671 startSelectFolder(ids, type); 1672 } 1673 1674 function delete_multiple(op, table_id, op1) { 1675 var ids = []; 1676 $all_tb_cbx = $("#"+table_id+" .tb_cbx:checkbox:checked"); 1677 for(var i = 0; i < $all_tb_cbx.length; i++) 1678 ids.push($all_tb_cbx.eq(i).data("id")); 1679 1680 if($all_tb_cbx.length == 0){ 1681 show_model(true, myi18n.t('msg1'), myi18n.t('ok'), "", ""); 1682 return; 1683 } 1684 1685 1686 show_model(true, myi18n.tc('msg2', ids.length) + " "+myi18n.t('msg3'), myi18n.t('delete'), myi18n.t('cancel'), ""); 1687 $("#btt_yes").click(function () { 1688 pb_show(true, myi18n.t('processing')); 1689 1690 var param = null; 1691 if(op1 == undefined || op1 == '') 1692 param = { op: op, op1: "delete", ids: ids}; 1693 else 1694 param = { op: op, op1: op1, op2: "delete", ids: ids}; 1695 1696 param.page_id = cur_page.page_id; 1697 1698 execute_request(param, null, null, false, function (data) { 1699 pb_show(false); 1700 setTimeout(function () { 1701 if (data.status == "OK") { 1702 $all_tb_cbx = $("#"+table_id+" .tb_cbx:checkbox:checked"); 1703 for(var i = 0; i < ids.length; i++){ 1704 $("#"+table_id).DataTable().row($("#"+table_id+" #tr"+ids[i])).remove(); 1705 } 1706 1707 $("#"+table_id).DataTable().draw(); 1708 1709 $(".tb_cbx_all[data-table='"+table_id+"'").prop('checked', false); 1710 $("#btt_tb_global_del").addClass("hide"); 1711 } 1712 }, 500); 1713 }) 1714 1715 }); 1716 } 1717 1718 1719 function scroll_elm(elm){ 1720 var offset = elm.offset().top - 100; 1721 if(offset < 0)offset = 0; 1722 $('html, body').animate({ 1723 scrollTop: offset 1724 }, 500); 1725 } 1726 1727 function scroll_smof(offset){ 1728 $('html, body').animate({ 1729 scrollTop: offset 1730 }, 500); 1731 } 1732 1733 function is_google_chart_load(){ 1734 try{ 1735 if ((typeof google === 'undefined') || (typeof google.visualization === 'undefined') || (typeof google.visualization.PieChart === 'undefined')) 1736 return false; 1737 else 1738 return true; 1739 }catch(ex){return false} 1740 } 1741 1742 function get_link(ref, msg, channel, copy, allowedChannels, account){ 1743 if(!account) 1744 account = cur_page; 1745 1746 if(copy === undefined) 1747 copy = true; 1748 1749 if(channel === undefined) 1750 channel = 0; 1751 1752 var url = null; 1753 1754 if(ref !== null){ 1755 ref+= ""; 1756 ref = ref.replace("'", "\\'").replace('"','"'); 1757 } 1758 1759 1760 1761 1762 if(ref === null || !ref.startsWith('https://')){ 1763 if(channel == 'viber' || channel == 12){ 1764 if(!account.viber){ 1765 msg_error(myi18n.tc('msg8', 'Viber')); 1766 return; 1767 } 1768 1769 url = "viber://pa?chatURI="+account.viber.username; 1770 if(ref != null) 1771 url += "&context="+ref; 1772 }else if(channel == 'telegram' || channel == 8){ 1773 if(!account.telegram){ 1774 msg_error(myi18n.tc('msg8', 'Telegram')); 1775 return; 1776 } 1777 1778 url = "https://t.me/"+account.telegram.username; 1779 if(ref != null) 1780 url += "?start="+encodeURI(ref); 1781 }else if(channel == 'whatsapp' || channel == 5){ 1782 if(!account.whatsapp){ 1783 msg_error(myi18n.tc('msg8', 'WhatsApp')); 1784 return; 1785 } 1786 1787 url = "https://wa.me/"+account.whatsapp.number; 1788 if(ref != null) 1789 url += "?text="+encodeURI("/"+ref); 1790 1791 }else if(channel == 'webchat' || channel == 9){ 1792 url = account.domain+"webchat/?p="+account.page_id; 1793 if(ref != null) 1794 url += "&ref="+encodeURI(ref); 1795 }else if(channel == 'instagram' || channel == 10){ 1796 if(account.instagram){ 1797 url = "https://ig.me/m/"+account.instagram.username 1798 1799 if(ref !== null) 1800 url += "?ref="+encodeURI(ref); 1801 }else 1802 return null; 1803 1804 1805 }else if(channel == 'tiktok' || channel == 17){ 1806 if(account.tiktok){ 1807 url = "https://tiktok.me/"+account.tiktok.username 1808 1809 if(ref !== null) 1810 url += "?ref="+encodeURI(ref); 1811 }else 1812 return null; 1813 1814 1815 }else if(channel == 7 || channel == 'googleBM' || channel == 'gbm'){ 1816 if(ref === null) 1817 url ="https://businessmessages.google.com/widget/agent/"+cur_page.gbm.agentID; 1818 else 1819 return null; 1820 }else if(channel == -1){ 1821 url = account.domain+"bots/"+account.page_id+"/l/" 1822 if(ref !== null) 1823 url +=ref; 1824 1825 }else if(channel == 'omnichannel' || channel == 'sms'){ 1826 let fbURL, wLink, tLink, igLink, omnichannelLink; 1827 1828 let links = []; 1829 1830 if(channel == 'sms') 1831 allowedChannels = [2]; 1832 1833 if((!allowedChannels || allowedChannels.includes(-1))){ 1834 omnichannelLink = account.domain+"bots/"+account.page_id+"/l/" 1835 if(ref !== null) 1836 omnichannelLink +=ref; 1837 1838 links.push({'url': omnichannelLink, name: 'Omnichannel', color: '#303133', icon: 'fal fa-dice-d20'}); 1839 } 1840 1841 1842 1843 1844 if(account.messenger_id != 0 && (!allowedChannels || allowedChannels.includes(0))){ 1845 fbURL = 'https://m.me/'+account.username; 1846 1847 if(ref != null) 1848 fbURL += "?ref="+encodeURI(ref); 1849 1850 links.push({'url': fbURL, name: 'Messenger', color: '#0078FF', icon: 'fab fa-facebook-messenger'}); 1851 } 1852 1853 if(account.instagram && (!allowedChannels || allowedChannels.includes(10))){ 1854 igLink = "https://ig.me/m/"+account.instagram.username 1855 1856 if(ref !== null) 1857 igLink += "?ref="+encodeURI(ref); 1858 1859 links.push({'url': igLink, name: 'Instagram',
1859color: '#833AB4', icon: 'fab fa-instagram'}); 1860 } 1861 1862 if(account.tiktok && (!allowedChannels || allowedChannels.includes(17))){ 1863 tLink = "https://tiktok.me/"+account.tiktok.username 1864 1865 if(ref !== null) 1866 tLink += "?ref="+encodeURI(ref); 1867 1868 links.push({'url': tLink, name: 'TikTok', color: '#000', icon: 'fab fa-tiktok'}); 1869 } 1870 1871 1872 if(account.whatsapp && (!allowedChannels || allowedChannels.includes(5))){ 1873 wLink = 'https://wa.me/'+account.whatsapp.number; 1874 if(ref != null) 1875 wLink += "?text="+encodeURI("/"+ref); 1876 1877 links.push({'url': wLink, name: 'WhatsApp', color: '#4AC959', icon: 'fab fa-whatsapp'}); 1878 } 1879 1880 1881 if(account.telegram && (!allowedChannels || allowedChannels.includes(8))){ 1882 tLink ="https://t.me/"+account.telegram.username; 1883 if(ref !== null) 1884 tLink += "?start="+encodeURI(ref); 1885 1886 links.push({'url': tLink, name: 'Telegram', color: '#0088cc', icon: 'fab fa-telegram'}); 1887 } 1888 1889 if(account.sms && account.sms.number && (!allowedChannels || allowedChannels.includes(2))){ 1890 if(ref !== null){ 1891 links.push({'url': "sms:"+account.sms.number+"&body="+encodeURI("/"+ref), name: 'SMS Link (iPhone)', color: '#555', icon: 'fa-thin fa-sms'}); 1892 links.push({'url': "sms:"+account.sms.number+"?body="+encodeURI("/"+ref), name: 'SMS Link (Android)', color: '#555', icon: 'fa-thin fa-sms'}); 1893 }else 1894 links.push({'url': "sms:"+account.sms.number, name: 'SMS', color: '#555', icon: 'fa-thin fa-sms'}); 1895 1896 } 1897 1898 1899 1900 if(account.viber && (!allowedChannels || allowedChannels.includes(12))){ 1901 1902 let vLink = "viber://pa?chatURI="+account.viber.username; 1903 if(ref !== null) 1904 vLink += "&context="+encodeURI(ref); 1905 1906 links.push({'url': vLink, name: 'Viber', color: '#7360F2', icon: 'fa-brands fa-viber'}); 1907 } 1908 1909 if(!allowedChannels || allowedChannels.includes(9)){ 1910 let webChatLink = account.domain+"webchat/?p="+account.page_id; 1911 if(ref !== null) 1912 webChatLink += "&ref="+encodeURI(ref); 1913 1914 1915 links.push({'url': webChatLink, name: 'WebChat', color: '#555', icon: 'fal fa-comment-dots'}); 1916 } 1917 1918 1919 1920 if(links.length > 0){ 1921 let strText = ''; 1922 for(let i = 0; i < links.length; i++) 1923 strText += '<div class="d-flex justify-content-between align-items-center py-2 w-100"><div class="d-flex align-items-center"><i style="color:'+links[i].color+'" class="'+links[i].icon+' h2 mb-0 mr-3"></i> '+links[i].name+' </div> <button type="button" class="btn btn-primary" onclick="copyTextToClipboard(\''+links[i].url+'\');">'+myi18n.t('copy')+'</button></div>'; 1924 1925 show_model(true, strText, null, null, null, myi18n.t('getLink')); 1926 1927 return 1928 }else 1929 url = fbURL; 1930 1931 }else /*if(channel == 'standard' || channel == -0 || channel == -2)*/{ 1932 var url = "https://m.me/"+account.username; 1933 1934 if(ref != null) 1935 url += "?ref="+encodeURI(ref); 1936 } 1937 1938 1939 if(msg == undefined) 1940 msg = myi18n.t('msg21'); 1941 }else{ 1942 url = ref; 1943 if(msg == undefined) 1944 msg = ''; 1945 } 1946 1947 if(copy) 1948 copyTextToClipboard(url); 1949 else 1950 return url 1951 1952 } 1953 1954 function get_payload(payload){ 1955 show_model(true, payload, myi18n.t('copy'), myi18n.t('cancel'), ""); 1956 $("#btt_yes").click(function () { 1957 copyTextToClipboard(payload); 1958 }); 1959 } 1960 1961 1962 function copyTextToClipboard(text, show_success) { 1963 if(show_success === undefined) 1964 show_success = true; 1965 1966 var textArea = document.createElement("textarea"); 1967 textArea.style.position = 'fixed'; 1968 textArea.style.top = 0; 1969 textArea.style.left = 0; 1970 // Ensure it has a small width and height. Setting to 1px / 1em 1971 // doesn't work as this gives a negative w/h on some browsers. 1972 textArea.style.width = '2em'; 1973 textArea.style.height = '2em'; 1974 textArea.style.padding = 0; 1975 textArea.style.border = 'none'; 1976 textArea.style.outline = 'none';
1977 textArea.style.boxShadow = 'none'; 1978 1979 // Avoid flash of white box if rendered for any reason. 1980 textArea.style.background = 'transparent'; 1981 textArea.value = text; 1982 document.body.appendChild(textArea); 1983 textArea.select(); 1984 1985 try { 1986 return document.execCommand('copy'); 1987 } catch (err) { 1988 return false; 1989 } finally { 1990 if(show_success && msg_success) 1991 msg_success(myi18n.t('success'), 2000); 1992 1993 document.body.removeChild(textArea); 1994 } 1995 } 1996 1997 function F_ajust_div_height(div_class, padding) { 1998 var max_height = 0; 1999 $(div_class).each(function (i) { 2000 if (max_height < $(this).height()) 2001 max_height = $(this).height(); 2002 }); 2003 2004 $(div_class).css("height", max_height + padding); 2005 } 2006 2007 function get_ctgr_name(id, level) { 2008 var results = null; 2009 if (level == 0) 2010 results = category0; 2011 else if (level == 1) 2012 results = category1; 2013 else if (level == 2) 2014 results = category2; 2015 else 2016 results = category3; 2017 2018 for (var i = 0; i < results.length; i++) { 2019 if (id == results[i].id) 2020 return results[i].n; 2021 } 2022 2023 return myi18n.t('none'); 2024 } 2025 2026 function dashb_area_op(title, color, legend){ 2027 2028 var c = "#007BFF"; 2029 if(mainData.wt.color && mainData.wt.color.primary) 2030 c = mainData.wt.color.primary; 2031 2032 if(color == undefined) 2033 color = [c, '#FD7217', '#E11DBB', '#026268' ]; 2034 2035 if(legend == undefined) 2036 legend = {position : 'none'} 2037 2038 2039 return { 2040 title: title, 2041 legend: legend, 2042 chartArea: {left: 25, width: '100%', height: '80%'}, 2043 animation: { 2044 startup: true, 2045 duration: 1000, 2046 easing: 'inAndOut' 2047 }, 2048 hAxis: { 2049 format: 'MMM d', 2050 legendTextStyle: { color: '#111' }, 2051 gridlines: {color: 'none' }, 2052 textStyle:{color: "#99979c", fontSize: 12}, 2053 titleTextStyle:{ 2054 color: "#99979c" 2055 } 2056 }, 2057 vAxis: { 2058 baselineColor: 'b3b3b3', 2059 format: 'short', 2060 gridlines: { count: -1, color: 'none' }, 2061 textStyle:{color: "#99979c", fontSize: 12}, 2062 titleTextStyle:{color: "#99979c"} 2063 }, 2064 titleTextStyle: { 2065 color: '#000',
2066 bold: false, 2067 fontSize: 14 2068 }, 2069 legend:{ 2070 textStyle:{ 2071 color: "#99979c", 2072 fontSize: 12 2073 } 2074 }, 2075 curveType: 'function', 2076 fontName: 'Roboto', 2077 lineWidth: 0.5, 2078 backgroundColor: { fill: 'white' }, 2079 colors: color 2080 }; 2081 2082 } 2083 2084 function dashb_pie_op(title, colors){ 2085 if(colors == undefined) 2086 { 2087 var c = "#007BFF"; 2088 if(mainData.wt.color && mainData.wt.color.primary) 2089 c = mainData.wt.color.primary; 2090 2091 colors = [c,'#FD7217', '#12266C', '#D10079', '#d40000', '#333', '#808000', '#ffff00', '#008000', '#008080']; 2092 } 2093 2094 return options = { 2095 'title': title, 2096 animation: { 2097 startup: true, 2098 duration: 1000, 2099 easing: 'inAndOut' 2100 }, 2101 titleTextStyle: { 2102 color: '#000',
2103 bold: false, 2104 fontSize: 14 2105 }, 2106 legend:{ 2107 textStyle:{ 2108 color: "#99979c" 2109 } 2110 }, 2111 fontName: 'Roboto', 2112 colors: colors, 2113 2114 }; 2115 } 2116 2117 function getTimezone(name){ 2118 if(name) 2119 return Intl.DateTimeFormat().resolvedOptions().timeZone 2120 else 2121 return new Date().getTimezoneOffset()/-60; 2122 } 2123 2124 2125 2126 /* Utility function to convert a canvas to a BLOB */ 2127 var dataURLToBlob = function (dataURL) { 2128 var BASE64_MARKER = ';base64,'; 2129 if (dataURL.indexOf(BASE64_MARKER) == -1) { 2130 var parts = dataURL.split(','); 2131 var contentType = parts[0].split(':')[1]; 2132 var raw = parts[1]; 2133 2134 return new Blob([raw], { type: contentType }); 2135 } 2136 2137 var parts = dataURL.split(BASE64_MARKER); 2138 var contentType = parts[0].split(':')[1]; 2139 var raw = window.atob(parts[1]); 2140 var rawLength = raw.length; 2141 2142 var uInt8Array = new Uint8Array(rawLength); 2143 2144 for (var i = 0; i < rawLength; ++i) { 2145 uInt8Array[i] = raw.charCodeAt(i); 2146 } 2147 2148 return new Blob([uInt8Array], { type: contentType }); 2149 } 2150 2151 2152 function canvasToImage(backgroundColor, canvas) { 2153 var context = canvas.getContext('2d'); 2154 var w = canvas.width; 2155 var h = canvas.height; 2156 2157 var data = context.getImageData(0, 0, w, h); 2158 var compositeOperation = context.globalCompositeOperation; 2159 context.globalCompositeOperation = "destination-over"; 2160 context.fillStyle = backgroundColor; 2161 context.fillRect(0, 0, w, h); 2162 var imageData = canvas.toDataURL("image/jpeg"); 2163 context.clearRect(0, 0, w, h); 2164 context.putImageData(data, 0, 0); 2165 context.globalCompositeOperation = compositeOperation; 2166 return imageData; 2167 } 2168 2169 function escapeHtml (str, jsHtml) { 2170 var entityMap = { 2171 '&': '&', 2172 '<': '<', 2173 '>': '>', 2174 '"': '"', 2175 "'": ''', 2176 '/': '/', 2177 '=': '=', 2178 '\n': ' ', 2179 '\r': ' ' 2180 }; 2181 2182 2183 return String(str).replace(/[&<>"'`=\/]/g, function (s) { 2184 return entityMap[s]; 2185 }); 2186 } 2187 2188 function confirm_delete(id, op, table_id, custom0, custom0_value, op1, tableData) { 2189 try{ 2190 show_model(true, myi18n.tc('msg2', 1)+' '+myi18n.t('msg3'), myi18n.t('delete'), myi18n.t('cancel'), ""); 2191 $("#btt_yes").click(function () { 2192 delete_item(id, op, table_id, custom0, custom0_value, op1,tableData) 2193 }); 2194 }catch(ex){ 2195 show_model(true, myi18n.tc('msg2')+ ' '+myi18n.t('msg3'), myi18n.t('delete'), myi18n.t('cancel'), ""); 2196 $("#btt_yes").click(function () { 2197 delete_item(id, op, table_id, custom0, custom0_value, op1,tableData) 2198 }); 2199 } 2200 } 2201 2202 function delete_item(id, op, table_id, custom0, custom0_value, op1, tableData){ 2203 2204 2205 pb_show(true, myi18n.t('processing')); 2206 var param = null; 2207 if(op1 == undefined) 2208 param = { op: op, op1:'delete', id: id}; 2209 else 2210 param = { op: op, op1: op1, op2:'delete', id: id}; 2211 2212 param.cur_page = cur_page.page_id; 2213 2214 if(custom0) 2215 param[custom0] = custom0_value; 2216 2217 execute_request(param, null, null, false, function (data) { 2218 pb_show(false); 2219 setTimeout(function () { 2220 pb_show(false); 2221 if (data.status == "OK") { 2222 if(table_id){ 2223 setTimeout(function () { 2224 if(table_id.endsWith(id)){ 2225 $(table_id).remove(); 2226 }else{ 2227 var t_contextMenu = $("#tr"+id).find("#t_contextMenu"); 2228 if(t_contextMenu.length != 0) 2229 $(t_contextMenu[0]).appendTo("body"); 2230 2231 $(table_id).DataTable().row($("#tr"+id)).remove().draw(); 2232 } 2233 }, 500); 2234 } 2235 2236 try{ 2237 if(tableData) 2238 tableData = arrayRemoveItem(tableData, id); 2239 2240 }catch(ex){} 2241 }else{ 2242 if(data.message) 2243 show_model(true, data.message, myi18n.t('ok'), "", ""); 2244 else 2245 msg_error(myi18n.t('msg0')); 2246 2247 } 2248 }, 500); 2249 }) 2250 2251 2252 } 2253 2254 2255 function item_change_active(id, switchh, op, op1, op2, op3){ 2256 if(!op1) 2257 op1 = 'update'; 2258 2259 var param = {page_id: cur_page.page_id, op, op1, id, fields: [{name: 'status', value: $(switchh).is(':checked') ? 1 : 0}]}; 2260 2261 if(op2) 2262 param.op2 = op2; 2263 2264 if(op3) 2265 param.op2 = op3; 2266 2267 2268 execute_request(param, null, null, false, function (data) { 2269 if (data.status == 'OK') 2270 msg_success(); 2271 else 2272 show_model(true, myi18n.t('msg0'), myi18n.t('ok'), ""); 2273 }); 2274 } 2275 2276 function editItemInTable (evt, url) { 2277 if(!url) 2278 return; 2279 2280 let elm = $(evt.target); 2281 if(!get_elem_parent(elm, 'td_icon') && !get_elem_parent(elm, 'dropdown-menu') && !get_elem_parent(elm, 'td_checkbox') && !get_elem_parent(elm, 'switch') && !get_elem_parent(elm, 'link_in_table')){ 2282 open_link(url); 2283 } 2284 } 2285 2286 2287 function actionButton_clicked(btt, edit_op, delete_op, view_states_op, get_link_op, clone_op, view_op, send_op, category_op, cancel_op, resend_op, json_op, messenger_code_op, payload_op, rename, transfer, getId){ 2288 if(edit_op == "0") 2289 $("#t_contextMenu li a[data-idx='0']").parent().hide(); 2290 else if(edit_op == "1") 2291 $("#t_contextMenu li a[data-idx='0']").addClass("my_disabled"); 2292 else{ 2293 $("#t_contextMenu li a[data-idx='0']").attr("onclick", edit_op); 2294 $("#t_contextMenu li a[data-idx='0']").removeClass("my_disabled"); 2295 } 2296 2297 if(delete_op == "0") 2298 $("#t_contextMenu li a[data-idx='1']").parent().hide(); 2299 else if(delete_op == "1") 2300 $("#t_contextMenu li a[data-idx='1']").addClass("my_disabled"); 2301 else{ 2302 $("#t_contextMenu li a[data-idx='1']").attr("onclick", delete_op); 2303 $("#t_contextMenu li a[data-idx='1']").removeClass("my_disabled"); 2304 } 2305 2306 if(clone_op == "0" || clone_op == undefined) 2307 $("#t_contextMenu li a[data-idx='2']").parent().hide(); 2308 else if(clone_op == "1") 2309 $("#t_contextMenu li a[data-idx='2']").addClass("my_disabled"); 2310 else{ 2311 $("#t_contextMenu li a[data-idx='2']").attr("onclick", clone_op); 2312 $("#t_contextMenu li a[data-idx='2']").removeClass("my_disabled"); 2313 } 2314 2315 if(view_op == "0" || view_op == undefined) 2316 $("#t_contextMenu li a[data-idx='3']").parent().hide(); 2317 else if(view_op == "1") 2318 $("#t_contextMenu li a[data-idx='3']").addClass("my_disabled"); 2319 else{ 2320 $("#t_contextMenu li a[data-idx='3']").attr("onclick", view_op); 2321 $("#t_contextMenu li a[data-idx='3']").removeClass("my_disabled"); 2322 } 2323 2324 if(get_link_op == "0" || get_link_op == undefined) 2325 $("#t_contextMenu li a[data-idx='4']").parent().hide(); 2326 else if(get_link_op == "1") 2327 $("#t_contextMenu li a[data-idx='4']").addClass("my_disabled"); 2328 else{ 2329 $("#t_contextMenu li a[data-idx='4']").attr("onclick", get_link_op); 2330 $("#t_contextMenu li a[data-idx='4']").removeClass("my_disabled"); 2331 } 2332 2333 if(view_states_op == "0" || view_states_op == undefined) 2334 $("#t_contextMenu li a[data-idx='5']").parent().hide(); 2335 else if(view_states_op == "1") 2336 $("#t_contextMenu li a[data-idx='5']").addClass("my_disabled"); 2337 else{ 2338 $("#t_contextMenu li a[data-idx='5']").attr("onclick", view_states_op); 2339 $("#t_contextMenu li a[data-idx='5']").removeClass("my_disabled"); 2340 } 2341 2342 if(send_op == "0" || send_op == undefined){ 2343 $("#t_contextMenu li a[data-idx='6']").parent().hide(); 2344 }
2344else if(send_op == "1") 2345 $("#t_contextMenu li a[data-idx='6']").addClass("my_disabled"); 2346 else{ 2347 $("#t_contextMenu li a[data-idx='6']").attr("onclick", send_op); 2348 $("#t_contextMenu li a[data-idx='6']").removeClass("my_disabled"); 2349 } 2350 2351 if(category_op == "0" || category_op == undefined) 2352 $("#t_contextMenu li a[data-idx='7']").parent().hide(); 2353 else if(category_op == "1") 2354 $("#t_contextMenu li a[data-idx='7']").addClass("my_disabled"); 2355 else{ 2356 $("#t_contextMenu li a[data-idx='7']").attr("onclick", category_op); 2357 $("#t_contextMenu li a[data-idx='7']").removeClass("my_disabled"); 2358 } 2359 2360 if(cancel_op == "0" || cancel_op == undefined) 2361 $("#t_contextMenu li a[data-idx='8']").parent().hide(); 2362 else if(cancel_op == "1") 2363 $("#t_contextMenu li a[data-idx='8']").addClass("my_disabled"); 2364 else{ 2365 $("#t_contextMenu li a[data-idx='8']").attr("onclick", cancel_op); 2366 $("#t_contextMenu li a[data-idx='8']").removeClass("my_disabled"); 2367 } 2368 2369 if(resend_op == "0" || resend_op == undefined) 2370 $("#t_contextMenu li a[data-idx='9']").parent().hide(); 2371 else if(resend_op == "1") 2372 $("#t_contextMenu li a[data-idx='9']").addClass("my_disabled"); 2373 else{ 2374 $("#t_contextMenu li a[data-idx='9']").attr("onclick", resend_op); 2375 $("#t_contextMenu li a[data-idx='9']").removeClass("my_disabled"); 2376 } 2377 2378 if(json_op == "0" || json_op == undefined) 2379 $("#t_contextMenu li a[data-idx='10']").parent().hide(); 2380 else if(json_op == "1") 2381 $("#t_contextMenu li a[data-idx='10']").addClass("my_disabled"); 2382 else{ 2383 $("#t_contextMenu li a[data-idx='10']").attr("onclick", json_op); 2384 $("#t_contextMenu li a[data-idx='10']").removeClass("my_disabled"); 2385 } 2386 2387 if(messenger_code_op == "0" || messenger_code_op == undefined) 2388 $("#t_contextMenu li a[data-idx='11']").parent().hide(); 2389 else if(messenger_code_op == "1") 2390 $("#t_contextMenu li a[data-idx='11']").addClass("my_disabled"); 2391 else{ 2392 messenger_code_op = "open_link('tools-qr-code?ref="+encodeURI(messenger_code_op)+"&acc="+cur_page.page_id+"', 0)"; 2393 $("#t_contextMenu li a[data-idx='11']").attr("onclick", messenger_code_op); 2394 $("#t_contextMenu li a[data-idx='11']").removeClass("my_disabled"); 2395 } 2396 2397 2398 if(payload_op == "0" || payload_op == undefined) 2399 $("#t_contextMenu li a[data-idx='12']").parent().hide(); 2400 else if(payload_op == "1") 2401 $("#t_contextMenu li a[data-idx='12']").addClass("my_disabled"); 2402 else{ 2403 $("#t_contextMenu li a[data-idx='12']").attr("onclick", payload_op); 2404 $("#t_contextMenu li a[data-idx='12']").removeClass("my_disabled"); 2405 } 2406 2407 if(rename == "0" || rename == undefined) 2408 $("#t_contextMenu li a[data-idx='13']").parent().hide(); 2409 else if(rename == "1") 2410 $("#t_contextMenu li a[data-idx='13']").addClass("my_disabled"); 2411 else{ 2412 $("#t_contextMenu li a[data-idx='13']").attr("onclick", rename); 2413 $("#t_contextMenu li a[data-idx='13']").removeClass("my_disabled"); 2414 } 2415 2416 if(transfer == "0" || transfer == undefined) 2417 $("#t_contextMenu li a[data-idx='14']").parent().hide(); 2418 else if(transfer == "1") 2419 $("#t_contextMenu li a[data-idx='14']").addClass("my_disabled"); 2420 else{ 2421 $("#t_contextMenu li a[data-idx='14']").attr("onclick", transfer); 2422 $("#t_contextMenu li a[data-idx='14']").removeClass("my_disabled"); 2423 } 2424 2425 if(getId == "0" || getId == undefined) 2426 $("#t_contextMenu li a[data-idx='15']").parent().hide(); 2427 else if(getId == "1") 2428 $("#t_contextMenu li a[data-idx='15']").addClass("my_disabled"); 2429 else{ 2430 $("#t_contextMenu li a[data-idx='15']").attr("onclick", getId); 2431 $("#t_contextMenu li a[data-idx='15']").removeClass("my_disabled"); 2432 } 2433 2434 $dropdown = $("#t_contextMenu"); 2435 $(btt).after($dropdown); 2436 $(btt).dropdown(); 2437 2438 $(btt).parent().one('hide.bs.dropdown', function () { 2439 if(!$("body > #t_contextMenu").length) 2440 $("#t_contextMenu").appendTo("body"); 2441 }); 2442 } 2443 2444function daterangepicker_show_hide(selector, on){ 2445 if(on){ 2446 $(selector).on('show.daterangepicker', function (ev, picker) { 2447 $(this).find("i:last-child").addClass("fa-times"); 2448 $(this).find("i:last-child").removeClass("fa-angle-down"); 2449 }); 2450 2451 $('.div_daterange').on('hide.daterangepicker', function (ev, picker) { 2452 $(this).find("i:last-child").removeClass("fa-times"); 2453 $(this).find("i:last-child").addClass("fa-angle-down"); 2454 }); 2455 }else{ 2456 $('.div_daterange').off('show.daterangepicker'); 2457 $('.div_daterange').off('hide.daterangepicker'); 2458 } 2459} 2460 2461function getPHPUserScript(url){ 2462 if(!url) 2463 url = '/php/user.php'; 2464 2465 if((window.location.hostname === 'localhost' || window.location.hostname.includes('.ngrok.io')) && (url === '/' || url.startsWith('/php/') || url.startsWith('/js/'))) 2466 url = '/bots'+url; 2467 2468 return url; 2469 2470} 2471 2472function prepareParam(param){ 2473 try{ 2474 if(param.constructor === Array){ 2475 for(let i = 0; i < param.length; i++){ 2476 param[i].pageName = mainData.pageName; 2477 } 2478 }else 2479 param.pageName = mainData.pageName; 2480 2481 if(cur_page && cur_page.page_id){ 2482 if(param.constructor === Array){ 2483 for(let i = 0; i < param.length; i++){ 2484 if(param[i].page_id === undefined) 2485 param[i].page_id = cur_page.page_id; 2486 } 2487 }else if(param.page_id === undefined) 2488 param.page_id = cur_page.page_id; 2489 } 2490 2491 }catch(ex){} 2492 2493 return param; 2494} 2495 2496function execute_request(param, msg_success, msg_error, show_pb, my_callback, ms_delay, timeout, url){ 2497 if(!url) 2498 url = '/php/user.php'; 2499 2500 if((window.location.hostname === 'localhost' || window.location.hostname.includes('.ngrok.io')) && url.startsWith('/php/')) 2501 url = '/bots'+url; 2502 2503 2504 if(show_pb === 1 || show_pb === 2) 2505 pb_show(myi18n.t('processing')); 2506 else if(show_pb) 2507 pb_show(true); 2508 2509 2510 param = prepareParam(param); 2511 2512 if(!timeout) 2513 timeout = 120000; 2514 2515 $.ajax({ 2516 timeout: timeout, 2517 type: 'POST', 2518 url: url, 2519 data: { param: JSON.stringify(param) }, 2520 contentType: "application/x-www-form-urlencoded", 2521 success: function (data) { 2522 if(show_pb === true || show_pb === 2) 2523 pb_show(false); 2524 2525 var json = typeof data === 'string' || data instanceof String ? JSON.parse(data) : data; 2526 2527 check_error(json); 2528 if(my_callback !== undefined && my_callback !== null){ 2529 my_callback(json); 2530 return; 2531 } 2532 2533 if(!ms_delay) 2534 ms_delay = 0; 2535 2536 setTimeout(function(){ 2537 if(json.status == 'OK') 2538 msg_success(myi18n.t('msg4')); 2539 else 2540 msg_error(myi18n.t('msg0')); 2541 }, ms_delay); 2542 }, 2543 failure: function (errMsg) { alert(errMsg); } 2544 }); 2545} 2546 2547 2548function connectFBTOMS(data){ 2549 $("#mFBTOMS").remove(); 2550 2551 show_connectBotToAdmin(data.data.ref, data.data.channel, data.data.text, 'connect'); 2552 return; 2553} 2554 2555 2556function open_link(link, op){ 2557 if(op != undefined){ 2558 var win = window.open(link, '_blank'); 2559 win.focus(); 2560 }else 2561 window.location.href = link; 2562} 2563 2564 2565function is_touch_device() { 2566 return 'ontouchstart' in window /*works on most browsers*/ 2567 || navigator.maxTouchPoints; /*works on IE10/11 and Surface*/ 2568}; 2569 2570 2571 2572function format_float(number, digit) { 2573 if (digit == 0) 2574 return Math.round(number) 2575 else 2576 return parseInt(number * digit * 10) / (digit * 10); 2577} 2578 2579 2580function getVariation(totalActual, totalPrevious){ 2581 if(totalActual == totalPrevious) 2582 return '0'; 2583 2584 if(totalPrevious == 0) 2585 return 'infinite' 2586 2587 return format_float((totalActual - totalPrevious) * 100 / (totalPrevious != 0 ? totalPrevious : 0.001), 2); 2588} 2589 2590 2591function setOverviewLoading(total){ 2592 if(!total) 2593 total = 4;
2594 2595 let overview = []; 2596 for(let i = 0; i < total; ++i){ 2597 overview.push({loading: true}) 2598 } 2599 2600 mainData.data.overview = overview; 2601} 2602 2603 2604 2605$('.toogle_div_change1').on('change', function (e) { 2606 div_save_changes(true); 2607}); 2608 2609$('.toogle_div_change').on('input', function (e) { 2610 div_save_changes(true); 2611}); 2612 2613function div_save_changes(b_show, back_url, btt_ok_text){ 2614 mainData.quicksave.visible = b_show; 2615 if(back_url != null) 2616 mainData.quicksave.negative.url = back_url; 2617 2618 if(btt_ok_text != undefined) 2619 mainData.quicksave.positive = btt_ok_text; 2620 2621} 2622 2623 2624function discart_changes(){ 2625 if($("#btt_discart_changes").data("url") == "") 2626 window.location.reload(); 2627 else 2628 window.location.href = $("#btt_discart_changes").data("url"); 2629} 2630 2631 2632function set_equal_height(css_selector){ 2633 var all_elm = $(css_selector); 2634 var max_height = 0; 2635 for(var i = 0; i < all_elm.length; i++){ 2636 if(max_height < all_elm.eq(i).height()) 2637 max_height = all_elm.eq(i).height(); 2638 } 2639 2640 all_elm.height(max_height); 2641} 2642 2643 2644 2645function get_conversation_link(conversation_id, conversation_link){ 2646 if(conversation_id > 1) 2647 return "https://fb.com/"+cur_page.page_id+"/inbox/"+conversation_id; 2648 else if(conversation_link != '') 2649 return "https://fb.com"+conversation_link; 2650 else 2651 return "https://fb.com/"+cur_page.page_id+"/inbox/"; 2652} 2653 2654listen_btt_delete_item(); 2655function listen_btt_delete_item(){ 2656 $(".div_single_item .btt_delete_item").off('click'); 2657 $(".div_single_item .btt_delete_item").click(function(){ 2658 $btt = $(this); 2659 for(var i = 0; i < 10; i++){ 2660 if($btt.parent().hasClass('div_single_item')){ 2661 $btt.parent().remove(); 2662 return; 2663 }else 2664 $btt = $btt.parent(); 2665 } 2666 }); 2667 2668 $(".div_item .btt_delete_item").off('click'); 2669 $(".div_item .btt_delete_item").click(function(){ 2670 $btt = $(this); 2671 for(var i = 0; i < 10; i++){ 2672 if($btt.parent().hasClass('div_item')){ 2673 $btt.parent().remove(); 2674 return; 2675 }else 2676 $btt = $btt.parent(); 2677 } 2678 }); 2679 2680 2681 2682 $(".div_single_item_s .btt_delete_item_s").off('click'); 2683 $(".div_single_item_s .btt_delete_item_s").click(function(){ 2684 $btt = $(this); 2685 for(var i = 0; i < 10; i++){ 2686 if($btt.parent().hasClass('div_single_item_s')){ 2687 $btt.parent().remove(); 2688 return; 2689 }else 2690 $btt = $btt.parent(); 2691 } 2692 }); 2693} 2694 2695 2696function preview_resource(type, id, channel){ 2697 if(channel === undefined || channel == -1){ 2698 channelSelector(function(channelData){ 2699 preview_resource(type, id, channelData.preview); 2700 }, null, [15,9]) 2701 2702 return 2703 }else if(isNumeric(channel)){ 2704 let item = getItemName(getChannelsData(true), channel, ['c', 'name'], 'item'); 2705 channel = item.preview; 2706 } 2707 2708 var param = {page_id: cur_page.page_id, op: "flows", op1:"preview-advanced-resources", type: type, id:id, channel}; 2709 execute_request(param, null, null, false, function (data) { 2710 pb_show(false); 2711 if (data.status == "OK") 2712 msg_success(myi18n.t('messageSent')); 2713 else if(!check_error(data)){ 2714 show_model(true, myi18n.t('msg0'), myi18n.t('ok'), "", ""); 2715 } 2716 }); 2717} 2718 2719function add_search_result(result){ 2720 result.url = result.url.replace("v_page_id", "page_id="+cur_page.page_id); 2721 2722 if(result.type == 0) 2723 return '<a class="result" href="'+result.url+'"><div class="d-flex align-items-center"><i class="'+result.icon+'"></i><span class="ml-3 title">'+result.title+'</span></div></a>'; 2724 else if(result.type == 1) 2725 return '<a class="result" href="'+result.url+'" target="_blank"> <div class="d-flex align-items-center justify-content-between"> <div> <i class="'+result.icon+'"></i> <span class="ml-3 title">'+result.title+'</span> </div><i class="fal fa-external-link"></i> </div></a>'; 2726 else if(result.type == 2) 2727 return '<a class="result" href="'+result.url+'"> <div class="flex-column"> <div class="d-flex align-items-center"> <i class="'+result.icon+'"></i> <span class="ml-3 title">'+result.title+'</span> </div><div class="d-flex align-items-center"> <i class="'+result.icon+' invisible"></i> <span class="ml-3 description">'+result.descr+'</span> </div></div></a>'; 2728 else if(result.type == 3) 2729 return '<a class="result" href="'+result.url+'" target="_blank"> <div class="d-flex align-items-center"> <div class="flex-column flex-grow-1"> <div class="d-flex align-items-center"> <i class="'+result.icon+'"></i> <span class="ml-3 title">'+result.title+'</span> </div><div class="d-flex flex-grow-1 align-items-center"> <i class="'+result.icon+' invisible"></i> <span class="ml-3 description">'+result.descr+'</span> </div></div><i class="fal fa-external-link"></i> </div></a>'; 2730 else{ 2731 result.title = JSON.parse(result.title); 2732 var title = '<i class="'+result.icon+'"></i><span class="ml-3 title">'+result.title[0]+'</span>'; 2733 for(var i = 1; i < result.title.length; i++) 2734 title+='<i class="ml-3 fal fa-chevron-right"></i><span class="ml-3 title">'+result.title[i]+'</span>'; 2735 2736 if(result.type == 10) 2737 return '<a class="result" href="'+result.url+'"><div class="d-flex align-items-center">
2737'+title+'</div></a>'; 2738 else if(result.type == 11) 2739 return '<a class="result" href="'+result.url+'" target="_blank"> <div class="d-flex align-items-center justify-content-between"> <div>'+title+'</div><i class="fal fa-external-link"></i> </div></a>'; 2740 else if(result.type == 12) 2741 return '<a class="result" href="'+result.url+'"> <div class="flex-column"> <div class="d-flex align-items-center">'+title+'</div><div class="d-flex align-items-center"> <i class="'+result.icon+' invisible"></i> <span class="ml-3 description">'+result.descr+'</span> </div></div></a> '; 2742 else if(result.type == 13) 2743 return '<a class="result" href="'+result.url+'" target="_blank"> <div class="d-flex align-items-center"> <div class="flex-column flex-grow-1"> <div class="d-flex align-items-center"> '+title+' </div><div class="d-flex flex-grow-1 align-items-center"> <i class="'+result.icon+' invisible"></i> <span class="ml-3 description">'+result.descr+'</span> </div></div><i class="fal fa-external-link"></i> </div></a>'; 2744 } 2745} 2746 2747 2748 2749 2750 2751function update_a_page_id(page_id, parent){ 2752 2753 if(page_id == null) 2754 return; 2755 if(parent === undefined) 2756 $all_a_page_id = $('.a_page_id'); 2757 else 2758 $all_a_page_id = $(parent+' .a_page_id'); 2759 2760 2761 let length = $all_a_page_id.length; 2762 let url = ''; 2763 for(var i = 0; i < length; i++){ 2764 try{ 2765 $a_page_id = $all_a_page_id.eq(i); 2766 url = $a_page_id.attr("href"); 2767 if(url.includes('page_id=')) 2768 continue; 2769 2770 if(url.includes("?")) 2771 $a_page_id.attr("href", url+"&acc="+page_id); 2772 else 2773 $a_page_id.attr("href", url+"?acc="+page_id); 2774 }catch(ex){} 2775 } 2776} 2777 2778 2779function get_elem_parent(elm, parent_class){ 2780 var parent = elm; 2781 2782 for(var j = 0; j < 20; j++){ 2783 if(parent == null) 2784 return null; 2785 2786 if(parent.hasClass(parent_class)) 2787 return parent; 2788 2789 parent = parent.parent(); 2790 } 2791 2792 return null; 2793} 2794 2795 2796function swapNodes(a, b) { 2797 var aparent = a.parentNode; 2798 var asibling = a.nextSibling === b ? a : a.nextSibling; 2799 b.parentNode.insertBefore(a, b); 2800 aparent.insertBefore(b, asibling); 2801} 2802 2803 2804 2805function getFileType(fileType){ 2806 if(fileType.includes('image')) 2807 return 'image'; 2808 else if(fileType.includes('audio')) 2809 return 'audio'; 2810 else if(fileType.includes('video')) 2811 return 'video'; 2812 else 2813 return 'file'; 2814} 2815 2816 2817function upload_file(type, file, original_file, param, div_progress, my_callback, urlScript){ 2818 /*setTimeout(function(){ 2819 my_callback({status: 'OK', url: 'https://cdnj1.com/assets/2042282106075798/flows/Test-document.pdf'}) 2820 }, 2000) 2821 2822 return;*/ 2823 if(!urlScript) 2824 urlScript = '../php/user.php'; 2825 2826 if(type === 'imageCanvas'){ 2827 file = canvasToImage("#fff", file); 2828 file = dataURLToBlob(file); 2829 } 2830 2831 param.page_id = cur_page.page_id; 2832 2833 var request = new XMLHttpRequest(); 2834 request.onreadystatechange = function () { 2835 if (request.readyState == 4) { 2836 if(div_progress){ 2837 div_progress.css('width', "100%"); 2838 setTimeout(function(){div_progress.css('width', "0%"); }, 500); 2839 } 2840 2841 my_callback(JSON.parse(request.response)); 2842 } 2843 }; 2844 2845 if(original_file.size < file.size) 2846 file = original_file; 2847 2848 2849 var data = new FormData(); 2850 var last_bytes = 0, total_send = 0, total_lenght = file.size; 2851 data.append("param", JSON.stringify(param)); 2852 data.append("file", file); 2853 2854 if(div_progress){ 2855 request.upload.addEventListener('progress', function (evt) { 2856 total_send += (evt.loaded - last_bytes); 2857 last_bytes = evt.loaded; 2858 var percent = (total_send / total_lenght) * 100; 2859 if (percent > 100) 2860 percent = 100; 2861 2862 percent = percent.toFixed(1); 2863 div_progress.css('width', percent + "%"); 2864 }); 2865 } 2866 2867 2868 request.upload.addEventListener('error', function (evt) { 2869 my_callback(null); 2870 }); 2871 2872 request.upload.addEventListener('abort', function (evt) { 2873 my_callback(null); 2874 }); 2875 2876 2877 2878 request.open('POST', urlScript); 2879 request.timeout = 900000; // time in milliseconds 2880 request.send(data); 2881} 2882 2883 2884function get_system_fields(full){ 2885 if(full === undefined) 2886 full = 0; 2887
2888 let cfs = [{id:-1, type: -1, name: 'First Name', value: '{first_name}}'}, {id:-2, type: -1, name: 'Last Name', value: '{last_name}}'},{id:-10, type: -1, name: 'Full Name', value: '{full_name}}'}, 2889 {id:-12, type: -1, name: 'Email', value: '{email}}'},{id:-8, type: -1, name: 'Phone', value: '{phone}}'},{id:-11, type: -1, name: 'Profile Image', value: '{profile_pic}}'},{id:-166, type: -1, name: 'Empty', value: '{empty}}'} 2890 ,{id:-6, type: -1, name: 'Locale', value: '{locale}}', type: -1}, {id:-19, type: -1, name: 'Gender', value: '{gender}}'},{id:-7, type: -1, name: 'Timezone', value: '{timezone}}'} 2891 ,{id:-4, type: -1, name: 'User Id', value: '{user_id}}'},{id:-27, type: -1, name: 'User Applied Tags', value: '{user_tags}}'}, {id: -48, type: -1, name: 'Account Name', value: '{account_name}}'}, 2892 {id:-47, type: -1, name: 'Account Id', value: '{account_id}}'}, {id:-26, type: -1, name: 'Page User Name', value: '{page_user_name}}'}, {id: -50, type: -1, name: 'Last Input', value: '{last_input}}'}, {id:-23, type: -1, name: 'Last Button Title', value: '{last_btt_title}}'}, {id:-15, type: -1, name: 'Last Order', value: '{last_order}}'}, 2893 {id:-18, type: -1, name: 'Last Seen', value: '{last_seen}}'}, {id:-21, type: -1, name: 'Last Interaction', value: '{last_interaction}}'}, {id:-22, type: -1, name: 'Facebook Inbox Link', value: '{fb_chat_link}}'}, {id:-29, type: -1, name: 'Inbox Link', value: '{inbox_link}}'}, {id:-99, type: -1, name: 'Shop Link', value: '{shop_link}}'}, 2894 {id:-16, type: -1, name: 'Cart Total', value: '{cart_total}}'},{id:-17, type: -1, name: 'Cart Subtotal', value: '{cart_subtotal}}'}, {id:-13, type: -1, name: 'Last FB comment', value: '{last_fb_comment}}'}, {id: -63, type: -1, name: 'Current Time', value: '{current_time}}'}, {id:-24, type: -1, name: 'Last FB comment total tagged users', value: '{total_tagged}}'}]; 2895 2896 if(whitelabel && whitelabel.jobs) 2897 cfs.push({id:-42, type: -1, name: 'Last Applied Job', value: '{last_applied_job}}'}) 2898 2899 2900 cfs.push({id:-100, type: -1, name: 'order_id', value: '{order_id}}'}) 2901 if(full){ 2902 cfs.push({id:-9, type: -1, name: 'Last Text Input', value: '{last_text_input}}'}), 2903 cfs.push({id:-28, type: -1, name: 'Account API Key', value: '{page_api_key}}'}), 2904 cfs.push({id:-101, type: -1, name: 'order_name', value: '{order_name}}'}) 2905 cfs.push({id:-102, type: -1, name: 'order_phone', value: '{order_phone}}'}) 2906 cfs.push({id:-103, type: -1, name: 'order_email', value: '{order_email}}'}) 2907 cfs.push({id:-104, type: -1, name: 'order_shipping_type', value: '{order_shipping_type}}'}) 2908 cfs.push({id:-105, type: -1, name: 'order_shipping_country', value: '{order_shipping_country}}'}) 2909 cfs.push({id:-106, type: -1, name: 'order_shipping_state', value: '{order_shipping_state}}'}) 2910 cfs.push({id:-107, type: -1, name: 'order_shipping_city', value: '{order_shipping_city}}'}) 2911 cfs.push({id:-108, type: -1, name: 'order_shipping_address1', value: '{order_shipping_address1}}'}) 2912 cfs.push({id:-109, type: -1, name: 'order_shipping_address2', value: '{order_shipping_address2}}'}) 2913 cfs.push({id:-110, type: -1, name: 'order_shipping_zip', value: '{order_shipping_zip}}'}) 2914 cfs.push({id:-111, type: -1, name: 'order_status', value: '{order_status}}'}) 2915 cfs.push({id:-114, type: -1, name: 'order_payment_method', value: '{order_payment_method}}'}) 2916 cfs.push({id:-115, type: -1, name: 'order_total', value: '{order_total}}'}) 2917 cfs.push({id:-116, type: -1, name: 'order_subtotal', value: '{order_subtotal}}'}) 2918 cfs.push({id:-117, type: -1, name: 'order_products', value: '{order_products}}'}) 2919 cfs.push({id:-118, type: -1, name: 'order_shipping_cost', value: '{order_shipping_cost}}'}) 2920 cfs.push({id:-119, type: -1, name: 'order_taxes', value: '{order_taxes}}'}) 2921 cfs.push({id:-120, type: -1, name: 'order_coupon_code', value: '{order_coupon_code}}'}) 2922 cfs.push({id:-121, type: -1, name: 'order_coupon_discount', value: '{order_coupon_discount}}'}) 2923 cfs.push({id:-122, type: -1, name: 'order_discount', value: '{order_discount}}'}) 2924 //cfs.push({id:-123, type: -1, name: 'order_date_timestamp', value: '{order_date_timestamp}}'}) 2925 cfs.push({id:-124, type: -1, name: 'order_date_utc', value: '{order_date_utc}}'}) 2926 cfs.push({id:-125, type: -1, name: 'order_date_pageTimezone', value: '{order_date_pageTimezone}}'}) 2927 } 2928 2929 return cfs; 2930 2931} 2932 2933function getCFforPers(data){
2934 let cfs = get_system_fields(); 2935 for(let i = 0; i < data.length; i++) 2936 cfs.push({name: data[i].name, value:'{'+data[i].name+'}}'}); 2937 2938 return cfs; 2939} 2940 2941function cf_enable_suggestions(elem, all_cf_suggestion){ 2942 $(elem).suggest('{', { 2943 filter: { 2944 casesensitive: false, 2945 limit: 500 2946 },data: all_cf_suggestion, 2947 map: function(field) { 2948 return {value: field.value, text: field.name} 2949 }, 2950 onselect: function(e, item) { 2951 const event = new Event('input', { bubbles: true }); 2952 e.target.dispatchEvent(event); 2953 2954 $(e.target).trigger('input', 'save'); 2955 } 2956 }); 2957} 2958 2959function validate_input(selector){ 2960 var elm = $(selector); 2961 if($.trim(elm.val()) === ''){ 2962 scroll_elm(elm); 2963 return false; 2964 }else 2965 return true; 2966} 2967 2968function fill_select(selector, data, keys, firstRows, sPicker){ 2969 if(sPicker === undefined) 2970 sPicker = true; 2971 2972 var s = null; 2973 if(typeof selector == 'string') 2974 s = $(selector); 2975 else 2976 s = selector; 2977 2978 var isSelectpicker = s.hasClass('selectpicker') || s.parent().hasClass('bootstrap-select'); 2979 try{s.selectpicker('destroy');}catch(ex){} 2980 2981 2982 s.find('option').remove(); 2983 2984 if(firstRows){ 2985 for (var i = 0; i < firstRows.length; i++) 2986 s.append('<option value="' + firstRows[i][keys[0]] + '">' + firstRows[i][keys[1]] + '</option>'); 2987 } 2988 2989 2990 if(keys.length == 2){ 2991 for (var i = 0; i < data.length; i++) 2992 s.append('<option value="' + data[i][keys[0]] + '">' + data[i][keys[1]] + '</option>'); 2993 }else{ 2994 for (var i = 0; i < data.length; i++) 2995 s.append('<option value="'+data[i][keys[0]]+'" data-'+keys[2]+'="'+data[i][keys[2]]+'">' + data[i][keys[1]] + '</option>'); 2996 } 2997 2998 if(sPicker && isSelectpicker){ 2999 s.selectpicker(); 3000 s.selectpicker("refresh"); 3001 } 3002 3003 return s; 3004} 3005 3006 3007function fill_items(type, selector) { 3008 var results = null; 3009 3010 if (type == 0) 3011 results = all_products; 3012 else if (type == 1) 3013 results = all_events; 3014 else if (type == 2) 3015 results = all_news; 3016 else if (type == 3) 3017 results = all_elections; 3018 else if (type == 4) 3019 results = all_subscription; 3020 else if (type == 5) 3021 results = all_custum_q; 3022 else if (type == 6) 3023 results = all_manufacturers; 3024 3025 3026 3027 3028 if(results === null) 3029 return; 3030 3031 3032 var s_items = $(selector); 3033 s_items.selectpicker('destroy'); 3034 s_items.find('option').remove(); 3035 3036 for (var i = 0; i < results.length; i++){ 3037 if (type != 5) 3038 s_items.append("<option value=\"" + results[i].id + "\">" + results[i].n + "</option>"); 3039 else 3040 s_items.append("<option value=\"" + results[i].id + "\">" + results[i].q + "</option>"); 3041 } 3042 3043 s_items.selectpicker(); 3044 s_items.selectpicker("refresh"); 3045} 3046 3047 3048function fill_templates(selector, type, all_tpts_tags, stepType) { 3049 if(selector === undefined) 3050 selector = "#tags_flows"; 3051 3052 if(all_tpts_tags === undefined) 3053 all_tpts_tags = all_tpts; 3054 3055 3056 if(type === undefined) 3057 type = "tags"; 3058 3059 3060 if(type === 'tags'){ 3061 if(ms_flows === null){ 3062 ms_flows = $(selector).magicSuggest({ 3063 maxSelection: 30, 3064 allowFreeEntries: false, 3065 allowDuplicates: false, 3066 useCommaKey: true, 3067 displayField: 'd', 3068 data: all_tpts 3069 }); 3070 }else{ 3071 ms_flows.clear(); 3072 } 3073 }else{ 3074 var s_select = typeof selector === 'string' ? $(selector) : selector; 3075 3076 s_select.selectpicker('destroy'); 3077 s_select.find('option').remove(); 3078 3079 var results = all_tpts; 3080 for (var x in results) { 3081 if(!stepType || stepType.includes(Number(results[x].ss))) 3082 s_select.append('<option value="' + results[x].id + '" data-start_step="'+results[x].ss+'">' + results[x].d + '</option>'); 3083 } 3084 3085 s_select.selectpicker(); 3086 s_select.selectpicker("refresh"); 3087 3088 return s_select; 3089 } 3090} 3091 3092 3093function isJsonString(str) { 3094 try { 3095 return JSON.parse(str); 3096 } catch (e) { 3097 return null; 3098 } 3099} 3100 3101function cloneObj(obj){ 3102 return JSON.parse(JSON.stringify(obj)); 3103} 3104 3105 3106function bttDelItemEvent(){ 3107 $('.btt-del-item[data-global_event="true"').off('click'); 3108 $('.btt-del-item[data-global_event="true"').on('click', function(){ 3109 var div_item = get_elem_parent($(this), 'div_item'); 3110 div_item.remove(); 3111 }); 3112 3113} 3114 3115 3116function str_plan_name(id){ 3117 if(id == 1) 3118 return 'Pro'; 3119 else if(id == 2) 3120 return 'Enterprise'; 3121 else if(id == 4) 3122 return 'Free'; 3123 else if(id == 5) 3124 return 'Pro No Subscription'; 3125 else if(id == 6) 3126 return 'Pro No Subscription'; 3127 else if(id == 10) 3128 return 'Demo'; 3129 else if(id == 11) 3130 return 'LTD'; 3131 else if(id == 12) 3132 return 'LTD';//agency 3133 else if(id == 15 || id == 13) 3134 return 'Pro Trial'; 3135 else if(id == 16) 3136 return 'Non Profit'; 3137 else if(id == 17) 3138 return 'PRO WL credit';
3139 else 3140 ''; 3141} 3142 3143function str_bot_status(id){ 3144 if(id == 0) 3145 return 'Disabled'; 3146 else if(id == 1) 3147 return 'Active'; 3148 else if(id == 2) 3149 return 'Only admins'; 3150 else if(id == 3) 3151 return 'Need reconnect'; 3152 else if(id == 4) 3153 return 'Deleting'; 3154 else 3155 return 'Deactivated' 3156} 3157 3158var b_menu_loaded = false; 3159 3160 3161function toogleMenu(visible){ 3162 if(visible){ 3163 $('#mysidebar').addClass('active'); 3164 $('.overlay').fadeIn(); 3165 $('#mysidebar .collapse.in').addClass('in'); 3166 $('#mysidebar a[aria-expanded=true]').attr('aria-expanded', 'false'); 3167 3168 }else{ 3169 $('#mysidebar').removeClass('active'); 3170 $('.overlay').fadeOut(); 3171 3172 $('#div_menu_bots_c').collapse('hide'); 3173 $('#pageSubmenu0').collapse('hide'); 3174 $('#pageSubmenu1').collapse('hide'); 3175 $('#pageSubmenu2').collapse('hide'); 3176 $('#pageSubmenu3').collapse('hide'); 3177 } 3178 3179} 3180 3181 3182function show_main_menu_new(type){ 3183 b_menu_loaded = true; 3184 3185 /*$("#mysidebar").mCustomScrollbar({ 3186 theme: "minimal" 3187 });*/ 3188 3189 return false; 3190 3191 3192 var itv = setInterval(function(){ 3193 /*if(document.getElementById("sidebarCollapse")){ 3194 clearInterval(itv); 3195 $('#sidebarCollapse').on('click', function () { 3196 $('#mysidebar').toggleClass('active'); 3197 $('.overlay').fadeIn(); 3198 $('#mysidebar .collapse.in').toggleClass('in'); 3199 $('#mysidebar a[aria-expanded=true]').attr('aria-expanded', 'false'); 3200 }); 3201 } */ 3202 }, 500) 3203 3204 3205 var overlay = document.getElementById('overlay'); 3206 if(overlay !== null){ 3207 overlay.addEventListener('touchmove', function(e) { 3208 e.preventDefault(); 3209 }, false); 3210 } 3211 3212 3213 $('#div_menu_bots_c').on('click', function(e){ 3214 e.stopPropagation(); 3215 }); 3216 3217 $('#div_menu_bots_c').on('show.bs.collapse', function () { 3218 $('#pageSubmenu0').collapse('hide'); 3219 $('#pageSubmenu1').collapse('hide'); 3220 $('#pageSubmenu2').collapse('hide'); 3221 $('#pageSubmenu3').collapse('hide'); 3222 }); 3223 3224 $('#pageSubmenu0').on('show.bs.collapse', function () { 3225 $('#div_menu_bots_c').collapse('hide'); 3226 $('#pageSubmenu1').collapse('hide'); 3227 $('#pageSubmenu2').collapse('hide'); 3228 $('#pageSubmenu3').collapse('hide'); 3229 }); 3230 3231 $('#pageSubmenu1').on('show.bs.collapse', function () { 3232 $('#pageSubmenu0').collapse('hide'); 3233 $('#div_menu_bots_c').collapse('hide'); 3234 $('#pageSubmenu2').collapse('hide'); 3235 $('#pageSubmenu3').collapse('hide'); 3236 }); 3237 3238 $('#pageSubmenu2').on('show.bs.collapse', function () { 3239 $('#pageSubmenu0').collapse('hide'); 3240 $('#pageSubmenu1').collapse('hide'); 3241 $('#div_menu_bots_c').collapse('hide'); 3242 $('#pageSubmenu3').collapse('hide'); 3243 }); 3244 3245 3246 let pageName = mainData.pageName 3247 3248 3249 3250 var cur_url = window.location.href; 3251 if(pageName == 'dashboard'){ 3252 $("#m_state > a, #m_state > a i, #m_state_item0 a, #m_state_item0 a i").addClass('text-primary'); 3253 }else if(pageName == 'dashboard-searches') 3254 $("#m_state > a, #m_state > a i, #m_state_item1 a, #m_state_item1 a i").addClass('text-primary'); 3255 else if(pageName == 'dashboard-users') 3256 $("#m_state > a, #m_state > a i, #m_state_item2 a, #m_state_item2 a i").addClass('text-primary'); 3257 else if(pageName == 'dashboard-subscriptions') 3258 $("#m_state > a, #m_state > a i, #m_state_item3 a, #m_state_item3 a i").addClass('text-primary'); 3259 else if(pageName == 'dashboard-refs') 3260 $("#m_state > a, #m_state > a i, #m_state_item3 a, #m_state_item3 a i").addClass('text-primary'); 3261 else if(pageName == 'questions' || pageName == 'ai' ) 3262 $("#m_question > a, #m_question > a i, #m_question_item0 a, #m_question_item0 a i").addClass('text-primary'); 3263 else if(pageName == 'stickers') 3264 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3265 else if(pageName == 'refs' && !simplified) 3266 $("#m_question > a, #m_question > a i, #m_question_item2 a, #m_question_item2 a i").addClass('text-primary'); 3267 else if(pageName == 'flows') 3268 $("#m_content a, #m_content a i").addClass('text-primary'); 3269 else if(pageName == 'boards') 3270 $("#m_boards a, #m_content a i").addClass('text-primary'); 3271 else if(pageName == 'inbox') 3272 $("#m_live_chat a, #m_live_chat a i").addClass('text-primary'); 3273 else if(pageName == 'broadcasts') 3274 $("#m_send_msg a, #m_send_msg a i").addClass('text-primary'); 3275 else if(pageName == 'swimlane') 3276 $("#m_swimlane a, #m_swimlane a i").addClass('text-primary'); 3277 else if(pageName == 'terra') 3278 $("#m_terra a, #m_terra a i").addClass('text-primary'); 3279 else if(cur_url.includes("/attachment")) 3280 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3281 else if(pageName == 'news') 3282 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3283 else if(pageName == 'events') 3284 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3285 else if(pageName == 'elections') 3286 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3287 else if(pageName == 'office') 3288 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3289 else if(pageName == 'users') 3290 $("#m_audience a, #m_audience a i").addClass('text-primary'); 3291 else if(pageName == 'messages') 3292 $("#m_send_msg a, #m_send_msg a i").addClass('text-primary'); 3293 else if(pageName == 'live-chat') 3294 $("#m_live_chat a, #m_live_chat a i").addClass('text-primary'); 3295 else if(pageName == 'tools') 3296 $("#m_tools a, #m_tools a i").addClass('text-primary'); 3297 else if(pageName == 'settings') 3298 $("#m_settings a, #m_settings a i").addClass('text-primary'); 3299 else if(true || cur_url.includes("/bots")){ 3300 $("#m_bots a, #m_bots a i").addClass('text-primary'); 3301 } 3302 3303 3304 if(pageName == 'products'){ 3305 $("#m_products a:first-child, #m_products a i").addClass('text-primary'); 3306 $("#m_categories").removeClass('hide'); 3307 }else if(pageName == 'dashboard') 3308 $("#m_analytics *").addClass('text-primary'); 3309 else if(pageName == 'coupons') 3310 $("#m_coupons *").addClass('text-primary'); 3311 else if(pageName == 'orders'){ 3312 $("#m_orders a:first-child, #m_orders a i").addClass('text-primary'); 3313 $("#m_kds").removeClass('hide'); 3314 }else if(pageName == 'tools') 3315 $("#m_marketing *").addClass('text-primary'); 3316 else if(pageName == 'users') 3317 $("#m_audience *").addClass('text-primary'); 3318 else if(pageName == 'categories') 3319 $("#m_categories").addClass('text-primary').removeClass('hide'); 3320 else if(pageName == 'kds') 3321 $("#m_kds").addClass('text-primary').removeClass('hide'); 3322 else if(pageName == 'billing') 3323 $("#btt_menu_upgrade").hide(); 3324 3325 3326 sfHideContents(); 3327} 3328 3329 3330function sfHideContents(){ 3331 try{ 3332 if(whitelabel){ 3333 let href = window.location.href; 3334 if((whitelabel.a == 0 || whitelabel.plan == 4 && whitelabel.dl <= 0) && !href.includes('/billing') && !href.includes('/login') && !href.includes('/error')){ 3335 window.location.href = whitelabel.appdomain+"admins/en/billing"; 3336 } 3337 3338 if(whitelabel.id == 2 || $("body").hasClass('bsf')){ 3339 $("body").addClass("bsf"); 3340 $(".nowt").removeClass("nowt"); 3341 3342 mainData.help = whitelabel.help; 3343 mainData.custom_tabs = whitelabel.custom_tabs; 3344 3345 try{loadCChat();}catch(e){} 3346 3347 }else{ 3348 $("body").addClass("bwt"); 3349 } 3350 3351 3352 if(whitelabel.id == 3 && location.href.includes('/s/')) 3353 $("body").attr('data-simplified', '1'); 3354 3355 if(whitelabel.id > 50) 3356 $('.pro.badge').addClass('hide'); 3357 3358 if(whitelabel.jobs) 3359 $('.jobs').removeClass('jobs'); 3360 3361 3362 $(".wt_name").html(whitelabel.name); 3363 3364 if(whitelabel.color) 3365 { 3366 var r = document.querySelector(':root'); 3367 r.style.setProperty('--primary-color', whitelabel.color.primary ); 3368 r.style.setProperty('--accent-color', whitelabel.color.accent); 3369 r.style.setProperty('--link-color', whitelabel.color.link); 3370 } 3371 } 3372 }catch(ex){} 3373} 3374 3375 3376function update_menu() { 3377 if(cur_page.plan == 13){ 3378 $("#p_day_left").removeClass('d-none'); 3379 cur_page.days_left = parseInt(cur_page.days_left); 3380 $("#p_day_left").html(get_str(272, cur_page.days_left > 0 ? cur_page.days_left : 0)); 3381 if(cur_page.days_left <= 3){ 3382 $("#p_day_left").removeClass("text-muted"); 3383 $("#p_day_left").addClass("text-danger"); 3384 }else if(cur_page.days_left < 7){ 3385 $("#p_day_left").removeClass("text-muted"); 3386 $("#p_day_left").addClass("text-warning"); 3387 } 3388 } 3389 3390 3391 if(cur_page.plan != 4 && cur_page.plan != 13) 3392 $("#btt_menu_upgrade").addClass("hide"); 3393 3394 3395 3396 if (cur_page.office == 0) 3397 $("#m_office").hide(); 3398 3399 if (my_perm.mg_all == 1){ 3400 3401 return; 3402 }else 3403 $("#m_settings").hide(); 3404 3405 if (my_perm.u == 0) 3406 $("#m_admin, #m_audience").hide(); 3407 3408 if (my_perm.q == 0) 3409 $("#m_question").hide(); 3410 3411 if (my_perm.o == 0 || cur_page.office == 0) 3412 $("#m_office").hide(); 3413 3414 if (my_perm.s == 0) 3415 $("#m_state").hide(); 3416 3417 if (my_perm.e == 0) 3418 $("#m_products").hide(); 3419 3420 3421 3422 3423 if (my_perm.t == 0) 3424 $("#m_content,#m_tools, #m_marketplace, #nemuNewBot").hide(); 3425 else 3426 3427 3428 if (my_perm.m == 0) 3429 $("#m_send_msg, #m_live_chat").hide(); 3430 3431 3432 if (my_perm.t != 2) 3433 $("#m_promotions, #m_events").hide(); 3434} 3435 3436 3437function load_nav(type){ 3438 if(type === undefined) 3439 $("#nav").html('<div class="d-flex flex-row justify-content-between align-items-center w-100"> <div id="sidebarCollapse" class="menu_button valign-wrapper navbar-btn" data-activates="slide-out"><i class="fal fa-bars" style="font-size: 24px"></i></div><div id="div_search" class="text-center col-7 col-sm-8 col-lg-6"> <div class="ui search rounded-pill w-100" style="border-radius: 50rem!important;"> <div class="ui icon input w-100"> <input id="i_nav_search_bar" class="prompt" style="width: calc(100% - 2rem) !important" type="text" data-str0="Hi {name}ð, find things faster here" placeholder=""> <i class="search icon fal fa-search"></i> </div><div class="results w-100"></div></div></div><div class="d-flex"> <img id="img_perfil" class="mr-3"/> <a id="btt_logout" class="valign-wrapper opacity70 font-size-normal">Log out</a> </div></div><div id="div_save_changes" class="w-100 h-100 bg-white flex-row justify-content-end py-2 d-none" style="z-index: 1;"> <button type="button" class="btn btn-light text-dark btn-sm rounded" data-url="" id="btt_discart_changes" onclick="discart_changes()">Cancel</button> <button type="button" class="btn bg-primary text-white ml-3 btn-sm px-5 rounded" id="btt_save_changes" onclick="save_changes()">Save</button></div><script src="../js/libs/search.js"></script><script src="../js/libs/jquery.easing.1.3.min.js"></script><script src="../js/libs/semantic-api.js"></script>'); 3440 else if(type == 'wt_admin') 3441 $("#nav").html('<div class="d-flex flex-row justify-content-between align-items-center w-100"> <div id="sidebarCollapse" class="menu_button valign-wrapper navbar-btn" data-activates="slide-out"><i class="fal fa-bars" style="font-size: 24px"></i></div><div id="div_search" class="text-center col-7 col-sm-8 col-lg-6"></div><div class="d-flex"> <img id="img_perfil" class="mr-3"/> <a id="btt_logout" class="valign-wrapper opacity70 font-size-normal">Log out</a> </div></div><div id="div_save_changes" class="w-100 h-100 bg-white flex-row justify-content-end py-2 d-none" style="z-index: 1;"> <button type="button" class="btn btn-light text-dark btn-sm rounded" data-url="" id="btt_discart_changes" onclick="discart_changes()">Cancel</button> <button type="button" class="btn bg-primary text-white ml-3 btn-sm px-5 rounded" id="btt_save_changes" onclick="save_changes()">Save</button></div>'); 3442} 3443 3444 3445function load_contextmenu(){ 3446 $("#div_t_contextMenu").remove(); 3447 $("body").append("<div id=\"div_t_contextMenu\"><div>"); 3448 3449 let str6 = '', str7; 3450 if(mainData.contextItem6) 3451 str6 = '<li> <a tabindex="-1" data-idx="6" href="javascript:;"> <i class="'+mainData.contextItem6.icon+'"></i> '+mainData.contextItem6.name+'</a> </li>'; 3452 else 3453 str6 = '<li> <a tabindex="-1" data-idx="6" href="javascript:;"> <i class="fal fa-bullhorn"></i> Send Message</a> </li>'; 3454 3455 3456 if(mainData.contextItem7) 3457 str7 = '<li> <a tabindex="-1" data-idx="7" href="javascript:;"> <i class="'+mainData.contextItem7.icon+'"></i> '+mainData.contextItem7.name+'</a> </li>'; 3458 else 3459 str7 = '<li> <a tabindex="-1" data-idx="7" href="javascript:;"> <i class="fal fa-list-ul"></i> '+myi18n.t('subcategories')+'</a> </li>'; 3460 3461 3462 try{ 3463 $("#div_t_contextMenu").html('<ul id="t_contextMenu" class="dropdown-menu t-dropdown-menu" role="menu"> <li> <a tabindex="-1" data-idx="0" href="javascript:;"> <i class="fal fa-pen"></i> '+myi18n.t('edit')+'</a> </li><li> <a tabindex="-1" data-idx="13" href="javascript:;"> <i class="fal fa-text"></i> '+myi18n.t('rename')+'</a> </li><li> <a tabindex="-1" data-idx="2" href="javascript:;"> <i class="fal fa-clone"></i> '+myi18n.t('duplicate')+'</a> </li><li> <a tabindex="-1" data-idx="14" href="javascript:;"> <i class="fal fa-file-export"></i> '+myi18n.t('copyTo')+'</a> </li><li> <a tabindex="-1" data-idx="3" href="javascript:;"> <i class="fal fa-eye"></i> '+myi18n.t('preview')+'</a> </li><li> <a tabindex="-1" data-idx="4" href="javascript:;"> <i class="fal fa-link"></i>'+myi18n.t('getLink')+'</a> </li><li> <a tabindex="-1" data-idx="5" href="javascript:;"> <i class="fal fa-chart-line"></i> '+myi18n.t('viewAnalytics')+'</a> </li>'+str6+str7+'<li> <a tabindex="-1" data-idx="8" href="javascript:;"> <i class="fal fa-ban"></i> '+myi18n.t('cancel')+'</a> </li><li> <a tabindex="-1" data-idx="9" href="javascript:;"> <i class="fal fa-redo-alt"></i> '+myi18n.t('resend')+'</a> </li><li> <a tabindex="-1" data-idx="10" href="javascript:;"> <i class="fa-light fa-folder-arrow-up"></i> '+myi18n.t('movetoFolder')+'</a> </li><li> <a tabindex="-1" data-idx="12" href="javascript:;"> <i class="fal fa-code"></i> Get Payload (Ads)</a> </li><li class="hide"> <a tabindex="-1" data-idx="11" href="javascript:;"> <i class="fal fa-qrcode"></i> Get QR Code</a> </li><li> <a tabindex="-1" data-idx="15" href="javascript:;"> <i class="fal fa-fingerprint"></i> '+myi18n.t('getID')+'</a> </li><li> <a tabindex="-1" data-idx="1" href="javascript:;" class="text-danger"> <i class="fal fa-trash-alt text-danger"></i> '+myi18n.t('delete')+'</a> </li></ul>'); 3464 }catch(ex){ 3465 $("#div_t_contextMenu").html('<ul id="t_contextMenu" class="dropdown-menu t-dropdown-menu" role="menu"> <li> <a tabindex="-1" data-idx="0" href="javascript:;"> <i class="fal fa-pen"></i> Edit</a> </li><li> <a tabindex="-1" data-idx="13" href="javascript:;"> <i class="fal fa-text"></i> Rename</a> </li><li> <a tabindex="-1" data-idx="2" href="javascript:;"> <i class="fal fa-clone"></i> Duplicate</a> </li><li> <a tabindex="-1" data-idx="14" href="javascript:;"> <i class="fal fa-file-export"></i> Copy to another page</a> </li><li> <a tabindex="-1" data-idx="3" href="javascript:;"> <i class="fal fa-eye"></i> Preview</a> </li><li> <a tabindex="-1" data-idx="4" href="javascript:;"> <i class="fal fa-link"></i>Get Link</a> </li><li> <a tabindex="-1" data-idx="5" href="javascript:;"> <i class="fal fa-chart-line"></i> View Analytics</a> </li>'+str6+str7+'<li> <a tabindex="-1" data-idx="8" href="javascript:;"> <i class="fal fa-ban"></i> Cancel</a> </li><li> <a tabindex="-1" data-idx="9" href="javascript:;"> <i class="fal fa-redo-alt"></i> Resend</a> </li><li> <a tabindex="-1" data-idx="10" href="javascript:;"> <i class="fal fa-code"></i> Get JSON code (Ads)</a> </li><li> <a tabindex="-1" data-idx="12" href="javascri
3465pt:;"> <i class="fa-light fa-folder-arrow-up"></i> '+myi18n.t('movetoFolder')+'</a> </li><li class="hide"> <a tabindex="-1" data-idx="11" href="javascript:;"> <i class="fal fa-qrcode"></i> Get QR Code</a> </li><li> <a tabindex="-1" data-idx="15" href="javascript:;"> <i class="fal fa-fingerprint"></i> Get ID</a> </li><li> <a tabindex="-1" data-idx="1" href="javascript:;" class="text-danger"> <i class="fal fa-trash-alt text-danger"></i> Delete</a> </li></ul>'); 3466 } 3467} 3468 3469load_contextmenu(); 3470 3471 3472function spinner(selector, hide){ 3473 if(typeof selector == 'string') 3474 selector = $(selector); 3475 3476 if(hide === undefined) 3477 selector.removeClass('hide'); 3478 else 3479 selector.addClass('hide'); 3480} 3481 3482 3483function duplicateItem(id, op, op1, url){ 3484 let param = {op: isNumeric(op) ? getContentName(op, 1) : op, id:id, timezone: getTimezone()}; 3485 3486 if(op1){ 3487 param.op1 = op1; 3488 param.op2 = 'duplicate'; 3489 }else 3490 param.op1 = 'duplicate'; 3491 3492 pb_show(true, myi18n.t('processing')); 3493 execute_request(param, null, null, false, function (r) { 3494 if (r.status == 'OK'){ 3495 msg_success(); 3496 3497 if(url){ 3498 if(r.id) 3499 document.location.href = url+'id='+r.id+'&acc='+cur_page.page_id 3500 else{ 3501 if(cur_page) 3502 document.location.href = url+'id='+r.data.id+'&acc='+cur_page.page_id 3503 else 3504 document.location.href = url+'id='+r.data.id 3505 } 3506 }else 3507 location.reload(); 3508 3509 }else{ 3510 pb_show(false); 3511 msg_error(myi18n.t('msg0')); 3512 } 3513 3514 }); 3515} 3516 3517 3518function createNewItem(op, op1, op2, url){ 3519 var name = $('#modelNewItem input.name').val().trim(); 3520 if(name === ''){ 3521 msg_error(myi18n.t('msg10')); 3522 return; 3523 } 3524 3525 $("#modelNewItem").modal('hide'); 3526 3527 pb_show(true, myi18n.t('processing')); 3528 var param = {page_id: cur_page.page_id, op, op1, data:{name : name, folder: activeFolder.id}}; 3529 3530 if(op2) 3531 param.op2 = op2; 3532 3533 3534 execute_request(param, null, null, false, function (r) { 3535 if (r.status == 'OK'){ 3536 if(r.id) 3537 url += 'id='+r.id; 3538 else 3539 url += 'id='+r.data.id; 3540 3541 if(cur_page && cur_page.page_id) 3542 url += '&acc='+cur_page.page_id; 3543 3544 3545 document.location.href = url; 3546 3547 3548 msg_success(); 3549 }else{ 3550 pb_show(false); 3551 msg_error(myi18n.t('msg0')); 3552 } 3553 3554 }); 3555} 3556 3557 3558 3559 3560function renameItem1(item, op, op1){ 3561 let form = {title: myi18n.t('rename'), rows: [{id:'name', label: myi18n.t('name'), value: item.name, closeOnEnter: true}]} 3562 3563 showForms(form, function(data){ 3564 item.name = data.name; 3565 3566 let param = {op: op, op1:'update', rename: true, id: item.id, data: {name: data.name}} 3567 if(op1){ 3568 param.op1 = op1; 3569 param.op2 = 'update' 3570 } 3571 3572 execute_request(param, null, null, false, function (r) { 3573 if (r.status != "OK"){ 3574 msg_error(); 3575 } 3576 }); 3577 }) 3578} 3579 3580 3581function renameItem(id, op, format, columnIdx, checkLastName){ 3582 let name = $('#modelNewItem input.name').val().trim(), op1; 3583 if(name === ''){ 3584 msg_error(myi18n.t('msg10')); 3585 return; 3586 } 3587 3588 if(!mainData.op1){ 3589 if(op == 0) 3590 op1 = 'rename-flow'; 3591 else 3592 op1 = 'update'; 3593 3594 op2 = 'rename'; 3595 }else{ 3596 op1 = mainData.op1; 3597 op2 = 'update'; 3598 } 3599 3600 3601 $("#modelNewItem").modal('hide'); 3602 3603 op = op === null ? mainData.op : getContentName(op, 1); 3604 3605 3606 pb_show(true, myi18n.t('processing')); 3607 let param = {page_id: cur_page.page_id, op, op1, op2}; 3608 if(format === 0) 3609 param.data = {name : name, id: id} 3610 else if(format === 2){ 3611 param.fields = [{name : 'name', value: name}] 3612 param.id = id; 3613 }else{ 3614 param.name = name; 3615 param.id = id; 3616 } 3617 3618 execute_request(param, null, null, false, function (data) { 3619 if (data.status == 'OK'){ 3620 msg_success(); 3621 3622 let td = $("#tr"+id+" td:nth-of-type("+(columnIdx + 1)+")"); 3623 if(checkLastName) 3624 name = td.html().replace(oldNameToChange, name); 3625 3626 td.html(name); 3627 if(op == 0) 3628 td.find('[data-toggle="tooltip"]').tooltip(); 3629 }else{ 3630 msg_error(myi18n.t('msg0')); 3631 } 3632 3633 pb_show(false); 3634 3635 }); 3636} 3637 3638 3639var oldNameToChange = ''; 3640
3641function modalNewItem(title, placeholder, functionName, folder, value){ 3642 if(!title) 3643 title = myi18n.t('add_new'); 3644 3645 if(!placeholder) 3646 placeholder = myi18n.t('name'); 3647 3648 3649 if(folder) 3650 folder = '<span class="mt-2 text-secondary">'+escapeHtml(folder)+'</span>'; 3651 else 3652 folder = ''; 3653 3654 if(value === undefined){ 3655 oldNameToChange = ''; 3656 value = ''; 3657 }else{ 3658 oldNameToChange = value; 3659 value = escapeHtml(value); 3660 } 3661 3662 $("#modelNewItem").remove(); 3663 $('body').append('<div id="modelNewItem" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <div class="invisible"></div><h5 class="modal-title">'+title+'</h5> <div class="modal-dismiss" data-dismiss="modal" aria-label="Close"> <i class="fal fa-times"></i> </div></div><div class="modal-body"> <div class="form-group_c"> <div class="form-group"> <input type="text" class="myimput w-100 name" placeholder="'+placeholder+'" value="'+value+'"/> </div>'+folder+'</div></div><div class="modal-footer"> <div class="d-flex px-3 py-2 justify-content-between w-100"> <button data-dismiss="modal" type="button" class="btn btn-outline-secondary nagative">'+myi18n.t('cancel')+'</button> <button data-dismiss="modal" type="button" class="btn btn-primary positive" onclick="'+functionName+'">'+myi18n.t('continue')+'</button> </div></div></div></div></div>') 3664 3665 let model = $("#modelNewItem"); 3666 actionOnEnterKey(model.find("input.name"), model.find(".positive"), null); 3667 model.modal('show'); 3668} 3669 3670function actionOnEnterKey(input, button, model){ 3671 if(typeof input == 'string') 3672 input = $(input); 3673 3674 if(typeof button == 'string') 3675 button = $(button); 3676 3677 if(typeof model == 'string') 3678 model = $(model); 3679 3680 input.on('keyup', e => { 3681 if(e.keyCode == 13) 3682 $(button).click(); 3683 else if(e.keyCode == 27 && model != null) 3684 model.modal('hide'); 3685 }); 3686 3687 /*input.on('keyup', e => { 3688 if (e.key === 'Enter' && !e.isComposing) { 3689 e.preventDefault(); 3690 $(button).click(); 3691 } 3692 else if (e.key === 'Escape' && model != null) { 3693 model.modal('hide'); 3694 } 3695 });*/ 3696} 3697 3698 3699 3700function animateCSS(element, animationName, callback) { 3701 if(animationName == undefined) 3702 animationName = 'tada'; 3703 3704 let node = typeof element == 'string' ? document.querySelector(element) : element.get(0); 3705 3706 node.classList.add('animated', animationName) 3707 3708 function handleAnimationEnd() { 3709 node.classList.remove('animated', animationName) 3710 node.removeEventListener('animationend', handleAnimationEnd) 3711 3712 if (typeof callback === 'function') callback() 3713 } 3714 3715 node.addEventListener('animationend', handleAnimationEnd) 3716} 3717 3718function getCustomFields(results, type, botField){ 3719 let data = []; 3720 for(i = 0; i < results.length; i++){ 3721 if((type === null || type.includes(results[i].type)) && (results[i].botfield == 0 || botField && results[i].botfield == 1)) 3722 data.push(results[i]); 3723 } 3724 3725 return data; 3726} 3727 3728function fill_custom_fields(selector, type, results, firstRows, botField){ 3729 if(type === undefined) 3730 type = null; 3731 3732 if(botField === undefined) 3733 botField = null; 3734 3735 if(results === undefined || results === null) 3736 results = all_custom_fields; 3737 3738 3739 var s_cf = null; 3740 if(typeof selector == 'string') 3741 s_cf = $(selector); 3742 else 3743 s_cf = selector; 3744 3745 3746 3747 3748 s_cf.selectpicker('destroy'); 3749 s_cf.find('option').remove(); 3750 3751 if(firstRows !== undefined){ 3752 for (var i = 0; i < firstRows.length; i++) 3753 s_cf.append("<option value=\"" + firstRows[i].id + "\" data-type=\"-1\" >" + firstRows[i].name + "</option>"); 3754 } 3755 3756 for (var i = 0; i < results.length; i++){ 3757 if((type === null || type.includes(results[i].type)) && (botField === null || botField == results[i].botfield) ) 3758 s_cf.append("<option value=\"" + results[i].id + "\" data-type=\"" + results[i].type + "\" >" + results[i].name + "</option>"); 3759 } 3760 3761 s_cf.selectpicker(); 3762 s_cf.selectpicker("refresh"); 3763 return s_cf; 3764} 3765 3766 3767 3768 3769 3770/*========================================================== Folders ========================================================== */ 3771 3772function folderDraw(container, data, parent, content){ 3773 container = $(container); 3774 container.empty(); 3775 3776 let name, hide = '', draggable = '', icon; 3777 for(let i = 0; i < data.length; i++){ 3778 if(visibleFolders && ! visibleFolders.includes(Number(data[i].id))) 3779 continue; 3780 3781 if(data[i].id < 1000){ 3782 hide = 'hide'; 3783 draggable = ''; 3784 }else{ 3785 hide = ''; 3786 draggable = 'draggable="true"'; 3787 } 3788 3789 if(data[i].id == 7){ 3790 icon = 'fal fa-folder-times'; 3791 name = myi18n.t('trash'); 3792 }else{ 3793 icon = 'fal fa-folder'; 3794 name = data[i].name; 3795 } 3796 3797 3798 container.append('<div class="folder0 col-12 col-sm-6 col-md-4"> <div title="'+escapeHtml(name)+'" data-id="'+data[i].id+'" data-parent="'+parent+'" data-content="'+content+'" '+draggable+' class="folder d-flex border rounded bg-white"> <i class="'+icon+' fIcon"></i> <span class="flex-fill text-left pl-3 text-truncate">'+escapeHtml(name)+'</span> <div class="actions d-flex '+hide+'"> <i class="fal fa-pen" data-toggle="tooltip" title="'+myi18n.t('rename')+'"></i> <i class="fal fa-trash-alt" data-toggle="tooltip" title="'+myi18n.t('delete')+'"></i> </div><input maxlength="40" class="input_no_style hide" placeholder="'+myi18n.t('folderName')+'" data-value="'+name+'" value="'+name+'" /></div></div>'); 3799 } 3800 3801 if(bNewFolder && createFolder &&(parent == 0 || parent >=1000)) 3802 container.append('<div class="col-12 col-sm-6 col-md-4"> <div data-parent="'+parent+'" data-content="'+content+'" class="folder new d-flex rounded"> <i class="fal fa-folder-plus fIcon"></i> <span class="flex-fill text-left pl-3">'+myi18n.t('newFolder')+'</span> </div></div>'); 3803 3804 folderEvents(); 3805} 3806 3807function getContentName(c, format){ 3808 if(format === undefined || format == 0){ 3809 if(c == 0) 3810 return myi18n.t('flows'); 3811 else if(c == 1) 3812 return myi18n.t('tags'); 3813 else if(c == 2) 3814 return myi18n.t('c_fields'); 3815 else if(c == 3) 3816 return myi18n.t('triggers'); 3817 else if(c == 4) 3818 return myi18n.t('a_responses'); 3819 else if(c == 5) 3820 return myi18n.t('sequences'); 3821 else if(c == 6) 3822 return 'Zapier/Make/Pabbly Events';//zapier 3823 else if(c == 7) 3824 return 'OTN'; 3825 else if(c == 8) 3826 return myi18n.t('campaigns'); 3827 else if(c == 9) 3828 return myi18n.t('fbAutoComment'); 3829 else if(c == 15) 3830 return myi18n.t('uPersMenu'); 3831 else if(c == 18) 3832 return myi18n.t('customEvents'); 3833 }else if(format == 1){ 3834 if(c == 0) 3835 return 'flows'; 3836 else if(c == 1) 3837 return 'tags'; 3838 else if(c == 2) 3839 return 'custom-fields'; 3840 else if(c == 3) 3841 return 'rules'; 3842 else if(c == 5) 3843 return 'sequences'; 3844 else if(c == 8) 3845 return 'campaigns'; 3846 else if(c == 9) 3847 return 'tools-fb-comment'; 3848 else if(c == 16) 3849 return 'tools-fb-comment'; 3850 else if(c == 18) 3851 return 'custom-events'; 3852 }else{ 3853 if(c == 0) 3854 return 'flows'; 3855 else if(c == 1) 3856 return 'tags'; 3857 else if(c == 2) 3858 return 'user-custom-fields'; 3859 else if(c == 3) 3860 return 'rules'; 3861 else if(c == 4) 3862 return 'questions'; 3863 else if(c == 5) 3864 return 'sequences'; 3865 else if(c == 6) 3866 return 'platform-events';//zapier 3867 else if(c == 7) 3868 return 'otn'; 3869 else if(c == 15) 3870 return 'bot-menus'; 3871 else if(c == 8) 3872 return 'email-campaigns'; 3873 else if(c == 9) 3874 return 'fb-comments'; 3875 else if(c == 18) 3876 return 'custom-events'; 3877 } 3878 3879} 3880 3881var my_trDrag = null; dragFolder = null, bpushState = false, bNewFolder = true; 3882 3883function folderPaths(container, data, content){ 3884 bNewFolder = true; 3885 container = $(container); 3886 container.empty(); 3887 3888 data.push({id:0, name: getContentName(content)}); 3889 activeFolder = data[0]; 3890 mainData.activeFolder = activeFolder; 3891 3892 3893 if(bpushState){ 3894 history.pushState({"id": data[0].id}, "", getContentName(content,2)+"?acc="+cur_page.page_id+"&folder="+data[0].id); 3895 bpushState = false;
3896 } 3897 3898 3899 if(data.length == 1) 3900 return; 3901 3902 for(let i = data.length -1; i > 0; i--){ 3903 if(data[i].id > 0 && data[i].id < 1000) 3904 bNewFolder = false; 3905 3906 container.append('<li class="breadcrumb-item bcFolder p-1" data-id="'+data[i].id+'" data-content="'+content+'"><span onclick="bpushState = true; load_data('+data[i].id+')">'+data[i].name+'</span></li>'); 3907 } 3908 3909 if(data[0].id > 0 && data[0].id < 1000) 3910 bNewFolder = false; 3911 3912 container.append('<li class="breadcrumb-item active p-1" aria-current="page">'+data[0].name+'</li>'); 3913 3914 folderEvents(); 3915} 3916 3917 3918 3919 3920function folderEvents(){ 3921 $('.folder .fa-trash-alt').off('click') 3922 $('.folder .fa-trash-alt').on('click', function(e){ 3923 e.stopPropagation(); 3924 folderDelete(null, get_elem_parent($(this), 'folder'), 0); 3925 }); 3926 3927 $('.folder:not(.new)').off('click') 3928 $('.folder:not(.new)').on('click', function(){ 3929 bpushState = true; 3930 load_data($(this).data('id')); 3931 }); 3932 3933 $('.folder.new').off('click') 3934 $('.folder.new').on('click', function(){ 3935 let parent = $(this).data('parent'); 3936 let content = $(this).data('content'); 3937 modalNewItem(myi18n.t('newFolder'), myi18n.t('folderName'), 'createNewFolder('+parent+','+content+')'); 3938 }); 3939 3940 3941 3942 $('.folder input').off('click') 3943 $('.folder input').on('click', function(e){ 3944 e.stopPropagation(); 3945 }); 3946 3947 3948 $('.folder input').off('keyup'); 3949 $('.folder input').on('keyup',function(e) { 3950 if(e.key == 'Enter') { 3951 folderEditFinish(true, null, $(this)); 3952 }else if(e.key == 'Escape') 3953 folderEditFinish(false, null, $(this)); 3954 }); 3955 3956 $('.folder input').off('blur') 3957 $('.folder input').on('blur', function(e){ 3958 folderEditFinish(false, null, $(this)); 3959 }); 3960 3961 $('.folder .fa-pen').off('click'); 3962 $('.folder .fa-pen').on('click', function(e){ 3963 e.stopPropagation(); 3964 let folder = get_elem_parent($(this), 'folder'); 3965 let input = folder.find('input'); 3966 input.removeClass('hide').focus(); 3967 folder.addClass('bdr_primary_color'); 3968 }); 3969 3970 3971 $('.my_tr').off('dragstart'); 3972 $('.my_tr').on('dragstart', function(ev){ 3973 setTimeout(() => { 3974 $("body").addClass('foldervove'); 3975 $(".forder_C_C").addClass('box_shadow'); 3976 }, 800); 3977 3978 3979 ev = ev.originalEvent; 3980 ev.stopImmediatePropagation(); 3981 let elm = get_elem_parent($(ev.target), 'my_tr'); 3982 ev.dataTransfer.setData("JSON", JSON.stringify({type : 'item', id: elm.attr('id').substring(2)})); 3983 elm.css("opacity", "0.2"); 3984 my_trDrag = elm; 3985 }); 3986 3987 $('.my_tr').off('dragend'); 3988 $('.my_tr').on('dragend', function(ev){ 3989 setTimeout(() => { 3990 $("body").removeClass('foldervove'); 3991 $(".forder_C_C").removeClass('box_shadow'); 3992 }, 1000); 3993 3994 3995 my_trDrag.css("opacity", "1"); 3996 }); 3997 3998 3999 $('.folder').off('dragstart'); 4000 $('.folder').on('dragstart', function(ev){ 4001 ev = ev.originalEvent; 4002 ev.stopImmediatePropagation(); 4003 let elm = $(ev.target); 4004 ev.dataTransfer.setData("JSON", JSON.stringify({type : 'folder', id: elm.data('id')})); 4005 elm.css("opacity", "0.2"); 4006 dragFolder = elm; 4007 }); 4008 4009 $('.folder').off('dragend'); 4010 $('.folder').on('dragend', function(ev){ 4011 dragFolder.css("opacity", "1"); 4012 }); 4013 4014 4015 $('.folder:not(.new), .bcFolder').off('dragover'); 4016 $('.folder:not(.new), .bcFolder').on('dragover', function(ev){ 4017 ev = ev.originalEvent; 4018 4019 if(my_trDrag || dragFolder){ 4020 elm = $(ev.target); 4021 if(!elm.hasClass('folder') && !elm.hasClass('bcFolder')){ 4022 elm = get_elem_parent($(ev.target), 'folder'); 4023 if(!elm){ 4024 elm = get_elem_parent($(ev.target), 'bcFolder'); 4025 if(!elm) 4026 return; 4027 } 4028 } 4029 4030 let targetId = elm.data('id'); 4031 if(targetId != 7 && targetId >= 5 && targetId < 1000) 4032 return; 4033 4034 4035 ev.preventDefault();
4036 elm.find('*').css('pointer-events', 'none'); 4037 4038 if(!elm.hasClass('bdr_primary_color') && elm.hasClass('folder')) 4039 elm.addClass('bdr_primary_color bdr_dashed'); 4040 } 4041 }); 4042 4043 $('.folder').off('dragleave'); 4044 $('.folder').on('dragleave', function(ev){ 4045 ev = ev.originalEvent; 4046 4047 if(my_trDrag || dragFolder){ 4048 let elm = $(ev.target); 4049 elm.removeClass('bdr_primary_color bdr_dashed'); 4050 elm.find('*').css('pointer-events', 'all'); 4051 } 4052 }); 4053 4054 $('.folder, .bcFolder').off('drop'); 4055 $('.folder, .bcFolder').on('drop', function(ev){ 4056 ev = ev.originalEvent; 4057 let elm = $(ev.currentTarget); 4058 elm.find('*').css('pointer-events', 'all'); 4059 4060 let folder = get_elem_parent(elm, 'folder'); 4061 if(!folder) 4062 folder = get_elem_parent(elm, 'bcFolder'); 4063 4064 if(!folder) 4065 return; 4066 4067 folder.removeClass("bdr_primary_color bdr_dashed"); 4068 4069 var data = JSON.parse(ev.dataTransfer.getData("JSON")); 4070 if (data.type == "folder") 4071 folderMove(data.id, folder.data('id'), folder.data('content')); 4072 else if(data.type == "item") 4073 folderMoveItem(data.id, [folder.data('id')], folder.data('content')) 4074 4075 }); 4076 4077 4078} 4079 4080function folderMove(id, parent, content){ 4081 if(id == parent || parent != 7 && parent > 0 && parent < 1000) 4082 return; 4083 4084 let param = []; 4085 param.push({page_id: cur_page.page_id, op: 'folder', op1: 'move', data: {id:id, parent:parent}}); 4086 param.push({page_id: cur_page.page_id, op: 'folder', op1: 'get', 'parent': activeFolder.id, content: content}); 4087 4088 pb_show(true); 4089 execute_request(param, null, null, false, function (data) { 4090 if(data[0].status === 'OK'){ 4091 folderDraw('.forder_C', data[1].results, parent, content); 4092 }else if(data[0].code === 30){ 4093 msg_error(myi18n.t('msg0')); 4094 } 4095 4096 pb_show(false); 4097 }); 4098} 4099 4100function folderMoveItem(items, parent, content){ 4101 if(parent != 7 && parent >= 5 && parent < 1000) 4102 return; 4103 4104 let param = []; 4105 param = {page_id: cur_page.page_id, op: 'folder', op1: 'move-item', data: {id:items, parent:parent, content: Number(content)}}; 4106 4107 execute_request(param, null, null, false, function (data) { 4108 if(data.status === 'OK'){ 4109 $("#t_contextMenu").appendTo("body"); 4110 for(i = 0; i < items.length; ++i) 4111 total_checked[cur_table_idx].table.row($("#tr"+items[i])).remove().draw(); 4112 4113 msg_success(); 4114 }else if(data.code === 30){ 4115 msg_error(myi18n.t('msg0')); 4116 } 4117 4118 pb_show(false); 4119 }); 4120} 4121 4122function createNewFolder(parent, content){ 4123 var name = $('#modelNewItem input.name').val().trim(); 4124 if(name === ''){ 4125 msg_error(myi18n.t('msg10')); 4126 return; 4127 } 4128 4129 $("#modelNewItem").modal('hide'); 4130 4131 4132 let data; 4133 if(content != 4) 4134 data = {name: name, parent: parent, c0: 1, c1: 1, c2: 1, c3: 1, c4: 0, c5: 1, c6: 1, c7: 1, c8: 1, c9: 1, c10: 1, c11: 1}; 4135 else 4136 data = {name: name, parent: parent, c0: 0, c1: 0, c2: 0, c3: 0, c4: 1, c5: 0, c6: 0, c7: 0, c8: 0, c9: 0, c10: 0, c11: 0}; 4137 4138 let param = []; 4139 param.push({page_id: cur_page.page_id, op: 'folder', op1: 'add', data: data}); 4140 param.push({page_id: cur_page.page_id, op: 'folder', op1: 'get', 'parent': parent, content: content}); 4141 4142 pb_show(true); 4143 execute_request(param, null, null, false, function (data) { 4144 if(data[0].status === 'OK'){ 4145 folderDraw('.forder_C', data[1].results, parent, content); 4146 }else if(data[0].code === 30){ 4147 msg_error('Folder already exist'); 4148 } 4149 4150 pb_show(false); 4151 }); 4152 4153} 4154 4155function folderDelete(folderID, folder, attempts){ 4156 if(folder === null) 4157 folder = $('.forder_C .folder[data-id='+folderID+']'); 4158 4159 if(folderID === null) 4160 folderID = folder.data('id'); 4161 4162 let folderName = folder.find('span').html(); 4163 4164 if(attempts === 0){ 4165 let param = {page_id: cur_page.page_id, op: 'folder', op1: 'get', op2: 'basic', id: folderID} 4166 4167 execute_request(param, null, null, false, function (data) { 4168 if(data.status === 'OK'){ 4169 data = data.data; 4170 let str = myi18n.tc('msg6', folderName); 4171 if(data.total > 0){ 4172 str+="<br><br>
4172"+myi18n.t('msg7'); 4173 4174 for(let i = 0; i < data.resources.length; i++){ 4175 if(data.resources[i] > 0) 4176 str+= '<br>'+getContentName(i)+": "+data.resources[i]; 4177 } 4178 } 4179 4180 show_model(true, str, myi18n.t('delete'), myi18n.t('cancel'), ''); 4181 $("#btt_yes").click(function (){ 4182 folder.parent().remove(); 4183 4184 let param = {page_id: cur_page.page_id, op: 'folder', op1: 'delete', id: folderID} 4185 execute_request(param, null, null, false, function (data){ 4186 4187 }); 4188 4189 4190 }); 4191 4192 4193 4194 }else if(data[0].code === 30){ 4195 msg_error('Folder already exist'); 4196 } 4197 4198 pb_show(false); 4199 }); 4200 }else{ 4201 folder.find('[data-toggle="tooltip"]').tooltip('hide'); 4202 folder.parent().remove(); 4203 } 4204} 4205 4206function folderEditFinish(success, folder, input){ 4207 if(input == null) 4208 input = folder.find('input'); 4209 4210 if(folder == null) 4211 folder = get_elem_parent(input, 'folder'); 4212 4213 input.addClass('hide'); 4214 4215 folder.removeClass('bdr_primary_color'); 4216 4217 let name = input.val().trim(); 4218 if(success && name.length > 0 && name != input.data('value')){ 4219 folder.find('span').html(name); 4220 param = {page_id: cur_page.page_id, op: 'folder', op1:'rename', data: {id: folder.data('id'), parent: folder.data('parent'), name:name}} 4221 execute_request(param, null, null, false, function (data) { 4222 if(data.status == 'OK'){ 4223 input.data('value', name); 4224 }else{ 4225 folder.find('span').html(input.data('value')); 4226 if(data.code == 30) 4227 msg_error('Folder already exist'); 4228 } 4229 }) 4230 }else{ 4231 input.val(input.data('value')); 4232 } 4233 4234 4235} 4236 4237window.addEventListener('popstate', function(e) { 4238 try{ 4239 if(e.state){ 4240 let data = e.state; 4241 load_data(data.id); 4242 }else 4243 load_data(0); 4244 }catch(ex){} 4245}); 4246 4247window.addEventListener('pageshow', function(event) { 4248 if (mainData.pageshowReload && event.persisted) { 4249 window.location.reload(); 4250 } 4251}); 4252 4253function doGetCaretPosition(ctrl){ 4254 if(typeof ctrl === 'string' || ctrl instanceof String){ 4255 ctrl = document.querySelector(ctrl); 4256 if(ctrl === null) 4257 return 0; 4258 }else if(ctrl instanceof jQuery) 4259 ctrl = ctrl.get(0); 4260 4261 var CaretPos = 0; 4262 4263 if (ctrl.selectionStart || ctrl.selectionStart == 0){ 4264 CaretPos = ctrl.selectionStart; 4265 }else if (document.selection){ 4266 ctrl.focus (); 4267 var Sel = document.selection.createRange (); 4268 Sel.moveStart('character', -ctrl.value.length); 4269 CaretPos = Sel.text.length; 4270 } 4271 4272 return CaretPos; 4273} 4274 4275 4276function setCaretPosition(ctrl,pos) 4277{ 4278 if(typeof ctrl === 'string' || ctrl instanceof String){ 4279 ctrl = document.querySelector(ctrl); 4280 if(ctrl === null) 4281 return 0; 4282 }else if(ctrl instanceof jQuery) 4283 ctrl = ctrl.get(0); 4284 4285 if (ctrl.setSelectionRange) 4286 { 4287 ctrl.focus(); 4288 ctrl.setSelectionRange(pos,pos); 4289 } 4290 else if (ctrl.createTextRange) 4291 { 4292 var range = ctrl.createTextRange(); 4293 range.collapse(true); 4294 range.moveEnd('character', pos); 4295 range.moveStart('character', pos); 4296 range.select(); 4297 } 4298} 4299 4300function emojiEvents(parentElm){ 4301 if(!parentElm) 4302 parentElm = ''; 4303 4304 $(parentElm+" .div_text_c textarea, .div_text_c input").off('focus'); 4305 $(parentElm+" .div_text_c textarea, .div_text_c input").on('focus', function(){ 4306 let parent = get_elem_parent($(this), 'div_text_c'); 4307 parent.find('.div_text').removeClass('hide'); 4308 }); 4309 4310 $(parentElm+" .div_text_c textarea, .div_text_c input ").off('blur'); 4311 $(parentElm+" .div_text_c textarea, .div_text_c input ").on('blur', function(){ 4312 let elm = $(this); 4313 setTimeout(function(){ 4314 let parent = get_elem_parent(elm, 'div_text_c'); 4315 parent.find('.div_text').addClass('hide'); 4316 }, 300); 4317 }); 4318 4319 4320 4321 $(parentElm+" .div_cf").off("click"); 4322 $(parentElm+" .div_cf").on("click", function(e){ 4323 e.stopPropagation(); 4324 4325 let elm = get_elem_parent($(this), 'div_text_c').find($(this).parent().data("selector")); 4326 ativeEmoji = elm; 4327 4328 let caretPos = doGetCaretPosition(elm); 4329 let val = elm.val(); 4330 elm.val(val.substring(0, caretPos) + '{' + val.substring(caretPos) ); 4331 setCaretPosition(elm, caretPos+1); 4332 4333 elm.trigger('keyup'); 4334 }) 4335 4336
4337 $(parentElm+" .div_emoji").off("click"); 4338 $(parentElm+" .div_emoji").on("click", function(e){ 4339 e.stopPropagation(); 4340 4341 $("emoji-picker .emoji-mart").off("click"); 4342 $("emoji-picker .emoji-mart").on("click", function(e){ 4343 e.stopPropagation(); 4344 }); 4345 4346 let elm = get_elem_parent($(this), 'div_text_c').find($(this).parent().data("selector")); 4347 ativeEmoji = elm; 4348 4349 ativeEmoji.data("caretPos", doGetCaretPosition(elm)); 4350 4351 let viewportOffset = $(this).parent().get(0).getBoundingClientRect(); 4352 let top = viewportOffset.top; 4353 let left = viewportOffset.left; 4354 4355 $("emoji-picker .emoji-mart").css({top: top - 2, left: left - get_elem_parent($(this), 'div_text_c').width() + 12}); 4356 $("emoji-picker").css({display: 'block'}); 4357 }); 4358} 4359 4360emojiEvents(); 4361 4362 4363var ativeEmoji = null 4364function emojiSeleted(e){ 4365 //$("emoji-picker").css('display', 'none'); 4366 let val = ativeEmoji.val(); 4367 let caretPos = ativeEmoji.data('caretPos'); 4368 let newcaretPos = Number(caretPos) + e.native.length; 4369 ativeEmoji.data('caretPos', newcaretPos); 4370 ativeEmoji.val(val.substring(0, caretPos) + e.native + val.substring(caretPos) ); 4371 setCaretPosition(ativeEmoji, newcaretPos); 4372 ativeEmoji.trigger('input', 'save'); 4373 4374} 4375 4376$(window).click(function() { 4377 if(ativeEmoji){ 4378 $("emoji-picker").css({display: 'none'}); 4379 ativeEmoji.focus(); 4380 ativeEmoji = null; 4381 } 4382}); 4383 4384$("emoji-picker").css({display: 'none'}); 4385 4386function cf_typeToStr(type){ 4387 if(type == 0) 4388 return myi18n.t('text'); 4389 else if(type == 1) 4390 return myi18n.t('number'); 4391 else if(type == 2) 4392 return myi18n.t('date'); 4393 else if(type == 3) 4394 return myi18n.t('dateTime'); 4395 else if(type == 4) 4396 return myi18n.t('trueFalse'); 4397 else if(type == 5) 4398 return myi18n.t('longText'); 4399 else if(type == 6) 4400 return myi18n.t('singleSelect'); 4401 else if(type == 7) 4402 return myi18n.t('multiSelect'); 4403} 4404 4405function cf_value(type, value, fromVue){ 4406 if(fromVue === undefined) 4407 fromVue = false; 4408 4409 if(value === null || value === '') 4410 return ''; 4411 else if(type == 0 || type == 5 || type == 6) 4412 return fromVue ? value : escapeHtml(value); 4413 else if(type == 2) 4414 return timestamp_to_local_str(value, 'L') 4415 else if(type == 3) 4416 return timestamp_to_local_str(value) 4417 else if(type == 4){ 4418 if(value == 1) 4419 return myi18n ? myi18n.t('yes') : 'Yes'; 4420 else 4421 return myi18n ? myi18n.t('no') : 'No'; 4422 }else if(type == 7){ 4423 //value is an array 4424 if(value.length == 0) 4425 return ''; 4426 4427 let r = value.join(', '); 4428 return fromVue ? r : escapeHtml(r); 4429 4430 }else 4431 return value; 4432} 4433 4434function handleBttLogic(btt, op, value){ 4435 if(typeof btt == 'string') 4436 btt = $(btt); 4437 4438 if(op == 0){ 4439 btt.html(btt.data('v'+value)); 4440 btt.data('value', value); 4441 }else{ 4442 btt.click(function(){ 4443 handleBttLogic($(this), 0, btt.data('value') == 0 ? 1 : 0); 4444 }) 4445 } 4446} 4447 4448 4449 4450function preRequest(op, op1, op2){ 4451 let param = {op, op1} 4452 if(op2) 4453 param.op2 = op2; 4454 4455 pb_show(true, myi18n.t('processing')); 4456 execute_request(param, null, null, false, function (data){ 4457 pb_show(false); 4458 if(data.status == 'OK') 4459 msg_success(); 4460 else 4461 msg_error(myi18n.t('msg0')); 4462 }) 4463} 4464 4465 4466function bttSpinner(btt, disabled){ 4467 if(btt === null) 4468 return; 4469 4470 if(typeof btt == 'string') 4471 btt = $(btt); 4472 4473 btt.attr('disabled', disabled); 4474 let text = btt.find('.text'); 4475 let spinner = btt.find('.spinner-grow'); 4476 if(disabled){ 4477 text.html(btt.data('0')); 4478 spinner.removeClass('hide'); 4479 }else{ 4480 text.html(btt.data('1')); 4481 spinner.addClass('hide'); 4482 } 4483} 4484 4485function preUpload(inputfile, btt){ 4486 if(btt){ 4487 inputfile = get_elem_parent($(btt), 'imageC').find('.inputfile'); 4488 }else if(typeof inputfile == 'string') 4489 inputfile = $(inputfile); 4490 4491 inputfile.show(); 4492 inputfile.focus(); 4493 inputfile.click(); 4494 inputfile.hide(); 4495} 4496 4497function loadImageFile(event, bttUpload, callback, maxWidth, param, urlScript, callback1){ 4498 if(!maxWidth) 4499 maxWidth = 900; 4500 4501 if (event.target.files.length > 0) { 4502 if(bttUpload) 4503 bttSpinner(bttUpload, true); 4504 else if(typeof callback === 'object') 4505 callback.uploading = true; 4506 4507 loadImage( 4508 event.target.files[0], 4509 function (canvas_img) { 4510 if(!param) 4511 param = {page_id: cur_page.page_id, op : 'flows', op1:'upload', op2:'image', file_name:null, uploadFB: false} 4512 4513 upload_file('imageCanvas', canvas_img, event.target.files[0], param, null, function(json){ 4514 if(bttUpload) 4515 bttSpinner(bttUpload, false); 4516 4517 if(json.status === 'OK'){ 4518 if(typeof callback === 'object'){ 4519 callback.uploading = false;
4520 callback.url = json.url; 4521 }else 4522 callback(json.url); 4523 4524 if(callback1) 4525 callback1(json.url); 4526 }else{ 4527 if(typeof callback === 'object') 4528 callback.uploading = false; 4529 else 4530 callback(null); 4531 4532 if(callback1) 4533 callback1(null); 4534 4535 msg_error(myi18n.t('msg0')); 4536 } 4537 }, urlScript); 4538 }, 4539 { 4540 maxWidth: maxWidth, 4541 canvas: true 4542 } 4543 ); 4544 } 4545} 4546 4547function msg_state(state) { 4548 if (state == -1) 4549 return 'Draft'; 4550 else if (state == 0) 4551 return myi18n.t('pending'); 4552 else if (state == 1 || state == 2) 4553 return myi18n.t('sending'); 4554 else if (state == 3) 4555 return myi18n.t('sent'); 4556 else if (state == 4) 4557 return myi18n.t('canceled'); 4558} 4559 4560 4561 4562function getPercent(total, subTotal, digits){ 4563 if(digits === undefined) 4564 digits = 2; 4565 4566 let val = total == 0 ? 0 : format_float((100 * subTotal / total), digits); 4567 return val+"%"; 4568} 4569 4570 4571try{ 4572 var url = document.location.toString(); 4573 if (url.match('#')){ 4574 mainData.selectedTab = url.split('#')[1]; 4575 $('.nav-pills a[href="#' + mainData.selectedTab + '"]').tab('show'); 4576 } 4577}catch(ex){} 4578 4579$('.nav-pills a').on('shown.bs.tab', function (e) { 4580 if((e.target.hash).indexOf('builder') == -1) 4581 history.replaceState(null, null, e.target.hash); 4582}) 4583 4584function sendFlow(id, ms_id, channel) { 4585 if(!ms_id && channel === undefined || channel == -1){ 4586 channelSelector(function(channelData){ 4587 sendFlow(id, ms_id, channelData.preview); 4588 }) 4589 4590 return 4591 }else if(isNumeric(channel)){ 4592 let item = getItemName(getChannelsData(true), channel, ['c', 'name'], 'item'); 4593 channel = item.preview; 4594 } 4595 4596 var param = {page_id: cur_page.page_id, op: 'flows', op1: 'send', id, ms_id, channel: channel}; 4597 4598 4599 execute_request(param, null, null, true, function (data) { 4600 if (data.status == 'OK'){ 4601 msg_success(); 4602 } else 4603 show_model(true, myi18n.t('msg0'), myi18n.t('ok'), ""); 4604 }); 4605} 4606 4607 4608function checkWhitelabel(force){ 4609 if(!force && whitelabel && whitelabel.dynamic){ 4610 return true; 4611 } 4612 4613 4614 var param = {op: 'whitelabel'}; 4615 execute_request(param, null, null, false, function (data) { 4616 if (data.status == "OK"){ 4617 whitelabel = data.data; 4618 mainData.wt = whitelabel; 4619 mainData.navMenu = whitelabel.dynamic.menu; 4620 appDomain = data.data.appdomain; 4621 4622 4623 if(data.data.fb){ 4624 appFbId = data.data.fb.app; 4625 fbRedirect = data.data.fb.redirect; 4626 }else{ 4627 appFbId = null; 4628 fbRedirect = null; 4629 } 4630 4631 4632 wtID = data.data.id; 4633 4634 4635 4636 sfHideContents(); 4637 } 4638 }); 4639 4640 return false; 4641} 4642 4643function renderI18n($cssEl){ 4644 let els = $($cssEl); 4645 length = els.length; 4646 for(let i = 0; i < length; i++){ 4647 try{ 4648 $el = els.eq(i); 4649 $data = $el.data('v-t'); 4650 if($data){ 4651 $data = $data.replaceAll('\'', ''); 4652 $el.html(myi18n.t($data)) 4653 } 4654 }catch(ex){} 4655 } 4656} 4657 4658 4659function getItemName(data, id, keys, type){ 4660 if(type === undefined) 4661 type = 'name' 4662 if(keys === undefined || keys == null) 4663 keys = ['id', 'name']; 4664 4665 if(Array.isArray(id)){ 4666 let descr = ''; 4667 let j = 0; 4668 for(let i = 0; i < id.length; ++i){ 4669 let name = getItemName(data, id[i]); 4670 if(name){ 4671 descr += j === 0 ? name : ', '+name; 4672 j++; 4673 } 4674 } 4675 4676 return descr; 4677 }else{ 4678 for(let i = 0; i < data.length; ++i){ 4679 if(data[i][keys[0]] == id){ 4680 if(type === 'idx') 4681 return i; 4682 if(type === 'item') 4683 return data[i]; 4684 else 4685 return data[i][keys[1]]; 4686 } 4687 } 4688 } 4689 4690 return ''; 4691} 4692 4693 4694function globalSearch(idx){ 4695 4696 if(total_checked){ 4697 for(let i = 0; i < total_checked.length; i++){ 4698 if(total_checked[i].table){ 4699 total_checked[i].table.search(mainData.searchGlobal).draw(); 4700 } 4701 } 4702 } 4703 4704 4705 4706 if(idx !== undefined){ 4707 if(mainData.searchGlobal === ''){ 4708 if(idx === 0) 4709 mainData.table1.deepResults = []; 4710 else if(idx === 1) 4711 mainData.table2.deepResults = []; 4712 }else{ 4713 4714 let table = null; 4715 if(idx === 0) 4716 table = mainData.table1; 4717 else if(idx === 1) 4718 table = mainData.table2; 4719 4720 4721 if(table.searchResquest && mainData.activeFolder && mainData.activeFolder.id !== undefined && mainData.searchGlobal.length > 1){ 4722 table.searchResquest.activeFolder = mainData.activeFolder.id; 4723 table.searchResquest.text = mainData.searchGlobal; 4724 table.draw++; 4725 let tableDraw = table.draw; 4726 setTimeout(function(){ 4727 if(tableDraw === table.draw){ 4728 execute_request(table.searchResquest, null, null, false, function (r) { 4729 if (r.status == "OK") 4730 table.deepResults = r.data; 4731 4732 }); 4733 } 4734 }, 800) 4735 } 4736 4737 } 4738 } 4739} 4740 4741function closeModal(id){ 4742 $(id).modal('hide'); 4743} 4744 4745function arrayGetIndex(data, id, name){ 4746 if(name === null){ 4747 for(let i = 0; i < data.length; i++){ 4748 if(data[i] == id) 4749 return i; 4750 } 4751 }else{ 4752 if(!name) 4753 name = 'id'; 4754 4755 for(let i = 0; i < data.length; i++){ 4756 if(data[i][name] == id) 4757 return i; 4758 } 4759 } 4760 4761 return null; 4762} 4763 4764 4765function arrayMoveItem(data, item, oldIdx, newIdx){ 4766 if(item === null) 4767 item = data[oldIdx]; 4768 4769 data.splice(oldIdx, 1); 4770 data.splice(newIdx, 0, item); 4771} 4772 4773function arrayDuplicateItem(data, item, index){ 4774 let newItem = cloneObj(item); 4775 if(newItem.id) 4776 newItem.id = new Date().getTime(); 4777 4778 if(data.length == index + 1) 4779 data.push(newItem); 4780 else 4781 data.splice(index, 0, newItem); 4782} 4783 4784function arrayRemoveItem(data, id, name, idx){ 4785 if(idx !== undefined){ 4786 data.splice(idx, 1); 4787 return data; 4788 } 4789 4790 if(name === null){ 4791 for(let i = 0; i < data.length; i++){ 4792 if(data[i] == id){ 4793 data.splice(i, 1); 4794 break; 4795 } 4796 } 4797 }else{ 4798 if(!name) 4799 name = 'id'; 4800 4801 for(let i = 0; i < data.length; i++){ 4802 if(data[i][name] == id){ 4803 data.splice(i, 1); 4804 break; 4805 } 4806 } 4807 } 4808 4809 return data; 4810} 4811 4812 4813function getPreRename(text){ 4814 return text.includes('"') || text.includes('\'') ? '' : escapeHtml(text); 4815} 4816 4817 4818function isNumeric(n) { 4819 return !isNaN(parseFloat(n)) && isFinite(n); 4820} 4821 4822function MergeObjects(obj1, obj2) { 4823 for (var p in obj2) { 4824 try { 4825 if(obj2[p].constructor==Object ) 4826 obj1[p] = MergeObjects(obj1[p], obj2[p]); 4827 else 4828 obj1[p] = obj2[p]; 4829 4830 } catch(e) { 4831 obj1[p] = obj2[p]; 4832 } 4833 } 4834 return obj1; 4835} 4836 4837 4838 4839 4840function handleCloseTag(items, tag){ 4841 items.splice(items.indexOf(tag), 1); 4842 } 4843 4844 4845 4846function showInputTag(tagData, app, input) { 4847 tagData.visible = true; 4848 app.$nextTick(_ => { 4849 $(input).focus(); 4850 }); 4851} 4852 4853function handleInputTagConfirm(items, tagData, lowerCase) { 4854 4855 let val = tagData.value; 4856 if(lowerCase === undefined || lowerCase) 4857 val = val.toLowerCase(); 4858 4859 4860 if (val && !items.includes(val)) 4861 items.push(val); 4862 4863 tagData.visible = false;
4864 tagData.value = ''; 4865 } 4866 4867 4868 function insertEmoji(input, callback){ 4869 $("emoji-picker .emoji-mart").off("click").on("click", function(e){ 4870 e.stopPropagation(); 4871 if(callback) 4872 callback($(input).val()); 4873 }); 4874 4875 let elm = $(input); 4876 ativeEmoji = elm; 4877 ativeEmoji.data("caretPos", doGetCaretPosition(elm)); 4878 let offset = elm.offset(); 4879 4880 $("emoji-picker .emoji-mart").css({top: offset.top - 380, left: offset.left}); 4881 $("emoji-picker").css({display: 'block'}); 4882} 4883 4884 4885function setCookies(item, value){ 4886 /*if(window.location.hostname === 'localhost') 4887 docCookies.setItem(item, value, Infinity, "/bots/"); 4888 else*/ 4889 docCookies.setItem(item, value, Infinity, "/"); 4890} 4891 4892function getCookies(item, value){ 4893 if(docCookies.hasItem(item)) 4894 return docCookies.getItem(item); 4895 else 4896 return value; 4897} 4898 4899function getPageIDParan(){ 4900 let pageID = $.urlParam('acc'); 4901 if(!pageID) 4902 pageID = $.urlParam('page_id'); 4903 4904 return pageID; 4905} 4906 4907var channelsData = [{id:"messenger", name: "Messenger", img:"../images/messenger.svg", icon: "fab fa-facebook-messenger", color: "#0084ff", c: 0}, 4908 {id:"instagram", name: "Instagram", img:"../images/instagram.svg", icon: "fab fa-instagram", color: "#833AB4", c: 10}, 4909 {id:"whatsapp", name: "WhatsApp", img:"../images/whatsapp.svg", icon: "fab fa-whatsapp", color: "#075e54", c: 5}, 4910 {id:"tiktok", name: "TikTok", img:"../images/tiktok.svg", icon: "fab fa-tiktok", color: "#000000", c: 17}, 4911 {id:"webchat", name: "Webchat", img:"../images/browser.svg", icon: "fal fa-globe", color: "#333", c: 9}, 4912 {id:"telegram", name: "Telegram", img:"../images/telegram.svg", icon: "fab fa-telegram", color: "#0088cc", c: 8}, 4913 {id:"sms", name: "SMS", img:"../images/sms.svg", icon: "fas fa-sms", color: "#FFA900", c: 2}, 4914 {id:"viber", name: "Viber", img:"../images/viber.svg", icon: "fa-brands fa-viber", color: "#7360F2", c: 12}, 4915 {id:"viberbm", name: "Viber BM", img:"../images/viber.svg", icon: "fa-brands fa-viber", color: "#7360F2", c: 16}, 4916 {id:"voice", name: "Voice", img:"../images/phone.svg", icon: "fa-light fa-phone", color: "#7360F2", c: 15}, 4917 {id:"gbm", name: "Google BM", img:"../images/google-my-business.svg", icon: "fab fa-google", color: "#ea4335", c: 7} 4918]; 4919 4920function channelSelector(callback, allowedChannels, noChannels){ 4921 mainData.channelSelector.callback = callback; 4922 mainData.channelSelector.data = getChannelsData(true, allowedChannels, noChannels); 4923 let modalM = $("#selectChannel"); 4924 modalM.modal('show'); 4925} 4926 4927 4928function getChannelsData(forceWebChat, allowedChannels, noChannels, account){ 4929 if(!account) 4930 account = cur_page; 4931 4932 if(!forceWebChat) 4933 forceWebChat = false; 4934 4935 if(!noChannels) 4936 noChannels = []; 4937 4938 let channels = []; 4939 if(account.messenger_id != 0 && (!allowedChannels || allowedChannels.includes(0)) && !noChannels.includes(0)) 4940 channels.push({c:0, preview:"standard", id:"messenger", name: "Messenger", img:"../images/messenger.svg", data: {name: account.messenger_id != account.username ? '@'+account.username : myi18n.t('botLink'), link: 'https://m.me/'+account.username}}); 4941 4942 if(account.whatsapp && (!allowedChannels || allowedChannels.includes(5)) && !noChannels.includes(5)) 4943 channels.push({c: 5, preview:"whatsapp", id:"whatsapp", name: "WhatsApp", img:"../images/whatsapp.svg", data: {name: '+'+account.whatsapp.number, link: 'https://wa.me/'+account.whatsapp.number}}); 4944 4945 if(account.instagram && (!allowedChannels || allowedChannels.includes(10)) && !noChannels.includes(10)) 4946 channels.push({c: 10, preview:"instagram", id:"instagram", name: "Instagram", img:"../images/instagram.svg", data: {name: '@'+account.instagram.username, link: "https://ig.me/m/"+account.instagram.username}}); 4947 4948 if(account.tiktok && (!allowedChannels || allowedChannels.includes(17)) && !noChannels.includes(17)) 4949 channels.push({c: 17, preview:"tiktok", id:"tiktok", name: "TikTok", img:"../images/tiktok.svg", data: {name: '@'+account.tiktok.username, link: "https://tiktok.me/"+account.tiktok.username}}); 4950 4951 4952 if(account.sms && (!allowedChannels || allowedChannels.includes(2)) && !noChannels.includes(2)){ 4953 let link = account.sms.number != '' ? "sms:"+account.sms.number : null; 4954 channels.push({c: 2, preview:"sms", id:"sms", name: "SMS", img:"../images/sms.svg", data: {name: account.sms.number != '' ? account.sms.number : '----', link: link}}); 4955 } 4956 4957 if(account.gbm && (!allowedChannels || allowedChannels.includes(7)) && !noChannels.includes(7)) 4958 channels.push({c: 7, preview:"googleBM", id:"gbm", name: "Business Message", img:"../images/google-my-business.svg", data: {name: myi18n.t('botLink'), link: 'https://businessmessages.google.com/widget/agent/'
4958+account.gbm.agentID}}); 4959 4960 if(account.telegram && (!allowedChannels || allowedChannels.includes(8)) && !noChannels.includes(8)) 4961 channels.push({c: 8, preview:"telegram", id:"telegram", name: "Telegram", img:"../images/telegram.svg", data: {name: '@'+account.telegram.username, link: 'https://t.me/'+account.telegram.username}}); 4962 4963 if(account.viber && (!allowedChannels || allowedChannels.includes(12)) && !noChannels.includes(12)) 4964 channels.push({c: 12, preview:"viber", id:"viber", name: "Viber", img:"../images/viber.svg", data: {name: '@'+account.viber.username, link: 'viber://pa?chatURI='+account.viber.username}}); 4965 4966 if(account.viberbm && (!allowedChannels || allowedChannels.includes(16)) && !noChannels.includes(16)) 4967 channels.push({c: 16, preview:"viberbm", id:"viberbm", name: "Viber BM", img:"../images/viber.svg", data: {name: '@'+account.viberbm.id, link: 'viber://chat?service='+account.viberbm.id}}); 4968 4969 if(account.voice && (!allowedChannels || allowedChannels.includes(15)) && !noChannels.includes(15)) 4970 channels.push({c: 15, preview:"voice", id:"voice", name: myi18n.t('voice'), img:"../images/phone.svg", data: {name: account.voice.number, link: 'tel:'+account.voice.number}}); 4971 4972 4973 if(account.pers.webchat && (!allowedChannels || allowedChannels.includes(9)) && !noChannels.includes(9)) 4974 channels.push({c: 9, preview:"webchat", id:"webchat", name: "Webchat", img:"../images/browser.svg", icon: "fal fa-globe", data: {name: myi18n.t('learnMore'), link: mainData.wt.links.webchat}}); 4975 4976 return channels; 4977} 4978 4979function resetLastDragData(){ 4980 setTimeout(function(){ 4981 lastDragData = {type:''} 4982 }, 600) 4983} 4984 4985function getFlowName(id){ 4986 let name = getItemName(mainData.flows, id, ['id', 'd']); 4987 if(name !== '') 4988 return {name, exist: true} 4989 else 4990 return {name: myi18n.t('msg17'), exist: false} 4991} 4992 4993 4994function isEmailValid(email){ 4995 var re = /\S+@\S+\.\S+/; 4996 return re.test(email); 4997} 4998 4999function show_connectBotToAdmin(ref, channel, message, type, account){ 5000 if(!account) 5001 account = cur_page 5002 5003 let ios = null, android = null, url = null, qrCode = null; 5004 channel = getItemName(getChannelsData(true, null, null, account), channel, ['c', 'name'], 'item'); 5005 5006 if(channel.c == 2 && account.sms.number != '' && message){ 5007 ios = {url: "sms:"+account.sms.number+(message ? "&body="+message : '')} 5008 android = {url: "sms:"+account.sms.number+(message ? "?body="+message : '')} 5009 5010 ios.qr_code = "https://api.qrserver.com/v1/create-qr-code/?data="+encodeURIComponent(ios.url)+"&size=250x250"; 5011 android.qr_code = "https://api.qrserver.com/v1/create-qr-code/?data="+encodeURIComponent(android.url)+"&size=250x250"; 5012 5013 }else{ 5014 if(type === 'getLink') 5015 url = ref; 5016 else 5017 url = get_link(ref, null, channel.id, false, null, account); 5018 5019 qrCode = "https://api.qrserver.com/v1/create-qr-code/?data="+encodeURIComponent(url)+"&size=250x250"; 5020 } 5021 5022 mainData.channelPreview = {type, android, ios, qr_code: qrCode, url, message, channelName: channel.name} 5023 5024 $("#connectBotToAdmin").modal("show"); 5025} 5026 5027 function askBrowserNotification(){ 5028 return new Promise(function (resolve, reject) { 5029 const permissionResult = Notification.requestPermission(function (result) { 5030 resolve(result); 5031 }); 5032 5033 if (permissionResult) { 5034 permissionResult.then(resolve, reject); 5035 } 5036 }).then(function (permissionResult) { 5037 if(permissionResult !== 'default' && typeof app !== "undefined") 5038 app.showBttAskNtfc = false; 5039 5040 if (permissionResult === 'granted') { 5041 navigator.serviceWorker.register(getPHPUserScript('/js/serviceWorker.js')). 5042 then(function (registration) { 5043 const subscribeOptions = { 5044 userVisibleOnly: true, 5045 applicationServerKey: urlBase64ToUint8Array( 5046 'BLrftxtsKkPkm1JlAk00XCFzC7RP3VWB3fS7YKn18jG2wtbGAROcrmqcWDXTmj1LLv726LTG9xIznjt_RowXogc', 5047 ), 5048 }; 5049 5050 return registration.pushManager.subscribe(subscribeOptions); 5051 }).then(function (pushSubscription) { 5052 let param = {op: 'pushManager', op1: 'add', data: pushSubscription, source: 'inbox'} 5053 5054 execute_request(param, null, null, false, function (r) { 5055 if (r.status == "OK"){ 5056 msg_success(); 5057 }else 5058 msg_error(); 5059 }); 5060 }); 5061 }else if(permissionResult === 'denied'){ 5062 msg_error(myi18n.t('msg52'), 10000); 5063 } 5064 5065 5066 }); 5067} 5068 5069function sendBrowserNotification(title, body, icon, url, tag, badge){ 5070 if (!("Notification" in window) || Notification.permission !== 'granted') 5071 return false;
5072 5073 5074 let param = {}; 5075 if(body) param.body = body; 5076 if(icon) param.icon = icon; 5077 if(badge) param.badge = badge; 5078 5079 let notification = new Notification(title, param); 5080 5081 if(url){ 5082 notification.onclick = function () { 5083 window.open(url); 5084 }; 5085 } 5086} 5087 5088 5089 function registerServiceWorker(){ 5090 if(!("Notification" in window) || !('serviceWorker' in navigator) || !('PushManager' in window) || Notification.permission !== 'granted') 5091 return null; 5092 5093 try{ 5094 5095 return navigator.serviceWorker.register(getPHPUserScript('/js/serviceWorker.js')).then(function (registration) { 5096 registration.update(); 5097 return registration; 5098 }).catch(function (err){}); 5099 5100 } catch (error) {} 5101 5102 return null; 5103} 5104 5105function urlBase64ToUint8Array(base64String) { 5106 const padding = '='.repeat((4 - base64String.length % 4) % 4); 5107 const base64 = (base64String + padding).replace(/\-/g, '+').replace(/_/g, '/'); 5108 5109 const rawData = window.atob(base64); 5110 const outputArray = new Uint8Array(rawData.length); 5111 5112 for (let i = 0; i < rawData.length; ++i) { 5113 outputArray[i] = rawData.charCodeAt(i); 5114 } 5115 return outputArray; 5116} 5117 5118function getClientReferenceId() { 5119 return window.Rewardful && window.Rewardful.referral || ('checkout_'+(new Date).getTime()); 5120} 5121 5122function formatMoney(number, currency, cents){ 5123 try{ 5124 var formatter = new Intl.NumberFormat(undefined, { 5125 style: 'currency', 5126 currency: currency, 5127 }); 5128 5129 if(cents) 5130 return formatter.format(number/100); 5131 else 5132 return formatter.format(number) 5133 }catch(ex){ 5134 return currency + " " + number; 5135 } 5136} 5137 5138 5139 5140 5141 5142function preSendProduct(data, callback, showModal){ 5143 let modalM = $("#mSendProduct"); 5144 5145 if(showModal === undefined) 5146 showModal = true; 5147 5148 if(showModal) 5149 modalM.modal('show'); 5150 5151 if(mainData.products === null){ 5152 loadProducts(function(success){ 5153 if(success) 5154 preSendProduct(data, callback, false); 5155 else 5156 modalM.modal('hide'); 5157 }) 5158 5159 return; 5160 } 5161 5162 5163 if(!data) 5164 data = {} 5165 5166 mainData.sendProduct.easyMode = data.easyMode != undefined ? data.easyMode : true; 5167 mainData.sendProduct.header = data.header != undefined ? data.header : {type: 'text', text: ''}; 5168 mainData.sendProduct.body = data.body != undefined ? data.body : ''; 5169 mainData.sendProduct.footer = data.body != undefined ? data.footer : ''; 5170 5171 5172 if(data.easyMode){ 5173 mainData.sendProduct.value = data.value !== undefined ? data.value : []; 5174 mainData.sendProduct.sessions = [{title: '', value: []}]; 5175 }else{ 5176 mainData.sendProduct.sessions = data.sessions ? data.sessions : [{title: '', value: []}]; 5177 mainData.sendProduct.value = []; 5178 } 5179 5180 5181 mainData.sendProduct.channel = data.channel != undefined ? data.channel : 0; 5182 5183 let options = []; 5184 for(let i = 0; i < mainData.products.length; i++){ 5185 let product = mainData.products[i]; 5186 let option = {value: product.id, label: product.n} 5187 5188 if(mainData.sendProduct.channel == 5 && product.hv){ 5189 option.children = []; 5190 option.disabled = true; 5191 for(let j = 0; j < mainData.products.length; j++){ 5192 5193 if(product.id === mainData.products[j].pp){ 5194 let child = mainData.products[j]; 5195 let name = child.n +" ⢠"; 5196 if(child.o3 !== '') 5197 name += child.o0 + " ⢠" + child.o1 + " ⢠" + child.o2 + " ⢠" + child.o3; 5198 else if(child.o2 !== '') 5199 name += child.o0 + " ⢠" + child.o1 + " ⢠" + child.o2; 5200 else if(child.o1 !== '') 5201 name += child.o0 + " ⢠" + child.o1; 5202 else 5203 name += child.o0; 5204 5205 5206 if(child.sku !== '') 5207 option.children.push({value: child.id, label: name, disabled: child.sku === ''}); 5208 } 5209 } 5210 5211 if(option.children.length) 5212 options.push(option); 5213 5214 }else 5215 if(product.t == 0 && (mainData.sendProduct.channel != 5 || product.sku !== '')) 5216 options.push(option); 5217 } 5218 5219 mainData.sendProduct.options = options; 5220 5221 5222 5223 modalM.find('.positive').off('click').click(function(){ 5224 if(mainData.sendProduct.easyMode){ 5225 if(mainData.sendProduct.value.length === 0){ 5226 msg_error(myi18n.t('msg10')); 5227 return; 5228 } 5229 } 5230 5231 modalM.modal('hide'); 5232 callback(cloneObj(mainData.sendProduct)); 5233 5234 }) 5235 5236} 5237 5238function apiGetSteps(flowID, callback){ 5239 let param = {op:'flows', op1:'get', step: true, data:{flowID}} 5240 execute_request(param, null, null, false, function (r) { 5241 if (r.status == "OK") 5242 callback(r.data); 5243 else 5244 callback(null); 5245 }); 5246} 5247 5248
5249function testForm(){ 5250 let form = {title: "This is a test", rows: [ 5251 {id:'param0', label: 'Messi', type:"my-input", value: ''}, 5252 { 5253 id:"player", 5254 loading: true, 5255 type:"select", label: "Test Select", value: null, multiple: false, keyId:'id', keyLabel:'name', 5256 options: null 5257 } 5258 ]} 5259 5260 showForms(form, function(data){ 5261 console.log(data); 5262 }) 5263 } 5264 5265 5266function isWaTemplateReady(components){ 5267 if(components.body){ 5268 for(let i = 0; i < components.body.pers.length; i++){ 5269 if(components.body.pers[i].value === '') 5270 return false; 5271 } 5272 } 5273 5274 5275 5276 if(components.footer){ 5277 for(let i = 0; i < components.footer.pers.length; i++){ 5278 if(components.footer.pers[i].value === '') 5279 return false; 5280 } 5281 } 5282 5283 5284 5285 if(components.header){ 5286 if(components.header.format == 'TEXT'){ 5287 if(components.header.pers){ 5288 for(let i = 0; i < components.header.pers.length; i++){ 5289 if(components.header.pers[i].value === '') 5290 return false; 5291 } 5292 } 5293 }else if(components.header.url === '') 5294 return false; 5295 5296 } 5297 5298 5299 5300 return true; 5301} 5302 5303 5304function auth_integration(op, op1, next){ 5305 pb_show(true, myi18n.t('processing')); 5306 5307 if(!next) 5308 next = null; 5309 5310 var param = {page_id: cur_page.page_id, op: op, op1: op1, data:{next: next}} 5311 execute_request(param, null, null, false, function (data) { 5312 if (data.status == 'OK'){ 5313 if(op1 === 'get-auth-link') 5314 window.location.href = data.url; 5315 else 5316 window.location.reload(); 5317 }else if(data.code != 98) 5318 show_model(true, myi18n.t('msg0'), myi18n.t('ok'), ""); 5319 }); 5320} 5321 5322 5323function startSelectFolder(items, content){ 5324 $('#mSelectFolder').modal('show'); 5325 mainData.selectFolder.items = items; 5326 mainData.selectFolder.content = content; 5327 mainData.selectFolder.notAllowed = [7]; 5328 mainData.selectFolder.selectedFolder = null; 5329 5330 if(activeFolder.id == 0) 5331 preMoveFolder('list', 0); 5332 else{ 5333 mainData.selectFolder.currentFolders = [{id: 0, name: getContentName(content, 0), selected: false}] 5334 } 5335} 5336 5337function preMoveFolder(op, parent, item){ 5338 if(op == 'selection'){ 5339 if(item.selected) 5340 mainData.selectFolder.selectedFolder = item; 5341 else 5342 mainData.selectFolder.selectedFolder = null; 5343 5344 return; 5345 } 5346 5347 5348 if(op == 'list'){ 5349 5350 mainData.selectFolder.selectedFolder = null; 5351 mainData.selectFolder.loading = true; 5352 param = {page_id: cur_page.page_id, op: 'folder', op1: 'get', parent, content: mainData.selectFolder.content}; 5353 5354 5355 execute_request(param, null, null, false, function (data) { 5356 if(data.status === 'OK'){ 5357 let folders = []; 5358 for(let i = 0; i < data.results.length; i++){ 5359 let folder = data.results[i]; 5360 folder.id = parseInt(folder.id); 5361 if(mainData.selectFolder.notAllowed.includes(folder.id)) 5362 continue; 5363 5364 folder.selected = false; 5365 5366 folders.push(folder); 5367 } 5368 5369 let parents = []; 5370 if(data.parents.length){ 5371 parents = [{id: 0, name: getContentName(mainData.selectFolder.content, 0)}]; 5372 5373 for(let i = data.parents.length - 1; i >= 0; i--) 5374 parents.push(data.parents[i]); 5375 5376 } 5377 5378 mainData.selectFolder.parents = parents; 5379 mainData.selectFolder.currentFolders = folders; 5380 mainData.selectFolder.loading = false; 5381 } 5382 }); 5383 }else if(op == 'done'){ 5384 folderMoveItem(mainData.selectFolder.items, mainData.selectFolder.selectedFolder.id, mainData.selectFolder.content) 5385 $('#mSelectFolder').modal('hide'); 5386 } 5387} 5388 5389function activateBot(){ 5390 show_model(true, 'Your bot was deactivated because your account reached the maximum number of contacts. Your account will be deactivated again if any new contact sends a message to your bot.', myi18n.t('activateBot'), myi18n.t('cancel'), ""); 5391 $("#btt_yes").click(function () { 5392 var param = { op: 'settings', op1: 'activateAccount'}; 5393 execute_request(param, null, null, true, function (data) { 5394 if(data.status == "OK"){ 5395 msg_success(); 5396 window.location.reload(); 5397 }else{ 5398 pb_show(false); 5399 } 5400 }) 5401 }); 5402} 5403
5404function addNewTag(item, id, callback){ 5405 let rows = [ 5406 {id: 'name', label: myi18n.t('name'), type: 'text', value: ''} 5407 ]; 5408 5409 let form = {title: myi18n.t('tag'), rows: rows} 5410 5411 showForms(form, function(data){ 5412 if(data){ 5413 mainData.form.loading = true; 5414 param = { op: 'tags', op1: 'add', name: data.name, folder: 0} 5415 5416 execute_request(param, null, null, true, function (r) { 5417 if (r.status == 'OK') { 5418 mainData.tags.push({name: data.name, id: r.data.id}) 5419 if(item) 5420 item[id] = r.data.id; 5421 5422 if(callback) 5423 callback(r); 5424 5425 return; 5426 5427 }else{ 5428 msg_error(); 5429 5430 if(callback) 5431 callback(null); 5432 } 5433 }); 5434 5435 } 5436 5437 5438 5439 }) 5440 5441 5442} 5443 5444function addNewCF(item, id, types, callback){ 5445 let rows = [ 5446 {id: 'name', label: myi18n.t('name'), type: 'text', value: ''} 5447 ]; 5448 5449 if(!types) 5450 types = [0,1,2,3,4]; 5451 5452 let cfType = types.length == 1 ? types[0] : null; 5453 if(cfType === null){ 5454 let options = []; 5455 for(let i = 0; i < types.length; i++){ 5456 let t = types[i], name = ''; 5457 if(t == 0) 5458 name = myi18n.t('text'); 5459 else if(t == 1) 5460 name = myi18n.t('number'); 5461 else if(t == 2) 5462 name = myi18n.t('date'); 5463 else if(t == 3) 5464 name = myi18n.t('dateTime'); 5465 else 5466 name = myi18n.t('trueFalse'); 5467 5468 options.push({id: t, name}); 5469 } 5470 5471 rows.push({id: 'type', label: myi18n.t('type'), type:'select', options}) 5472 } 5473 5474 5475 5476 5477 let form = {title: myi18n.t('c_field'), rows: rows} 5478 5479 showForms(form, function(data){ 5480 if(data){ 5481 if(cfType === null) 5482 cfType = data.type; 5483 5484 mainData.form.loading = true; 5485 param = { op: 'custom-fields', op1: 'add', name:data.name, type: cfType, botfield: 0, value: null, descr: '', folder: 0} 5486 5487 execute_request(param, null, null, true, function (r) { 5488 if (r.status == 'OK') { 5489 if(r.affected == 1){ 5490 5491 if(typeof all_custom_fields !== 'undefined' && all_custom_fields) 5492 all_custom_fields.push({name: data.name, id: r.id, type: cfType}); 5493 5494 if(typeof all_cf_suggestion !== 'undefined' && all_cf_suggestion) 5495 all_cf_suggestion.push({name: data.name, id: r.id, type: cfType, value:'{'+data.name+'}}'}); 5496 5497 mainData.customFields.push({name: data.name, id: r.id, type: cfType}) 5498 }else 5499 r.id; 5500 5501 if(item) 5502 item[id] = r.id; 5503 5504 5505 if(callback) 5506 callback(r); 5507 5508 return; 5509 5510 }else 5511 msg_error(); 5512 }); 5513 5514 } 5515 5516 if(callback) 5517 callback(null); 5518 5519 }) 5520 5521 5522} 5523 5524 5525 5526 5527function addNewItemSelect(item, index){ 5528 let lastForm = cloneObj(mainData.form); 5529 lastForm.callback = mainData.form.callback; 5530 5531 5532 if(item.addNew.data === 'custom-field'){ 5533 let rows = [ 5534 {id: 'name', label: myi18n.t('name'), type: 'text', value: ''} 5535 ]; 5536
5537 if(!item.addNew.type) 5538 item.addNew.type = [0,1,2,3,4]; 5539 5540 let cfType = item.addNew.type.length == 1 ? item.addNew.type[0] : null; 5541 if(cfType === null){ 5542 let options = []; 5543 for(let i = 0; i < item.addNew.type.length; i++){ 5544 let t = item.addNew.type[i], name = ''; 5545 if(t == 0) 5546 name = myi18n.t('text'); 5547 else if(t == 1) 5548 name = myi18n.t('number'); 5549 else if(t == 2) 5550 name = myi18n.t('date'); 5551 else if(t == 3) 5552 name = myi18n.t('date'); 5553 else 5554 name = myi18n.t('trueFalse'); 5555 5556 options.push({id: t, name}); 5557 } 5558 5559 rows.push({id: 'type', label: myi18n.t('type'), type:'select', options}) 5560 } 5561 5562 5563 5564 5565 let form = {title: myi18n.t('c_field'), rows: rows, keepOnDone: true} 5566 5567 showForms(form, function(data){ 5568 if(data){ 5569 if(cfType === null) 5570 cfType = data.type; 5571 5572 mainData.form.loading = true; 5573 param = { op: 'custom-fields', op1: 'add', name:data.name, type: cfType, botfield: 0, value: null, descr: '', folder: 0} 5574 5575 execute_request(param, null, null, true, function (r) { 5576 if (r.status == 'OK') { 5577 let newItem = lastForm.rows[index]; 5578 if(r.affected == 1){ 5579 newItem.options.push({id: r.id, name: data.name}); 5580 newItem.value = r.id; 5581 lastForm.rows[index] = newItem; 5582 5583 if(all_custom_fields) 5584 all_custom_fields.push({name: data.name, id: r.id, type: cfType}); 5585 5586 if(all_cf_suggestion) 5587 all_cf_suggestion.push({name: data.name, id: r.id, type: cfType, value:'{'+data.name+'}}'}); 5588 }else 5589 lastForm.rows[index].value = r.id; 5590 5591 showForms(lastForm, lastForm.callback); 5592 5593 }else 5594 msg_error(); 5595 }); 5596 5597 }else{ 5598 showForms(lastForm, lastForm.callback); 5599 } 5600 5601 }) 5602 5603 } 5604} 5605 5606 5607function getChartjsOptions(type, legend, xIsTime){ 5608 if(xIsTime === undefined) 5609 xIsTime = true; 5610 5611 let options = { 5612 plugins: { 5613 legend: { 5614 display: legend, 5615 position: 'bottom' 5616 } 5617 } 5618 } 5619 5620 if(type == 'bar' || type == 'line'){ 5621 options.scales = { 5622 x:{ 5623 grid: { 5624 display: false 5625 } 5626 5627 5628 }, 5629 y: { 5630 beginAtZero: true, 5631 grid: { 5632 display: false 5633 } 5634 } 5635 } 5636 5637 options.radius = 0; 5638 5639 if(xIsTime){ 5640 options.scales.x.type = 'time'; 5641 options.scales.x.time = { parser: 'YYYY-MM-DD HH:mm:ss', tooltipFormat: 'LL', displayFormats: { unit: 'day'}} 5642 } 5643 5644 } 5645 5646 5647 5648 return options; 5649} 5650 5651function getChartValues(data, admins, keysData, keysAdmins){ 5652 if(!keysData) 5653 keysData = ['id', 'total']; 5654 5655 if(!keysAdmins) 5656 keysAdmins = ['id', 'name']; 5657 5658 let label = []; 5659 let value = []; 5660 let name; 5661 5662 if(admins === null){ 5663 for(let i = 0; i < data.length; i++){ 5664 label.push(data[i][keysData[0]]); 5665 value.push(data[i][keysData[1]]) 5666 } 5667 }else{ 5668 for(let i = 0; i < data.length; i++){ 5669 name = getItemName(admins, data[i][keysData[0]]); 5670 label.push(name ? name : ''); 5671 value.push(data[i][keysData[1]]) 5672 } 5673 } 5674 5675 5676 return {label, data: value}; 5677 5678} 5679 5680 5681 5682function convertSecondsToText(seconds, subValue, format){ 5683 if(format === undefined) 5684 format = 'short'; 5685 5686 if(format === 'long'){ 5687 const totalSeconds = Math.max(0, Math.floor(Number(seconds) || 0)); 5688 5689 const hours = Math.floor(totalSeconds / 3600); 5690 const minutes = Math.floor((totalSeconds % 3600) / 60); 5691 seconds = totalSeconds % 60; 5692 5693 if (hours > 0) { 5694 return `${String(hours).padStart(2, "0")}
5694:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; 5695 } 5696 5697 return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}`; 5698 }else{ 5699 let m = moment.utc(1000 * seconds); 5700 5701 if(subValue === undefined) 5702 subValue = false; 5703 5704 5705 5706 let format; 5707 if(seconds < 60) 5708 format = 's[s]'; 5709 else if(seconds < 3600){ 5710 if(subValue) 5711 format = 'm[m] s[s]'; 5712 else 5713 format = 'm[m]'; 5714 }else if(seconds < 86400) 5715 format = 'H[h] m[m]'; 5716 else 5717 format = 'd[d] H[h]'; 5718 5719 return m.format(format); 5720 } 5721 5722 5723} 5724 5725function datatableEvents(){ 5726 $('.dataTables_wrapper').on( 'draw.dt', function () { 5727 $('.dataTables_processing').html('<div class="spinner-grow" style="width: 2rem; height: 2rem;" role="status"> <span class="sr-only">Loading...</span></div>').addClass('text-right border-0') 5728 } ); 5729} 5730 5731 5732function preChangeLogo(type, previewURL, callback){ 5733 mainData.newLogo.type = type; 5734 mainData.newLogo.callback = callback; 5735 mainData.newLogo.previewURL = previewURL; 5736 mainData.newLogo.modalM = $("#modalChangeImage"); 5737 mainData.newLogo.modalM.modal('show'); 5738} 5739 5740function inputLogoChanged(file){ 5741 if(file){ 5742 mainData.newLogo.file = file; 5743 mainData.newLogo.previewURL = URL.createObjectURL(file.raw) 5744 } 5745} 5746 5747function changeLogo(){ 5748 mainData.newLogo.uploading = true; 5749 loadImage(mainData.newLogo.file.raw, function (canvas_img) { 5750 param = {op : 'flows', op1:'upload', op2:'image', file_name:null, uploadFB: false} 5751 if(mainData.newLogo.type) 5752 param[mainData.newLogo.type] = true; 5753 5754 upload_file('imageCanvas', canvas_img, mainData.newLogo.file.raw, param, null, function(r){ 5755 mainData.newLogo.uploading = true; 5756 if(r.status === 'OK'){ 5757 mainData.newLogo.callback(r.url); 5758 }else 5759 msg_error(myi18n.t('msg0')); 5760 }); 5761 },{maxWidth: 200, canvas: true} 5762 ); 5763} 5764 5765 5766function destroyChart(id){ 5767 let chartStatus = Chart.getChart(id); // <canvas> id 5768 if (chartStatus != undefined) { 5769 chartStatus.destroy(); 5770 } 5771} 5772 5773function hideInformation(){ 5774 $('.mycontainer.divIntro').addClass('hide'); 5775 $('.mycontainer.data').removeClass('hide'); 5776} 5777 5778function getPersNavLink(url){ 5779 let userName = '', userEmail = '', userID = '', account_id = '', account_secret = ''; 5780 if(mainData.me){ 5781 userName = mainData.me.name; 5782 userEmail = mainData.me.email; 5783 userID = mainData.me.fb_id; 5784 } 5785 5786 if(cur_page){ 5787 account_id = cur_page.page_id; 5788 account_secret = cur_page.secret; 5789 } 5790 5791 5792 return url.replace('{{account_id}}', account_id).replace('{{user_name}}', encodeURIComponent(userName)).replace('{{user_id}}', userID).replace('{{user_email}}',userEmail).replace('{{account_secret}}', account_secret); 5793} 5794 5795function loadIframe(url){ 5796 if(url){ 5797 url = getPersNavLink(url) 5798 localStorage.setItem("dURL", url); 5799 }else 5800 url = localStorage.getItem("dURL"); 5801 5802 if(url){ 5803 5804 if(mainData.iframe || mainData.pageName === 'l') 5805 mainData.iframe = {url: url} 5806 else 5807 document.location.href = 'l'; 5808 5809 }else{ 5810 got_page_error(); 5811 } 5812 5813} 5814 5815function prePrareAnalyticsData(data){ 5816 data.total = Number(data.total); 5817 data.previous = Number(data.previous); 5818 return data; 5819} 5820 5821function changeMyAvailability(){ 5822 mainData.me.available = mainData.me.available == 1 ? 0 : 1; 5823 let param = {op: 'admins', op1: 'changeMyAvailability', data: {available: mainData.me.available}} 5824 5825 execute_request(param, null, null, false, function (r) { 5826 if (r.status != "OK"){ 5827 msg_error(); 5828 } 5829 }); 5830} 5831 5832 5833function ciclyToText(cicly, cicly_count){ 5834 switch(cicly){ 5835 case 'month': return cicly_count == 1 ? myi18n.t('bil.month') : myi18n.tc('bil.msg5', cicly_count); 5836 case 'year': return myi18n.tc('bil.year', cicly_count); 5837 case 'week': return cicly_count == 1 ? myi18n.t('bil.week') : myi18n.tc('bil.msg6', cicly_count); 5838 case 'day': return cicly_count == 1 ? myi18n.t('bil.day') : myi18n.tc('bil.msg7', cicly_count); 5839 } 5840} 5841 5842function formatBytes(bytes) { 5843 if (bytes < 1024) 5844 return bytes + "B" 5845 else if (bytes < 1024 * 1024) 5846 return (bytes / 1024).toFixed(2) + " KB" 5847 else 5848 return (bytes / (1024 * 1024)).toFixed(2) + " MB" 5849} 5850 5851 5852 5853function setPaginationData(r, tableIdx){ 5854 mainData.tables[tableIdx].pagination.recordsTotal = r.recordsTotal; 5855} 5856 5857function tableLoadData(idx, callback){ 5858 pb_show(true); 5859 5860 let table = mainData.tables[idx]; 5861 table.datatable.start = (table.pagination.currentPage - 1) * table.datatable.length; 5862 5863 let param = table.request; 5864 param.datatable = table.datatable; 5865 param.datatable.draw++; 5866 5867 let draw = param.datatable.draw; 5868 5869 execute_request(param, null, null, false, function (r) { 5870 if(draw === param.datatable.draw){ 5871 if (r.status == "OK"){ 5872 setPaginationData(r, idx); 5873 let items = r.data; 5874 5875 for(let i = 0; i < items.length; ++i) 5876 items[i] = prepareItem(items[i]); 5877 5878 mainData.data.items = items; 5879 5880 if(callback) 5881 callback(); 5882 5883 pb_show(false); 5884 5885 }else if(data.code == 51){ 5886 pb_show(false); 5887 } 5888 } 5889 }); 5890} 5891 5892 5893 5894function copyItemToOtherPage(row, op, op1){ 5895 let op2 = null; 5896 if(!op1) 5897 op1 = 'copy'; 5898 else 5899 op2 = 'copy'; 5900 5901 let options = []; 5902 for(let i = 0; i < mainData.my_pages.length; ++i){ 5903 if(cur_page.page_id != mainData.my_pages[i].page_id) 5904 options.push({id: mainData.my_pages[i].page_id, name: mainData.my_pages[i].name}); 5905 } 5906 5907 let form = {title: myi18n.t('copyTo'), rows: [{id:'page_id', label: myi18n.t('accountName'), type:"select", value: null, options}]} 5908 showForms(form, function(data){ 5909 pb_show(true, myi18n.t('processing')); 5910 param = {op, op1, op2, data: {id: row.id, page_id: data.page_id}} 5911 execute_request(param, null, null, false, function (data) { 5912 pb_show(false); 5913 if(data.status == 'OK'){ 5914 msg_success(); 5915 }else{ 5916 msg_error(myi18n.t('msg0'), 4000); 5917 } 5918 }) 5919 }) 5920} 5921 5922 5923 5924function getShortRelativeTime(unixTimestamp) { 5925 let shortFormats = { 5926 en: { day: 'd', hour: 'h', minute: 'm'}, 5927 pt: { dia: 'd', hora: 'h', minuto: 'm', minute: 'm', hour: 'h'}, 5928 es: { dÃa: 'd', hora: 'h', minuto: 'm', minute: 'm', hour: 'h' }, 5929 fr: { jour: 'j', heure: 'h', minute: 'm', minute: 'm', hour: 'h'}, 5930 de: { Tag: 'd', Stunde: 'h', Minute: 'm', minute: 'm', hour: 'h'}, 5931 }; 5932 5933 const mappings = shortFormats[mainData.locale] || shortFormats['en']; 5934 5935 let diff = getTimestamp() - unixTimestamp; 5936 5937 if(diff < 60) 5938 return '0'+ mappings.minute; 5939 else if(diff < 120) 5940 return '1'+ mappings.minute; 5941 else if(diff >= 3600 && diff < 7200) 5942 return '1'+ mappings.hour; 5943 5944 const date = moment.unix(unixTimestamp); 5945 5946 let relativeTime = date.fromNow(true); 5947
5948 Object.entries(mappings).forEach(([long, short]) => { 5949 relativeTime = relativeTime.replace(new RegExp(long + 's?', 'i'), short).replace(' ', ''); 5950 }); 5951 5952 return relativeTime; 5953} 5954 5955function getAdminsTeams(admins, teams){ 5956 let adminsTeams =[]; 5957 for(let i = 0; i < admins.length; i++){ 5958 adminsTeams.push({id: admins[i].fb_id, fb_id: admins[i].fb_id, name: admins[i].name, profile_pic: admins[i].profile_pic, isTeam: false, available: admins[i].available == 1, startLetter: admins[i].name.length ? admins[i].name[0] : '', first_name: admins[i].first_name, last_name: admins[i].last_name}); 5959 } 5960 5961 for(let i = 0; i < teams.length; i++){ 5962 adminsTeams.push({id: teams[i].id, fb_id: teams[i].id, name: teams[i].name, profile_pic: whitelabel.appdomain+'images/peopleGroup.svg', isTeam: true, available: true, startLetter: teams[i].name.length ? teams[i].name[0] : ''}); 5963 } 5964 5965 return adminsTeams; 5966} 5967 5968function getCountry(id){ 5969 let country = getItemName(allCountries, id, ['i', 'n'], 'item'); 5970 if(!country) 5971 return getItemName(allCountries, 840, ['i', 'n'], 'item'); 5972 else 5973 return country; 5974} 5975 5976function getDurationLabel(startAtMs, endAtMs = null, pausedMs = 0, elapsedMs = null) { 5977 if(elapsedMs === null){ 5978 const stop = endAtMs || Date.now(); 5979 elapsedMs = Math.max(0, stop - startAtMs - pausedMs); 5980 } 5981 5982 5983 const dur = moment.duration(elapsedMs); 5984 5985 const h = dur.hours(); 5986 const m = dur.minutes(); 5987 const s = dur.seconds(); 5988 5989 return h > 0 5990 ? `${h}:${String(m).padStart(2, '0')}
5990:${String(s).padStart(2, '0')}` 5991 : `${m}:${String(s).padStart(2, '0')}`; 5992} 5993 5994 5995function sanitizeHiddenUnicode(str) { 5996 return str.replace(/[\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g, ""); 5997} 5998 5999 6000function disabledDateInPicker(time, minDays = 0, maxDays = 29) { 6001 const today = new Date() 6002 today.setHours(0, 0, 0, 0) 6003 6004 const minDate = new Date(today) 6005 minDate.setDate(today.getDate() + minDays) 6006 6007 const maxDate = new Date(today) 6008 maxDate.setDate(today.getDate() + maxDays) 6009 maxDate.setHours(23, 59, 59, 999) 6010 6011 return time < minDate || time > maxDate 6012} 6013 6014 6015function setTheme(theme) { 6016 mainData.theme = theme; 6017 document.body.classList.toggle('dark', theme === 'dark'); 6018 document.documentElement.classList.toggle('dark', theme === 'dark'); 6019 localStorage.setItem('theme', theme); 6020} 6021 6022function exportToCSV(data, headers, filename) { 6023 if (!data || !data.length) return; 6024 6025 const keys = Object.keys(headers); 6026 6027 const csvRows = [ 6028 keys.map(key => `"${headers[key]}"`).join(","), // custom headers 6029 6030 ...data.map(row => 6031 keys.map(key => { 6032 const value = row[key] ?? ""; 6033 return `"${String(value).replace(/"/g, '""')}"`; 6034 }).join(",") 6035 ) 6036 ]; 6037 6038 const csvContent = csvRows.join("\n"); 6039 6040 const blob = new Blob([csvContent], { 6041 type: "text/csv;charset=utf-8;" 6042 }); 6043 6044 const url = URL.createObjectURL(blob); 6045 6046 const link = document.createElement("a"); 6047 link.href = url; 6048 link.download = filename; 6049 link.click(); 6050 6051 URL.revokeObjectURL(url); 6052} 6053 6054function exportTextToFile(content, filename = "file", type = "text") { 6055 const fileTypes = { 6056 text: { 6057 extension: ".txt", 6058 mime: "text/plain;charset=utf-8;" 6059 }, 6060 json: { 6061 extension: ".json", 6062 mime: "application/json;charset=utf-8;" 6063 } 6064 }; 6065 6066 const selectedType = fileTypes[type] || fileTypes.text; 6067 6068 let fileContent; 6069 6070 if (type === "json") { 6071 fileContent = 6072 typeof content === "string" 6073 ? content 6074 : JSON.stringify(content ?? {}, null, 2); 6075 } else { 6076 fileContent = String(content ?? ""); 6077 } 6078 6079 const finalFilename = filename.endsWith(selectedType.extension) 6080 ? filename 6081 : `${filename}${selectedType.extension}`; 6082 6083 const blob = new Blob([fileContent], { 6084 type: selectedType.mime 6085 }); 6086 6087 const url = URL.createObjectURL(blob); 6088 6089 const link = document.createElement("a"); 6090 link.href = url; 6091 link.download = finalFilename; 6092 6093 document.body.appendChild(link); 6094 link.click(); 6095 document.body.removeChild(link); 6096 6097 URL.revokeObjectURL(url); 6098} 6099 6100function isModelAllowed(model, models){ 6101 for (let i = 0; i < models.length; i++) { 6102 if (models[i].id === model) { 6103 return model; 6104 } 6105 } 6106 6107 return models[0].id 6108}
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.