{"version":3,"sources":["node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js"],"names":["define","preview","timeoutId","render","postContainer","callback","find","is","clearTimeout","textarea","setTimeout","socket","emit","val","err","$","addClass","html","window","trigger","matchScroll","length","diff","scrollHeight","height","scrollPercent","scrollTop","Math","max","handleToggler","env","utils","findBootstrapEnvironment","hidePreview","togglePreview","localStorage","setItem","showPreview","removeItem","show","previewContainer","toggleClass","writeContainer","showBtn","focus","toggle","hideBtn","on","getItem"],"mappings":"AAAA,aAIAA,OAAO,mBAAoB,WAC1B,IAAIC,KAEJ,IAAIC,EAAY,EAEhBD,EAAQE,OAAS,SAASC,EAAeC,GACxCA,EAAWA,GAAY,aACvB,IAAKD,EAAcE,KAAK,sBAAsBC,GAAG,YAAa,CAC7D,OAAOF,IAGR,GAAIH,EAAW,CACdM,aAAaN,GACbA,EAAY,EAEb,IAAIO,EAAWL,EAAcE,KAAK,YAElCJ,EAAYQ,WAAW,WACtBC,OAAOC,KAAK,iCAAkCH,EAASI,MAAO,SAASC,EAAKb,GAC3EC,EAAY,EACZ,GAAIY,EAAK,CACR,OAEDb,EAAUc,EAAE,QAAUd,EAAU,UAChCA,EAAQK,KAAK,4BAA4BU,SAAS,kBAClDZ,EAAcE,KAAK,YAAYW,KAAKhB,GACpCc,EAAEG,QAAQC,QAAQ,2BAClBd,OAEC,MAGJJ,EAAQmB,YAAc,SAAShB,GAC9B,IAAKA,EAAcE,KAAK,sBAAsBC,GAAG,YAAa,CAC7D,OAED,IAAIE,EAAWL,EAAcE,KAAK,YAClC,IAAIL,EAAUG,EAAcE,KAAK,YAEjC,GAAIG,EAASY,QAAUpB,EAAQoB,OAAQ,CACtC,IAAIC,EAAOb,EAAS,GAAGc,aAAed,EAASe,SAE/C,GAAIF,IAAS,EAAG,CACf,OAGD,IAAIG,EAAgBhB,EAASiB,YAAcJ,EAE3CrB,EAAQyB,UAAUC,KAAKC,IAAI3B,EAAQ,GAAGsB,aAAetB,EAAQuB,SAAU,GAAKC,KAI9ExB,EAAQ4B,cAAgB,SAASzB,GAChCH,EAAQ6B,IAAMC,MAAMC,2BAEpB,SAASC,IACRC,EAAc,OACd,GAAIjC,EAAQ6B,MAAQ,MAAQ7B,EAAQ6B,MAAO,KAAM,CAChDK,aAAaC,QAAQ,0BAA2B,OAIlD,SAASC,IACRH,EAAc,MACd,GAAIjC,EAAQ6B,MAAQ,MAAQ7B,EAAQ6B,MAAO,KAAM,CAChDK,aAAaG,WAAW,4BAI1B,SAASJ,EAAcK,GACtB,GAAItC,EAAQ6B,MAAQ,MAAQ7B,EAAQ6B,MAAO,KAAM,CAChDU,EAAiBC,YAAY,OAAQ,OACrCC,EAAeD,YAAY,YAAa,OACxCE,EAAQF,YAAY,OAAQ,MAC5BD,EAAiBC,YAAY,uBAAwBF,GACrDG,EAAeD,YAAY,sBAAuBF,GAGlD,GAAIA,EAAM,CACTtC,EAAQE,OAAOC,EAAe,mBAEzB,CACNoC,EAAiBC,YAAY,QAASF,GACtCG,EAAeD,YAAY,aAAcF,GACzCI,EAAQF,YAAY,OAAQF,GAC5BxB,EAAE,UAAU6B,QAGb3C,EAAQmB,YAAYhB,GAErBH,EAAQ4C,OAASX,EAEjB,IAAIS,EAAUvC,EAAcE,KAAK,oCAChCwC,EAAU1C,EAAcE,KAAK,sCAC7BkC,EAAmBzB,EAAE,sBACrB2B,EAAiB3B,EAAE,oBAEpB+B,EAAQC,GAAG,QAASd,GACpBU,EAAQI,GAAG,QAASV,GAEpB,GAAIF,aAAaa,QAAQ,6BAA+B/C,EAAQ6B,MAAQ,MAAQ7B,EAAQ6B,MAAO,MAAO,CACrGG,QACM,CACNI,MAIF,OAAOpC","file":"node_modules/nodebb-plugin-composer-default/static/lib/composer/preview.js","sourcesContent":["'use strict';\r\n\r\n/* globals define, socket*/\r\n\r\ndefine('composer/preview', function() {\r\n\tvar preview = {};\r\n\r\n\tvar timeoutId = 0;\r\n\r\n\tpreview.render = function(postContainer, callback) {\r\n\t\tcallback = callback || function() {};\r\n\t\tif (!postContainer.find('.preview-container').is(':visible')) {\r\n\t\t\treturn callback();\r\n\t\t}\r\n\r\n\t\tif (timeoutId) {\r\n\t\t\tclearTimeout(timeoutId);\r\n\t\t\ttimeoutId = 0;\r\n\t\t}\r\n\t\tvar textarea = postContainer.find('textarea');\r\n\r\n\t\ttimeoutId = setTimeout(function() {\r\n\t\t\tsocket.emit('plugins.composer.renderPreview', textarea.val(), function(err, preview) {\r\n\t\t\t\ttimeoutId = 0;\r\n\t\t\t\tif (err) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tpreview = $('