PageSourceSearch

https://www.taize.fr/assets/vendor/@editorjs/image/image.index-oaPN7eH.js

js taize.fr collected 2026-09-24 09:07:23 UTC 30,015 bytes, 7 lines download raw bytes

1/**
2 * Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
3 * Original file: /npm/@editorjs/[email protected]/dist/image.mjs
4 *
5 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
6 */
7(function(){try{if(typeof document<"u"){var _=document.createElement("style");_.appendChild(document.createTextNode('.image-tool{--bg-color: #cdd1e0;--front-color: #388ae5;--border-color: #e8e8eb}.image-tool__image{border-radius:3px;overflow:hidden;margin-bottom:10px;padding-bottom:0}.image-tool__image-picture{max-width:100%;vertical-align:bottom;display:block}.image-tool__image-preloader{width:50px;height:50px;border-radius:50%;background-size:cover;margin:auto;position:relative;background-color:var(--bg-color);background-position:center center}.image-tool__image-preloader:after{content:"";position:absolute;z-index:3;width:60px;height:60px;border-radius:50%;border:2px solid var(--bg-color);border-top-color:var(--front-color);left:50%;top:50%;margin-top:-30px;margin-left:-30px;animation:image-preloader-spin 2s infinite linear;box-sizing:border-box}.image-tool__caption{visibility:hidden;position:absolute;bottom:0;left:0;margin-bottom:10px}.image-tool__caption[contentEditable=true][data-placeholder]:before{position:absolute!important;content:attr(data-placeholder);color:#707684;font-weight:400;display:none}.image-tool__caption[contentEditable=true][data-placeholder]:empty:before{display:block}.image-tool__caption[contentEditable=true][data-placeholder]:empty:focus:before{display:none}.image-tool--empty .image-tool__image,.image-tool--empty .image-tool__image-preloader{display:none}.image-tool--empty .image-tool__caption,.image-tool--uploading .image-tool__caption{visibility:hidden!important}.image-tool .cdx-button{display:flex;align-items:center;justify-content:center}.image-tool .cdx-button svg{height:auto;margin:0 6px 0 0}.image-tool--filled .cdx-button,.image-tool--filled .image-tool__image-preloader{display:none}.image-tool--uploading .image-tool__image{min-height:200px;display:flex;border:1px solid var(--border-color);background-color:#fff}.image-tool--uploading .image-tool__image-picture,.image-tool--uploading .cdx-button{display:none}.image-tool--withBorder .image-tool__image{border:1px solid var(--border-color)}.image-tool--withBackground .image-tool__image{padding:15px;background:var(--bg-color)}.image-tool--withBackground .image-tool__image-picture{max-width:60%;margin:0 auto}.image-tool--stretched .image-tool__image-picture{width:100%}.image-tool--caption .image-tool__caption{visibility:visible}.image-tool--caption{padding-bottom:50px}@keyframes image-preloader-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}')),document.head.appendChild(_)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();const H='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',R='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/>
7<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',P='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><rect width="14" height="14" x="5" y="5" stroke="currentColor" stroke-width="2" rx="4"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.13968 15.32L8.69058 11.5661C9.02934 11.2036 9.48873 11 9.96774 11C10.4467 11 10.9061 11.2036 11.2449 11.5661L15.3871 16M13.5806 14.0664L15.0132 12.533C15.3519 12.1705 15.8113 11.9668 16.2903 11.9668C16.7693 11.9668 17.2287 12.1705 17.5675 12.533L18.841 13.9634"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.7778 9.33331H13.7867"/></svg>',I='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>',B='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M8 9V7.2C8 7.08954 8.08954 7 8.2 7L12 7M16 9V7.2C16 7.08954 15.9105 7 15.8 7L12 7M12 7L12 17M12 17H10M12 17H14"/></svg>';function j(_,i=null,a={}){const s=document.createElement(_);Array.isArray(i)?s.classList.add(...i):i!==null&&s.classList.add(i);for(const r in a)a.hasOwnProperty(r)&&(s[r]=a[r]);return s}var M=(_=>(_.Empty="empty",_.Uploading="uploading",_.Filled="filled",_))(M||{});class U{constructor({api:i,config:a,onSelectFile:s,readOnly:r}){this.api=i,this.config=a,this.onSelectFile=s,this.readOnly=r,this.nodes={wrapper:j("div",[this.CSS.baseClass,this.CSS.wrapper]),imageContainer:j("div",[this.CSS.imageContainer]),fileButton:this.createFileButton(),imageEl:void 0,imagePreloader:j("div",this.CSS.imagePreloader),caption:j("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly})},this.nodes.caption.dataset.placeholder=this.config.captionPlaceholder,this.nodes.imageContainer.appendChild(this.nodes.imagePreloader),this.nodes.wrapper.appendChild(this.nodes.imageContainer),this.nodes.wrapper.appendChild(this.nodes.caption),this.nodes.wrapper.appendChild(this.nodes.fileButton)}applyTune(i,a){this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${i}`,a)}render(){return this.toggleStatus("empty"),this.nodes.wrapper}showPreloader(i){this.nodes.imagePreloader.style.backgroundImage=`url(${i})`,this.toggleStatus("uploading")}hidePreloader(){this.nodes.imagePreloader.style.backgroundImage="",this.toggleStatus("empty")}fillImage(i){const a=/\.mp4$/.test(i)?"VIDEO":"IMG",s={src:i};let r="load";a==="VIDEO"&&(s.autoplay=!0,s.loop=!0,s.muted=!0,s.playsinline=!0,r="loadeddata"),this.nodes.imageEl=j(a,this.CSS.imageEl,s),this.nodes.imageEl.addEventListener(r,()=>{this.toggleStatus("filled"),this.nodes.imagePreloader!==void 0&&(this.nodes.imagePreloader.style.backgroundImage="")}),this.nodes.imageContainer.appendChild(this.nodes.imageEl)}fillCaption(i){this.nodes.caption!==void 0&&(this.nodes.caption.innerHTML=i)}toggleStatus(i){for(const a in M)if(Object.prototype.hasOwnProperty.call(M,a)){const s=M[a];this.nodes.wrapper.classList.toggle(`${this.CSS.wrapper}--${s}`,s===i)}}get CSS(){return{baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,button:this.api.styles.button,wrapper:"image-tool",imageContainer:"image-tool__image",imagePreloader:"image-tool__image-preloader",imageEl:"image-tool__image-picture",caption:"image-tool__caption"}}createFileButton(){const i=j("div",[this.CSS.button]);return i.innerHTML=this.config.buttonContent??`${P} ${this.api.i18n.t("Select an Image")}`,i.addEventListener("click",()=>{this.onSelectFile()}),i}}
7function D(_){return _&&_.__esModule&&Object.prototype.hasOwnProperty.call(_,"default")?_.default:_}var L={exports:{}};(function(_,i){(function(a,s){_.exports=s()})(window,function(){return(function(a){var s={};function r(n){if(s[n])return s[n].exports;var t=s[n]={i:n,l:!1,exports:{}};return a[n].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=a,r.c=s,r.d=function(n,t,d){r.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:d})},r.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,t){if(1&t&&(n=r(n)),8&t||4&t&&typeof n=="object"&&n&&n.__esModule)return n;var d=Object.create(null);if(r.r(d),Object.defineProperty(d,"default",{enumerable:!0,value:n}),2&t&&typeof n!="string")for(var v in n)r.d(d,v,(function(l){return n[l]}).bind(null,v));return d},r.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(t,"a",t),t},r.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},r.p="",r(r.s=3)})([function(a,s){var r;r=(function(){return this})();try{r=r||new Function("return this")()}catch{typeof window=="object"&&(r=window)}a.exports=r},function(a,s,r){(function(n){var t=r(2),d=setTimeout;function v(){}function l(o){if(!(this instanceof l))throw new TypeError("Promises must be constructed via new");if(typeof o!="function")throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],e(o,this)}function f(o,u){for(;o._state===3;)o=o._value;o._state!==0?(o._handled=!0,l._immediateFn(function(){var c=o._state===1?u.onFulfilled:u.onRejected;if(c!==null){var m;try{m=c(o._value)}catch(g){return void y(u.promise,g)}p(u.promise,m)}else(o._state===1?p:y)(u.promise,o._value)})):o._deferreds.push(u)}function p(o,u){try{if(u===o)throw new TypeError("A promise cannot be resolved with itself.");if(u&&(typeof u=="object"||typeof u=="function")){var c=u.then;if(u instanceof l)return o._state=3,o._value=u,void w(o);if(typeof c=="function")return void e((m=c,g=u,function(){m.apply(g,arguments)}),o)}o._state=1,o._value=u,w(o)}catch(h){y(o,h)}var m,g}function y(o,u){o._state=2,o._value=u,w(o)}function w(o){o._state===2&&o._deferreds.length===0&&l._immediateFn(function(){o._handled||l._unhandledRejectionFn(o._value)});for(var u=0,c=o._deferreds.length;u<c;u++)f(o,o._deferreds[u]);o._deferreds=null}function b(o,u,c){this.onFulfilled=typeof o=="function"?o:null,this.onRejected=typeof u=="function"?u:null,this.promise=c}function e(o,u){var c=!1;try{o(function(m){c||(c=!0,p(u,m))},function(m){c||(c=!0,y(u,m))})}catch(m){if(c)return;c=!0,y(u,m)}}l.prototype.catch=function(o){return this.then(null,o)},l.prototype.then=function(o,u){var c=new this.constructor(v);return f(this,new b(o,u,c)),c},l.prototype.finally=t.a,l.all=function(o){return new l(function(u,c){if(!o||o.length===void 0)throw new TypeError("Promise.all accepts an array");var m=Array.prototype.slice.call(o);if(m.length===0)return u([]);var g=m.length;function h(T,C){try{if(C&&(typeof C=="object"||typeof C=="function")){var E=C.then;if(typeof E=="function")return void E.call(C,function(O){h(T,O)},c)}m[T]=C,--g==0&&u(m)}catch(O){c(O)}}for(var k=0;k<m.length;k++)h(k,m[k])})},l.resolve=function(o){return o&&typeof o=="object"&&o.constructor===l?o:new l(function(u){u(o)})},l.reject=function(o){return new l(function(u,c){c(o)})},l.race=function(o){return new l(function(u,c){for(var m=0,g=o.length;m<g;m++)o[m].then(u,c)})},l._immediateFn=typeof n=="function"&&function(o){n(o)}||function(o){d(o,0)},l._unhandledRejectionFn=function(o){typeof console<"u"&&console&&console.warn("Possible Unhandled Promise Rejection:",o)},s.a=l}).call(this,r(5).setImmediate)},function(a,s,r){s.a=function(n){var t=this.constructor;return this.then(function(d){return t.resolve(n()).then(function(){return d})},function(d){return t.resolve(n()).then(function(){return t.reject(d)})})}},function(a,s,r){function n(e){return(n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o})(e)}r(4);var t,d,v,l,f,p,y,w=r(8),b=(d=function(e){return new Promise(function(o,u){e=l(e),(e=f(e)).beforeSend&&e.beforeSend();var c=window.XMLHttpRequest?new window.XMLHttpRequest:new window.ActiveXObject("Microsoft.XMLHTTP");c.open(e.method,e.url),c.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(e.headers).forEac
7h(function(g){var h=e.headers[g];c.setRequestHeader(g,h)});var m=e.ratio;c.upload.addEventListener("progress",function(g){var h=Math.round(g.loaded/g.total*100),k=Math.ceil(h*m/100);e.progress(Math.min(k,100))},!1),c.addEventListener("progress",function(g){var h=Math.round(g.loaded/g.total*100),k=Math.ceil(h*(100-m)/100)+m;e.progress(Math.min(k,100))},!1),c.onreadystatechange=function(){if(c.readyState===4){var g=c.response;try{g=JSON.parse(g)}catch{}var h=w.parseHeaders(c.getAllResponseHeaders()),k={body:g,code:c.status,headers:h};y(c.status)?o(k):u(k)}},c.send(e.data)})},v=function(e){return e.method="POST",d(e)},l=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(e.url&&typeof e.url!="string")throw new Error("Url must be a string");if(e.url=e.url||"",e.method&&typeof e.method!="string")throw new Error("`method` must be a string or null");if(e.method=e.method?e.method.toUpperCase():"GET",e.headers&&n(e.headers)!=="object")throw new Error("`headers` must be an object or null");if(e.headers=e.headers||{},e.type&&(typeof e.type!="string"||!Object.values(t).includes(e.type)))throw new Error("`type` must be taken from module's \xABcontentType\xBB library");if(e.progress&&typeof e.progress!="function")throw new Error("`progress` must be a function or null");if(e.progress=e.progress||function(o){},e.beforeSend=e.beforeSend||function(o){},e.ratio&&typeof e.ratio!="number")throw new Error("`ratio` must be a number");if(e.ratio<0||e.ratio>100)throw new Error("`ratio` must be in a 0-100 interval");if(e.ratio=e.ratio||90,e.accept&&typeof e.accept!="string")throw new Error("`accept` must be a string with a list of allowed mime-types");if(e.accept=e.accept||"*/*",e.multiple&&typeof e.multiple!="boolean")throw new Error("`multiple` must be a true or false");if(e.multiple=e.multiple||!1,e.fieldName&&typeof e.fieldName!="string")throw new Error("`fieldName` must be a string");return e.fieldName=e.fieldName||"files",e},f=function(e){switch(e.method){case"GET":var o=p(e.data,t.URLENCODED);delete e.data,e.url=/\?/.test(e.url)?e.url+"&"+o:e.url+"?"+o;break;case"POST":case"PUT":case"DELETE":case"UPDATE":var u=(function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:{}).type||t.JSON})(e);(w.isFormData(e.data)||w.isFormElement(e.data))&&(u=t.FORM),e.data=p(e.data,u),u!==b.contentType.FORM&&(e.headers["content-type"]=u)}return e},p=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};switch(arguments.length>1?arguments[1]:void 0){case t.URLENCODED:return w.urlEncode(e);case t.JSON:return w.jsonEncode(e);case t.FORM:return w.formEncode(e);default:return e}},y=function(e){return e>=200&&e<300},{contentType:t={URLENCODED:"application/x-www-form-urlencoded; charset=utf-8",FORM:"multipart/form-data",JSON:"application/json; charset=utf-8"},request:d,get:function(e){return e.method="GET",d(e)},post:v,transport:function(e){return e=l(e),w.selectFiles(e).then(function(o){for(var u=new FormData,c=0;c<o.length;c++)u.append(e.fieldName,o[c],o[c].name);w.isObject(e.data)&&Object.keys(e.data).forEach(function(g){var h=e.data[g];u.append(g,h)});var m=e.beforeSend;return e.beforeSend=function(){return m(o)},e.data=u,v(e)})},selectFiles:function(e){return delete(e=l(e)).beforeSend,w.selectFiles(e)}});a.exports=b},function(a,s,r){r.r(s);var n=r(1);window.Promise=window.Promise||n.a},function(a,s,r){(function(n){var t=n!==void 0&&n||typeof self<"u"&&self||window,d=Function.prototype.apply;function v(l,f){this._id=l,this._clearFn=f}s.setTimeout=function(){return new v(d.call(setTimeout,t,arguments),clearTimeout)},s.setInterval=function(){return new v(d.call(setInterval,t,arguments),clearInterval)},s.clearTimeout=s.clearInterval=function(l){l&&l.close()},v.prototype.unref=v.prototype.ref=function(){},v.prototype.close=function(){this._clearFn.call(t,this._id)},s.enroll=function(l,f){clearTimeout(l._idleTimeoutId),l._idleTimeout=f},s.unenroll=function(l){clearTimeout(l._idleTimeoutId),l._idleTimeout=-1},s._unrefActive=s.active=function(l){clearTimeout(l._idleTimeoutId);var f=l._idleTimeout;f>=0&&(l._idleTimeoutId=setTimeout(function(){l._onTimeout&&l._onTimeout()},f))},r(6),s.setImmediate=typeof self<"u"&&self.setImmediate||n!==void 0&&n.setImmediate||this&&this.setImmediate,s.clearImmediate=typeof self<"u"&&self.clearImmediate||n!==void 0&&n.clearImmediate||this&&this.clearImmediate}).call(this,r(0))},function(a,s,r){(function(n,t){(function(d,v){if(!d.setImmediate){var l,f,p,y,w,b=1,e={},o=!1,u=d.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(d);c=c&&c.setTimeout?c:d,{}.toString.call(d.process)==="[object process]"?l=function(h){t.nextTick(function(){g(h)})}:(function(){if(d.postMessage&&!d.importScripts){var h=!0,k=d.onmessage;return d.onmessage=function(){h=!1},d.postMessage("","*"),d.onmessage=k,h}})()?(y="setImmediate$"+Math.random()+"$",w=function(h){h.source===d&&typeof h.data=="str
7ing"&&h.data.indexOf(y)===0&&g(+h.data.slice(y.length))},d.addEventListener?d.addEventListener("message",w,!1):d.attachEvent("onmessage",w),l=function(h){d.postMessage(y+h,"*")}):d.MessageChannel?((p=new MessageChannel).port1.onmessage=function(h){g(h.data)},l=function(h){p.port2.postMessage(h)}):u&&"onreadystatechange"in u.createElement("script")?(f=u.documentElement,l=function(h){var k=u.createElement("script");k.onreadystatechange=function(){g(h),k.onreadystatechange=null,f.removeChild(k),k=null},f.appendChild(k)}):l=function(h){setTimeout(g,0,h)},c.setImmediate=function(h){typeof h!="function"&&(h=new Function(""+h));for(var k=new Array(arguments.length-1),T=0;T<k.length;T++)k[T]=arguments[T+1];var C={callback:h,args:k};return e[b]=C,l(b),b++},c.clearImmediate=m}function m(h){delete e[h]}function g(h){if(o)setTimeout(g,0,h);else{var k=e[h];if(k){o=!0;try{(function(T){var C=T.callback,E=T.args;switch(E.length){case 0:C();break;case 1:C(E[0]);break;case 2:C(E[0],E[1]);break;case 3:C(E[0],E[1],E[2]);break;default:C.apply(v,E)}})(k)}finally{m(h),o=!1}}}}})(typeof self>"u"?n===void 0?this:n:self)}).call(this,r(0),r(7))},function(a,s){var r,n,t=a.exports={};function d(){throw new Error("setTimeout has not been defined")}function v(){throw new Error("clearTimeout has not been defined")}function l(c){if(r===setTimeout)return setTimeout(c,0);if((r===d||!r)&&setTimeout)return r=setTimeout,setTimeout(c,0);try{return r(c,0)}
7catch{try{return r.call(null,c,0)}catch{return r.call(this,c,0)}}}(function(){try{r=typeof setTimeout=="function"?setTimeout:d}catch{r=d}try{n=typeof clearTimeout=="function"?clearTimeout:v}catch{n=v}})();var f,p=[],y=!1,w=-1;function b(){y&&f&&(y=!1,f.length?p=f.concat(p):w=-1,p.length&&e())}function e(){if(!y){var c=l(b);y=!0;for(var m=p.length;m;){for(f=p,p=[];++w<m;)f&&f[w].run();w=-1,m=p.length}f=null,y=!1,(function(g){if(n===clearTimeout)return clearTimeout(g);if((n===v||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(g);try{n(g)}catch{try{return n.call(null,g)}catch{return n.call(this,g)}}})(c)}}function o(c,m){this.fun=c,this.array=m}function u(){}t.nextTick=function(c){var m=new Array(arguments.length-1);if(arguments.length>1)for(var g=1;g<arguments.length;g++)m[g-1]=arguments[g];p.push(new o(c,m)),p.length!==1||y||l(e)},o.prototype.run=function(){this.fun.apply(null,this.array)},t.title="browser",t.browser=!0,t.env={},t.argv=[],t.version="",t.versions={},t.on=u,t.addListener=u,t.once=u,t.off=u,t.removeListener=u,t.removeAllListeners=u,t.emit=u,t.prependListener=u,t.prependOnceListener=u,t.listeners=function(c){return[]},t.binding=function(c){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(c){throw new Error("process.chdir is not supported")},t.umask=function(){return 0}},function(a,s,r){function n(d,v){for(var l=0;l<v.length;l++){var f=v[l];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(d,f.key,f)}}var t=r(9);a.exports=(function(){function d(){(function(p,y){if(!(p instanceof y))throw new TypeError("Cannot call a class as a function")})(this,d)}var v,l,f;return v=d,f=[{key:"urlEncode",value:function(p){return t(p)}},{key:"jsonEncode",value:function(p){return JSON.stringify(p)}},{key:"formEncode",value:function(p){if(this.isFormData(p))return p;if(this.isFormElement(p))return new FormData(p);if(this.isObject(p)){var y=new FormData;return Object.keys(p).forEach(function(w){var b=p[w];y.append(w,b)}),y}throw new Error("`data` must be an instance of Object, FormData or <FORM> HTMLElement")}},{key:"isObject",value:function(p){return Object.prototype.toString.call(p)==="[object Object]"}},{key:"isFormData",value:function(p){return p instanceof FormData}},{key:"isFormElement",value:function(p){return p instanceof HTMLFormElement}},{key:"selectFiles",value:function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(y,w){var b=document.createElement("INPUT");b.type="file",p.multiple&&b.setAttribute("multiple","multiple"),p.accept&&b.setAttribute("accept",p.accept),b.style.display="none",document.body.appendChild(b),b.addEventListener("change",function(e){var o=e.target.files;y(o),document.body.removeChild(b)},!1),b.click()})}},{key:"parseHeaders",value:function(p){var y=p.trim().split(/[\r\n]+/),w={};return y.forEach(function(b){var e=b.split(": "),o=e.shift(),u=e.join(": ");o&&(w[o]=u)}),w}}],(l=null)&&n(v.prototype,l),f&&n(v,f),d})()},function(a,s){var r=function(t){return encodeURIComponent(t).replace(/[!'()*]/g,escape).replace(/%20/g,"+")},n=function(t,d,v,l){return d=d||null,v=v||"&",l=l||null,t?(function(f){for(var p=new Array,y=0;y<f.length;y++)f[y]&&p.push(f[y]);return p})(Object.keys(t).map(function(f){var p,y,w=f;if(l&&(w=l+"["+w+"]"),typeof t[f]=="object"&&t[f]!==null)p=n(t[f],null,v,w);else{d&&(y=w,w=!isNaN(parseFloat(y))&&isFinite(y)?d+Number(w):w);var b=t[f];b=(b=(b=(b=b===!0?"1":b)===!1?"0":b)===0?"0":b)||"",p=r(w)+"="+r(b)}return p})).join(v).replace(/[!'()*]/g,""):""};a.exports=n}])})})(L);var N=L.exports;const S=D(N);function x(_){return _!==void 0&&typeof _.then=="function"}class q{constructor({config:i,onUpload:a,onError:s}){this.config=i,this.onUpload=a,this.onError=s}uploadSelectedFile({onPreview:i}){const a=function(r){const n=new FileReader;n.readAsDataURL(r),n.onload=t=>{i(t.target.result)}};let s;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function"){const r=this.config.uploader.uploadByFile;s=S.selectFiles({accept:this.config.types??"image/*"}).then(n=>{a(n[0]);const t=r(n[0]);return x(t)||console.warn("Custom uploader method uploadByFile should return a Promise"),t})}else s=S.transport({url:this.config.endpoints.byFile,data:this.config.additionalRequestData,accept:this.config.types??"image/*",headers:this.config.additionalRequestHeaders,beforeSend:r=>{a(r[0])},fieldName:this.config.field??"image"}).then(r=>r.body);s.then(r=>{this.onUpload(r)}).catch(r=>{this.onError(r)})}uploadByUrl(i){let a;this.config.uploader&&typeof this.config.uploader.uploadByUrl=="function"?(a=this.config.uploader.uploadByUrl(i),x(a)||console.warn("Custom uploader method uploadByUrl should return a Promise")):a=S.post({url:this.config.endpoints.byUrl,data:Object.assign({url:i},this.config.additionalRequestData),type:S.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(s=>s.body),a.then(s=>{this.onUpload(s)}).catch(s=>{this.onError(s)})}uploadByFile(i,{onPreview:a}){const s=new FileReader;s.readAsDataURL(i),s.onload=n=>{a(n.target.result)};let r;if(this.config.uploader&&typeof this.config.uploader.uploadByFile=="function")r=this.config.uploader.uploadByFile(i),x(r)||console.warn("Custom uploader method uploadByFile should return a Promise");else{const n=new FormData;n.append(this.config.field??"image",i),this.config.additionalRequestData&&Object.keys(this.config.additionalRequestData).length&&Object.entries(this.config.additionalRequestData).forEac
7h(([t,d])=>{n.append(t,d)}),r=S.post({url:this.config.endpoints.byFile,data:n,type:S.contentType.JSON,headers:this.config.additionalRequestHeaders}).then(t=>t.body)}r.then(n=>{this.onUpload(n)}).catch(n=>{this.onError(n)})}}class F{constructor({data:i,config:a,api:s,readOnly:r,block:n}){this.isCaptionEnabled=null,this.api=s,this.block=n,this.config={endpoints:a.endpoints,additionalRequestData:a.additionalRequestData,additionalRequestHeaders:a.additionalRequestHeaders,field:a.field,types:a.types,captionPlaceholder:this.api.i18n.t(a.captionPlaceholder??"Caption"),buttonContent:a.buttonContent,uploader:a.uploader,actions:a.actions,features:a.features||{}},this.uploader=new q({config:this.config,onUpload:t=>this.onUpload(t),onError:t=>this.uploadingFailed(t)}),this.ui=new U({api:s,config:this.config,onSelectFile:()=>{this.uploader.uploadSelectedFile({onPreview:t=>{this.ui.showPreloader(t)}})},readOnly:r}),this._data={caption:"",withBorder:!1,withBackground:!1,stretched:!1,file:{url:""}},this.data=i}static get isReadOnlySupported(){return!0}static get toolbox(){return{icon:P,title:"Image"}}static get tunes(){return[{name:"withBorder",icon:R,title:"With border",toggle:!0},{name:"stretched",icon:I,title:"Stretch image",toggle:!0},{name:"withBackground",icon:H,title:"With background",toggle:!0}]}render(){var i,a,s;return(((i=this.config.features)==null?void 0:i.caption)===!0||((a=this.config.features)==null?void 0:a.caption)===void 0||((s=this.config.features)==null?void 0:s.caption)==="optional"&&this.data.caption)&&(this.isCaptionEnabled=!0,this.ui.applyTune("caption",!0)),this.ui.render()}validate(i){return!!i.file.url}save(){const i=this.ui.nodes.caption;return this._data.caption=i.innerHTML,this.data}renderSettings(){var i;const a=F.tunes.concat(this.config.actions||[]),s={border:"withBorder",background:"withBackground",stretch:"stretched",caption:"caption"};((i=this.config.features)==null?void 0:i.caption)==="optional"&&a.push({name:"caption",icon:B,title:"With caption",toggle:!0});const r=a.filter(t=>{var d,v;const l=Object.keys(s).find(f=>s[f]===t.name);return l==="caption"?((d=this.config.features)==null?void 0:d.caption)!==!1:l==null||((v=this.config.features)==null?void 0:v[l])!==!1}),n=t=>{let d=this.data[t.name];return t.name==="caption"&&(d=this.isCaptionEnabled??d),d};return r.map(t=>({icon:t.icon,label:this.api.i18n.t(t.title),name:t.name,toggle:t.toggle,isActive:n(t),onActivate:()=>{if(typeof t.action=="function"){t.action(t.name);return}let d=!n(t);t.name==="caption"&&(this.isCaptionEnabled=!(this.isCaptionEnabled??!1),d=this.isCaptionEnabled),this.tuneToggled(t.name,d)}}))}appendCallback(){this.ui.nodes.fileButton.click()}static get pasteConfig(){return{tags:[{img:{src:!0}}],patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|svg|webp)(\?[a-z0-9=]*)?$/i},files:{mimeTypes:["image/*"]}}}async onPaste(i){switch(i.type){case"tag":{const a=i.detail.data;if(/^blob:/.test(a.src)){const s=await(await fetch(a.src)).blob();this.uploadFile(s);break}this.uploadUrl(a.src);break}case"pattern":{const a=i.detail.data;this.uploadUrl(a);break}case"file":{const a=i.detail.file;this.uploadFile(a);break}}}set data(i){var a;this.image=i.file,this._data.caption=i.caption||"",this.ui.fillCaption(this._data.caption),F.tunes.forEach(({name:s})=>{const r=typeof i[s]<"u"?i[s]===!0||i[s]==="true":!1;this.setTune(s,r)}),i.caption?this.setTune("caption",!0):((a=this.config.features)==null?void 0:a.caption)===!0&&this.setTune("caption",!0)}get data(){return this._data}set image(i){this._data.file=i||{url:""},i&&i.url&&this.ui.fillImage(i.url)}onUpload(i){i.success&&i.file?this.image=i.file:this.uploadingFailed("incorrect response: "+JSON.stringify(i))}uploadingFailed(i){console.log("Image Tool: uploading failed because of",i),this.api.notifier.show({message:this.api.i18n.t("Couldn\u2019t upload image. Please try another."),style:"error"}),this.ui.hidePreloader()}tuneToggled(i,a){i==="caption"?(this.ui.applyTune(i,a),a==!1&&(this._data.caption="",this.ui.fillCaption(""))):this.setTune(i,a)}setTune(i,a){this._data[i]=a,this.ui.applyTune(i,a),i==="stretched"&&Promise.resolve().then(()=>{this.block.stretched=a}).catch(s=>{console.error(s)})}uploadFile(i){this.uploader.uploadByFile(i,{onPreview:a=>{this.ui.showPreloader(a)}})}uploadUrl(i){this.ui.showPreloader(i),this.uploader.uploadByUrl(i)}}export{F as default};

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.