1var ve=Object.defineProperty;var Se=(t,e,i)=>e in t?ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i;var Z=(t,e,i)=>Se(t,typeof e!="symbol"?e+"":e,i);import{M as we,C as Ee}from"./application-Ck7HMAff.js";import{b as U,a3 as Pe,e as b,f as g,k as S,u as L,g as h,m as O,n as B,j as y,C as P,F as M,l as T,p as Ae,L as F,a4 as ee,y as V,z as G,M as H,a0 as te,T as Ue,Y as xe,c as Oe,h as Re}from"./runtime-dom.esm-bundler-CyUH1lBv.js";import{d as Ie,m as k,c as Le}from"./pinia-C5Ar_kxh.js";import{B as Ce,V as ke}from"./b-modal-FXn2uxFh.js";import{f as W}from"./findIndex-DcEfx47j.js";import{_ as $,F as De}from"./fa-icon-DkYBpXum.js";import{u as N}from"./useApi-Dm2NgKHR.js";import"./ladda-lfBWiFKf.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./findIndex-DWgcmT2S.js";import"./_baseIteratee-BcnF7k0K.js";import"./isSymbol-Bl59bn9a.js";import"./toNumber-DVbq9Ght.js";import"./index-C-zgGeRf.js";var x=(t=>(t.LOADING="loading",t.LOADED="loaded",t.ERROR="error",t))(x||{});const Me=typeof window<"u"&&window!==null,Te=Ve(),Be=Object.prototype.propertyIsEnumerable,re=Object.getOwnPropertySymbols;function q(t){return typeof t=="function"||toString.call(t)==="[object Object]"}function $e(t){return typeof t=="object"?t===null:typeof t!="function"}function je(t){return t!=="__proto__"&&t!=="constructor"&&t!=="prototype"}function Ve(){return Me&&"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype?("isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get(){return this.intersectionRatio>0}}),!0):!1}function Fe(t,...e){if(!q(t))throw new TypeError("expected the first argument to be an object");if(e.length===0||typeof Symbol!="function"||typeof re!="function")return t;for(const i of e){const a=re(i);for(const l of a)Be.call(i,l)&&(t[l]=i[l])}return t}function ce(t,...e){let i=0;for($e(t)&&(t=e[i++]),t||(t={});i<e.length;i++)if(q(e[i])){for(const a of Object.keys(e[i]))je(a)&&(q(t[a])&&q(e[i][a])?ce(t[a],e[i][a]):t[a]=e[i][a]);Fe(t,e[i])}return t}const ie="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",qe="",ze={rootMargin:"0px",threshold:0},D="data-lazy-timeout-id";class Ne{constructor(e){this.options={loading:ie,error:qe,observerOptions:ze,log:!0,lifecycle:{},logLevel:"error"},this._images=new WeakMap,this.config(e)}config(e={}){ce(this.options,e)}mount(e,i){if(!e)return;const{src:a,loading:l,error:d,lifecycle:f,delay:p}=this._valueFormatter(typeof i=="string"?i:i.value);this._lifecycle(x.LOADING,f,e),e.setAttribute("src",l||ie),Te||(this.loadImages(e,a,d,f),this._log(()=>{this._logger("Not support IntersectionObserver!")})),this._initIntersectionObserver(e,a,d,f,p)}update(e,i){if(!e)return;this._realObserver(e)?.unobserve(e);const{src:a,error:l,lifecycle:d,delay:f}=this._valueFormatter(typeof i=="string"?i:i.value);this._initIntersectionObserver(e,a,l,d,f)}unmount(e){e&&(this._realObserver(e)?.unobserve(e),this._images.delete(e))}loadImages(e,i,a,l){this._setImageSrc(e,i,a,l)}_setImageSrc(e,i,a,l){e.tagName.toLowerCase()==="img"?(i&&e.getAttribute("src")!==i&&e.setAttribute("src",i),this._listenImageStatus(e,()=>{this._lifecycle(x.LOADED,l,e)},()=>{e.onload=null,this._lifecycle(x.ERROR,l,e),this._realObserver(e)?.disconnect(),a&&e.getAttribute("src")!==a&&e.setAttribute("src",a),this._log(()=>{this._logger(`Image failed to load!And failed src was: ${i} `)})})):e.style.backgroundImage=`url('${i}')`}_initIntersectionObserver(e,i,a,l,d){const f=this.options.observerOptions;this._images.set(e,new IntersectionObserver(p=>{Array.prototype.forEach.call(p,m=>{d&&d>0?this._delayedIntersectionCallback(e,m,d,i,a,l):this._intersectionCallback(e,m,i,a,l)})},f)),this._realObserver(e)?.observe(e)}_intersectionCallback(e,i,a,l,d){i.isIntersecting&&(this._realObserver(e)?.unobserve(i.target),this._setImageSrc(e,a,l,d))}_delayedIntersectionCallback(e,i,a,l,d,f){if(i.isIntersecting){if(i.target.hasAttribute(D))return;const p=setTimeout(()=>{this._intersectionCallback(e,i,l,d,f),i.target.removeAttribute(D)},a);i.target.setAttribute(D,String(p))}else i.target.hasAttribute(D)&&(clearTimeout(Number(i.target.getAttribute(D))),i.target.removeAttribute(D))}_listenImageStatus(e,i,a){e.onload=i,e.onerror=a}_valueFormatter(e){let i=e,a=this.options.loading,l=this.options.error,d=this.options.lifecycle,f=this.options.delay;return q(e)&&(i=e.src,a=e.loading||this.options.loading,l=e.error||this.options.error,d=e.lifecycle||this.options.lifecycle,f=e.delay||this.options.delay),{src:i,loading:a,error:l,lifecycle:d,delay:f}}_log(e){this.options.log&&e()}_lifecycle(e,i,a){switch(e){case x.LOADING:a?.setAttribute("lazy",x.LOADING),i?.loading&&i.loading(a);break;case x.LOADED:a?.setAttribute("lazy",x.LOADED),i?.loaded&&i.loaded(a);break;case x.ERROR:a?.setAttribute("lazy",x.ERROR),i?.error&&i.error(a);break}}_realObserver(e){return this._images.get(e)}_logger(e,...i){let a=console.error;switch(this.options.logLevel){case"error":a=console.error;break;case"warn":a=console.warn;break;case"info":a=console.info;break;case"debug":a=console.debug;break}a(e,i)}}const He={install(t,e){const i=new Ne(e);t.config.globalProperties.$Lazyload=i,t.provide("Lazyload",i),t.directive("lazy",{mounted:i.mount.bind(i),updated:i.update.bind(i),unmounted:i.unmount.bind(i)})}},se={pictures:[],position:"last",view:"upload",maximumSelectedPicturesCount:9,toEditPictureUuid:null,
1selectablePictures:[],selectedPictures:[]},C=Ie("main",{state:()=>({...se}),getters:{toEditPictureIndex:t=>W(t.pictures,["uuid",t.toEditPictureUuid]),pictureIsSelected:t=>e=>W(t.selectedPictures,["id",e])>-1},actions:{reset(){Object.entries({...se}).forEach(([t,e])=>{this[t]=e})},addPicture(t){this.pictures.push(t)},removePicture(t){this.pictures=this.pictures.filter(e=>e.uuid!==t.uuid)},updatePicture(t){const e=W(this.pictures,["uuid",t.uuid]);this.pictures[e]=t},addSelectablePicture(t){this.selectablePictures.push(t)},addSelectedPicture(t){this.selectedPictures.push(t)},removeSelectedPicture(t){this.selectedPictures=this.selectedPictures.filter(e=>e.id!==t.id)},clearSelectedPictures(){this.selectedPictures=[]},handlePictureSelection(t){this.pictureIsSelected(t.id)?this.removeSelectedPicture(t):this.selectedPictures.length<this.maximumSelectedPicturesCount&&this.addSelectedPicture(t)}}}),We={props:{inModal:{type:Boolean,default:!1},picture:{type:Object,required:!0},hasErrors:{type:Boolean,default:!1}},computed:{...k(C)}},Xe={key:0,class:"absolute right-1 top-1 block rounded-lg bg-neutral-700/50 px-2 py-0.8 text-xs font-semibold uppercase text-white"},Ge={width:"420",height:"280"},Je={class:"caption"},Qe={class:"caption-tools"};function Ye(t,e,i,a,l,d){const f=U("fa-icon"),p=Pe("lazy");return b(),g("a",{class:P(["thumbnail",{selected:t.mainStore.pictureIsSelected(i.picture.id)&&i.inModal,"border-danger":i.hasErrors}])},[i.picture.is_video?(b(),g("span",Xe," VideÌo ")):S("",!0),L(h("img",Ge,null,512),[[p,i.picture.image.thumbnail]]),h("div",Je,[h("ul",Qe,[h("li",null,[O(f,{type:"fas",icon:"heart"}),B(" "+y(i.picture.likes_count),1)]),h("li",null,[O(f,{type:"fas",icon:"eye"}),B(" "+y(i.picture.views_count),1)])])])],2)}const de=$(We,[["render",Ye]]),Ke={components:{UserPicture:de},computed:{...k(C)}},Ze={class:"modal-header flex justify-between gap-4 max-md:flex-col md:items-center md:gap-2"},et={class:"modal-title w-auto"},tt={class:"modal-body"},rt={class:"row max-h-[65vh] overflow-x-hidden overflow-y-scroll"};function it(t,e,i,a,l,d){const f=U("UserPicture");return b(),g("div",null,[h("div",Ze,[h("h4",et,y(t.$root.locales.bid_mode.select_pictures),1),h("button",{class:"btn btn-default mr-3 whitespace-nowrap",type:"button",onClick:e[0]||(e[0]=p=>t.mainStore.view="upload")},y(t.$root.locales.title),1)]),h("div",tt,[h("div",rt,[(b(!0),g(M,null,T(t.mainStore.selectablePictures,p=>(b(),g("div",{key:p.id,class:"col-6 col-sm-4 col-md-3"},[O(f,{picture:p,"in-modal":!0,onClick:m=>t.mainStore.handlePictureSelection(p)},null,8,["picture","onClick"])]))),128))])]),e[1]||(e[1]=h("div",{class:"modal-footer"},[h("button",{class:"btn btn-primary float-right",type:"button","data-bs-dismiss":"modal"},"Terminer")],-1))])}const st=$(Ke,[["render",it],["__scopeId","data-v-69d2d5b7"]]);function ot(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}var ue={exports:{}};(function(t,e){(function(i){t.exports=i()})((function(i){var a=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function l(u,c){var s=u[0],r=u[1],n=u[2],o=u[3];s+=(r&n|~r&o)+c[0]-680876936|0,s=(s<<7|s>>>25)+r|0,o+=(s&r|~s&n)+c[1]-389564586|0,o=(o<<12|o>>>20)+s|0,n+=(o&s|~o&r)+c[2]+606105819|0,n=(n<<17|n>>>15)+o|0,r+=(n&o|~n&s)+c[3]-1044525330|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&o)+c[4]-176418897|0,s=(s<<7|s>>>25)+r|0,o+=(s&r|~s&n)+c[5]+1200080426|0,o=(o<<12|o>>>20)+s|0,n+=(o&s|~o&r)+c[6]-1473231341|0,n=(n<<17|n>>>15)+o|0,r+=(n&o|~n&s)+c[7]-45705983|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&o)+c[8]+1770035416|0,s=(s<<7|s>>>25)+r|0,o+=(s&r|~s&n)+c[9]-1958414417|0,o=(o<<12|o>>>20)+s|0,n+=(o&s|~o&r)+c[10]-42063|0,n=(n<<17|n>>>15)+o|0,r+=(n&o|~n&s)+c[11]-1990404162|0,r=(r<<22|r>>>10)+n|0,s+=(r&n|~r&o)+c[12]+1804603682|0,s=(s<<7|s>>>25)+r|0,o+=(s&r|~s&n)+c[13]-40341101|0,o=(o<<12|o>>>20)+s|0,n+=(o&s|~o&r)+c[14]-1502002290|0,n=(n<<17|n>>>15)+o|0,r+=(n&o|~n&s)+c[15]+1236535329|0,r=(r<<22|r>>>10)+n|0,s+=(r&o|n&~o)+c[1]-165796510|0,s=(s<<5|s>>>27)+r|0,o+=(s&n|r&~n)+c[6]-1069501632|0,o=(o<<9|o>>>23)+s|0,n+=(o&r|s&~r)+c[11]+643717713|0,n=(n<<14|n>>>18)+o|0,r+=(n&s|o&~s)+c[0]-373897302|0,r=(r<<20|r>>>12)+n|0,s+=(r&o|n&~o)+c[5]-701558691|0,s=(s<<5|s>>>27)+r|0,o+=(s&n|r&~n)+c[10]+38016083|0,o=(o<<9|o>>>23)+s|0,n+=(o&r|s&~r)+c[15]-660478335|0,n=(n<<14|n>>>18)+o|0,r+=(n&s|o&~s)+c[4]-405537848|0,r=(r<<20|r>>>12)+n|0,s+=(r&o|n&~o)+c[9]+568446438|0,s=(s<<5|s>>>27)+r|0,o+=(s&n|r&~n)+c[14]-1019803690|0,o=(o<<9|o>>>23)+s|0,n+=(o&r|s&~r)+c[3]-187363961|0,n=(n<<14|n>>>18)+o|0,r+=(n&s|o&~s)+c[8]+1163531501|0,r=(r<<20|r>>>12)+n|0,s+=(r&o|n&~o)+c[13]-1444681467|0,s=(s<<5|s>>>27)+r|0,o+=(s&n|r&~n)+c[2]-51403784|0,o=(o<<9|o>>>23)+s|0,n+=(o&r|s&~r)+c[7]+1735328473|0,n=(n<<14|n>>>18)+o|0,r+=(n&s|o&~s)+c[12]-1926607734|0,r=(r<<20|r>>>12)+n|0,s+=(r^n^o)+c[5]-378558|0,s=(s<<4|s>>>28)+r|0,o+=(s^r^n)+c[8]-2022574463|0,o=(o<<11|o>>>21)+s|0,n+=(o^s^r)+c[11]+1839030562|0,n=(n<<16|n>>>16)+o|0,r+=(n^o^s)+c[14]-35309556|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^o)+c[1]-1530992060|0,s=(s<<4|s>>>28)+r|0,o+=(s^r^n)+c[4]+1272893353|0,o=(o<<11|o>>>21)+s|0,n+=(o^s^r)+c[7]-155497632|0,n=(n<<16|n>>>16)+o|0,r+=(n^o^s)+c[10]-1094730640|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^o)+c[13]+681279174|0,s=(s<<4|s>>>28)+r|0,o+=(s^r^n)+c[0]-358537222|0,o=(o<<11|o>>>21)+s|0,n+=(o^s^r)+c[3]-722521979|0,n=(n<<16|n>>>
116)+o|0,r+=(n^o^s)+c[6]+76029189|0,r=(r<<23|r>>>9)+n|0,s+=(r^n^o)+c[9]-640364487|0,s=(s<<4|s>>>28)+r|0,o+=(s^r^n)+c[12]-421815835|0,o=(o<<11|o>>>21)+s|0,n+=(o^s^r)+c[15]+530742520|0,n=(n<<16|n>>>16)+o|0,r+=(n^o^s)+c[2]-995338651|0,r=(r<<23|r>>>9)+n|0,s+=(n^(r|~o))+c[0]-198630844|0,s=(s<<6|s>>>26)+r|0,o+=(r^(s|~n))+c[7]+1126891415|0,o=(o<<10|o>>>22)+s|0,n+=(s^(o|~r))+c[14]-1416354905|0,n=(n<<15|n>>>17)+o|0,r+=(o^(n|~s))+c[5]-57434055|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~o))+c[12]+1700485571|0,s=(s<<6|s>>>26)+r|0,o+=(r^(s|~n))+c[3]-1894986606|0,o=(o<<10|o>>>22)+s|0,n+=(s^(o|~r))+c[10]-1051523|0,n=(n<<15|n>>>17)+o|0,r+=(o^(n|~s))+c[1]-2054922799|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~o))+c[8]+1873313359|0,s=(s<<6|s>>>26)+r|0,o+=(r^(s|~n))+c[15]-30611744|0,o=(o<<10|o>>>22)+s|0,n+=(s^(o|~r))+c[6]-1560198380|0,n=(n<<15|n>>>17)+o|0,r+=(o^(n|~s))+c[13]+1309151649|0,r=(r<<21|r>>>11)+n|0,s+=(n^(r|~o))+c[4]-145523070|0,s=(s<<6|s>>>26)+r|0,o+=(r^(s|~n))+c[11]-1120210379|0,o=(o<<10|o>>>22)+s|0,n+=(s^(o|~r))+c[2]+718787259|0,n=(n<<15|n>>>17)+o|0,r+=(o^(n|~s))+c[9]-343485551|0,r=(r<<21|r>>>11)+n|0,u[0]=s+u[0]|0,u[1]=r+u[1]|0,u[2]=n+u[2]|0,u[3]=o+u[3]|0}function d(u){var c=[],s;for(s=0;s<64;s+=4)c[s>>2]=u.charCodeAt(s)+(u.charCodeAt(s+1)<<8)+(u.charCodeAt(s+2)<<16)+(u.charCodeAt(s+3)<<24);return c}function f(u){var c=[],s;for(s=0;s<64;s+=4)c[s>>2]=u[s]+(u[s+1]<<8)+(u[s+2]<<16)+(u[s+3]<<24);return c}function p(u){var c=u.length,s=[1732584193,-271733879,-1732584194,271733878],r,n,o,E,R,I;for(r=64;r<=c;r+=64)l(s,d(u.substring(r-64,r)));for(u=u.substring(r-64),n=u.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<n;r+=1)o[r>>2]|=u.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(s,o),r=0;r<16;r+=1)o[r]=0;return E=c*8,E=E.toString(16).match(/(.*?)(.{0,8})$/),R=parseInt(E[2],16),I=parseInt(E[1],16)||0,o[14]=R,o[15]=I,l(s,o),s}function m(u){var c=u.length,s=[1732584193,-271733879,-1732584194,271733878],r,n,o,E,R,I;for(r=64;r<=c;r+=64)l(s,f(u.subarray(r-64,r)));for(u=r-64<c?u.subarray(r-64):new Uint8Array(0),n=u.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<n;r+=1)o[r>>2]|=u[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(s,o),r=0;r<16;r+=1)o[r]=0;return E=c*8,E=E.toString(16).match(/(.*?)(.{0,8})$/),R=parseInt(E[2],16),I=parseInt(E[1],16)||0,o[14]=R,o[15]=I,l(s,o),s}function w(u){var c="",s;for(s=0;s<4;s+=1)c+=a[u>>s*8+4&15]+a[u>>s*8&15];return c}function v(u){var c;for(c=0;c<u.length;c+=1)u[c]=w(u[c]);return u.join("")}v(p("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function u(c,s){return c=c|0||0,c<0?Math.max(c+s,0):Math.min(c,s)}ArrayBuffer.prototype.slice=function(c,s){var r=this.byteLength,n=u(c,r),o=r,E,R,I,K;return s!==i&&(o=u(s,r)),n>o?new ArrayBuffer(0):(E=o-n,R=new ArrayBuffer(E),I=new Uint8Array(R),K=new Uint8Array(this,n,E),I.set(K),R)}})();function A(u){return/[\u0080-\uFFFF]/.test(u)&&(u=unescape(encodeURIComponent(u))),u}function j(u,c){var s=u.length,r=new ArrayBuffer(s),n=new Uint8Array(r),o;for(o=0;o<s;o+=1)n[o]=u.charCodeAt(o);return c?n:r}function ye(u){return String.fromCharCode.apply(null,new Uint8Array(u))}function _e(u,c,s){var r=new Uint8Array(u.byteLength+c.byteLength);return r.set(new Uint8Array(u)),r.set(new Uint8Array(c),u.byteLength),r}function z(u){var c=[],s=u.length,r;for(r=0;r<s-1;r+=2)c.push(parseInt(u.substr(r,2),16));return String.fromCharCode.apply(String,c)}function _(){this.reset()}return _.prototype.append=function(u){return this.appendBinary(A(u)),this},_.prototype.appendBinary=function(u){this._buff+=u,this._length+=u.length;var c=this._buff.length,s;for(s=64;s<=c;s+=64)l(this._hash,d(this._buff.substring(s-64,s)));return this._buff=this._buff.substring(s-64),this},_.prototype.end=function(u){var c=this._buff,s=c.length,r,n=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o;for(r=0;r<s;r+=1)n[r>>2]|=c.charCodeAt(r)<<(r%4<<3);return this._finish(n,s),o=v(this._hash),u&&(o=z(o)),this.reset(),o},_.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},_.prototype.setState=function(u){return this._buff=u.buff,this._length=u.length,this._hash=u.hash,this},_.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},_.prototype._finish=function(u,c){var s=c,r,n,o;if(u[s>>2]|=128<<(s%4<<3),s>55)for(l(this._hash,u),s=0;s<16;s+=1)u[s]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),n=parseInt(r[2],16),o=parseInt(r[1],16)||0,u[14]=n,u[15]=o,l(this._hash,u)},_.hash=function(u,c){return _.hashBinary(A(u),c)},_.hashBinary=function(u,c){var s=p(u),r=v(s);return c?z(r):r},_.ArrayBuffer=function(){this.reset()},_.ArrayBuffer.prototype.append=function(u){var c=_e(this._buff.buffer,u),s=c.length,r;for(this._length+=u.byteLength,r=64;r<=s;r+=64)l(this._hash,f(c.subarray(r-64,r)));return this._buff=r-64<s?new Uint8Array(c.buffer.slice(r-64)):new Uint8Array(0),this},_.ArrayBuffer.prototype.end=function(u){var c=this._buff,s=c.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n,o;for(n=0;n<s;n+=1)r[n>>2]|=c[n]<<(n%4<<3);return this._finish(r,s),o=v(this._hash),u&&(o=z(o)),this.reset(),o},_.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},_.ArrayBuffer.prototype.getState=function(){var u=_.prototype.getState.call(this);return u.buff=ye(u.buff),u},_.ArrayBuffer.prototype.setState=function(u){return u.buff=j(u.buff,!0),_.prototype.setState.call(this,u)},_.ArrayBuffer.prototype.destroy=_.prototype.destroy,_.ArrayBuffer.prototype._finish=_.prototype._finish,_.ArrayBuffer.hash=function(u,c){var s=m(new Uint8Array(u)),r=v(s);return c?z(r):r},_}))})(ue);var nt=ue.exports;const at=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice;
1class Y{static create(e,i){new Y(e).create(i)}constructor(e){this.file=e,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(e){this.callback=e,this.md5Buffer=new nt.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",(i=>this.fileReaderDidLoad(i))),this.fileReader.addEventListener("error",(i=>this.fileReaderDidError(i))),this.readNextChunk()}fileReaderDidLoad(e){if(this.md5Buffer.append(e.target.result),!this.readNextChunk()){const i=this.md5Buffer.end(!0),a=btoa(i);this.callback(null,a)}}fileReaderDidError(e){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex<this.chunkCount||this.chunkIndex==0&&this.chunkCount==0){const e=this.chunkIndex*this.chunkSize,i=Math.min(e+this.chunkSize,this.file.size),a=at.call(this.file,e,i);return this.fileReader.readAsArrayBuffer(a),this.chunkIndex++,!0}else return!1}}function lt(t){const e=he(document.head,`meta[name="${t}"]`);if(e)return e.getAttribute("content")}function ct(t,e){typeof t=="string"&&(e=t,t=document);const i=t.querySelectorAll(e);return fe(i)}function he(t,e){return typeof t=="string"&&(e=t,t=document),t.querySelector(e)}function pe(t,e,i={}){const{disabled:a}=t,{bubbles:l,cancelable:d,detail:f}=i,p=document.createEvent("Event");p.initEvent(e,l||!0,d||!0),p.detail=f||{};try{t.disabled=!1,t.dispatchEvent(p)}finally{t.disabled=a}return p}function fe(t){return Array.isArray(t)?t:Array.from?Array.from(t):[].slice.call(t)}class dt{constructor(e,i,a,l={}){this.file=e,this.attributes={filename:e.name,content_type:e.type||"application/octet-stream",byte_size:e.size,checksum:i},this.xhr=new XMLHttpRequest,this.xhr.open("POST",a,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(l).forEach((f=>{this.xhr.setRequestHeader(f,l[f])}));const d=lt("csrf-token");d!=null&&this.xhr.setRequestHeader("X-CSRF-Token",d),this.xhr.addEventListener("load",(f=>this.requestDidLoad(f))),this.xhr.addEventListener("error",(f=>this.requestDidError(f)))}get status(){return this.xhr.status}get response(){const{responseType:e,response:i}=this.xhr;return e=="json"?i:JSON.parse(i)}create(e){this.callback=e,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(e){if(this.status>=200&&this.status<300){const{response:i}=this,{direct_upload:a}=i;delete i.direct_upload,this.attributes=i,this.directUploadData=a,this.callback(null,this.toJSON())}else this.requestDidError(e)}requestDidError(e){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){const e={};for(const i in this.attributes)e[i]=this.attributes[i];return e}}class ut{constructor(e){this.blob=e,this.file=e.file;const{url:i,headers:a}=e.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",i,!0),this.xhr.responseType="text";for(const l in a)this.xhr.setRequestHeader(l,a[l]);this.xhr.addEventListener("load",(l=>this.requestDidLoad(l))),this.xhr.addEventListener("error",(l=>this.requestDidError(l)))}create(e){this.callback=e,this.xhr.send(this.file.slice())}requestDidLoad(e){const{status:i,response:a}=this.xhr;i>=200&&i<300?this.callback(null,a):this.requestDidError(e)}requestDidError(e){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}}let ht=0;class J{constructor(e,i,a,l={}){this.id=++ht,this.file=e,this.url=i,this.delegate=a,this.customHeaders=l}create(e){Y.create(this.file,((i,a)=>{if(i){e(i);return}const l=new dt(this.file,a,this.url,this.customHeaders);oe(this.delegate,"directUploadWillCreateBlobWithXHR",l.xhr),l.create((d=>{if(d)e(d);else{const f=new ut(l);oe(this.delegate,"directUploadWillStoreFileWithXHR",f.xhr),f.create((p=>{p?e(p):e(null,l.toJSON())}))}}))}))}}function oe(t,e,...i){if(t&&typeof t[e]=="function")return t[e](...i)}class pt{constructor(e,i){this.input=e,this.file=i,this.directUpload=new J(this.file,this.url,this),this.dispatch("initialize")}start(e){const i=document.createElement("input");i.type="hidden",i.name=this.input.name,this.input.insertAdjacentElement("beforebegin",i),this.dispatch("start"),this.directUpload.create(((a,l)=>{a?(i.parentNode.removeChild(i),this.dispatchError(a)):i.value=l.signed_id,this.dispatch("end"),e(a)}))}uploadRequestDidProgress(e){const i=e.loaded/e.total*90;i&&this.dispatch("progress",{progress:i})}get url(){return this.input.getAttribute("data-direct-upload-url")}
1dispatch(e,i={}){return i.file=this.file,i.id=this.directUpload.id,pe(this.input,`direct-upload:${e}`,{detail:i})}dispatchError(e){this.dispatch("error",{error:e}).defaultPrevented||alert(e)}directUploadWillCreateBlobWithXHR(e){this.dispatch("before-blob-request",{xhr:e})}directUploadWillStoreFileWithXHR(e){this.dispatch("before-storage-request",{xhr:e}),e.upload.addEventListener("progress",(i=>this.uploadRequestDidProgress(i))),e.upload.addEventListener("loadend",(()=>{this.simulateResponseProgress(e)}))}simulateResponseProgress(e){let i=90;const a=Date.now(),l=()=>{const d=Date.now()-a,f=this.estimateResponseTime();i=90+Math.min(d/f,1)*9,this.dispatch("progress",{progress:i}),e.readyState!==XMLHttpRequest.DONE&&i<99&&requestAnimationFrame(l)};e.addEventListener("loadend",(()=>{this.dispatch("progress",{progress:100})})),requestAnimationFrame(l)}estimateResponseTime(){const e=this.file.size,i=1024*1024;return e<i?1e3:e<10*i?2e3:3e3+e/i*50}}const ft="input[type=file][data-direct-upload-url]:not([disabled])";class mt{constructor(e){this.form=e,this.inputs=ct(e,ft).filter((i=>i.files.length))}start(e){const i=this.createDirectUploadControllers(),a=()=>{const l=i.shift();l?l.start((d=>{d?(e(d),this.dispatch("end")):a()})):(e(),this.dispatch("end"))};this.dispatch("start"),a()}createDirectUploadControllers(){const e=[];return this.inputs.forEach((i=>{fe(i.files).forEach((a=>{const l=new pt(i,a);e.push(l)}))})),e}dispatch(e,i={}){return pe(this.form,`direct-uploads:${e}`,{detail:i})}}const X="data-direct-uploads-processing",Q=new WeakMap;let ne=!1;function bt(){ne||(ne=!0,document.addEventListener("click",gt,!0),document.addEventListener("submit",yt,!0),document.addEventListener("ajax:before",_t))}function gt(t){const e=t.target.closest("button, input");e&&e.type==="submit"&&e.form&&Q.set(e.form,e)}function yt(t){me(t)}function _t(t){t.target.tagName=="FORM"&&me(t)}function me(t){const e=t.target;if(e.hasAttribute(X)){t.preventDefault();return}const i=new mt(e),{inputs:a}=i;a.length&&(t.preventDefault(),e.setAttribute(X,""),a.forEach(St),i.start((l=>{e.removeAttribute(X),l?a.forEach(wt):vt(e)})))}function vt(t){let e=Q.get(t)||he(t,"input[type=submit], button[type=submit]");if(e){const{disabled:i}=e;e.disabled=!1,e.focus(),e.click(),e.disabled=i}else e=document.createElement("input"),e.type="submit",e.style.display="none",t.appendChild(e),e.click(),t.removeChild(e);Q.delete(t)}function St(t){t.disabled=!0}function wt(t){t.disabled=!1}function Et(){window.ActiveStorage&&bt()}setTimeout(Et,1);const Pt={props:{picture:{type:Object,default:()=>{}}},data(){return{xhr:null}},computed:{...k(C),isVideo(){return this.picture.file.type.split("/")[0]==="video"},fileObjectURL(){return window.URL.createObjectURL(this.picture.file)}},methods:{async upload(){try{if(this.picture.file.size>1e9)throw this.buildError({data:{errors:{image:["Le fichier doit être inférieur à 1Go"]}}});const t=new J(this.picture.file,this.$root.directUploadUrl,this),e=new FormData;await new Promise((i,a)=>{t.create(async(l,d)=>
1{if(l)a(this.buildError({data:{errors:{image:["Une erreur est survenue, veuillez réessayer"]}}}));else{const f=this.isVideo?"original_video":"image";if(e.append(`picture[${f}]`,d.signed_id),this.isVideo){const p=await fetch(this.picture.url).then(w=>w.blob()).then(w=>new File([w],"thumbnail.jpg",{type:"image/jpeg"})),m=new J(p,"/rails/active_storage/direct_uploads");await new Promise((w,v)=>{m.create((A,j)=>{A?v(this.buildError({data:{errors:{image:["Une erreur est survenue, veuillez réessayer"]}}})):(e.append("picture[image]",j.signed_id),w())})})}i()}})}),await N().post("/pictures",e).then(i=>{this.mainStore.updatePicture({...this.picture,state:"success",record:i.data.picture,progress:100}),this.$root.bidMode&&(this.mainStore.addSelectablePicture(i.data.picture),this.mainStore.addSelectedPicture(i.data.picture))}).catch(i=>this.catchError(i))}catch(t){this.catchError(t)}},onProgress(t){t.lengthComputable&&this.mainStore.updatePicture({...this.picture,progress:t.loaded/t.total*95})},abort(){["error","aborted"].includes(this.picture.state)?this.mainStore.removePicture(this.picture):(this.xhr.abort(),this.mainStore.updatePicture({...this.picture,state:"aborted",progress:100}))},directUploadWillStoreFileWithXHR(t){this.xhr=t,t.upload.addEventListener("progress",e=>this.onProgress(e))},buildError(t){const e=new Error("An error occurred during the upload");return e.response=t,e},catchError(t){if(t.code==="ERR_CANCELED")return;const e=[];t.response?.data?.errors&&Object.keys(t.response.data.errors).forEach(i=>{e.push(t.response.data.errors[i][0])}),this.mainStore.updatePicture({...this.picture,state:"error",errors:e,progress:100})}}},At={class:"list-group-item"},Ut={class:"row flex items-center"},xt={class:"col-8 flex items-center"},Ot={class:"mx-6 w-[84px] min-w-[84px] text-center"},Rt=["src","alt"],It=["src"],Lt={key:0,class:"shrink text-xs text-danger first-letter:uppercase"},Ct={key:1,class:"shrink text-xs text-warning"},kt=["title"],Dt={key:3,class:"text-xs"},Mt={class:"col-3"},Tt={class:"progress picture-upload-progress"},Bt={class:"col-1"};function $t(t,e,i,a,l,d){const f=U("fa-icon");return b(),g("div",At,[h("div",Ut,[h("div",xt,[h("div",Ot,[i.picture.url?(b(),g("img",{key:0,src:i.picture.url,alt:i.picture.file.name,class:"max-h-[55px] max-w-[84px] object-cover object-center"},null,8,Rt)):d.isVideo?(b(),g("video",{key:1,class:"max-h-[55px] max-w-[84px]",src:d.fileObjectURL,muted:"",playsinline:""},null,8,It)):S("",!0)]),i.picture.errors.length>0?(b(),g("span",Lt,y(i.picture.errors[0]),1)):i.picture.state==="aborted"?(b(),g("span",Ct,y(t.$root.locales.upload_aborted),1)):i.picture.record&&i.picture.record.cmyk?(b(),g("span",{key:2,"data-controller":"tooltip",title:t.$root.locales.cmyk_profile_warning,class:"shrink text-xs text-warning"},[O(f,{type:"fal",icon:"exclamation-circle"}),B(" "+y(t.$root.locales.cmyk_profile),1)],8,kt)):(b(),g("span",Dt,y(i.picture.file.name),1))]),h("div",Mt,[h("div",Tt,[h("div",{class:P(["progress-bar",{"bg-warning":i.picture.state==="aborted","bg-danger":i.picture.state==="error","bg-success":i.picture.state==="success"}]),style:Ae({width:`${i.picture.progress}%`})},null,6)])]),h("div",Bt,[i.picture.state!=="success"?(b(),g("a",{key:0,href:"#",class:"picture-upload-abort",onClick:e[0]||(e[0]=F((...p)=>d.abort&&d.abort(...p),["prevent"]))},"x")):S("",!0)])])])}const jt=$(Pt,[["render",$t]]),be=(t,e)=>new Promise((i,a)=>{window.URL=window.URL||window.webkitURL;const l=window.URL.createObjectURL(t);setTimeout(()=>{i(l)},100)}),ge=async(t,e,i,a)=>{const l=[],d=[];return e=e||1,new Promise(async(f,p)=>{await Ft(t).then(async m=>{for(let v=0;v<e;v++)d.push(Math.floor(m/(e+1)*(v+1)));const w=d.map(async(v,A)=>{const j=await Vt(t,v);return Promise.resolve(j)});await Promise.all(w).then(v=>{v.forEach(A=>{l.push(A)}),f(l)}).catch(v=>{p(v)}).finally(()=>f(l))}).catch(m=>{p(m)}),p("something went wrong")})},Vt=(t,e)=>new Promise((i,a)=>{t?.type?.match("video")?be(t).then(l=>{ae(l,e).then(d=>{i(d)})}):t?ae(t,e).then(l=>{i(l)}).catch(l=>{a(l)}):a("file not valid")}),ae=(t,e=0)=>new Promise((i,a)=>{try{const l=document.createElement("video");l.setAttribute("src",t),l.crossOrigin="Anonymous",l.load(),l.addEventListener("error",d=>{a(`error when loading video file ${d}`)}),l.addEventListener("loadedmetadata",()=>{if(l.duration<e){a("video is too short.");return}setTimeout(()=>{l.currentTime=e},200),l.addEventListener("seeked",()=>{const d=document.createElement("canvas");d.width=l.videoWidth,d.height=l.videoHeight;const f=d.getContext("2d");f.drawImage(l,0,0,d.width,d.height),f.canvas.toBlob(p=>{const m=new FileReader;
1m.readAsDataURL(p),m.onloadend=function(){const w=m.result;i(w)}},"image/jpeg",1)})})}catch(l){a(l)}}),Ft=t=>new Promise((e,i)=>{try{t?t?.type?.match("video")?be(t).then(a=>{le(a).then(l=>{e(l)})}):le(t).then(a=>{e(a)}):i("Cannot generate video duration for this video file.")}catch(a){i(a)}}),le=t=>new Promise((e,i)=>{const a=document.createElement("video");a.addEventListener("loadeddata",()=>{e(a.duration),window.URL.revokeObjectURL(t)}),a.preload="metadata",a.src=t,a.muted=!0,a.crossOrigin="Anonymous",a.playsInline=!0,a.play()}),qt=t=>{let e=!1;return{promise:new Promise((a,l)=>{t.then(d=>e?l({isCanceled:!0}):a(d)),t.catch(d=>l(e?{isCanceled:!0}:d))}),cancel(){e=!0}}},zt={components:{PictureUploader:jt},data(){return{acceptedMimeTypes:["image/jpeg","image/jpg","image/png","image/gif","image/bmp","video/*"]}},computed:{...k(C),successfullUploads(){return this.mainStore.pictures.filter(t=>t.state==="success").length},pendingUploads(){return this.mainStore.pictures.filter(t=>t.state==="pending").length}},methods:{addPictures(t){Array.from(t.dataTransfer?.files||t.target.files).forEach(async e=>{const i=e.type.split("/")[0]==="video";if(!(this.acceptedMimeTypes.includes(e.type)||i))return;const a={file:e,state:"pending",progress:0,errors:[],editErrors:{},uuid:ot()},l=qt(this.fileToObjectURL(e,i));try{const d=await Promise.race([l.promise,new Promise((f,p)=>setTimeout(p,4e3))]);a.url=d,this.mainStore.addPicture(a),this.$nextTick(()=>this.$refs[a.uuid][0].upload())}catch{l.cancel(),a.url=null,a.state="error",a.errors=["Une erreur s'est produite, veuillez réessayer dans un autre format ou depuis un autre navigateur."],a.progress=100,this.mainStore.addPicture(a)}})},async fileToObjectURL(t,e){return e?await ge(t).then(i=>i[0]):window.URL.createObjectURL(t)},closeModal(){new we(".picture-upload-modal").hide(),this.mainStore.pictures=[]},moveToTopPosition(){N().post("/pictures/move_to_top",{pictures:{ids:this.mainStore.pictures.map(t=>t.record?.id)}})},goToEdit(){this.mainStore.pictures.forEach(t=>{t.errors.length>0&&this.mainStore.removePicture(t)}),this.mainStore.position==="first"&&this.moveToTopPosition(),this.mainStore.view="edit"}}},Nt={key:0,class:"modal-header flex justify-between gap-4 max-md:flex-col md:items-center md:gap-2"},Ht={class:"modal-title bid-mode !w-auto"},Wt={key:1,class:"modal-header"},Xt={class:"modal-title"},Gt={class:"modal-body picture-upload"},Jt=["innerHTML"],Qt=["accept"],Yt={class:"mt-5 text-center text-sm font-bold text-danger"},Kt={key:2,class:"list-group picture-upload-list-group"},Zt={key:3,class:"modal-footer"},er={key:0},tr={class:"row vertical-align"},rr={class:"col-9 col-sm-10"},ir={class:"radio-inline float-left"},sr={class:"radio-inline float-left"},or={class:"col-3 col-sm-2"};function nr(t,e,i,a,l,d){const f=U("PictureUploader");return b(),g("div",null,[t.$root.bidMode?(b(),g("div",Nt,[h("h4",Ht,y(t.$root.locales.title),1),h("button",{class:"btn btn-default mr-3",type:"button",onClick:e[0]||(e[0]=p=>t.mainStore.view="select")},y(t.$root.locales.bid_mode.back_to_selection),1)])):(b(),g("div",Wt,[h("h4",Xt,y(t.$root.locales.title),1),e[9]||(e[9]=h("button",{type:"button",class:"btn-close","data-bs-dismiss":"modal","aria-label":"Close"},null,-1))])),h("div",Gt,[h("div",{class:"picture-upload-dropbox rounded-lg",onDrop:e[3]||(e[3]=F((...p)=>d.addPictures&&d.addPictures(...p),["prevent"])),onDragover:e[4]||(e[4]=F(()=>{},["prevent"]))},[h("span",{innerHTML:t.$root.locales.drag_and_drop_or},null,8,Jt),h("a",{href:"#",onClick:e[1]||(e[1]=F(p=>t.$refs.fileInput.click(),["prevent"]))},y(t.$root.locales.select)+" "+y(t.$root.locales.one_or_more_image),1),h("input",{ref:"fileInput",type:"file",multiple:"true",class:"hidden",accept:l.acceptedMimeTypes.join(","),onChange:e[2]||(e[2]=(...p)=>d.addPictures&&d.addPictures(...p))},null,40,Qt)],32),h("p",Yt,y(t.$root.locales.warnings),1)]),t.mainStore.pictures.length>0?(b(),g("div",Kt,[(b(!0),g(M,null,T(t.mainStore.pictures,p=>(b(),V(f,{key:p.uuid,ref_for:!0,ref:p.uuid,picture:p},null,8,["picture"]))),128))])):S("",!0),!t.$root.bidMode&&t.mainStore.pictures.length>0?(b(),g("div",Zt,[d.successfullUploads>0?(b(),g("div",er,[h("div",tr,[h("div",rr,[h("div",ir,[h("label",null,[L(h("input",{id:"first","onUpdate:modelValue":e[5]||(e[5]=p=>t.mainStore.position=p),type:"radio",value:"first"},null,512),[[ee,t.mainStore.position]]),B(" "+y(t.$root.locales.first_position),1)])]),h("div",sr,[h("label",null,[L(h("input",{id:"last","onUpdate:modelValue":e[6]||(e[6]=p=>t.mainStore.position=p),type:"radio",value:"last"},null,512),[[ee,t.mainStore.position]]),B(" "+y(t.$root.locales.last_position),1)])])]),h("div",or,[h("button",{class:P(["btn btn-primary float-right",{disabled:d.pendingUploads>0}]),onClick:e[7]||(e[7]=(...p)=>d.goToEdit&&d.goToEdit(...p))}," Suivant ",2)])])])):S("",!0),d.successfullUploads===0?(b(),g("button",{key:1,class:P(["btn btn-primary float-right",{disabled:d.pendingUploads>0}]),onClick:e[8]||(e[8]=(...p)=>d.closeModal&&d.closeModal(...p))}," Terminer ",2)):S("",!0)])):S("",!0)])}const ar=$(zt,[["render",nr],["__scopeId","data-v-e3b7ab92"]]),lr={data(){return{forms:{},loading:!1,slideWay:"next",init:!1,thumbnailUrls:[]}},computed:{...k(C),selectedPicture(){return this.mainStore.pictures[this.mainStore.toEditPictureIndex]},isVideo(){return this.selectedPicture.file.type.split("/")[0]==="video"},picturePayload(){return this.forms[this.mainStore.toEditPictureUuid]}}
1,mounted(){this.mainStore.pictures.forEach(t=>{const e=t.record,i=e.title===e.default_title?"":e.title;this.forms[t.uuid]={title:i,category_id:"",description:"",tags_string:"",license:"",url:t.url}}),this.mainStore.toEditPictureUuid=this.mainStore.pictures[0].uuid,this.isVideo&&ge(this.selectedPicture.file,5).then(t=>this.thumbnailUrls=t)},methods:{selectedPictureErrorOn(t){return this.selectedPicture?.editErrors[t]?.[0]},navigate(t){t>0?this.slideWay="slide-next":this.slideWay="slide-prev",setTimeout(()=>{this.mainStore.toEditPictureUuid=this.mainStore.pictures[this.mainStore.toEditPictureIndex+t].uuid},50)},done(){window.location.href=this.$root.doneUrl},selectThumbnail(t){this.picturePayload.url=t},async submitPicture(){try{this.loading=!0;const t=new FormData;if(Object.keys(this.picturePayload).filter(e=>e!=="url").forEach(e=>t.append(`picture[${e}]`,this.picturePayload[e])),this.isVideo){const e=await fetch(this.picturePayload.url).then(i=>i.blob()).then(i=>new File([i],"thumbnail.jpg",{type:"image/jpeg"}));t.append("picture[image]",e)}await N().patch(`/pictures/${this.selectedPicture.record.id}`,t),this.mainStore.toEditPictureIndex!==this.mainStore.pictures.length-1?this.navigate(1):this.done()}catch(t){this.mainStore.updatePicture({...this.selectedPicture,editErrors:t.response.data.errors})}this.loading=!1}}},cr={class:"modal-header"},dr={class:"modal-title"},ur={class:"btn-toolbar float-right"},hr={class:"btn-group"},pr=["disabled"],fr=["disabled"],mr={class:"container-fluid"},br={class:"row"},gr={class:"col-12 col-md-4"},yr={class:"bg-slate-50 text-center"},_r=["src"],vr={class:"col-12 col-md-8 px-0"},Sr=["placeholder"],wr={key:0,class:"invalid-feedback"},Er=["value"],Pr={key:0,class:"invalid-feedback"},Ar={key:0,class:"invalid-feedback"},Ur={key:0,class:"mb-5"},xr={class:"flex gap-2"},Or=["onClick"],Rr=["src"],Ir={key:0,class:"invalid-feedback"},Lr=["value"],Cr={key:0,class:"invalid-feedback"},kr={class:"w-full"};function Dr(t,e,i,a,l,d){const f=U("fa-icon"),p=U("vue-ladda");return b(),g("div",null,[h("div",cr,[h("h4",dr,y(t.$root.locales.new_image)+" ("+y(t.mainStore.toEditPictureIndex+1)+"/"+y(t.mainStore.pictures.length)+") ",1),h("div",ur,[h("div",hr,[h("button",{class:"btn btn-default",disabled:t.mainStore.toEditPictureIndex===0,onClick:e[0]||(e[0]=m=>d.navigate(-1))},[O(f,{type:"fal",icon:"angle-left"})],8,pr),h("button",{class:"btn btn-default",disabled:t.mainStore.toEditPictureIndex===t.mainStore.pictures.length-1,onClick:e[1]||(e[1]=m=>d.navigate(1))},[O(f,{type:"fal",icon:"angle-right"})],8,fr),h("button",{class:"btn btn-default done-upload-btn",onClick:e[2]||(e[2]=(...m)=>d.done&&d.done(...m))},"Terminer")])])]),O(Ue,{name:l.slideWay,mode:"out-in"},{default:G(()=>[t.mainStore.toEditPictureUuid&&l.forms[t.mainStore.toEditPictureUuid]?(b(),g("div",{key:t.mainStore.toEditPictureUuid,class:"modal-body"},[h("form",null,[h("div",mr,[h("div",br,[h("div",gr,[h("div",yr,[h("img",{src:d.picturePayload.url,class:"max-h-[160px] max-w-[160px] object-cover object-center"},null,8,_r)])]),h("div",vr,[h("div",{class:P(["form-group",{"form-group-invalid":d.selectedPictureErrorOn("title")}])},[e[8]||(e[8]=h("label",{for:"picture_title",class:"control-label"},"Titre",-1)),L(h("input",{id:"picture_title","onUpdate:modelValue":e[3]||(e[3]=m=>l.forms[t.mainStore.toEditPictureUuid].title=m),class:P([{"is-invalid":d.selectedPictureErrorOn("title")},"form-control"]),placeholder:l.forms[t.mainStore.toEditPictureUuid].default_title,maxlength:"50"},null,10,Sr),[[H,l.forms[t.mainStore.toEditPictureUuid].title]]),d.selectedPictureErrorOn("title")?(b(),g("span",wr,y(d.selectedPictureErrorOn("title")),1)):S("",!0)],2),h("div",{class:P(["form-group",{"form-group-invalid":d.selectedPictureErrorOn("category_id")}])},[e[10]||(e[10]=h("label",{for:"picture_category_id",class:"control-label"},"Catégorie",-1)),L(h("select",{id:"picture_category_id","onUpdate:modelValue":e[4]||(e[4]=m=>l.forms[t.mainStore.toEditPictureUuid].category_id=m),class:P([{"is-invalid":d.selectedPictureErrorOn("category_id")},"form-control"])},[e[9]||(e[9]=h("option",null,null,-1)),(b(!0),g(M,null,T(t.$root.categories,m=>(b(),g("option",{key:m[1],value:m[1]},y(m[0]),9,Er))),128))],2),[[te,l.forms[t.mainStore.toEditPictureUuid].category_id]]),d.selectedPictureErrorOn("category_id")?(b(),g("span",Pr,
1y(d.selectedPictureErrorOn("category_id")),1)):S("",!0)],2)]),h("div",{class:P(["form-group",{"form-group-invalid":d.selectedPictureErrorOn("description")}])},[e[11]||(e[11]=h("label",{for:"picture_description",class:"control-label"},"Description",-1)),L(h("textarea",{id:"picture_description","onUpdate:modelValue":e[5]||(e[5]=m=>l.forms[t.mainStore.toEditPictureUuid].description=m),class:P([{"is-invalid":d.selectedPictureErrorOn("description")},"form-control"]),maxlength:"800"},null,2),[[H,l.forms[t.mainStore.toEditPictureUuid].description]]),d.selectedPictureErrorOn("description")?(b(),g("span",Ar,y(d.selectedPictureErrorOn("description")),1)):S("",!0)],2),d.isVideo&&l.thumbnailUrls.length?(b(),g("div",Ur,[e[12]||(e[12]=h("label",{class:"control-label"},"Miniature",-1)),h("div",xr,[(b(!0),g(M,null,T(l.thumbnailUrls,(m,w)=>(b(),g("div",{key:w,class:P(["rounded-md ring-offset-1 ",d.picturePayload.url===m?"ring-2 ring-primary":"ring-1 ring-[#ced4da]"]),onClick:v=>d.selectThumbnail(m)},[h("img",{src:m,class:"img-fluid rounded-md"},null,8,Rr)],10,Or))),128))])])):S("",!0),h("div",{class:P(["form-group",{"form-group-invalid":d.selectedPictureErrorOn("tags_string")}])},[e[13]||(e[13]=h("label",{for:"picture_tags_string",class:"control-label"},"Mots-clés",-1)),L(h("input",{id:"picture_tags_string","onUpdate:modelValue":e[6]||(e[6]=m=>l.forms[t.mainStore.toEditPictureUuid].tags_string=m),class:P([{"is-invalid":d.selectedPictureErrorOn("tags_string")},"form-control"]),placeholder:"flat, template, responsive"},null,2),[[H,l.forms[t.mainStore.toEditPictureUuid].tags_string]]),d.selectedPictureErrorOn("tags_string")?(b(),g("span",Ir,y(d.selectedPictureErrorOn("tags_string")),1)):S("",!0)],2),h("div",{class:P(["form-group",{"form-group-invalid":d.selectedPictureErrorOn("license")}])},[e[15]||(e[15]=h("label",{for:"picture_license",class:"control-label"},"License",-1)),L(h("select",{id:"picture_license","onUpdate:modelValue":e[7]||(e[7]=m=>l.forms[t.mainStore.toEditPictureUuid].license=m),class:P(["form-control",{"is-invalid":d.selectedPictureErrorOn("license")}])},[e[14]||(e[14]=h("option",null,null,-1)),(b(!0),g(M,null,T(t.$root.licenses,m=>(b(),g("option",{key:m[1],value:m[1]},y(m[0]),9,Lr))),128))],2),[[te,l.forms[t.mainStore.toEditPictureUuid].license]]),d.selectedPictureErrorOn("license")?(b(),g("span",Cr,y(d.selectedPictureErrorOn("license")),1)):S("",!0)],2),h("div",kr,[O(p,{type:"submit",class:"btn btn-primary done-upload-btn float-right",loading:l.loading,onClick:F(d.submitPicture,["prevent"])},{default:G(()=>e[16]||(e[16]=[B(" Enregistrer ",-1)])),_:1,__:[16]},8,["loading","onClick"])])])])])])):S("",!0)]),_:1},8,["name"])])}const Mr=$(lr,[["render",Dr],["__scopeId","data-v-4ae7b33e"]]),Tr={components:{BModal:Ce,UserPicture:de,SelectStep:st,UploadStep:ar,EditStep:Mr},computed:{...k(C)}},Br={class:"row"},$r=["value"];function jr(t,e,i,a,l,d){const f=U("UserPicture"),p=U("SelectStep"),m=U("UploadStep"),w=U("EditStep"),v=U("BModal");return b(),g("div",null,[t.$root.bidMode?(b(),V(xe,{key:0,to:"#selected-pictures"},[h("div",Br,[(b(!0),g(M,null,T(t.mainStore.selectedPictures,A=>(b(),g("div",{key:A.id,class:"col-6 col-sm-3"},[O(f,{picture:A,"has-errors":t.$root.hasErrors},null,8,["picture","has-errors"]),h("input",{multiple:"multiple",type:"hidden",value:A.id,name:"bid[picture_ids][]",autocomplete:"off"},null,8,$r)]))),128))])])):S("",!0),O(v,{name:"picture-upload-modal","dialog-class":{"modal-lg":t.$root.bidMode}},{default:G(()=>[t.mainStore.view==="select"?(b(),V(p,{key:0})):S("",!0),t.mainStore.view==="upload"?(b(),V(m,{key:1})):S("",!0),t.mainStore.view==="edit"?(b(),V(w,{key:2})):S("",!0)]),_:1},8,["dialog-class"])])}const Vr=$(Tr,[["render",jr]]),Fr=Le();class qr extends Ee{connect(){const e=this;window.pictureUploadModalApp=Oe({data(){return{userSlug:e.userSlugValue,locales:e.localesValue,categories:e.categoriesValue,licenses:e.licensesValue,doneUrl:e.doneUrlValue,bidMode:e.bidModeValue,selectedPictures:e.selectedPicturesValue,hasErrors:e.hasErrorsValue,directUploadUrl:e.directUploadUrlValue}},computed:{...k(C)},beforeMount(){this.bidMode&&(N().get(`/${this.userSlug}/pictures`).then(a=>{this.mainStore.clearSelectedPictures(),this.mainStore.selectablePictures=a.data.pictures,this.selectedPictures.forEac
1h(l=>{this.mainStore.selectedPictures.find(d=>d.id===l)||this.mainStore.addSelectedPicture(this.mainStore.selectablePictures.find(d=>d.id===l))})}),this.mainStore.view="select")},render(){return Re(Vr)}}).use(Fr).use(He).component("VueLadda",ke).component("FaIcon",De),C().reset(),window.pictureUploadModalApp.mount(this.element)}disconnect(){window.pictureUploadModalApp.unmount(),delete window.pictureUploadModalApp}}Z(qr,"values",{userSlug:String,locales:Object,categories:Array,licenses:Array,doneUrl:String,bidMode:Boolean,selectedPictures:Array,hasErrors:Boolean,directUploadUrl:String});export{qr as default}; 2//# sourceMappingURL=picture_upload_modal_controller-D1hRWw6V.js.map
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.