@scaleflex/asset-picker 0.2.16 → 0.2.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var Ms=Object.create;var Kt=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var Os=Object.getOwnPropertyNames;var Ps=Object.getPrototypeOf,Is=Object.prototype.hasOwnProperty;var Ds=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Os(e))!Is.call(t,a)&&a!==s&&Kt(t,a,{get:()=>e[a],enumerable:!(i=Ls(e,a))||i.enumerable});return t};var zs=(t,e,s)=>(s=t!=null?Ms(Ps(t)):{},Ds(e||!t||!t.__esModule?Kt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class Rs{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function js(){return new Rs({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Ns{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Bs(t){return"extension"in t&&!("path"in t)}class Us{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const r=this._getCombinedList();for(let n=e;n<=s;n++){const l=r[n];l&&(Bs(l)?i.set(l.uuid,l):a.set(l.uuid,l))}}handleSelect(e,s,i){var l,d,h,u;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=new Map(a.selectedFolders);this._applyRangeSelection(f,p,r,g);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&r.size+g.size>m)return;this.store.setState({selectedAssets:r,selectedFolders:g})}else{const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=a.assets;for(let _=f;_<=p;_++)g[_]&&r.set(g[_].uuid,g[_]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&r.size>m)return;this.store.setState({selectedAssets:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const f=(u=a.config)==null?void 0:u.maxSelections,p=r.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(f&&p>f)return;this.store.setState({selectedAssets:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var l,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),r=new Map(a.selectedFolders);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,f,p,r);const g=(d=a.config)==null?void 0:d.maxSelections;if(g&&p.size+r.size>g)return;this.store.setState({selectedAssets:p,selectedFolders:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,f=r.size+a.selectedAssets.size;if(u&&f>u)return;this.store.setState({selectedFolders:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var l;const s=this.store.getState(),i=(l=s.config)==null?void 0:l.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,r=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)r.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:r}),this.lastClickedIndex=-1,r.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let l=0;l<r;l++)a.set(e[l].uuid,e[l]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Vs{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Yt=5,Me=40,Xt=15;class qs{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Yt&&a<Yt)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let r=Math.min(this.startX,i),n=Math.min(this.startY,a),l=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;r+l>h&&(l=h-r),n+d>u&&(d=u-n),r<0&&(l+=r,r=0),n<0&&(d+=n,n=0),this.rect={x:r,y:n,width:l,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<Me||a<Me;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<Me?r=-Xt*(1-i/Me):a<Me&&(r=Xt*(1-a/Me)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const r=i.shadowRoot.querySelectorAll("[data-folder-uuid]");r.length>0&&s.push(...Array.from(r))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),r=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(_=>_.uuid===g);m&&r.set(g,m)}}),s&&a.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(_=>_.uuid===g);m&&n.set(g,m)}});const l=(u=e.config)==null?void 0:u.maxSelections,d=r.size+(s?n.size:0);if(l&&d>l){const f=Array.from(r.entries()).slice(0,Math.max(0,l-n.size));this.store.setState({selectedAssets:new Map(f),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:r,...s?{selectedFolders:n}:{}})}}class Hs{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(l,d.join(",")):i.searchParams.set(l,String(d)))});const a={};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function Gs(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function He(t,e){const s=Gs(e);return t.request("/files",s)}async function Wt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),t.request("/files/stats",s)}async function Ks(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Ys(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Xs(t){return await t.request("/labels")}async function Ws(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function Qs(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const v={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},R={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},y={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Zs={AND:"AND"},b={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},vt={[b.DATE]:"date_",[b.BOOLEAN]:"bool_",[b.NUMERIC]:"num_",[b.DECIMAL2]:"dec_",[b.ATTACHMENTS_ASSETS]:"attach_",[b.ATTACHMENT_URI]:"uri_",[b.SELECT_ONE]:"one_",[b.MULTI_SELECT]:"multi_",[b.SUPERTAGS]:"tags_",[b.TEXT]:"text_",[b.TEXT_AREA]:"area_",[b.GEO_POINT]:"geo_",[b.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(vt).map(([t,e])=>[e,t]));const os=Object.values(vt),Ge={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Qt={EMPTY:"empty",NOT_EMPTY:"non-empty"},V="empty",q="non-empty",_e="specific",kt=10,St=10,at=10,ns="filters:pinned:",ls="metadata:pinned:",Zt=[v.DATE,v.TYPE,v.SIZE],cs=y.IS,ot="20",nt="1",Js=0,ei=[{key:v.DATE,label:"Date",icon:"calendar",type:"date"},{key:v.TYPE,label:"Format",icon:"file-type",type:"string"},{key:v.SIZE,label:"Size",icon:"scaling",type:"string"},{key:v.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:v.TAGS,label:"Tags",icon:"hash",type:"string"},{key:v.LABELS,label:"Labels",icon:"tag",type:"string"},{key:v.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:v.IMAGE,label:"Image",icon:"image",type:"string"},{key:v.COLOR,label:"Color",icon:"swatch-book",type:"string"}],ti={key:v.METADATA,label:"Metadata",icon:"file-text",type:"string"},si={key:v.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Pt=[ti,...ei,si],Le={[v.TYPE]:"Format",[v.DATE]:"Date",[v.SIZE]:"Size",[v.LICENSE_EXPIRY]:"License expiry",[v.TAGS]:"Tags",[v.LABELS]:"Labels",[v.PRODUCT_REF]:"Products",[v.IMAGE]:"Image",[v.COLOR]:"Color",[v.METADATA]:"Metadata",[v.APPROVAL]:"Approval"},j={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ct=[{value:j.IMAGE,label:"Image",icon:"image"},{value:j.VIDEO,label:"Video",icon:"clapperboard"},{value:j.AUDIO,label:"Audio",icon:"music"},{value:j.DOCUMENT,label:"Document",icon:"document"},{value:j.ARCHIVE,label:"Archive",icon:"archive"},{value:j.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:j.FONTS,label:"Fonts",icon:"text"},{value:j.OTHER,label:"Other",icon:"layout-grid"}],ii={[j.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[j.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[j.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[j.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[j.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[j.FONTS]:["ttf","otf","woff","woff2","eot"]},Ct={RESOLUTION:0,ORIENTATION:1,FACES:2},ai=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ri=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],oi=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],ds=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],zt=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],ps=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ni=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],li=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ci=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],Et=[{label:"Is",value:y.IS},{label:"Contains",value:y.CONTAINS_IN_TEXT}],re=[{label:"Is",value:y.IS},{label:"Is not",value:y.IS_NOT}],Ft=[{label:"Is",value:y.IS_EXACT},{label:"Contains",value:y.IS},{label:"Does not contain",value:y.IS_NOT}],At=[{label:"Is",value:y.IS},{label:"Greater than",value:y.GREATER_THAN_OR_EQUAL},{label:"Is not",value:y.IS_NOT},{label:"Less than",value:y.LESS_THAN_OR_EQUAL},{label:"Between",value:y.RANGE}],di=[{label:"Is",value:y.IS_EXACT},{label:"Is not",value:y.IS_NOT}],Jt=[{label:"Contains",value:y.CONTAINS},{label:"Does not contain",value:y.IS_NOT}],pi=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],xe=[{label:"Empty",value:V},{label:"Not empty",value:q}],Tt=[...xe,{label:"Specific",value:_e}],hi=[{label:"Empty",value:V},{label:"Not empty",value:q},{label:"True",value:"true"},{label:"False",value:"false"}],lt={[b.DATE]:"calendar",[b.BOOLEAN]:"toggle-left",[b.NUMERIC]:"file-digit",[b.DECIMAL2]:"decimals-arrow-right",[b.ATTACHMENTS_ASSETS]:"paperclip",[b.ATTACHMENT_URI]:"link-2",[b.SELECT_ONE]:"circle-dot",[b.MULTI_SELECT]:"square-check",[b.SUPERTAGS]:"hash",[b.TEXT]:"text-initial",[b.TEXT_AREA]:"text-align-justify",[b.GEO_POINT]:"locate",[b.INTEGER_LIST]:"list-ordered"},ui={[b.TEXT]:"text",[b.TEXT_AREA]:"text",[b.NUMERIC]:"number",[b.DECIMAL2]:"number",[b.BOOLEAN]:"boolean",[b.SELECT_ONE]:"select-one",[b.MULTI_SELECT]:"multi-select",[b.SUPERTAGS]:"tags",[b.DATE]:"date",[b.GEO_POINT]:"geo",[b.ATTACHMENTS_ASSETS]:"attachment",[b.ATTACHMENT_URI]:"attachment",[b.INTEGER_LIST]:"attachment"};async function gi(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:fi(a.name)}))}function fi(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function mi(t){var m,_;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[Js],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(x=>({uuid:x.uuid,label:x.label??x.name??"",variants:(x.variants??[]).map($=>({api_value:$.api_value??$.value??"",internal_unique_value:$.internal_unique_value??$.api_value??"",label:$.label??$.name??""}))})).filter(x=>x.variants.length>1),h={};for(const x of d)h[x.uuid]=((m=x.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((_=e.settings)==null?void 0:_.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const x of p){const $=x.name||"Root fields";for(const k of x.fields??[]){const A=k.possible_values,O=A==null?void 0:A.map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??S.api_value??""}));g.push({key:k.key??k.ckey,label:k.title??k.label??k.key??"",type:k.type??"text",slug:k.slug,ckey:k.ckey,possible_values:O,group:$,regionalVariantsGroupUuid:k.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ye(t){return t.toLocaleDateString("en-CA")}function rt(){return ye(new Date)}function hs(t){const e=new Date;switch(t){case"today":return{from:rt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ye(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:rt(),to:ye(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ye(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:rt(),to:ye(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ye(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:rt(),to:ye(s)}}default:return null}}function es(t,e){return e?e.type==="date"?vi(e):e.type==="string"?bi(e):!0:!1}function vi(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function bi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function _i(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!es(i,a))continue;const r=xi(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!es(i,a))continue;const r=Fi(i,a);s.push(...r)}return yi(s)}function yi(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function xi(t,e){if(e.type==="date")return us(t,e);if(t===v.IMAGE)return Ei(e);const s=e,{operator:i=cs,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case v.SIZE:return wi(t,a,"..");case v.FACES:return $i(t,i,a);case v.TAGS:return we(t,i,ts(a),",",r);case v.LABELS:return we(t,i,ts(a),",",r);case v.COLOR:return ki(i,a,r);case v.TYPE:return Si(a,i);case v.MIME_TYPE:return Ci(t,a,i);case v.PRODUCT_REF:return we(t,"=%",a,",",r);default:return we(t,i,a,",",r)}}function us(t,e){const s=e.field||"created";if(e.kind===Ge.PRESET&&e.preset){if(e.preset===Qt.EMPTY)return[`${s}:"empty"`];if(e.preset===Qt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=hs(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===Ge.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ge.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ge.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===Ge.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function wi(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function $i(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function we(t,e,s,i,a){if(s.length===0)return[];if(a===Zs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function ki(t,e,s){const i=[],a=we("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Si(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const r of t){const n=ii[r];if(n)for(const l of n){const d=`${r}_${l}`;s.has(d)||(s.add(d),i.push(d))}else s.has(r)||(s.add(r),i.push(r))}const a=i.map(r=>`"${r}"`).join(",");return[`type${e}${a}`]}function Ci(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function Ei(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[Ct.RESOLUTION],a=s[Ct.ORIENTATION],r=s[Ct.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function Fi(t,e){const s=Mi(t),i=Ti(t);if(e.type==="date")return Ai(s,e,i);const a=e,{operator:r=cs,values:n=[],logic:l,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===V||n[0]===q)){const h=d===b.GEO_POINT?y.IS+"~":y.IS;return[`${s}${h}"${n[0]}"`]}if((d===b.NUMERIC||d===b.DECIMAL2)&&r===y.RANGE)return[`${s}${y.IS}"${n.join('","')}"`];if(d===b.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return we(s,r+"~",h,",",l)}return we(s,r,n,",",l)}function Ai(t,e,s){const i=us(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function Ti(t){return t.startsWith("date_")}function Mi(t){for(const e of os)if(t.startsWith(e))return t.slice(e.length);return t}function ts(t){return t.map(e=>e.replace(/#/g,""))}const Li=new Set([v.DATE,v.LICENSE_EXPIRY,R.DUE_DATE]);function It(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Oi(s,i));return e}function Oi(t,e){return e.type==="string"||e.type==="date"?e:Li.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Pi(t){const e=localStorage.getItem(ns+t),s=localStorage.getItem(ls+t);let i;try{i=e?JSON.parse(e):[...Zt]}catch{i=[...Zt]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ii(t,e){localStorage.setItem(ns+t,JSON.stringify(e))}function Di(t,e){localStorage.setItem(ls+t,JSON.stringify(e))}const gs="sort-by",fs="sort-order";function ss(t,e){try{localStorage.setItem(gs,t),localStorage.setItem(fs,e)}catch{}}function zi(){try{const t=localStorage.getItem(gs),e=localStorage.getItem(fs);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const ms="ap-last-folder",vs="ap-last-view",bs="ap-last-tab";function Ne(t,e){return e?`${t}:${e}`:t}function is(t,e){try{localStorage.setItem(Ne(ms,e),t)}catch{}}function Ri(t){try{return localStorage.getItem(Ne(ms,t))}catch{return null}}function ji(t,e){try{localStorage.setItem(Ne(vs,e),t)}catch{}}function Ni(t){try{return localStorage.getItem(Ne(vs,t))}catch{return null}}function Bi(t,e){try{localStorage.setItem(Ne(bs,e),t)}catch{}}function Ui(t){try{const e=localStorage.getItem(Ne(bs,t));return e==="assets"||e==="folders"?e:null}catch{return null}}function Vi(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function Mt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function qi(t,e,s){const i=Mt(t),a=Mt(e),r=Mt(s),n=.4122214708*i+.5363325363*a+.0514459929*r,l=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,m=.0259040371*h+.7827717662*u-.808675766*f,_=Math.sqrt(g*g+m*m);let x=Math.atan2(m,g)*(180/Math.PI);return x<0&&(x+=360),[p,_,x]}function Hi(t){return t>.7}function Gi(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[i,a,r]=Vi(e),[n,l,d]=qi(i,a,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Hi(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const Rt=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Ki=[{value:"relevance",label:"Relevance"},...Rt],Yi=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var Xi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,jt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Xi(e,s,a),a};let Ye=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
1
+ "use strict";var Is=Object.create;var Qt=Object.defineProperty;var Ps=Object.getOwnPropertyDescriptor;var Ds=Object.getOwnPropertyNames;var zs=Object.getPrototypeOf,Rs=Object.prototype.hasOwnProperty;var js=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ds(e))!Rs.call(t,a)&&a!==s&&Qt(t,a,{get:()=>e[a],enumerable:!(i=Ps(e,a))||i.enumerable});return t};var Ns=(t,e,s)=>(s=t!=null?Is(zs(t)):{},js(e||!t||!t.__esModule?Qt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class Bs{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Us(){return new Bs({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",isAISearchActive:!1,sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Vs{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function qs(t){return"extension"in t&&!("path"in t)}class Hs{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const r=this._getCombinedList();for(let n=e;n<=s;n++){const l=r[n];l&&(qs(l)?i.set(l.uuid,l):a.set(l.uuid,l))}}handleSelect(e,s,i){var l,d,h,u;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=new Map(a.selectedFolders);this._applyRangeSelection(f,p,r,g);const v=(d=a.config)==null?void 0:d.maxSelections;if(v&&r.size+g.size>v)return;this.store.setState({selectedAssets:r,selectedFolders:g})}else{const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=a.assets;for(let _=f;_<=p;_++)g[_]&&r.set(g[_].uuid,g[_]);const v=(h=a.config)==null?void 0:h.maxSelections;if(v&&r.size>v)return;this.store.setState({selectedAssets:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const f=(u=a.config)==null?void 0:u.maxSelections,p=r.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(f&&p>f)return;this.store.setState({selectedAssets:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var l,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),r=new Map(a.selectedFolders);if(!(((l=a.config)==null?void 0:l.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,f,p,r);const g=(d=a.config)==null?void 0:d.maxSelections;if(g&&p.size+r.size>g)return;this.store.setState({selectedAssets:p,selectedFolders:r})}else if(i.metaKey||i.ctrlKey){r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,f=r.size+a.selectedAssets.size;if(u&&f>u)return;this.store.setState({selectedFolders:r})}else r.clear(),r.set(e.uuid,e),this.store.setState({selectedFolders:r,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var l;const s=this.store.getState(),i=(l=s.config)==null?void 0:l.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,r=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)r.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:r}),this.lastClickedIndex=-1,r.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let l=0;l<r;l++)a.set(e[l].uuid,e[l]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Gs{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Xt=5,Le=40,Wt=15;class Ks{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Xt&&a<Xt)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let r=Math.min(this.startX,i),n=Math.min(this.startY,a),l=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;r+l>h&&(l=h-r),n+d>u&&(d=u-n),r<0&&(l+=r,r=0),n<0&&(d+=n,n=0),this.rect={x:r,y:n,width:l,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<Le||a<Le;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<Le?r=-Wt*(1-i/Le):a<Le&&(r=Wt*(1-a/Le)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const r=i.shadowRoot.querySelectorAll("[data-folder-uuid]");r.length>0&&s.push(...Array.from(r))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),r=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.assetUuid;if(this.intersectsMarquee(p)){const v=e.assets.find(_=>_.uuid===g);v&&r.set(g,v)}}),s&&a.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.folderUuid;if(this.intersectsMarquee(p)){const v=e.folders.find(_=>_.uuid===g);v&&n.set(g,v)}});const l=(u=e.config)==null?void 0:u.maxSelections,d=r.size+(s?n.size:0);if(l&&d>l){const f=Array.from(r.entries()).slice(0,Math.max(0,l-n.size));this.store.setState({selectedAssets:new Map(f),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:r,...s?{selectedFolders:n}:{}})}}class Ys{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(l,d.join(",")):i.searchParams.set(l,String(d)))});const a={};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function Qs(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&!t.with_ai&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),t.with_ai&&(e.with_ai=!0,t.ai_query&&(e.ai_query=t.ai_query),t.ai_lang&&(e.ai_lang=t.ai_lang)),e}async function Ge(t,e){const s=Qs(e);return t.request("/files",s)}async function Zt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&!e.with_ai&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),e.with_ai&&(s.with_ai=!0,e.ai_query&&(s.ai_query=e.ai_query),e.ai_lang&&(s.ai_lang=e.ai_lang)),t.request("/files/stats",s)}async function Xs(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Ws(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Zs(t){return await t.request("/labels")}async function Js(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function ei(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const m={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},B={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},x={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},ti={AND:"AND"},b={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},mt={[b.DATE]:"date_",[b.BOOLEAN]:"bool_",[b.NUMERIC]:"num_",[b.DECIMAL2]:"dec_",[b.ATTACHMENTS_ASSETS]:"attach_",[b.ATTACHMENT_URI]:"uri_",[b.SELECT_ONE]:"one_",[b.MULTI_SELECT]:"multi_",[b.SUPERTAGS]:"tags_",[b.TEXT]:"text_",[b.TEXT_AREA]:"area_",[b.GEO_POINT]:"geo_",[b.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(mt).map(([t,e])=>[e,t]));const ls=Object.values(mt),Ke={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Jt={EMPTY:"empty",NOT_EMPTY:"non-empty"},Q="empty",X="non-empty",ye="specific",Ct=10,Et=10,at=10,cs="filters:pinned:",ds="metadata:pinned:",es=[m.DATE,m.TYPE,m.SIZE],ps=x.IS,ot="20",nt="1",si=0,ii=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],ai={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},ri={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Dt=[ai,...ii,ri],Oe={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},U={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ct=[{value:U.IMAGE,label:"Image",icon:"image"},{value:U.VIDEO,label:"Video",icon:"clapperboard"},{value:U.AUDIO,label:"Audio",icon:"music"},{value:U.DOCUMENT,label:"Document",icon:"document"},{value:U.ARCHIVE,label:"Archive",icon:"archive"},{value:U.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:U.FONTS,label:"Fonts",icon:"text"},{value:U.OTHER,label:"Other",icon:"layout-grid"}],oi={[U.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[U.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[U.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[U.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[U.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[U.FONTS]:["ttf","otf","woff","woff2","eot"]},Ft={RESOLUTION:0,ORIENTATION:1,FACES:2},ni=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],li=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],ci=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],hs=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],jt=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],us=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],di=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],pi=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],hi=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],At=[{label:"Is",value:x.IS},{label:"Contains",value:x.CONTAINS_IN_TEXT}],ce=[{label:"Is",value:x.IS},{label:"Is not",value:x.IS_NOT}],Tt=[{label:"Is",value:x.IS_EXACT},{label:"Contains",value:x.IS},{label:"Does not contain",value:x.IS_NOT}],Mt=[{label:"Is",value:x.IS},{label:"Greater than",value:x.GREATER_THAN_OR_EQUAL},{label:"Is not",value:x.IS_NOT},{label:"Less than",value:x.LESS_THAN_OR_EQUAL},{label:"Between",value:x.RANGE}],ui=[{label:"Is",value:x.IS_EXACT},{label:"Is not",value:x.IS_NOT}],ts=[{label:"Contains",value:x.CONTAINS},{label:"Does not contain",value:x.IS_NOT}],gi=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],we=[{label:"Empty",value:Q},{label:"Not empty",value:X}],Lt=[...we,{label:"Specific",value:ye}],fi=[{label:"Empty",value:Q},{label:"Not empty",value:X},{label:"True",value:"true"},{label:"False",value:"false"}],lt={[b.DATE]:"calendar",[b.BOOLEAN]:"toggle-left",[b.NUMERIC]:"file-digit",[b.DECIMAL2]:"decimals-arrow-right",[b.ATTACHMENTS_ASSETS]:"paperclip",[b.ATTACHMENT_URI]:"link-2",[b.SELECT_ONE]:"circle-dot",[b.MULTI_SELECT]:"square-check",[b.SUPERTAGS]:"hash",[b.TEXT]:"text-initial",[b.TEXT_AREA]:"text-align-justify",[b.GEO_POINT]:"locate",[b.INTEGER_LIST]:"list-ordered"},vi={[b.TEXT]:"text",[b.TEXT_AREA]:"text",[b.NUMERIC]:"number",[b.DECIMAL2]:"number",[b.BOOLEAN]:"boolean",[b.SELECT_ONE]:"select-one",[b.MULTI_SELECT]:"multi-select",[b.SUPERTAGS]:"tags",[b.DATE]:"date",[b.GEO_POINT]:"geo",[b.ATTACHMENTS_ASSETS]:"attachment",[b.ATTACHMENT_URI]:"attachment",[b.INTEGER_LIST]:"attachment"};async function mi(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:bi(a.name)}))}function bi(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function _i(t){var v,_;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[si],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(y=>({uuid:y.uuid,label:y.label??y.name??"",variants:(y.variants??[]).map($=>({api_value:$.api_value??$.value??"",internal_unique_value:$.internal_unique_value??$.api_value??"",label:$.label??$.name??""}))})).filter(y=>y.variants.length>1),h={};for(const y of d)h[y.uuid]=((v=y.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((_=e.settings)==null?void 0:_.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const y of p){const $=y.name||"Root fields";for(const k of y.fields??[]){const T=k.possible_values,O=T==null?void 0:T.map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??S.api_value??""}));g.push({key:k.key??k.ckey,label:k.title??k.label??k.key??"",type:k.type??"text",slug:k.slug,ckey:k.ckey,possible_values:O,group:$,regionalVariantsGroupUuid:k.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function xe(t){return t.toLocaleDateString("en-CA")}function rt(){return xe(new Date)}function gs(t){const e=new Date;switch(t){case"today":return{from:rt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:xe(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:rt(),to:xe(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:xe(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:rt(),to:xe(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:xe(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:rt(),to:xe(s)}}default:return null}}function ss(t,e){return e?e.type==="date"?yi(e):e.type==="string"?xi(e):!0:!1}function yi(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function xi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function wi(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!ss(i,a))continue;const r=ki(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!ss(i,a))continue;const r=Mi(i,a);s.push(...r)}return $i(s)}function $i(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function ki(t,e){if(e.type==="date")return fs(t,e);if(t===m.IMAGE)return Ti(e);const s=e,{operator:i=ps,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case m.SIZE:return Si(t,a,"..");case m.FACES:return Ci(t,i,a);case m.TAGS:return $e(t,i,is(a),",",r);case m.LABELS:return $e(t,i,is(a),",",r);case m.COLOR:return Ei(i,a,r);case m.TYPE:return Fi(a,i);case m.MIME_TYPE:return Ai(t,a,i);case m.PRODUCT_REF:return $e(t,"=%",a,",",r);default:return $e(t,i,a,",",r)}}function fs(t,e){const s=e.field||"created";if(e.kind===Ke.PRESET&&e.preset){if(e.preset===Jt.EMPTY)return[`${s}:"empty"`];if(e.preset===Jt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=gs(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===Ke.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ke.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ke.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===Ke.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function Si(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Ci(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function $e(t,e,s,i,a){if(s.length===0)return[];if(a===ti.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function Ei(t,e,s){const i=[],a=$e("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Fi(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const r of t){const n=oi[r];if(n)for(const l of n){const d=`${r}_${l}`;s.has(d)||(s.add(d),i.push(d))}else s.has(r)||(s.add(r),i.push(r))}const a=i.map(r=>`"${r}"`).join(",");return[`type${e}${a}`]}function Ai(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function Ti(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[Ft.RESOLUTION],a=s[Ft.ORIENTATION],r=s[Ft.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function Mi(t,e){const s=Ii(t),i=Oi(t);if(e.type==="date")return Li(s,e,i);const a=e,{operator:r=ps,values:n=[],logic:l,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===Q||n[0]===X)){const h=d===b.GEO_POINT?x.IS+"~":x.IS;return[`${s}${h}"${n[0]}"`]}if((d===b.NUMERIC||d===b.DECIMAL2)&&r===x.RANGE)return[`${s}${x.IS}"${n.join('","')}"`];if(d===b.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return $e(s,r+"~",h,",",l)}return $e(s,r,n,",",l)}function Li(t,e,s){const i=fs(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function Oi(t){return t.startsWith("date_")}function Ii(t){for(const e of ls)if(t.startsWith(e))return t.slice(e.length);return t}function is(t){return t.map(e=>e.replace(/#/g,""))}const Pi=new Set([m.DATE,m.LICENSE_EXPIRY,B.DUE_DATE]);function zt(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Di(s,i));return e}function Di(t,e){return e.type==="string"||e.type==="date"?e:Pi.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function zi(t){const e=localStorage.getItem(cs+t),s=localStorage.getItem(ds+t);let i;try{i=e?JSON.parse(e):[...es]}catch{i=[...es]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ri(t,e){localStorage.setItem(cs+t,JSON.stringify(e))}function ji(t,e){localStorage.setItem(ds+t,JSON.stringify(e))}const vs="sort-by",ms="sort-order";function as(t,e){try{localStorage.setItem(vs,t),localStorage.setItem(ms,e)}catch{}}function Ni(){try{const t=localStorage.getItem(vs),e=localStorage.getItem(ms);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const bs="ap-last-folder",_s="ap-last-view",ys="ap-last-tab";function Be(t,e){return e?`${t}:${e}`:t}function rs(t,e){try{localStorage.setItem(Be(bs,e),t)}catch{}}function Bi(t){try{return localStorage.getItem(Be(bs,t))}catch{return null}}function Ui(t,e){try{localStorage.setItem(Be(_s,e),t)}catch{}}function Vi(t){try{return localStorage.getItem(Be(_s,t))}catch{return null}}function qi(t,e){try{localStorage.setItem(Be(ys,e),t)}catch{}}function Hi(t){try{const e=localStorage.getItem(Be(ys,t));return e==="assets"||e==="folders"?e:null}catch{return null}}function Gi(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function Ot(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Ki(t,e,s){const i=Ot(t),a=Ot(e),r=Ot(s),n=.4122214708*i+.5363325363*a+.0514459929*r,l=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,_=Math.sqrt(g*g+v*v);let y=Math.atan2(v,g)*(180/Math.PI);return y<0&&(y+=360),[p,_,y]}function Yi(t){return t>.7}function Qi(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[i,a,r]=Gi(e),[n,l,d]=Ki(i,a,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Yi(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const Nt=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Xi=[{value:"relevance",label:"Relevance"},...Nt],Wi=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Bt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};let Qe=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
2
2
  <dialog
3
3
  @click=${this._handleBackdropClick}
4
4
  @cancel=${this._handleCancel}
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
  </dialog>
18
- `}};Ye.styles=o.css`
18
+ `}};Qe.styles=o.css`
19
19
  :host {
20
20
  display: contents;
21
21
  }
@@ -88,11 +88,11 @@
88
88
  animation: none;
89
89
  }
90
90
  }
91
- `;jt([c.property({type:Boolean})],Ye.prototype,"open",2);jt([c.query("dialog")],Ye.prototype,"dialog",2);Ye=jt([c.customElement("ap-modal")],Ye);function Qi(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const ee=o.css`
91
+ `;Bt([c.property({type:Boolean})],Qe.prototype,"open",2);Bt([c.query("dialog")],Qe.prototype,"dialog",2);Qe=Bt([c.customElement("ap-modal")],Qe);function ea(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const re=o.css`
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,bt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};let Pe=class extends o.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return o.html`
95
+ `;var ta=Object.defineProperty,sa=Object.getOwnPropertyDescriptor,bt=(t,e,s,i)=>{for(var a=i>1?void 0:i?sa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ta(e,s,a),a};let Pe=class extends o.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return o.html`
96
96
  <button
97
97
  class="trigger ${this._open?"active":""}"
98
98
  @click=${()=>this._open=!this._open}
@@ -208,7 +208,7 @@
208
208
  width: 16px;
209
209
  flex-shrink: 0;
210
210
  }
211
- `;bt([c.property({type:Array})],Pe.prototype,"groups",2);bt([c.property({type:Object})],Pe.prototype,"selectedFilters",2);bt([c.state()],Pe.prototype,"_open",2);Pe=bt([c.customElement("ap-regional-settings")],Pe);var ea=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ce=(t,e,s,i)=>{for(var a=i>1?void 0:i?ta(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ea(e,s,a),a};const sa=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let W=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=Qi(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=sa.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
211
+ `;bt([c.property({type:Array})],Pe.prototype,"groups",2);bt([c.property({type:Object})],Pe.prototype,"selectedFilters",2);bt([c.state()],Pe.prototype,"_open",2);Pe=bt([c.customElement("ap-regional-settings")],Pe);var ia=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,se=(t,e,s,i)=>{for(var a=i>1?void 0:i?aa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ia(e,s,a),a};const ra=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let H=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=ea(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleAISearch(){this.dispatchEvent(new CustomEvent("ai-search-toggle",{detail:{active:!this.isAISearchActive},bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=ra.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
212
212
  <div class="header-row">
213
213
  ${t.length>1?o.html`<ap-dropdown
214
214
  .value=${this.activeTab}
@@ -219,15 +219,28 @@
219
219
  <ap-icon class="search-icon" name="search" .size=${16}></ap-icon>
220
220
  <input
221
221
  type="text"
222
- placeholder=${this.activeTab==="folders"?"Search folders and assets":"Search assets"}
222
+ placeholder=${this.isAISearchActive?this.activeTab==="folders"?"AI search folders and assets":"AI search assets":this.activeTab==="folders"?"Search folders and assets":"Search assets"}
223
223
  .value=${this.searchQuery}
224
224
  @input=${this._handleInput}
225
225
  />
226
- ${this._localSearch?o.html`
227
- <button class="clear-btn" @click=${this._clearSearch} aria-label="Clear search">
228
- <ap-icon name="close" .size=${14}></ap-icon>
229
- </button>
230
- `:""}
226
+ <div class="search-actions">
227
+ ${this._localSearch?o.html`
228
+ <button class="clear-btn" @click=${this._clearSearch} aria-label="Clear search">
229
+ <ap-icon name="close" .size=${14}></ap-icon>
230
+ </button>
231
+ `:""}
232
+ ${this.enableAISearch?o.html`
233
+ <button
234
+ class="ai-toggle ${this.isAISearchActive?"active":""}"
235
+ @click=${this._toggleAISearch}
236
+ aria-label=${this.isAISearchActive?"Disable AI search":"Enable AI search"}
237
+ title=${this.isAISearchActive?"AI search on":"AI search off"}
238
+ >
239
+ <ap-icon name="sparkles" .size=${12}></ap-icon>
240
+ <span>AI</span>
241
+ </button>
242
+ `:""}
243
+ </div>
231
244
  </div>
232
245
  <div class="actions">
233
246
  <ap-regional-settings
@@ -251,7 +264,7 @@
251
264
  `}
252
265
  </div>
253
266
  </div>
254
- `}};W.styles=[ee,o.css`
267
+ `}};H.styles=[re,o.css`
255
268
  :host {
256
269
  display: block;
257
270
  padding: 16px 20px;
@@ -280,7 +293,7 @@
280
293
  width: 100%;
281
294
  height: 36px;
282
295
  box-sizing: border-box;
283
- padding: 0 32px 0 38px;
296
+ padding: 0 34px 0 38px;
284
297
  border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
285
298
  border-radius: var(--ap-radius-sm, 6px);
286
299
  font-size: var(--ap-font-size-sm, 0.875rem);
@@ -303,16 +316,24 @@
303
316
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
304
317
  font-weight: 400;
305
318
  }
306
- .clear-btn {
319
+ :host([ai-search]) input {
320
+ padding-right: 90px;
321
+ }
322
+ .search-actions {
307
323
  position: absolute;
308
- right: 8px;
324
+ right: 6px;
309
325
  top: 50%;
310
326
  transform: translateY(-50%);
327
+ display: flex;
328
+ align-items: center;
329
+ gap: 2px;
330
+ }
331
+ .clear-btn {
311
332
  display: flex;
312
333
  align-items: center;
313
334
  justify-content: center;
314
- width: 20px;
315
- height: 20px;
335
+ width: 22px;
336
+ height: 22px;
316
337
  border: none;
317
338
  border-radius: var(--ap-radius-sm, 6px);
318
339
  background: none;
@@ -324,6 +345,38 @@
324
345
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
325
346
  background: var(--ap-muted, oklch(0.974 0.006 239.819));
326
347
  }
348
+ .ai-toggle {
349
+ display: flex;
350
+ align-items: center;
351
+ gap: 4px;
352
+ height: 26px;
353
+ padding: 0 8px;
354
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
355
+ border-radius: var(--ap-radius-sm, 6px);
356
+ background: none;
357
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
358
+ font-size: 12px;
359
+ font-weight: 500;
360
+ font-family: var(--ap-font-family, system-ui, sans-serif);
361
+ cursor: pointer;
362
+ white-space: nowrap;
363
+ }
364
+ .ai-toggle:hover {
365
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
366
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
367
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
368
+ }
369
+ .ai-toggle.active {
370
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
371
+ color: white;
372
+ border-color: transparent;
373
+ }
374
+ .ai-toggle.active:hover {
375
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
376
+ color: white;
377
+ border-color: transparent;
378
+ opacity: 0.9;
379
+ }
327
380
  .icon-btn {
328
381
  display: flex;
329
382
  align-items: center;
@@ -362,7 +415,7 @@
362
415
  height: 24px;
363
416
  background: var(--ap-border, oklch(92.86% 0.009 247.92));
364
417
  }
365
- `];ce([c.property()],W.prototype,"activeTab",2);ce([c.property({type:Array})],W.prototype,"tabs",2);ce([c.property()],W.prototype,"viewMode",2);ce([c.property()],W.prototype,"searchQuery",2);ce([c.property({type:Array})],W.prototype,"regionalGroups",2);ce([c.property({type:Object})],W.prototype,"regionalFilters",2);ce([c.property({type:Boolean})],W.prototype,"hideClose",2);ce([c.state()],W.prototype,"_localSearch",2);W=ce([c.customElement("ap-header")],W);var ia=Object.defineProperty,aa=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?aa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ia(e,s,a),a};let dt=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
418
+ `];se([c.property()],H.prototype,"activeTab",2);se([c.property({type:Array})],H.prototype,"tabs",2);se([c.property()],H.prototype,"viewMode",2);se([c.property()],H.prototype,"searchQuery",2);se([c.property({type:Array})],H.prototype,"regionalGroups",2);se([c.property({type:Object})],H.prototype,"regionalFilters",2);se([c.property({type:Boolean})],H.prototype,"hideClose",2);se([c.property({type:Boolean,reflect:!0,attribute:"ai-search"})],H.prototype,"enableAISearch",2);se([c.property({type:Boolean})],H.prototype,"isAISearchActive",2);se([c.state()],H.prototype,"_localSearch",2);H=se([c.customElement("ap-header")],H);var oa=Object.defineProperty,na=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&oa(e,s,a),a};let dt=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
366
419
  <nav class="breadcrumb" aria-label="Breadcrumb">
367
420
  <button @click=${()=>this._navigate("")}>Root</button>
368
421
  ${this.items.map((t,e)=>o.html`
@@ -406,7 +459,7 @@
406
459
  ap-icon {
407
460
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
408
461
  }
409
- `;_s([c.property({type:Array})],dt.prototype,"items",2);dt=_s([c.customElement("ap-breadcrumb")],dt);var ra=Object.defineProperty,oa=Object.getOwnPropertyDescriptor,Nt=(t,e,s,i)=>{for(var a=i>1?void 0:i?oa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ra(e,s,a),a};let Xe=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
462
+ `;xs([c.property({type:Array})],dt.prototype,"items",2);dt=xs([c.customElement("ap-breadcrumb")],dt);var la=Object.defineProperty,ca=Object.getOwnPropertyDescriptor,Ut=(t,e,s,i)=>{for(var a=i>1?void 0:i?ca(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&la(e,s,a),a};let Xe=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
410
463
  <div class="popover">
411
464
  ${this.title?o.html`<div class="title">${this.title}</div>`:""}
412
465
  <slot></slot>
@@ -436,7 +489,7 @@
436
489
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
437
490
  margin-bottom: 12px;
438
491
  }
439
- `;Nt([c.property()],Xe.prototype,"title",2);Nt([c.property({type:Boolean})],Xe.prototype,"open",2);Xe=Nt([c.customElement("ap-filter-popover")],Xe);var na=Object.defineProperty,la=Object.getOwnPropertyDescriptor,Ze=(t,e,s,i)=>{for(var a=i>1?void 0:i?la(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&na(e,s,a),a};function as(t){var i;const e=new Map;for(const a of t){const r=a.category||a.value.split("_")[0];if(!e.has(r)){const l=ct.find(d=>d.value===r);e.set(r,{key:r,label:(l==null?void 0:l.label)||r.charAt(0).toUpperCase()+r.slice(1),icon:(l==null?void 0:l.icon)||"file",extensions:[],totalCount:0})}const n=e.get(r);n.extensions.push({value:a.value,label:a.label||((i=a.value.split("_").pop())==null?void 0:i.toUpperCase())||a.value,count:a.count}),n.totalCount+=a.count}const s=ct.map(a=>a.value);return[...e.values()].sort((a,r)=>{const n=s.indexOf(a.key),l=s.indexOf(r.key);return(n===-1?999:n)-(l===-1?999:l)})}let $e=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this.fileTypes=[],this._search="",this._expanded=new Set}_extValues(t){return t.extensions.map(e=>e.value)}_isGroupFullySelected(t){if(this.selected.includes(t.key))return!0;const e=this._extValues(t);return e.length>0&&e.every(s=>this.selected.includes(s))}_isGroupPartial(t){if(this.selected.includes(t.key))return!1;const e=this._extValues(t),s=e.filter(i=>this.selected.includes(i)).length;return s>0&&s<e.length}_isExtSelected(t,e){return this.selected.includes(e)||this.selected.includes(t)}_toggleGroup(t){const e=this._extValues(t),s=this._isGroupFullySelected(t);let i;if(s){const a=new Set([t.key,...e]);i=this.selected.filter(r=>!a.has(r))}else{const a=new Set(e);i=this.selected.filter(r=>!a.has(r)),i.push(t.key)}this._emit(i)}_toggleExt(t,e){const s=this._extValues(e);let i=[...this.selected];i.includes(e.key)&&(i=i.filter(a=>a!==e.key),i.push(...s)),i.includes(t)?i=i.filter(a=>a!==t):(i.push(t),s.every(a=>i.includes(a))&&(i=i.filter(a=>!s.includes(a)),i.push(e.key))),this._emit(i)}_clearAll(){this._emit([])}_emit(t){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.TYPE,values:t,operator:y.IS},bubbles:!0,composed:!0}))}_toggleExpand(t){const e=new Set(this._expanded);e.has(t)?e.delete(t):e.add(t),this._expanded=e}_filteredGroups(t){const e=this._search.toLowerCase().trim();return e?t.map(s=>{if(s.label.toLowerCase().includes(e)||s.key.toLowerCase().includes(e))return s;const a=s.extensions.filter(r=>r.label.toLowerCase().includes(e)||r.value.toLowerCase().includes(e));return a.length===0?null:{...s,extensions:a}}).filter(s=>s!==null):t}_toggleCategory(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this._emit(e)}updated(t){if(t.has("fileTypes")&&this.fileTypes.length>0){const e=as(this.fileTypes),s=new Set(this._expanded);for(const i of e)(this._isGroupFullySelected(i)||this._isGroupPartial(i))&&s.add(i.key);this._expanded=s}}render(){if(this.fileTypes.length===0)return this._renderFallback();const t=as(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return o.html`
492
+ `;Ut([c.property()],Xe.prototype,"title",2);Ut([c.property({type:Boolean})],Xe.prototype,"open",2);Xe=Ut([c.customElement("ap-filter-popover")],Xe);var da=Object.defineProperty,pa=Object.getOwnPropertyDescriptor,Je=(t,e,s,i)=>{for(var a=i>1?void 0:i?pa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&da(e,s,a),a};function os(t){var i;const e=new Map;for(const a of t){const r=a.category||a.value.split("_")[0];if(!e.has(r)){const l=ct.find(d=>d.value===r);e.set(r,{key:r,label:(l==null?void 0:l.label)||r.charAt(0).toUpperCase()+r.slice(1),icon:(l==null?void 0:l.icon)||"file",extensions:[],totalCount:0})}const n=e.get(r);n.extensions.push({value:a.value,label:a.label||((i=a.value.split("_").pop())==null?void 0:i.toUpperCase())||a.value,count:a.count}),n.totalCount+=a.count}const s=ct.map(a=>a.value);return[...e.values()].sort((a,r)=>{const n=s.indexOf(a.key),l=s.indexOf(r.key);return(n===-1?999:n)-(l===-1?999:l)})}let ke=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this.fileTypes=[],this._search="",this._expanded=new Set}_extValues(t){return t.extensions.map(e=>e.value)}_isGroupFullySelected(t){if(this.selected.includes(t.key))return!0;const e=this._extValues(t);return e.length>0&&e.every(s=>this.selected.includes(s))}_isGroupPartial(t){if(this.selected.includes(t.key))return!1;const e=this._extValues(t),s=e.filter(i=>this.selected.includes(i)).length;return s>0&&s<e.length}_isExtSelected(t,e){return this.selected.includes(e)||this.selected.includes(t)}_toggleGroup(t){const e=this._extValues(t),s=this._isGroupFullySelected(t);let i;if(s){const a=new Set([t.key,...e]);i=this.selected.filter(r=>!a.has(r))}else{const a=new Set(e);i=this.selected.filter(r=>!a.has(r)),i.push(t.key)}this._emit(i)}_toggleExt(t,e){const s=this._extValues(e);let i=[...this.selected];i.includes(e.key)&&(i=i.filter(a=>a!==e.key),i.push(...s)),i.includes(t)?i=i.filter(a=>a!==t):(i.push(t),s.every(a=>i.includes(a))&&(i=i.filter(a=>!s.includes(a)),i.push(e.key))),this._emit(i)}_clearAll(){this._emit([])}_emit(t){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.TYPE,values:t,operator:x.IS},bubbles:!0,composed:!0}))}_toggleExpand(t){const e=new Set(this._expanded);e.has(t)?e.delete(t):e.add(t),this._expanded=e}_filteredGroups(t){const e=this._search.toLowerCase().trim();return e?t.map(s=>{if(s.label.toLowerCase().includes(e)||s.key.toLowerCase().includes(e))return s;const a=s.extensions.filter(r=>r.label.toLowerCase().includes(e)||r.value.toLowerCase().includes(e));return a.length===0?null:{...s,extensions:a}}).filter(s=>s!==null):t}_toggleCategory(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this._emit(e)}updated(t){if(t.has("fileTypes")&&this.fileTypes.length>0){const e=os(this.fileTypes),s=new Set(this._expanded);for(const i of e)(this._isGroupFullySelected(i)||this._isGroupPartial(i))&&s.add(i.key);this._expanded=s}}render(){if(this.fileTypes.length===0)return this._renderFallback();const t=os(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return o.html`
440
493
  <input
441
494
  class="search-input"
442
495
  type="text"
@@ -499,7 +552,7 @@
499
552
  </div>
500
553
  `)}
501
554
  </div>
502
- `}};$e.styles=o.css`
555
+ `}};ke.styles=o.css`
503
556
  :host {
504
557
  display: block;
505
558
  }
@@ -646,7 +699,7 @@
646
699
  .option.selected ap-icon {
647
700
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
648
701
  }
649
- `;Ze([c.property({type:Array})],$e.prototype,"selected",2);Ze([c.property({type:Array})],$e.prototype,"fileTypes",2);Ze([c.state()],$e.prototype,"_search",2);Ze([c.state()],$e.prototype,"_expanded",2);$e=Ze([c.customElement("ap-filter-type")],$e);const de=o.css`
702
+ `;Je([c.property({type:Array})],ke.prototype,"selected",2);Je([c.property({type:Array})],ke.prototype,"fileTypes",2);Je([c.state()],ke.prototype,"_search",2);Je([c.state()],ke.prototype,"_expanded",2);ke=Je([c.customElement("ap-filter-type")],ke);const ue=o.css`
650
703
  :host {
651
704
  display: block;
652
705
  }
@@ -929,11 +982,11 @@
929
982
  font-size: var(--ap-font-size-sm, 0.875rem);
930
983
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
931
984
  }
932
- `;var ca=Object.defineProperty,da=Object.getOwnPropertyDescriptor,Fe=(t,e,s,i)=>{for(var a=i>1?void 0:i?da(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ca(e,s,a),a};function Lt(t){return t.toISOString().split("T")[0]}let oe=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=v.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===v.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?ps:zt}get _todayStr(){return Lt(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=hs(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
985
+ `;var ha=Object.defineProperty,ua=Object.getOwnPropertyDescriptor,Ae=(t,e,s,i)=>{for(var a=i>1?void 0:i?ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ha(e,s,a),a};function It(t){return t.toISOString().split("T")[0]}let de=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=m.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===m.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?us:jt}get _todayStr(){return It(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=gs(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
933
986
  <div class="filter-section">
934
987
  <span class="section-label">Date type</span>
935
988
  <ap-radio-group
936
- .options=${ds}
989
+ .options=${hs}
937
990
  .value=${this.field}
938
991
  @ap-change=${t=>this._selectField(t.detail.value)}
939
992
  ></ap-radio-group>
@@ -948,7 +1001,7 @@
948
1001
  @ap-change=${t=>this._selectPreset(t.detail.value)}
949
1002
  ></ap-radio-group>
950
1003
  </div>
951
- `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?Lt(new Date(this.from)):"",s=this.to?Lt(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
1004
+ `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?It(new Date(this.from)):"",s=this.to?It(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
952
1005
  <div class="filter-section date-inputs">
953
1006
  <div>
954
1007
  <span class="input-label">Date</span>
@@ -1024,14 +1077,14 @@
1024
1077
  ${this._renderRangeSection()}
1025
1078
  ${this._renderDateInputs()}
1026
1079
  </div>
1027
- `}};oe.styles=[de,o.css`
1080
+ `}};de.styles=[ue,o.css`
1028
1081
  .date-inputs {
1029
1082
  margin-top: 4px;
1030
1083
  }
1031
- `];Fe([c.property()],oe.prototype,"filterKey",2);Fe([c.property()],oe.prototype,"field",2);Fe([c.property()],oe.prototype,"kind",2);Fe([c.property()],oe.prototype,"preset",2);Fe([c.property()],oe.prototype,"from",2);Fe([c.property()],oe.prototype,"to",2);oe=Fe([c.customElement("ap-filter-date")],oe);var pa=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,Be=(t,e,s,i)=>{for(var a=i>1?void 0:i?ha(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pa(e,s,a),a};let pe=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=v.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=kt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1084
+ `];Ae([c.property()],de.prototype,"filterKey",2);Ae([c.property()],de.prototype,"field",2);Ae([c.property()],de.prototype,"kind",2);Ae([c.property()],de.prototype,"preset",2);Ae([c.property()],de.prototype,"from",2);Ae([c.property()],de.prototype,"to",2);de=Ae([c.customElement("ap-filter-date")],de);var ga=Object.defineProperty,fa=Object.getOwnPropertyDescriptor,Ue=(t,e,s,i)=>{for(var a=i>1?void 0:i?fa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ga(e,s,a),a};let ge=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=m.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=Ct}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:x.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:x.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:x.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1032
1085
  <div
1033
1086
  class="tag-item ${s?"disabled":""}"
1034
- title=${s?`You can select up to ${kt} tags`:o.nothing}
1087
+ title=${s?`You can select up to ${Ct} tags`:o.nothing}
1035
1088
  @click=${()=>!s&&this._toggle(t.sid)}
1036
1089
  >
1037
1090
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -1077,7 +1130,7 @@
1077
1130
  ${this._atLimit?o.html`
1078
1131
  <div class="info-alert">
1079
1132
  <ap-icon name="info" .size=${14}></ap-icon>
1080
- <span>You can select up to ${kt} tags.</span>
1133
+ <span>You can select up to ${Ct} tags.</span>
1081
1134
  </div>
1082
1135
  `:o.nothing}
1083
1136
  </div>
@@ -1133,7 +1186,7 @@
1133
1186
  ${t.length>0?o.html`<div class="separator"></div>`:o.nothing}
1134
1187
 
1135
1188
  <div class="hint-message">Find more tags by using search</div>
1136
- `}};pe.styles=[ee,de,o.css`
1189
+ `}};ge.styles=[re,ue,o.css`
1137
1190
  .tag-item {
1138
1191
  display: flex;
1139
1192
  align-items: center;
@@ -1217,10 +1270,10 @@
1217
1270
  max-height: none;
1218
1271
  overflow-y: visible;
1219
1272
  }
1220
- `];Be([c.property({type:Array})],pe.prototype,"tags",2);Be([c.property({type:Array})],pe.prototype,"selected",2);Be([c.property()],pe.prototype,"filterKey",2);Be([c.query(".tag-search")],pe.prototype,"_searchInput",2);Be([c.state()],pe.prototype,"_search",2);pe=Be([c.customElement("ap-filter-tags")],pe);var ua=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,Je=(t,e,s,i)=>{for(var a=i>1?void 0:i?ga(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ua(e,s,a),a};let ke=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=St}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.LABELS,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1273
+ `];Ue([c.property({type:Array})],ge.prototype,"tags",2);Ue([c.property({type:Array})],ge.prototype,"selected",2);Ue([c.property()],ge.prototype,"filterKey",2);Ue([c.query(".tag-search")],ge.prototype,"_searchInput",2);Ue([c.state()],ge.prototype,"_search",2);ge=Ue([c.customElement("ap-filter-tags")],ge);var va=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,et=(t,e,s,i)=>{for(var a=i>1?void 0:i?ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&va(e,s,a),a};let Se=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=Et}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:s,operator:x.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:e,operator:x.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:[],operator:x.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1221
1274
  <div
1222
1275
  class="label-item ${s?"disabled":""}"
1223
- title=${s?`You can select up to ${St} labels`:o.nothing}
1276
+ title=${s?`You can select up to ${Et} labels`:o.nothing}
1224
1277
  @click=${()=>!s&&this._toggle(t.sid)}
1225
1278
  >
1226
1279
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -1287,11 +1340,11 @@
1287
1340
  ${this._atLimit?o.html`
1288
1341
  <div class="info-alert">
1289
1342
  <ap-icon name="info" .size=${14}></ap-icon>
1290
- <span>You can select up to ${St} labels.</span>
1343
+ <span>You can select up to ${Et} labels.</span>
1291
1344
  </div>
1292
1345
  `:o.nothing}
1293
1346
  </div>
1294
- `}};ke.styles=[de,o.css`
1347
+ `}};Se.styles=[ue,o.css`
1295
1348
  .label-item {
1296
1349
  display: flex;
1297
1350
  align-items: center;
@@ -1340,9 +1393,9 @@
1340
1393
  flex-shrink: 0;
1341
1394
  line-height: 0;
1342
1395
  }
1343
- `];Je([c.property({type:Array})],ke.prototype,"labels",2);Je([c.property({type:Array})],ke.prototype,"selected",2);Je([c.query(".search-input")],ke.prototype,"_searchInput",2);Je([c.state()],ke.prototype,"_search",2);ke=Je([c.customElement("ap-filter-labels")],ke);var fa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,Ue=(t,e,s,i)=>{for(var a=i>1?void 0:i?ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fa(e,s,a),a};const Ot=3,Dt=/^#[0-9A-Fa-f]{6}$/;function va(t){const e=t.trim().split(/\s+/);return e.length<1||!Dt.test(e[0])?null:{hex:e[0],tolerance:e[1]||nt,coverage:e[3]||ot}}let he=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=va(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==nt||s.coverage!==ot)),this._initialized=!0)}}_selectColor(t){if(!Dt.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=Ot||(this._colors=[...this._colors,{hex:t,tolerance:nt,coverage:ot}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!Dt.test(i)||this._colors.some((n,l)=>l!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:i},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:nt,i=this._advanced?e.coverage:ot;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=Ot;return o.html`
1396
+ `];et([c.property({type:Array})],Se.prototype,"labels",2);et([c.property({type:Array})],Se.prototype,"selected",2);et([c.query(".search-input")],Se.prototype,"_searchInput",2);et([c.state()],Se.prototype,"_search",2);Se=et([c.customElement("ap-filter-labels")],Se);var ba=Object.defineProperty,_a=Object.getOwnPropertyDescriptor,Ve=(t,e,s,i)=>{for(var a=i>1?void 0:i?_a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ba(e,s,a),a};const Pt=3,Rt=/^#[0-9A-Fa-f]{6}$/;function ya(t){const e=t.trim().split(/\s+/);return e.length<1||!Rt.test(e[0])?null:{hex:e[0],tolerance:e[1]||nt,coverage:e[3]||ot}}let fe=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=ya(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==nt||s.coverage!==ot)),this._initialized=!0)}}_selectColor(t){if(!Rt.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=Pt||(this._colors=[...this._colors,{hex:t,tolerance:nt,coverage:ot}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!Rt.test(i)||this._colors.some((n,l)=>l!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:i},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:nt,i=this._advanced?e.coverage:ot;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=Pt;return o.html`
1344
1397
  <div class="palette">
1345
- ${li.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1398
+ ${pi.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1346
1399
  <button
1347
1400
  class="swatch ${i?"selected":""} ${a?"disabled":""}"
1348
1401
  style="background:${s};${s==="#ffffff"?" border: 1px solid #e4e4e7;":""}"
@@ -1371,7 +1424,7 @@
1371
1424
  <span class="adv-field-label">Difference</span>
1372
1425
  <ap-dropdown
1373
1426
  .value=${t.tolerance}
1374
- .options=${ci}
1427
+ .options=${hi}
1375
1428
  @ap-change=${s=>this._handleToleranceChange(e,s)}
1376
1429
  ></ap-dropdown>
1377
1430
  </div>
@@ -1407,7 +1460,7 @@
1407
1460
  <ap-icon name="close" .size=${14}></ap-icon>
1408
1461
  </button>
1409
1462
  </div>
1410
- `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<Ot&&!this._showPalette;return o.html`
1463
+ `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<Pt&&!this._showPalette;return o.html`
1411
1464
  <div class="filter-content">
1412
1465
  <button
1413
1466
  class="clear-btn"
@@ -1452,7 +1505,7 @@
1452
1505
  <span>Requires image processing to be enabled.</span>
1453
1506
  </div>
1454
1507
  </div>
1455
- `}};he.styles=[ee,de,o.css`
1508
+ `}};fe.styles=[re,ue,o.css`
1456
1509
  /* ── Palette ── */
1457
1510
  .palette {
1458
1511
  display: grid;
@@ -1689,7 +1742,7 @@
1689
1742
  .add-color-btn:hover {
1690
1743
  opacity: 0.8;
1691
1744
  }
1692
- `];Ue([c.property({type:Array})],he.prototype,"values",2);Ue([c.state()],he.prototype,"_colors",2);Ue([c.state()],he.prototype,"_advanced",2);Ue([c.state()],he.prototype,"_showPalette",2);Ue([c.state()],he.prototype,"_initialized",2);he=Ue([c.customElement("ap-filter-color")],he);var ba=Object.defineProperty,_a=Object.getOwnPropertyDescriptor,Ae=(t,e,s,i)=>{for(var a=i>1?void 0:i?_a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ba(e,s,a),a};const ya={KB:1/1e3,MB:1,GB:1e3},xa=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let ne=class extends o.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=ya[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.SIZE,values:[],operator:y.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.SIZE,values:[i],operator:y.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return o.html`
1745
+ `];Ve([c.property({type:Array})],fe.prototype,"values",2);Ve([c.state()],fe.prototype,"_colors",2);Ve([c.state()],fe.prototype,"_advanced",2);Ve([c.state()],fe.prototype,"_showPalette",2);Ve([c.state()],fe.prototype,"_initialized",2);fe=Ve([c.customElement("ap-filter-color")],fe);var xa=Object.defineProperty,wa=Object.getOwnPropertyDescriptor,Te=(t,e,s,i)=>{for(var a=i>1?void 0:i?wa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xa(e,s,a),a};const $a={KB:1/1e3,MB:1,GB:1e3},ka=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let pe=class extends o.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=$a[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[],operator:x.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[i],operator:x.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return o.html`
1693
1746
  <div class="filter-content">
1694
1747
  <span class="section-label">Size</span>
1695
1748
  <button
@@ -1726,14 +1779,14 @@
1726
1779
  <div>
1727
1780
  <span class="input-label">Unit</span>
1728
1781
  <ap-dropdown
1729
- .options=${xa}
1782
+ .options=${ka}
1730
1783
  .value=${this._unit}
1731
1784
  @ap-change=${this._setUnit}
1732
1785
  ></ap-dropdown>
1733
1786
  </div>
1734
1787
  </div>
1735
1788
  </div>
1736
- `}};ne.styles=[de,o.css`
1789
+ `}};pe.styles=[ue,o.css`
1737
1790
  /* Hide number input spinners */
1738
1791
  .filter-input[type='number']::-webkit-inner-spin-button,
1739
1792
  .filter-input[type='number']::-webkit-outer-spin-button {
@@ -1752,19 +1805,19 @@
1752
1805
  display: block;
1753
1806
  width: 100%;
1754
1807
  }
1755
- `];Ae([c.property({type:Number})],ne.prototype,"min",2);Ae([c.property({type:Number})],ne.prototype,"max",2);Ae([c.state()],ne.prototype,"_minVal",2);Ae([c.state()],ne.prototype,"_maxVal",2);Ae([c.state()],ne.prototype,"_unit",2);Ae([c.state()],ne.prototype,"_initialized",2);ne=Ae([c.customElement("ap-filter-size")],ne);var wa=Object.defineProperty,$a=Object.getOwnPropertyDescriptor,_t=(t,e,s,i)=>{for(var a=i>1?void 0:i?$a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&wa(e,s,a),a};const ka=o.svg`
1808
+ `];Te([c.property({type:Number})],pe.prototype,"min",2);Te([c.property({type:Number})],pe.prototype,"max",2);Te([c.state()],pe.prototype,"_minVal",2);Te([c.state()],pe.prototype,"_maxVal",2);Te([c.state()],pe.prototype,"_unit",2);Te([c.state()],pe.prototype,"_initialized",2);pe=Te([c.customElement("ap-filter-size")],pe);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,_t=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ca(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sa(e,s,a),a};const Ea=o.svg`
1756
1809
  <svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1757
1810
  <path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
1758
1811
  <path d="M5.33332 4.65885C5.33332 4.29066 5.6318 3.99219 5.99999 3.99219C6.36818 3.99219 6.66666 4.29066 6.66666 4.65885L6.66666 4.66536C6.66666 5.03355 6.36818 5.33203 5.99999 5.33203C5.6318 5.33203 5.33332 5.03355 5.33332 4.66536L5.33332 4.65885Z" fill="#9747FF"/>
1759
1812
  <path d="M5.33332 11.3255C5.33332 10.9573 5.6318 10.6589 5.99999 10.6589C6.36818 10.6589 6.66666 10.9573 6.66666 11.3255L6.66666 11.332C6.66666 11.7002 6.36818 11.9987 5.99999 11.9987C5.6318 11.9987 5.33332 11.7002 5.33332 11.332L5.33332 11.3255Z" fill="#9747FF"/>
1760
1813
  </svg>
1761
- `,Sa=o.svg`
1814
+ `,Fa=o.svg`
1762
1815
  <svg width="20" height="20" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1763
1816
  <path d="M14 2.66797C14 2.29978 13.7015 2.0013 13.3333 2.0013H2.66666C2.29847 2.0013 1.99999 2.29978 1.99999 2.66797V9.33463C1.99999 9.70282 2.29847 10.0013 2.66666 10.0013H13.3333C13.7015 10.0013 14 9.70282 14 9.33463V2.66797ZM15.3333 9.33463C15.3333 10.4392 14.4379 11.3346 13.3333 11.3346H2.66666C1.56209 11.3346 0.666656 10.4392 0.666656 9.33463V2.66797C0.666656 1.5634 1.56209 0.667969 2.66666 0.667969H13.3333C14.4379 0.667969 15.3333 1.5634 15.3333 2.66797V9.33463Z" fill="#65A30D"/>
1764
1817
  <path d="M11.3398 5.33464C11.708 5.33464 12.0065 5.63311 12.0065 6.0013C12.0065 6.36949 11.708 6.66797 11.3398 6.66797H11.3333C10.9651 6.66797 10.6667 6.36949 10.6667 6.0013C10.6667 5.63311 10.9651 5.33464 11.3333 5.33464H11.3398Z" fill="#65A30D"/>
1765
1818
  <path d="M4.67317 5.33464C5.04136 5.33464 5.33983 5.63311 5.33983 6.0013C5.33983 6.36949 5.04136 6.66797 4.67317 6.66797H4.66666C4.29847 6.66797 3.99999 6.36949 3.99999 6.0013C3.99999 5.63311 4.29847 5.33464 4.66666 5.33464H4.67317Z" fill="#65A30D"/>
1766
1819
  </svg>
1767
- `,Ca=o.svg`
1820
+ `,Aa=o.svg`
1768
1821
  <svg width="20" height="20" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1769
1822
  <path d="M12.3333 2.33203C12.3333 1.96384 12.0349 1.66536 11.6667 1.66536H2.33334C1.96515 1.66536 1.66668 1.96384 1.66668 2.33203V11.6654C1.66668 12.0336 1.96515 12.332 2.33334 12.332H11.6667C12.0349 12.332 12.3333 12.0336 12.3333 11.6654V2.33203ZM13.6667 11.6654C13.6667 12.7699 12.7712 13.6654 11.6667 13.6654H2.33334C1.22877 13.6654 0.333344 12.7699 0.333344 11.6654V2.33203C0.333344 1.22746 1.22877 0.332031 2.33334 0.332031H11.6667C12.7712 0.332031 13.6667 1.22746 13.6667 2.33203V11.6654Z" fill="#6366F1"/>
1770
1823
  <path d="M9.67319 3.66536C10.0414 3.66536 10.3399 3.96384 10.3399 4.33203C10.3399 4.70022 10.0414 4.9987 9.67319 4.9987H9.66668C9.29849 4.9987 9.00001 4.70022 9.00001 4.33203C9.00001 3.96384 9.29849 3.66536 9.66668 3.66536H9.67319Z" fill="#6366F1"/>
@@ -1772,13 +1825,13 @@
1772
1825
  <path d="M4.33985 8.9987C4.70804 8.9987 5.00652 9.29718 5.00652 9.66537C5.00652 10.0336 4.70804 10.332 4.33985 10.332H4.33334C3.96515 10.332 3.66668 10.0336 3.66668 9.66537C3.66668 9.29718 3.96515 8.9987 4.33334 8.9987H4.33985Z" fill="#6366F1"/>
1773
1826
  <path d="M9.67319 8.9987C10.0414 8.9987 10.3399 9.29718 10.3399 9.66537C10.3399 10.0336 10.0414 10.332 9.67319 10.332H9.66668C9.29849 10.332 9.00001 10.0336 9.00001 9.66537C9.00001 9.29718 9.29849 8.9987 9.66668 8.9987H9.67319Z" fill="#6366F1"/>
1774
1827
  </svg>
1775
- `,Ea=o.svg`
1828
+ `,Ta=o.svg`
1776
1829
  <svg width="20" height="20" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
1777
1830
  <path d="M14 2.33203C14 1.96384 13.7015 1.66536 13.3333 1.66536H2.66666C2.29847 1.66536 1.99999 1.96384 1.99999 2.33203V5.66536C1.99999 6.03355 2.29847 6.33203 2.66666 6.33203H13.3333C13.7015 6.33203 14 6.03355 14 5.66536V2.33203ZM15.3333 5.66536C15.3333 6.76993 14.4379 7.66536 13.3333 7.66536H2.66666C1.56209 7.66536 0.666656 6.76993 0.666656 5.66536V2.33203C0.666656 1.22746 1.56209 0.332031 2.66666 0.332031H13.3333C14.4379 0.332031 15.3333 1.22746 15.3333 2.33203V5.66536Z" fill="#4BA3AD"/>
1778
1831
  <path d="M11.3398 3.33203C11.708 3.33203 12.0065 3.63051 12.0065 3.9987C12.0065 4.36689 11.708 4.66536 11.3398 4.66536H11.3333C10.9651 4.66536 10.6667 4.36689 10.6667 3.9987C10.6667 3.63051 10.9651 3.33203 11.3333 3.33203H11.3398Z" fill="#4BA3AD"/>
1779
1832
  <path d="M4.67317 3.33203C5.04136 3.33203 5.33983 3.63051 5.33983 3.9987C5.33983 4.36689 5.04136 4.66536 4.67317 4.66536H4.66666C4.29847 4.66536 3.99999 4.36689 3.99999 3.9987C3.99999 3.63051 4.29847 3.33203 4.66666 3.33203H4.67317Z" fill="#4BA3AD"/>
1780
1833
  </svg>
1781
- `,Fa={portrait:ka,landscape:Sa,square:Ca,panorama:Ea};let Ie=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1834
+ `,Ma={portrait:Ea,landscape:Fa,square:Aa,panorama:Ta};let De=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1782
1835
  <div class="filter-content">
1783
1836
  <button
1784
1837
  class="clear-btn"
@@ -1789,7 +1842,7 @@
1789
1842
  <div class="filter-section">
1790
1843
  <span class="section-label">Resolution</span>
1791
1844
  <div class="options-horizontal">
1792
- ${ai.map(t=>o.html`
1845
+ ${ni.map(t=>o.html`
1793
1846
  <ap-checkbox
1794
1847
  ?checked=${this.selectedResolution.includes(t.value)}
1795
1848
  @ap-toggle=${()=>{this._toggleResolution(t.value)}}
@@ -1801,11 +1854,11 @@
1801
1854
  <div class="filter-section">
1802
1855
  <span class="section-label">Orientation</span>
1803
1856
  <div class="options-vertical">
1804
- ${ri.map(t=>o.html`
1857
+ ${li.map(t=>o.html`
1805
1858
  <ap-checkbox
1806
1859
  ?checked=${this.selectedOrientation.includes(t.value)}
1807
1860
  @ap-toggle=${()=>{this._toggleOrientation(t.value)}}
1808
- ><span class="orientation-label">${Fa[t.value]}${t.label}</span></ap-checkbox>
1861
+ ><span class="orientation-label">${Ma[t.value]}${t.label}</span></ap-checkbox>
1809
1862
  `)}
1810
1863
  </div>
1811
1864
  </div>
@@ -1813,7 +1866,7 @@
1813
1866
  <div class="filter-section">
1814
1867
  <span class="section-label">Faces</span>
1815
1868
  <div class="options-horizontal">
1816
- ${oi.map(t=>o.html`
1869
+ ${ci.map(t=>o.html`
1817
1870
  <ap-checkbox
1818
1871
  ?checked=${this.selectedFaces.includes(t.value)}
1819
1872
  @ap-toggle=${()=>{this._toggleFaces(t.value)}}
@@ -1827,7 +1880,7 @@
1827
1880
  <span>Some images might not have been processed, so they won't be displayed.</span>
1828
1881
  </div>
1829
1882
  </div>
1830
- `}};Ie.styles=[de,o.css`
1883
+ `}};De.styles=[ue,o.css`
1831
1884
  .options-horizontal {
1832
1885
  display: flex;
1833
1886
  gap: 28px;
@@ -1848,7 +1901,7 @@
1848
1901
  .orientation-label svg {
1849
1902
  flex-shrink: 0;
1850
1903
  }
1851
- `];_t([c.property({type:Array})],Ie.prototype,"selectedResolution",2);_t([c.property({type:Array})],Ie.prototype,"selectedOrientation",2);_t([c.property({type:Array})],Ie.prototype,"selectedFaces",2);Ie=_t([c.customElement("ap-filter-image")],Ie);var Aa=Object.defineProperty,Ta=Object.getOwnPropertyDescriptor,L=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ta(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Aa(e,s,a),a};function w(t){return`${vt[t.type]||""}${t.key}`}let M=class extends o.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=at}_getField(t){return this.fields.find(e=>w(e)===t)}_getUIType(t){return ui[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===V||t[0]===q}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===V?V:((i=e.values)==null?void 0:i[0])===q?q:this._specificModeFields.has(t)||e.values&&e.values.length>0?_e:""}_emitFilterChange(t,e,s){const i=w(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=w(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=w(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=w(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(w(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=w(t);if(e===_e){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=w(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...l}=this._dateTos;this._dateTos=l;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(w(t)).operator||Et[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=w(t),r=this._getApplied(a),n=r.operator||At[0].value,l=[...r.values||[]];s===0?l[0]=i:l[1]=i;const d=l.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===b.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,l)}_onBooleanSelect(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||re[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||Ft[0].value,r=i.values||[],n=r.includes(e)?r.filter(l=>l!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=w(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||re[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(r=>r.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||re[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||re[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=w(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=w(t);if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=i.toISOString();break}case"last_week":{const n=new Date(i),l=n.getDay();n.setDate(n.getDate()-(l===0?6:l-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),l=new Date(n);l.setMonth(l.getMonth()-1),a=l.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),l=new Date(n);l.setFullYear(l.getFullYear()-1),a=l.toISOString(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=w(t),r=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let l=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&l&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(l=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:l}),l&&d&&this._emitFilterChange(t,"..",[l,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=w(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[l,d]=n;let u=`${l},${d}..${r||"0"}`;this._emitFilterChange(t,y.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=w(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let l=n;s&&(l+=`..${s}`),this._emitFilterChange(t,y.IS,[l])}_onEmptyOption(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
1904
+ `];_t([c.property({type:Array})],De.prototype,"selectedResolution",2);_t([c.property({type:Array})],De.prototype,"selectedOrientation",2);_t([c.property({type:Array})],De.prototype,"selectedFaces",2);De=_t([c.customElement("ap-filter-image")],De);var La=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&La(e,s,a),a};function w(t){return`${mt[t.type]||""}${t.key}`}let A=class extends o.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=at}_getField(t){return this.fields.find(e=>w(e)===t)}_getUIType(t){return vi[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===Q||t[0]===X}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===Q?Q:((i=e.values)==null?void 0:i[0])===X?X:this._specificModeFields.has(t)||e.values&&e.values.length>0?ye:""}_emitFilterChange(t,e,s){const i=w(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=w(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=w(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=w(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(w(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=w(t);if(e===ye){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=w(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...l}=this._dateTos;this._dateTos=l;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(w(t)).operator||At[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=w(t),r=this._getApplied(a),n=r.operator||Mt[0].value,l=[...r.values||[]];s===0?l[0]=i:l[1]=i;const d=l.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===b.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,l)}_onBooleanSelect(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||ce[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||Tt[0].value,r=i.values||[],n=r.includes(e)?r.filter(l=>l!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=w(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||ce[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(r=>r.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||ce[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||ce[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=w(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=w(t);if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=i.toISOString();break}case"last_week":{const n=new Date(i),l=n.getDay();n.setDate(n.getDate()-(l===0?6:l-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),l=new Date(n);l.setMonth(l.getMonth()-1),a=l.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),l=new Date(n);l.setFullYear(l.getFullYear()-1),a=l.toISOString(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=w(t),r=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let l=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&l&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(l=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:l}),l&&d&&this._emitFilterChange(t,"..",[l,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=w(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[l,d]=n;let u=`${l},${d}..${r||"0"}`;this._emitFilterChange(t,x.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=w(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let l=n;s&&(l+=`..${s}`),this._emitFilterChange(t,x.IS,[l])}_onEmptyOption(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
1852
1905
  <div class="field-group-label">${a}</div>
1853
1906
  ${r.map(n=>{const l=w(n),d=this.visibleFields.includes(l),h=!d&&this._atFieldLimit;return o.html`
1854
1907
  <div
@@ -1884,7 +1937,7 @@
1884
1937
  ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
1885
1938
  </div>
1886
1939
  </div>
1887
- `}_renderTextFilter(t){var h,u;const e=w(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===V||r===q,l=s.operator||Et[0].value,d=t.type===b.TEXT_AREA;return o.html`
1940
+ `}_renderTextFilter(t){var h,u;const e=w(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===Q||r===X,l=s.operator||At[0].value,d=t.type===b.TEXT_AREA;return o.html`
1888
1941
  <div class="filter-content" style="position: relative;">
1889
1942
  <button
1890
1943
  class="clear-btn"
@@ -1896,7 +1949,7 @@
1896
1949
  <span class="section-label">Operator</span>
1897
1950
  <ap-radio-group
1898
1951
  direction="horizontal"
1899
- .options=${Et}
1952
+ .options=${At}
1900
1953
  .value=${l}
1901
1954
  ?disabled=${n}
1902
1955
  @ap-change=${f=>this._onOperatorChange(t,f.detail.value)}
@@ -1906,13 +1959,13 @@
1906
1959
  <div class="filter-section">
1907
1960
  <span class="section-label">Content</span>
1908
1961
  <ap-radio-group
1909
- .options=${Tt}
1962
+ .options=${Lt}
1910
1963
  .value=${r}
1911
1964
  @ap-change=${f=>this._onContentModeChange(t,f.detail.value)}
1912
1965
  ></ap-radio-group>
1913
1966
  </div>
1914
1967
 
1915
- ${r===_e?o.html`
1968
+ ${r===ye?o.html`
1916
1969
  <div class="filter-section">
1917
1970
  <span class="section-label">Value</span>
1918
1971
  ${d?o.html`
@@ -1935,7 +1988,7 @@
1935
1988
  </div>
1936
1989
  `:o.nothing}
1937
1990
  </div>
1938
- `}_renderNumberFilter(t){var k,A,O;const e=w(t),s=this._getApplied(e),i=s.operator||At[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===V||r===q,l=i===y.RANGE,d=i===y.GREATER_THAN_OR_EQUAL,h=i===y.LESS_THAN_OR_EQUAL,u=t.type===b.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((k=s.values)==null?void 0:k[0])||"",m=a?"":((A=s.values)==null?void 0:A[1])||"",_=l||d||h,x=l||d||h?"Min":"Value";return o.html`
1991
+ `}_renderNumberFilter(t){var k,T,O;const e=w(t),s=this._getApplied(e),i=s.operator||Mt[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===Q||r===X,l=i===x.RANGE,d=i===x.GREATER_THAN_OR_EQUAL,h=i===x.LESS_THAN_OR_EQUAL,u=t.type===b.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((k=s.values)==null?void 0:k[0])||"",v=a?"":((T=s.values)==null?void 0:T[1])||"",_=l||d||h,y=l||d||h?"Min":"Value";return o.html`
1939
1992
  <div class="filter-content" style="position: relative;">
1940
1993
  <button
1941
1994
  class="clear-btn"
@@ -1947,7 +2000,7 @@
1947
2000
  <span class="section-label">Condition</span>
1948
2001
  <ap-radio-group
1949
2002
  columns="2"
1950
- .options=${At}
2003
+ .options=${Mt}
1951
2004
  .value=${i}
1952
2005
  ?disabled=${n}
1953
2006
  @ap-change=${S=>this._onOperatorChange(t,S.detail.value)}
@@ -1957,17 +2010,17 @@
1957
2010
  <div class="filter-section">
1958
2011
  <span class="section-label">Content</span>
1959
2012
  <ap-radio-group
1960
- .options=${Tt}
2013
+ .options=${Lt}
1961
2014
  .value=${r}
1962
2015
  @ap-change=${S=>this._onContentModeChange(t,S.detail.value)}
1963
2016
  ></ap-radio-group>
1964
2017
  </div>
1965
2018
 
1966
- ${r===_e?o.html`
2019
+ ${r===ye?o.html`
1967
2020
  <div class="filter-section">
1968
2021
  <div class="grid-2">
1969
2022
  <div>
1970
- <span class="input-label" aria-disabled=${h?"true":o.nothing}>${x}</span>
2023
+ <span class="input-label" aria-disabled=${h?"true":o.nothing}>${y}</span>
1971
2024
  <input
1972
2025
  class="filter-input"
1973
2026
  type="number"
@@ -1986,7 +2039,7 @@
1986
2039
  type="number"
1987
2040
  step=${f}
1988
2041
  placeholder=${p}
1989
- .value=${m}
2042
+ .value=${v}
1990
2043
  ?disabled=${d}
1991
2044
  @change=${S=>this._onNumberInput(t,S,1)}
1992
2045
  />
@@ -2007,13 +2060,13 @@
2007
2060
  <div class="filter-section">
2008
2061
  <span class="section-label">Value</span>
2009
2062
  <ap-radio-group
2010
- .options=${hi}
2063
+ .options=${fi}
2011
2064
  .value=${s}
2012
2065
  @ap-change=${r=>this._onBooleanSelect(t,r.detail.value)}
2013
2066
  ></ap-radio-group>
2014
2067
  </div>
2015
2068
  </div>
2016
- `}_renderSelectOneFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||re[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=at;return o.html`
2069
+ `}_renderSelectOneFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||ce[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=at;return o.html`
2017
2070
  <div class="filter-content">
2018
2071
  <!-- Search input -->
2019
2072
  <div class="search-wrapper">
@@ -2054,7 +2107,7 @@
2054
2107
  </div>
2055
2108
  <ap-radio-group
2056
2109
  direction="horizontal"
2057
- .options=${re}
2110
+ .options=${ce}
2058
2111
  .value=${n}
2059
2112
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2060
2113
  ></ap-radio-group>
@@ -2064,7 +2117,7 @@
2064
2117
  ${a.length>0?o.html`
2065
2118
  <div class="filter-section">
2066
2119
  <div class="chips-wrap">
2067
- ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
2120
+ ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
2068
2121
  <div class="chip">
2069
2122
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
2070
2123
  <button class="chip-remove" @click=${()=>this._onSelectOneToggle(t,p)}>
@@ -2083,7 +2136,7 @@
2083
2136
 
2084
2137
  <!-- Empty/Not empty checkboxes -->
2085
2138
  <div class="options-list short">
2086
- ${xe.map(p=>{var g;return o.html`
2139
+ ${we.map(p=>{var g;return o.html`
2087
2140
  <div
2088
2141
  class="option-item"
2089
2142
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2098,10 +2151,10 @@
2098
2151
 
2099
2152
  <!-- Regular options -->
2100
2153
  <div class="options-list">
2101
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return o.html`
2154
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
2102
2155
  <div
2103
- class="option-item ${m?"disabled":""}"
2104
- @click=${()=>!m&&this._onSelectOneToggle(t,p.api_value)}
2156
+ class="option-item ${v?"disabled":""}"
2157
+ @click=${()=>!v&&this._onSelectOneToggle(t,p.api_value)}
2105
2158
  >
2106
2159
  <ap-checkbox ?checked=${g}></ap-checkbox>
2107
2160
  <span>${p.label}</span>
@@ -2110,7 +2163,7 @@
2110
2163
  </div>
2111
2164
  </div>
2112
2165
  </div>
2113
- `}_renderMultiSelectFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||Ft[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=at;return o.html`
2166
+ `}_renderMultiSelectFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||Tt[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=at;return o.html`
2114
2167
  <div class="filter-content">
2115
2168
  <!-- Search input -->
2116
2169
  <div class="search-wrapper">
@@ -2151,7 +2204,7 @@
2151
2204
  </div>
2152
2205
  <ap-radio-group
2153
2206
  direction="horizontal"
2154
- .options=${Ft}
2207
+ .options=${Tt}
2155
2208
  .value=${n}
2156
2209
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2157
2210
  ></ap-radio-group>
@@ -2161,7 +2214,7 @@
2161
2214
  ${a.length>0?o.html`
2162
2215
  <div class="filter-section">
2163
2216
  <div class="chips-wrap">
2164
- ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
2217
+ ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
2165
2218
  <div class="chip">
2166
2219
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
2167
2220
  <button class="chip-remove" @click=${()=>this._onMultiSelectToggle(t,p)}>
@@ -2180,7 +2233,7 @@
2180
2233
 
2181
2234
  <!-- Empty/Not empty checkboxes -->
2182
2235
  <div class="options-list short">
2183
- ${xe.map(p=>{var g;return o.html`
2236
+ ${we.map(p=>{var g;return o.html`
2184
2237
  <div
2185
2238
  class="option-item"
2186
2239
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2195,10 +2248,10 @@
2195
2248
 
2196
2249
  <!-- Regular options -->
2197
2250
  <div class="options-list">
2198
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return o.html`
2251
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
2199
2252
  <div
2200
- class="option-item ${m?"disabled":""}"
2201
- @click=${()=>!m&&this._onMultiSelectToggle(t,p.api_value)}
2253
+ class="option-item ${v?"disabled":""}"
2254
+ @click=${()=>!v&&this._onMultiSelectToggle(t,p.api_value)}
2202
2255
  >
2203
2256
  <ap-checkbox ?checked=${g}></ap-checkbox>
2204
2257
  <span>${p.label}</span>
@@ -2207,7 +2260,7 @@
2207
2260
  </div>
2208
2261
  </div>
2209
2262
  </div>
2210
- `}_renderTagsFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||re[0].value,l=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=at;return o.html`
2263
+ `}_renderTagsFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||ce[0].value,l=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=at;return o.html`
2211
2264
  <div class="filter-content">
2212
2265
  <!-- Search input -->
2213
2266
  <div class="search-wrapper">
@@ -2249,7 +2302,7 @@
2249
2302
  </div>
2250
2303
  <ap-radio-group
2251
2304
  direction="horizontal"
2252
- .options=${re}
2305
+ .options=${ce}
2253
2306
  .value=${n}
2254
2307
  ?disabled=${i}
2255
2308
  @ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
@@ -2276,7 +2329,7 @@
2276
2329
  <div class="filter-section">
2277
2330
  <span class="section-label">All options</span>
2278
2331
  <div class="options-list short">
2279
- ${xe.map(p=>{var g;return o.html`
2332
+ ${we.map(p=>{var g;return o.html`
2280
2333
  <div
2281
2334
  class="option-item"
2282
2335
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2293,10 +2346,10 @@
2293
2346
  ${u?o.html`
2294
2347
  <div class="filter-section">
2295
2348
  <div class="options-list">
2296
- ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),m=!g&&f;return o.html`
2349
+ ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),v=!g&&f;return o.html`
2297
2350
  <div
2298
- class="option-item ${m?"disabled":""}"
2299
- @click=${()=>!m&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2351
+ class="option-item ${v?"disabled":""}"
2352
+ @click=${()=>!v&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2300
2353
  >
2301
2354
  <ap-checkbox ?checked=${g}></ap-checkbox>
2302
2355
  <span>${p}</span>
@@ -2325,7 +2378,7 @@
2325
2378
 
2326
2379
  <ap-radio-group
2327
2380
  columns="2"
2328
- .options=${zt}
2381
+ .options=${jt}
2329
2382
  .value=${r!=="empty"&&r!=="non-empty"?r:""}
2330
2383
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2331
2384
  ></ap-radio-group>
@@ -2378,7 +2431,7 @@
2378
2431
  </div>
2379
2432
  `:o.nothing}
2380
2433
  </div>
2381
- `}_renderGeoFilter(t){var u,f;const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,m]=p.split("..");r=g||"",n=m||""}const l=r.length>0,d=r.split(",").map(p=>p.trim()),h=!l||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2434
+ `}_renderGeoFilter(t){var u,f;const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const l=r.length>0,d=r.split(",").map(p=>p.trim()),h=!l||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2382
2435
  <div class="filter-content" style="position: relative;">
2383
2436
  <button
2384
2437
  class="clear-btn"
@@ -2389,13 +2442,13 @@
2389
2442
  <div class="filter-section">
2390
2443
  <span class="section-label">Content</span>
2391
2444
  <ap-radio-group
2392
- .options=${Tt}
2445
+ .options=${Lt}
2393
2446
  .value=${a}
2394
2447
  @ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
2395
2448
  ></ap-radio-group>
2396
2449
  </div>
2397
2450
 
2398
- ${a===_e?o.html`
2451
+ ${a===ye?o.html`
2399
2452
  <div class="filter-section">
2400
2453
  <div class="geo-row">
2401
2454
  <div class="geo-location">
@@ -2434,13 +2487,13 @@
2434
2487
 
2435
2488
  <div class="filter-section">
2436
2489
  <ap-radio-group
2437
- .options=${xe}
2490
+ .options=${we}
2438
2491
  .value=${s}
2439
2492
  @ap-change=${r=>this._onEmptyOption(t,r.detail.value)}
2440
2493
  ></ap-radio-group>
2441
2494
  </div>
2442
2495
  </div>
2443
- `}_renderFaceMatcherFilter(t){const e=w(t),s=this._getApplied(e),i=s.values||[],a=s.operator||y.IS;return o.html`
2496
+ `}_renderFaceMatcherFilter(t){const e=w(t),s=this._getApplied(e),i=s.values||[],a=s.operator||x.IS;return o.html`
2444
2497
  <div class="filter-content" style="position: relative;">
2445
2498
  <button
2446
2499
  class="clear-btn"
@@ -2452,7 +2505,7 @@
2452
2505
  <span class="section-label">Condition</span>
2453
2506
  <ap-radio-group
2454
2507
  direction="horizontal"
2455
- .options=${re}
2508
+ .options=${ce}
2456
2509
  .value=${a}
2457
2510
  @ap-change=${r=>this._emitFilterChange(t,r.detail.value,i)}
2458
2511
  ></ap-radio-group>
@@ -2548,7 +2601,7 @@
2548
2601
  </button>
2549
2602
  `:o.nothing}
2550
2603
  `:o.nothing}
2551
- `}};M.styles=[ee,de,o.css`
2604
+ `}};A.styles=[re,ue,o.css`
2552
2605
  /* ── Field selection panel ─────────────────────────────── */
2553
2606
 
2554
2607
  .add-field-btn {
@@ -2925,7 +2978,7 @@
2925
2978
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
2926
2979
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
2927
2980
  }
2928
- `];L([c.property({type:Array})],M.prototype,"fields",2);L([c.property({type:Object})],M.prototype,"appliedFilters",2);L([c.property({type:Array})],M.prototype,"visibleFields",2);L([c.property()],M.prototype,"mode",2);L([c.property()],M.prototype,"activeFieldKey",2);L([c.property({type:Array})],M.prototype,"pinnedFields",2);L([c.property({type:Object})],M.prototype,"appliedMetadata",2);L([c.property({attribute:!1})],M.prototype,"apiClient",2);L([c.state()],M.prototype,"_showFieldSelection",2);L([c.state()],M.prototype,"_fieldSearch",2);L([c.state()],M.prototype,"_collapsedFields",2);L([c.state()],M.prototype,"_tagInputs",2);L([c.state()],M.prototype,"_tagSuggestions",2);L([c.state()],M.prototype,"_tagLoading",2);L([c.state()],M.prototype,"_datePresets",2);L([c.state()],M.prototype,"_dateFroms",2);L([c.state()],M.prototype,"_dateTos",2);L([c.state()],M.prototype,"_specificModeFields",2);L([c.state()],M.prototype,"_selectSearches",2);M=L([c.customElement("ap-filter-metadata")],M);var Ma=Object.defineProperty,La=Object.getOwnPropertyDescriptor,te=(t,e,s,i)=>{for(var a=i>1?void 0:i?La(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ma(e,s,a),a};let H=class extends o.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(V)||this.selectedStatus.includes(q)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===V||t===q)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(R.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(R.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(R.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(R.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(R.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(R.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(R.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(R.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(R.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(R.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return o.html`
2981
+ `];M([c.property({type:Array})],A.prototype,"fields",2);M([c.property({type:Object})],A.prototype,"appliedFilters",2);M([c.property({type:Array})],A.prototype,"visibleFields",2);M([c.property()],A.prototype,"mode",2);M([c.property()],A.prototype,"activeFieldKey",2);M([c.property({type:Array})],A.prototype,"pinnedFields",2);M([c.property({type:Object})],A.prototype,"appliedMetadata",2);M([c.property({attribute:!1})],A.prototype,"apiClient",2);M([c.state()],A.prototype,"_showFieldSelection",2);M([c.state()],A.prototype,"_fieldSearch",2);M([c.state()],A.prototype,"_collapsedFields",2);M([c.state()],A.prototype,"_tagInputs",2);M([c.state()],A.prototype,"_tagSuggestions",2);M([c.state()],A.prototype,"_tagLoading",2);M([c.state()],A.prototype,"_datePresets",2);M([c.state()],A.prototype,"_dateFroms",2);M([c.state()],A.prototype,"_dateTos",2);M([c.state()],A.prototype,"_specificModeFields",2);M([c.state()],A.prototype,"_selectSearches",2);A=M([c.customElement("ap-filter-metadata")],A);var Ia=Object.defineProperty,Pa=Object.getOwnPropertyDescriptor,oe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Pa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ia(e,s,a),a};let W=class extends o.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(Q)||this.selectedStatus.includes(X)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===Q||t===X)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(B.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(B.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(B.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(B.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(B.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(B.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(B.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(B.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(B.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(B.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:B.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:B.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return o.html`
2929
2982
  <div class="filter-section">
2930
2983
  <button
2931
2984
  class="clear-btn"
@@ -2939,7 +2992,7 @@
2939
2992
  <span class="section-label condition-label">Condition</span>
2940
2993
  <ap-radio-group
2941
2994
  direction="horizontal"
2942
- .options=${di}
2995
+ .options=${ui}
2943
2996
  .value=${this.statusOperator}
2944
2997
  ?disabled=${this._statusHasOnlyEmptyValues}
2945
2998
  @ap-change=${this._handleStatusOperator}
@@ -2947,7 +3000,7 @@
2947
3000
 
2948
3001
  <!-- Empty / Not empty checkboxes -->
2949
3002
  <div class="options-list short mt-12">
2950
- ${xe.map(e=>o.html`
3003
+ ${we.map(e=>o.html`
2951
3004
  <ap-checkbox
2952
3005
  ?checked=${this.selectedStatus.includes(e.value)}
2953
3006
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -2959,7 +3012,7 @@
2959
3012
 
2960
3013
  <!-- Status options -->
2961
3014
  <div class="options-list short">
2962
- ${pi.map(e=>o.html`
3015
+ ${gi.map(e=>o.html`
2963
3016
  <ap-checkbox
2964
3017
  ?checked=${this.selectedStatus.includes(e.value)}
2965
3018
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -2986,7 +3039,7 @@
2986
3039
  <span class="section-label condition-label">Condition</span>
2987
3040
  <ap-radio-group
2988
3041
  direction="horizontal"
2989
- .options=${Jt}
3042
+ .options=${ts}
2990
3043
  .value=${this.approverOperator}
2991
3044
  @ap-change=${this._handleApproverOperator}
2992
3045
  ></ap-radio-group>
@@ -3013,7 +3066,7 @@
3013
3066
  <span class="section-label condition-label">Condition</span>
3014
3067
  <ap-radio-group
3015
3068
  direction="horizontal"
3016
- .options=${Jt}
3069
+ .options=${ts}
3017
3070
  .value=${this.requesterOperator}
3018
3071
  @ap-change=${this._handleRequesterOperator}
3019
3072
  ></ap-radio-group>
@@ -3038,8 +3091,8 @@
3038
3091
 
3039
3092
  <!-- Empty / Not empty radio buttons -->
3040
3093
  <ap-radio-group
3041
- .options=${xe}
3042
- .value=${this.dueDatePreset===V||this.dueDatePreset===q?this.dueDatePreset:""}
3094
+ .options=${we}
3095
+ .value=${this.dueDatePreset===Q||this.dueDatePreset===X?this.dueDatePreset:""}
3043
3096
  @ap-change=${this._handleDueDatePreset}
3044
3097
  ></ap-radio-group>
3045
3098
 
@@ -3048,8 +3101,8 @@
3048
3101
  <!-- Date range options -->
3049
3102
  <ap-radio-group
3050
3103
  columns="2"
3051
- .options=${ni}
3052
- .value=${this.dueDatePreset!==V&&this.dueDatePreset!==q?this.dueDatePreset:""}
3104
+ .options=${di}
3105
+ .value=${this.dueDatePreset!==Q&&this.dueDatePreset!==X?this.dueDatePreset:""}
3053
3106
  @ap-change=${this._handleDueDatePreset}
3054
3107
  ></ap-radio-group>
3055
3108
 
@@ -3091,7 +3144,7 @@
3091
3144
  <div class="separator"></div>
3092
3145
  ${this._renderDueDateSection()}
3093
3146
  </div>
3094
- `}};H.styles=[ee,de,o.css`
3147
+ `}};W.styles=[re,ue,o.css`
3095
3148
  .options-list.short {
3096
3149
  max-height: none;
3097
3150
  }
@@ -3110,7 +3163,7 @@
3110
3163
  .mt-12 {
3111
3164
  margin-top: 12px;
3112
3165
  }
3113
- `];te([c.property({type:Array})],H.prototype,"selectedStatus",2);te([c.property()],H.prototype,"statusOperator",2);te([c.property()],H.prototype,"approverValue",2);te([c.property()],H.prototype,"approverOperator",2);te([c.property()],H.prototype,"requesterValue",2);te([c.property()],H.prototype,"requesterOperator",2);te([c.property()],H.prototype,"dueDatePreset",2);te([c.property()],H.prototype,"dueDateFrom",2);te([c.property()],H.prototype,"dueDateTo",2);H=te([c.customElement("ap-filter-approval")],H);var Oa=Object.defineProperty,Pa=Object.getOwnPropertyDescriptor,se=(t,e,s,i)=>{for(var a=i>1?void 0:i?Pa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Oa(e,s,a),a};const Ia=300;function Da(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let G=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=Da(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:v.PRODUCT_REF,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},Ia)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
3166
+ `];oe([c.property({type:Array})],W.prototype,"selectedStatus",2);oe([c.property()],W.prototype,"statusOperator",2);oe([c.property()],W.prototype,"approverValue",2);oe([c.property()],W.prototype,"approverOperator",2);oe([c.property()],W.prototype,"requesterValue",2);oe([c.property()],W.prototype,"requesterOperator",2);oe([c.property()],W.prototype,"dueDatePreset",2);oe([c.property()],W.prototype,"dueDateFrom",2);oe([c.property()],W.prototype,"dueDateTo",2);W=oe([c.customElement("ap-filter-approval")],W);var Da=Object.defineProperty,za=Object.getOwnPropertyDescriptor,ne=(t,e,s,i)=>{for(var a=i>1?void 0:i?za(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Da(e,s,a),a};const Ra=300;function ja(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let Z=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=ja(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.PRODUCT_REF,values:e,operator:x.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},Ra)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
3114
3167
  `).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(i=>!e.has(i))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return o.html`
3115
3168
  <div
3116
3169
  class="product-item"
@@ -3230,7 +3283,7 @@
3230
3283
  </div>
3231
3284
  </div>
3232
3285
  `:o.nothing}
3233
- `}};G.styles=[ee,de,o.css`
3286
+ `}};Z.styles=[re,ue,o.css`
3234
3287
  .product-item {
3235
3288
  display: flex;
3236
3289
  align-items: center;
@@ -3469,7 +3522,7 @@
3469
3522
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3470
3523
  margin-left: 4px;
3471
3524
  }
3472
- `];se([c.property({type:Array})],G.prototype,"selected",2);se([c.property({attribute:!1})],G.prototype,"apiClient",2);se([c.query(".product-search")],G.prototype,"_searchInput",2);se([c.state()],G.prototype,"_search",2);se([c.state()],G.prototype,"_debouncedSearch",2);se([c.state()],G.prototype,"_products",2);se([c.state()],G.prototype,"_isLoading",2);se([c.state()],G.prototype,"_showAddList",2);se([c.state()],G.prototype,"_addListText",2);G=se([c.customElement("ap-filter-product-ref")],G);var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,F=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&za(e,s,a),a};let E=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=Rt,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.fileTypes=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${vt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=Pt.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3525
+ `];ne([c.property({type:Array})],Z.prototype,"selected",2);ne([c.property({attribute:!1})],Z.prototype,"apiClient",2);ne([c.query(".product-search")],Z.prototype,"_searchInput",2);ne([c.state()],Z.prototype,"_search",2);ne([c.state()],Z.prototype,"_debouncedSearch",2);ne([c.state()],Z.prototype,"_products",2);ne([c.state()],Z.prototype,"_isLoading",2);ne([c.state()],Z.prototype,"_showAddList",2);ne([c.state()],Z.prototype,"_addListText",2);Z=ne([c.customElement("ap-filter-product-ref")],Z);var Na=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,F=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ba(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Na(e,s,a),a};let C=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=Nt,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.fileTypes=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${mt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=Dt.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3473
3526
  .selected=${(r==null?void 0:r.values)||[]}
3474
3527
  .fileTypes=${this.fileTypes}
3475
3528
  @filter-change=${this._handleFilterChange}
@@ -3597,7 +3650,7 @@
3597
3650
  </button>
3598
3651
  ${this._showDropdown?o.html`
3599
3652
  <div class="dropdown-menu">
3600
- ${Pt.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3653
+ ${Dt.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3601
3654
  </div>
3602
3655
  `:o.nothing}
3603
3656
  </div>
@@ -3636,7 +3689,7 @@
3636
3689
  ${this._getMetadataFieldLabel(this._openMetadataField)}
3637
3690
  `:o.html`
3638
3691
  <ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
3639
- ${Le[this._openFilter]||this._openFilter}
3692
+ ${Oe[this._openFilter]||this._openFilter}
3640
3693
  `}
3641
3694
  <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
3642
3695
  <ap-icon name="close" .size=${14}></ap-icon>
@@ -3648,7 +3701,7 @@
3648
3701
  </div>
3649
3702
  </div>
3650
3703
  `:o.nothing}
3651
- `}};E.styles=o.css`
3704
+ `}};C.styles=o.css`
3652
3705
  :host {
3653
3706
  display: block;
3654
3707
  padding: 8px 20px 6px;
@@ -3986,10 +4039,10 @@
3986
4039
  border-radius: 8px;
3987
4040
  top: 0;
3988
4041
  }
3989
- `;F([c.property({type:Number})],E.prototype,"totalCount",2);F([c.property({type:Number})],E.prototype,"totalFolderCount",2);F([c.property({type:Boolean})],E.prototype,"isLoading",2);F([c.property({type:Boolean})],E.prototype,"showUpload",2);F([c.property()],E.prototype,"sortBy",2);F([c.property()],E.prototype,"sortDirection",2);F([c.property({type:Array})],E.prototype,"sortOptions",2);F([c.property({type:Object})],E.prototype,"filters",2);F([c.property({type:Array})],E.prototype,"labels",2);F([c.property({type:Array})],E.prototype,"tags",2);F([c.property({type:Array})],E.prototype,"fileTypes",2);F([c.property({type:Array})],E.prototype,"metadataFields",2);F([c.property({type:Array})],E.prototype,"pinnedFilters",2);F([c.property({type:Array})],E.prototype,"forcedFilterKeys",2);F([c.property({attribute:!1})],E.prototype,"apiClient",2);F([c.query("ap-dropdown")],E.prototype,"_sortDropdown",2);F([c.state()],E.prototype,"_showDropdown",2);F([c.state()],E.prototype,"_showMetadataSelector",2);F([c.state()],E.prototype,"_openFilter",2);F([c.state()],E.prototype,"_openMetadataField",2);F([c.state()],E.prototype,"_externalTrigger",2);F([c.state()],E.prototype,"_externalLeft",2);F([c.state()],E.prototype,"_externalTop",2);E=F([c.customElement("ap-content-toolbar")],E);var ja=Object.defineProperty,Na=Object.getOwnPropertyDescriptor,B=(t,e,s,i)=>{for(var a=i>1?void 0:i?Na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ja(e,s,a),a};let D=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var i;const e=(i=ct.find(a=>a.value===t))==null?void 0:i.label;if(e)return e;const s=t.indexOf("_");return s!==-1?t.slice(s+1).toUpperCase():t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,r=i?parseFloat(i):null,n=l=>l>=1e3?`${(l/1e3).toFixed(l%1e3===0?0:1)} GB`:`${l} MB`;return a!==null&&r!==null?`${n(a)} – ${n(r)}`:a!==null?`> ${n(a)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===v.SIZE)return this._getSizeSummary(s);if(e===v.COLOR){const a=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===v.TYPE?a=>this._mapTypeLabel(a):e===v.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===v.LABELS?a=>{var r;return((r=this.labels.find(n=>n.sid===a))==null?void 0:r.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,l;const e=((n=ds.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...zt,...ps],i=t.preset?((l=s.find(d=>d.value===t.preset))==null?void 0:l.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=i;break;case"before":r=t.to?`Before ${a(t.to)}`:i;break;case"after":r=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?r=`${a(t.from)} – ${a(t.to)}`:t.from?r=`After ${a(t.from)}`:t.to&&(r=`Before ${a(t.to)}`);break;case"specific":r=t.from?a(t.from):"";break;default:r=i}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=Pt.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&lt[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of os)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
4042
+ `;F([c.property({type:Number})],C.prototype,"totalCount",2);F([c.property({type:Number})],C.prototype,"totalFolderCount",2);F([c.property({type:Boolean})],C.prototype,"isLoading",2);F([c.property({type:Boolean})],C.prototype,"showUpload",2);F([c.property()],C.prototype,"sortBy",2);F([c.property()],C.prototype,"sortDirection",2);F([c.property({type:Array})],C.prototype,"sortOptions",2);F([c.property({type:Object})],C.prototype,"filters",2);F([c.property({type:Array})],C.prototype,"labels",2);F([c.property({type:Array})],C.prototype,"tags",2);F([c.property({type:Array})],C.prototype,"fileTypes",2);F([c.property({type:Array})],C.prototype,"metadataFields",2);F([c.property({type:Array})],C.prototype,"pinnedFilters",2);F([c.property({type:Array})],C.prototype,"forcedFilterKeys",2);F([c.property({attribute:!1})],C.prototype,"apiClient",2);F([c.query("ap-dropdown")],C.prototype,"_sortDropdown",2);F([c.state()],C.prototype,"_showDropdown",2);F([c.state()],C.prototype,"_showMetadataSelector",2);F([c.state()],C.prototype,"_openFilter",2);F([c.state()],C.prototype,"_openMetadataField",2);F([c.state()],C.prototype,"_externalTrigger",2);F([c.state()],C.prototype,"_externalLeft",2);F([c.state()],C.prototype,"_externalTop",2);C=F([c.customElement("ap-content-toolbar")],C);var Ua=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?Va(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ua(e,s,a),a};let j=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var i;const e=(i=ct.find(a=>a.value===t))==null?void 0:i.label;if(e)return e;const s=t.indexOf("_");return s!==-1?t.slice(s+1).toUpperCase():t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,r=i?parseFloat(i):null,n=l=>l>=1e3?`${(l/1e3).toFixed(l%1e3===0?0:1)} GB`:`${l} MB`;return a!==null&&r!==null?`${n(a)} – ${n(r)}`:a!==null?`> ${n(a)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===m.SIZE)return this._getSizeSummary(s);if(e===m.COLOR){const a=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===m.TYPE?a=>this._mapTypeLabel(a):e===m.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===m.LABELS?a=>{var r;return((r=this.labels.find(n=>n.sid===a))==null?void 0:r.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,l;const e=((n=hs.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...jt,...us],i=t.preset?((l=s.find(d=>d.value===t.preset))==null?void 0:l.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=i;break;case"before":r=t.to?`Before ${a(t.to)}`:i;break;case"after":r=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?r=`${a(t.from)} – ${a(t.to)}`:t.from?r=`After ${a(t.from)}`:t.to&&(r=`Before ${a(t.to)}`);break;case"specific":r=t.from?a(t.from):"";break;default:r=i}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=Dt.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&lt[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of ls)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3990
4043
  <span class="chip forced">
3991
- ${(i||t===v.TYPE||t===v.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
3992
- <span class="chip-label">${Le[t]||t}</span>
4044
+ ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
4045
+ <span class="chip-label">${Oe[t]||t}</span>
3993
4046
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3994
4047
  `}
3995
4048
  <span class="chip-lock">
@@ -3999,15 +4052,15 @@
3999
4052
  `}_renderFilterChip(t,e){if(!e)return o.html`
4000
4053
  <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
4001
4054
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4002
- <span class="chip-label">${Le[t]||t}</span>
4055
+ <span class="chip-label">${Oe[t]||t}</span>
4003
4056
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4004
4057
  </span>
4005
4058
  `;const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
4006
4059
  <span class="chip ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
4007
- ${(i||t===v.TYPE||t===v.SIZE)&&s?o.html`
4060
+ ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`
4008
4061
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4009
4062
  <span class="chip-label">${s}</span>`:o.html`
4010
- <span class="chip-label">${Le[t]||t}</span>
4063
+ <span class="chip-label">${Oe[t]||t}</span>
4011
4064
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
4012
4065
  `}
4013
4066
  <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
@@ -4029,7 +4082,7 @@
4029
4082
  <ap-icon name="close" .size=${12}></ap-icon>
4030
4083
  </button>
4031
4084
  </span>
4032
- `}render(){const t=It(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),l=s.filter(g=>!a.has(g)),d=i.filter(g=>!r.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+l.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
4085
+ `}render(){const t=zt(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),l=s.filter(g=>!a.has(g)),d=i.filter(g=>!r.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+l.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
4033
4086
  <div class="chips-row">
4034
4087
  <div class="chips">
4035
4088
  ${[...e].map(g=>this._renderForcedChip(g,t[g]))}
@@ -4039,7 +4092,7 @@
4039
4092
  ${h?o.html`
4040
4093
  <span class="chip pinned-empty active pending" @click=${g=>this._openFilter(this.pendingFilter,g)}>
4041
4094
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
4042
- <span class="chip-label">${Le[this.pendingFilter]||this.pendingFilter}</span>
4095
+ <span class="chip-label">${Oe[this.pendingFilter]||this.pendingFilter}</span>
4043
4096
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4044
4097
  </span>
4045
4098
  `:o.nothing}
@@ -4054,7 +4107,7 @@
4054
4107
  ${f?o.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:o.nothing}
4055
4108
  </div>
4056
4109
  </div>
4057
- `}};D.styles=o.css`
4110
+ `}};j.styles=o.css`
4058
4111
  :host {
4059
4112
  display: block;
4060
4113
  }
@@ -4201,7 +4254,7 @@
4201
4254
  align-items: center;
4202
4255
  opacity: 0.6;
4203
4256
  }
4204
- `;B([c.property({type:Object})],D.prototype,"appliedFilters",2);B([c.property({type:Object})],D.prototype,"appliedMetadata",2);B([c.property({type:Object})],D.prototype,"forcedFilters",2);B([c.property({type:Array})],D.prototype,"metadataFields",2);B([c.property({type:Array})],D.prototype,"pinnedFilters",2);B([c.property({type:Array})],D.prototype,"pinnedMetadataFields",2);B([c.property({type:Array})],D.prototype,"tags",2);B([c.property({type:Array})],D.prototype,"labels",2);B([c.property()],D.prototype,"activeFilter",2);B([c.property()],D.prototype,"activeMetadataField",2);B([c.property()],D.prototype,"pendingFilter",2);B([c.property()],D.prototype,"pendingMetadataField",2);D=B([c.customElement("ap-filters-bar")],D);var Ba=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ba(e,s,a),a};const Va=6;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return o.html`
4257
+ `;G([c.property({type:Object})],j.prototype,"appliedFilters",2);G([c.property({type:Object})],j.prototype,"appliedMetadata",2);G([c.property({type:Object})],j.prototype,"forcedFilters",2);G([c.property({type:Array})],j.prototype,"metadataFields",2);G([c.property({type:Array})],j.prototype,"pinnedFilters",2);G([c.property({type:Array})],j.prototype,"pinnedMetadataFields",2);G([c.property({type:Array})],j.prototype,"tags",2);G([c.property({type:Array})],j.prototype,"labels",2);G([c.property()],j.prototype,"activeFilter",2);G([c.property()],j.prototype,"activeMetadataField",2);G([c.property()],j.prototype,"pendingFilter",2);G([c.property()],j.prototype,"pendingMetadataField",2);j=G([c.customElement("ap-filters-bar")],j);var qa=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,le=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ha(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&qa(e,s,a),a};const Ga=6;let J=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return o.html`
4205
4258
  <div class="grid" role="list" aria-label="Assets" style="--ap-grid-min-col: ${t}">
4206
4259
  ${this.folders.map((e,s)=>o.html`
4207
4260
  <ap-folder-card
@@ -4229,7 +4282,7 @@
4229
4282
  @asset-quick-select=${a=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4230
4283
  ></ap-asset-card>
4231
4284
  `})}
4232
- ${this.isLoading?Array.from({length:Va},()=>o.html`<div class="ghost-card">
4285
+ ${this.isLoading?Array.from({length:Ga},()=>o.html`<div class="ghost-card">
4233
4286
  <div class="ghost-thumb"></div>
4234
4287
  <div class="ghost-info">
4235
4288
  <div class="ghost-line ghost-name"></div>
@@ -4237,7 +4290,7 @@
4237
4290
  </div>
4238
4291
  </div>`):o.nothing}
4239
4292
  </div>
4240
- `}};K.styles=o.css`
4293
+ `}};J.styles=o.css`
4241
4294
  :host {
4242
4295
  display: block;
4243
4296
  padding: 0 20px 16px;
@@ -4292,7 +4345,7 @@
4292
4345
  @media (prefers-reduced-motion: reduce) {
4293
4346
  .ghost-thumb, .ghost-line { animation: none; }
4294
4347
  }
4295
- `;ie([c.property({type:Array})],K.prototype,"assets",2);ie([c.property({type:Array})],K.prototype,"folders",2);ie([c.property({type:Object})],K.prototype,"folderPreviews",2);ie([c.property({type:Array})],K.prototype,"selectedIds",2);ie([c.property({type:Array})],K.prototype,"selectedFolderIds",2);ie([c.property({type:Boolean})],K.prototype,"isLoading",2);ie([c.property({type:Boolean})],K.prototype,"multiSelect",2);ie([c.property({type:Boolean})],K.prototype,"folderSelectable",2);ie([c.property({type:String})],K.prototype,"gridSize",2);K=ie([c.customElement("ap-grid-view")],K);var qa=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,Y=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ha(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&qa(e,s,a),a};const Ga=5;let N=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("64px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:"all"},bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return o.html`
4348
+ `;le([c.property({type:Array})],J.prototype,"assets",2);le([c.property({type:Array})],J.prototype,"folders",2);le([c.property({type:Object})],J.prototype,"folderPreviews",2);le([c.property({type:Array})],J.prototype,"selectedIds",2);le([c.property({type:Array})],J.prototype,"selectedFolderIds",2);le([c.property({type:Boolean})],J.prototype,"isLoading",2);le([c.property({type:Boolean})],J.prototype,"multiSelect",2);le([c.property({type:Boolean})],J.prototype,"folderSelectable",2);le([c.property({type:String})],J.prototype,"gridSize",2);J=le([c.customElement("ap-grid-view")],J);var Ka=Object.defineProperty,Ya=Object.getOwnPropertyDescriptor,ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ya(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ka(e,s,a),a};const Qa=5;let V=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("64px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:"all"},bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return o.html`
4296
4349
  <div class="list-header" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}" role="row" aria-label="Column headers">
4297
4350
  ${this.multiSelect?o.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4298
4351
  <div class="header-check-box ${s?"checked":e>0?"indeterminate":""}">
@@ -4339,7 +4392,7 @@
4339
4392
  @asset-quick-select=${r=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:r.detail,bubbles:!0,composed:!0}))}
4340
4393
  ></ap-asset-row>
4341
4394
  `)}
4342
- ${this.isLoading?Array.from({length:Ga},(i,a)=>{const r=["70%","55%","80%","45%","65%"];return o.html`
4395
+ ${this.isLoading?Array.from({length:Qa},(i,a)=>{const r=["70%","55%","80%","45%","65%"];return o.html`
4343
4396
  <div class="ghost-row" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}">
4344
4397
  ${this.multiSelect?o.html`<div class="ghost-el ghost-check"></div>`:o.nothing}
4345
4398
  <div class="ghost-el ghost-thumb"></div>
@@ -4351,7 +4404,7 @@
4351
4404
  </div>
4352
4405
  `}):o.nothing}
4353
4406
  </div>
4354
- `}};N.styles=o.css`
4407
+ `}};V.styles=o.css`
4355
4408
  :host {
4356
4409
  display: block;
4357
4410
  padding: 0 20px 16px;
@@ -4438,7 +4491,7 @@
4438
4491
  @media (prefers-reduced-motion: reduce) {
4439
4492
  .ghost-el { animation: none; }
4440
4493
  }
4441
- `;Y([c.property({type:Array})],N.prototype,"assets",2);Y([c.property({type:Array})],N.prototype,"folders",2);Y([c.property({type:Array})],N.prototype,"selectedIds",2);Y([c.property({type:Array})],N.prototype,"selectedFolderIds",2);Y([c.property({type:Boolean})],N.prototype,"isLoading",2);Y([c.property({type:Boolean})],N.prototype,"multiSelect",2);Y([c.property({type:Boolean})],N.prototype,"folderSelectable",2);Y([c.property({type:Number})],N.prototype,"totalCount",2);Y([c.property({type:Boolean})],N.prototype,"isSelectingAll",2);Y([c.property({type:Object})],N.prototype,"folderPreviews",2);Y([c.state()],N.prototype,"_compactLevel",2);N=Y([c.customElement("ap-list-view")],N);const Ka=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),Ya=new Set([...Ka,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Oe(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function ys(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ya.has(e)}const xs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",Xa={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function et(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=Xa[e];return`${xs}${s||"DEFAULT"}.png`}function De(){return`${xs}DEFAULT.png`}function yt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Wa=new Set(["png","svg","webp","gif","avif"]);function Bt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Wa.has(e)}const Qa=new Set(["svg","svg+xml","png","pdf"]);function ws(t){return Qa.has(yt(t).toLowerCase())}function pt(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return ze(s)}function $s(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?ze(s):""}function Ut(t){var s,i;let e=ze(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ke(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function Ke(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const rs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function ze(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(rs);if(s){const i=s[2];return t.replace(rs,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function ks(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=ze(s);const a=Oe(t.file_type),r=String(window.devicePixelRatio||1);return a==="video"?Ke(i,{w:e,dpr:r,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||yt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ke(i,{w:e,dpr:r,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):Ke(i,{w:e,dpr:r})}function Vt(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function ht(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Ss(t,e){return!t||!e?"":`${t} x ${e}`}var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,tt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ja(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Za(e,s,a),a};let Se=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=r=>String(r).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f,p;const t=this.asset;if(!t)return o.html``;const s=Oe(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ys(t.extension||"");let r="";s?r=$s(t):i?r=Ut(t):a&&(r=pt(t));const n=et(t.extension||""),l=Bt(t.extension||"");return o.html`
4494
+ `;ee([c.property({type:Array})],V.prototype,"assets",2);ee([c.property({type:Array})],V.prototype,"folders",2);ee([c.property({type:Array})],V.prototype,"selectedIds",2);ee([c.property({type:Array})],V.prototype,"selectedFolderIds",2);ee([c.property({type:Boolean})],V.prototype,"isLoading",2);ee([c.property({type:Boolean})],V.prototype,"multiSelect",2);ee([c.property({type:Boolean})],V.prototype,"folderSelectable",2);ee([c.property({type:Number})],V.prototype,"totalCount",2);ee([c.property({type:Boolean})],V.prototype,"isSelectingAll",2);ee([c.property({type:Object})],V.prototype,"folderPreviews",2);ee([c.state()],V.prototype,"_compactLevel",2);V=ee([c.customElement("ap-list-view")],V);const Xa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),Wa=new Set([...Xa,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Ie(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function ws(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Wa.has(e)}const $s="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",Za={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function tt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=Za[e];return`${$s}${s||"DEFAULT"}.png`}function ze(){return`${$s}DEFAULT.png`}function yt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Ja=new Set(["png","svg","webp","gif","avif"]);function Vt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ja.has(e)}const er=new Set(["svg","svg+xml","png","pdf"]);function ks(t){return er.has(yt(t).toLowerCase())}function pt(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return Re(s)}function Ss(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Re(s):""}function qt(t){var s,i;let e=Re(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ye(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function Ye(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const ns=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Re(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(ns);if(s){const i=s[2];return t.replace(ns,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function Cs(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Re(s);const a=Ie(t.file_type),r=String(window.devicePixelRatio||1);return a==="video"?Ye(i,{w:e,dpr:r,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||yt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),Ye(i,{w:e,dpr:r,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):Ye(i,{w:e,dpr:r})}function Ht(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function ht(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Es(t,e){return!t||!e?"":`${t} x ${e}`}var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,st=(t,e,s,i)=>{for(var a=i>1?void 0:i?sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&tr(e,s,a),a};let Ce=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=r=>String(r).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f,p;const t=this.asset;if(!t)return o.html``;const s=Ie(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ws(t.extension||"");let r="";s?r=Ss(t):i?r=qt(t):a&&(r=pt(t));const n=tt(t.extension||""),l=Vt(t.extension||"");return o.html`
4442
4495
  <div class="card" @click=${this._handleSelect}>
4443
4496
  <div class="thumbnail ${l&&r?"chess":""}">
4444
4497
  ${r?o.html`<img
@@ -4446,12 +4499,12 @@
4446
4499
  alt=${t.name}
4447
4500
  loading="lazy"
4448
4501
  class="thumb-img ${l?"transparent-asset":""}"
4449
- @error=${g=>{const m=g.target,_=De();m.src!==n&&m.src!==_?(m.src=n,m.classList.add("icon-fallback")):m.src!==_&&(m.src=_)}}
4502
+ @error=${g=>{const v=g.target,_=ze();v.src!==n&&v.src!==_?(v.src=n,v.classList.add("icon-fallback")):v.src!==_&&(v.src=_)}}
4450
4503
  />`:o.html`<img
4451
4504
  src=${n}
4452
4505
  alt=${t.name}
4453
4506
  class="thumb-img icon-fallback"
4454
- @error=${g=>{const m=g.target,_=De();m.src!==_&&(m.src=_)}}
4507
+ @error=${g=>{const v=g.target,_=ze();v.src!==_&&(v.src=_)}}
4455
4508
  />`}
4456
4509
  ${s&&(((h=t.info)==null?void 0:h.video_duration)??((u=t.info)==null?void 0:u.duration))!=null?o.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:o.nothing}
4457
4510
  <div class="overlay">
@@ -4476,10 +4529,10 @@
4476
4529
  </div>
4477
4530
  <div class="info">
4478
4531
  <div class="name" title=${t.name}>${t.name}</div>
4479
- <div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var x,$,k,A;const g=((x=t.info)==null?void 0:x.img_w)||(($=t.info)==null?void 0:$.video_w),m=((k=t.info)==null?void 0:k.img_h)||((A=t.info)==null?void 0:A.video_h),_=Ss(g,m);return _?` · ${_}`:""})()} · ${Vt(((p=t.size)==null?void 0:p.bytes)||0)}</div>
4532
+ <div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var y,$,k,T;const g=((y=t.info)==null?void 0:y.img_w)||(($=t.info)==null?void 0:$.video_w),v=((k=t.info)==null?void 0:k.img_h)||((T=t.info)==null?void 0:T.video_h),_=Es(g,v);return _?` · ${_}`:""})()} · ${Ht(((p=t.size)==null?void 0:p.bytes)||0)}</div>
4480
4533
  </div>
4481
4534
  </div>
4482
- `}};Se.styles=o.css`
4535
+ `}};Ce.styles=o.css`
4483
4536
  :host {
4484
4537
  display: block;
4485
4538
  animation: ap-card-in 300ms ease-out both;
@@ -4658,7 +4711,7 @@
4658
4711
  :host { animation: none; }
4659
4712
  .overlay { transition: none; }
4660
4713
  }
4661
- `;tt([c.property({type:Object})],Se.prototype,"asset",2);tt([c.property({type:Number})],Se.prototype,"index",2);tt([c.property({type:Boolean,reflect:!0})],Se.prototype,"selected",2);tt([c.property({type:Boolean})],Se.prototype,"multiSelect",2);Se=tt([c.customElement("ap-asset-card")],Se);var er=Object.defineProperty,tr=Object.getOwnPropertyDescriptor,Ve=(t,e,s,i)=>{for(var a=i>1?void 0:i?tr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&er(e,s,a),a};let ue=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Oe(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ys(t.extension||"");let r="";s?r=$s(t):i?r=Ut(t):a&&(r=pt(t));const n=et(t.extension||""),l=Bt(t.extension||"");return o.html`
4714
+ `;st([c.property({type:Object})],Ce.prototype,"asset",2);st([c.property({type:Number})],Ce.prototype,"index",2);st([c.property({type:Boolean,reflect:!0})],Ce.prototype,"selected",2);st([c.property({type:Boolean})],Ce.prototype,"multiSelect",2);Ce=st([c.customElement("ap-asset-card")],Ce);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ir(e,s,a),a};let ve=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Ie(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=ws(t.extension||"");let r="";s?r=Ss(t):i?r=qt(t):a&&(r=pt(t));const n=tt(t.extension||""),l=Vt(t.extension||"");return o.html`
4662
4715
  <div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleSelect}>
4663
4716
  ${this.multiSelect?o.html`
4664
4717
  <div class="check">
@@ -4675,17 +4728,17 @@
4675
4728
  alt=${t.name}
4676
4729
  class="${l?"transparent-asset":""}"
4677
4730
  loading="lazy"
4678
- @error=${f=>{const p=f.target,g=De();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4731
+ @error=${f=>{const p=f.target,g=ze();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4679
4732
  />`:o.html`<img
4680
4733
  src=${n}
4681
4734
  alt=${t.name}
4682
4735
  class="icon-fallback"
4683
- @error=${f=>{const p=f.target,g=De();p.src!==g&&(p.src=g)}}
4736
+ @error=${f=>{const p=f.target,g=ze();p.src!==g&&(p.src=g)}}
4684
4737
  />`}
4685
4738
  </div>
4686
4739
  <div class="name" title=${t.name}>${t.name}</div>
4687
4740
  <div class="type">${(h=t.extension)==null?void 0:h.toUpperCase()}</div>
4688
- ${this.compactLevel<2?o.html`<div class="desc">${Vt(((u=t.size)==null?void 0:u.bytes)||0)}</div>`:o.nothing}
4741
+ ${this.compactLevel<2?o.html`<div class="desc">${Ht(((u=t.size)==null?void 0:u.bytes)||0)}</div>`:o.nothing}
4689
4742
  ${this.compactLevel<1?o.html`<div class="date">${ht(t.created_at||"")}</div>`:o.nothing}
4690
4743
  <div class="actions">
4691
4744
  <button class="icon-btn select-btn" @click=${this._handleQuickSelect} aria-label="Select" title="Select">
@@ -4696,7 +4749,7 @@
4696
4749
  </button>
4697
4750
  </div>
4698
4751
  </div>
4699
- `}};ue.styles=o.css`
4752
+ `}};ve.styles=o.css`
4700
4753
  :host {
4701
4754
  display: block;
4702
4755
  }
@@ -4826,7 +4879,7 @@
4826
4879
  :host([selected]) .check-icon {
4827
4880
  display: block;
4828
4881
  }
4829
- `;Ve([c.property({type:Object})],ue.prototype,"asset",2);Ve([c.property({type:Number})],ue.prototype,"index",2);Ve([c.property({type:Boolean,reflect:!0})],ue.prototype,"selected",2);Ve([c.property({type:Boolean})],ue.prototype,"multiSelect",2);Ve([c.property({type:Number})],ue.prototype,"compactLevel",2);ue=Ve([c.customElement("ap-asset-row")],ue);var sr=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,Te=(t,e,s,i)=>{for(var a=i>1?void 0:i?ir(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sr(e,s,a),a};let le=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return ks(t,"200")}_renderPreviewImg(t){const e=ws(t.file_type),s=this._getPreviewUrl(t),i=et(yt(t.file_type)),a=De();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4882
+ `;qe([c.property({type:Object})],ve.prototype,"asset",2);qe([c.property({type:Number})],ve.prototype,"index",2);qe([c.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);qe([c.property({type:Boolean})],ve.prototype,"multiSelect",2);qe([c.property({type:Number})],ve.prototype,"compactLevel",2);ve=qe([c.customElement("ap-asset-row")],ve);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,Me=(t,e,s,i)=>{for(var a=i>1?void 0:i?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};let he=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return Cs(t,"200")}_renderPreviewImg(t){const e=ks(t.file_type),s=this._getPreviewUrl(t),i=tt(yt(t.file_type)),a=ze();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4830
4883
  <img
4831
4884
  class="preview-img ${e?"icon-mode":""}"
4832
4885
  src="${s||i}"
@@ -4873,7 +4926,7 @@
4873
4926
  </div>
4874
4927
  </div>
4875
4928
  </div>
4876
- `}};le.styles=[ee,o.css`
4929
+ `}};he.styles=[re,o.css`
4877
4930
  :host {
4878
4931
  display: block;
4879
4932
  }
@@ -5051,7 +5104,7 @@
5051
5104
  :host([selected]) .check-icon {
5052
5105
  display: block;
5053
5106
  }
5054
- `];Te([c.property({type:Object})],le.prototype,"folder",2);Te([c.property({type:Array})],le.prototype,"previews",2);Te([c.property({type:Boolean,reflect:!0})],le.prototype,"selected",2);Te([c.property({type:Boolean})],le.prototype,"selectable",2);Te([c.property({type:Boolean})],le.prototype,"multiSelect",2);Te([c.property({type:Number})],le.prototype,"index",2);le=Te([c.customElement("ap-folder-card")],le);var ar=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,fe=(t,e,s,i)=>{for(var a=i>1?void 0:i?rr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ar(e,s,a),a};let Z=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_renderPreviewImg(t){const e=ws(t.file_type),s=ks(t,"80"),i=et(yt(t.file_type)),a=De();return o.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5107
+ `];Me([c.property({type:Object})],he.prototype,"folder",2);Me([c.property({type:Array})],he.prototype,"previews",2);Me([c.property({type:Boolean,reflect:!0})],he.prototype,"selected",2);Me([c.property({type:Boolean})],he.prototype,"selectable",2);Me([c.property({type:Boolean})],he.prototype,"multiSelect",2);Me([c.property({type:Number})],he.prototype,"index",2);he=Me([c.customElement("ap-folder-card")],he);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,be=(t,e,s,i)=>{for(var a=i>1?void 0:i?lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nr(e,s,a),a};let ie=class extends o.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_renderPreviewImg(t){const e=ks(t.file_type),s=Cs(t,"80"),i=tt(yt(t.file_type)),a=ze();return o.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5055
5108
  class="preview-img ${e?"icon-mode":""}"
5056
5109
  src="${s||i}"
5057
5110
  alt=""
@@ -5086,7 +5139,7 @@
5086
5139
  ${this.compactLevel<1?o.html`<div class="meta">${ht(t.modified_at||t.updated_at||"")}</div>`:o.nothing}
5087
5140
  <div></div>
5088
5141
  </div>
5089
- `:o.html``}};Z.styles=o.css`
5142
+ `:o.html``}};ie.styles=o.css`
5090
5143
  :host {
5091
5144
  display: block;
5092
5145
  }
@@ -5205,7 +5258,7 @@
5205
5258
  :host([selected]) .check-icon {
5206
5259
  display: block;
5207
5260
  }
5208
- `;fe([c.property({type:Object})],Z.prototype,"folder",2);fe([c.property({type:Array})],Z.prototype,"previews",2);fe([c.property({type:Boolean,reflect:!0})],Z.prototype,"selected",2);fe([c.property({type:Boolean})],Z.prototype,"selectable",2);fe([c.property({type:Boolean})],Z.prototype,"multiSelect",2);fe([c.property({type:Number})],Z.prototype,"index",2);fe([c.property({type:Number})],Z.prototype,"compactLevel",2);Z=fe([c.customElement("ap-folder-row")],Z);var or=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,st=(t,e,s,i)=>{for(var a=i>1?void 0:i?nr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&or(e,s,a),a};let Ce=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return o.html`
5261
+ `;be([c.property({type:Object})],ie.prototype,"folder",2);be([c.property({type:Array})],ie.prototype,"previews",2);be([c.property({type:Boolean,reflect:!0})],ie.prototype,"selected",2);be([c.property({type:Boolean})],ie.prototype,"selectable",2);be([c.property({type:Boolean})],ie.prototype,"multiSelect",2);be([c.property({type:Number})],ie.prototype,"index",2);be([c.property({type:Number})],ie.prototype,"compactLevel",2);ie=be([c.customElement("ap-folder-row")],ie);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,it=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let Ee=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return o.html`
5209
5262
  <div class="grid-skeleton" style="--ap-grid-min-col: ${n}">
5210
5263
  ${Array.from({length:18},()=>o.html`<div class="card-skel">
5211
5264
  <div class="skeleton card-skel-thumb"></div>
@@ -5251,7 +5304,7 @@
5251
5304
  </div>
5252
5305
  ${Array.from({length:this.folderCount},()=>s)}
5253
5306
  ${Array.from({length:r},(n,l)=>i(a[l%a.length]))}
5254
- `}};Ce.styles=o.css`
5307
+ `}};Ee.styles=o.css`
5255
5308
  :host {
5256
5309
  display: block;
5257
5310
  padding: 0 20px 16px;
@@ -5376,7 +5429,7 @@
5376
5429
  @media (prefers-reduced-motion: reduce) {
5377
5430
  .skeleton { animation: none; }
5378
5431
  }
5379
- `;st([c.property({reflect:!0})],Ce.prototype,"variant",2);st([c.property({type:String})],Ce.prototype,"gridSize",2);st([c.property({type:Boolean})],Ce.prototype,"multiSelect",2);st([c.property({type:Number})],Ce.prototype,"folderCount",2);Ce=st([c.customElement("ap-skeleton")],Ce);function Cs(t){var a,r;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var lr=Object.defineProperty,cr=Object.getOwnPropertyDescriptor,I=(t,e,s,i)=>{for(var a=i>1?void 0:i?cr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&lr(e,s,a),a};let P=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Oe(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Cs(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(l,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Oe(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return pt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=ze(e,this.containerToken);return Ke(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,l;const e=(n=t.info)==null?void 0:n.img_w,s=(l=t.info)==null?void 0:l.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,r=Math.min(i/e,a/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:v.TAGS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:v.LABELS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
5432
+ `;it([c.property({reflect:!0})],Ee.prototype,"variant",2);it([c.property({type:String})],Ee.prototype,"gridSize",2);it([c.property({type:Boolean})],Ee.prototype,"multiSelect",2);it([c.property({type:Number})],Ee.prototype,"folderCount",2);Ee=it([c.customElement("ap-skeleton")],Ee);function Fs(t){var a,r;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var a=i>1?void 0:i?hr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pr(e,s,a),a};let L=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Ie(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Fs(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(l,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Ie(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return pt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Re(e,this.containerToken);return Ye(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,l;const e=(n=t.info)==null?void 0:n.img_w,s=(l=t.info)==null?void 0:l.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,r=Math.min(i/e,a/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.TAGS,values:[t],operator:x.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.LABELS,values:[t],operator:x.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
5380
5433
  <div class="accordion">
5381
5434
  <button
5382
5435
  class="accordion-trigger"
@@ -5420,7 +5473,7 @@
5420
5473
  `)}
5421
5474
  </div>
5422
5475
  </div>
5423
- `}_getFileInfoRows(t){var s,i,a,r,n,l;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:Vt(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:Ss(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((r=t.info)==null?void 0:r.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(l=t.info)!=null&&l.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:ht(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:ht(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var r,n,l,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((l=t.meta)==null?void 0:l[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?o.nothing:o.html`
5476
+ `}_getFileInfoRows(t){var s,i,a,r,n,l;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:Ht(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:Es(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((r=t.info)==null?void 0:r.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(l=t.info)!=null&&l.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:ht(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:ht(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var r,n,l,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((l=t.meta)==null?void 0:l[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?o.nothing:o.html`
5424
5477
  <div class="meta-row" style="flex-direction:column;gap:6px">
5425
5478
  <span class="meta-label">Labels</span>
5426
5479
  <div class="tags-list">
@@ -5443,7 +5496,7 @@
5443
5496
  `)}
5444
5497
  </div>
5445
5498
  </div>
5446
- `}render(){var O,S,T,C,Q,ae,X,it;const t=this.asset;if(!t)return o.nothing;const e=Oe(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((O=t.extension)==null?void 0:O.toLowerCase())==="pdf",n=et(t.extension||""),l=Bt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=pt(t),u=s?d?((T=t.url)==null?void 0:T.cdn)||"":h||ze(((C=t.url)==null?void 0:C.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((Q=t.url)==null?void 0:Q.cdn)||"",m=i&&(((ae=t.info)==null?void 0:ae.video_thumbnail)||((X=t.info)==null?void 0:X.preview))||"",_=r&&!s?Ut(t):"",x=this._getCurrentIndex(),$=x>0&&this._findNavTarget(x,-1)>=0,k=x>=0&&this._findNavTarget(x,1)>=0,A=this.assets.length>1;return o.html`
5499
+ `}render(){var O,S,z,E,Y,te,I,P;const t=this.asset;if(!t)return o.nothing;const e=Ie(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((O=t.extension)==null?void 0:O.toLowerCase())==="pdf",n=tt(t.extension||""),l=Vt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=pt(t),u=s?d?((z=t.url)==null?void 0:z.cdn)||"":h||Re(((E=t.url)==null?void 0:E.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((Y=t.url)==null?void 0:Y.cdn)||"",v=i&&(((te=t.info)==null?void 0:te.video_thumbnail)||((I=t.info)==null?void 0:I.preview))||"",_=r&&!s?qt(t):"",y=this._getCurrentIndex(),$=y>0&&this._findNavTarget(y,-1)>=0,k=y>=0&&this._findNavTarget(y,1)>=0,T=this.assets.length>1;return o.html`
5447
5500
  <div class="panel">
5448
5501
  <div class="panel-header">
5449
5502
  <span class="panel-title" title=${t.name}>${t.name}</span>
@@ -5462,7 +5515,7 @@
5462
5515
  </div>
5463
5516
 
5464
5517
  <div class="preview-area ${s&&l?"chess":""}">
5465
- ${A?o.html`
5518
+ ${T?o.html`
5466
5519
  <button class="nav-btn prev" @click=${this._prev} ?disabled=${!$} aria-label="Previous">
5467
5520
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
5468
5521
  </button>
@@ -5480,8 +5533,8 @@
5480
5533
  <img
5481
5534
  src=${u}
5482
5535
  alt=${t.name}
5483
- @load=${ve=>{ve.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
5484
- @error=${ve=>{const be=ve.target;this._previewLoading=!1,be.src!==n&&(be.src=n,be.classList.add("icon-fallback"))}}
5536
+ @load=${R=>{R.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
5537
+ @error=${R=>{const q=R.target;this._previewLoading=!1,q.src!==n&&(q.src=n,q.classList.add("icon-fallback"))}}
5485
5538
  />
5486
5539
  <div class="fs-wrapper">
5487
5540
  ${d?o.nothing:o.html`
@@ -5501,14 +5554,14 @@
5501
5554
  />
5502
5555
  </div>
5503
5556
  `:o.nothing}
5504
- ${i?o.html`<video src=${g} poster=${m||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
5505
- ${a?o.html`<audio src=${((it=t.url)==null?void 0:it.cdn)||""} controls></audio>`:o.nothing}
5557
+ ${i?o.html`<video src=${g} poster=${v||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
5558
+ ${a?o.html`<audio src=${((P=t.url)==null?void 0:P.cdn)||""} controls></audio>`:o.nothing}
5506
5559
  ${r&&!s?o.html`
5507
5560
  <img
5508
5561
  src=${_||n}
5509
5562
  alt=${t.name}
5510
5563
  class=${_?"":"icon-fallback"}
5511
- @error=${ve=>{const be=ve.target;be.src!==n&&(be.src=n,be.classList.add("icon-fallback"))}}
5564
+ @error=${R=>{const q=R.target;q.src!==n&&(q.src=n,q.classList.add("icon-fallback"))}}
5512
5565
  />
5513
5566
  `:o.nothing}
5514
5567
  ${!s&&!i&&!a&&!r?o.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:o.nothing}
@@ -5519,7 +5572,7 @@
5519
5572
  ${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
5520
5573
  `:o.nothing}
5521
5574
  </div>
5522
- `}};P.styles=o.css`
5575
+ `}};L.styles=o.css`
5523
5576
  :host {
5524
5577
  display: block;
5525
5578
  }
@@ -5830,7 +5883,7 @@
5830
5883
  .panel { animation: none; }
5831
5884
  .accordion-chevron { transition: none; }
5832
5885
  }
5833
- `;I([c.property({type:Object})],P.prototype,"asset",2);I([c.property({type:Array})],P.prototype,"assets",2);I([c.property({type:Array})],P.prototype,"selectedIds",2);I([c.property()],P.prototype,"containerToken",2);I([c.property({type:Boolean})],P.prototype,"showMetadata",2);I([c.property({type:Array})],P.prototype,"metadataFields",2);I([c.property({type:Array})],P.prototype,"labels",2);I([c.property({type:Object})],P.prototype,"regionalFilters",2);I([c.property({type:Boolean})],P.prototype,"multiSelect",2);I([c.query(".preview-area")],P.prototype,"previewArea",2);I([c.query("video")],P.prototype,"_videoEl",2);I([c.state()],P.prototype,"_isFullscreen",2);I([c.state()],P.prototype,"_fsImageLoaded",2);I([c.state()],P.prototype,"_previewLoading",2);I([c.state()],P.prototype,"_openSections",2);P=I([c.customElement("ap-preview-panel")],P);var dr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,qt=(t,e,s,i)=>{for(var a=i>1?void 0:i?pr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&dr(e,s,a),a};const hr={search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let We=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=hr[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5886
+ `;D([c.property({type:Object})],L.prototype,"asset",2);D([c.property({type:Array})],L.prototype,"assets",2);D([c.property({type:Array})],L.prototype,"selectedIds",2);D([c.property()],L.prototype,"containerToken",2);D([c.property({type:Boolean})],L.prototype,"showMetadata",2);D([c.property({type:Array})],L.prototype,"metadataFields",2);D([c.property({type:Array})],L.prototype,"labels",2);D([c.property({type:Object})],L.prototype,"regionalFilters",2);D([c.property({type:Boolean})],L.prototype,"multiSelect",2);D([c.query(".preview-area")],L.prototype,"previewArea",2);D([c.query("video")],L.prototype,"_videoEl",2);D([c.state()],L.prototype,"_isFullscreen",2);D([c.state()],L.prototype,"_fsImageLoaded",2);D([c.state()],L.prototype,"_previewLoading",2);D([c.state()],L.prototype,"_openSections",2);L=D([c.customElement("ap-preview-panel")],L);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Gt=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};const fr={sparkles:[{tag:"path",attrs:{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}},{tag:"path",attrs:{d:"M5 3v4"}},{tag:"path",attrs:{d:"M19 17v4"}},{tag:"path",attrs:{d:"M3 5h4"}},{tag:"path",attrs:{d:"M17 19h4"}}],search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let We=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=fr[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5834
5887
  <svg
5835
5888
  style="--icon-size: ${this.size}px"
5836
5889
  viewBox="0 0 24 24"
@@ -5852,7 +5905,7 @@
5852
5905
  width: var(--icon-size, 20px);
5853
5906
  height: var(--icon-size, 20px);
5854
5907
  }
5855
- `];qt([c.property()],We.prototype,"name",2);qt([c.property({type:Number})],We.prototype,"size",2);We=qt([c.customElement("ap-icon")],We);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,me=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let J=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_canSelectMore(){if(this.maxSelections&&this._totalSelected>=this.maxSelections)return!1;const t=this._selectScope;return t==="assets"?this.selectedAssets.length<this.totalCount:t==="folders"?this.selectedFolders.length<this.totalFolderCount:this._totalSelected<this.totalCount+this.totalFolderCount}get _scopeTotal(){const t=this._selectScope;return t==="assets"?this.totalCount:t==="folders"?this.totalFolderCount:this.totalCount+this.totalFolderCount}get _selectScope(){const t=this.selectedAssets.length>0,e=this.selectedFolders.length>0;return t&&!e?"assets":e&&!t?"folders":"all"}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:this._selectScope},bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?o.nothing:o.html`
5908
+ `];Gt([c.property()],We.prototype,"name",2);Gt([c.property({type:Number})],We.prototype,"size",2);We=Gt([c.customElement("ap-icon")],We);var vr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?mr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vr(e,s,a),a};let ae=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_canSelectMore(){if(this.maxSelections&&this._totalSelected>=this.maxSelections)return!1;const t=this._selectScope;return t==="assets"?this.selectedAssets.length<this.totalCount:t==="folders"?this.selectedFolders.length<this.totalFolderCount:this._totalSelected<this.totalCount+this.totalFolderCount}get _scopeTotal(){const t=this._selectScope;return t==="assets"?this.totalCount:t==="folders"?this.totalFolderCount:this.totalCount+this.totalFolderCount}get _selectScope(){const t=this.selectedAssets.length>0,e=this.selectedFolders.length>0;return t&&!e?"assets":e&&!t?"folders":"all"}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:this._selectScope},bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?o.nothing:o.html`
5856
5909
  <div class="bar">
5857
5910
  <span class="count">${this._formatCount()}</span>
5858
5911
  ${this.multiSelect?o.html`
@@ -5869,7 +5922,7 @@
5869
5922
  <div class="spacer"></div>
5870
5923
  <button class="btn-confirm" @click=${this._confirm}>Confirm</button>
5871
5924
  </div>
5872
- `}};J.styles=o.css`
5925
+ `}};ae.styles=o.css`
5873
5926
  :host {
5874
5927
  display: block;
5875
5928
  padding: 0 8px 8px;
@@ -5956,12 +6009,12 @@
5956
6009
  @media (prefers-reduced-motion: reduce) {
5957
6010
  .bar { animation: none; }
5958
6011
  }
5959
- `;me([c.property({type:Array})],J.prototype,"selectedAssets",2);me([c.property({type:Array})],J.prototype,"selectedFolders",2);me([c.property({type:Number})],J.prototype,"totalCount",2);me([c.property({type:Number})],J.prototype,"totalFolderCount",2);me([c.property({type:Boolean})],J.prototype,"isSelectingAll",2);me([c.property({type:Boolean})],J.prototype,"multiSelect",2);me([c.property({type:Number})],J.prototype,"maxSelections",2);J=me([c.customElement("ap-selection-bar")],J);var fr=Object.defineProperty,mr=Object.getOwnPropertyDescriptor,Ht=(t,e,s,i)=>{for(var a=i>1?void 0:i?mr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let Qe=class extends o.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?o.nothing:o.html`
6012
+ `;_e([c.property({type:Array})],ae.prototype,"selectedAssets",2);_e([c.property({type:Array})],ae.prototype,"selectedFolders",2);_e([c.property({type:Number})],ae.prototype,"totalCount",2);_e([c.property({type:Number})],ae.prototype,"totalFolderCount",2);_e([c.property({type:Boolean})],ae.prototype,"isSelectingAll",2);_e([c.property({type:Boolean})],ae.prototype,"multiSelect",2);_e([c.property({type:Number})],ae.prototype,"maxSelections",2);ae=_e([c.customElement("ap-selection-bar")],ae);var br=Object.defineProperty,_r=Object.getOwnPropertyDescriptor,Kt=(t,e,s,i)=>{for(var a=i>1?void 0:i?_r(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&br(e,s,a),a};let Ze=class extends o.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?o.nothing:o.html`
5960
6013
  <div
5961
6014
  class="marquee"
5962
6015
  style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
5963
6016
  ></div>
5964
- `}};Qe.styles=o.css`
6017
+ `}};Ze.styles=o.css`
5965
6018
  :host {
5966
6019
  display: block;
5967
6020
  position: absolute;
@@ -5978,7 +6031,7 @@
5978
6031
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5979
6032
  border-radius: 2px;
5980
6033
  }
5981
- `;Ht([c.property({type:Boolean})],Qe.prototype,"active",2);Ht([c.property({type:Object})],Qe.prototype,"rect",2);Qe=Ht([c.customElement("ap-marquee-overlay")],Qe);var vr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vr(e,s,a),a};let ge=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
6034
+ `;Kt([c.property({type:Boolean})],Ze.prototype,"active",2);Kt([c.property({type:Object})],Ze.prototype,"rect",2);Ze=Kt([c.customElement("ap-marquee-overlay")],Ze);var yr=Object.defineProperty,xr=Object.getOwnPropertyDescriptor,He=(t,e,s,i)=>{for(var a=i>1?void 0:i?xr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&yr(e,s,a),a};let me=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
5982
6035
  ${this.options.map(t=>o.html`
5983
6036
  <div
5984
6037
  class="option"
@@ -5992,7 +6045,7 @@
5992
6045
  <span class="label">${t.label}</span>
5993
6046
  </div>
5994
6047
  `)}
5995
- `}_select(t){this.disabled||t.disabled||this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t.value},bubbles:!0,composed:!0}))}};ge.styles=[ee,o.css`
6048
+ `}_select(t){this.disabled||t.disabled||this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t.value},bubbles:!0,composed:!0}))}};me.styles=[re,o.css`
5996
6049
  :host {
5997
6050
  display: flex;
5998
6051
  flex-direction: column;
@@ -6053,7 +6106,7 @@
6053
6106
  font-family: inherit;
6054
6107
  user-select: none;
6055
6108
  }
6056
- `];qe([c.property()],ge.prototype,"value",2);qe([c.property({type:Array})],ge.prototype,"options",2);qe([c.property({type:Boolean})],ge.prototype,"disabled",2);qe([c.property({reflect:!0})],ge.prototype,"direction",2);qe([c.property({reflect:!0})],ge.prototype,"columns",2);ge=qe([c.customElement("ap-radio-group")],ge);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let ut=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};ut.styles=[o.css`
6109
+ `];He([c.property()],me.prototype,"value",2);He([c.property({type:Array})],me.prototype,"options",2);He([c.property({type:Boolean})],me.prototype,"disabled",2);He([c.property({reflect:!0})],me.prototype,"direction",2);He([c.property({reflect:!0})],me.prototype,"columns",2);me=He([c.customElement("ap-radio-group")],me);var wr=Object.defineProperty,$r=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?$r(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&wr(e,s,a),a};let ut=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};ut.styles=[o.css`
6057
6110
  :host {
6058
6111
  display: inline-flex;
6059
6112
  }
@@ -6066,7 +6119,7 @@
6066
6119
  @keyframes spin {
6067
6120
  to { transform: rotate(360deg); }
6068
6121
  }
6069
- `];Es([c.property({type:Number})],ut.prototype,"size",2);ut=Es([c.customElement("ap-spinner")],ut);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,xt=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let Re=class extends o.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return o.html`
6122
+ `];As([c.property({type:Number})],ut.prototype,"size",2);ut=As([c.customElement("ap-spinner")],ut);var kr=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,xt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&kr(e,s,a),a};let je=class extends o.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return o.html`
6070
6123
  <div class="backdrop" @click=${e=>{e.target===e.currentTarget&&this._handleCancel()}}>
6071
6124
  <div class="dialog">
6072
6125
  <div class="title">Add folder contents</div>
@@ -6088,7 +6141,7 @@
6088
6141
  </div>
6089
6142
  </div>
6090
6143
  </div>
6091
- `}};Re.styles=[ee,o.css`
6144
+ `}};je.styles=[re,o.css`
6092
6145
  :host {
6093
6146
  display: block;
6094
6147
  }
@@ -6161,7 +6214,7 @@
6161
6214
  align-items: center;
6162
6215
  gap: 8px;
6163
6216
  }
6164
- `];xt([c.property({type:Array})],Re.prototype,"folders",2);xt([c.property({type:Boolean})],Re.prototype,"loading",2);xt([c.state()],Re.prototype,"_mode",2);Re=xt([c.customElement("ap-folder-resolve-dialog")],Re);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let je=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
6217
+ `];xt([c.property({type:Array})],je.prototype,"folders",2);xt([c.property({type:Boolean})],je.prototype,"loading",2);xt([c.state()],je.prototype,"_mode",2);je=xt([c.customElement("ap-folder-resolve-dialog")],je);var Cr=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Er(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Cr(e,s,a),a};let Ne=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
6165
6218
  <div class="box">
6166
6219
  <svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
6167
6220
  <path d="M20 6 9 17l-5-5"></path>
@@ -6171,7 +6224,7 @@
6171
6224
  </svg>
6172
6225
  </div>
6173
6226
  <span class="label" ?hidden=${!this._hasLabel}><slot @slotchange=${this._onSlotChange}></slot></span>
6174
- `}};je.styles=[o.css`
6227
+ `}};Ne.styles=[o.css`
6175
6228
  :host {
6176
6229
  display: inline-flex;
6177
6230
  align-items: center;
@@ -6230,7 +6283,7 @@
6230
6283
  .label[hidden] {
6231
6284
  display: none;
6232
6285
  }
6233
- `];wt([c.property({type:Boolean,reflect:!0})],je.prototype,"checked",2);wt([c.property({type:Boolean,reflect:!0})],je.prototype,"indeterminate",2);wt([c.property({type:Boolean,reflect:!0})],je.prototype,"disabled",2);je=wt([c.customElement("ap-checkbox")],je);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let gt=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
6286
+ `];wt([c.property({type:Boolean,reflect:!0})],Ne.prototype,"checked",2);wt([c.property({type:Boolean,reflect:!0})],Ne.prototype,"indeterminate",2);wt([c.property({type:Boolean,reflect:!0})],Ne.prototype,"disabled",2);Ne=wt([c.customElement("ap-checkbox")],Ne);var Fr=Object.defineProperty,Ar=Object.getOwnPropertyDescriptor,Ts=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ar(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fr(e,s,a),a};let gt=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
6234
6287
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
6235
6288
  <div class="content ${this.open?"open":""}">
6236
6289
  <slot></slot>
@@ -6256,7 +6309,7 @@
6256
6309
  .content.open {
6257
6310
  display: block;
6258
6311
  }
6259
- `];Fs([c.state()],gt.prototype,"open",2);gt=Fs([c.customElement("ap-popover")],gt);var Er=Object.defineProperty,Fr=Object.getOwnPropertyDescriptor,U=(t,e,s,i)=>{for(var a=i>1?void 0:i?Fr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Er(e,s,a),a};let z=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
6312
+ `];Ts([c.state()],gt.prototype,"open",2);gt=Ts([c.customElement("ap-popover")],gt);var Tr=Object.defineProperty,Mr=Object.getOwnPropertyDescriptor,K=(t,e,s,i)=>{for(var a=i>1?void 0:i?Mr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Tr(e,s,a),a};let N=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
6260
6313
  <button
6261
6314
  class="trigger"
6262
6315
  role="combobox"
@@ -6295,7 +6348,7 @@
6295
6348
  `)}
6296
6349
  </div>
6297
6350
  `:o.nothing}
6298
- `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};z.styles=[ee,o.css`
6351
+ `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};N.styles=[re,o.css`
6299
6352
  :host {
6300
6353
  position: relative;
6301
6354
  display: inline-block;
@@ -6375,7 +6428,7 @@
6375
6428
  .option[aria-selected="true"] ap-icon {
6376
6429
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
6377
6430
  }
6378
- `];U([c.property()],z.prototype,"value",2);U([c.property()],z.prototype,"label",2);U([c.property({reflect:!0})],z.prototype,"variant",2);U([c.property({type:Array})],z.prototype,"options",2);U([c.state()],z.prototype,"_open",2);U([c.state()],z.prototype,"_focusedIndex",2);U([c.state()],z.prototype,"_menuPosition",2);U([c.state()],z.prototype,"_menuAlign",2);U([c.state()],z.prototype,"_menuTop",2);U([c.state()],z.prototype,"_menuBottom",2);U([c.state()],z.prototype,"_menuLeft",2);U([c.state()],z.prototype,"_menuRight",2);z=U([c.customElement("ap-dropdown")],z);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?Tr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ar(e,s,a),a};let ft=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};ft.styles=[o.css`
6431
+ `];K([c.property()],N.prototype,"value",2);K([c.property()],N.prototype,"label",2);K([c.property({reflect:!0})],N.prototype,"variant",2);K([c.property({type:Array})],N.prototype,"options",2);K([c.state()],N.prototype,"_open",2);K([c.state()],N.prototype,"_focusedIndex",2);K([c.state()],N.prototype,"_menuPosition",2);K([c.state()],N.prototype,"_menuAlign",2);K([c.state()],N.prototype,"_menuTop",2);K([c.state()],N.prototype,"_menuBottom",2);K([c.state()],N.prototype,"_menuLeft",2);K([c.state()],N.prototype,"_menuRight",2);N=K([c.customElement("ap-dropdown")],N);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Ms=(t,e,s,i)=>{for(var a=i>1?void 0:i?Or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lr(e,s,a),a};let ft=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};ft.styles=[o.css`
6379
6432
  :host {
6380
6433
  display: inline-flex;
6381
6434
  }
@@ -6394,10 +6447,10 @@
6394
6447
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
6395
6448
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
6396
6449
  }
6397
- `];As([c.property({reflect:!0})],ft.prototype,"variant",2);ft=As([c.customElement("ap-badge")],ft);var Mr=Object.defineProperty,Lr=Object.getOwnPropertyDescriptor,Ts=(t,e,s,i)=>{for(var a=i>1?void 0:i?Lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};let mt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
6450
+ `];Ms([c.property({reflect:!0})],ft.prototype,"variant",2);ft=Ms([c.customElement("ap-badge")],ft);var Ir=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,Ls=(t,e,s,i)=>{for(var a=i>1?void 0:i?Pr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ir(e,s,a),a};let vt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
6398
6451
  <slot></slot>
6399
6452
  <div class="tip">${this.text}</div>
6400
- `}};mt.styles=[o.css`
6453
+ `}};vt.styles=[o.css`
6401
6454
  :host {
6402
6455
  position: relative;
6403
6456
  display: inline-flex;
@@ -6420,22 +6473,25 @@
6420
6473
  :host(:hover) .tip {
6421
6474
  display: block;
6422
6475
  }
6423
- `];Ts([c.property()],mt.prototype,"text",2);mt=Ts([c.customElement("ap-tooltip")],mt);var Or=Object.defineProperty,$t=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&Or(e,s,a),a};const Gt=class Gt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=js(),this.storeCtrl=new Ns(this,this.store),this.selectionCtrl=new Us(this,this.store),this.infiniteScrollCtrl=new Vs(this,()=>this._loadMore()),this.marqueeCtrl=new qs(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=It(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=zi(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Ni(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Hs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const m=await Qs(this.apiClient);this.apiClient.setSassKey(m),this.store.setState({sassKey:m})}const[r,n,l,d]=await Promise.allSettled([mi(this.apiClient),Xs(this.apiClient),Ws(this.apiClient),gi(this.apiClient)]),h={};if(r.status==="fulfilled"){const{fields:m,regionalVariantGroups:_,regionalFilters:x,brandColor:$}=r.value;h.metadataFields=m,h.regionalVariantGroups=_,h.regionalFilters=x,$&&(h.brandColor=$)}n.status==="fulfilled"&&(h.labels=n.value.labels||[]),l.status==="fulfilled"&&(h.tags=l.value),d.status==="fulfilled"&&(h.fileTypes=d.value);const{pinnedFilters:u,pinnedMetadata:f}=Pi(e.auth.projectToken??null),p=this.store.getState().filters;h.filters={...p,pinned:u,visible:[...u],metadata:{...p.metadata,pinned:f,visible:[...f]}},this.store.setState(h);const g=e.brandColor||h.brandColor||this.store.getState().brandColor;g&&(h.brandColor||this.store.setState({brandColor:g}),Gi(this,g))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,f,p,g;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=It((h=this.config)==null?void 0:h.defaultFilters);for(const[m,_]of Object.entries(a))s.has(m)||(i[m]=_);const r=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],l=(f=this.config)!=null&&f.rememberLastTab?Ui(this.config.auth.projectToken):null,d=(l&&n.includes(l)?l:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...r])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((g=this.config)==null?void 0:g.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,l,d,h,u,f,p,g,m,_,x;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const $=s.activeTab;if($==="assets"){const k=this._buildSearchNotation(),A=s.currentFolderPath||"/",O=He(this.apiClient,{folder:A,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:k||void 0,recursive:1}),S=Wt(this.apiClient,{folder:A,q:k||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[T,C]=await Promise.all([O,S]);if(e!==this._loadId)return;const Q=((i=T.files)==null?void 0:i.length)??0,ae=Q>=s.limit,X=((a=C==null?void 0:C.stats)==null?void 0:a.approx_files_count)??((r=C==null?void 0:C.info)==null?void 0:r.total_files_count)??((n=T.info)==null?void 0:n.total_files_count)??((d=(l=T.base)==null?void 0:l.count)==null?void 0:d.files_recursive)??((u=(h=T.base)==null?void 0:h.count)==null?void 0:u.files_direct)??Q;this.store.setState({assets:T.files||[],folders:[],totalCount:X,totalFolderCount:0,offset:0,hasMore:ae,isLoading:!1})}else if($==="folders"){const k=this._buildSearchNotation(),A=s.currentFolderPath||"/",[O,S,T]=await Promise.all([Ks(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),He(this.apiClient,{folder:A,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:k||void 0,recursive:0}),Wt(this.apiClient,{folder:A,q:k||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const C=O.folders||[];let Q={};if(C.length>0)try{Q=await Ys(this.apiClient,C.map(ve=>ve.uuid))}catch{}if(e!==this._loadId)return;const ae=((f=S.files)==null?void 0:f.length)??0,X=ae>=s.limit,it=((p=T==null?void 0:T.stats)==null?void 0:p.approx_files_count)??((g=T==null?void 0:T.info)==null?void 0:g.total_files_count)??((m=S.info)==null?void 0:m.total_files_count)??((x=(_=S.base)==null?void 0:_.count)==null?void 0:x.files_direct)??ae;this.store.setState({assets:S.files||[],folders:C,folderPreviews:Q,totalCount:it,totalFolderCount:O.total??C.length,offset:0,hasMore:X,isLoading:!1})}}catch($){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:$,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const a=this._buildSearchNotation(),r=await He(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,l=r.files||[],d=l.length>=e.limit,h=[...n,...l];this.store.setState({assets:h,offset:i,hasMore:d,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&ji(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),ss(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),ss(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Bi(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&is(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var l,d;const s=e.detail.uuid,i=this.store.getState(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((l=this.config)==null?void 0:l.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&is(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Ri(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),r=[];let n=s.endsWith("/")?s:s+"/";for(const l of a)n+=l+"/",r.push({uuid:n,name:l,path:n});return r}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,r,n,l,d,h;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1){if(((r=this.config)==null?void 0:r.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,s,i),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s,folders:i},bubbles:!0,composed:!0})),this._isInline||this.close();return}(h=(d=this.config)==null?void 0:d.onSelect)==null||h.call(d,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleFolderResolveConfirm(e){var r,n,l;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const d=await Promise.all(i.map(m=>He(this.apiClient,{folder:m.path,recursive:s==="recursive"?1:0,limit:1e4}))),h=[];for(const m of d)h.push(...m.files);const u=[...a],f=new Set(u.map(m=>m.uuid));for(const m of h)f.has(m.uuid)||(u.push(m),f.add(m.uuid));const p=(r=this.config)==null?void 0:r.maxSelections,g=p?u.slice(0,p):u;(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,g),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:g},bubbles:!0,composed:!0})),this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._isInline||this.close()}catch(d){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:d,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",r=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){r&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){r&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const l=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const f=this._buildSearchNotation(),p=s.currentFolderPath||"/",g=s.limit,m=s.assets,_=s.totalCount,x=s.activeTab==="folders"?0:1,$=[];for(let C=m.length;C<_;C+=g)$.push(C);const k=4,A=[];for(let C=0;C<$.length;C+=k){if(l!==this._selectAllId)return;const Q=$.slice(C,C+k),ae=await Promise.all(Q.map(X=>He(this.apiClient,{folder:p,offset:X,limit:g,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:f||void 0,recursive:x})));if(l!==this._selectAllId)return;for(const X of ae)X.files&&A.push(...X.files)}if(l!==this._selectAllId)return;const O=new Set(m.map(C=>C.uuid)),S=A.filter(C=>O.has(C.uuid)?!1:(O.add(C.uuid),!0)),T=[...m,...S];this.store.setState({assets:T,offset:Math.max(0,T.length-g),hasMore:!1,isSelectingAll:!1}),r&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(T)}catch(f){if(l!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:f,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===v.DATE||e===v.LICENSE_EXPIRY||e===R.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let l=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!l&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;l=!d&&!h&&!u&&!f}if(l){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===v.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,g,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const _=a.renderRoot.querySelectorAll(".chip.pinned-empty"),x=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const $ of _){const k=(m=(g=$.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:m.trim();if(i&&k===x){n=$;break}if(s&&k===(Le[s]||s)){n=$;break}}}if(!n)return;const l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left,f=h?l.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},r={...a.applied};delete r[s],a.applied=r,a.pinned.includes(s)||(a.visible=a.visible.filter(l=>l!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:r}=e.detail,l={...this.store.getState().filters},d={...l.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),l.metadata=d,this.store.setState({filters:l,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(l=>l!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(l=>l!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,d;const{key:s,pinned:i}=e.detail,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;Ii(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Di(l,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Ki:e.activeTab==="folders"?Yi:Rt}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return _i(s,e.filters.metadata.applied).join(" ")}render(){var p,g,m,_,x,$,k,A,O,S,T;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),r=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,l=o.html`
6476
+ `];Ls([c.property()],vt.prototype,"text",2);vt=Ls([c.customElement("ap-tooltip")],vt);var Dr=Object.defineProperty,$t=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&Dr(e,s,a),a};const Yt=class Yt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Us(),this.storeCtrl=new Vs(this,this.store),this.selectionCtrl=new Hs(this,this.store),this.infiniteScrollCtrl=new Gs(this,()=>this._loadMore()),this.marqueeCtrl=new Ks(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=zt(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Ni(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Vi(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Ys(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const v=await ei(this.apiClient);this.apiClient.setSassKey(v),this.store.setState({sassKey:v})}const[r,n,l,d]=await Promise.allSettled([_i(this.apiClient),Zs(this.apiClient),Js(this.apiClient),mi(this.apiClient)]),h={};if(r.status==="fulfilled"){const{fields:v,regionalVariantGroups:_,regionalFilters:y,brandColor:$}=r.value;h.metadataFields=v,h.regionalVariantGroups=_,h.regionalFilters=y,$&&(h.brandColor=$)}n.status==="fulfilled"&&(h.labels=n.value.labels||[]),l.status==="fulfilled"&&(h.tags=l.value),d.status==="fulfilled"&&(h.fileTypes=d.value);const{pinnedFilters:u,pinnedMetadata:f}=zi(e.auth.projectToken??null),p=this.store.getState().filters;h.filters={...p,pinned:u,visible:[...u],metadata:{...p.metadata,pinned:f,visible:[...f]}},this.store.setState(h);const g=e.brandColor||h.brandColor||this.store.getState().brandColor;g&&(h.brandColor||this.store.setState({brandColor:g}),Qi(this,g))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,f,p,g,v,_;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=zt((h=this.config)==null?void 0:h.defaultFilters);for(const[y,$]of Object.entries(a))s.has(y)||(i[y]=$);const r=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],l=(f=this.config)!=null&&f.rememberLastTab?Hi(this.config.auth.projectToken):null,d=(l&&n.includes(l)?l:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",isAISearchActive:!!((g=this.config)!=null&&g.enableAISearch&&((v=this.config)!=null&&v.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...r])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((_=this.config)==null?void 0:_.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,l,d,h,u,f,p,g,v,_,y,$,k,T,O;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const S=s.activeTab;if(S==="assets"){const z=this._buildSearchNotation(),E=s.currentFolderPath||"/",Y=s.isAISearchActive&&!!s.searchQuery,te=Ge(this.apiClient,{folder:E,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:z||void 0,recursive:1,...Y&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),I=Zt(this.apiClient,{folder:E,q:z||void 0,search:s.searchQuery||void 0,recursive:1,...Y&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[P,R]=await Promise.all([te,I]);if(e!==this._loadId)return;const q=((r=P.files)==null?void 0:r.length)??0,kt=q>=s.limit,St=((n=R==null?void 0:R.stats)==null?void 0:n.approx_files_count)??((l=R==null?void 0:R.info)==null?void 0:l.total_files_count)??((d=P.info)==null?void 0:d.total_files_count)??((u=(h=P.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(f=P.base)==null?void 0:f.count)==null?void 0:p.files_direct)??q;this.store.setState({assets:P.files||[],folders:[],totalCount:St,totalFolderCount:0,offset:0,hasMore:kt,isLoading:!1})}else if(S==="folders"){const z=this._buildSearchNotation(),E=s.currentFolderPath||"/",[Y,te,I]=await Promise.all([Xs(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ge(this.apiClient,{folder:E,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:z||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((g=s.config)==null?void 0:g.locale)??"en"}}),Zt(this.apiClient,{folder:E,q:z||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((v=s.config)==null?void 0:v.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const P=Y.folders||[];let R={};if(P.length>0)try{R=await Ws(this.apiClient,P.map(Os=>Os.uuid))}catch{}if(e!==this._loadId)return;const q=((_=te.files)==null?void 0:_.length)??0,kt=q>=s.limit,St=((y=I==null?void 0:I.stats)==null?void 0:y.approx_files_count)??(($=I==null?void 0:I.info)==null?void 0:$.total_files_count)??((k=te.info)==null?void 0:k.total_files_count)??((O=(T=te.base)==null?void 0:T.count)==null?void 0:O.files_direct)??q;this.store.setState({assets:te.files||[],folders:P,folderPreviews:R,totalCount:St,totalFolderCount:Y.total??P.length,offset:0,hasMore:kt,isLoading:!1})}}catch(S){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:S,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const r=this._buildSearchNotation(),n=await Ge(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:r||void 0,recursive:e.activeTab==="folders"?0:1,...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((a=e.config)==null?void 0:a.locale)??"en"}});if(s!==this._loadMoreId)return;const l=this.store.getState().assets,d=n.files||[],h=d.length>=e.limit,u=[...l,...d];this.store.setState({assets:u,offset:i,hasMore:h,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){const s={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};this.store.getState().isAISearchActive&&e.detail.value&&(s.sortBy="relevance"),this.store.setState(s),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var r;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((r=this.config)==null?void 0:r.defaultSortBy)??"created_at"),a.offset=0,a.assets=[],a.folders=[],a.isLoading=!0),this.store.setState(a),i.searchQuery&&this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Ui(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),as(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),as(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&qi(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&rs(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var l,d;const s=e.detail.uuid,i=this.store.getState(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((l=this.config)==null?void 0:l.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&rs(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Bi(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),r=[];let n=s.endsWith("/")?s:s+"/";for(const l of a)n+=l+"/",r.push({uuid:n,name:l,path:n});return r}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,r,n,l,d,h;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1){if(((r=this.config)==null?void 0:r.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,s,i),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s,folders:i},bubbles:!0,composed:!0})),this._isInline||this.close();return}(h=(d=this.config)==null?void 0:d.onSelect)==null||h.call(d,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleFolderResolveConfirm(e){var r,n,l;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const d=await Promise.all(i.map(v=>Ge(this.apiClient,{folder:v.path,recursive:s==="recursive"?1:0,limit:1e4}))),h=[];for(const v of d)h.push(...v.files);const u=[...a],f=new Set(u.map(v=>v.uuid));for(const v of h)f.has(v.uuid)||(u.push(v),f.add(v.uuid));const p=(r=this.config)==null?void 0:r.maxSelections,g=p?u.slice(0,p):u;(l=(n=this.config)==null?void 0:n.onSelect)==null||l.call(n,g),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:g},bubbles:!0,composed:!0})),this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._isInline||this.close()}catch(d){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:d,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",r=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){r&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){r&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const l=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const f=this._buildSearchNotation(),p=s.currentFolderPath||"/",g=s.limit,v=s.assets,_=s.totalCount,y=s.activeTab==="folders"?0:1,$=[];for(let E=v.length;E<_;E+=g)$.push(E);const k=4,T=[];for(let E=0;E<$.length;E+=k){if(l!==this._selectAllId)return;const Y=$.slice(E,E+k),te=await Promise.all(Y.map(I=>{var P;return Ge(this.apiClient,{folder:p,offset:I,limit:g,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:f||void 0,recursive:y,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((P=s.config)==null?void 0:P.locale)??"en"}})}));if(l!==this._selectAllId)return;for(const I of te)I.files&&T.push(...I.files)}if(l!==this._selectAllId)return;const O=new Set(v.map(E=>E.uuid)),S=T.filter(E=>O.has(E.uuid)?!1:(O.add(E.uuid),!0)),z=[...v,...S];this.store.setState({assets:z,offset:Math.max(0,z.length-g),hasMore:!1,isSelectingAll:!1}),r&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(z)}catch(f){if(l!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:f,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===m.DATE||e===m.LICENSE_EXPIRY||e===B.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let l=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!l&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;l=!d&&!h&&!u&&!f}if(l){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===m.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,g,v;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const _=a.renderRoot.querySelectorAll(".chip.pinned-empty"),y=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const $ of _){const k=(v=(g=$.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:v.trim();if(i&&k===y){n=$;break}if(s&&k===(Oe[s]||s)){n=$;break}}}if(!n)return;const l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left,f=h?l.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},r={...a.applied};delete r[s],a.applied=r,a.pinned.includes(s)||(a.visible=a.visible.filter(l=>l!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:r}=e.detail,l={...this.store.getState().filters},d={...l.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),l.metadata=d,this.store.setState({filters:l,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(l=>l!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(l=>l!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,d;const{key:s,pinned:i}=e.detail,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;Ri(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;ji(l,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Xi:e.activeTab==="folders"?Wi:Nt}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return wi(s,e.filters.metadata.applied).join(" ")}render(){var p,g,v,_,y,$,k,T,O,S,z,E;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),r=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,l=o.html`
6424
6477
  <ap-header
6425
6478
  .activeTab=${e.activeTab}
6426
6479
  .tabs=${((g=this.config)==null?void 0:g.tabs)??["assets","folders"]}
6427
6480
  .viewMode=${e.viewMode}
6428
6481
  .searchQuery=${e.searchQuery}
6482
+ .enableAISearch=${!!((v=this.config)!=null&&v.enableAISearch)}
6483
+ .isAISearchActive=${e.isAISearchActive}
6429
6484
  .regionalGroups=${e.regionalVariantGroups}
6430
6485
  .regionalFilters=${e.regionalFilters}
6431
6486
  .hideClose=${this._isInline}
6432
6487
  @tab-change=${this._handleTabChange}
6433
6488
  @search-change=${this._handleSearchChange}
6489
+ @ai-search-toggle=${this._handleAISearchToggle}
6434
6490
  @view-change=${this._handleViewChange}
6435
6491
  @regional-change=${this._handleRegionalChange}
6436
6492
  @ap-close=${()=>this._handleCancel("close-button")}
6437
6493
  ></ap-header>
6438
- `,d=!!((m=this.config)!=null&&m.uploader),h=o.html`
6494
+ `,d=!!((_=this.config)!=null&&_.uploader),h=o.html`
6439
6495
  <div class="content-area"
6440
6496
  @dragenter=${this._onDragEnter}
6441
6497
  @dragover=${this._onDragOver}
@@ -6451,7 +6507,7 @@
6451
6507
  </div>
6452
6508
  `:o.nothing}
6453
6509
  <div class="main-content">
6454
- <div class="toolbar-filters-wrapper${(_=this.config)!=null&&_.stickyFilters?" sticky":""}">
6510
+ <div class="toolbar-filters-wrapper${(y=this.config)!=null&&y.stickyFilters?" sticky":""}">
6455
6511
  <ap-content-toolbar
6456
6512
  .isLoading=${e.isLoading}
6457
6513
  .totalCount=${e.totalCount}
@@ -6488,7 +6544,7 @@
6488
6544
  .labels=${e.labels}
6489
6545
  .pinnedFilters=${e.filters.pinned}
6490
6546
  .pinnedMetadataFields=${e.filters.metadata.pinned}
6491
- .forcedFilters=${((x=this.config)==null?void 0:x.forcedFilters)??{}}
6547
+ .forcedFilters=${(($=this.config)==null?void 0:$.forcedFilters)??{}}
6492
6548
  @filter-remove=${this._handleFilterRemove}
6493
6549
  @filter-deactivate=${this._handleFilterDeactivate}
6494
6550
  @filter-open=${this._handleFilterOpen}
@@ -6506,7 +6562,7 @@
6506
6562
  ></ap-breadcrumb>`:o.nothing}
6507
6563
  </div>
6508
6564
 
6509
- ${e.isLoading&&e.assets.length===0&&e.folders.length===0?o.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${(($=this.config)==null?void 0:$.gridSize)??"normal"} .multiSelect=${((k=this.config)==null?void 0:k.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
6565
+ ${e.isLoading&&e.assets.length===0&&e.folders.length===0?o.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((k=this.config)==null?void 0:k.gridSize)??"normal"} .multiSelect=${((T=this.config)==null?void 0:T.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
6510
6566
 
6511
6567
  <ap-marquee-overlay .active=${this.marqueeCtrl.isActive} .rect=${this.marqueeCtrl.rect}></ap-marquee-overlay>
6512
6568
  ${this._folderResolveOpen?o.html`
@@ -6524,11 +6580,11 @@
6524
6580
  .assets=${e.assets}
6525
6581
  .selectedIds=${s}
6526
6582
  .containerToken=${e.projectToken}
6527
- .showMetadata=${((A=this.config)==null?void 0:A.showMetadata)!==!1}
6583
+ .showMetadata=${((O=this.config)==null?void 0:O.showMetadata)!==!1}
6528
6584
  .metadataFields=${e.metadataFields}
6529
6585
  .labels=${e.labels}
6530
6586
  .regionalFilters=${e.regionalFilters}
6531
- .multiSelect=${((O=this.config)==null?void 0:O.multiSelect)??!0}
6587
+ .multiSelect=${((S=this.config)==null?void 0:S.multiSelect)??!0}
6532
6588
  @preview-close=${this._handlePreviewClose}
6533
6589
  @preview-navigate=${this._handlePreviewNavigate}
6534
6590
  @asset-select=${this._handleAssetSelect}
@@ -6543,8 +6599,8 @@
6543
6599
  .totalCount=${e.totalCount}
6544
6600
  .totalFolderCount=${e.totalFolderCount}
6545
6601
  .isSelectingAll=${e.isSelectingAll}
6546
- .multiSelect=${((S=this.config)==null?void 0:S.multiSelect)??!0}
6547
- .maxSelections=${(T=this.config)==null?void 0:T.maxSelections}
6602
+ .multiSelect=${((z=this.config)==null?void 0:z.multiSelect)??!0}
6603
+ .maxSelections=${(E=this.config)==null?void 0:E.maxSelections}
6548
6604
  @selection-confirm=${this._handleSelectionConfirm}
6549
6605
  @selection-clear=${this._handleSelectionClear}
6550
6606
  @selection-deselect=${this._handleSelectionDeselect}
@@ -6565,7 +6621,7 @@
6565
6621
  `:o.nothing:o.html`
6566
6622
  <ap-modal
6567
6623
  ?open=${e.isOpen}
6568
- @ap-cancel=${C=>this._handleCancel(C.detail.reason)}
6624
+ @ap-cancel=${Y=>this._handleCancel(Y.detail.reason)}
6569
6625
  >
6570
6626
  ${this._isUploaderOpen?f:o.html`
6571
6627
  <div slot="header">${l}</div>
@@ -6659,7 +6715,7 @@
6659
6715
  @selection-clear=${this._handleSelectionClear}
6660
6716
  ></ap-list-view>
6661
6717
  <div id="sentinel"></div>
6662
- `:o.nothing}};Gt.styles=[o.css`
6718
+ `:o.nothing}};Yt.styles=[o.css`
6663
6719
  :host {
6664
6720
  display: contents;
6665
6721
  font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
@@ -6806,4 +6862,4 @@
6806
6862
  width: 100%;
6807
6863
  height: 100%;
6808
6864
  }
6809
- `];let Ee=Gt;$t([c.state()],Ee.prototype,"_isDragOver");$t([c.state()],Ee.prototype,"_isUploaderOpen");$t([c.state()],Ee.prototype,"_folderResolveOpen");$t([c.property({type:Object})],Ee.prototype,"config");exports.AssetPicker=Ee;exports.getHlsUrl=Cs;
6865
+ `];let Fe=Yt;$t([c.state()],Fe.prototype,"_isDragOver");$t([c.state()],Fe.prototype,"_isUploaderOpen");$t([c.state()],Fe.prototype,"_folderResolveOpen");$t([c.property({type:Object})],Fe.prototype,"config");exports.AssetPicker=Fe;exports.getHlsUrl=Fs;