@scaleflex/asset-picker 1.0.4 → 1.0.6

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.
Files changed (36) hide show
  1. package/.claude/scheduled_tasks.lock +1 -0
  2. package/.claude/settings.local.json +26 -3
  3. package/README.md +17 -3
  4. package/dist/{asset-picker-cnvFGhJa.cjs → asset-picker-DX9-6sK9.cjs} +776 -588
  5. package/dist/{asset-picker-dDQ9kiNT.js → asset-picker-tb3L6px1.js} +2081 -1731
  6. package/dist/asset-picker.d.ts +8 -0
  7. package/dist/asset-picker.d.ts.map +1 -1
  8. package/dist/components/shared/ap-create-folder-dialog.d.ts +28 -0
  9. package/dist/components/shared/ap-create-folder-dialog.d.ts.map +1 -0
  10. package/dist/components/shared/ap-icon.d.ts.map +1 -1
  11. package/dist/components/toolbar/ap-content-toolbar.d.ts +2 -0
  12. package/dist/components/toolbar/ap-content-toolbar.d.ts.map +1 -1
  13. package/dist/define.cjs +1 -1
  14. package/dist/define.js +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -1
  19. package/dist/services/auth.service.d.ts +5 -1
  20. package/dist/services/auth.service.d.ts.map +1 -1
  21. package/dist/services/folders.service.d.ts +7 -0
  22. package/dist/services/folders.service.d.ts.map +1 -1
  23. package/dist/store/index.d.ts.map +1 -1
  24. package/dist/store/store.types.d.ts +2 -0
  25. package/dist/store/store.types.d.ts.map +1 -1
  26. package/dist/types/api.types.d.ts +5 -0
  27. package/dist/types/api.types.d.ts.map +1 -1
  28. package/dist/types/config.types.d.ts +7 -0
  29. package/dist/types/config.types.d.ts.map +1 -1
  30. package/dist/types/folder.types.d.ts +13 -1
  31. package/dist/types/folder.types.d.ts.map +1 -1
  32. package/dist/types/permission.types.d.ts +16 -0
  33. package/dist/types/permission.types.d.ts.map +1 -0
  34. package/dist/utils/permissions.d.ts +11 -0
  35. package/dist/utils/permissions.d.ts.map +1 -0
  36. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- "use strict";var Fi=Object.create;var Hs=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Ai=Object.getOwnPropertyNames;var Ti=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty;var Oi=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ai(e))!Li.call(t,a)&&a!==s&&Hs(t,a,{get:()=>e[a],enumerable:!(i=Ei(e,a))||i.enumerable});return t};var Mi=(t,e,s)=>(s=t!=null?Fi(Ti(t)):{},Oi(e||!t||!t.__esModule?Hs(s,"default",{value:t,enumerable:!0}):s,t));const r=require("lit"),l=require("lit/decorators.js"),ps=require("lit/directive.js");class Pi{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 Ii(){return new Pi({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:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,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 Di{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 zi(t){return"extension"in t&&!("path"in t)}class Ri{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 o=this._getCombinedList();for(let n=e;n<=s;n++){const c=o[n];c&&(zi(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),o=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=new Map(a.selectedFolders);this._applyRangeSelection(g,p,o,f);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&o.size+f.size>m)return;this.store.setState({selectedAssets:o,selectedFolders:f})}else{const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=a.assets;for(let x=g;x<=p;x++)f[x]&&o.set(f[x].uuid,f[x]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&o.size>m)return;this.store.setState({selectedAssets:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const g=(u=a.config)==null?void 0:u.maxSelections,p=o.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(g&&p>g)return;this.store.setState({selectedAssets:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),o=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),g=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,g,p,o);const f=(d=a.config)==null?void 0:d.maxSelections;if(f&&p.size+o.size>f)return;this.store.setState({selectedAssets:p,selectedFolders:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,g=o.size+a.selectedAssets.size;if(u&&g>u)return;this.store.setState({selectedFolders:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,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 c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,o=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)o.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:o}),this.lastClickedIndex=-1,o.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,o=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let c=0;c<o;c++)a.set(e[c].uuid,e[c]);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 ji{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 Gs=5,et=40,Ks=15;class Ni{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<Gs&&a<Gs)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 o=Math.min(this.startX,i),n=Math.min(this.startY,a),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;o+c>h&&(c=h-o),n+d>u&&(d=u-n),o<0&&(c+=o,o=0),n<0&&(d+=n,n=0),this.rect={x:o,y:n,width:c,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,o=i<et||a<et;o&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):o||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 o=0;i<et?o=-Ks*(1-i/et):a<et&&(o=Ks*(1-a/et)),o!==0&&(this.container.scrollTop+=o,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 o=i.shadowRoot.querySelectorAll("[data-folder-uuid]");o.length>0&&s.push(...Array.from(o))}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(),o=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(x=>x.uuid===f);m&&o.set(f,m)}}),s&&a.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(x=>x.uuid===f);m&&n.set(f,m)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=o.size+(s?n.size:0);if(c&&d>c){const g=Array.from(o.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(g),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:o,...s?{selectedFolders:n}:{}})}}class Ui{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(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function Bi(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 o=[];return t.search&&!t.with_ai&&o.push(t.search),t.q&&o.push(t.q),o.length>0&&(e.q=o.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)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function ze(t,e){const s=Bi(e);return t.request("/files",s)}async function Tt(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const 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)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function qi(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",o={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${o[i]||i}:${a}`,await t.request("/folders",s)}async function Vi(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Hi(t){return await t.request("/labels")}async function Gi(t){return t.request("/collections")}async function Ki(t,e){return t.request(`/collections/${e}/folders`)}function ii(t){return t.filter(e=>!!e.name).map(e=>({...e,children:ii(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Qi(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 Yi(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}function Ht(t){var a,o;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(o=e[0])==null?void 0:o.playlists;return s!=null&&s.length&&s[0]||null}function Ne(t){return(t.type??"").startsWith("image")}function Wi(t){return(t.type??"").startsWith("video")}function Xi(t){return(t.type??"").startsWith("audio")}function ai(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function Zi(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const o=Object.keys(a)[0];if(o){const n=a[o];if(n)return n}}return i.split(".")[0]}function Dt(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function zt(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function Ji(t){return{width:Dt(t),height:zt(t)}}function ea(t){return Ht(t)!==null}function ta(t){return Ht(t)}function sa(t){return Ht(t)??ai(t)}const ia={excellent:90,good:75,fair:60},aa=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],oa=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],ra=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],na={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},la=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),ca=new Set([...la,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function st(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 oi(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ca.has(e)}const v="https://scaleflex.cloudimg.io/v7/assets/file-types/v3/",hs={_default:v+"GENERIC.svg?vh=9a518a",png:v+"PNG.svg?vh=96cd9a",jpg:v+"JPG.svg?vh=06e819",jpg2:v+"JPG2.svg?vh=f0eb7f",jpeg:v+"JPEG.svg?vh=6a65e9",gif:v+"GIF.svg?vh=c3c2c3",bmp:v+"BMP.svg?vh=d2243a",webp:v+"WEBP.svg?vh=fedd74",svg:v+"SVG.svg?vh=a15e46",tiff:v+"TIFF.svg?vh=1f30c3",tif:v+"TIF.svg?vh=b383c9",heic:v+"HEIC.svg?vh=84adfe",avif:v+"AVIF.svg?vh=536b30",ico:v+"ICO.svg?vh=79063d",psd:v+"PSD.svg?vh=be6140",psb:v+"PSB.svg?vh=678646",ai:v+"AI.svg?vh=84b254",dwg:v+"DWG.svg?vh=971fb3",mp4:v+"MP4.svg?vh=42f175",webm:v+"WEBM.svg?vh=26a84a",avi:v+"AVI.svg?vh=d22ba8",mpeg:v+"MPEG.svg?vh=ba93bb",ogv:v+"OGV.svg?vh=74d453","3gp":v+"3GP.svg?vh=f0d388","3g2":v+"3G2.svg?vh=04c652",swf:v+"SWF.svg?vh=3955e2",fla:v+"FLA.svg?vh=daf585",m3u8:v+"M3U8.svg?vh=7d5e62",mp3:v+"MP3.svg?vh=66bbef",wav:v+"WAV.svg?vh=d7a7d5",aac:v+"AAC.svg?vh=07f3f9",oga:v+"OGA.svg?vh=a5c622",opus:v+"OPUS.svg?vh=9548b1",weba:v+"WEBA.svg?vh=4dcf70",mid:v+"MID.svg?vh=3f0e29",midi:v+"MIDI.svg?vh=9fedec",cda:v+"CDA.svg?vh=85b83b",pdf:v+"PDF.svg?vh=18c5f7",doc:v+"DOC.svg?vh=d1b47c",docx:v+"DOCX.svg?vh=1eb6b0",txt:v+"TXT.svg?vh=307979",rtf:v+"RTF.svg?vh=978c5f",xls:v+"XLS.svg?vh=13b5f7",xlsx:v+"XLSX.svg?vh=79d64a",ppt:v+"PPT.svg?vh=4ee29b",pptx:v+"PPTX.svg?vh=8b1568",csv:v+"CSV.svg?vh=4add78",odt:v+"ODT.svg?vh=940781",ods:v+"ODS.svg?vh=9fbe9a",odp:v+"ODP.svg?vh=bf892d",dbf:v+"DBF.svg?vh=457bd4",vsd:v+"VSD.svg?vh=8a9ccb",abw:v+"ABW.svg?vh=313dc7",epub:v+"EPUB.svg?vh=15263d",azw:v+"AZW.svg?vh=a018b1",ics:v+"ICS.svg?vh=909f63",ogx:v+"OGX.svg?vh=f694d2",zip:v+"ZIP.svg?vh=84f98b",rar:v+"RAR.svg?vh=1d6423","7z":v+"7Z.svg?vh=e007e5",tar:v+"TAR.svg?vh=603aed",gz:v+"GZ.svg?vh=de13f7",bz:v+"BZ.svg?vh=0374ff",bz2:v+"BZ2.svg?vh=e14294",arc:v+"ARC.svg?vh=942fad",jar:v+"JAR.svg?vh=149796",mpkg:v+"MPKG.svg?vh=dea655",ttf:v+"TTF.svg?vh=d2e2c1",otf:v+"OTF.svg?vh=c904fd",woff:v+"WOFF.svg?vh=4b8177",woff2:v+"WOFF2.svg?vh=b532d3",eot:v+"EOT.svg?vh=a54980",js:v+"JS.svg?vh=524691",mjs:v+"MJS.svg?vh=d57921",ts:v+"TS.svg?vh=9af3ae",css:v+"CSS.svg?vh=287863",html:v+"HTML.svg?vh=fa7a87",htm:v+"HTM.svg?vh=21323d",xhtml:v+"XHTML.svg?vh=e6d6a9",xul:v+"XUL.svg?vh=6c9c71",json:v+"JSON.svg?vh=104c9e",jsonld:v+"JSONLD.svg?vh=f30c0f",xml:v+"XML.svg?vh=7f7194",php:v+"PHP.svg?vh=503e36",sh:v+"SH.svg?vh=3b820e",csh:v+"CSH.svg?vh=08c0cc",exe:v+"EXE.svg?vh=ccca53",iso:v+"ISO.svg?vh=064b8f",bin:v+"BIN.svg?vh=1e9618"};function kt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return hs[e]||hs._default}function it(){return hs._default}function Gt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const da=new Set(["png","svg","webp","gif","avif"]);function vs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return da.has(e)}const pa=new Set(["svg","svg+xml","png","pdf"]);function ri(t){return pa.has(Gt(t).toLowerCase())}function Rt(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 qe(s)}function ni(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?qe(s):""}function ms(t){var s,i;let e=qe(((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(/[?&]$/,""),we(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function we(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 Qs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function qe(t,e){if(!t)return"";const s=a=>a.replace(/(\.filerobot\.com\/[a-z0-9_-]+)\/v\d+\//i,"$1/");if(t.includes("assets.filerobot.com"))return s(t);const i=t.match(Qs);if(i){const a=i[2],o=t.replace(Qs,`$1assets.filerobot.com/${a}/`);return s(o)}if(e)try{const a=new URL(t);return s(`https://assets.filerobot.com/${e}${a.pathname}${a.search}`)}catch{}return t}function li(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=qe(s);const a=st(t.file_type),o=String(window.devicePixelRatio||1);return a==="video"?we(i,{w:e,dpr:o,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||Gt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),we(i,{w:e,dpr:o,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):we(i,{w:e,dpr:o})}function bs(t,e){const s={};return t.format&&(s.force_format=na[t.format]),t.quality&&t.format!=="png"&&(s.q=String(ia[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ha(t,e,s){const i=qe(t);if(!i)return t;const a=bs(e,s);return Object.keys(a).length>0?we(i,a):i}const b={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"},K={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},C={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},ua={AND:"AND"},$={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"},Kt={[$.DATE]:"date_",[$.BOOLEAN]:"bool_",[$.NUMERIC]:"num_",[$.DECIMAL2]:"dec_",[$.ATTACHMENTS_ASSETS]:"attach_",[$.ATTACHMENT_URI]:"uri_",[$.SELECT_ONE]:"one_",[$.MULTI_SELECT]:"multi_",[$.SUPERTAGS]:"tags_",[$.TEXT]:"text_",[$.TEXT_AREA]:"area_",[$.GEO_POINT]:"geo_",[$.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(Kt).map(([t,e])=>[e,t]));const ci=Object.values(Kt),ht={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Ys={EMPTY:"empty",NOT_EMPTY:"non-empty"},ne="empty",le="non-empty",Re="specific",es=10,ts=10,Lt=10,di="filters:pinned:",pi="metadata:pinned:",Ws=[b.DATE,b.TYPE,b.SIZE],hi=C.IS,Mt="20",Pt="1",ga=0,fa=[{key:b.DATE,label:"Date",icon:"calendar",type:"date"},{key:b.TYPE,label:"Format",icon:"file-type",type:"string"},{key:b.SIZE,label:"Size",icon:"scaling",type:"string"},{key:b.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:b.TAGS,label:"Tags",icon:"hash",type:"string"},{key:b.LABELS,label:"Labels",icon:"tag",type:"string"},{key:b.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:b.IMAGE,label:"Image",icon:"image",type:"string"},{key:b.COLOR,label:"Color",icon:"swatch-book",type:"string"}],va={key:b.METADATA,label:"Metadata",icon:"file-text",type:"string"},ma={key:b.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},us=[va,...fa,ma],tt={[b.TYPE]:"Format",[b.DATE]:"Date",[b.SIZE]:"Size",[b.LICENSE_EXPIRY]:"License expiry",[b.TAGS]:"Tags",[b.LABELS]:"Labels",[b.PRODUCT_REF]:"Products",[b.IMAGE]:"Image",[b.COLOR]:"Color",[b.METADATA]:"Metadata",[b.APPROVAL]:"Approval"},Q={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},jt=[{value:Q.IMAGE,label:"Image",icon:"image"},{value:Q.VIDEO,label:"Video",icon:"clapperboard"},{value:Q.AUDIO,label:"Audio",icon:"music"},{value:Q.DOCUMENT,label:"Document",icon:"document"},{value:Q.ARCHIVE,label:"Archive",icon:"archive"},{value:Q.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:Q.FONTS,label:"Fonts",icon:"text"},{value:Q.OTHER,label:"Other",icon:"layout-grid"}],ba={[Q.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[Q.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[Q.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[Q.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[Q.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[Q.FONTS]:["ttf","otf","woff","woff2","eot"]},ss={RESOLUTION:0,ORIENTATION:1,FACES:2},_a=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ya=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],xa=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],ui=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],_s=[{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"}],gi=[{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"}],wa=[{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"}],$a=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ka=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],is=[{label:"Is",value:C.IS},{label:"Contains",value:C.CONTAINS_IN_TEXT}],xe=[{label:"Is",value:C.IS},{label:"Is not",value:C.IS_NOT}],as=[{label:"Is",value:C.IS_EXACT},{label:"Contains",value:C.IS},{label:"Does not contain",value:C.IS_NOT}],os=[{label:"Is",value:C.IS},{label:"Greater than",value:C.GREATER_THAN_OR_EQUAL},{label:"Is not",value:C.IS_NOT},{label:"Less than",value:C.LESS_THAN_OR_EQUAL},{label:"Between",value:C.RANGE}],Sa=[{label:"Is",value:C.IS_EXACT},{label:"Is not",value:C.IS_NOT}],Xs=[{label:"Contains",value:C.CONTAINS},{label:"Does not contain",value:C.IS_NOT}],Ca=[{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))"}],Ue=[{label:"Empty",value:ne},{label:"Not empty",value:le}],rs=[...Ue,{label:"Specific",value:Re}],Fa=[{label:"Empty",value:ne},{label:"Not empty",value:le},{label:"True",value:"true"},{label:"False",value:"false"}],It={[$.DATE]:"calendar",[$.BOOLEAN]:"toggle-left",[$.NUMERIC]:"file-digit",[$.DECIMAL2]:"decimals-arrow-right",[$.ATTACHMENTS_ASSETS]:"paperclip",[$.ATTACHMENT_URI]:"link-2",[$.SELECT_ONE]:"circle-dot",[$.MULTI_SELECT]:"square-check",[$.SUPERTAGS]:"hash",[$.TEXT]:"text-initial",[$.TEXT_AREA]:"text-align-justify",[$.GEO_POINT]:"locate",[$.INTEGER_LIST]:"list-ordered"},Ea={[$.TEXT]:"text",[$.TEXT_AREA]:"text",[$.NUMERIC]:"number",[$.DECIMAL2]:"number",[$.BOOLEAN]:"boolean",[$.SELECT_ONE]:"select-one",[$.MULTI_SELECT]:"multi-select",[$.SUPERTAGS]:"tags",[$.DATE]:"date",[$.GEO_POINT]:"geo",[$.ATTACHMENTS_ASSETS]:"attachment",[$.ATTACHMENT_URI]:"attachment",[$.INTEGER_LIST]:"attachment"};async function Aa(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:Ta(a.name)}))}function Ta(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function La(t){var m,x;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,o=((i==null?void 0:i.model)??[])[ga],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(_=>({uuid:_.uuid,label:_.label??_.name??"",variants:(_.variants??[]).map(w=>({api_value:w.api_value??w.value??"",internal_unique_value:w.internal_unique_value??w.api_value??"",label:w.label??w.name??""}))})).filter(_=>_.variants.length>1),h={};for(const _ of d)h[_.uuid]=((m=_.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.project_branding),g=u==null?void 0:u.brandColor;if(!o)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:g};const p=o.groups??[],f=[];for(const _ of p){const w=_.name||"Root fields";for(const y of _.fields??[]){const L=y.possible_values,k=L==null?void 0:L.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??""}));f.push({key:y.key??y.ckey,label:y.title??y.label??y.key??"",type:y.type??"text",slug:y.slug,ckey:y.ckey,possible_values:k,group:w,regionalVariantsGroupUuid:y.regional_variants_group_uuid})}}return{fields:f,regionalVariantGroups:d,regionalFilters:h,brandColor:g}}function je(t){return t.toLocaleDateString("en-CA")}function Ot(){return je(new Date)}function fi(t){const e=new Date;switch(t){case"today":return{from:Ot(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:je(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Ot(),to:je(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:je(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Ot(),to:je(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:je(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Ot(),to:je(s)}}default:return null}}function Zs(t,e){return e?e.type==="date"?Oa(e):e.type==="string"?Ma(e):!0:!1}function Oa(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 Ma(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function Pa(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Zs(i,a))continue;const o=Da(i,a);s.push(...o)}for(const[i,a]of Object.entries(e)){if(!a||!Zs(i,a))continue;const o=qa(i,a);s.push(...o)}return Ia(s)}function Ia(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 Da(t,e){if(e.type==="date")return vi(t,e);if(t===b.IMAGE)return Ba(e);const s=e,{operator:i=hi,values:a=[],logic:o}=s;if(a.length===0)return[];switch(t){case b.SIZE:return za(t,a,"..");case b.FACES:return Ra(t,i,a);case b.TAGS:return Be(t,i,Js(a),",",o);case b.LABELS:return Be(t,i,Js(a),",",o);case b.COLOR:return ja(i,a,o);case b.TYPE:return Na(a,i);case b.MIME_TYPE:return Ua(t,a,i);case b.PRODUCT_REF:return Be(t,"=%",a,",",o);default:return Be(t,i,a,",",o)}}function vi(t,e){const s=e.field||"created";if(e.kind===ht.PRESET&&e.preset){if(e.preset===Ys.EMPTY)return[`${s}:"empty"`];if(e.preset===Ys.NOT_EMPTY)return[`${s}:"non-empty"`];const i=fi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===ht.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===ht.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===ht.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===ht.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function za(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Ra(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function Be(t,e,s,i,a){if(s.length===0)return[];if(a===ua.AND)return s.map(n=>`${t}${e}"${n}"`);const o=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${o}`]}function ja(t,e,s){const i=[],a=Be("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Na(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const o of t){const n=ba[o];if(n)for(const c of n){const d=`${o}_${c}`;s.has(d)||(s.add(d),i.push(d))}else s.has(o)||(s.add(o),i.push(o))}const a=i.map(o=>`"${o}"`).join(",");return[`type${e}${a}`]}function Ua(t,e,s,i){if(e.length===0)return[];const a=e.map(o=>`"${o}"`).join(",");return[`${t}${s}${a}`]}function Ba(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.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[ss.RESOLUTION],a=s[ss.ORIENTATION],o=s[ss.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),o&&e.push(`faces:"${o}"`),e}function qa(t,e){const s=Ga(t),i=Ha(t);if(e.type==="date")return Va(s,e,i);const a=e,{operator:o=hi,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===ne||n[0]===le)){const h=d===$.GEO_POINT?C.IS+"~":C.IS;return[`${s}${h}"${n[0]}"`]}if((d===$.NUMERIC||d===$.DECIMAL2)&&o===C.RANGE)return[`${s}${C.IS}"${n.join('","')}"`];if(d===$.GEO_POINT){const h=n.map(u=>{const g=u.indexOf("..");if(g===-1)return`(${u})`;const p=u.slice(0,g),f=u.slice(g);return`(${p})${f}`});return Be(s,o+"~",h,",",c)}return Be(s,o,n,",",c)}function Va(t,e,s){const i=vi(t,e);return!s||i.length===0?i:i.map(a=>{const o=a.search(/[^a-zA-Z0-9_]/);if(o===-1)return`"${a}"`;const n=a.slice(0,o),d=a.slice(o).replace(/"/g,"");return`"${n}${d}"`})}function Ha(t){return t.startsWith("date_")}function Ga(t){for(const e of ci)if(t.startsWith(e))return t.slice(e.length);return t}function Js(t){return t.map(e=>e.replace(/#/g,""))}const Ka=new Set([b.DATE,b.LICENSE_EXPIRY,K.DUE_DATE]);function gs(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Qa(s,i));return e}function Qa(t,e){return e.type==="string"||e.type==="date"?e:Ka.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 Ya(t){const e=localStorage.getItem(di+t),s=localStorage.getItem(pi+t);let i;try{i=e?JSON.parse(e):[...Ws]}catch{i=[...Ws]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Wa(t,e){localStorage.setItem(di+t,JSON.stringify(e))}function Xa(t,e){localStorage.setItem(pi+t,JSON.stringify(e))}const mi="sort-by",bi="sort-order";function ei(t,e){try{localStorage.setItem(mi,t),localStorage.setItem(bi,e)}catch{}}function Za(){try{const t=localStorage.getItem(mi),e=localStorage.getItem(bi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const _i="ap-last-folder",yi="ap-last-view",xi="ap-last-tab";function lt(t,e){return e?`${t}:${e}`:t}function ti(t,e){try{localStorage.setItem(lt(_i,e),t)}catch{}}function Ja(t){try{return localStorage.getItem(lt(_i,t))}catch{return null}}function eo(t,e){try{localStorage.setItem(lt(yi,e),t)}catch{}}function to(t){try{return localStorage.getItem(lt(yi,t))}catch{return null}}function so(t,e){try{localStorage.setItem(lt(xi,e),t)}catch{}}function io(t){try{const e=localStorage.getItem(lt(xi,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function ao(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,o=parseInt(s.slice(4,6),16)/255;return[i,a,o]}function ns(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function oo(t,e,s){const i=ns(t),a=ns(e),o=ns(s),n=.4122214708*i+.5363325363*a+.0514459929*o,c=.2119034982*i+.6806995451*a+.1073969566*o,d=.0883024619*i+.2817188376*a+.6299787005*o,h=Math.cbrt(n),u=Math.cbrt(c),g=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*g,f=1.9779984951*h-2.428592205*u+.4505937099*g,m=.0259040371*h+.7827717662*u-.808675766*g,x=Math.sqrt(f*f+m*m);let _=Math.atan2(m,f)*(180/Math.PI);return _<0&&(_+=360),[p,x,_]}function ro(t){return t>.7}function no(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 g of s)t.style.removeProperty(g);return}const[i,a,o]=ao(e),[n,c,d]=oo(i,a,o),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=ro(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)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const ys=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],lo=[{value:"relevance",label:"Relevance"},...ys],co=[{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"}],po=[{value:"name",label:"Name"}],ho=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],uo=[{value:"name",label:"Name"}];var go=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?fo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&go(e,s,a),a};let ut=class extends r.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 r.html`
1
+ "use strict";var Ai=Object.create;var Ks=Object.defineProperty;var Ti=Object.getOwnPropertyDescriptor;var Li=Object.getOwnPropertyNames;var Oi=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty;var Pi=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Li(e))!Mi.call(t,a)&&a!==s&&Ks(t,a,{get:()=>e[a],enumerable:!(i=Ti(e,a))||i.enumerable});return t};var Ii=(t,e,s)=>(s=t!=null?Ai(Oi(t)):{},Pi(e||!t||!t.__esModule?Ks(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),l=require("lit/decorators.js"),_s=require("lit/directive.js");class Di{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 zi(){return new Di({config:null,projectToken:"",sassKey:"",permissions:null,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:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,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 Ri{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 ji(t){return"extension"in t&&!("path"in t)}class Ni{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 c=r[n];c&&(ji(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.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 x=f;x<=p;x++)g[x]&&r.set(g[x].uuid,g[x]);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 c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),r=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.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 c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.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 c=0;c<r;c++)a.set(e[c].uuid,e[c]);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 Ui{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 Qs=5,it=40,Ys=15;class Bi{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<Qs&&a<Qs)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),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;r+c>h&&(c=h-r),n+d>u&&(d=u-n),r<0&&(c+=r,r=0),n<0&&(d+=n,n=0),this.rect={x:r,y:n,width:c,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<it||a<it;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<it?r=-Ys*(1-i/it):a<it&&(r=Ys*(1-a/it)),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(x=>x.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(x=>x.uuid===g);m&&n.set(g,m)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=r.size+(s?n.size:0);if(c&&d>c){const f=Array.from(r.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(f),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:r,...s?{selectedFolders:n}:{}})}}class qi{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(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}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 c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function Vi(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)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function Ne(t,e){const s=Vi(e);return t.request("/files",s)}async function Rt(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const 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)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function Hi(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 Gi(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Ki(t,e,s){const i=s.replace(/\/+$/,""),a=i?`${i}/${e}`:`/${e}`,r=await t.post("/folders",{name:a});if(r.status!=="success")throw new Error(r.msg||"Failed to create folder")}async function Qi(t){return await t.request("/labels")}async function Yi(t){return t.request("/collections")}async function Wi(t,e){return t.request(`/collections/${e}/folders`)}function ri(t){return t.filter(e=>!!e.name).map(e=>({...e,children:ri(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Xi(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 Zi(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");const s=await t.request(`/key/${e}`);return{key:s.key,permissions:s.permissions??[]}}function Ji(t,e){return t?t.includes(e):!1}const ea={FOLDER_CREATE:"DIR_CREATE"};function Jt(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}function qe(t){return(t.type??"").startsWith("image")}function ta(t){return(t.type??"").startsWith("video")}function sa(t){return(t.type??"").startsWith("audio")}function oi(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function ia(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const r=Object.keys(a)[0];if(r){const n=a[r];if(n)return n}}return i.split(".")[0]}function Vt(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function Ht(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function aa(t){return{width:Vt(t),height:Ht(t)}}function ra(t){return Jt(t)!==null}function oa(t){return Jt(t)}function na(t){return Jt(t)??oi(t)}const la={excellent:90,good:75,fair:60},ca=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],da=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],pa=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],ha={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},ua=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),fa=new Set([...ua,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function rt(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 ni(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return fa.has(e)}const v="https://scaleflex.cloudimg.io/v7/assets/file-types/v3/",ys={_default:v+"GENERIC.svg?vh=9a518a",png:v+"PNG.svg?vh=96cd9a",jpg:v+"JPG.svg?vh=06e819",jpg2:v+"JPG2.svg?vh=f0eb7f",jpeg:v+"JPEG.svg?vh=6a65e9",gif:v+"GIF.svg?vh=c3c2c3",bmp:v+"BMP.svg?vh=d2243a",webp:v+"WEBP.svg?vh=fedd74",svg:v+"SVG.svg?vh=a15e46",tiff:v+"TIFF.svg?vh=1f30c3",tif:v+"TIF.svg?vh=b383c9",heic:v+"HEIC.svg?vh=84adfe",avif:v+"AVIF.svg?vh=536b30",ico:v+"ICO.svg?vh=79063d",psd:v+"PSD.svg?vh=be6140",psb:v+"PSB.svg?vh=678646",ai:v+"AI.svg?vh=84b254",dwg:v+"DWG.svg?vh=971fb3",mp4:v+"MP4.svg?vh=42f175",webm:v+"WEBM.svg?vh=26a84a",avi:v+"AVI.svg?vh=d22ba8",mpeg:v+"MPEG.svg?vh=ba93bb",ogv:v+"OGV.svg?vh=74d453","3gp":v+"3GP.svg?vh=f0d388","3g2":v+"3G2.svg?vh=04c652",swf:v+"SWF.svg?vh=3955e2",fla:v+"FLA.svg?vh=daf585",m3u8:v+"M3U8.svg?vh=7d5e62",mp3:v+"MP3.svg?vh=66bbef",wav:v+"WAV.svg?vh=d7a7d5",aac:v+"AAC.svg?vh=07f3f9",oga:v+"OGA.svg?vh=a5c622",opus:v+"OPUS.svg?vh=9548b1",weba:v+"WEBA.svg?vh=4dcf70",mid:v+"MID.svg?vh=3f0e29",midi:v+"MIDI.svg?vh=9fedec",cda:v+"CDA.svg?vh=85b83b",pdf:v+"PDF.svg?vh=18c5f7",doc:v+"DOC.svg?vh=d1b47c",docx:v+"DOCX.svg?vh=1eb6b0",txt:v+"TXT.svg?vh=307979",rtf:v+"RTF.svg?vh=978c5f",xls:v+"XLS.svg?vh=13b5f7",xlsx:v+"XLSX.svg?vh=79d64a",ppt:v+"PPT.svg?vh=4ee29b",pptx:v+"PPTX.svg?vh=8b1568",csv:v+"CSV.svg?vh=4add78",odt:v+"ODT.svg?vh=940781",ods:v+"ODS.svg?vh=9fbe9a",odp:v+"ODP.svg?vh=bf892d",dbf:v+"DBF.svg?vh=457bd4",vsd:v+"VSD.svg?vh=8a9ccb",abw:v+"ABW.svg?vh=313dc7",epub:v+"EPUB.svg?vh=15263d",azw:v+"AZW.svg?vh=a018b1",ics:v+"ICS.svg?vh=909f63",ogx:v+"OGX.svg?vh=f694d2",zip:v+"ZIP.svg?vh=84f98b",rar:v+"RAR.svg?vh=1d6423","7z":v+"7Z.svg?vh=e007e5",tar:v+"TAR.svg?vh=603aed",gz:v+"GZ.svg?vh=de13f7",bz:v+"BZ.svg?vh=0374ff",bz2:v+"BZ2.svg?vh=e14294",arc:v+"ARC.svg?vh=942fad",jar:v+"JAR.svg?vh=149796",mpkg:v+"MPKG.svg?vh=dea655",ttf:v+"TTF.svg?vh=d2e2c1",otf:v+"OTF.svg?vh=c904fd",woff:v+"WOFF.svg?vh=4b8177",woff2:v+"WOFF2.svg?vh=b532d3",eot:v+"EOT.svg?vh=a54980",js:v+"JS.svg?vh=524691",mjs:v+"MJS.svg?vh=d57921",ts:v+"TS.svg?vh=9af3ae",css:v+"CSS.svg?vh=287863",html:v+"HTML.svg?vh=fa7a87",htm:v+"HTM.svg?vh=21323d",xhtml:v+"XHTML.svg?vh=e6d6a9",xul:v+"XUL.svg?vh=6c9c71",json:v+"JSON.svg?vh=104c9e",jsonld:v+"JSONLD.svg?vh=f30c0f",xml:v+"XML.svg?vh=7f7194",php:v+"PHP.svg?vh=503e36",sh:v+"SH.svg?vh=3b820e",csh:v+"CSH.svg?vh=08c0cc",exe:v+"EXE.svg?vh=ccca53",iso:v+"ISO.svg?vh=064b8f",bin:v+"BIN.svg?vh=1e9618"};function Ot(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ys[e]||ys._default}function ot(){return ys._default}function es(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const ga=new Set(["png","svg","webp","gif","avif"]);function ks(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ga.has(e)}const va=new Set(["svg","svg+xml","png","pdf"]);function li(t){return va.has(es(t).toLowerCase())}function Gt(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 Ge(s)}function ci(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?Ge(s):""}function Ss(t){var s,i;let e=Ge(((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 Ws=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Ge(t,e){if(!t)return"";const s=a=>a.replace(/(\.filerobot\.com\/[a-z0-9_-]+)\/v\d+\//i,"$1/");if(t.includes("assets.filerobot.com"))return s(t);const i=t.match(Ws);if(i){const a=i[2],r=t.replace(Ws,`$1assets.filerobot.com/${a}/`);return s(r)}if(e)try{const a=new URL(t);return s(`https://assets.filerobot.com/${e}${a.pathname}${a.search}`)}catch{}return t}function di(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Ge(s);const a=rt(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"||es(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 Cs(t,e){const s={};return t.format&&(s.force_format=ha[t.format]),t.quality&&t.format!=="png"&&(s.q=String(la[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ma(t,e,s){const i=Ge(t);if(!i)return t;const a=Cs(e,s);return Object.keys(a).length>0?ke(i,a):i}const _={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"},Q={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},C={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},ba={AND:"AND"},$={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"},ts={[$.DATE]:"date_",[$.BOOLEAN]:"bool_",[$.NUMERIC]:"num_",[$.DECIMAL2]:"dec_",[$.ATTACHMENTS_ASSETS]:"attach_",[$.ATTACHMENT_URI]:"uri_",[$.SELECT_ONE]:"one_",[$.MULTI_SELECT]:"multi_",[$.SUPERTAGS]:"tags_",[$.TEXT]:"text_",[$.TEXT_AREA]:"area_",[$.GEO_POINT]:"geo_",[$.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(ts).map(([t,e])=>[e,t]));const pi=Object.values(ts),yt={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Xs={EMPTY:"empty",NOT_EMPTY:"non-empty"},ne="empty",le="non-empty",Ue="specific",ls=10,cs=10,jt=10,hi="filters:pinned:",ui="metadata:pinned:",Zs=[_.DATE,_.TYPE,_.SIZE],fi=C.IS,Ut="20",Bt="1",_a=0,ya=[{key:_.DATE,label:"Date",icon:"calendar",type:"date"},{key:_.TYPE,label:"Format",icon:"file-type",type:"string"},{key:_.SIZE,label:"Size",icon:"scaling",type:"string"},{key:_.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:_.TAGS,label:"Tags",icon:"hash",type:"string"},{key:_.LABELS,label:"Labels",icon:"tag",type:"string"},{key:_.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:_.IMAGE,label:"Image",icon:"image",type:"string"},{key:_.COLOR,label:"Color",icon:"swatch-book",type:"string"}],xa={key:_.METADATA,label:"Metadata",icon:"file-text",type:"string"},wa={key:_.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},xs=[xa,...ya,wa],at={[_.TYPE]:"Format",[_.DATE]:"Date",[_.SIZE]:"Size",[_.LICENSE_EXPIRY]:"License expiry",[_.TAGS]:"Tags",[_.LABELS]:"Labels",[_.PRODUCT_REF]:"Products",[_.IMAGE]:"Image",[_.COLOR]:"Color",[_.METADATA]:"Metadata",[_.APPROVAL]:"Approval"},Y={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},Kt=[{value:Y.IMAGE,label:"Image",icon:"image"},{value:Y.VIDEO,label:"Video",icon:"clapperboard"},{value:Y.AUDIO,label:"Audio",icon:"music"},{value:Y.DOCUMENT,label:"Document",icon:"document"},{value:Y.ARCHIVE,label:"Archive",icon:"archive"},{value:Y.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:Y.FONTS,label:"Fonts",icon:"text"},{value:Y.OTHER,label:"Other",icon:"layout-grid"}],$a={[Y.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[Y.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[Y.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[Y.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[Y.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[Y.FONTS]:["ttf","otf","woff","woff2","eot"]},ds={RESOLUTION:0,ORIENTATION:1,FACES:2},ka=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Sa=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Ca=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],gi=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Fs=[{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"}],vi=[{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"}],Fa=[{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"}],Ea=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],Aa=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],ps=[{label:"Is",value:C.IS},{label:"Contains",value:C.CONTAINS_IN_TEXT}],$e=[{label:"Is",value:C.IS},{label:"Is not",value:C.IS_NOT}],hs=[{label:"Is",value:C.IS_EXACT},{label:"Contains",value:C.IS},{label:"Does not contain",value:C.IS_NOT}],us=[{label:"Is",value:C.IS},{label:"Greater than",value:C.GREATER_THAN_OR_EQUAL},{label:"Is not",value:C.IS_NOT},{label:"Less than",value:C.LESS_THAN_OR_EQUAL},{label:"Between",value:C.RANGE}],Ta=[{label:"Is",value:C.IS_EXACT},{label:"Is not",value:C.IS_NOT}],Js=[{label:"Contains",value:C.CONTAINS},{label:"Does not contain",value:C.IS_NOT}],La=[{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))"}],Ve=[{label:"Empty",value:ne},{label:"Not empty",value:le}],fs=[...Ve,{label:"Specific",value:Ue}],Oa=[{label:"Empty",value:ne},{label:"Not empty",value:le},{label:"True",value:"true"},{label:"False",value:"false"}],qt={[$.DATE]:"calendar",[$.BOOLEAN]:"toggle-left",[$.NUMERIC]:"file-digit",[$.DECIMAL2]:"decimals-arrow-right",[$.ATTACHMENTS_ASSETS]:"paperclip",[$.ATTACHMENT_URI]:"link-2",[$.SELECT_ONE]:"circle-dot",[$.MULTI_SELECT]:"square-check",[$.SUPERTAGS]:"hash",[$.TEXT]:"text-initial",[$.TEXT_AREA]:"text-align-justify",[$.GEO_POINT]:"locate",[$.INTEGER_LIST]:"list-ordered"},Ma={[$.TEXT]:"text",[$.TEXT_AREA]:"text",[$.NUMERIC]:"number",[$.DECIMAL2]:"number",[$.BOOLEAN]:"boolean",[$.SELECT_ONE]:"select-one",[$.MULTI_SELECT]:"multi-select",[$.SUPERTAGS]:"tags",[$.DATE]:"date",[$.GEO_POINT]:"geo",[$.ATTACHMENTS_ASSETS]:"attachment",[$.ATTACHMENT_URI]:"attachment",[$.INTEGER_LIST]:"attachment"};async function Pa(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:Ia(a.name)}))}function Ia(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function Da(t){var m,x;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)??[])[_a],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(b=>({uuid:b.uuid,label:b.label??b.name??"",variants:(b.variants??[]).map(w=>({api_value:w.api_value??w.value??"",internal_unique_value:w.internal_unique_value??w.api_value??"",label:w.label??w.name??""}))})).filter(b=>b.variants.length>1),h={};for(const b of d)h[b.uuid]=((m=b.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.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 b of p){const w=b.name||"Root fields";for(const y of b.fields??[]){const L=y.possible_values,k=L==null?void 0:L.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:y.key??y.ckey,label:y.title??y.label??y.key??"",type:y.type??"text",slug:y.slug,ckey:y.ckey,possible_values:k,group:w,regionalVariantsGroupUuid:y.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function Be(t){return t.toLocaleDateString("en-CA")}function Nt(){return Be(new Date)}function mi(t){const e=new Date;switch(t){case"today":return{from:Nt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:Be(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Nt(),to:Be(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:Be(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Nt(),to:Be(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:Be(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Nt(),to:Be(s)}}default:return null}}function ei(t,e){return e?e.type==="date"?za(e):e.type==="string"?Ra(e):!0:!1}function za(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 Ra(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ja(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!ei(i,a))continue;const r=Ua(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!ei(i,a))continue;const r=Qa(i,a);s.push(...r)}return Na(s)}function Na(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 Ua(t,e){if(e.type==="date")return bi(t,e);if(t===_.IMAGE)return Ka(e);const s=e,{operator:i=fi,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case _.SIZE:return Ba(t,a,"..");case _.FACES:return qa(t,i,a);case _.TAGS:return He(t,i,ti(a),",",r);case _.LABELS:return He(t,i,ti(a),",",r);case _.COLOR:return Va(i,a,r);case _.TYPE:return Ha(a,i);case _.MIME_TYPE:return Ga(t,a,i);case _.PRODUCT_REF:return He(t,"=%",a,",",r);default:return He(t,i,a,",",r)}}function bi(t,e){const s=e.field||"created";if(e.kind===yt.PRESET&&e.preset){if(e.preset===Xs.EMPTY)return[`${s}:"empty"`];if(e.preset===Xs.NOT_EMPTY)return[`${s}:"non-empty"`];const i=mi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===yt.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===yt.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===yt.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===yt.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function Ba(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function qa(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function He(t,e,s,i,a){if(s.length===0)return[];if(a===ba.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function Va(t,e,s){const i=[],a=He("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Ha(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const r of t){const n=$a[r];if(n)for(const c of n){const d=`${r}_${c}`;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 Ga(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function Ka(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.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[ds.RESOLUTION],a=s[ds.ORIENTATION],r=s[ds.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function Qa(t,e){const s=Xa(t),i=Wa(t);if(e.type==="date")return Ya(s,e,i);const a=e,{operator:r=fi,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===ne||n[0]===le)){const h=d===$.GEO_POINT?C.IS+"~":C.IS;return[`${s}${h}"${n[0]}"`]}if((d===$.NUMERIC||d===$.DECIMAL2)&&r===C.RANGE)return[`${s}${C.IS}"${n.join('","')}"`];if(d===$.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 He(s,r+"~",h,",",c)}return He(s,r,n,",",c)}function Ya(t,e,s){const i=bi(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 Wa(t){return t.startsWith("date_")}function Xa(t){for(const e of pi)if(t.startsWith(e))return t.slice(e.length);return t}function ti(t){return t.map(e=>e.replace(/#/g,""))}const Za=new Set([_.DATE,_.LICENSE_EXPIRY,Q.DUE_DATE]);function ws(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Ja(s,i));return e}function Ja(t,e){return e.type==="string"||e.type==="date"?e:Za.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 er(t){const e=localStorage.getItem(hi+t),s=localStorage.getItem(ui+t);let i;try{i=e?JSON.parse(e):[...Zs]}catch{i=[...Zs]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function tr(t,e){localStorage.setItem(hi+t,JSON.stringify(e))}function sr(t,e){localStorage.setItem(ui+t,JSON.stringify(e))}const _i="sort-by",yi="sort-order";function si(t,e){try{localStorage.setItem(_i,t),localStorage.setItem(yi,e)}catch{}}function ir(){try{const t=localStorage.getItem(_i),e=localStorage.getItem(yi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const xi="ap-last-folder",wi="ap-last-view",$i="ap-last-tab";function pt(t,e){return e?`${t}:${e}`:t}function ii(t,e){try{localStorage.setItem(pt(xi,e),t)}catch{}}function ar(t){try{return localStorage.getItem(pt(xi,t))}catch{return null}}function rr(t,e){try{localStorage.setItem(pt(wi,e),t)}catch{}}function or(t){try{return localStorage.getItem(pt(wi,t))}catch{return null}}function nr(t,e){try{localStorage.setItem(pt($i,e),t)}catch{}}function lr(t){try{const e=localStorage.getItem(pt($i,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function cr(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 gs(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function dr(t,e,s){const i=gs(t),a=gs(e),r=gs(s),n=.4122214708*i+.5363325363*a+.0514459929*r,c=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(c),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,x=Math.sqrt(g*g+m*m);let b=Math.atan2(m,g)*(180/Math.PI);return b<0&&(b+=360),[p,x,b]}function pr(t){return t>.7}function hr(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]=cr(e),[n,c,d]=dr(i,a,r),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=pr(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)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const Es=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],ur=[{value:"relevance",label:"Relevance"},...Es],fr=[{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"}],gr=[{value:"name",label:"Name"}],vr=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],mr=[{value:"name",label:"Name"}];var br=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&&br(e,s,a),a};let xt=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
- `}};ut.styles=r.css`
18
+ `}};xt.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
- `;xs([l.property({type:Boolean})],ut.prototype,"open",2);xs([l.query("dialog")],ut.prototype,"dialog",2);ut=xs([l.customElement("ap-modal")],ut);function vo(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const W=r.css`
91
+ `;As([l.property({type:Boolean})],xt.prototype,"open",2);As([l.query("dialog")],xt.prototype,"dialog",2);xt=As([l.customElement("ap-modal")],xt);function yr(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const H=o.css`
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var mo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,Qt=(t,e,s,i)=>{for(var a=i>1?void 0:i?bo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mo(e,s,a),a};let at=class extends r.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 r.html`
95
+ `;var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,ss=(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 nt=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}
@@ -102,28 +102,28 @@
102
102
  <ap-icon name="globe" .size=${18}></ap-icon>
103
103
  </button>
104
104
  <div class="popover ${this._open?"open":""}">
105
- ${t?r.nothing:r.html`
105
+ ${t?o.nothing:o.html`
106
106
  <div class="empty-msg">
107
107
  No regional settings configured
108
108
  </div>
109
109
  `}
110
- ${this.groups.map(e=>r.html`
110
+ ${this.groups.map(e=>o.html`
111
111
  <div class="group">
112
112
  <div class="group-label">${e.label}</div>
113
- ${e.variants.map(s=>{const i=this.selectedFilters[e.uuid]===s.api_value;return r.html`
113
+ ${e.variants.map(s=>{const i=this.selectedFilters[e.uuid]===s.api_value;return o.html`
114
114
  <button
115
115
  class="variant-option"
116
116
  ?data-selected=${i}
117
117
  @click=${()=>this._selectVariant(e.uuid,s.api_value)}
118
118
  >
119
119
  <span class="variant-label">${s.label}</span>
120
- <span class="check-mark">${i?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:""}</span>
120
+ <span class="check-mark">${i?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:""}</span>
121
121
  </button>
122
122
  `})}
123
123
  </div>
124
124
  `)}
125
125
  </div>
126
- `}};at.styles=r.css`
126
+ `}};nt.styles=o.css`
127
127
  :host {
128
128
  position: relative;
129
129
  display: inline-block;
@@ -213,13 +213,13 @@
213
213
  font-size: 0.8125rem;
214
214
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
215
215
  }
216
- `;Qt([l.property({type:Array})],at.prototype,"groups",2);Qt([l.property({type:Object})],at.prototype,"selectedFilters",2);Qt([l.state()],at.prototype,"_open",2);at=Qt([l.customElement("ap-regional-settings")],at);var _o=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,X=(t,e,s,i)=>{for(var a=i>1?void 0:i?yo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_o(e,s,a),a};const xo=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"},{value:"labels",label:"Labels",icon:"tag"},{value:"collections",label:"Collections",icon:"layout-grid"}];let U=class extends r.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.isInsideLabel=!1,this.isInsideCollection=!1,this.isInsideCollectionLeaf=!1,this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=vo(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=xo.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),r.html`
216
+ `;ss([l.property({type:Array})],nt.prototype,"groups",2);ss([l.property({type:Object})],nt.prototype,"selectedFilters",2);ss([l.state()],nt.prototype,"_open",2);nt=ss([l.customElement("ap-regional-settings")],nt);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,X=(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};const Sr=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"},{value:"labels",label:"Labels",icon:"tag"},{value:"collections",label:"Collections",icon:"layout-grid"}];let U=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.isInsideLabel=!1,this.isInsideCollection=!1,this.isInsideCollectionLeaf=!1,this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=yr(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=Sr.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`
217
217
  <div class="header-row">
218
- ${t.length>1?r.html`<ap-dropdown
218
+ ${t.length>1?o.html`<ap-dropdown
219
219
  .value=${this.activeTab}
220
220
  .options=${t}
221
221
  @ap-change=${this._handleTabChange}
222
- ></ap-dropdown>`:r.nothing}
222
+ ></ap-dropdown>`:o.nothing}
223
223
  <div class="search-wrapper">
224
224
  <ap-icon class="search-icon" name="search" .size=${16}></ap-icon>
225
225
  <input
@@ -229,12 +229,12 @@
229
229
  @input=${this._handleInput}
230
230
  />
231
231
  <div class="search-actions">
232
- ${this._localSearch?r.html`
232
+ ${this._localSearch?o.html`
233
233
  <button class="clear-btn" @click=${this._clearSearch} aria-label="Clear search">
234
234
  <ap-icon name="close" .size=${14}></ap-icon>
235
235
  </button>
236
236
  `:""}
237
- ${this.enableAISearch?r.html`
237
+ ${this.enableAISearch?o.html`
238
238
  <button
239
239
  class="ai-toggle ${this.isAISearchActive?"active":""}"
240
240
  @click=${this._toggleAISearch}
@@ -261,7 +261,7 @@
261
261
  >
262
262
  <ap-icon name=${this.viewMode==="grid"?"list":"layout-grid"} .size=${18}></ap-icon>
263
263
  </button>
264
- ${this.hideClose?r.nothing:r.html`
264
+ ${this.hideClose?o.nothing:o.html`
265
265
  <div class="divider"></div>
266
266
  <button class="icon-btn icon-btn--muted" @click=${this._handleClose} aria-label="Close">
267
267
  <ap-icon name="close" .size=${18}></ap-icon>
@@ -269,7 +269,7 @@
269
269
  `}
270
270
  </div>
271
271
  </div>
272
- `}};U.styles=[W,r.css`
272
+ `}};U.styles=[H,o.css`
273
273
  :host {
274
274
  display: block;
275
275
  padding: 16px 20px;
@@ -423,15 +423,15 @@
423
423
  .icon-btn--muted {
424
424
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
425
425
  }
426
- `];X([l.property()],U.prototype,"activeTab",2);X([l.property({type:Array})],U.prototype,"tabs",2);X([l.property({type:Boolean})],U.prototype,"isInsideLabel",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollection",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollectionLeaf",2);X([l.property()],U.prototype,"viewMode",2);X([l.property()],U.prototype,"searchQuery",2);X([l.property({type:Array})],U.prototype,"regionalGroups",2);X([l.property({type:Object})],U.prototype,"regionalFilters",2);X([l.property({type:Boolean})],U.prototype,"hideClose",2);X([l.property({type:Boolean,reflect:!0,attribute:"ai-search"})],U.prototype,"enableAISearch",2);X([l.property({type:Boolean})],U.prototype,"isAISearchActive",2);X([l.state()],U.prototype,"_localSearch",2);U=X([l.customElement("ap-header")],U);var wo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?$o(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&wo(e,s,a),a};let gt=class extends r.LitElement{constructor(){super(...arguments),this.items=[],this.rootLabel="Root"}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?r.html``:r.html`
426
+ `];X([l.property()],U.prototype,"activeTab",2);X([l.property({type:Array})],U.prototype,"tabs",2);X([l.property({type:Boolean})],U.prototype,"isInsideLabel",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollection",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollectionLeaf",2);X([l.property()],U.prototype,"viewMode",2);X([l.property()],U.prototype,"searchQuery",2);X([l.property({type:Array})],U.prototype,"regionalGroups",2);X([l.property({type:Object})],U.prototype,"regionalFilters",2);X([l.property({type:Boolean})],U.prototype,"hideClose",2);X([l.property({type:Boolean,reflect:!0,attribute:"ai-search"})],U.prototype,"enableAISearch",2);X([l.property({type:Boolean})],U.prototype,"isAISearchActive",2);X([l.state()],U.prototype,"_localSearch",2);U=X([l.customElement("ap-header")],U);var Cr=Object.defineProperty,Fr=Object.getOwnPropertyDescriptor,Ts=(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&&Cr(e,s,a),a};let wt=class extends o.LitElement{constructor(){super(...arguments),this.items=[],this.rootLabel="Root"}_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`
427
427
  <nav class="breadcrumb" aria-label="Breadcrumb">
428
428
  <button @click=${()=>this._navigate("")}>${this.rootLabel}</button>
429
- ${this.items.map((t,e)=>r.html`
429
+ ${this.items.map((t,e)=>o.html`
430
430
  <ap-icon name="chevron-right" .size=${14}></ap-icon>
431
- ${e<this.items.length-1?r.html`<button @click=${()=>this._navigate(t.uuid)}>${t.name}</button>`:r.html`<span class="current">${t.name}</span>`}
431
+ ${e<this.items.length-1?o.html`<button @click=${()=>this._navigate(t.uuid)}>${t.name}</button>`:o.html`<span class="current">${t.name}</span>`}
432
432
  `)}
433
433
  </nav>
434
- `}};gt.styles=r.css`
434
+ `}};wt.styles=o.css`
435
435
  :host {
436
436
  display: block;
437
437
  padding: 4px 20px 12px;
@@ -467,12 +467,12 @@
467
467
  ap-icon {
468
468
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
469
469
  }
470
- `;ws([l.property({type:Array})],gt.prototype,"items",2);ws([l.property()],gt.prototype,"rootLabel",2);gt=ws([l.customElement("ap-breadcrumb")],gt);const ls=t=>t.includes("-")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);class ko extends ps.Directive{constructor(e){if(super(e),this._appliedProps=new Set,e.type!==ps.PartType.ELEMENT)throw new Error("cspStyle must be used as an element directive: <el ${cspStyle({...})}>")}render(e){return r.noChange}update(e,[s]){if(s===this._lastStyles)return r.noChange;this._lastStyles=s;const{style:i}=e.element,a=s??{};for(const o of this._appliedProps)(!(o in a)||a[o]==null||a[o]==="")&&(i.removeProperty(ls(o)),this._appliedProps.delete(o));for(const[o,n]of Object.entries(a))n!=null&&n!==""?(i.setProperty(ls(o),n),this._appliedProps.add(o)):this._appliedProps.has(o)&&(i.removeProperty(ls(o)),this._appliedProps.delete(o));return r.noChange}}const F=ps.directive(ko);var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Co(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&So(e,s,a),a};let ft=class extends r.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?r.html`
470
+ `;Ts([l.property({type:Array})],wt.prototype,"items",2);Ts([l.property()],wt.prototype,"rootLabel",2);wt=Ts([l.customElement("ap-breadcrumb")],wt);const vs=t=>t.includes("-")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);class Er extends _s.Directive{constructor(e){if(super(e),this._appliedProps=new Set,e.type!==_s.PartType.ELEMENT)throw new Error("cspStyle must be used as an element directive: <el ${cspStyle({...})}>")}render(e){return o.noChange}update(e,[s]){if(s===this._lastStyles)return o.noChange;this._lastStyles=s;const{style:i}=e.element,a=s??{};for(const r of this._appliedProps)(!(r in a)||a[r]==null||a[r]==="")&&(i.removeProperty(vs(r)),this._appliedProps.delete(r));for(const[r,n]of Object.entries(a))n!=null&&n!==""?(i.setProperty(vs(r),n),this._appliedProps.add(r)):this._appliedProps.has(r)&&(i.removeProperty(vs(r)),this._appliedProps.delete(r));return o.noChange}}const F=_s.directive(Er);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,Ls=(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 $t=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
471
471
  <div class="popover">
472
- ${this.title?r.html`<div class="title">${this.title}</div>`:""}
472
+ ${this.title?o.html`<div class="title">${this.title}</div>`:""}
473
473
  <slot></slot>
474
474
  </div>
475
- `:r.html``}};ft.styles=r.css`
475
+ `:o.html``}};$t.styles=o.css`
476
476
  :host {
477
477
  display: block;
478
478
  }
@@ -497,7 +497,7 @@
497
497
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
498
498
  margin-bottom: 12px;
499
499
  }
500
- `;$s([l.property()],ft.prototype,"title",2);$s([l.property({type:Boolean})],ft.prototype,"open",2);ft=$s([l.customElement("ap-filter-popover")],ft);var Fo=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,St=(t,e,s,i)=>{for(var a=i>1?void 0:i?Eo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fo(e,s,a),a};function si(t){var i;const e=new Map;for(const a of t){const o=a.category||a.value.split("_")[0];if(!e.has(o)){const c=jt.find(d=>d.value===o);e.set(o,{key:o,label:(c==null?void 0:c.label)||o.charAt(0).toUpperCase()+o.slice(1),icon:(c==null?void 0:c.icon)||"file",extensions:[],totalCount:0})}const n=e.get(o);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=jt.map(a=>a.value);return[...e.values()].sort((a,o)=>{const n=s.indexOf(a.key),c=s.indexOf(o.key);return(n===-1?999:n)-(c===-1?999:c)})}let Ve=class extends r.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(o=>!a.has(o))}else{const a=new Set(e);i=this.selected.filter(o=>!a.has(o)),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:b.TYPE,values:t,operator:C.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(o=>o.label.toLowerCase().includes(e)||o.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=si(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=si(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return r.html`
500
+ `;Ls([l.property()],$t.prototype,"title",2);Ls([l.property({type:Boolean})],$t.prototype,"open",2);$t=Ls([l.customElement("ap-filter-popover")],$t);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Mt=(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};function ai(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 c=Kt.find(d=>d.value===r);e.set(r,{key:r,label:(c==null?void 0:c.label)||r.charAt(0).toUpperCase()+r.slice(1),icon:(c==null?void 0:c.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=Kt.map(a=>a.value);return[...e.values()].sort((a,r)=>{const n=s.indexOf(a.key),c=s.indexOf(r.key);return(n===-1?999:n)-(c===-1?999:c)})}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:_.TYPE,values:t,operator:C.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=ai(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=ai(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return o.html`
501
501
  <input
502
502
  class="search-input"
503
503
  type="text"
@@ -507,12 +507,12 @@
507
507
  />
508
508
  <div class="header-row">
509
509
  <span class="section-label">Formats</span>
510
- ${s?r.html`<button class="clear-btn" @click=${this._clearAll}>Clear all</button>`:r.nothing}
510
+ ${s?o.html`<button class="clear-btn" @click=${this._clearAll}>Clear all</button>`:o.nothing}
511
511
  </div>
512
512
  <div class="groups">
513
- ${e.length===0&&this._search.trim()?r.html`<div class="no-results">No formats found</div>`:e.map(i=>this._renderGroup(i))}
513
+ ${e.length===0&&this._search.trim()?o.html`<div class="no-results">No formats found</div>`:e.map(i=>this._renderGroup(i))}
514
514
  </div>
515
- `}_renderGroup(t){const e=this._expanded.has(t.key)||this._search.trim().length>0,s=this._isGroupFullySelected(t),i=this._isGroupPartial(t);return r.html`
515
+ `}_renderGroup(t){const e=this._expanded.has(t.key)||this._search.trim().length>0,s=this._isGroupFullySelected(t),i=this._isGroupPartial(t);return o.html`
516
516
  <div
517
517
  class="group-header ${s||i?"selected":""}"
518
518
  @click=${()=>this._toggleExpand(t.key)}
@@ -529,27 +529,27 @@
529
529
  @ap-toggle=${()=>this._toggleGroup(t)}
530
530
  ></ap-checkbox>
531
531
  </div>
532
- ${e?r.html`
532
+ ${e?o.html`
533
533
  <div class="extensions">
534
- ${t.extensions.map(a=>r.html`
534
+ ${t.extensions.map(a=>o.html`
535
535
  <div
536
536
  class="ext-row"
537
537
  @click=${()=>this._toggleExt(a.value,t)}
538
538
  >
539
539
  <ap-checkbox
540
540
  ?checked=${this._isExtSelected(a.value,t.key)}
541
- @click=${o=>o.stopPropagation()}
541
+ @click=${r=>r.stopPropagation()}
542
542
  @ap-toggle=${()=>this._toggleExt(a.value,t)}
543
543
  ></ap-checkbox>
544
544
  <span class="ext-label">${a.label}</span>
545
545
  </div>
546
546
  `)}
547
547
  </div>
548
- `:r.nothing}
549
- `}_renderFallback(){return r.html`
548
+ `:o.nothing}
549
+ `}_renderFallback(){return o.html`
550
550
  <div class="options">
551
551
  <span class="section-label">Formats</span>
552
- ${jt.map(t=>r.html`
552
+ ${Kt.map(t=>o.html`
553
553
  <div
554
554
  class="option ${this.selected.includes(t.value)?"selected":""}"
555
555
  @click=${()=>this._toggleCategory(t.value)}
@@ -560,7 +560,7 @@
560
560
  </div>
561
561
  `)}
562
562
  </div>
563
- `}};Ve.styles=r.css`
563
+ `}};Ke.styles=o.css`
564
564
  :host {
565
565
  display: block;
566
566
  }
@@ -714,7 +714,7 @@
714
714
  font-size: var(--ap-font-size-sm, 0.875rem);
715
715
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
716
716
  }
717
- `;St([l.property({type:Array})],Ve.prototype,"selected",2);St([l.property({type:Array})],Ve.prototype,"fileTypes",2);St([l.state()],Ve.prototype,"_search",2);St([l.state()],Ve.prototype,"_expanded",2);Ve=St([l.customElement("ap-filter-type")],Ve);const Fe=r.css`
717
+ `;Mt([l.property({type:Array})],Ke.prototype,"selected",2);Mt([l.property({type:Array})],Ke.prototype,"fileTypes",2);Mt([l.state()],Ke.prototype,"_search",2);Mt([l.state()],Ke.prototype,"_expanded",2);Ke=Mt([l.customElement("ap-filter-type")],Ke);const Ae=o.css`
718
718
  :host {
719
719
  display: block;
720
720
  }
@@ -997,16 +997,16 @@
997
997
  font-size: var(--ap-font-size-sm, 0.875rem);
998
998
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
999
999
  }
1000
- `;var Ao=Object.defineProperty,To=Object.getOwnPropertyDescriptor,Qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?To(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ao(e,s,a),a};function cs(t){return t.toISOString().split("T")[0]}let $e=class extends r.LitElement{constructor(){super(...arguments),this.filterKey=b.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===b.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?gi:_s}get _todayStr(){return cs(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){if(!t){this._clearAll();return}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=fi(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?r.nothing:r.html`
1000
+ `;var Mr=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,Xe=(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&&Mr(e,s,a),a};function ms(t){return t.toISOString().split("T")[0]}let Se=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=_.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===_.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?vi:Fs}get _todayStr(){return ms(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){if(!t){this._clearAll();return}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=mi(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`
1001
1001
  <div class="filter-section">
1002
1002
  <span class="section-label">Date type</span>
1003
1003
  <ap-radio-group
1004
- .options=${ui}
1004
+ .options=${gi}
1005
1005
  .value=${this.field}
1006
1006
  @ap-change=${t=>this._selectField(t.detail.value)}
1007
1007
  ></ap-radio-group>
1008
1008
  </div>
1009
- `}_renderRangeSection(){return r.html`
1009
+ `}_renderRangeSection(){return o.html`
1010
1010
  <div class="filter-section">
1011
1011
  <span class="section-label">Range</span>
1012
1012
  <ap-radio-group
@@ -1017,7 +1017,7 @@
1017
1017
  @ap-change=${t=>this._selectPreset(t.detail.value)}
1018
1018
  ></ap-radio-group>
1019
1019
  </div>
1020
- `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return r.nothing;const e=this.from?cs(new Date(this.from)):"",s=this.to?cs(new Date(this.to)):"",i=this._todayStr;return t==="specific"?r.html`
1020
+ `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?ms(new Date(this.from)):"",s=this.to?ms(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
1021
1021
  <div class="filter-section date-inputs">
1022
1022
  <div>
1023
1023
  <span class="input-label">Date</span>
@@ -1030,7 +1030,7 @@
1030
1030
  />
1031
1031
  </div>
1032
1032
  </div>
1033
- `:t==="before"?r.html`
1033
+ `:t==="before"?o.html`
1034
1034
  <div class="filter-section date-inputs">
1035
1035
  <div>
1036
1036
  <span class="input-label">End date</span>
@@ -1043,7 +1043,7 @@
1043
1043
  />
1044
1044
  </div>
1045
1045
  </div>
1046
- `:t==="after"?r.html`
1046
+ `:t==="after"?o.html`
1047
1047
  <div class="filter-section date-inputs">
1048
1048
  <div>
1049
1049
  <span class="input-label">Start date</span>
@@ -1056,7 +1056,7 @@
1056
1056
  />
1057
1057
  </div>
1058
1058
  </div>
1059
- `:r.html`
1059
+ `:o.html`
1060
1060
  <div class="filter-section date-inputs">
1061
1061
  <div class="grid-2">
1062
1062
  <div>
@@ -1082,7 +1082,7 @@
1082
1082
  </div>
1083
1083
  </div>
1084
1084
  </div>
1085
- `}render(){return r.html`
1085
+ `}render(){return o.html`
1086
1086
  <div class="filter-content">
1087
1087
  <button
1088
1088
  class="clear-btn"
@@ -1093,20 +1093,20 @@
1093
1093
  ${this._renderRangeSection()}
1094
1094
  ${this._renderDateInputs()}
1095
1095
  </div>
1096
- `}};$e.styles=[Fe,r.css`
1096
+ `}};Se.styles=[Ae,o.css`
1097
1097
  .date-inputs {
1098
1098
  margin-top: 4px;
1099
1099
  }
1100
- `];Qe([l.property()],$e.prototype,"filterKey",2);Qe([l.property()],$e.prototype,"field",2);Qe([l.property()],$e.prototype,"kind",2);Qe([l.property()],$e.prototype,"preset",2);Qe([l.property()],$e.prototype,"from",2);Qe([l.property()],$e.prototype,"to",2);$e=Qe([l.customElement("ap-filter-date")],$e);var Lo=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lo(e,s,a),a};let Le=class extends r.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=b.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>=es}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:C.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:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:C.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 r.html`
1100
+ `];Xe([l.property()],Se.prototype,"filterKey",2);Xe([l.property()],Se.prototype,"field",2);Xe([l.property()],Se.prototype,"kind",2);Xe([l.property()],Se.prototype,"preset",2);Xe([l.property()],Se.prototype,"from",2);Xe([l.property()],Se.prototype,"to",2);Se=Xe([l.customElement("ap-filter-date")],Se);var Ir=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,ht=(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&&Ir(e,s,a),a};let Pe=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=_.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>=ls}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:C.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:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:C.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`
1101
1101
  <div
1102
1102
  class="tag-item ${s?"disabled":""}"
1103
- title=${s?`You can select up to ${es} tags`:r.nothing}
1103
+ title=${s?`You can select up to ${ls} tags`:o.nothing}
1104
1104
  @click=${()=>!s&&this._toggle(t.sid)}
1105
1105
  >
1106
1106
  <ap-checkbox ?checked=${e}></ap-checkbox>
1107
1107
  <span class="tag-name">${t.label}</span>
1108
1108
  </div>
1109
- `}render(){const t=this._search.toLowerCase().trim();return r.html`
1109
+ `}render(){const t=this._search.toLowerCase().trim();return o.html`
1110
1110
  <div class="filter-content">
1111
1111
  <div class="filter-header">
1112
1112
  <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
@@ -1117,15 +1117,15 @@
1117
1117
  .value=${this._search}
1118
1118
  @input=${this._onSearchInput}
1119
1119
  />
1120
- ${this._search?r.html`
1120
+ ${this._search?o.html`
1121
1121
  <button class="search-clear" @click=${this._clearSearch}>
1122
1122
  <ap-icon name="close" .size=${12}></ap-icon>
1123
1123
  </button>
1124
- `:r.nothing}
1124
+ `:o.nothing}
1125
1125
  </div>
1126
1126
 
1127
1127
  <!-- Selected chips (when not searching) -->
1128
- ${!this._isSearching&&this.selected.length>0?r.html`
1128
+ ${!this._isSearching&&this.selected.length>0?o.html`
1129
1129
  <div class="filter-section">
1130
1130
  <div class="section-header">
1131
1131
  <span class="section-label">Selected</span>
@@ -1135,30 +1135,30 @@
1135
1135
  >Clear all</button>
1136
1136
  </div>
1137
1137
  <div class="chips-wrap">
1138
- ${this.selected.map(e=>{const s=this._getTagBySid(e);return s?r.html`
1138
+ ${this.selected.map(e=>{const s=this._getTagBySid(e);return s?o.html`
1139
1139
  <div class="chip">
1140
1140
  <span class="chip-label">${s.label}</span>
1141
1141
  <button class="chip-remove" @click=${()=>this._remove(e)}>
1142
1142
  <ap-icon name="close" .size=${10}></ap-icon>
1143
1143
  </button>
1144
1144
  </div>
1145
- `:r.nothing})}
1145
+ `:o.nothing})}
1146
1146
  </div>
1147
1147
  </div>
1148
- `:r.nothing}
1148
+ `:o.nothing}
1149
1149
 
1150
1150
  ${this._isSearching?this._renderSearchResults(t):this._renderSections()}
1151
1151
 
1152
1152
  <!-- Limit warning -->
1153
- ${this._atLimit?r.html`
1153
+ ${this._atLimit?o.html`
1154
1154
  <div class="info-alert">
1155
1155
  <ap-icon name="info" .size=${14}></ap-icon>
1156
- <span>You can select up to ${es} tags.</span>
1156
+ <span>You can select up to ${ls} tags.</span>
1157
1157
  </div>
1158
- `:r.nothing}
1158
+ `:o.nothing}
1159
1159
  </div>
1160
- `}_renderSearchResults(t){const e=a=>a.toLowerCase().includes(t),s=this._suggestedTags.filter(a=>e(a.label)).slice(0,50),i=this._otherTags.filter(a=>e(a.label)).slice(0,50);return s.length===0&&i.length===0?r.html`<div class="no-results">No tags found</div>`:r.html`
1161
- ${s.length>0?r.html`
1160
+ `}_renderSearchResults(t){const e=a=>a.toLowerCase().includes(t),s=this._suggestedTags.filter(a=>e(a.label)).slice(0,50),i=this._otherTags.filter(a=>e(a.label)).slice(0,50);return s.length===0&&i.length===0?o.html`<div class="no-results">No tags found</div>`:o.html`
1161
+ ${s.length>0?o.html`
1162
1162
  <div class="filter-section">
1163
1163
  <div class="section-header">
1164
1164
  <span class="section-label">Suggested tags</span>
@@ -1172,37 +1172,37 @@
1172
1172
  ${s.map(a=>this._renderTagItem(a))}
1173
1173
  </div>
1174
1174
  </div>
1175
- `:r.nothing}
1175
+ `:o.nothing}
1176
1176
 
1177
- ${i.length>0?r.html`
1177
+ ${i.length>0?o.html`
1178
1178
  <div class="filter-section">
1179
1179
  <div class="section-header">
1180
- ${s.length===0?r.html`<span class="section-label">All tags</span>
1180
+ ${s.length===0?o.html`<span class="section-label">All tags</span>
1181
1181
  <button
1182
1182
  class="clear-btn"
1183
1183
  ?disabled=${this.selected.length===0}
1184
1184
  @click=${this._clearAll}
1185
- >Clear all</button>`:r.html`<span class="section-label">All tags</span>`}
1185
+ >Clear all</button>`:o.html`<span class="section-label">All tags</span>`}
1186
1186
  </div>
1187
1187
  <div class="options-list">
1188
1188
  ${i.map(a=>this._renderTagItem(a))}
1189
1189
  </div>
1190
1190
  </div>
1191
- `:r.nothing}
1192
- `}_renderSections(){if(this.tags.length===0)return r.html`<div class="no-results">No tags available</div>`;const t=this._suggestedTags.filter(e=>!this.selected.includes(e.sid));return r.html`
1191
+ `:o.nothing}
1192
+ `}_renderSections(){if(this.tags.length===0)return o.html`<div class="no-results">No tags available</div>`;const t=this._suggestedTags.filter(e=>!this.selected.includes(e.sid));return o.html`
1193
1193
  <div class="filter-section">
1194
- ${t.length>0?r.html`<span class="section-label">Suggested tags</span>`:r.nothing}
1195
- ${t.length>0?r.html`
1194
+ ${t.length>0?o.html`<span class="section-label">Suggested tags</span>`:o.nothing}
1195
+ ${t.length>0?o.html`
1196
1196
  <div class="options-list short">
1197
1197
  ${t.map(e=>this._renderTagItem(e))}
1198
1198
  </div>
1199
- `:r.nothing}
1199
+ `:o.nothing}
1200
1200
  </div>
1201
1201
 
1202
- ${t.length>0?r.html`<div class="separator"></div>`:r.nothing}
1202
+ ${t.length>0?o.html`<div class="separator"></div>`:o.nothing}
1203
1203
 
1204
1204
  <div class="hint-message">Find more tags by using search</div>
1205
- `}};Le.styles=[W,Fe,r.css`
1205
+ `}};Pe.styles=[H,Ae,o.css`
1206
1206
  .tag-item {
1207
1207
  display: flex;
1208
1208
  align-items: center;
@@ -1287,10 +1287,10 @@
1287
1287
  max-height: none;
1288
1288
  overflow-y: visible;
1289
1289
  }
1290
- `];ct([l.property({type:Array})],Le.prototype,"tags",2);ct([l.property({type:Array})],Le.prototype,"selected",2);ct([l.property()],Le.prototype,"filterKey",2);ct([l.query(".tag-search")],Le.prototype,"_searchInput",2);ct([l.state()],Le.prototype,"_search",2);Le=ct([l.customElement("ap-filter-tags")],Le);var Mo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Po(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mo(e,s,a),a};let He=class extends r.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>=ts}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:b.LABELS,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:[],operator:C.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 r.html`
1290
+ `];ht([l.property({type:Array})],Pe.prototype,"tags",2);ht([l.property({type:Array})],Pe.prototype,"selected",2);ht([l.property()],Pe.prototype,"filterKey",2);ht([l.query(".tag-search")],Pe.prototype,"_searchInput",2);ht([l.state()],Pe.prototype,"_search",2);Pe=ht([l.customElement("ap-filter-tags")],Pe);var zr=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Pt=(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&&zr(e,s,a),a};let Qe=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>=cs}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:_.LABELS,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:_.LABELS,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:_.LABELS,values:[],operator:C.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`
1291
1291
  <div
1292
1292
  class="label-item ${s?"disabled":""}"
1293
- title=${s?`You can select up to ${ts} labels`:r.nothing}
1293
+ title=${s?`You can select up to ${cs} labels`:o.nothing}
1294
1294
  @click=${()=>!s&&this._toggle(t.sid)}
1295
1295
  >
1296
1296
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -1300,7 +1300,7 @@
1300
1300
  <span class="label-name">${t.name}</span>
1301
1301
  <span class="count">${t.assets_count}</span>
1302
1302
  </div>
1303
- `}render(){const t=this._search.toLowerCase().trim(),e=this.labels.filter(s=>s.name.toLowerCase().includes(t));return r.html`
1303
+ `}render(){const t=this._search.toLowerCase().trim(),e=this.labels.filter(s=>s.name.toLowerCase().includes(t));return o.html`
1304
1304
  <div class="filter-content">
1305
1305
  <!-- Search input -->
1306
1306
  <div class="search-wrapper">
@@ -1312,15 +1312,15 @@
1312
1312
  .value=${this._search}
1313
1313
  @input=${this._onSearchInput}
1314
1314
  />
1315
- ${this._search?r.html`
1315
+ ${this._search?o.html`
1316
1316
  <button class="search-clear" @click=${this._clearSearch}>
1317
1317
  <ap-icon name="close" .size=${12}></ap-icon>
1318
1318
  </button>
1319
- `:r.nothing}
1319
+ `:o.nothing}
1320
1320
  </div>
1321
1321
 
1322
1322
  <!-- Selected chips (when not searching) -->
1323
- ${!this._isSearching&&this.selected.length>0?r.html`
1323
+ ${!this._isSearching&&this.selected.length>0?o.html`
1324
1324
  <div class="filter-section">
1325
1325
  <div class="section-header">
1326
1326
  <span class="section-label">Selected</span>
@@ -1330,7 +1330,7 @@
1330
1330
  >Clear all</button>
1331
1331
  </div>
1332
1332
  <div class="chips-wrap">
1333
- ${this.selected.map(s=>{const i=this._getLabelBySid(s);return i?r.html`
1333
+ ${this.selected.map(s=>{const i=this._getLabelBySid(s);return i?o.html`
1334
1334
  <div class="chip">
1335
1335
  <span class="chip-icon" ${F({color:i.color})}>
1336
1336
  <ap-icon name="tag" .size=${12}></ap-icon>
@@ -1340,10 +1340,10 @@
1340
1340
  <ap-icon name="close" .size=${10}></ap-icon>
1341
1341
  </button>
1342
1342
  </div>
1343
- `:r.nothing})}
1343
+ `:o.nothing})}
1344
1344
  </div>
1345
1345
  </div>
1346
- `:r.nothing}
1346
+ `:o.nothing}
1347
1347
 
1348
1348
  <!-- Labels list -->
1349
1349
  <div class="filter-section">
@@ -1356,19 +1356,19 @@
1356
1356
  >Clear all</button>
1357
1357
  </div>
1358
1358
  <div class="options-list">
1359
- ${e.length===0?r.html`<div class="no-results">No labels found</div>`:e.map(s=>this._renderLabelItem(s))}
1359
+ ${e.length===0?o.html`<div class="no-results">No labels found</div>`:e.map(s=>this._renderLabelItem(s))}
1360
1360
  </div>
1361
1361
  </div>
1362
1362
 
1363
1363
  <!-- Limit warning -->
1364
- ${this._atLimit?r.html`
1364
+ ${this._atLimit?o.html`
1365
1365
  <div class="info-alert">
1366
1366
  <ap-icon name="info" .size=${14}></ap-icon>
1367
- <span>You can select up to ${ts} labels.</span>
1367
+ <span>You can select up to ${cs} labels.</span>
1368
1368
  </div>
1369
- `:r.nothing}
1369
+ `:o.nothing}
1370
1370
  </div>
1371
- `}};He.styles=[Fe,r.css`
1371
+ `}};Qe.styles=[Ae,o.css`
1372
1372
  .label-item {
1373
1373
  display: flex;
1374
1374
  align-items: center;
@@ -1417,9 +1417,9 @@
1417
1417
  flex-shrink: 0;
1418
1418
  line-height: 0;
1419
1419
  }
1420
- `];Ct([l.property({type:Array})],He.prototype,"labels",2);Ct([l.property({type:Array})],He.prototype,"selected",2);Ct([l.query(".search-input")],He.prototype,"_searchInput",2);Ct([l.state()],He.prototype,"_search",2);He=Ct([l.customElement("ap-filter-labels")],He);var Io=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Do(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Io(e,s,a),a};const ds=3,fs=/^#[0-9A-Fa-f]{6}$/;function zo(t){const e=t.trim().split(/\s+/);return e.length<1||!fs.test(e[0])?null:{hex:e[0],tolerance:e[1]||Pt,coverage:e[3]||Mt}}let Oe=class extends r.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=zo(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!==Pt||s.coverage!==Mt)),this._initialized=!0)}}_selectColor(t){if(!fs.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=ds||(this._colors=[...this._colors,{hex:t,tolerance:Pt,coverage:Mt}],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),!fs.test(i)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const o=[...this._colors];o[t]={...o[t],hex:i},this._colors=o,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:Pt,i=this._advanced?e.coverage:Mt;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>=ds;return r.html`
1420
+ `];Pt([l.property({type:Array})],Qe.prototype,"labels",2);Pt([l.property({type:Array})],Qe.prototype,"selected",2);Pt([l.query(".search-input")],Qe.prototype,"_searchInput",2);Pt([l.state()],Qe.prototype,"_search",2);Qe=Pt([l.customElement("ap-filter-labels")],Qe);var jr=Object.defineProperty,Nr=Object.getOwnPropertyDescriptor,ut=(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&&jr(e,s,a),a};const bs=3,$s=/^#[0-9A-Fa-f]{6}$/;function Ur(t){const e=t.trim().split(/\s+/);return e.length<1||!$s.test(e[0])?null:{hex:e[0],tolerance:e[1]||Bt,coverage:e[3]||Ut}}let Ie=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=Ur(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!==Bt||s.coverage!==Ut)),this._initialized=!0)}}_selectColor(t){if(!$s.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=bs||(this._colors=[...this._colors,{hex:t,tolerance:Bt,coverage:Ut}],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),!$s.test(i)||this._colors.some((n,c)=>c!==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:Bt,i=this._advanced?e.coverage:Ut;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>=bs;return o.html`
1421
1421
  <div class="palette">
1422
- ${$a.map(s=>{const i=t.has(s),a=e&&!i;return r.html`
1422
+ ${Ea.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1423
1423
  <button
1424
1424
  class="swatch ${i?"selected":""} ${a?"disabled":""}"
1425
1425
  ${F({background:s,...s==="#ffffff"?{border:"1px solid #e4e4e7"}:{}})}
@@ -1429,7 +1429,7 @@
1429
1429
  ></button>
1430
1430
  `})}
1431
1431
  </div>
1432
- `}_renderColorEntry(t,e){return this._advanced?r.html`
1432
+ `}_renderColorEntry(t,e){return this._advanced?o.html`
1433
1433
  <div class="color-row advanced">
1434
1434
  <div class="adv-field">
1435
1435
  <span class="adv-field-label">Color</span>
@@ -1448,7 +1448,7 @@
1448
1448
  <span class="adv-field-label">Difference</span>
1449
1449
  <ap-dropdown
1450
1450
  .value=${t.tolerance}
1451
- .options=${ka}
1451
+ .options=${Aa}
1452
1452
  @ap-change=${s=>this._handleToleranceChange(e,s)}
1453
1453
  ></ap-dropdown>
1454
1454
  </div>
@@ -1470,7 +1470,7 @@
1470
1470
  <ap-icon name="close" .size=${14}></ap-icon>
1471
1471
  </button>
1472
1472
  </div>
1473
- `:r.html`
1473
+ `:o.html`
1474
1474
  <div class="color-row">
1475
1475
  <div class="color-swatch-small" ${F({background:t.hex})}></div>
1476
1476
  <input
@@ -1484,7 +1484,7 @@
1484
1484
  <ap-icon name="close" .size=${14}></ap-icon>
1485
1485
  </button>
1486
1486
  </div>
1487
- `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<ds&&!this._showPalette;return r.html`
1487
+ `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<bs&&!this._showPalette;return o.html`
1488
1488
  <div class="filter-content">
1489
1489
  <button
1490
1490
  class="clear-btn"
@@ -1504,32 +1504,32 @@
1504
1504
  </div>
1505
1505
 
1506
1506
  <div class="filter-section">
1507
- ${t?this._renderPalette():r.nothing}
1507
+ ${t?this._renderPalette():o.nothing}
1508
1508
  </div>
1509
1509
 
1510
- ${this._colors.length>0?r.html`
1510
+ ${this._colors.length>0?o.html`
1511
1511
  <div class="filter-section">
1512
1512
  <div class="selected-colors">
1513
1513
  ${this._colors.map((s,i)=>this._renderColorEntry(s,i))}
1514
1514
  </div>
1515
1515
  </div>
1516
- `:r.nothing}
1516
+ `:o.nothing}
1517
1517
 
1518
- ${e?r.html`
1518
+ ${e?o.html`
1519
1519
  <div class="filter-section">
1520
1520
  <button class="add-color-btn" @click=${this._showAddPalette}>
1521
1521
  <ap-icon name="plus" .size=${14}></ap-icon>
1522
1522
  Add color
1523
1523
  </button>
1524
1524
  </div>
1525
- `:r.nothing}
1525
+ `:o.nothing}
1526
1526
 
1527
1527
  <div class="info-alert">
1528
1528
  <ap-icon name="info" .size=${14}></ap-icon>
1529
1529
  <span>Requires image processing to be enabled.</span>
1530
1530
  </div>
1531
1531
  </div>
1532
- `}};Oe.styles=[W,Fe,r.css`
1532
+ `}};Ie.styles=[H,Ae,o.css`
1533
1533
  /* ── Palette ── */
1534
1534
  .palette {
1535
1535
  display: grid;
@@ -1771,7 +1771,7 @@
1771
1771
  .add-color-btn:hover {
1772
1772
  opacity: 0.8;
1773
1773
  }
1774
- `];dt([l.property({type:Array})],Oe.prototype,"values",2);dt([l.state()],Oe.prototype,"_colors",2);dt([l.state()],Oe.prototype,"_advanced",2);dt([l.state()],Oe.prototype,"_showPalette",2);dt([l.state()],Oe.prototype,"_initialized",2);Oe=dt([l.customElement("ap-filter-color")],Oe);var Ro=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?jo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ro(e,s,a),a};const No={KB:1/1e3,MB:1,GB:1e3},Uo=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let ke=class extends r.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=No[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:b.SIZE,values:[],operator:C.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[i],operator:C.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 r.html`
1774
+ `];ut([l.property({type:Array})],Ie.prototype,"values",2);ut([l.state()],Ie.prototype,"_colors",2);ut([l.state()],Ie.prototype,"_advanced",2);ut([l.state()],Ie.prototype,"_showPalette",2);ut([l.state()],Ie.prototype,"_initialized",2);Ie=ut([l.customElement("ap-filter-color")],Ie);var Br=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Ze=(t,e,s,i)=>{for(var a=i>1?void 0:i?qr(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};const Vr={KB:1/1e3,MB:1,GB:1e3},Hr=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let Ce=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=Vr[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:_.SIZE,values:[],operator:C.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:_.SIZE,values:[i],operator:C.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`
1775
1775
  <div class="filter-content">
1776
1776
  <span class="section-label">Size</span>
1777
1777
  <button
@@ -1808,14 +1808,14 @@
1808
1808
  <div>
1809
1809
  <span class="input-label">Unit</span>
1810
1810
  <ap-dropdown
1811
- .options=${Uo}
1811
+ .options=${Hr}
1812
1812
  .value=${this._unit}
1813
1813
  @ap-change=${this._setUnit}
1814
1814
  ></ap-dropdown>
1815
1815
  </div>
1816
1816
  </div>
1817
1817
  </div>
1818
- `}};ke.styles=[Fe,r.css`
1818
+ `}};Ce.styles=[Ae,o.css`
1819
1819
  /* Hide number input spinners */
1820
1820
  .filter-input[type='number']::-webkit-inner-spin-button,
1821
1821
  .filter-input[type='number']::-webkit-outer-spin-button {
@@ -1834,19 +1834,19 @@
1834
1834
  display: block;
1835
1835
  width: 100%;
1836
1836
  }
1837
- `];Ye([l.property({type:Number})],ke.prototype,"min",2);Ye([l.property({type:Number})],ke.prototype,"max",2);Ye([l.state()],ke.prototype,"_minVal",2);Ye([l.state()],ke.prototype,"_maxVal",2);Ye([l.state()],ke.prototype,"_unit",2);Ye([l.state()],ke.prototype,"_initialized",2);ke=Ye([l.customElement("ap-filter-size")],ke);var Bo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Yt=(t,e,s,i)=>{for(var a=i>1?void 0:i?qo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Bo(e,s,a),a};const Vo=r.svg`
1837
+ `];Ze([l.property({type:Number})],Ce.prototype,"min",2);Ze([l.property({type:Number})],Ce.prototype,"max",2);Ze([l.state()],Ce.prototype,"_minVal",2);Ze([l.state()],Ce.prototype,"_maxVal",2);Ze([l.state()],Ce.prototype,"_unit",2);Ze([l.state()],Ce.prototype,"_initialized",2);Ce=Ze([l.customElement("ap-filter-size")],Ce);var Gr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,is=(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&&Gr(e,s,a),a};const Qr=o.svg`
1838
1838
  <svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1839
1839
  <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"/>
1840
1840
  <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"/>
1841
1841
  <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"/>
1842
1842
  </svg>
1843
- `,Ho=r.svg`
1843
+ `,Yr=o.svg`
1844
1844
  <svg width="20" height="20" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1845
1845
  <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"/>
1846
1846
  <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"/>
1847
1847
  <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"/>
1848
1848
  </svg>
1849
- `,Go=r.svg`
1849
+ `,Wr=o.svg`
1850
1850
  <svg width="20" height="20" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1851
1851
  <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"/>
1852
1852
  <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"/>
@@ -1854,13 +1854,13 @@
1854
1854
  <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"/>
1855
1855
  <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"/>
1856
1856
  </svg>
1857
- `,Ko=r.svg`
1857
+ `,Xr=o.svg`
1858
1858
  <svg width="20" height="20" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
1859
1859
  <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"/>
1860
1860
  <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"/>
1861
1861
  <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"/>
1862
1862
  </svg>
1863
- `,Qo={portrait:Vo,landscape:Ho,square:Go,panorama:Ko};let ot=class extends r.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 r.html`
1863
+ `,Zr={portrait:Qr,landscape:Yr,square:Wr,panorama:Xr};let lt=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`
1864
1864
  <div class="filter-content">
1865
1865
  <button
1866
1866
  class="clear-btn"
@@ -1871,7 +1871,7 @@
1871
1871
  <div class="filter-section">
1872
1872
  <span class="section-label">Resolution</span>
1873
1873
  <div class="options-horizontal">
1874
- ${_a.map(t=>r.html`
1874
+ ${ka.map(t=>o.html`
1875
1875
  <ap-checkbox
1876
1876
  ?checked=${this.selectedResolution.includes(t.value)}
1877
1877
  @ap-toggle=${()=>{this._toggleResolution(t.value)}}
@@ -1883,11 +1883,11 @@
1883
1883
  <div class="filter-section">
1884
1884
  <span class="section-label">Orientation</span>
1885
1885
  <div class="options-vertical">
1886
- ${ya.map(t=>r.html`
1886
+ ${Sa.map(t=>o.html`
1887
1887
  <ap-checkbox
1888
1888
  ?checked=${this.selectedOrientation.includes(t.value)}
1889
1889
  @ap-toggle=${()=>{this._toggleOrientation(t.value)}}
1890
- ><span class="orientation-label">${Qo[t.value]}${t.label}</span></ap-checkbox>
1890
+ ><span class="orientation-label">${Zr[t.value]}${t.label}</span></ap-checkbox>
1891
1891
  `)}
1892
1892
  </div>
1893
1893
  </div>
@@ -1895,7 +1895,7 @@
1895
1895
  <div class="filter-section">
1896
1896
  <span class="section-label">Faces</span>
1897
1897
  <div class="options-horizontal">
1898
- ${xa.map(t=>r.html`
1898
+ ${Ca.map(t=>o.html`
1899
1899
  <ap-checkbox
1900
1900
  ?checked=${this.selectedFaces.includes(t.value)}
1901
1901
  @ap-toggle=${()=>{this._toggleFaces(t.value)}}
@@ -1909,7 +1909,7 @@
1909
1909
  <span>Some images might not have been processed, so they won't be displayed.</span>
1910
1910
  </div>
1911
1911
  </div>
1912
- `}};ot.styles=[Fe,r.css`
1912
+ `}};lt.styles=[Ae,o.css`
1913
1913
  .options-horizontal {
1914
1914
  display: flex;
1915
1915
  gap: 28px;
@@ -1930,18 +1930,18 @@
1930
1930
  .orientation-label svg {
1931
1931
  flex-shrink: 0;
1932
1932
  }
1933
- `];Yt([l.property({type:Array})],ot.prototype,"selectedResolution",2);Yt([l.property({type:Array})],ot.prototype,"selectedOrientation",2);Yt([l.property({type:Array})],ot.prototype,"selectedFaces",2);ot=Yt([l.customElement("ap-filter-image")],ot);var Yo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Yo(e,s,a),a};function T(t){return`${Kt[t.type]||""}${t.key}`}let I=class extends r.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>=Lt}_getField(t){return this.fields.find(e=>T(e)===t)}_getUIType(t){return Ea[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===ne||t[0]===le}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===ne?ne:((i=e.values)==null?void 0:i[0])===le?le:this._specificModeFields.has(t)||e.values&&e.values.length>0?Re:""}_emitFilterChange(t,e,s){const i=T(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=T(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=T(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=T(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(T(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=T(t);if(e===Re){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}if(e)this._onEmptyOption(t,e);else{const i=this._getApplied(s);this._emitFilterChange(t,i.operator,[])}}}_clearFieldFilter(t){const e=T(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,...o}=this._dateFroms;this._dateFroms=o;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...g}=this._tagInputs;this._tagInputs=g,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(T(t)).operator||is[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=T(t),o=this._getApplied(a),n=o.operator||os[0].value,c=[...o.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===$.DECIMAL2;if(!d.every(g=>h?!isNaN(parseFloat(g)):/^-?\d+$/.test(g)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];o.length===1&&o[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||as[0].value,o=i.values||[],n=o.includes(e)?o.filter(c=>c!==e):[...o,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=T(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=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];o.includes(e)||this._emitFilterChange(t,a,[...o,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(o=>o.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||xe[0].value,o=i.values||[];o.includes(s)||this._emitFilterChange(t,a,[...o,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];this._emitFilterChange(t,a,o.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=T(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=T(t);if(!e){this._clearFieldFilter(t);return}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="",o="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),o=i.toISOString();break}case"last_week":{const n=new Date(i),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),o=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),o=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.toISOString(),o=n.toISOString();break}}a&&o&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:o},this._emitFilterChange(t,"..",[a,o]))}_onDateInput(t,e,s){const i=s.target.value,a=T(t),o=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 c=this._dateFroms[a]||"",d=this._dateTos[a]||"";o==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),o==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var g;const s=e.target.value.trim(),i=T(t),a=(g=this.shadowRoot)==null?void 0:g.querySelector(`[data-geo-radius="${i}"]`),o=(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[c,d]=n;let u=`${c},${d}..${o||"0"}`;this._emitFilterChange(t,C.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=T(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const o=a.values[0],[n]=o.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,C.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===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,o)=>o.length===0?r.nothing:r.html`
1933
+ `];is([l.property({type:Array})],lt.prototype,"selectedResolution",2);is([l.property({type:Array})],lt.prototype,"selectedOrientation",2);is([l.property({type:Array})],lt.prototype,"selectedFaces",2);lt=is([l.customElement("ap-filter-image")],lt);var Jr=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var a=i>1?void 0:i?eo(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&&Jr(e,s,a),a};function T(t){return`${ts[t.type]||""}${t.key}`}let I=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>=jt}_getField(t){return this.fields.find(e=>T(e)===t)}_getUIType(t){return Ma[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===ne||t[0]===le}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===ne?ne:((i=e.values)==null?void 0:i[0])===le?le:this._specificModeFields.has(t)||e.values&&e.values.length>0?Ue:""}_emitFilterChange(t,e,s){const i=T(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=T(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=T(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=T(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(T(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=T(t);if(e===Ue){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}if(e)this._onEmptyOption(t,e);else{const i=this._getApplied(s);this._emitFilterChange(t,i.operator,[])}}}_clearFieldFilter(t){const e=T(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,...c}=this._dateTos;this._dateTos=c;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(T(t)).operator||ps[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=T(t),r=this._getApplied(a),n=r.operator||us[0].value,c=[...r.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===$.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||$e[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=T(t),i=this._getApplied(s),a=i.operator||hs[0].value,r=i.values||[],n=r.includes(e)?r.filter(c=>c!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=T(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=T(t),i=this._getApplied(s),a=i.operator||$e[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||$e[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=T(t),i=this._getApplied(s),a=i.operator||$e[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=T(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=T(t);if(!e){this._clearFieldFilter(t);return}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),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-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),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.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=T(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 c=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=T(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[c,d]=n;let u=`${c},${d}..${r||"0"}`;this._emitFilterChange(t,C.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=T(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,C.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===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`
1934
1934
  <div class="field-group-label">${a}</div>
1935
- ${o.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return r.html`
1935
+ ${r.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return o.html`
1936
1936
  <div
1937
1937
  class="field-item ${d?"selected":""} ${h?"disabled":""}"
1938
1938
  @click=${()=>!h&&!d&&this._addField(n)}
1939
1939
  >
1940
- ${d?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.html`<ap-icon name=${It[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>`}
1940
+ ${d?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.html`<ap-icon name=${qt[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>`}
1941
1941
  <span>${n.label}</span>
1942
1942
  </div>
1943
1943
  `})}
1944
- `;return r.html`
1944
+ `;return o.html`
1945
1945
  <div class="field-selection">
1946
1946
  <div class="field-selection-header">
1947
1947
  <span class="field-selection-title">Add metadata field</span>
@@ -1963,10 +1963,10 @@
1963
1963
  />
1964
1964
  </div>
1965
1965
  <div class="field-list">
1966
- ${e.length===0?r.html`<div class="empty-msg">No fields found</div>`:r.html`${[...s.entries()].map(([a,o])=>i(a,o))}`}
1966
+ ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
1967
1967
  </div>
1968
1968
  </div>
1969
- `}_renderTextFilter(t){var h,u;const e=T(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",o=this._getContentMode(e),n=o===ne||o===le,c=s.operator||is[0].value,d=t.type===$.TEXT_AREA;return r.html`
1969
+ `}_renderTextFilter(t){var h,u;const e=T(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===ne||r===le,c=s.operator||ps[0].value,d=t.type===$.TEXT_AREA;return o.html`
1970
1970
  <div class="filter-content">
1971
1971
  <button
1972
1972
  class="clear-btn"
@@ -1978,10 +1978,10 @@
1978
1978
  <span class="section-label">Operator</span>
1979
1979
  <ap-radio-group
1980
1980
  direction="horizontal"
1981
- .options=${is}
1981
+ .options=${ps}
1982
1982
  .value=${c}
1983
1983
  ?disabled=${n}
1984
- @ap-change=${g=>this._onOperatorChange(t,g.detail.value)}
1984
+ @ap-change=${f=>this._onOperatorChange(t,f.detail.value)}
1985
1985
  ></ap-radio-group>
1986
1986
  </div>
1987
1987
 
@@ -1989,36 +1989,36 @@
1989
1989
  <span class="section-label">Content</span>
1990
1990
  <ap-radio-group
1991
1991
  clearable
1992
- .options=${rs}
1993
- .value=${o}
1994
- @ap-change=${g=>this._onContentModeChange(t,g.detail.value)}
1992
+ .options=${fs}
1993
+ .value=${r}
1994
+ @ap-change=${f=>this._onContentModeChange(t,f.detail.value)}
1995
1995
  ></ap-radio-group>
1996
1996
  </div>
1997
1997
 
1998
- ${o===Re?r.html`
1998
+ ${r===Ue?o.html`
1999
1999
  <div class="filter-section">
2000
2000
  <span class="section-label">Value</span>
2001
- ${d?r.html`
2001
+ ${d?o.html`
2002
2002
  <textarea
2003
2003
  class="filter-input"
2004
2004
  placeholder="Enter value"
2005
2005
  .value=${a}
2006
- @change=${g=>this._onTextInput(t,g)}
2006
+ @change=${f=>this._onTextInput(t,f)}
2007
2007
  ></textarea>
2008
- `:r.html`
2008
+ `:o.html`
2009
2009
  <input
2010
2010
  class="filter-input"
2011
2011
  type="text"
2012
2012
  placeholder="Enter value"
2013
2013
  .value=${a}
2014
- @change=${g=>this._onTextInput(t,g)}
2015
- @keydown=${g=>{g.key==="Enter"&&g.preventDefault()}}
2014
+ @change=${f=>this._onTextInput(t,f)}
2015
+ @keydown=${f=>{f.key==="Enter"&&f.preventDefault()}}
2016
2016
  />
2017
2017
  `}
2018
2018
  </div>
2019
- `:r.nothing}
2019
+ `:o.nothing}
2020
2020
  </div>
2021
- `}_renderNumberFilter(t){var y,L,k;const e=T(t),s=this._getApplied(e),i=s.operator||os[0].value,a=this._isSpecialValue(s.values),o=this._getContentMode(e),n=o===ne||o===le,c=i===C.RANGE,d=i===C.GREATER_THAN_OR_EQUAL,h=i===C.LESS_THAN_OR_EQUAL,u=t.type===$.DECIMAL2,g=u?"0.01":"1",p=u?"0.00":"0",f=a?"":((y=s.values)==null?void 0:y[0])||"",m=a?"":((L=s.values)==null?void 0:L[1])||"",x=c||d||h,_=c||d||h?"Min":"Value";return r.html`
2021
+ `}_renderNumberFilter(t){var y,L,k;const e=T(t),s=this._getApplied(e),i=s.operator||us[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===ne||r===le,c=i===C.RANGE,d=i===C.GREATER_THAN_OR_EQUAL,h=i===C.LESS_THAN_OR_EQUAL,u=t.type===$.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((y=s.values)==null?void 0:y[0])||"",m=a?"":((L=s.values)==null?void 0:L[1])||"",x=c||d||h,b=c||d||h?"Min":"Value";return o.html`
2022
2022
  <div class="filter-content">
2023
2023
  <button
2024
2024
  class="clear-btn"
@@ -2030,7 +2030,7 @@
2030
2030
  <span class="section-label">Condition</span>
2031
2031
  <ap-radio-group
2032
2032
  columns="2"
2033
- .options=${os}
2033
+ .options=${us}
2034
2034
  .value=${i}
2035
2035
  ?disabled=${n}
2036
2036
  @ap-change=${S=>this._onOperatorChange(t,S.detail.value)}
@@ -2041,46 +2041,46 @@
2041
2041
  <span class="section-label">Content</span>
2042
2042
  <ap-radio-group
2043
2043
  clearable
2044
- .options=${rs}
2045
- .value=${o}
2044
+ .options=${fs}
2045
+ .value=${r}
2046
2046
  @ap-change=${S=>this._onContentModeChange(t,S.detail.value)}
2047
2047
  ></ap-radio-group>
2048
2048
  </div>
2049
2049
 
2050
- ${o===Re?r.html`
2050
+ ${r===Ue?o.html`
2051
2051
  <div class="filter-section">
2052
2052
  <div class="grid-2">
2053
2053
  <div>
2054
- <span class="input-label" aria-disabled=${h?"true":r.nothing}>${_}</span>
2054
+ <span class="input-label" aria-disabled=${h?"true":o.nothing}>${b}</span>
2055
2055
  <input
2056
2056
  class="filter-input"
2057
2057
  type="number"
2058
- step=${g}
2058
+ step=${f}
2059
2059
  placeholder=${p}
2060
- .value=${f}
2060
+ .value=${g}
2061
2061
  ?disabled=${h}
2062
2062
  @change=${S=>this._onNumberInput(t,S,0)}
2063
2063
  />
2064
2064
  </div>
2065
- ${x?r.html`
2065
+ ${x?o.html`
2066
2066
  <div>
2067
- <span class="input-label" aria-disabled=${d?"true":r.nothing}>${"Max"}</span>
2067
+ <span class="input-label" aria-disabled=${d?"true":o.nothing}>${"Max"}</span>
2068
2068
  <input
2069
2069
  class="filter-input"
2070
2070
  type="number"
2071
- step=${g}
2071
+ step=${f}
2072
2072
  placeholder=${p}
2073
2073
  .value=${m}
2074
2074
  ?disabled=${d}
2075
2075
  @change=${S=>this._onNumberInput(t,S,1)}
2076
2076
  />
2077
2077
  </div>
2078
- `:r.nothing}
2078
+ `:o.nothing}
2079
2079
  </div>
2080
2080
  </div>
2081
- `:r.nothing}
2081
+ `:o.nothing}
2082
2082
  </div>
2083
- `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2083
+ `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2084
2084
  <div class="filter-content">
2085
2085
  <button
2086
2086
  class="clear-btn"
@@ -2092,13 +2092,13 @@
2092
2092
  <span class="section-label">Value</span>
2093
2093
  <ap-radio-group
2094
2094
  clearable
2095
- .options=${Fa}
2095
+ .options=${Oa}
2096
2096
  .value=${s}
2097
- @ap-change=${o=>this._onBooleanSelect(t,o.detail.value)}
2097
+ @ap-change=${r=>this._onBooleanSelect(t,r.detail.value)}
2098
2098
  ></ap-radio-group>
2099
2099
  </div>
2100
2100
  </div>
2101
- `}_renderSelectOneFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||xe[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Lt;return r.html`
2101
+ `}_renderSelectOneFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||$e[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=jt;return o.html`
2102
2102
  <div class="filter-content">
2103
2103
  <!-- Search input -->
2104
2104
  <div class="search-wrapper">
@@ -2110,14 +2110,14 @@
2110
2110
  .value=${this._selectSearches[e]||""}
2111
2111
  @input=${p=>{this._selectSearches={...this._selectSearches,[e]:p.target.value}}}
2112
2112
  />
2113
- ${d?r.html`
2113
+ ${d?o.html`
2114
2114
  <button class="search-clear" @click=${()=>{this._selectSearches={...this._selectSearches,[e]:""}}}>
2115
2115
  <ap-icon name="close" .size=${12}></ap-icon>
2116
2116
  </button>
2117
- `:r.nothing}
2117
+ `:o.nothing}
2118
2118
  </div>
2119
2119
 
2120
- ${d?r.html`
2120
+ ${d?o.html`
2121
2121
  <div class="section-header">
2122
2122
  <span class="section-label"></span>
2123
2123
  <button
@@ -2126,7 +2126,7 @@
2126
2126
  @click=${()=>this._clearFieldFilter(t)}
2127
2127
  >Clear all</button>
2128
2128
  </div>
2129
- `:r.html`
2129
+ `:o.html`
2130
2130
  <!-- Operator -->
2131
2131
  <div class="filter-section">
2132
2132
  <div class="section-header">
@@ -2139,14 +2139,14 @@
2139
2139
  </div>
2140
2140
  <ap-radio-group
2141
2141
  direction="horizontal"
2142
- .options=${xe}
2142
+ .options=${$e}
2143
2143
  .value=${n}
2144
2144
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2145
2145
  ></ap-radio-group>
2146
2146
  </div>
2147
2147
 
2148
2148
  <!-- Selected chips -->
2149
- ${a.length>0?r.html`
2149
+ ${a.length>0?o.html`
2150
2150
  <div class="filter-section">
2151
2151
  <div class="section-header">
2152
2152
  <span class="section-label">Selected</span>
@@ -2156,9 +2156,9 @@
2156
2156
  >Clear all</button>
2157
2157
  </div>
2158
2158
  <div class="chips-wrap">
2159
- ${a.map(p=>{const f=o.find(m=>m.api_value===p);return r.html`
2159
+ ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
2160
2160
  <div class="chip">
2161
- <span class="chip-label">${(f==null?void 0:f.label)||p}</span>
2161
+ <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
2162
2162
  <button class="chip-remove" @click=${()=>this._onSelectOneToggle(t,p)}>
2163
2163
  <ap-icon name="close" .size=${10}></ap-icon>
2164
2164
  </button>
@@ -2166,7 +2166,7 @@
2166
2166
  `})}
2167
2167
  </div>
2168
2168
  </div>
2169
- `:r.nothing}
2169
+ `:o.nothing}
2170
2170
  `}
2171
2171
 
2172
2172
  <!-- Options list -->
@@ -2175,12 +2175,12 @@
2175
2175
 
2176
2176
  <!-- Empty/Not empty checkboxes -->
2177
2177
  <div class="options-list short">
2178
- ${Ue.map(p=>{var f;return r.html`
2178
+ ${Ve.map(p=>{var g;return o.html`
2179
2179
  <div
2180
2180
  class="option-item"
2181
2181
  @click=${()=>this._onEmptyOption(t,p.value)}
2182
2182
  >
2183
- <ap-checkbox ?checked=${((f=s.values)==null?void 0:f[0])===p.value}></ap-checkbox>
2183
+ <ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
2184
2184
  <span>${p.label}</span>
2185
2185
  </div>
2186
2186
  `})}
@@ -2190,19 +2190,19 @@
2190
2190
 
2191
2191
  <!-- Regular options -->
2192
2192
  <div class="options-list">
2193
- ${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const f=a.includes(p.api_value),m=!f&&g;return r.html`
2193
+ ${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`
2194
2194
  <div
2195
2195
  class="option-item ${m?"disabled":""}"
2196
2196
  @click=${()=>!m&&this._onSelectOneToggle(t,p.api_value)}
2197
2197
  >
2198
- <ap-checkbox ?checked=${f}></ap-checkbox>
2198
+ <ap-checkbox ?checked=${g}></ap-checkbox>
2199
2199
  <span>${p.label}</span>
2200
2200
  </div>
2201
2201
  `})}
2202
2202
  </div>
2203
2203
  </div>
2204
2204
  </div>
2205
- `}_renderMultiSelectFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||as[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Lt;return r.html`
2205
+ `}_renderMultiSelectFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||hs[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=jt;return o.html`
2206
2206
  <div class="filter-content">
2207
2207
  <!-- Search input -->
2208
2208
  <div class="search-wrapper">
@@ -2214,14 +2214,14 @@
2214
2214
  .value=${this._selectSearches[e]||""}
2215
2215
  @input=${p=>{this._selectSearches={...this._selectSearches,[e]:p.target.value}}}
2216
2216
  />
2217
- ${d?r.html`
2217
+ ${d?o.html`
2218
2218
  <button class="search-clear" @click=${()=>{this._selectSearches={...this._selectSearches,[e]:""}}}>
2219
2219
  <ap-icon name="close" .size=${12}></ap-icon>
2220
2220
  </button>
2221
- `:r.nothing}
2221
+ `:o.nothing}
2222
2222
  </div>
2223
2223
 
2224
- ${d?r.html`
2224
+ ${d?o.html`
2225
2225
  <div class="section-header">
2226
2226
  <span class="section-label"></span>
2227
2227
  <button
@@ -2230,7 +2230,7 @@
2230
2230
  @click=${()=>this._clearFieldFilter(t)}
2231
2231
  >Clear all</button>
2232
2232
  </div>
2233
- `:r.html`
2233
+ `:o.html`
2234
2234
  <!-- Operator -->
2235
2235
  <div class="filter-section">
2236
2236
  <div class="section-header">
@@ -2243,14 +2243,14 @@
2243
2243
  </div>
2244
2244
  <ap-radio-group
2245
2245
  direction="horizontal"
2246
- .options=${as}
2246
+ .options=${hs}
2247
2247
  .value=${n}
2248
2248
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2249
2249
  ></ap-radio-group>
2250
2250
  </div>
2251
2251
 
2252
2252
  <!-- Selected chips -->
2253
- ${a.length>0?r.html`
2253
+ ${a.length>0?o.html`
2254
2254
  <div class="filter-section">
2255
2255
  <div class="section-header">
2256
2256
  <span class="section-label">Selected</span>
@@ -2260,9 +2260,9 @@
2260
2260
  >Clear all</button>
2261
2261
  </div>
2262
2262
  <div class="chips-wrap">
2263
- ${a.map(p=>{const f=o.find(m=>m.api_value===p);return r.html`
2263
+ ${a.map(p=>{const g=r.find(m=>m.api_value===p);return o.html`
2264
2264
  <div class="chip">
2265
- <span class="chip-label">${(f==null?void 0:f.label)||p}</span>
2265
+ <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
2266
2266
  <button class="chip-remove" @click=${()=>this._onMultiSelectToggle(t,p)}>
2267
2267
  <ap-icon name="close" .size=${10}></ap-icon>
2268
2268
  </button>
@@ -2270,7 +2270,7 @@
2270
2270
  `})}
2271
2271
  </div>
2272
2272
  </div>
2273
- `:r.nothing}
2273
+ `:o.nothing}
2274
2274
  `}
2275
2275
 
2276
2276
  <!-- Options list -->
@@ -2279,12 +2279,12 @@
2279
2279
 
2280
2280
  <!-- Empty/Not empty checkboxes -->
2281
2281
  <div class="options-list short">
2282
- ${Ue.map(p=>{var f;return r.html`
2282
+ ${Ve.map(p=>{var g;return o.html`
2283
2283
  <div
2284
2284
  class="option-item"
2285
2285
  @click=${()=>this._onEmptyOption(t,p.value)}
2286
2286
  >
2287
- <ap-checkbox ?checked=${((f=s.values)==null?void 0:f[0])===p.value}></ap-checkbox>
2287
+ <ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
2288
2288
  <span>${p.label}</span>
2289
2289
  </div>
2290
2290
  `})}
@@ -2294,19 +2294,19 @@
2294
2294
 
2295
2295
  <!-- Regular options -->
2296
2296
  <div class="options-list">
2297
- ${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const f=a.includes(p.api_value),m=!f&&g;return r.html`
2297
+ ${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`
2298
2298
  <div
2299
2299
  class="option-item ${m?"disabled":""}"
2300
2300
  @click=${()=>!m&&this._onMultiSelectToggle(t,p.api_value)}
2301
2301
  >
2302
- <ap-checkbox ?checked=${f}></ap-checkbox>
2302
+ <ap-checkbox ?checked=${g}></ap-checkbox>
2303
2303
  <span>${p.label}</span>
2304
2304
  </div>
2305
2305
  `})}
2306
2306
  </div>
2307
2307
  </div>
2308
2308
  </div>
2309
- `}_renderTagsFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=this._tagInputs[e]||"",n=s.operator||xe[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=o.trim().length>0,g=a.length>=Lt;return r.html`
2309
+ `}_renderTagsFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||$e[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=jt;return o.html`
2310
2310
  <div class="filter-content">
2311
2311
  <!-- Search input -->
2312
2312
  <div class="search-wrapper">
@@ -2315,18 +2315,18 @@
2315
2315
  class="search-input"
2316
2316
  type="text"
2317
2317
  placeholder="Search tags"
2318
- .value=${o}
2318
+ .value=${r}
2319
2319
  @input=${p=>this._onTagInput(t,e,p)}
2320
2320
  @keydown=${p=>this._onTagKeydown(t,p)}
2321
2321
  />
2322
- ${u?r.html`
2322
+ ${u?o.html`
2323
2323
  <button class="search-clear" @click=${()=>{this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}}>
2324
2324
  <ap-icon name="close" .size=${12}></ap-icon>
2325
2325
  </button>
2326
- `:r.nothing}
2326
+ `:o.nothing}
2327
2327
  </div>
2328
2328
 
2329
- ${u?r.html`
2329
+ ${u?o.html`
2330
2330
  <div class="section-header">
2331
2331
  <span class="section-label"></span>
2332
2332
  <button
@@ -2335,7 +2335,7 @@
2335
2335
  @click=${()=>this._clearFieldFilter(t)}
2336
2336
  >Clear all</button>
2337
2337
  </div>
2338
- `:r.html`
2338
+ `:o.html`
2339
2339
  <!-- Operator -->
2340
2340
  <div class="filter-section">
2341
2341
  <div class="section-header">
@@ -2348,7 +2348,7 @@
2348
2348
  </div>
2349
2349
  <ap-radio-group
2350
2350
  direction="horizontal"
2351
- .options=${xe}
2351
+ .options=${$e}
2352
2352
  .value=${n}
2353
2353
  ?disabled=${i}
2354
2354
  @ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
@@ -2356,7 +2356,7 @@
2356
2356
  </div>
2357
2357
 
2358
2358
  <!-- Selected chips -->
2359
- ${a.length>0?r.html`
2359
+ ${a.length>0?o.html`
2360
2360
  <div class="filter-section">
2361
2361
  <div class="section-header">
2362
2362
  <span class="section-label">Selected</span>
@@ -2366,7 +2366,7 @@
2366
2366
  >Clear all</button>
2367
2367
  </div>
2368
2368
  <div class="chips-wrap">
2369
- ${a.map(p=>r.html`
2369
+ ${a.map(p=>o.html`
2370
2370
  <div class="chip">
2371
2371
  <span class="chip-label">${p}</span>
2372
2372
  <button class="chip-remove" @click=${()=>this._removeTag(t,p)}>
@@ -2376,18 +2376,18 @@
2376
2376
  `)}
2377
2377
  </div>
2378
2378
  </div>
2379
- `:r.nothing}
2379
+ `:o.nothing}
2380
2380
 
2381
2381
  <!-- Empty/Not empty -->
2382
2382
  <div class="filter-section">
2383
2383
  <span class="section-label">All options</span>
2384
2384
  <div class="options-list short">
2385
- ${Ue.map(p=>{var f;return r.html`
2385
+ ${Ve.map(p=>{var g;return o.html`
2386
2386
  <div
2387
2387
  class="option-item"
2388
2388
  @click=${()=>this._onEmptyOption(t,p.value)}
2389
2389
  >
2390
- <ap-checkbox ?checked=${((f=s.values)==null?void 0:f[0])===p.value}></ap-checkbox>
2390
+ <ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
2391
2391
  <span>${p.label}</span>
2392
2392
  </div>
2393
2393
  `})}
@@ -2396,27 +2396,27 @@
2396
2396
  `}
2397
2397
 
2398
2398
  <!-- Suggestions list -->
2399
- ${u?r.html`
2399
+ ${u?o.html`
2400
2400
  <div class="filter-section">
2401
2401
  <div class="options-list">
2402
- ${h?r.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const f=a.includes(p),m=!f&&g;return r.html`
2402
+ ${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`
2403
2403
  <div
2404
2404
  class="option-item ${m?"disabled":""}"
2405
- @click=${()=>!m&&(f?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2405
+ @click=${()=>!m&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
2406
2406
  >
2407
- <ap-checkbox ?checked=${f}></ap-checkbox>
2407
+ <ap-checkbox ?checked=${g}></ap-checkbox>
2408
2408
  <span>${p}</span>
2409
2409
  </div>
2410
- `}):r.html`<div class="option-item disabled"><span>No results</span></div>`}
2410
+ `}):o.html`<div class="option-item disabled"><span>No results</span></div>`}
2411
2411
  </div>
2412
2412
  </div>
2413
- `:r.nothing}
2413
+ `:o.nothing}
2414
2414
  </div>
2415
- `}_renderDateFilter(t){var u,g;const e=T(t),s=this._datePresets[e]||"",i=this._getApplied(e),o=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(o);return r.html`
2415
+ `}_renderDateFilter(t){var u,f;const e=T(t),s=this._datePresets[e]||"",i=this._getApplied(e),r=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(r);return o.html`
2416
2416
  <div class="filter-content">
2417
2417
  <button
2418
2418
  class="clear-btn"
2419
- ?disabled=${!o&&!((g=i.values)!=null&&g.length)}
2419
+ ?disabled=${!r&&!((f=i.values)!=null&&f.length)}
2420
2420
  @click=${()=>this._clearFieldFilter(t)}
2421
2421
  >Clear all</button>
2422
2422
 
@@ -2424,7 +2424,7 @@
2424
2424
  <ap-radio-group
2425
2425
  clearable
2426
2426
  .options=${n}
2427
- .value=${o==="empty"||o==="non-empty"?o:""}
2427
+ .value=${r==="empty"||r==="non-empty"?r:""}
2428
2428
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2429
2429
  ></ap-radio-group>
2430
2430
 
@@ -2433,16 +2433,16 @@
2433
2433
  <ap-radio-group
2434
2434
  clearable
2435
2435
  columns="2"
2436
- .options=${_s}
2437
- .value=${o!=="empty"&&o!=="non-empty"?o:""}
2436
+ .options=${Fs}
2437
+ .value=${r!=="empty"&&r!=="non-empty"?r:""}
2438
2438
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2439
2439
  ></ap-radio-group>
2440
2440
  </div>
2441
2441
 
2442
- ${h?r.html`
2442
+ ${h?o.html`
2443
2443
  <div class="filter-section">
2444
2444
  <div class="grid-2">
2445
- ${o==="before"?r.html`
2445
+ ${r==="before"?o.html`
2446
2446
  <div>
2447
2447
  <span class="input-label">End date</span>
2448
2448
  <input
@@ -2452,7 +2452,7 @@
2452
2452
  @change=${p=>this._onDateInput(t,"to",p)}
2453
2453
  />
2454
2454
  </div>
2455
- `:o==="after"?r.html`
2455
+ `:r==="after"?o.html`
2456
2456
  <div>
2457
2457
  <span class="input-label">Start date</span>
2458
2458
  <input
@@ -2462,7 +2462,7 @@
2462
2462
  @change=${p=>this._onDateInput(t,"from",p)}
2463
2463
  />
2464
2464
  </div>
2465
- `:r.html`
2465
+ `:o.html`
2466
2466
  <div>
2467
2467
  <span class="input-label">Start date</span>
2468
2468
  <input
@@ -2484,13 +2484,13 @@
2484
2484
  `}
2485
2485
  </div>
2486
2486
  </div>
2487
- `:r.nothing}
2487
+ `:o.nothing}
2488
2488
  </div>
2489
- `}_renderGeoFilter(t){var u,g;const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let o="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[f,m]=p.split("..");o=f||"",n=m||""}const c=o.length>0,d=o.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return r.html`
2489
+ `}_renderGeoFilter(t){var u,f;const e=T(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 c=r.length>0,d=r.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2490
2490
  <div class="filter-content">
2491
2491
  <button
2492
2492
  class="clear-btn"
2493
- ?disabled=${!((g=s.values)!=null&&g.length)}
2493
+ ?disabled=${!((f=s.values)!=null&&f.length)}
2494
2494
  @click=${()=>this._clearFieldFilter(t)}
2495
2495
  >Clear all</button>
2496
2496
 
@@ -2498,13 +2498,13 @@
2498
2498
  <span class="section-label">Content</span>
2499
2499
  <ap-radio-group
2500
2500
  clearable
2501
- .options=${rs}
2501
+ .options=${fs}
2502
2502
  .value=${a}
2503
2503
  @ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
2504
2504
  ></ap-radio-group>
2505
2505
  </div>
2506
2506
 
2507
- ${a===Re?r.html`
2507
+ ${a===Ue?o.html`
2508
2508
  <div class="filter-section">
2509
2509
  <div class="geo-row">
2510
2510
  <div class="geo-location">
@@ -2513,10 +2513,10 @@
2513
2513
  class="filter-input"
2514
2514
  type="text"
2515
2515
  placeholder="Latitude, longitude"
2516
- .value=${o}
2516
+ .value=${r}
2517
2517
  @change=${p=>this._onGeoLocationInput(t,p)}
2518
2518
  />
2519
- ${c&&!h?r.html`<div class="error-text">Enter coordinates as "latitude, longitude"</div>`:r.nothing}
2519
+ ${c&&!h?o.html`<div class="error-text">Enter coordinates as "latitude, longitude"</div>`:o.nothing}
2520
2520
  </div>
2521
2521
  <div class="geo-radius">
2522
2522
  <span class="input-label">Max radius (&deg;)</span>
@@ -2531,9 +2531,9 @@
2531
2531
  </div>
2532
2532
  </div>
2533
2533
  </div>
2534
- `:r.nothing}
2534
+ `:o.nothing}
2535
2535
  </div>
2536
- `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2536
+ `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2537
2537
  <div class="filter-content">
2538
2538
  <button
2539
2539
  class="clear-btn"
@@ -2544,13 +2544,13 @@
2544
2544
  <div class="filter-section">
2545
2545
  <ap-radio-group
2546
2546
  clearable
2547
- .options=${Ue}
2547
+ .options=${Ve}
2548
2548
  .value=${s}
2549
- @ap-change=${o=>this._onEmptyOption(t,o.detail.value)}
2549
+ @ap-change=${r=>this._onEmptyOption(t,r.detail.value)}
2550
2550
  ></ap-radio-group>
2551
2551
  </div>
2552
2552
  </div>
2553
- `}_renderFaceMatcherFilter(t){const e=T(t),s=this._getApplied(e),i=s.values||[],a=s.operator||C.IS;return r.html`
2553
+ `}_renderFaceMatcherFilter(t){const e=T(t),s=this._getApplied(e),i=s.values||[],a=s.operator||C.IS;return o.html`
2554
2554
  <div class="filter-content">
2555
2555
  <button
2556
2556
  class="clear-btn"
@@ -2562,20 +2562,20 @@
2562
2562
  <span class="section-label">Condition</span>
2563
2563
  <ap-radio-group
2564
2564
  direction="horizontal"
2565
- .options=${xe}
2565
+ .options=${$e}
2566
2566
  .value=${a}
2567
- @ap-change=${o=>this._emitFilterChange(t,o.detail.value,i)}
2567
+ @ap-change=${r=>this._emitFilterChange(t,r.detail.value,i)}
2568
2568
  ></ap-radio-group>
2569
2569
  <input
2570
2570
  class="filter-input"
2571
2571
  type="text"
2572
2572
  placeholder="Search faces"
2573
2573
  .value=${i.join(", ")}
2574
- @change=${o=>{const c=o.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,c)}}
2574
+ @change=${r=>{const c=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,c)}}
2575
2575
  />
2576
2576
  </div>
2577
2577
  </div>
2578
- `}_renderFieldControl(t){switch(this._getUIType(t)){case"text":return this._renderTextFilter(t);case"number":return this._renderNumberFilter(t);case"boolean":return this._renderBooleanFilter(t);case"select-one":return this._renderSelectOneFilter(t);case"multi-select":return this._renderMultiSelectFilter(t);case"tags":return this._renderTagsFilter(t);case"date":return this._renderDateFilter(t);case"geo":return this._renderGeoFilter(t);case"attachment":return t.type===$.INTEGER_LIST&&t.slug==="face_matcher"?this._renderFaceMatcherFilter(t):this._renderAttachmentFilter(t);default:return r.nothing}}_renderFieldSection(t){const e=this._getField(t);if(!e)return r.nothing;const s=this._collapsedFields.has(t);return r.html`
2578
+ `}_renderFieldControl(t){switch(this._getUIType(t)){case"text":return this._renderTextFilter(t);case"number":return this._renderNumberFilter(t);case"boolean":return this._renderBooleanFilter(t);case"select-one":return this._renderSelectOneFilter(t);case"multi-select":return this._renderMultiSelectFilter(t);case"tags":return this._renderTagsFilter(t);case"date":return this._renderDateFilter(t);case"geo":return this._renderGeoFilter(t);case"attachment":return t.type===$.INTEGER_LIST&&t.slug==="face_matcher"?this._renderFaceMatcherFilter(t):this._renderAttachmentFilter(t);default:return o.nothing}}_renderFieldSection(t){const e=this._getField(t);if(!e)return o.nothing;const s=this._collapsedFields.has(t);return o.html`
2579
2579
  <div class="field-section">
2580
2580
  <div
2581
2581
  class="field-header"
@@ -2587,7 +2587,7 @@
2587
2587
  name="chevron-right"
2588
2588
  .size=${14}
2589
2589
  ></ap-icon>
2590
- <ap-icon name=${It[e.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2590
+ <ap-icon name=${qt[e.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2591
2591
  <span>${e.label}</span>
2592
2592
  </div>
2593
2593
  <div class="field-header-actions">
@@ -2604,14 +2604,14 @@
2604
2604
  ${this._renderFieldControl(e)}
2605
2605
  </div>
2606
2606
  </div>
2607
- `}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
2607
+ `}_renderSelectorMode(){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`
2608
2608
  <div class="field-group-label">${a}</div>
2609
- ${o.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),g=!d&&this._atFieldLimit;return r.html`
2609
+ ${r.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),f=!d&&this._atFieldLimit;return o.html`
2610
2610
  <div
2611
- class="field-item ${h?"has-filter":""} ${g?"disabled":""}"
2612
- @click=${()=>!g&&this._emitFieldSelect(n)}
2611
+ class="field-item ${h?"has-filter":""} ${f?"disabled":""}"
2612
+ @click=${()=>!f&&this._emitFieldSelect(n)}
2613
2613
  >
2614
- <ap-icon name=${It[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2614
+ <ap-icon name=${qt[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2615
2615
  <span class="field-item-label">${n.label}</span>
2616
2616
  <button
2617
2617
  class="field-item-pin ${u?"pinned":""}"
@@ -2620,10 +2620,10 @@
2620
2620
  >
2621
2621
  <ap-icon name="pin" .size=${12}></ap-icon>
2622
2622
  </button>
2623
- ${h?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.nothing}
2623
+ ${h?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
2624
2624
  </div>
2625
2625
  `})}
2626
- `;return r.html`
2626
+ `;return o.html`
2627
2627
  <div class="selector-wrap">
2628
2628
  <div class="field-search-wrapper">
2629
2629
  <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
@@ -2636,18 +2636,18 @@
2636
2636
  />
2637
2637
  </div>
2638
2638
  <div class="field-list">
2639
- ${e.length===0?r.html`<div class="empty-msg">No fields found</div>`:r.html`${[...s.entries()].map(([a,o])=>i(a,o))}`}
2639
+ ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
2640
2640
  </div>
2641
2641
  </div>
2642
- `}_renderFieldMode(){const t=this._getField(this.activeFieldKey);return t?this._renderFieldControl(t):r.html`<div class="empty-msg">Field not found</div>`}render(){if(this.mode==="selector")return this._renderSelectorMode();if(this.mode==="field")return this._renderFieldMode();const t=this.visibleFields.length>0;return r.html`
2643
- ${this._showFieldSelection||!t?this._renderFieldSelection():r.nothing}
2642
+ `}_renderFieldMode(){const t=this._getField(this.activeFieldKey);return t?this._renderFieldControl(t):o.html`<div class="empty-msg">Field not found</div>`}render(){if(this.mode==="selector")return this._renderSelectorMode();if(this.mode==="field")return this._renderFieldMode();const t=this.visibleFields.length>0;return o.html`
2643
+ ${this._showFieldSelection||!t?this._renderFieldSelection():o.nothing}
2644
2644
 
2645
- ${t?r.html`
2645
+ ${t?o.html`
2646
2646
  <div class="field-filters">
2647
2647
  ${this.visibleFields.map(e=>this._renderFieldSection(e))}
2648
2648
  </div>
2649
2649
 
2650
- ${!this._showFieldSelection&&!this._atFieldLimit?r.html`
2650
+ ${!this._showFieldSelection&&!this._atFieldLimit?o.html`
2651
2651
  <button
2652
2652
  class="add-field-btn"
2653
2653
  @click=${this._openFieldSelection}
@@ -2655,9 +2655,9 @@
2655
2655
  <ap-icon name="filter" .size=${14}></ap-icon>
2656
2656
  Add field
2657
2657
  </button>
2658
- `:r.nothing}
2659
- `:r.nothing}
2660
- `}};I.styles=[W,Fe,r.css`
2658
+ `:o.nothing}
2659
+ `:o.nothing}
2660
+ `}};I.styles=[H,Ae,o.css`
2661
2661
  /* ── Field selection panel ─────────────────────────────── */
2662
2662
 
2663
2663
  .add-field-btn {
@@ -3035,7 +3035,7 @@
3035
3035
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
3036
3036
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
3037
3037
  }
3038
- `];D([l.property({type:Array})],I.prototype,"fields",2);D([l.property({type:Object})],I.prototype,"appliedFilters",2);D([l.property({type:Array})],I.prototype,"visibleFields",2);D([l.property()],I.prototype,"mode",2);D([l.property()],I.prototype,"activeFieldKey",2);D([l.property({type:Array})],I.prototype,"pinnedFields",2);D([l.property({type:Object})],I.prototype,"appliedMetadata",2);D([l.property({attribute:!1})],I.prototype,"apiClient",2);D([l.state()],I.prototype,"_showFieldSelection",2);D([l.state()],I.prototype,"_fieldSearch",2);D([l.state()],I.prototype,"_collapsedFields",2);D([l.state()],I.prototype,"_tagInputs",2);D([l.state()],I.prototype,"_tagSuggestions",2);D([l.state()],I.prototype,"_tagLoading",2);D([l.state()],I.prototype,"_datePresets",2);D([l.state()],I.prototype,"_dateFroms",2);D([l.state()],I.prototype,"_dateTos",2);D([l.state()],I.prototype,"_specificModeFields",2);D([l.state()],I.prototype,"_selectSearches",2);I=D([l.customElement("ap-filter-metadata")],I);var Xo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,be=(t,e,s,i)=>{for(var a=i>1?void 0:i?Zo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Xo(e,s,a),a};let ce=class extends r.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(ne)||this.selectedStatus.includes(le)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===ne||t===le)}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(K.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(K.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(K.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(K.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(K.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(K.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(K.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(K.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(K.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(K.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:K.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:K.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 r.html`
3038
+ `];D([l.property({type:Array})],I.prototype,"fields",2);D([l.property({type:Object})],I.prototype,"appliedFilters",2);D([l.property({type:Array})],I.prototype,"visibleFields",2);D([l.property()],I.prototype,"mode",2);D([l.property()],I.prototype,"activeFieldKey",2);D([l.property({type:Array})],I.prototype,"pinnedFields",2);D([l.property({type:Object})],I.prototype,"appliedMetadata",2);D([l.property({attribute:!1})],I.prototype,"apiClient",2);D([l.state()],I.prototype,"_showFieldSelection",2);D([l.state()],I.prototype,"_fieldSearch",2);D([l.state()],I.prototype,"_collapsedFields",2);D([l.state()],I.prototype,"_tagInputs",2);D([l.state()],I.prototype,"_tagSuggestions",2);D([l.state()],I.prototype,"_tagLoading",2);D([l.state()],I.prototype,"_datePresets",2);D([l.state()],I.prototype,"_dateFroms",2);D([l.state()],I.prototype,"_dateTos",2);D([l.state()],I.prototype,"_specificModeFields",2);D([l.state()],I.prototype,"_selectSearches",2);I=D([l.customElement("ap-filter-metadata")],I);var to=Object.defineProperty,so=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?so(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&&to(e,s,a),a};let ce=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(ne)||this.selectedStatus.includes(le)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===ne||t===le)}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(Q.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(Q.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(Q.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(Q.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(Q.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(Q.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(Q.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(Q.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(Q.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(Q.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:Q.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:Q.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`
3039
3039
  <div class="filter-section">
3040
3040
  <button
3041
3041
  class="clear-btn"
@@ -3049,7 +3049,7 @@
3049
3049
  <span class="section-label condition-label">Condition</span>
3050
3050
  <ap-radio-group
3051
3051
  direction="horizontal"
3052
- .options=${Sa}
3052
+ .options=${Ta}
3053
3053
  .value=${this.statusOperator}
3054
3054
  ?disabled=${this._statusHasOnlyEmptyValues}
3055
3055
  @ap-change=${this._handleStatusOperator}
@@ -3057,7 +3057,7 @@
3057
3057
 
3058
3058
  <!-- Empty / Not empty checkboxes -->
3059
3059
  <div class="options-list short mt-12">
3060
- ${Ue.map(e=>r.html`
3060
+ ${Ve.map(e=>o.html`
3061
3061
  <ap-checkbox
3062
3062
  ?checked=${this.selectedStatus.includes(e.value)}
3063
3063
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -3069,7 +3069,7 @@
3069
3069
 
3070
3070
  <!-- Status options -->
3071
3071
  <div class="options-list short">
3072
- ${Ca.map(e=>r.html`
3072
+ ${La.map(e=>o.html`
3073
3073
  <ap-checkbox
3074
3074
  ?checked=${this.selectedStatus.includes(e.value)}
3075
3075
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -3082,7 +3082,7 @@
3082
3082
  `)}
3083
3083
  </div>
3084
3084
  </div>
3085
- `}_renderApproverSection(){const t=!!this.approverValue;return r.html`
3085
+ `}_renderApproverSection(){const t=!!this.approverValue;return o.html`
3086
3086
  <div class="filter-section">
3087
3087
  <button
3088
3088
  class="clear-btn"
@@ -3096,7 +3096,7 @@
3096
3096
  <span class="section-label condition-label">Condition</span>
3097
3097
  <ap-radio-group
3098
3098
  direction="horizontal"
3099
- .options=${Xs}
3099
+ .options=${Js}
3100
3100
  .value=${this.approverOperator}
3101
3101
  @ap-change=${this._handleApproverOperator}
3102
3102
  ></ap-radio-group>
@@ -3109,7 +3109,7 @@
3109
3109
  @input=${this._handleApproverInput}
3110
3110
  />
3111
3111
  </div>
3112
- `}_renderRequesterSection(){const t=!!this.requesterValue;return r.html`
3112
+ `}_renderRequesterSection(){const t=!!this.requesterValue;return o.html`
3113
3113
  <div class="filter-section">
3114
3114
  <button
3115
3115
  class="clear-btn"
@@ -3123,7 +3123,7 @@
3123
3123
  <span class="section-label condition-label">Condition</span>
3124
3124
  <ap-radio-group
3125
3125
  direction="horizontal"
3126
- .options=${Xs}
3126
+ .options=${Js}
3127
3127
  .value=${this.requesterOperator}
3128
3128
  @ap-change=${this._handleRequesterOperator}
3129
3129
  ></ap-radio-group>
@@ -3136,7 +3136,7 @@
3136
3136
  @input=${this._handleRequesterInput}
3137
3137
  />
3138
3138
  </div>
3139
- `}_renderDueDateSection(){const t=!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo;return r.html`
3139
+ `}_renderDueDateSection(){const t=!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo;return o.html`
3140
3140
  <div class="filter-section">
3141
3141
  <button
3142
3142
  class="clear-btn"
@@ -3149,7 +3149,7 @@
3149
3149
  <!-- Empty / Not empty radio buttons -->
3150
3150
  <ap-radio-group
3151
3151
  clearable
3152
- .options=${Ue}
3152
+ .options=${Ve}
3153
3153
  .value=${this.dueDatePreset===ne||this.dueDatePreset===le?this.dueDatePreset:""}
3154
3154
  @ap-change=${this._handleDueDatePreset}
3155
3155
  ></ap-radio-group>
@@ -3160,15 +3160,15 @@
3160
3160
  <ap-radio-group
3161
3161
  clearable
3162
3162
  columns="2"
3163
- .options=${wa}
3163
+ .options=${Fa}
3164
3164
  .value=${this.dueDatePreset!==ne&&this.dueDatePreset!==le?this.dueDatePreset:""}
3165
3165
  @ap-change=${this._handleDueDatePreset}
3166
3166
  ></ap-radio-group>
3167
3167
 
3168
3168
  <!-- Date inputs -->
3169
- ${this._dueDateNeedsInputs?r.html`
3169
+ ${this._dueDateNeedsInputs?o.html`
3170
3170
  <div class="grid-2 mt-12">
3171
- ${this.dueDatePreset!=="before"?r.html`
3171
+ ${this.dueDatePreset!=="before"?o.html`
3172
3172
  <div class="date-input-col">
3173
3173
  <span class="input-label">Start date</span>
3174
3174
  <input
@@ -3178,8 +3178,8 @@
3178
3178
  @change=${this._handleDueDateFrom}
3179
3179
  />
3180
3180
  </div>
3181
- `:r.nothing}
3182
- ${this.dueDatePreset!=="after"&&this.dueDatePreset!=="specific"?r.html`
3181
+ `:o.nothing}
3182
+ ${this.dueDatePreset!=="after"&&this.dueDatePreset!=="specific"?o.html`
3183
3183
  <div class="date-input-col">
3184
3184
  <span class="input-label">End date</span>
3185
3185
  <input
@@ -3189,11 +3189,11 @@
3189
3189
  @change=${this._handleDueDateTo}
3190
3190
  />
3191
3191
  </div>
3192
- `:r.nothing}
3192
+ `:o.nothing}
3193
3193
  </div>
3194
- `:r.nothing}
3194
+ `:o.nothing}
3195
3195
  </div>
3196
- `}render(){return r.html`
3196
+ `}render(){return o.html`
3197
3197
  <div class="filter-content">
3198
3198
  ${this._renderStatusSection()}
3199
3199
  <div class="separator"></div>
@@ -3203,7 +3203,7 @@
3203
3203
  <div class="separator"></div>
3204
3204
  ${this._renderDueDateSection()}
3205
3205
  </div>
3206
- `}};ce.styles=[W,Fe,r.css`
3206
+ `}};ce.styles=[H,Ae,o.css`
3207
3207
  .options-list.short {
3208
3208
  max-height: none;
3209
3209
  }
@@ -3227,8 +3227,8 @@
3227
3227
  align-items: center;
3228
3228
  gap: 6px;
3229
3229
  }
3230
- `];be([l.property({type:Array})],ce.prototype,"selectedStatus",2);be([l.property()],ce.prototype,"statusOperator",2);be([l.property()],ce.prototype,"approverValue",2);be([l.property()],ce.prototype,"approverOperator",2);be([l.property()],ce.prototype,"requesterValue",2);be([l.property()],ce.prototype,"requesterOperator",2);be([l.property()],ce.prototype,"dueDatePreset",2);be([l.property()],ce.prototype,"dueDateFrom",2);be([l.property()],ce.prototype,"dueDateTo",2);ce=be([l.customElement("ap-filter-approval")],ce);var Jo=Object.defineProperty,er=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Jo(e,s,a),a};const tr=300;function sr(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let de=class extends r.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=sr(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.PRODUCT_REF,values:e,operator:C.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)},tr)}_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(`
3231
- `).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 r.html`
3230
+ `];ye([l.property({type:Array})],ce.prototype,"selectedStatus",2);ye([l.property()],ce.prototype,"statusOperator",2);ye([l.property()],ce.prototype,"approverValue",2);ye([l.property()],ce.prototype,"approverOperator",2);ye([l.property()],ce.prototype,"requesterValue",2);ye([l.property()],ce.prototype,"requesterOperator",2);ye([l.property()],ce.prototype,"dueDatePreset",2);ye([l.property()],ce.prototype,"dueDateFrom",2);ye([l.property()],ce.prototype,"dueDateTo",2);ce=ye([l.customElement("ap-filter-approval")],ce);var io=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,xe=(t,e,s,i)=>{for(var a=i>1?void 0:i?ao(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&&io(e,s,a),a};const ro=300;function oo(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let de=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=oo(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:_.PRODUCT_REF,values:e,operator:C.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)},ro)}_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(`
3231
+ `).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`
3232
3232
  <div
3233
3233
  class="product-item"
3234
3234
  @click=${()=>this._toggle(t)}
@@ -3236,7 +3236,7 @@
3236
3236
  <ap-checkbox ?checked=${e}></ap-checkbox>
3237
3237
  <span class="product-name">${t}</span>
3238
3238
  </div>
3239
- `}render(){const t=this.selected.length===0;return r.html`
3239
+ `}render(){const t=this.selected.length===0;return o.html`
3240
3240
  <div class="filter-content">
3241
3241
  <div class="filter-header">
3242
3242
  <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
@@ -3247,15 +3247,15 @@
3247
3247
  .value=${this._search}
3248
3248
  @input=${this._onSearchInput}
3249
3249
  />
3250
- ${this._search?r.html`
3250
+ ${this._search?o.html`
3251
3251
  <button class="search-clear" @click=${this._clearSearch}>
3252
3252
  <ap-icon name="close" .size=${12}></ap-icon>
3253
3253
  </button>
3254
- `:r.nothing}
3254
+ `:o.nothing}
3255
3255
  </div>
3256
3256
 
3257
3257
  <!-- Clear all (when searching and has selection) -->
3258
- ${this._isSearching&&!t?r.html`
3258
+ ${this._isSearching&&!t?o.html`
3259
3259
  <div class="section-header">
3260
3260
  <span class="section-label"></span>
3261
3261
  <button
@@ -3263,10 +3263,10 @@
3263
3263
  @click=${this._clearAll}
3264
3264
  >Clear all</button>
3265
3265
  </div>
3266
- `:r.nothing}
3266
+ `:o.nothing}
3267
3267
 
3268
3268
  <!-- Selected chips (when not searching) -->
3269
- ${!this._isSearching&&this.selected.length>0?r.html`
3269
+ ${!this._isSearching&&this.selected.length>0?o.html`
3270
3270
  <div class="filter-section">
3271
3271
  <div class="section-header">
3272
3272
  <span class="section-label">Selected</span>
@@ -3276,7 +3276,7 @@
3276
3276
  >Clear all</button>
3277
3277
  </div>
3278
3278
  <div class="chips-wrap">
3279
- ${this.selected.map(e=>r.html`
3279
+ ${this.selected.map(e=>o.html`
3280
3280
  <div class="chip">
3281
3281
  <span class="chip-label">${e}</span>
3282
3282
  <button class="chip-remove" @click=${()=>this._remove(e)}>
@@ -3286,24 +3286,24 @@
3286
3286
  `)}
3287
3287
  </div>
3288
3288
  </div>
3289
- `:r.nothing}
3289
+ `:o.nothing}
3290
3290
 
3291
3291
  <!-- Search results -->
3292
- ${this._isSearching?r.html`
3292
+ ${this._isSearching?o.html`
3293
3293
  <div class="filter-section">
3294
3294
  <span class="section-label">Product references</span>
3295
3295
  <div class="options-list">
3296
3296
  <!-- Wildcard "Select all" option when multiple results -->
3297
- ${this._products.length>1?this._renderProductItem(`${this._search.trim()}*`):r.nothing}
3297
+ ${this._products.length>1?this._renderProductItem(`${this._search.trim()}*`):o.nothing}
3298
3298
  ${this._products.map(({ref:e})=>this._renderProductItem(e))}
3299
3299
  </div>
3300
3300
  </div>
3301
- `:r.nothing}
3301
+ `:o.nothing}
3302
3302
 
3303
3303
  <!-- Placeholder (when not searching) -->
3304
- ${this._isSearching?r.nothing:r.html`
3304
+ ${this._isSearching?o.nothing:o.html`
3305
3305
  <div class="placeholder">
3306
- ${t?r.html`<ap-icon name="box" .size=${40} ${F({color:"var(--ap-border, oklch(92.86% 0.009 247.92))","margin-bottom":"4px"})}></ap-icon>`:r.nothing}
3306
+ ${t?o.html`<ap-icon name="box" .size=${40} ${F({color:"var(--ap-border, oklch(92.86% 0.009 247.92))","margin-bottom":"4px"})}></ap-icon>`:o.nothing}
3307
3307
  <div class="placeholder-title">Find product reference</div>
3308
3308
  <div class="placeholder-text">By using the search or pressing the button below to import the product references list.</div>
3309
3309
  <button class="add-list-btn" @click=${this._openAddList}>
@@ -3314,20 +3314,20 @@
3314
3314
  `}
3315
3315
 
3316
3316
  <!-- Loading skeleton -->
3317
- ${this._isLoading?r.html`
3317
+ ${this._isLoading?o.html`
3318
3318
  <div class="loading-skeleton">
3319
3319
  <div class="skeleton-item"></div>
3320
3320
  <div class="skeleton-item"></div>
3321
3321
  <div class="skeleton-item"></div>
3322
3322
  </div>
3323
- `:r.nothing}
3323
+ `:o.nothing}
3324
3324
 
3325
3325
  <!-- No results -->
3326
- ${this._isSearching&&!this._isLoading&&this._products.length===0?r.html`<div class="no-results">No results found</div>`:r.nothing}
3326
+ ${this._isSearching&&!this._isLoading&&this._products.length===0?o.html`<div class="no-results">No results found</div>`:o.nothing}
3327
3327
  </div>
3328
3328
 
3329
3329
  <!-- Add List Dialog -->
3330
- ${this._showAddList?r.html`
3330
+ ${this._showAddList?o.html`
3331
3331
  <div class="dialog-overlay" @click=${e=>{e.target===e.currentTarget&&this._closeAddList()}}>
3332
3332
  <div class="dialog">
3333
3333
  <div class="dialog-header">Add products references list</div>
@@ -3351,8 +3351,8 @@
3351
3351
  </div>
3352
3352
  </div>
3353
3353
  </div>
3354
- `:r.nothing}
3355
- `}};de.styles=[W,Fe,r.css`
3354
+ `:o.nothing}
3355
+ `}};de.styles=[H,Ae,o.css`
3356
3356
  .product-item {
3357
3357
  display: flex;
3358
3358
  align-items: center;
@@ -3592,49 +3592,49 @@
3592
3592
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3593
3593
  margin-left: 4px;
3594
3594
  }
3595
- `];_e([l.property({type:Array})],de.prototype,"selected",2);_e([l.property({attribute:!1})],de.prototype,"apiClient",2);_e([l.query(".product-search")],de.prototype,"_searchInput",2);_e([l.state()],de.prototype,"_search",2);_e([l.state()],de.prototype,"_debouncedSearch",2);_e([l.state()],de.prototype,"_products",2);_e([l.state()],de.prototype,"_isLoading",2);_e([l.state()],de.prototype,"_showAddList",2);_e([l.state()],de.prototype,"_addListText",2);de=_e([l.customElement("ap-filter-product-ref")],de);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ir(e,s,a),a};let O=class extends r.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.showFilters=!0,this.countLabel="",this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=ys,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(o=>{var n;return o instanceof HTMLElement&&o.classList.contains("chip")&&((n=o.closest)==null?void 0:n.call(o,"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(`${Kt[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=us.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 o=e.type;return r.html`<ap-filter-type
3596
- .selected=${(o==null?void 0:o.values)||[]}
3595
+ `];xe([l.property({type:Array})],de.prototype,"selected",2);xe([l.property({attribute:!1})],de.prototype,"apiClient",2);xe([l.query(".product-search")],de.prototype,"_searchInput",2);xe([l.state()],de.prototype,"_search",2);xe([l.state()],de.prototype,"_debouncedSearch",2);xe([l.state()],de.prototype,"_products",2);xe([l.state()],de.prototype,"_isLoading",2);xe([l.state()],de.prototype,"_showAddList",2);xe([l.state()],de.prototype,"_addListText",2);de=xe([l.customElement("ap-filter-product-ref")],de);var no=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var a=i>1?void 0:i?lo(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&&no(e,s,a),a};let O=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.showCreateFolder=!1,this.showFilters=!0,this.countLabel="",this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=Es,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}))}_handleCreateFolderClick(){this.dispatchEvent(new CustomEvent("create-folder-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(`${ts[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=xs.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
3596
+ .selected=${(r==null?void 0:r.values)||[]}
3597
3597
  .fileTypes=${this.fileTypes}
3598
3598
  @filter-change=${this._handleFilterChange}
3599
- ></ap-filter-type>`}case"tags":{const o=e.tags;return r.html`<ap-filter-tags
3599
+ ></ap-filter-type>`}case"tags":{const r=e.tags;return o.html`<ap-filter-tags
3600
3600
  .tags=${this.tags}
3601
- .selected=${(o==null?void 0:o.values)||[]}
3601
+ .selected=${(r==null?void 0:r.values)||[]}
3602
3602
  @filter-change=${this._handleFilterChange}
3603
- ></ap-filter-tags>`}case"labels":{const o=e.labels;return r.html`<ap-filter-labels
3603
+ ></ap-filter-tags>`}case"labels":{const r=e.labels;return o.html`<ap-filter-labels
3604
3604
  .labels=${this.labels}
3605
- .selected=${(o==null?void 0:o.values)||[]}
3605
+ .selected=${(r==null?void 0:r.values)||[]}
3606
3606
  @filter-change=${this._handleFilterChange}
3607
- ></ap-filter-labels>`}case"color":{const o=e.color;return r.html`<ap-filter-color
3608
- .values=${(o==null?void 0:o.values)||[]}
3607
+ ></ap-filter-labels>`}case"color":{const r=e.color;return o.html`<ap-filter-color
3608
+ .values=${(r==null?void 0:r.values)||[]}
3609
3609
  @filter-change=${this._handleFilterChange}
3610
- ></ap-filter-color>`}case"date":{const o=e.date;return r.html`<ap-filter-date
3610
+ ></ap-filter-color>`}case"date":{const r=e.date;return o.html`<ap-filter-date
3611
3611
  .filterKey=${"date"}
3612
- .field=${(o==null?void 0:o.field)||"created"}
3613
- .kind=${(o==null?void 0:o.kind)||null}
3614
- .from=${(o==null?void 0:o.from)||""}
3615
- .to=${(o==null?void 0:o.to)||""}
3616
- .preset=${(o==null?void 0:o.preset)||""}
3612
+ .field=${(r==null?void 0:r.field)||"created"}
3613
+ .kind=${(r==null?void 0:r.kind)||null}
3614
+ .from=${(r==null?void 0:r.from)||""}
3615
+ .to=${(r==null?void 0:r.to)||""}
3616
+ .preset=${(r==null?void 0:r.preset)||""}
3617
3617
  @filter-change=${this._handleFilterChange}
3618
- ></ap-filter-date>`}case"asset_expiration":{const o=e.asset_expiration;return r.html`<ap-filter-date
3618
+ ></ap-filter-date>`}case"asset_expiration":{const r=e.asset_expiration;return o.html`<ap-filter-date
3619
3619
  .filterKey=${"asset_expiration"}
3620
- .field=${(o==null?void 0:o.field)||"created"}
3621
- .kind=${(o==null?void 0:o.kind)||null}
3622
- .from=${(o==null?void 0:o.from)||""}
3623
- .to=${(o==null?void 0:o.to)||""}
3624
- .preset=${(o==null?void 0:o.preset)||""}
3620
+ .field=${(r==null?void 0:r.field)||"created"}
3621
+ .kind=${(r==null?void 0:r.kind)||null}
3622
+ .from=${(r==null?void 0:r.from)||""}
3623
+ .to=${(r==null?void 0:r.to)||""}
3624
+ .preset=${(r==null?void 0:r.preset)||""}
3625
3625
  @filter-change=${this._handleFilterChange}
3626
- ></ap-filter-date>`}case"size":{const o=e.size,n=((s=o==null?void 0:o.values)==null?void 0:s[0])||"",[c,d]=n.split(".."),h=c?parseFloat(c)/1e6:0,u=d?parseFloat(d)/1e6:0;return r.html`<ap-filter-size
3626
+ ></ap-filter-date>`}case"size":{const r=e.size,n=((s=r==null?void 0:r.values)==null?void 0:s[0])||"",[c,d]=n.split(".."),h=c?parseFloat(c)/1e6:0,u=d?parseFloat(d)/1e6:0;return o.html`<ap-filter-size
3627
3627
  .min=${h}
3628
3628
  .max=${u}
3629
3629
  @filter-change=${this._handleFilterChange}
3630
- ></ap-filter-size>`}case"image":{const o=e.image,n=o&&"resolution"in o?o:null;return r.html`<ap-filter-image
3630
+ ></ap-filter-size>`}case"image":{const r=e.image,n=r&&"resolution"in r?r:null;return o.html`<ap-filter-image
3631
3631
  .selectedResolution=${(n==null?void 0:n.resolution)||[]}
3632
3632
  .selectedOrientation=${(n==null?void 0:n.orientation)||[]}
3633
3633
  .selectedFaces=${(n==null?void 0:n.faces)||[]}
3634
3634
  @filter-change=${this._handleFilterChange}
3635
- ></ap-filter-image>`}case"approval":{const o=e.approval_status,n=e.task_approver,c=e.task_requester,d=e.task_duedate;return r.html`<ap-filter-approval
3636
- .selectedStatus=${(o==null?void 0:o.values)||[]}
3637
- .statusOperator=${(o==null?void 0:o.operator)||":"}
3635
+ ></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,c=e.task_requester,d=e.task_duedate;return o.html`<ap-filter-approval
3636
+ .selectedStatus=${(r==null?void 0:r.values)||[]}
3637
+ .statusOperator=${(r==null?void 0:r.operator)||":"}
3638
3638
  .approverValue=${((i=n==null?void 0:n.values)==null?void 0:i[0])||""}
3639
3639
  .approverOperator=${(n==null?void 0:n.operator)||":"}
3640
3640
  .requesterValue=${((a=c==null?void 0:c.values)==null?void 0:a[0])||""}
@@ -3643,7 +3643,7 @@
3643
3643
  .dueDateFrom=${(d==null?void 0:d.from)||""}
3644
3644
  .dueDateTo=${(d==null?void 0:d.to)||""}
3645
3645
  @filter-change=${this._handleFilterChange}
3646
- ></ap-filter-approval>`}case"metadata":return this._openMetadataField?r.html`<ap-filter-metadata
3646
+ ></ap-filter-approval>`}case"metadata":return this._openMetadataField?o.html`<ap-filter-metadata
3647
3647
  mode="field"
3648
3648
  .activeFieldKey=${this._openMetadataField}
3649
3649
  .fields=${this.metadataFields}
@@ -3653,7 +3653,7 @@
3653
3653
  .apiClient=${this.apiClient}
3654
3654
  @metadata-filter-change=${this._handleMetadataFilterChange}
3655
3655
  @metadata-field-toggle=${this._handleMetadataFieldToggle}
3656
- ></ap-filter-metadata>`:r.html`<ap-filter-metadata
3656
+ ></ap-filter-metadata>`:o.html`<ap-filter-metadata
3657
3657
  mode="selector"
3658
3658
  .fields=${this.metadataFields}
3659
3659
  .appliedMetadata=${this.filters.metadata.applied}
@@ -3664,11 +3664,11 @@
3664
3664
  @metadata-field-toggle=${this._handleMetadataFieldToggle}
3665
3665
  @metadata-field-select=${this._handleMetadataFieldSelect}
3666
3666
  @metadata-pin=${this._handleMetadataPin}
3667
- ></ap-filter-metadata>`;case"product_ref":{const o=e.product_ref;return r.html`<ap-filter-product-ref
3668
- .selected=${(o==null?void 0:o.values)||[]}
3667
+ ></ap-filter-metadata>`;case"product_ref":{const r=e.product_ref;return o.html`<ap-filter-product-ref
3668
+ .selected=${(r==null?void 0:r.values)||[]}
3669
3669
  .apiClient=${this.apiClient}
3670
3670
  @filter-change=${this._handleFilterChange}
3671
- ></ap-filter-product-ref>`}default:return r.nothing}}_renderFilterButton(t){const e=t.key==="metadata",s=e?Object.keys(this.filters.metadata.applied).length>0:this._isFilterActive(t.key),i=this.pinnedFilters.includes(t.key),a=r.html`
3671
+ ></ap-filter-product-ref>`}default:return o.nothing}}_renderFilterButton(t){const e=t.key==="metadata",s=e?Object.keys(this.filters.metadata.applied).length>0:this._isFilterActive(t.key),i=this.pinnedFilters.includes(t.key),a=o.html`
3672
3672
  <button
3673
3673
  class="filter-btn ${s?"active":""} ${i?"pinned":""}"
3674
3674
  @click=${()=>e?this._toggleMetadataSelector():this.openFilterPanel(t.key)}
@@ -3679,20 +3679,20 @@
3679
3679
  <span class="filter-btn-label">
3680
3680
  ${t.label}
3681
3681
  </span>
3682
- ${e?r.html`<span class="submenu-chevron"><ap-icon name="chevron-right" .size=${14}></ap-icon></span>`:r.html`
3682
+ ${e?o.html`<span class="submenu-chevron"><ap-icon name="chevron-right" .size=${14}></ap-icon></span>`:o.html`
3683
3683
  <span
3684
3684
  class="pin-btn ${i?"pinned":""}"
3685
3685
  title=${i?"Unpin filter":"Pin filter"}
3686
- @click=${o=>this._togglePin(t.key,o)}
3686
+ @click=${r=>this._togglePin(t.key,r)}
3687
3687
  >
3688
3688
  <ap-icon name="pin" .size=${14}></ap-icon>
3689
3689
  </span>
3690
3690
  `}
3691
3691
  </button>
3692
- `;return e?r.html`
3692
+ `;return e?o.html`
3693
3693
  <div class="filter-btn-wrapper">
3694
3694
  ${a}
3695
- ${this._showMetadataSelector?r.html`
3695
+ ${this._showMetadataSelector?o.html`
3696
3696
  <div class="metadata-selector-overlay">
3697
3697
  <ap-filter-metadata
3698
3698
  mode="selector"
@@ -3705,27 +3705,27 @@
3705
3705
  @metadata-pin=${this._handleMetadataPin}
3706
3706
  ></ap-filter-metadata>
3707
3707
  </div>
3708
- `:r.nothing}
3708
+ `:o.nothing}
3709
3709
  </div>
3710
- `:a}render(){const t=Object.keys(this.filters.applied).length+Object.keys(this.filters.metadata.applied).length;return r.html`
3710
+ `:a}render(){const t=Object.keys(this.filters.applied).length+Object.keys(this.filters.metadata.applied).length;return o.html`
3711
3711
  <div class="toolbar-row">
3712
- ${this.isLoading?r.html`<span class="count-skeleton"></span>`:r.html`<span class="count">${this.countLabel||[this.totalFolderCount>0?`${this.totalFolderCount.toLocaleString()} folder${this.totalFolderCount!==1?"s":""}`:"",this.totalCount>0||this.totalFolderCount===0?`${this.totalCount.toLocaleString()} asset${this.totalCount!==1?"s":""}`:""].filter(Boolean).join(", ")}</span>`}
3712
+ ${this.isLoading?o.html`<span class="count-skeleton"></span>`:o.html`<span class="count">${this.countLabel||[this.totalFolderCount>0?`${this.totalFolderCount.toLocaleString()} folder${this.totalFolderCount!==1?"s":""}`:"",this.totalCount>0||this.totalFolderCount===0?`${this.totalCount.toLocaleString()} asset${this.totalCount!==1?"s":""}`:""].filter(Boolean).join(", ")}</span>`}
3713
3713
  <span class="spacer"></span>
3714
3714
  <div class="controls">
3715
- ${this.showFilters?r.html`
3715
+ ${this.showFilters?o.html`
3716
3716
  <div class="filter-dropdown">
3717
3717
  <button class="add-btn ${this._showDropdown?"open":""}" @click=${this._toggleDropdown}>
3718
3718
  <ap-icon name="filter" .size=${16}></ap-icon>
3719
3719
  Filters
3720
- ${t>0?r.html`<span class="filter-count">${t}</span>`:r.html`<ap-icon name="chevron-down" .size=${16}></ap-icon>`}
3720
+ ${t>0?o.html`<span class="filter-count">${t}</span>`:o.html`<ap-icon name="chevron-down" .size=${16}></ap-icon>`}
3721
3721
  </button>
3722
- ${this._showDropdown?r.html`
3722
+ ${this._showDropdown?o.html`
3723
3723
  <div class="dropdown-menu">
3724
- ${us.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3724
+ ${xs.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3725
3725
  </div>
3726
- `:r.nothing}
3726
+ `:o.nothing}
3727
3727
  </div>
3728
- `:r.nothing}
3728
+ `:o.nothing}
3729
3729
  <ap-dropdown
3730
3730
  variant="borderless"
3731
3731
  label="Sort"
@@ -3742,26 +3742,32 @@
3742
3742
  >
3743
3743
  <ap-icon name=${this.sortDirection==="asc"?"sort-asc":"sort-desc"} .size=${18}></ap-icon>
3744
3744
  </button>
3745
- ${this.showUpload?r.html`
3745
+ ${this.showCreateFolder?o.html`
3746
+ <button class="new-folder-btn" @click=${this._handleCreateFolderClick}>
3747
+ <ap-icon name="folder-plus" .size=${16}></ap-icon>
3748
+ New folder
3749
+ </button>
3750
+ `:o.nothing}
3751
+ ${this.showUpload?o.html`
3746
3752
  <button class="upload-btn" @click=${this._handleUploadClick}>
3747
3753
  <ap-icon name="upload" .size=${16}></ap-icon>
3748
3754
  Upload
3749
3755
  </button>
3750
- `:r.nothing}
3756
+ `:o.nothing}
3751
3757
  </div>
3752
3758
  </div>
3753
- ${this._openFilter?r.html`
3759
+ ${this._openFilter?o.html`
3754
3760
  <div class="popover-anchor ${this._externalTrigger?"external":""}" ${F(this._externalTrigger&&this._externalTop!=null?{top:`${this._externalTop+4}px`}:null)}>
3755
- ${this._externalTrigger?r.nothing:r.html`
3761
+ ${this._externalTrigger?o.nothing:o.html`
3756
3762
  <div class="anchor-tab">
3757
- ${this._openFilter==="metadata"&&this._openMetadataField?r.html`
3763
+ ${this._openFilter==="metadata"&&this._openMetadataField?o.html`
3758
3764
  <button class="anchor-back" @click=${e=>{e.stopPropagation(),this._openMetadataField=null}} title="Back to fields">
3759
3765
  <ap-icon name="chevron-left" .size=${14}></ap-icon>
3760
3766
  </button>
3761
3767
  ${this._getMetadataFieldLabel(this._openMetadataField)}
3762
- `:r.html`
3768
+ `:o.html`
3763
3769
  <ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
3764
- ${tt[this._openFilter]||this._openFilter}
3770
+ ${at[this._openFilter]||this._openFilter}
3765
3771
  `}
3766
3772
  <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
3767
3773
  <ap-icon name="close" .size=${14}></ap-icon>
@@ -3772,8 +3778,8 @@
3772
3778
  ${this._renderFilterContent(this._openFilter)}
3773
3779
  </div>
3774
3780
  </div>
3775
- `:r.nothing}
3776
- `}};O.styles=r.css`
3781
+ `:o.nothing}
3782
+ `}};O.styles=o.css`
3777
3783
  :host {
3778
3784
  display: block;
3779
3785
  padding: 8px 20px 6px;
@@ -4034,6 +4040,30 @@
4034
4040
  outline-offset: 2px;
4035
4041
  }
4036
4042
 
4043
+ .new-folder-btn {
4044
+ display: inline-flex;
4045
+ align-items: center;
4046
+ gap: 6px;
4047
+ margin-left: 4px;
4048
+ padding: 6px 14px;
4049
+ border: 1px solid var(--ap-primary, oklch(0.578 0.198 268.129));
4050
+ border-radius: 6px;
4051
+ font-size: 0.875rem;
4052
+ font-weight: 500;
4053
+ background: var(--ap-background, oklch(1 0 0));
4054
+ color: var(--ap-primary, oklch(0.578 0.198 268.129));
4055
+ cursor: pointer;
4056
+ white-space: nowrap;
4057
+ transition: background 150ms;
4058
+ }
4059
+ .new-folder-btn:hover {
4060
+ background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.08));
4061
+ }
4062
+ .new-folder-btn:focus-visible {
4063
+ outline: 2px solid var(--ap-ring, oklch(0.578 0.198 268.129 / 0.7));
4064
+ outline-offset: 2px;
4065
+ }
4066
+
4037
4067
  /* Popover anchor row */
4038
4068
  .popover-anchor {
4039
4069
  position: absolute;
@@ -4111,75 +4141,75 @@
4111
4141
  border-radius: 8px;
4112
4142
  top: 0;
4113
4143
  }
4114
- `;M([l.property({type:Number})],O.prototype,"totalCount",2);M([l.property({type:Number})],O.prototype,"totalFolderCount",2);M([l.property({type:Boolean})],O.prototype,"isLoading",2);M([l.property({type:Boolean})],O.prototype,"showUpload",2);M([l.property({type:Boolean})],O.prototype,"showFilters",2);M([l.property()],O.prototype,"countLabel",2);M([l.property()],O.prototype,"sortBy",2);M([l.property()],O.prototype,"sortDirection",2);M([l.property({type:Array})],O.prototype,"sortOptions",2);M([l.property({type:Object})],O.prototype,"filters",2);M([l.property({type:Array})],O.prototype,"labels",2);M([l.property({type:Array})],O.prototype,"tags",2);M([l.property({type:Array})],O.prototype,"fileTypes",2);M([l.property({type:Array})],O.prototype,"metadataFields",2);M([l.property({type:Array})],O.prototype,"pinnedFilters",2);M([l.property({type:Array})],O.prototype,"forcedFilterKeys",2);M([l.property({attribute:!1})],O.prototype,"apiClient",2);M([l.query("ap-dropdown")],O.prototype,"_sortDropdown",2);M([l.state()],O.prototype,"_showDropdown",2);M([l.state()],O.prototype,"_showMetadataSelector",2);M([l.state()],O.prototype,"_openFilter",2);M([l.state()],O.prototype,"_openMetadataField",2);M([l.state()],O.prototype,"_externalTrigger",2);M([l.state()],O.prototype,"_externalLeft",2);M([l.state()],O.prototype,"_externalTop",2);O=M([l.customElement("ap-content-toolbar")],O);var or=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?rr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&or(e,s,a),a};let V=class extends r.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=jt.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,o=i?parseFloat(i):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return a!==null&&o!==null?`${n(a)} – ${n(o)}`:a!==null?`> ${n(a)}`:o!==null?`< ${n(o)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===b.SIZE)return this._getSizeSummary(s);if(e===b.COLOR){const a=s.values.map(o=>o.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===b.TYPE?a=>this._mapTypeLabel(a):e===b.TAGS?a=>{var o;return((o=this.tags.find(n=>n.sid===a))==null?void 0:o.label)||a}:e===b.LABELS?a=>{var o;return((o=this.labels.find(n=>n.sid===a))==null?void 0:o.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,c;const e=((n=ui.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[..._s,...gi],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let o="";switch(t.kind){case"preset":o=i;break;case"before":o=t.to?`Before ${a(t.to)}`:i;break;case"after":o=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?o=`${a(t.from)} – ${a(t.to)}`:t.from?o=`After ${a(t.from)}`:t.to&&(o=`Before ${a(t.to)}`);break;case"specific":o=t.from?a(t.from):"";break;default:o=i}return o?`${e}: ${o}`:""}_getFilterIcon(t){var e;return((e=us.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&&It[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of ci)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 r.html`
4144
+ `;M([l.property({type:Number})],O.prototype,"totalCount",2);M([l.property({type:Number})],O.prototype,"totalFolderCount",2);M([l.property({type:Boolean})],O.prototype,"isLoading",2);M([l.property({type:Boolean})],O.prototype,"showUpload",2);M([l.property({type:Boolean})],O.prototype,"showCreateFolder",2);M([l.property({type:Boolean})],O.prototype,"showFilters",2);M([l.property()],O.prototype,"countLabel",2);M([l.property()],O.prototype,"sortBy",2);M([l.property()],O.prototype,"sortDirection",2);M([l.property({type:Array})],O.prototype,"sortOptions",2);M([l.property({type:Object})],O.prototype,"filters",2);M([l.property({type:Array})],O.prototype,"labels",2);M([l.property({type:Array})],O.prototype,"tags",2);M([l.property({type:Array})],O.prototype,"fileTypes",2);M([l.property({type:Array})],O.prototype,"metadataFields",2);M([l.property({type:Array})],O.prototype,"pinnedFilters",2);M([l.property({type:Array})],O.prototype,"forcedFilterKeys",2);M([l.property({attribute:!1})],O.prototype,"apiClient",2);M([l.query("ap-dropdown")],O.prototype,"_sortDropdown",2);M([l.state()],O.prototype,"_showDropdown",2);M([l.state()],O.prototype,"_showMetadataSelector",2);M([l.state()],O.prototype,"_openFilter",2);M([l.state()],O.prototype,"_openMetadataField",2);M([l.state()],O.prototype,"_externalTrigger",2);M([l.state()],O.prototype,"_externalLeft",2);M([l.state()],O.prototype,"_externalTop",2);O=M([l.customElement("ap-content-toolbar")],O);var co=Object.defineProperty,po=Object.getOwnPropertyDescriptor,ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?po(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&&co(e,s,a),a};let V=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=Kt.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=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} 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===_.SIZE)return this._getSizeSummary(s);if(e===_.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===_.TYPE?a=>this._mapTypeLabel(a):e===_.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===_.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,c;const e=((n=gi.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Fs,...vi],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.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=xs.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&&qt[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of pi)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`
4115
4145
  <span class="chip forced">
4116
- ${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`<span class="chip-label">${s}</span>`:r.html`
4117
- <span class="chip-label">${tt[t]||t}</span>
4118
- ${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
4146
+ ${(i||t===_.TYPE||t===_.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
4147
+ <span class="chip-label">${at[t]||t}</span>
4148
+ ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
4119
4149
  `}
4120
4150
  <span class="chip-lock">
4121
4151
  <ap-icon name="lock" .size=${12}></ap-icon>
4122
4152
  </span>
4123
4153
  </span>
4124
- `}_renderFilterChip(t,e){if(!e)return r.html`
4154
+ `}_renderFilterChip(t,e){if(!e)return o.html`
4125
4155
  <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
4126
4156
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4127
- <span class="chip-label">${tt[t]||t}</span>
4157
+ <span class="chip-label">${at[t]||t}</span>
4128
4158
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4129
4159
  </span>
4130
- `;const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
4160
+ `;const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
4131
4161
  <span class="chip ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
4132
- ${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`
4162
+ ${(i||t===_.TYPE||t===_.SIZE)&&s?o.html`
4133
4163
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4134
- <span class="chip-label">${s}</span>`:r.html`
4135
- <span class="chip-label">${tt[t]||t}</span>
4136
- ${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
4164
+ <span class="chip-label">${s}</span>`:o.html`
4165
+ <span class="chip-label">${at[t]||t}</span>
4166
+ ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
4137
4167
  `}
4138
4168
  <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
4139
4169
  <ap-icon name="close" .size=${12}></ap-icon>
4140
4170
  </button>
4141
4171
  </span>
4142
- `}_renderMetadataChip(t,e){if(!e){const o=this._getMetadataLabel(t),n=this._getMetadataIcon(t);return r.html`
4172
+ `}_renderMetadataChip(t,e){if(!e){const r=this._getMetadataLabel(t),n=this._getMetadataIcon(t);return o.html`
4143
4173
  <span class="chip pinned-empty ${t===this.activeMetadataField?"active":""}" @click=${c=>this._openMetadataFilter(t,c)}>
4144
4174
  <span class="chip-icon"><ap-icon name=${n} .size=${16}></ap-icon></span>
4145
- <span class="chip-label">${o}</span>
4175
+ <span class="chip-label">${r}</span>
4146
4176
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4147
4177
  </span>
4148
- `}const s=this._getFilterSummary(e),i=this._getMetadataLabel(t),a=this._getMetadataIcon(t);return r.html`
4149
- <span class="chip ${t===this.activeMetadataField?"active":""}" @click=${o=>this._openMetadataFilter(t,o)}>
4178
+ `}const s=this._getFilterSummary(e),i=this._getMetadataLabel(t),a=this._getMetadataIcon(t);return o.html`
4179
+ <span class="chip ${t===this.activeMetadataField?"active":""}" @click=${r=>this._openMetadataFilter(t,r)}>
4150
4180
  <span class="chip-icon"><ap-icon name=${a} .size=${16}></ap-icon></span>
4151
4181
  <span class="chip-label">${i}</span>
4152
- ${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
4153
- <button class="chip-remove" @click=${o=>{o.stopPropagation(),this._removeMetadataFilter(t)}} title="Remove filter">
4182
+ ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
4183
+ <button class="chip-remove" @click=${r=>{r.stopPropagation(),this._removeMetadataFilter(t)}} title="Remove filter">
4154
4184
  <ap-icon name="close" .size=${12}></ap-icon>
4155
4185
  </button>
4156
4186
  </span>
4157
- `}render(){const t=gs(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(f=>!e.has(f)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),o=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(f=>!e.has(f)),c=s.filter(f=>!a.has(f)),d=i.filter(f=>!o.has(f)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!o.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),g=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?r.nothing:r.html`
4187
+ `}render(){const t=ws(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)),c=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+c.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
4158
4188
  <div class="chips-row">
4159
4189
  <div class="chips">
4160
- ${[...e].map(f=>this._renderForcedChip(f,t[f]))}
4161
- ${n.map(f=>this._renderFilterChip(f,this.appliedFilters[f]))}
4162
- ${this.pinnedMetadataFields.map(f=>this._renderMetadataChip(f,this.appliedMetadata[f]))}
4163
- ${c.map(f=>this._renderFilterChip(f,this.appliedFilters[f]))}
4164
- ${h?r.html`
4165
- <span class="chip pinned-empty active pending" @click=${f=>this._openFilter(this.pendingFilter,f)}>
4190
+ ${[...e].map(g=>this._renderForcedChip(g,t[g]))}
4191
+ ${n.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
4192
+ ${this.pinnedMetadataFields.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
4193
+ ${c.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
4194
+ ${h?o.html`
4195
+ <span class="chip pinned-empty active pending" @click=${g=>this._openFilter(this.pendingFilter,g)}>
4166
4196
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
4167
- <span class="chip-label">${tt[this.pendingFilter]||this.pendingFilter}</span>
4197
+ <span class="chip-label">${at[this.pendingFilter]||this.pendingFilter}</span>
4168
4198
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4169
4199
  </span>
4170
- `:r.nothing}
4171
- ${d.map(f=>this._renderMetadataChip(f,this.appliedMetadata[f]))}
4172
- ${u?r.html`
4173
- <span class="chip pinned-empty active pending" @click=${f=>this._openMetadataFilter(this.pendingMetadataField,f)}>
4200
+ `:o.nothing}
4201
+ ${d.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
4202
+ ${u?o.html`
4203
+ <span class="chip pinned-empty active pending" @click=${g=>this._openMetadataFilter(this.pendingMetadataField,g)}>
4174
4204
  <span class="chip-icon"><ap-icon name=${this._getMetadataIcon(this.pendingMetadataField)} .size=${16}></ap-icon></span>
4175
4205
  <span class="chip-label">${this._getMetadataLabel(this.pendingMetadataField)}</span>
4176
4206
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4177
4207
  </span>
4178
- `:r.nothing}
4179
- ${g?r.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:r.nothing}
4208
+ `:o.nothing}
4209
+ ${f?o.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:o.nothing}
4180
4210
  </div>
4181
4211
  </div>
4182
- `}};V.styles=r.css`
4212
+ `}};V.styles=o.css`
4183
4213
  :host {
4184
4214
  display: block;
4185
4215
  }
@@ -4326,9 +4356,9 @@
4326
4356
  align-items: center;
4327
4357
  opacity: 0.6;
4328
4358
  }
4329
- `;ie([l.property({type:Object})],V.prototype,"appliedFilters",2);ie([l.property({type:Object})],V.prototype,"appliedMetadata",2);ie([l.property({type:Object})],V.prototype,"forcedFilters",2);ie([l.property({type:Array})],V.prototype,"metadataFields",2);ie([l.property({type:Array})],V.prototype,"pinnedFilters",2);ie([l.property({type:Array})],V.prototype,"pinnedMetadataFields",2);ie([l.property({type:Array})],V.prototype,"tags",2);ie([l.property({type:Array})],V.prototype,"labels",2);ie([l.property()],V.prototype,"activeFilter",2);ie([l.property()],V.prototype,"activeMetadataField",2);ie([l.property()],V.prototype,"pendingFilter",2);ie([l.property()],V.prototype,"pendingMetadataField",2);V=ie([l.customElement("ap-filters-bar")],V);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?lr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nr(e,s,a),a};const cr=6;let pe=class extends r.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 r.html`
4359
+ `;ie([l.property({type:Object})],V.prototype,"appliedFilters",2);ie([l.property({type:Object})],V.prototype,"appliedMetadata",2);ie([l.property({type:Object})],V.prototype,"forcedFilters",2);ie([l.property({type:Array})],V.prototype,"metadataFields",2);ie([l.property({type:Array})],V.prototype,"pinnedFilters",2);ie([l.property({type:Array})],V.prototype,"pinnedMetadataFields",2);ie([l.property({type:Array})],V.prototype,"tags",2);ie([l.property({type:Array})],V.prototype,"labels",2);ie([l.property()],V.prototype,"activeFilter",2);ie([l.property()],V.prototype,"activeMetadataField",2);ie([l.property()],V.prototype,"pendingFilter",2);ie([l.property()],V.prototype,"pendingMetadataField",2);V=ie([l.customElement("ap-filters-bar")],V);var ho=Object.defineProperty,uo=Object.getOwnPropertyDescriptor,we=(t,e,s,i)=>{for(var a=i>1?void 0:i?uo(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&&ho(e,s,a),a};const fo=6;let pe=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`
4330
4360
  <div class="grid" role="list" aria-label="Assets" ${F({"--ap-grid-min-col":String(t)})}>
4331
- ${this.folders.map((e,s)=>r.html`
4361
+ ${this.folders.map((e,s)=>o.html`
4332
4362
  <ap-folder-card
4333
4363
  .folder=${e}
4334
4364
  .previews=${this.folderPreviews[e.uuid]||[]}
@@ -4341,7 +4371,7 @@
4341
4371
  @folder-select=${i=>{i.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:i.detail,bubbles:!0,composed:!0}))}}
4342
4372
  ></ap-folder-card>
4343
4373
  `)}
4344
- ${this.assets.map((e,s)=>{const i=s>=this._prevCount?Math.min(s-this._prevCount,20):Math.min(s,20);return r.html`
4374
+ ${this.assets.map((e,s)=>{const i=s>=this._prevCount?Math.min(s-this._prevCount,20):Math.min(s,20);return o.html`
4345
4375
  <ap-asset-card
4346
4376
  .asset=${e}
4347
4377
  .index=${this.folderSelectable?this.folders.length+s:s}
@@ -4354,15 +4384,15 @@
4354
4384
  @asset-quick-select=${a=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4355
4385
  ></ap-asset-card>
4356
4386
  `})}
4357
- ${this.isLoading?Array.from({length:cr},()=>r.html`<div class="ghost-card">
4387
+ ${this.isLoading?Array.from({length:fo},()=>o.html`<div class="ghost-card">
4358
4388
  <div class="ghost-thumb"></div>
4359
4389
  <div class="ghost-info">
4360
4390
  <div class="ghost-line ghost-name"></div>
4361
4391
  <div class="ghost-line ghost-meta"></div>
4362
4392
  </div>
4363
- </div>`):r.nothing}
4393
+ </div>`):o.nothing}
4364
4394
  </div>
4365
- `}};pe.styles=r.css`
4395
+ `}};pe.styles=o.css`
4366
4396
  :host {
4367
4397
  display: block;
4368
4398
  padding: 0 20px 16px;
@@ -4417,9 +4447,9 @@
4417
4447
  @media (prefers-reduced-motion: reduce) {
4418
4448
  .ghost-thumb, .ghost-line { animation: none; }
4419
4449
  }
4420
- `;ye([l.property({type:Array})],pe.prototype,"assets",2);ye([l.property({type:Array})],pe.prototype,"folders",2);ye([l.property({type:Object})],pe.prototype,"folderPreviews",2);ye([l.property({type:Array})],pe.prototype,"selectedIds",2);ye([l.property({type:Array})],pe.prototype,"selectedFolderIds",2);ye([l.property({type:Boolean})],pe.prototype,"isLoading",2);ye([l.property({type:Boolean})],pe.prototype,"multiSelect",2);ye([l.property({type:Boolean})],pe.prototype,"folderSelectable",2);ye([l.property({type:String})],pe.prototype,"gridSize",2);pe=ye([l.customElement("ap-grid-view")],pe);var dr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,he=(t,e,s,i)=>{for(var a=i>1?void 0:i?pr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&dr(e,s,a),a};const hr=5;let Y=class extends r.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 r.html`
4450
+ `;we([l.property({type:Array})],pe.prototype,"assets",2);we([l.property({type:Array})],pe.prototype,"folders",2);we([l.property({type:Object})],pe.prototype,"folderPreviews",2);we([l.property({type:Array})],pe.prototype,"selectedIds",2);we([l.property({type:Array})],pe.prototype,"selectedFolderIds",2);we([l.property({type:Boolean})],pe.prototype,"isLoading",2);we([l.property({type:Boolean})],pe.prototype,"multiSelect",2);we([l.property({type:Boolean})],pe.prototype,"folderSelectable",2);we([l.property({type:String})],pe.prototype,"gridSize",2);pe=we([l.customElement("ap-grid-view")],pe);var go=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,he=(t,e,s,i)=>{for(var a=i>1?void 0:i?vo(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&&go(e,s,a),a};const mo=5;let W=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`
4421
4451
  <div class="list-header" ${F({"grid-template-columns":this._getGridColumns(this.multiSelect)})} role="row" aria-label="Column headers">
4422
- ${this.multiSelect?r.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4452
+ ${this.multiSelect?o.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4423
4453
  <div class="header-check-box ${s?"checked":e>0?"indeterminate":""}">
4424
4454
  <svg class="header-check-icon check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
4425
4455
  <path d="M20 6 9 17l-5-5"></path>
@@ -4428,16 +4458,16 @@
4428
4458
  <path d="M5 12h14"></path>
4429
4459
  </svg>
4430
4460
  </div>
4431
- </span>`:r.nothing}
4461
+ </span>`:o.nothing}
4432
4462
  <span></span>
4433
4463
  <span>Name</span>
4434
4464
  <span>Type</span>
4435
- ${this._compactLevel<2?r.html`<span>Size</span>`:r.nothing}
4436
- ${this._compactLevel<1?r.html`<span>Date</span>`:r.nothing}
4465
+ ${this._compactLevel<2?o.html`<span>Size</span>`:o.nothing}
4466
+ ${this._compactLevel<1?o.html`<span>Date</span>`:o.nothing}
4437
4467
  <span></span>
4438
4468
  </div>
4439
4469
  <div class="list-body" role="list" aria-label="Assets">
4440
- ${this.folders.map((i,a)=>r.html`
4470
+ ${this.folders.map((i,a)=>o.html`
4441
4471
  <ap-folder-row
4442
4472
  .folder=${i}
4443
4473
  .previews=${this.folderPreviews[i.uuid]||[]}
@@ -4447,11 +4477,11 @@
4447
4477
  ?selected=${this.selectedFolderIds.includes(i.uuid)}
4448
4478
  .index=${a}
4449
4479
  data-folder-uuid=${i.uuid}
4450
- @folder-open=${o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:o.detail,bubbles:!0,composed:!0}))}}
4451
- @folder-select=${o=>{o.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:o.detail,bubbles:!0,composed:!0}))}}
4480
+ @folder-open=${r=>{r.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-open",{detail:r.detail,bubbles:!0,composed:!0}))}}
4481
+ @folder-select=${r=>{r.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:r.detail,bubbles:!0,composed:!0}))}}
4452
4482
  ></ap-folder-row>
4453
4483
  `)}
4454
- ${this.assets.map((i,a)=>r.html`
4484
+ ${this.assets.map((i,a)=>o.html`
4455
4485
  <ap-asset-row
4456
4486
  .asset=${i}
4457
4487
  .index=${this.folderSelectable?this.folders.length+a:a}
@@ -4459,24 +4489,24 @@
4459
4489
  .multiSelect=${this.multiSelect}
4460
4490
  .compactLevel=${this._compactLevel}
4461
4491
  data-asset-uuid=${i.uuid}
4462
- @asset-select=${o=>this.dispatchEvent(new CustomEvent("asset-select",{detail:o.detail,bubbles:!0,composed:!0}))}
4463
- @asset-preview=${o=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:o.detail,bubbles:!0,composed:!0}))}
4464
- @asset-quick-select=${o=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:o.detail,bubbles:!0,composed:!0}))}
4492
+ @asset-select=${r=>this.dispatchEvent(new CustomEvent("asset-select",{detail:r.detail,bubbles:!0,composed:!0}))}
4493
+ @asset-preview=${r=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:r.detail,bubbles:!0,composed:!0}))}
4494
+ @asset-quick-select=${r=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:r.detail,bubbles:!0,composed:!0}))}
4465
4495
  ></ap-asset-row>
4466
4496
  `)}
4467
- ${this.isLoading?Array.from({length:hr},(i,a)=>{const o=["70%","55%","80%","45%","65%"];return r.html`
4497
+ ${this.isLoading?Array.from({length:mo},(i,a)=>{const r=["70%","55%","80%","45%","65%"];return o.html`
4468
4498
  <div class="ghost-row" ${F({"grid-template-columns":this._getGridColumns(this.multiSelect)})}>
4469
- ${this.multiSelect?r.html`<div class="ghost-el ghost-check"></div>`:r.nothing}
4499
+ ${this.multiSelect?o.html`<div class="ghost-el ghost-check"></div>`:o.nothing}
4470
4500
  <div class="ghost-el ghost-thumb"></div>
4471
- <div class="ghost-el ghost-name" ${F({width:o[a]})}></div>
4501
+ <div class="ghost-el ghost-name" ${F({width:r[a]})}></div>
4472
4502
  <div class="ghost-el ghost-type"></div>
4473
- ${this._compactLevel<2?r.html`<div class="ghost-el ghost-size"></div>`:r.nothing}
4474
- ${this._compactLevel<1?r.html`<div class="ghost-el ghost-date"></div>`:r.nothing}
4503
+ ${this._compactLevel<2?o.html`<div class="ghost-el ghost-size"></div>`:o.nothing}
4504
+ ${this._compactLevel<1?o.html`<div class="ghost-el ghost-date"></div>`:o.nothing}
4475
4505
  <div></div>
4476
4506
  </div>
4477
- `}):r.nothing}
4507
+ `}):o.nothing}
4478
4508
  </div>
4479
- `}};Y.styles=r.css`
4509
+ `}};W.styles=o.css`
4480
4510
  :host {
4481
4511
  display: block;
4482
4512
  padding: 0 20px 16px;
@@ -4563,22 +4593,22 @@
4563
4593
  @media (prefers-reduced-motion: reduce) {
4564
4594
  .ghost-el { animation: none; }
4565
4595
  }
4566
- `;he([l.property({type:Array})],Y.prototype,"assets",2);he([l.property({type:Array})],Y.prototype,"folders",2);he([l.property({type:Array})],Y.prototype,"selectedIds",2);he([l.property({type:Array})],Y.prototype,"selectedFolderIds",2);he([l.property({type:Boolean})],Y.prototype,"isLoading",2);he([l.property({type:Boolean})],Y.prototype,"multiSelect",2);he([l.property({type:Boolean})],Y.prototype,"folderSelectable",2);he([l.property({type:Number})],Y.prototype,"totalCount",2);he([l.property({type:Boolean})],Y.prototype,"isSelectingAll",2);he([l.property({type:Object})],Y.prototype,"folderPreviews",2);he([l.state()],Y.prototype,"_compactLevel",2);Y=he([l.customElement("ap-list-view")],Y);function ks(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 Nt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function wi(t,e){return!t||!e?"":`${t} x ${e}`}var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Ft=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let Ge=class extends r.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=o=>String(o).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 h,u,g,p,f,m,x,_;const t=this.asset;if(!t)return r.html``;const s=st(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=oi(t.extension||"")||a;let n="";s?n=ni(t):i?n=ms(t):o&&(n=Rt(t));const c=kt(t.extension||""),d=vs(t.extension||"");return r.html`
4596
+ `;he([l.property({type:Array})],W.prototype,"assets",2);he([l.property({type:Array})],W.prototype,"folders",2);he([l.property({type:Array})],W.prototype,"selectedIds",2);he([l.property({type:Array})],W.prototype,"selectedFolderIds",2);he([l.property({type:Boolean})],W.prototype,"isLoading",2);he([l.property({type:Boolean})],W.prototype,"multiSelect",2);he([l.property({type:Boolean})],W.prototype,"folderSelectable",2);he([l.property({type:Number})],W.prototype,"totalCount",2);he([l.property({type:Boolean})],W.prototype,"isSelectingAll",2);he([l.property({type:Object})],W.prototype,"folderPreviews",2);he([l.state()],W.prototype,"_compactLevel",2);W=he([l.customElement("ap-list-view")],W);function Os(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 Qt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ki(t,e){return!t||!e?"":`${t} x ${e}`}var bo=Object.defineProperty,_o=Object.getOwnPropertyDescriptor,It=(t,e,s,i)=>{for(var a=i>1?void 0:i?_o(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&&bo(e,s,a),a};let Ye=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 h,u,f,p,g,m,x,b;const t=this.asset;if(!t)return o.html``;const s=rt(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(f=t.info)!=null&&f.image_thumbnail||(p=t.info)!=null&&p.preview),r=ni(t.extension||"")||a;let n="";s?n=ci(t):i?n=Ss(t):r&&(n=Gt(t));const c=Ot(t.extension||""),d=ks(t.extension||"");return o.html`
4567
4597
  <div class="card" @click=${this._handleSelect}>
4568
4598
  <div class="thumbnail ${d&&n?"chess":""}">
4569
- ${n?r.html`<img
4599
+ ${n?o.html`<img
4570
4600
  src=${n}
4571
4601
  alt=${t.name}
4572
4602
  loading="lazy"
4573
4603
  class="thumb-img ${d?"transparent-asset":""}"
4574
- @error=${w=>{const y=w.target,L=it();y.src!==c&&y.src!==L?(y.src=c,y.classList.add("icon-fallback")):y.src!==L&&(y.src=L)}}
4575
- />`:r.html`<img
4604
+ @error=${w=>{const y=w.target,L=ot();y.src!==c&&y.src!==L?(y.src=c,y.classList.add("icon-fallback")):y.src!==L&&(y.src=L)}}
4605
+ />`:o.html`<img
4576
4606
  src=${c}
4577
4607
  alt=${t.name}
4578
4608
  class="thumb-img icon-fallback"
4579
- @error=${w=>{const y=w.target,L=it();y.src!==L&&(y.src=L)}}
4609
+ @error=${w=>{const y=w.target,L=ot();y.src!==L&&(y.src=L)}}
4580
4610
  />`}
4581
- ${s&&(((f=t.info)==null?void 0:f.video_duration)??((m=t.info)==null?void 0:m.duration))!=null?r.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:r.nothing}
4611
+ ${s&&(((g=t.info)==null?void 0:g.video_duration)??((m=t.info)==null?void 0:m.duration))!=null?o.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:o.nothing}
4582
4612
  <div class="overlay">
4583
4613
  <button class="overlay-btn" @click=${this._handlePreview} aria-label="Preview">
4584
4614
  <ap-icon name="preview" .size=${16}></ap-icon>
@@ -4589,7 +4619,7 @@
4589
4619
  Select
4590
4620
  </button>
4591
4621
  </div>
4592
- ${this.multiSelect?r.html`
4622
+ ${this.multiSelect?o.html`
4593
4623
  <div class="check">
4594
4624
  <div class="check-box">
4595
4625
  <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
@@ -4597,14 +4627,14 @@
4597
4627
  </svg>
4598
4628
  </div>
4599
4629
  </div>
4600
- `:r.nothing}
4630
+ `:o.nothing}
4601
4631
  </div>
4602
4632
  <div class="info">
4603
4633
  <div class="name" title=${t.name}>${t.name}</div>
4604
- <div class="meta">${(x=t.extension)==null?void 0:x.toUpperCase()}${(()=>{var k,S,E,A;const w=((k=t.info)==null?void 0:k.img_w)||((S=t.info)==null?void 0:S.video_w),y=((E=t.info)==null?void 0:E.img_h)||((A=t.info)==null?void 0:A.video_h),L=wi(w,y);return L?` · ${L}`:""})()} · ${ks(((_=t.size)==null?void 0:_.bytes)||0)}</div>
4634
+ <div class="meta">${(x=t.extension)==null?void 0:x.toUpperCase()}${(()=>{var k,S,E,A;const w=((k=t.info)==null?void 0:k.img_w)||((S=t.info)==null?void 0:S.video_w),y=((E=t.info)==null?void 0:E.img_h)||((A=t.info)==null?void 0:A.video_h),L=ki(w,y);return L?` · ${L}`:""})()} · ${Os(((b=t.size)==null?void 0:b.bytes)||0)}</div>
4605
4635
  </div>
4606
4636
  </div>
4607
- `}};Ge.styles=r.css`
4637
+ `}};Ye.styles=o.css`
4608
4638
  :host {
4609
4639
  display: block;
4610
4640
  animation: ap-card-in 300ms ease-out both;
@@ -4783,9 +4813,9 @@
4783
4813
  :host { animation: none; }
4784
4814
  .overlay { transition: none; }
4785
4815
  }
4786
- `;Ft([l.property({type:Object})],Ge.prototype,"asset",2);Ft([l.property({type:Number})],Ge.prototype,"index",2);Ft([l.property({type:Boolean,reflect:!0})],Ge.prototype,"selected",2);Ft([l.property({type:Boolean})],Ge.prototype,"multiSelect",2);Ge=Ft([l.customElement("ap-asset-card")],Ge);var fr=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?vr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let Me=class extends r.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 h,u,g,p,f,m;const t=this.asset;if(!t)return r.html``;const s=st(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=oi(t.extension||"")||a;let n="";s?n=ni(t):i?n=ms(t):o&&(n=Rt(t));const c=kt(t.extension||""),d=vs(t.extension||"");return r.html`
4816
+ `;It([l.property({type:Object})],Ye.prototype,"asset",2);It([l.property({type:Number})],Ye.prototype,"index",2);It([l.property({type:Boolean,reflect:!0})],Ye.prototype,"selected",2);It([l.property({type:Boolean})],Ye.prototype,"multiSelect",2);Ye=It([l.customElement("ap-asset-card")],Ye);var yo=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,ft=(t,e,s,i)=>{for(var a=i>1?void 0:i?xo(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&&yo(e,s,a),a};let De=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 h,u,f,p,g,m;const t=this.asset;if(!t)return o.html``;const s=rt(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(f=t.info)!=null&&f.image_thumbnail||(p=t.info)!=null&&p.preview),r=ni(t.extension||"")||a;let n="";s?n=ci(t):i?n=Ss(t):r&&(n=Gt(t));const c=Ot(t.extension||""),d=ks(t.extension||"");return o.html`
4787
4817
  <div class="row" ${F({"grid-template-columns":this._getGridColumns()})} @click=${this._handleSelect}>
4788
- ${this.multiSelect?r.html`
4818
+ ${this.multiSelect?o.html`
4789
4819
  <div class="check">
4790
4820
  <div class="check-box">
4791
4821
  <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
@@ -4793,25 +4823,25 @@
4793
4823
  </svg>
4794
4824
  </div>
4795
4825
  </div>
4796
- `:r.nothing}
4826
+ `:o.nothing}
4797
4827
  <div class="thumb ${d&&n?"chess":""}">
4798
- ${n?r.html`<img
4828
+ ${n?o.html`<img
4799
4829
  src=${n}
4800
4830
  alt=${t.name}
4801
4831
  class="${d?"transparent-asset":""}"
4802
4832
  loading="lazy"
4803
- @error=${x=>{const _=x.target,w=it();_.src!==c&&_.src!==w?(_.src=c,_.classList.add("icon-fallback")):_.src!==w&&(_.src=w)}}
4804
- />`:r.html`<img
4833
+ @error=${x=>{const b=x.target,w=ot();b.src!==c&&b.src!==w?(b.src=c,b.classList.add("icon-fallback")):b.src!==w&&(b.src=w)}}
4834
+ />`:o.html`<img
4805
4835
  src=${c}
4806
4836
  alt=${t.name}
4807
4837
  class="icon-fallback"
4808
- @error=${x=>{const _=x.target,w=it();_.src!==w&&(_.src=w)}}
4838
+ @error=${x=>{const b=x.target,w=ot();b.src!==w&&(b.src=w)}}
4809
4839
  />`}
4810
4840
  </div>
4811
4841
  <div class="name" title=${t.name}>${t.name}</div>
4812
- <div class="type">${(f=t.extension)==null?void 0:f.toUpperCase()}</div>
4813
- ${this.compactLevel<2?r.html`<div class="desc">${ks(((m=t.size)==null?void 0:m.bytes)||0)}</div>`:r.nothing}
4814
- ${this.compactLevel<1?r.html`<div class="date">${Nt(t.created_at||"")}</div>`:r.nothing}
4842
+ <div class="type">${(g=t.extension)==null?void 0:g.toUpperCase()}</div>
4843
+ ${this.compactLevel<2?o.html`<div class="desc">${Os(((m=t.size)==null?void 0:m.bytes)||0)}</div>`:o.nothing}
4844
+ ${this.compactLevel<1?o.html`<div class="date">${Qt(t.created_at||"")}</div>`:o.nothing}
4815
4845
  <div class="actions">
4816
4846
  <button class="icon-btn select-btn" @click=${this._handleQuickSelect} aria-label="Select" title="Select">
4817
4847
  <ap-icon name="select" .size=${16}></ap-icon>
@@ -4821,7 +4851,7 @@
4821
4851
  </button>
4822
4852
  </div>
4823
4853
  </div>
4824
- `}};Me.styles=r.css`
4854
+ `}};De.styles=o.css`
4825
4855
  :host {
4826
4856
  display: block;
4827
4857
  }
@@ -4951,31 +4981,31 @@
4951
4981
  :host([selected]) .check-icon {
4952
4982
  display: block;
4953
4983
  }
4954
- `;pt([l.property({type:Object})],Me.prototype,"asset",2);pt([l.property({type:Number})],Me.prototype,"index",2);pt([l.property({type:Boolean,reflect:!0})],Me.prototype,"selected",2);pt([l.property({type:Boolean})],Me.prototype,"multiSelect",2);pt([l.property({type:Number})],Me.prototype,"compactLevel",2);Me=pt([l.customElement("ap-asset-row")],Me);var mr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,We=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mr(e,s,a),a};let Se=class extends r.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 li(t,"200")}_renderPreviewImg(t){const e=ri(t.file_type),s=this._getPreviewUrl(t),i=kt(Gt(t.file_type)),a=it();return r.html`<div class="preview-slot ${e?"icon-bg":""}">
4984
+ `;ft([l.property({type:Object})],De.prototype,"asset",2);ft([l.property({type:Number})],De.prototype,"index",2);ft([l.property({type:Boolean,reflect:!0})],De.prototype,"selected",2);ft([l.property({type:Boolean})],De.prototype,"multiSelect",2);ft([l.property({type:Number})],De.prototype,"compactLevel",2);De=ft([l.customElement("ap-asset-row")],De);var wo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Je=(t,e,s,i)=>{for(var a=i>1?void 0:i?$o(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&&wo(e,s,a),a};let Fe=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 di(t,"200")}_renderPreviewImg(t){const e=li(t.file_type),s=this._getPreviewUrl(t),i=Ot(es(t.file_type)),a=ot();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4955
4985
  <img
4956
4986
  class="preview-img ${e?"icon-mode":""}"
4957
4987
  src="${s||i}"
4958
4988
  alt=""
4959
4989
  loading="lazy"
4960
- @error=${o=>{const n=o.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4961
- @load=${o=>{const n=o.target,c=n.parentElement;n.src.includes("assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4990
+ @error=${r=>{const n=r.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4991
+ @load=${r=>{const n=r.target,c=n.parentElement;n.src.includes("assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4962
4992
  />
4963
- </div>`}_renderPreviews(){if(this.previews.length===0)return r.html`<div class="empty-preview"><ap-icon name="inbox" .size=${64}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?r.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:r.html`
4993
+ </div>`}_renderPreviews(){if(this.previews.length===0)return o.html`<div class="empty-preview"><ap-icon name="inbox" .size=${64}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?o.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:o.html`
4964
4994
  <div class="preview-grid">
4965
4995
  <div class="preview-left">${this._renderPreviewImg(t[0])}</div>
4966
4996
  <div class="preview-right">
4967
4997
  <div class="preview-right-item">${this._renderPreviewImg(t[1])}</div>
4968
- ${t[2]?r.html`<div class="preview-right-item">${this._renderPreviewImg(t[2])}</div>`:r.nothing}
4998
+ ${t[2]?o.html`<div class="preview-right-item">${this._renderPreviewImg(t[2])}</div>`:o.nothing}
4969
4999
  </div>
4970
5000
  </div>
4971
- `}render(){var a,o;const t=this.folder;if(!t)return r.html``;const e=((a=t.count)==null?void 0:a.files_direct)??0,i=(((o=t.count)==null?void 0:o.files_recursive)??0)-e;return r.html`
5001
+ `}render(){var a,r;const t=this.folder;if(!t)return o.html``;const e=((a=t.count)==null?void 0:a.files_direct)??0,i=(((r=t.count)==null?void 0:r.files_recursive)??0)-e;return o.html`
4972
5002
  <div class="card" @click=${this._handleClick}>
4973
5003
  <!-- Folder shape background -->
4974
5004
  <svg class="folder-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
4975
5005
  <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z"
4976
5006
  rx="3" ry="3" />
4977
5007
  </svg>
4978
- ${this.selectable&&this.multiSelect?r.html`
5008
+ ${this.selectable&&this.multiSelect?o.html`
4979
5009
  <div class="check">
4980
5010
  <div class="check-box">
4981
5011
  <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
@@ -4983,7 +5013,7 @@
4983
5013
  </svg>
4984
5014
  </div>
4985
5015
  </div>
4986
- `:r.nothing}
5016
+ `:o.nothing}
4987
5017
  <div class="card-content">
4988
5018
  <div class="preview-container">
4989
5019
  <div class="preview-overlay"></div>
@@ -4993,12 +5023,12 @@
4993
5023
  <div class="name" title=${t.name}>${t.name}</div>
4994
5024
  <div class="counts">
4995
5025
  <span>${e} asset${e!==1?"s":""}</span>
4996
- ${i>0?r.html`<span>${i} sub-asset${i!==1?"s":""}</span>`:r.nothing}
5026
+ ${i>0?o.html`<span>${i} sub-asset${i!==1?"s":""}</span>`:o.nothing}
4997
5027
  </div>
4998
5028
  </div>
4999
5029
  </div>
5000
5030
  </div>
5001
- `}};Se.styles=[W,r.css`
5031
+ `}};Fe.styles=[H,o.css`
5002
5032
  :host {
5003
5033
  display: block;
5004
5034
  }
@@ -5176,42 +5206,42 @@
5176
5206
  :host([selected]) .check-icon {
5177
5207
  display: block;
5178
5208
  }
5179
- `];We([l.property({type:Object})],Se.prototype,"folder",2);We([l.property({type:Array})],Se.prototype,"previews",2);We([l.property({type:Boolean,reflect:!0})],Se.prototype,"selected",2);We([l.property({type:Boolean})],Se.prototype,"selectable",2);We([l.property({type:Boolean})],Se.prototype,"multiSelect",2);We([l.property({type:Number})],Se.prototype,"index",2);Se=We([l.customElement("ap-folder-card")],Se);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,Ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let me=class extends r.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=ri(t.file_type),s=li(t,"80"),i=kt(Gt(t.file_type)),a=it();return r.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5209
+ `];Je([l.property({type:Object})],Fe.prototype,"folder",2);Je([l.property({type:Array})],Fe.prototype,"previews",2);Je([l.property({type:Boolean,reflect:!0})],Fe.prototype,"selected",2);Je([l.property({type:Boolean})],Fe.prototype,"selectable",2);Je([l.property({type:Boolean})],Fe.prototype,"multiSelect",2);Je([l.property({type:Number})],Fe.prototype,"index",2);Fe=Je([l.customElement("ap-folder-card")],Fe);var ko=Object.defineProperty,So=Object.getOwnPropertyDescriptor,ze=(t,e,s,i)=>{for(var a=i>1?void 0:i?So(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&&ko(e,s,a),a};let be=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=li(t.file_type),s=di(t,"80"),i=Ot(es(t.file_type)),a=ot();return o.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5180
5210
  class="preview-img ${e?"icon-mode":""}"
5181
5211
  src="${s||i}"
5182
5212
  alt=""
5183
5213
  loading="lazy"
5184
- @error=${o=>{const n=o.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
5185
- /></div>`}_renderThumb(){const t=r.html`
5214
+ @error=${r=>{const n=r.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
5215
+ /></div>`}_renderThumb(){const t=o.html`
5186
5216
  <svg class="folder-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
5187
5217
  <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z"
5188
5218
  />
5189
5219
  </svg>
5190
- `,e=this.previews.slice(0,2);return r.html`
5220
+ `,e=this.previews.slice(0,2);return o.html`
5191
5221
  ${t}
5192
5222
  <div class="preview-area">
5193
- ${e.length>0?e.map(s=>this._renderPreviewImg(s)):r.html`<div class="empty-preview">
5223
+ ${e.length>0?e.map(s=>this._renderPreviewImg(s)):o.html`<div class="empty-preview">
5194
5224
  <ap-icon name="inbox" .size=${14}></ap-icon>
5195
5225
  </div>`}
5196
5226
  </div>
5197
- `}_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}))}render(){var e,s;const t=this.folder;return t?r.html`
5227
+ `}_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}))}render(){var e,s;const t=this.folder;return t?o.html`
5198
5228
  <div class="row" ${F({"grid-template-columns":this._getGridColumns()})} @click=${this._handleClick}>
5199
- ${this.multiSelect?this.selectable?r.html`
5229
+ ${this.multiSelect?this.selectable?o.html`
5200
5230
  <div class="check">
5201
5231
  <div class="check-box">
5202
5232
  <svg class="check-icon" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
5203
5233
  <path d="M20 6 9 17l-5-5"></path>
5204
5234
  </svg>
5205
5235
  </div>
5206
- </div>`:r.html`<div></div>`:r.nothing}
5236
+ </div>`:o.html`<div></div>`:o.nothing}
5207
5237
  <div class="thumb">${this._renderThumb()}</div>
5208
5238
  <div class="name">${t.name}</div>
5209
5239
  <div class="meta">Folder</div>
5210
- ${this.compactLevel<2?r.html`<div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>`:r.nothing}
5211
- ${this.compactLevel<1?r.html`<div class="meta">${Nt(t.modified_at||t.updated_at||"")}</div>`:r.nothing}
5240
+ ${this.compactLevel<2?o.html`<div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>`:o.nothing}
5241
+ ${this.compactLevel<1?o.html`<div class="meta">${Qt(t.modified_at||t.updated_at||"")}</div>`:o.nothing}
5212
5242
  <div></div>
5213
5243
  </div>
5214
- `:r.html``}};me.styles=r.css`
5244
+ `:o.html``}};be.styles=o.css`
5215
5245
  :host {
5216
5246
  display: block;
5217
5247
  }
@@ -5330,7 +5360,7 @@
5330
5360
  :host([selected]) .check-icon {
5331
5361
  display: block;
5332
5362
  }
5333
- `;Ie([l.property({type:Object})],me.prototype,"folder",2);Ie([l.property({type:Array})],me.prototype,"previews",2);Ie([l.property({type:Boolean,reflect:!0})],me.prototype,"selected",2);Ie([l.property({type:Boolean})],me.prototype,"selectable",2);Ie([l.property({type:Boolean})],me.prototype,"multiSelect",2);Ie([l.property({type:Number})],me.prototype,"index",2);Ie([l.property({type:Number})],me.prototype,"compactLevel",2);me=Ie([l.customElement("ap-folder-row")],me);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,Ss=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let vt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5363
+ `;ze([l.property({type:Object})],be.prototype,"folder",2);ze([l.property({type:Array})],be.prototype,"previews",2);ze([l.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);ze([l.property({type:Boolean})],be.prototype,"selectable",2);ze([l.property({type:Boolean})],be.prototype,"multiSelect",2);ze([l.property({type:Number})],be.prototype,"index",2);ze([l.property({type:Number})],be.prototype,"compactLevel",2);be=ze([l.customElement("ap-folder-row")],be);var Co=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,Ms=(t,e,s,i)=>{for(var a=i>1?void 0:i?Fo(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&&Co(e,s,a),a};let kt=class extends o.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return o.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return o.html`
5334
5364
  <div class="card" @click=${this._handleClick}>
5335
5365
  <div class="icon-wrapper" ${F({background:`color-mix(in srgb, ${s} 10%, transparent)`})}>
5336
5366
  <ap-icon name="tag" .size=${18} ${F({color:s})}></ap-icon>
@@ -5340,7 +5370,7 @@
5340
5370
  <div class="count">${e} asset${e!==1?"s":""}</div>
5341
5371
  </div>
5342
5372
  </div>
5343
- `}};vt.styles=[W,r.css`
5373
+ `}};kt.styles=[H,o.css`
5344
5374
  :host {
5345
5375
  display: block;
5346
5376
  }
@@ -5387,7 +5417,7 @@
5387
5417
  color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
5388
5418
  margin-top: 2px;
5389
5419
  }
5390
- `];Ss([l.property({type:Object})],vt.prototype,"label",2);Ss([l.property({type:Number})],vt.prototype,"index",2);vt=Ss([l.customElement("ap-label-card")],vt);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let mt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5420
+ `];Ms([l.property({type:Object})],kt.prototype,"label",2);Ms([l.property({type:Number})],kt.prototype,"index",2);kt=Ms([l.customElement("ap-label-card")],kt);var Eo=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Ps=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ao(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&&Eo(e,s,a),a};let St=class extends o.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return o.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return o.html`
5391
5421
  <div class="row" @click=${this._handleClick}>
5392
5422
  <div class="icon-wrapper" ${F({background:`color-mix(in srgb, ${s} 10%, transparent)`})}>
5393
5423
  <ap-icon name="tag" .size=${16} ${F({color:s})}></ap-icon>
@@ -5395,7 +5425,7 @@
5395
5425
  <div class="name" title=${t.name}>${t.name}</div>
5396
5426
  <div class="count">${e} asset${e!==1?"s":""}</div>
5397
5427
  </div>
5398
- `}};mt.styles=r.css`
5428
+ `}};St.styles=o.css`
5399
5429
  :host {
5400
5430
  display: block;
5401
5431
  }
@@ -5435,7 +5465,7 @@
5435
5465
  white-space: nowrap;
5436
5466
  text-align: right;
5437
5467
  }
5438
- `;Cs([l.property({type:Object})],mt.prototype,"label",2);Cs([l.property({type:Number})],mt.prototype,"index",2);mt=Cs([l.customElement("ap-label-row")],mt);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let bt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5468
+ `;Ps([l.property({type:Object})],St.prototype,"label",2);Ps([l.property({type:Number})],St.prototype,"index",2);St=Ps([l.customElement("ap-label-row")],St);var To=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Is=(t,e,s,i)=>{for(var a=i>1?void 0:i?Lo(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&&To(e,s,a),a};let Ct=class extends o.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?o.html`
5439
5469
  <div class="card" @click=${this._handleClick}>
5440
5470
  <div class="icon-wrapper">
5441
5471
  <ap-icon name="layout-grid" .size=${22}></ap-icon>
@@ -5447,7 +5477,7 @@
5447
5477
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5448
5478
  </div>
5449
5479
  </div>
5450
- `:r.html``}};bt.styles=[W,r.css`
5480
+ `:o.html``}};Ct.styles=[H,o.css`
5451
5481
  @keyframes ap-card-in {
5452
5482
  from { opacity: 0; transform: translateY(8px); }
5453
5483
  to { opacity: 1; transform: translateY(0); }
@@ -5509,7 +5539,7 @@
5509
5539
  opacity: 0.5;
5510
5540
  transition: opacity 150ms;
5511
5541
  }
5512
- `];Fs([l.property({type:Object})],bt.prototype,"collection",2);Fs([l.property({type:Number})],bt.prototype,"index",2);bt=Fs([l.customElement("ap-collection-card")],bt);var Fr=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?Er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fr(e,s,a),a};let _t=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_formatDate(t){if(!t)return"";try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return""}}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5542
+ `];Is([l.property({type:Object})],Ct.prototype,"collection",2);Is([l.property({type:Number})],Ct.prototype,"index",2);Ct=Is([l.customElement("ap-collection-card")],Ct);var Oo=Object.defineProperty,Mo=Object.getOwnPropertyDescriptor,Ds=(t,e,s,i)=>{for(var a=i>1?void 0:i?Mo(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&&Oo(e,s,a),a};let Ft=class extends o.LitElement{constructor(){super(...arguments),this.index=0}_formatDate(t){if(!t)return"";try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return""}}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?o.html`
5513
5543
  <div class="row" @click=${this._handleClick}>
5514
5544
  <div class="icon-wrapper">
5515
5545
  <ap-icon name="layout-grid" .size=${16}></ap-icon>
@@ -5520,7 +5550,7 @@
5520
5550
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5521
5551
  </div>
5522
5552
  </div>
5523
- `:r.html``}};_t.styles=r.css`
5553
+ `:o.html``}};Ft.styles=o.css`
5524
5554
  :host {
5525
5555
  display: block;
5526
5556
  }
@@ -5575,7 +5605,7 @@
5575
5605
  opacity: 0.5;
5576
5606
  transition: opacity 150ms;
5577
5607
  }
5578
- `;Es([l.property({type:Object})],_t.prototype,"collection",2);Es([l.property({type:Number})],_t.prototype,"index",2);_t=Es([l.customElement("ap-collection-row")],_t);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?Tr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ar(e,s,a),a};let yt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5608
+ `;Ds([l.property({type:Object})],Ft.prototype,"collection",2);Ds([l.property({type:Number})],Ft.prototype,"index",2);Ft=Ds([l.customElement("ap-collection-row")],Ft);var Po=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,zs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Io(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&&Po(e,s,a),a};let Et=class extends o.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?o.html`
5579
5609
  <div class="card" @click=${this._handleClick}>
5580
5610
  <div class="icon-wrapper">
5581
5611
  <ap-icon name="folder" .size=${22}></ap-icon>
@@ -5587,7 +5617,7 @@
5587
5617
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5588
5618
  </div>
5589
5619
  </div>
5590
- `:r.html``}};yt.styles=[W,r.css`
5620
+ `:o.html``}};Et.styles=[H,o.css`
5591
5621
  @keyframes ap-card-in {
5592
5622
  from { opacity: 0; transform: translateY(8px); }
5593
5623
  to { opacity: 1; transform: translateY(0); }
@@ -5645,7 +5675,7 @@
5645
5675
  opacity: 0.5;
5646
5676
  transition: opacity 150ms;
5647
5677
  }
5648
- `];As([l.property({type:Object})],yt.prototype,"folder",2);As([l.property({type:Number})],yt.prototype,"index",2);yt=As([l.customElement("ap-collection-folder-card")],yt);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Ts=(t,e,s,i)=>{for(var a=i>1?void 0:i?Or(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lr(e,s,a),a};let xt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5678
+ `];zs([l.property({type:Object})],Et.prototype,"folder",2);zs([l.property({type:Number})],Et.prototype,"index",2);Et=zs([l.customElement("ap-collection-folder-card")],Et);var Do=Object.defineProperty,zo=Object.getOwnPropertyDescriptor,Rs=(t,e,s,i)=>{for(var a=i>1?void 0:i?zo(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&&Do(e,s,a),a};let At=class extends o.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?o.html`
5649
5679
  <div class="row" @click=${this._handleClick}>
5650
5680
  <div class="icon-wrapper">
5651
5681
  <ap-icon name="folder" .size=${16}></ap-icon>
@@ -5655,7 +5685,7 @@
5655
5685
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5656
5686
  </div>
5657
5687
  </div>
5658
- `:r.html``}};xt.styles=r.css`
5688
+ `:o.html``}};At.styles=o.css`
5659
5689
  :host {
5660
5690
  display: block;
5661
5691
  }
@@ -5700,9 +5730,9 @@
5700
5730
  opacity: 0.5;
5701
5731
  transition: opacity 150ms;
5702
5732
  }
5703
- `;Ts([l.property({type:Object})],xt.prototype,"folder",2);Ts([l.property({type:Number})],xt.prototype,"index",2);xt=Ts([l.customElement("ap-collection-folder-row")],xt);var Mr=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,Et=(t,e,s,i)=>{for(var a=i>1?void 0:i?Pr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};let Ke=class extends r.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 r.html`
5733
+ `;Rs([l.property({type:Object})],At.prototype,"folder",2);Rs([l.property({type:Number})],At.prototype,"index",2);At=Rs([l.customElement("ap-collection-folder-row")],At);var Ro=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?jo(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&&Ro(e,s,a),a};let We=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`
5704
5734
  <div class="grid-skeleton" ${F({"--ap-grid-min-col":String(n)})}>
5705
- ${Array.from({length:18},()=>r.html`<div class="card-skel">
5735
+ ${Array.from({length:18},()=>o.html`<div class="card-skel">
5706
5736
  <div class="skeleton card-skel-thumb"></div>
5707
5737
  <div class="card-skel-info">
5708
5738
  <div class="skeleton card-skel-name"></div>
@@ -5710,9 +5740,9 @@
5710
5740
  </div>
5711
5741
  </div>`)}
5712
5742
  </div>
5713
- `}const t=[];this.multiSelect&&t.push("32px"),t.push("48px","minmax(120px, 1fr)","72px","100px","120px","36px");const e=t.join(" "),s=r.html`
5743
+ `}const t=[];this.multiSelect&&t.push("32px"),t.push("48px","minmax(120px, 1fr)","72px","100px","120px","36px");const e=t.join(" "),s=o.html`
5714
5744
  <div class="row-skel" ${F({"grid-template-columns":e})}>
5715
- ${this.multiSelect?r.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5745
+ ${this.multiSelect?o.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5716
5746
  <div class="row-skel-folder-thumb">
5717
5747
  <svg viewBox="0 0 100 100" preserveAspectRatio="none">
5718
5748
  <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z" />
@@ -5724,9 +5754,9 @@
5724
5754
  <div class="skeleton row-skel-date"></div>
5725
5755
  <div></div>
5726
5756
  </div>
5727
- `,i=n=>r.html`
5757
+ `,i=n=>o.html`
5728
5758
  <div class="row-skel" ${F({"grid-template-columns":e})}>
5729
- ${this.multiSelect?r.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5759
+ ${this.multiSelect?o.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5730
5760
  <div class="skeleton row-skel-thumb"></div>
5731
5761
  <div class="skeleton row-skel-name" ${F({width:n})}></div>
5732
5762
  <div class="skeleton row-skel-type"></div>
@@ -5734,9 +5764,9 @@
5734
5764
  <div class="skeleton row-skel-date"></div>
5735
5765
  <div></div>
5736
5766
  </div>
5737
- `,a=["70%","55%","80%","45%","65%","50%","75%","60%","85%","40%","72%","58%"],o=12-this.folderCount;return r.html`
5767
+ `,a=["70%","55%","80%","45%","65%","50%","75%","60%","85%","40%","72%","58%"],r=12-this.folderCount;return o.html`
5738
5768
  <div class="list-header" ${F({"grid-template-columns":e})}>
5739
- ${this.multiSelect?r.html`<div class="header-check-wrap"><div class="header-check-box"></div></div>`:""}
5769
+ ${this.multiSelect?o.html`<div class="header-check-wrap"><div class="header-check-box"></div></div>`:""}
5740
5770
  <span></span>
5741
5771
  <span>Name</span>
5742
5772
  <span>Type</span>
@@ -5745,8 +5775,8 @@
5745
5775
  <span></span>
5746
5776
  </div>
5747
5777
  ${Array.from({length:this.folderCount},()=>s)}
5748
- ${Array.from({length:o},(n,c)=>i(a[c%a.length]))}
5749
- `}};Ke.styles=r.css`
5778
+ ${Array.from({length:r},(n,c)=>i(a[c%a.length]))}
5779
+ `}};We.styles=o.css`
5750
5780
  :host {
5751
5781
  display: block;
5752
5782
  padding: 0 20px 16px;
@@ -5874,7 +5904,7 @@
5874
5904
  @media (prefers-reduced-motion: reduce) {
5875
5905
  .skeleton { animation: none; }
5876
5906
  }
5877
- `;Et([l.property({reflect:!0})],Ke.prototype,"variant",2);Et([l.property({type:String})],Ke.prototype,"gridSize",2);Et([l.property({type:Boolean})],Ke.prototype,"multiSelect",2);Et([l.property({type:Number})],Ke.prototype,"folderCount",2);Ke=Et([l.customElement("ap-skeleton")],Ke);var Ir=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,B=(t,e,s,i)=>{for(var a=i>1?void 0:i?Dr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ir(e,s,a),a};let R=class extends r.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=st(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Ht(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:o}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!o.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new o;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(o.Events.ERROR,(c,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,o,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=(o=this.previewArea)==null?void 0:o.requestFullscreen)==null||n.call(o)}_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=st(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 Rt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=qe(e,this.containerToken);return we(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,o=Math.min(i/e,a/s,1);return{width:`${Math.round(e*o)}px`,height:`${Math.round(s*o)}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:b.TAGS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.LABELS,values:[t],operator:C.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 r.nothing;const s=this._openSections.has("file-info");return r.html`
5907
+ `;Dt([l.property({reflect:!0})],We.prototype,"variant",2);Dt([l.property({type:String})],We.prototype,"gridSize",2);Dt([l.property({type:Boolean})],We.prototype,"multiSelect",2);Dt([l.property({type:Number})],We.prototype,"folderCount",2);We=Dt([l.customElement("ap-skeleton")],We);var No=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,B=(t,e,s,i)=>{for(var a=i>1?void 0:i?Uo(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&&No(e,s,a),a};let R=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=rt(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Jt(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,(c,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=rt(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 Gt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Ge(e,this.containerToken);return ke(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.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:_.TAGS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:_.LABELS,values:[t],operator:C.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`
5878
5908
  <div class="accordion">
5879
5909
  <button
5880
5910
  class="accordion-trigger"
@@ -5887,7 +5917,7 @@
5887
5917
  </svg>
5888
5918
  </button>
5889
5919
  <div class="accordion-content ${s?"open":""}">
5890
- ${e.map(i=>r.html`
5920
+ ${e.map(i=>o.html`
5891
5921
  <div class="meta-row">
5892
5922
  <span class="meta-label" title=${i.label}>${i.label}</span>
5893
5923
  <span class="meta-value" title=${i.value}>${i.value}</span>
@@ -5897,7 +5927,7 @@
5897
5927
  ${this._renderLabelsRow(t)}
5898
5928
  </div>
5899
5929
  </div>
5900
- `}_renderAccordion(t,e,s){if(s.length===0)return r.nothing;const i=this._openSections.has(t);return r.html`
5930
+ `}_renderAccordion(t,e,s){if(s.length===0)return o.nothing;const i=this._openSections.has(t);return o.html`
5901
5931
  <div class="accordion">
5902
5932
  <button
5903
5933
  class="accordion-trigger"
@@ -5910,7 +5940,7 @@
5910
5940
  </svg>
5911
5941
  </button>
5912
5942
  <div class="accordion-content ${i?"open":""}">
5913
- ${s.map(a=>r.html`
5943
+ ${s.map(a=>o.html`
5914
5944
  <div class="meta-row">
5915
5945
  <span class="meta-label" title=${a.label}>${a.label}</span>
5916
5946
  <span class="meta-value" title=${a.value}>${a.value}</span>
@@ -5918,11 +5948,11 @@
5918
5948
  `)}
5919
5949
  </div>
5920
5950
  </div>
5921
- `}_getFileInfoRows(t){var s,i,a,o,n,c;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:ks(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:wi(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}`}),(((o=t.info)==null?void 0:o.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`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:Nt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:Nt(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 o,n,c,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const g=h[u.key]??((n=(o=t.info)==null?void 0:o.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(g,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const f=p.length>50;e.push({label:u.label,value:p,wrap:f})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,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 g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,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?r.nothing:r.html`
5951
+ `}_getFileInfoRows(t){var s,i,a,r,n,c;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:Os(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:ki(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`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:Qt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:Qt(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,c,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])??((c=t.meta)==null?void 0:c[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`
5922
5952
  <div class="meta-row meta-row--col">
5923
5953
  <span class="meta-label">Labels</span>
5924
5954
  <div class="tags-list">
5925
- ${e.map(s=>r.html`
5955
+ ${e.map(s=>o.html`
5926
5956
  <ap-badge class="tag-link" ${F({"--ap-muted":`${s.color}22`,"--ap-muted-foreground":s.color})} @click=${()=>this._applyLabelFilter(s.sid||s.uuid)}>
5927
5957
  <span class="label-content">
5928
5958
  <ap-icon name="tag" .size=${12} ${F({color:s.color})}></ap-icon>
@@ -5932,21 +5962,21 @@
5932
5962
  `)}
5933
5963
  </div>
5934
5964
  </div>
5935
- `}_renderTagsRow(t){const e=this._getTagEntries(t.tags);return e.length===0?r.nothing:r.html`
5965
+ `}_renderTagsRow(t){const e=this._getTagEntries(t.tags);return e.length===0?o.nothing:o.html`
5936
5966
  <div class="meta-row">
5937
5967
  <span class="meta-label">Tags</span>
5938
5968
  <div class="tags-list">
5939
- ${e.map(s=>r.html`
5969
+ ${e.map(s=>o.html`
5940
5970
  <ap-badge class="tag-link" @click=${()=>this._applyTagFilter(s.sid)}>${s.label}</ap-badge>
5941
5971
  `)}
5942
5972
  </div>
5943
5973
  </div>
5944
- `}render(){var k,S,E,A,ve,ae,P,Z;const t=this.asset;if(!t)return r.nothing;const e=st(t.type),s=e==="image",i=e==="video",a=e==="audio",o=((k=t.extension)==null?void 0:k.toLowerCase())==="pdf",n=kt(t.extension||""),c=vs(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=Rt(t),u=s?d?((E=t.url)==null?void 0:E.cdn)||"":h||qe(((A=t.url)==null?void 0:A.cdn)||"",this.containerToken):"",g=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,f=i&&((ve=t.url)==null?void 0:ve.cdn)||"",m=i&&(((ae=t.info)==null?void 0:ae.video_thumbnail)||((P=t.info)==null?void 0:P.preview))||"",x=o&&!s?ms(t):"",_=this._getCurrentIndex(),w=_>0&&this._findNavTarget(_,-1)>=0,y=_>=0&&this._findNavTarget(_,1)>=0,L=this.assets.length>1;return r.html`
5974
+ `}render(){var k,S,E,A,me,ae,P,Z;const t=this.asset;if(!t)return o.nothing;const e=rt(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((k=t.extension)==null?void 0:k.toLowerCase())==="pdf",n=Ot(t.extension||""),c=ks(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=Gt(t),u=s?d?((E=t.url)==null?void 0:E.cdn)||"":h||Ge(((A=t.url)==null?void 0:A.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((me=t.url)==null?void 0:me.cdn)||"",m=i&&(((ae=t.info)==null?void 0:ae.video_thumbnail)||((P=t.info)==null?void 0:P.preview))||"",x=r&&!s?Ss(t):"",b=this._getCurrentIndex(),w=b>0&&this._findNavTarget(b,-1)>=0,y=b>=0&&this._findNavTarget(b,1)>=0,L=this.assets.length>1;return o.html`
5945
5975
  <div class="panel">
5946
5976
  <div class="panel-header">
5947
5977
  <span class="panel-title" title=${t.name}>${t.name}</span>
5948
5978
  <div class="header-actions">
5949
- <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!i&&!a&&!o} aria-label="Fullscreen" title="Full screen">
5979
+ <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!i&&!a&&!r} aria-label="Fullscreen" title="Full screen">
5950
5980
  <ap-icon name="fullscreen" .size=${16}></ap-icon>
5951
5981
  </button>
5952
5982
  <button class="icon-btn ${this.asset&&this.selectedIds.includes(this.asset.uuid)?"selected":""}" @click=${this._select} aria-label="Select" title="Select the asset">
@@ -5960,21 +5990,21 @@
5960
5990
  </div>
5961
5991
 
5962
5992
  <div class="preview-area ${s&&c?"chess":""}">
5963
- ${L?r.html`
5993
+ ${L?o.html`
5964
5994
  <button class="nav-btn prev" @click=${this._prev} ?disabled=${!w} aria-label="Previous">
5965
5995
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
5966
5996
  </button>
5967
5997
  <button class="nav-btn next" @click=${this._next} ?disabled=${!y} aria-label="Next">
5968
5998
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5969
5999
  </button>
5970
- `:r.nothing}
5971
- ${this._isFullscreen?r.html`
6000
+ `:o.nothing}
6001
+ ${this._isFullscreen?o.html`
5972
6002
  <button class="fs-close-btn" @click=${this._exitFullscreen} aria-label="Exit fullscreen">
5973
6003
  <ap-icon name="close" .size=${16}></ap-icon>
5974
6004
  </button>
5975
- `:r.nothing}
5976
- ${this._previewLoading?r.html`<div class="preview-loading"><div class="spinner"></div></div>`:r.nothing}
5977
- ${s?r.html`
6005
+ `:o.nothing}
6006
+ ${this._previewLoading?o.html`<div class="preview-loading"><div class="spinner"></div></div>`:o.nothing}
6007
+ ${s?o.html`
5978
6008
  <img
5979
6009
  src=${u}
5980
6010
  alt=${t.name}
@@ -5982,7 +6012,7 @@
5982
6012
  @error=${J=>{const z=J.target;this._previewLoading=!1,z.src!==n&&(z.src=n,z.classList.add("icon-fallback"))}}
5983
6013
  />
5984
6014
  <div class="fs-wrapper">
5985
- ${d?r.nothing:r.html`
6015
+ ${d?o.nothing:o.html`
5986
6016
  <img
5987
6017
  class="fs-blur ${this._fsImageLoaded?"hidden":""}"
5988
6018
  src=${u}
@@ -5992,32 +6022,32 @@
5992
6022
  `}
5993
6023
  <img
5994
6024
  class="fs-full ${d||this._fsImageLoaded?"loaded":""}"
5995
- src=${this._isFullscreen?g:""}
6025
+ src=${this._isFullscreen?f:""}
5996
6026
  alt=${t.name}
5997
6027
  ${F(d?{width:"100vw",height:"100vh"}:null)}
5998
6028
  @load=${this._onFsImageLoad}
5999
6029
  />
6000
6030
  </div>
6001
- `:r.nothing}
6002
- ${i?r.html`<video src=${f} poster=${m||r.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:r.nothing}
6003
- ${a?r.html`<audio src=${((Z=t.url)==null?void 0:Z.cdn)||""} controls></audio>`:r.nothing}
6004
- ${o&&!s?r.html`
6031
+ `:o.nothing}
6032
+ ${i?o.html`<video src=${g} poster=${m||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
6033
+ ${a?o.html`<audio src=${((Z=t.url)==null?void 0:Z.cdn)||""} controls></audio>`:o.nothing}
6034
+ ${r&&!s?o.html`
6005
6035
  <img
6006
6036
  src=${x||n}
6007
6037
  alt=${t.name}
6008
6038
  class=${x?"":"icon-fallback"}
6009
6039
  @error=${J=>{const z=J.target;z.src!==n&&(z.src=n,z.classList.add("icon-fallback"))}}
6010
6040
  />
6011
- `:r.nothing}
6012
- ${!s&&!i&&!a&&!o?r.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:r.nothing}
6041
+ `:o.nothing}
6042
+ ${!s&&!i&&!a&&!r?o.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:o.nothing}
6013
6043
  </div>
6014
6044
 
6015
6045
  ${this._renderFileInfoSection(t)}
6016
- ${this.showMetadata?r.html`
6046
+ ${this.showMetadata?o.html`
6017
6047
  ${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
6018
- `:r.nothing}
6048
+ `:o.nothing}
6019
6049
  </div>
6020
- `}};R.styles=r.css`
6050
+ `}};R.styles=o.css`
6021
6051
  :host {
6022
6052
  display: block;
6023
6053
  }
@@ -6337,7 +6367,7 @@
6337
6367
  .panel { animation: none; }
6338
6368
  .accordion-chevron { transition: none; }
6339
6369
  }
6340
- `;B([l.property({type:Object})],R.prototype,"asset",2);B([l.property({type:Array})],R.prototype,"assets",2);B([l.property({type:Array})],R.prototype,"selectedIds",2);B([l.property()],R.prototype,"containerToken",2);B([l.property({type:Boolean})],R.prototype,"showMetadata",2);B([l.property({type:Array})],R.prototype,"metadataFields",2);B([l.property({type:Array})],R.prototype,"labels",2);B([l.property({type:Object})],R.prototype,"regionalFilters",2);B([l.property({type:Boolean})],R.prototype,"multiSelect",2);B([l.query(".preview-area")],R.prototype,"previewArea",2);B([l.query("video")],R.prototype,"_videoEl",2);B([l.state()],R.prototype,"_isFullscreen",2);B([l.state()],R.prototype,"_fsImageLoaded",2);B([l.state()],R.prototype,"_previewLoading",2);B([l.state()],R.prototype,"_openSections",2);R=B([l.customElement("ap-preview-panel")],R);var zr=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Ls=(t,e,s,i)=>{for(var a=i>1?void 0:i?Rr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&zr(e,s,a),a};const jr={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 wt=class extends r.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=jr[this.name];if(!t)return r.nothing;const e=typeof t=="string"?r.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?r.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?r.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:r.svg`<path d=${a.d}></path>`});return r.html`
6370
+ `;B([l.property({type:Object})],R.prototype,"asset",2);B([l.property({type:Array})],R.prototype,"assets",2);B([l.property({type:Array})],R.prototype,"selectedIds",2);B([l.property()],R.prototype,"containerToken",2);B([l.property({type:Boolean})],R.prototype,"showMetadata",2);B([l.property({type:Array})],R.prototype,"metadataFields",2);B([l.property({type:Array})],R.prototype,"labels",2);B([l.property({type:Object})],R.prototype,"regionalFilters",2);B([l.property({type:Boolean})],R.prototype,"multiSelect",2);B([l.query(".preview-area")],R.prototype,"previewArea",2);B([l.query("video")],R.prototype,"_videoEl",2);B([l.state()],R.prototype,"_isFullscreen",2);B([l.state()],R.prototype,"_fsImageLoaded",2);B([l.state()],R.prototype,"_previewLoading",2);B([l.state()],R.prototype,"_openSections",2);R=B([l.customElement("ap-preview-panel")],R);var Bo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,js=(t,e,s,i)=>{for(var a=i>1?void 0:i?qo(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&&Bo(e,s,a),a};const Vo={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","folder-plus":[{tag:"path",attrs:{d:"M12 10v6"}},{tag:"path",attrs:{d:"M9 13h6"}},{tag:"path",attrs:{d:"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"}}],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 Tt=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=Vo[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`
6341
6371
  <svg
6342
6372
  ${F({"--icon-size":`${this.size}px`})}
6343
6373
  viewBox="0 0 24 24"
@@ -6349,7 +6379,7 @@
6349
6379
  >
6350
6380
  ${e}
6351
6381
  </svg>
6352
- `}};wt.styles=[r.css`
6382
+ `}};Tt.styles=[o.css`
6353
6383
  :host {
6354
6384
  display: inline-flex;
6355
6385
  align-items: center;
@@ -6359,27 +6389,27 @@
6359
6389
  width: var(--icon-size, 20px);
6360
6390
  height: var(--icon-size, 20px);
6361
6391
  }
6362
- `];Ls([l.property()],wt.prototype,"name",2);Ls([l.property({type:Number})],wt.prototype,"size",2);wt=Ls([l.customElement("ap-icon")],wt);var Nr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ur(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Nr(e,s,a),a};let ge=class extends r.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0,this.showTransform=!1}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}))}_transform(){this.dispatchEvent(new CustomEvent("selection-transform",{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?r.nothing:r.html`
6392
+ `];js([l.property()],Tt.prototype,"name",2);js([l.property({type:Number})],Tt.prototype,"size",2);Tt=js([l.customElement("ap-icon")],Tt);var Ho=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,Te=(t,e,s,i)=>{for(var a=i>1?void 0:i?Go(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&&Ho(e,s,a),a};let fe=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0,this.showTransform=!1}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}))}_transform(){this.dispatchEvent(new CustomEvent("selection-transform",{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`
6363
6393
  <div class="bar">
6364
6394
  <span class="count">${this._formatCount()}</span>
6365
- ${this.multiSelect?r.html`
6395
+ ${this.multiSelect?o.html`
6366
6396
  <span class="divider"></span>
6367
6397
  <span class="select-label">Select:</span>
6368
- ${this._canSelectMore()?r.html`<button
6398
+ ${this._canSelectMore()?o.html`<button
6369
6399
  class="bar-btn"
6370
6400
  ?disabled=${this.isSelectingAll}
6371
6401
  @click=${this._selectAll}
6372
- ><ap-icon name="check-check" .size=${14}></ap-icon>${this.isSelectingAll?"Selecting...":this.maxSelections&&this.maxSelections<this._scopeTotal?`First ${this.maxSelections}`:this._selectScope==="assets"?"Select all assets":this._selectScope==="folders"?"Select all folders":"Select all"}</button>`:r.nothing}
6402
+ ><ap-icon name="check-check" .size=${14}></ap-icon>${this.isSelectingAll?"Selecting...":this.maxSelections&&this.maxSelections<this._scopeTotal?`First ${this.maxSelections}`:this._selectScope==="assets"?"Select all assets":this._selectScope==="folders"?"Select all folders":"Select all"}</button>`:o.nothing}
6373
6403
  <button class="bar-btn" @click=${this._clear}><ap-icon name="close" .size=${14}></ap-icon>Deselect all</button>
6374
- ${this.maxSelections&&this._totalSelected>=this.maxSelections?r.html`<span class="limit-notice">Max ${this.maxSelections} allowed</span>`:r.nothing}
6375
- `:r.nothing}
6404
+ ${this.maxSelections&&this._totalSelected>=this.maxSelections?o.html`<span class="limit-notice">Max ${this.maxSelections} allowed</span>`:o.nothing}
6405
+ `:o.nothing}
6376
6406
  <div class="spacer"></div>
6377
- ${this.showTransform?r.html`
6407
+ ${this.showTransform?o.html`
6378
6408
  <button class="btn-confirm btn-transform" @click=${this._transform}>Transform</button>
6379
- `:r.nothing}
6409
+ `:o.nothing}
6380
6410
  <button class="btn-confirm" @click=${this._confirm}>Confirm</button>
6381
6411
  </div>
6382
- `}};ge.styles=r.css`
6412
+ `}};fe.styles=o.css`
6383
6413
  :host {
6384
6414
  display: block;
6385
6415
  padding: 0 8px 8px;
@@ -6470,12 +6500,12 @@
6470
6500
  @media (prefers-reduced-motion: reduce) {
6471
6501
  .bar { animation: none; }
6472
6502
  }
6473
- `;Ee([l.property({type:Array})],ge.prototype,"selectedAssets",2);Ee([l.property({type:Array})],ge.prototype,"selectedFolders",2);Ee([l.property({type:Number})],ge.prototype,"totalCount",2);Ee([l.property({type:Number})],ge.prototype,"totalFolderCount",2);Ee([l.property({type:Boolean})],ge.prototype,"isSelectingAll",2);Ee([l.property({type:Boolean})],ge.prototype,"multiSelect",2);Ee([l.property({type:Number})],ge.prototype,"maxSelections",2);Ee([l.property({type:Boolean})],ge.prototype,"showTransform",2);ge=Ee([l.customElement("ap-selection-bar")],ge);var Br=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Os=(t,e,s,i)=>{for(var a=i>1?void 0:i?qr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Br(e,s,a),a};let $t=class extends r.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?r.nothing:r.html`
6503
+ `;Te([l.property({type:Array})],fe.prototype,"selectedAssets",2);Te([l.property({type:Array})],fe.prototype,"selectedFolders",2);Te([l.property({type:Number})],fe.prototype,"totalCount",2);Te([l.property({type:Number})],fe.prototype,"totalFolderCount",2);Te([l.property({type:Boolean})],fe.prototype,"isSelectingAll",2);Te([l.property({type:Boolean})],fe.prototype,"multiSelect",2);Te([l.property({type:Number})],fe.prototype,"maxSelections",2);Te([l.property({type:Boolean})],fe.prototype,"showTransform",2);fe=Te([l.customElement("ap-selection-bar")],fe);var Ko=Object.defineProperty,Qo=Object.getOwnPropertyDescriptor,Ns=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qo(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&&Ko(e,s,a),a};let Lt=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`
6474
6504
  <div
6475
6505
  class="marquee"
6476
6506
  ${F({left:`${this.rect.x}px`,top:`${this.rect.y}px`,width:`${this.rect.width}px`,height:`${this.rect.height}px`})}
6477
6507
  ></div>
6478
- `}};$t.styles=r.css`
6508
+ `}};Lt.styles=o.css`
6479
6509
  :host {
6480
6510
  display: block;
6481
6511
  position: absolute;
@@ -6492,21 +6522,21 @@
6492
6522
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
6493
6523
  border-radius: 2px;
6494
6524
  }
6495
- `;Os([l.property({type:Boolean})],$t.prototype,"active",2);Os([l.property({type:Object})],$t.prototype,"rect",2);$t=Os([l.customElement("ap-marquee-overlay")],$t);var Vr=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,Xe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vr(e,s,a),a};let Ce=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.clearable=!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 r.html`
6496
- ${this.options.map(t=>r.html`
6525
+ `;Ns([l.property({type:Boolean})],Lt.prototype,"active",2);Ns([l.property({type:Object})],Lt.prototype,"rect",2);Lt=Ns([l.customElement("ap-marquee-overlay")],Lt);var Yo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,et=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wo(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&&Yo(e,s,a),a};let Ee=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.clearable=!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`
6526
+ ${this.options.map(t=>o.html`
6497
6527
  <div
6498
6528
  class="option"
6499
6529
  role="radio"
6500
6530
  aria-checked=${t.value===this.value}
6501
- aria-disabled=${this.disabled||t.disabled?"true":r.nothing}
6531
+ aria-disabled=${this.disabled||t.disabled?"true":o.nothing}
6502
6532
  @click=${()=>this._select(t)}
6503
6533
  >
6504
6534
  <div class="radio"><div class="dot"></div></div>
6505
- ${t.icon?r.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:r.nothing}
6535
+ ${t.icon?o.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:o.nothing}
6506
6536
  <span class="label">${t.label}</span>
6507
6537
  </div>
6508
6538
  `)}
6509
- `}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};Ce.styles=[W,r.css`
6539
+ `}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};Ee.styles=[H,o.css`
6510
6540
  :host {
6511
6541
  display: flex;
6512
6542
  flex-direction: column;
@@ -6567,7 +6597,7 @@
6567
6597
  font-family: inherit;
6568
6598
  user-select: none;
6569
6599
  }
6570
- `];Xe([l.property()],Ce.prototype,"value",2);Xe([l.property({type:Array})],Ce.prototype,"options",2);Xe([l.property({type:Boolean})],Ce.prototype,"disabled",2);Xe([l.property({type:Boolean})],Ce.prototype,"clearable",2);Xe([l.property({reflect:!0})],Ce.prototype,"direction",2);Xe([l.property({reflect:!0})],Ce.prototype,"columns",2);Ce=Xe([l.customElement("ap-radio-group")],Ce);var Gr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,$i=(t,e,s,i)=>{for(var a=i>1?void 0:i?Kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gr(e,s,a),a};let Ut=class extends r.LitElement{constructor(){super(...arguments),this.size=24}render(){return r.html`<div class="spinner" ${F({width:`${this.size}px`,height:`${this.size}px`})}></div>`}};Ut.styles=[r.css`
6600
+ `];et([l.property()],Ee.prototype,"value",2);et([l.property({type:Array})],Ee.prototype,"options",2);et([l.property({type:Boolean})],Ee.prototype,"disabled",2);et([l.property({type:Boolean})],Ee.prototype,"clearable",2);et([l.property({reflect:!0})],Ee.prototype,"direction",2);et([l.property({reflect:!0})],Ee.prototype,"columns",2);Ee=et([l.customElement("ap-radio-group")],Ee);var Xo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,Si=(t,e,s,i)=>{for(var a=i>1?void 0:i?Zo(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&&Xo(e,s,a),a};let Yt=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" ${F({width:`${this.size}px`,height:`${this.size}px`})}></div>`}};Yt.styles=[o.css`
6571
6601
  :host {
6572
6602
  display: inline-flex;
6573
6603
  }
@@ -6580,7 +6610,7 @@
6580
6610
  @keyframes spin {
6581
6611
  to { transform: rotate(360deg); }
6582
6612
  }
6583
- `];$i([l.property({type:Number})],Ut.prototype,"size",2);Ut=$i([l.customElement("ap-spinner")],Ut);var Qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qr(e,s,a),a};let rt=class extends r.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 r.html`
6613
+ `];Si([l.property({type:Number})],Yt.prototype,"size",2);Yt=Si([l.customElement("ap-spinner")],Yt);var Jo=Object.defineProperty,en=Object.getOwnPropertyDescriptor,as=(t,e,s,i)=>{for(var a=i>1?void 0:i?en(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&&Jo(e,s,a),a};let ct=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`
6584
6614
  <div class="backdrop" @click=${e=>{e.target===e.currentTarget&&this._handleCancel()}}>
6585
6615
  <div class="dialog">
6586
6616
  <div class="title">Add folder contents</div>
@@ -6597,12 +6627,12 @@
6597
6627
  <div class="actions">
6598
6628
  <button class="btn" @click=${this._handleCancel} ?disabled=${this.loading}>Cancel</button>
6599
6629
  <button class="btn btn-primary" @click=${this._handleConfirm} ?disabled=${this.loading}>
6600
- ${this.loading?r.html`<span class="loading-content"><ap-spinner .size=${14}></ap-spinner> Loading...</span>`:"Add assets"}
6630
+ ${this.loading?o.html`<span class="loading-content"><ap-spinner .size=${14}></ap-spinner> Loading...</span>`:"Add assets"}
6601
6631
  </button>
6602
6632
  </div>
6603
6633
  </div>
6604
6634
  </div>
6605
- `}};rt.styles=[W,r.css`
6635
+ `}};ct.styles=[H,o.css`
6606
6636
  :host {
6607
6637
  display: block;
6608
6638
  }
@@ -6675,7 +6705,7 @@
6675
6705
  align-items: center;
6676
6706
  gap: 8px;
6677
6707
  }
6678
- `];Wt([l.property({type:Array})],rt.prototype,"folders",2);Wt([l.property({type:Boolean})],rt.prototype,"loading",2);Wt([l.state()],rt.prototype,"_mode",2);rt=Wt([l.customElement("ap-folder-resolve-dialog")],rt);var Wr=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,H=(t,e,s,i)=>{for(var a=i>1?void 0:i?Xr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Wr(e,s,a),a};let j=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.clearable=!1,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._menuWidth=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 r.html`
6708
+ `];as([l.property({type:Array})],ct.prototype,"folders",2);as([l.property({type:Boolean})],ct.prototype,"loading",2);as([l.state()],ct.prototype,"_mode",2);ct=as([l.customElement("ap-folder-resolve-dialog")],ct);var tn=Object.defineProperty,sn=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?sn(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&&tn(e,s,a),a};let j=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.clearable=!1,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._menuWidth=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`
6679
6709
  <button
6680
6710
  class="trigger"
6681
6711
  role="combobox"
@@ -6685,11 +6715,11 @@
6685
6715
  @click=${this._toggle}
6686
6716
  @keydown=${this._handleTriggerKeydown}
6687
6717
  >
6688
- ${t!=null&&t.icon?r.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:r.nothing}
6689
- ${this.label?r.html`<span class="label">${this.label}${t?": ":""}</span>`:r.nothing}${t?t.label:""}
6690
- ${this.clearable&&t?r.html`<span class="clear-trigger" @click=${this._clear}><ap-icon name="close" .size=${12}></ap-icon></span>`:r.html`<ap-icon name="chevron-down" .size=${14}></ap-icon>`}
6718
+ ${t!=null&&t.icon?o.html`<ap-icon name=${t.icon} .size=${16}></ap-icon>`:o.nothing}
6719
+ ${this.label?o.html`<span class="label">${this.label}${t?": ":""}</span>`:o.nothing}${t?t.label:""}
6720
+ ${this.clearable&&t?o.html`<span class="clear-trigger" @click=${this._clear}><ap-icon name="close" .size=${12}></ap-icon></span>`:o.html`<ap-icon name="chevron-down" .size=${14}></ap-icon>`}
6691
6721
  </button>
6692
- ${this._open?r.html`
6722
+ ${this._open?o.html`
6693
6723
  <div
6694
6724
  id=${e}
6695
6725
  class="menu ${this._menuPosition} ${this._menuAlign}"
@@ -6697,7 +6727,7 @@
6697
6727
  role="listbox"
6698
6728
  @keydown=${this._handleMenuKeydown}
6699
6729
  >
6700
- ${this.options.map((s,i)=>r.html`
6730
+ ${this.options.map((s,i)=>o.html`
6701
6731
  <button
6702
6732
  class="option ${i===this._focusedIndex?"focused":""}"
6703
6733
  role="option"
@@ -6706,15 +6736,15 @@
6706
6736
  @mouseenter=${()=>{this._focusedIndex=i}}
6707
6737
  >
6708
6738
  <span class="option-label">
6709
- ${s.icon?r.html`<ap-icon name=${s.icon} .size=${16}></ap-icon>`:r.nothing}
6739
+ ${s.icon?o.html`<ap-icon name=${s.icon} .size=${16}></ap-icon>`:o.nothing}
6710
6740
  ${s.label}
6711
6741
  </span>
6712
- ${s.value===this.value?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.nothing}
6742
+ ${s.value===this.value?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
6713
6743
  </button>
6714
6744
  `)}
6715
6745
  </div>
6716
- `:r.nothing}
6717
- `}_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)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_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();this._menuWidth=t.width;const 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)}};j.styles=[W,r.css`
6746
+ `:o.nothing}
6747
+ `}_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)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_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();this._menuWidth=t.width;const 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)}};j.styles=[H,o.css`
6718
6748
  :host {
6719
6749
  position: relative;
6720
6750
  display: inline-block;
@@ -6823,7 +6853,7 @@
6823
6853
  .option[aria-selected="true"] ap-icon {
6824
6854
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
6825
6855
  }
6826
- `];H([l.property()],j.prototype,"value",2);H([l.property()],j.prototype,"label",2);H([l.property({reflect:!0})],j.prototype,"variant",2);H([l.property({type:Boolean})],j.prototype,"clearable",2);H([l.property({type:Array})],j.prototype,"options",2);H([l.state()],j.prototype,"_open",2);H([l.state()],j.prototype,"_focusedIndex",2);H([l.state()],j.prototype,"_menuPosition",2);H([l.state()],j.prototype,"_menuAlign",2);H([l.state()],j.prototype,"_menuTop",2);H([l.state()],j.prototype,"_menuBottom",2);H([l.state()],j.prototype,"_menuLeft",2);H([l.state()],j.prototype,"_menuRight",2);H([l.state()],j.prototype,"_menuWidth",2);j=H([l.customElement("ap-dropdown")],j);var Zr=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Ae=(t,e,s,i)=>{for(var a=i>1?void 0:i?Jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zr(e,s,a),a};const en=["webp","jpeg","png","gif"];function tn(t){const e=(t??"").toLowerCase();return en.includes(e)?e:"jpeg"}let fe=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.isMultiSelect=!1,this._format="jpeg",this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this._defaultFormat="jpeg"}get _ratio(){const t=this.assets.find(i=>Ne(i));if(!t)return 1.5;const e=Dt(t),s=zt(t);return e&&s?e/s:1.5}get _isDirty(){return this._format!==this._defaultFormat||this._quality!=="excellent"||this._width!==this._defaultWidth||this._height!==this._defaultHeight}willUpdate(t){t.has("assets")&&this._initDefaults()}_initDefaults(){const t=this.assets.find(e=>Ne(e));if(this._defaultFormat=tn(t==null?void 0:t.extension),this._format=this._defaultFormat,this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this.isMultiSelect)this._defaultWidth=void 0,this._defaultHeight=void 0;else if(t){const e=Dt(t),s=zt(t);this._defaultWidth=e||void 0,this._defaultHeight=s||void 0}else this._defaultWidth=void 0,this._defaultHeight=void 0;this._width=this._defaultWidth,this._height=this._defaultHeight}_handleFormatChange(t){this._format=t.detail.value}_handleQualityChange(t){this._quality=t.detail.value}_handleWidthInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._activePreset="",this._lockAspect&&i&&(this._height=Math.round(i/this._ratio))}_handleHeightInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._height=i,this._activePreset="",this._lockAspect&&i&&(this._width=Math.round(i*this._ratio))}_handleMaxSizeInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._height=i,this._activePreset=""}_toggleLock(){this._lockAspect=!this._lockAspect}_handlePreset(t){this._activePreset=t.value,t.value==="original"?(this._width=this._defaultWidth,this._height=this._defaultHeight):t.width&&(this._width=t.width,this._height=Math.round(t.width/this._ratio))}_handleApply(){const t={format:this._format,quality:this._format!=="png"?this._quality:void 0,width:this._width,height:this._height};this.dispatchEvent(new CustomEvent("transform-confirm",{detail:{params:t,isAspectLocked:this._lockAspect},bubbles:!0,composed:!0}))}_handleSkip(){this.dispatchEvent(new CustomEvent("transform-skip",{bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("transform-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleClose()}render(){const t=this._format==="png";return r.html`
6856
+ `];G([l.property()],j.prototype,"value",2);G([l.property()],j.prototype,"label",2);G([l.property({reflect:!0})],j.prototype,"variant",2);G([l.property({type:Boolean})],j.prototype,"clearable",2);G([l.property({type:Array})],j.prototype,"options",2);G([l.state()],j.prototype,"_open",2);G([l.state()],j.prototype,"_focusedIndex",2);G([l.state()],j.prototype,"_menuPosition",2);G([l.state()],j.prototype,"_menuAlign",2);G([l.state()],j.prototype,"_menuTop",2);G([l.state()],j.prototype,"_menuBottom",2);G([l.state()],j.prototype,"_menuLeft",2);G([l.state()],j.prototype,"_menuRight",2);G([l.state()],j.prototype,"_menuWidth",2);j=G([l.customElement("ap-dropdown")],j);var an=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,Le=(t,e,s,i)=>{for(var a=i>1?void 0:i?rn(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&&an(e,s,a),a};const on=["webp","jpeg","png","gif"];function nn(t){const e=(t??"").toLowerCase();return on.includes(e)?e:"jpeg"}let ge=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.isMultiSelect=!1,this._format="jpeg",this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this._defaultFormat="jpeg"}get _ratio(){const t=this.assets.find(i=>qe(i));if(!t)return 1.5;const e=Vt(t),s=Ht(t);return e&&s?e/s:1.5}get _isDirty(){return this._format!==this._defaultFormat||this._quality!=="excellent"||this._width!==this._defaultWidth||this._height!==this._defaultHeight}willUpdate(t){t.has("assets")&&this._initDefaults()}_initDefaults(){const t=this.assets.find(e=>qe(e));if(this._defaultFormat=nn(t==null?void 0:t.extension),this._format=this._defaultFormat,this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this.isMultiSelect)this._defaultWidth=void 0,this._defaultHeight=void 0;else if(t){const e=Vt(t),s=Ht(t);this._defaultWidth=e||void 0,this._defaultHeight=s||void 0}else this._defaultWidth=void 0,this._defaultHeight=void 0;this._width=this._defaultWidth,this._height=this._defaultHeight}_handleFormatChange(t){this._format=t.detail.value}_handleQualityChange(t){this._quality=t.detail.value}_handleWidthInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._activePreset="",this._lockAspect&&i&&(this._height=Math.round(i/this._ratio))}_handleHeightInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._height=i,this._activePreset="",this._lockAspect&&i&&(this._width=Math.round(i*this._ratio))}_handleMaxSizeInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._height=i,this._activePreset=""}_toggleLock(){this._lockAspect=!this._lockAspect}_handlePreset(t){this._activePreset=t.value,t.value==="original"?(this._width=this._defaultWidth,this._height=this._defaultHeight):t.width&&(this._width=t.width,this._height=Math.round(t.width/this._ratio))}_handleApply(){const t={format:this._format,quality:this._format!=="png"?this._quality:void 0,width:this._width,height:this._height};this.dispatchEvent(new CustomEvent("transform-confirm",{detail:{params:t,isAspectLocked:this._lockAspect},bubbles:!0,composed:!0}))}_handleSkip(){this.dispatchEvent(new CustomEvent("transform-skip",{bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("transform-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleClose()}render(){const t=this._format==="png";return o.html`
6827
6857
  <div class="backdrop" @click=${this._handleBackdropClick}>
6828
6858
  <div class="dialog">
6829
6859
  <div class="header">
@@ -6838,17 +6868,17 @@
6838
6868
  <ap-radio-group
6839
6869
  direction="horizontal"
6840
6870
  .value=${this._format}
6841
- .options=${aa}
6871
+ .options=${ca}
6842
6872
  @ap-change=${this._handleFormatChange}
6843
6873
  ></ap-radio-group>
6844
6874
  </div>
6845
6875
 
6846
- ${t?r.nothing:r.html`
6876
+ ${t?o.nothing:o.html`
6847
6877
  <div class="section">
6848
6878
  <span class="section-label">Quality</span>
6849
6879
  <ap-dropdown
6850
6880
  .value=${this._quality}
6851
- .options=${oa}
6881
+ .options=${da}
6852
6882
  @ap-change=${this._handleQualityChange}
6853
6883
  ></ap-dropdown>
6854
6884
  </div>
@@ -6856,7 +6886,7 @@
6856
6886
 
6857
6887
  <div class="section">
6858
6888
  <span class="section-label">Size</span>
6859
- ${this.isMultiSelect?r.html`
6889
+ ${this.isMultiSelect?o.html`
6860
6890
  <div class="input-group half-width">
6861
6891
  <span class="input-label">Max Size</span>
6862
6892
  <div class="input-wrapper">
@@ -6870,7 +6900,7 @@
6870
6900
  <span class="input-suffix">px</span>
6871
6901
  </div>
6872
6902
  </div>
6873
- `:r.html`
6903
+ `:o.html`
6874
6904
  <div class="dimensions-row">
6875
6905
  <div class="input-group">
6876
6906
  <span class="input-label">Width</span>
@@ -6906,7 +6936,7 @@
6906
6936
  </div>
6907
6937
  `}
6908
6938
  <div class="presets-row">
6909
- ${ra.map(e=>r.html`
6939
+ ${pa.map(e=>o.html`
6910
6940
  <button
6911
6941
  class="preset-btn ${this._activePreset===e.value?"active":""}"
6912
6942
  @click=${()=>this._handlePreset(e)}
@@ -6921,7 +6951,7 @@
6921
6951
  </div>
6922
6952
  </div>
6923
6953
  </div>
6924
- `}};fe.styles=[W,r.css`
6954
+ `}};ge.styles=[H,o.css`
6925
6955
  :host {
6926
6956
  display: block;
6927
6957
  }
@@ -7125,7 +7155,7 @@
7125
7155
  display: block;
7126
7156
  width: 100%;
7127
7157
  }
7128
- `];Ae([l.property({type:Array})],fe.prototype,"assets",2);Ae([l.property({type:Boolean})],fe.prototype,"isMultiSelect",2);Ae([l.state()],fe.prototype,"_format",2);Ae([l.state()],fe.prototype,"_quality",2);Ae([l.state()],fe.prototype,"_width",2);Ae([l.state()],fe.prototype,"_height",2);Ae([l.state()],fe.prototype,"_lockAspect",2);Ae([l.state()],fe.prototype,"_activePreset",2);fe=Ae([l.customElement("ap-transformation-dialog")],fe);var sn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,Xt=(t,e,s,i)=>{for(var a=i>1?void 0:i?an(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sn(e,s,a),a};let nt=class extends r.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 r.html`
7158
+ `];Le([l.property({type:Array})],ge.prototype,"assets",2);Le([l.property({type:Boolean})],ge.prototype,"isMultiSelect",2);Le([l.state()],ge.prototype,"_format",2);Le([l.state()],ge.prototype,"_quality",2);Le([l.state()],ge.prototype,"_width",2);Le([l.state()],ge.prototype,"_height",2);Le([l.state()],ge.prototype,"_lockAspect",2);Le([l.state()],ge.prototype,"_activePreset",2);ge=Le([l.customElement("ap-transformation-dialog")],ge);var ln=Object.defineProperty,cn=Object.getOwnPropertyDescriptor,rs=(t,e,s,i)=>{for(var a=i>1?void 0:i?cn(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&&ln(e,s,a),a};let dt=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`
7129
7159
  <div class="box">
7130
7160
  <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">
7131
7161
  <path d="M20 6 9 17l-5-5"></path>
@@ -7135,7 +7165,7 @@
7135
7165
  </svg>
7136
7166
  </div>
7137
7167
  <span class="label" ?hidden=${!this._hasLabel}><slot @slotchange=${this._onSlotChange}></slot></span>
7138
- `}};nt.styles=[r.css`
7168
+ `}};dt.styles=[o.css`
7139
7169
  :host {
7140
7170
  display: inline-flex;
7141
7171
  align-items: center;
@@ -7194,12 +7224,12 @@
7194
7224
  .label[hidden] {
7195
7225
  display: none;
7196
7226
  }
7197
- `];Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"checked",2);Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"indeterminate",2);Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"disabled",2);nt=Xt([l.customElement("ap-checkbox")],nt);var on=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,ki=(t,e,s,i)=>{for(var a=i>1?void 0:i?rn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&on(e,s,a),a};let Bt=class extends r.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return r.html`
7227
+ `];rs([l.property({type:Boolean,reflect:!0})],dt.prototype,"checked",2);rs([l.property({type:Boolean,reflect:!0})],dt.prototype,"indeterminate",2);rs([l.property({type:Boolean,reflect:!0})],dt.prototype,"disabled",2);dt=rs([l.customElement("ap-checkbox")],dt);var dn=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,Ci=(t,e,s,i)=>{for(var a=i>1?void 0:i?pn(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&&dn(e,s,a),a};let Wt=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`
7198
7228
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
7199
7229
  <div class="content ${this.open?"open":""}">
7200
7230
  <slot></slot>
7201
7231
  </div>
7202
- `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};Bt.styles=[r.css`
7232
+ `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};Wt.styles=[o.css`
7203
7233
  :host {
7204
7234
  position: relative;
7205
7235
  display: inline-block;
@@ -7220,7 +7250,7 @@
7220
7250
  .content.open {
7221
7251
  display: block;
7222
7252
  }
7223
- `];ki([l.state()],Bt.prototype,"open",2);Bt=ki([l.customElement("ap-popover")],Bt);var nn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,Si=(t,e,s,i)=>{for(var a=i>1?void 0:i?ln(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nn(e,s,a),a};let qt=class extends r.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return r.html`<span class="badge"><slot></slot></span>`}};qt.styles=[r.css`
7253
+ `];Ci([l.state()],Wt.prototype,"open",2);Wt=Ci([l.customElement("ap-popover")],Wt);var hn=Object.defineProperty,un=Object.getOwnPropertyDescriptor,Fi=(t,e,s,i)=>{for(var a=i>1?void 0:i?un(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&&hn(e,s,a),a};let Xt=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};Xt.styles=[o.css`
7224
7254
  :host {
7225
7255
  display: inline-flex;
7226
7256
  }
@@ -7239,10 +7269,10 @@
7239
7269
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
7240
7270
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
7241
7271
  }
7242
- `];Si([l.property({reflect:!0})],qt.prototype,"variant",2);qt=Si([l.customElement("ap-badge")],qt);var cn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,Ci=(t,e,s,i)=>{for(var a=i>1?void 0:i?dn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cn(e,s,a),a};let Vt=class extends r.LitElement{constructor(){super(...arguments),this.text=""}render(){return r.html`
7272
+ `];Fi([l.property({reflect:!0})],Xt.prototype,"variant",2);Xt=Fi([l.customElement("ap-badge")],Xt);var fn=Object.defineProperty,gn=Object.getOwnPropertyDescriptor,Ei=(t,e,s,i)=>{for(var a=i>1?void 0:i?gn(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&&fn(e,s,a),a};let Zt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
7243
7273
  <slot></slot>
7244
7274
  <div class="tip">${this.text}</div>
7245
- `}};Vt.styles=[r.css`
7275
+ `}};Zt.styles=[o.css`
7246
7276
  :host {
7247
7277
  position: relative;
7248
7278
  display: inline-flex;
@@ -7265,16 +7295,163 @@
7265
7295
  :host(:hover) .tip {
7266
7296
  display: block;
7267
7297
  }
7268
- `];Ci([l.property()],Vt.prototype,"text",2);Vt=Ci([l.customElement("ap-tooltip")],Vt);var pn=Object.defineProperty,At=(t,e,s,i)=>{for(var a=void 0,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(e,s,a)||a);return a&&pn(e,s,a),a};const Ms=class Ms extends r.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._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!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=Ii(),this.storeCtrl=new Di(this,this.store),this.selectionCtrl=new Ri(this,this.store),this.infiniteScrollCtrl=new ji(this,()=>this._loadMore()),this.marqueeCtrl=new Ni(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=gs(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=Za(),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&&to(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Ui(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const x=await Yi(this.apiClient);this.apiClient.setSassKey(x),this.store.setState({sassKey:x})}const[o,n,c,d,h]=await Promise.allSettled([La(this.apiClient),Hi(this.apiClient),Qi(this.apiClient),Aa(this.apiClient),Gi(this.apiClient)]),u={};if(o.status==="fulfilled"){const{fields:x,regionalVariantGroups:_,regionalFilters:w,brandColor:y}=o.value;u.metadataFields=x,u.regionalVariantGroups=_,u.regionalFilters=w,y&&(u.brandColor=y)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:g,pinnedMetadata:p}=Ya(e.auth.projectToken??null),f=this.store.getState().filters;u.filters={...f,pinned:g,visible:[...g],metadata:{...f.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const m=e.brandColor||u.brandColor||this.store.getState().brandColor;m&&(u.brandColor||this.store.setState({brandColor:m}),no(this,m))}catch(o){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:o,context:"init"},bubbles:!0,composed:!0})),o}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():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,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,closeOnComplete:s.closeOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay,lastUploadReview:s.lastUploadReview,showLocateButton:s.showLocateButton,showCopyCdnButton:s.showCopyCdnButton,getLocateUrl:s.getLocateUrl,minimizeOnUpload:s.minimizeOnUpload,metadataConfig:s.metadataConfig,tusConfig:s.tusConfig}}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,g,p,f,m,x;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=gs((h=this.config)==null?void 0:h.defaultFilters);for(const[_,w]of Object.entries(a))s.has(_)||(i[_]=w);const o=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(g=this.config)!=null&&g.rememberLastTab?io(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c: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:!!((f=this.config)!=null&&f.enableAISearch&&((m=this.config)!=null&&m.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...o])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((x=this.config)==null?void 0:x.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._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,o,n,c,d,h,u,g,p,f,m,x,_,w,y,L,k,S,E,A,ve,ae,P,Z,J,z,De,Ps,Is,Ds,zs,Rs,js,Ns,Us,Bs,qs,Vs;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const Ze=s.activeTab;if(Ze==="assets"){const oe=this._buildSearchNotation(),Te=s.currentFolderPath||"/",ue=s.isAISearchActive&&!!s.searchQuery,re=ze(this.apiClient,{folder:Te,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),G=Tt(this.apiClient,{folder:Te,q:oe||void 0,search:s.searchQuery||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[q,ee]=await Promise.all([re,G]);if(e!==this._loadId)return;const te=((o=q.files)==null?void 0:o.length)??0,N=te>=s.limit,se=((n=ee==null?void 0:ee.stats)==null?void 0:n.approx_files_count)??((c=ee==null?void 0:ee.info)==null?void 0:c.total_files_count)??((d=q.info)==null?void 0:d.total_files_count)??((u=(h=q.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(g=q.base)==null?void 0:g.count)==null?void 0:p.files_direct)??te;this.store.setState({assets:q.files||[],folders:[],totalCount:se,totalFolderCount:0,offset:0,hasMore:N,isLoading:!1})}else if(Ze==="folders"){const oe=this._buildSearchNotation(),Te=s.currentFolderPath||"/",[ue,re,G]=await Promise.all([qi(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),ze(this.apiClient,{folder:Te,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((f=s.config)==null?void 0:f.locale)??"en"}}),Tt(this.apiClient,{folder:Te,q:oe||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((m=s.config)==null?void 0:m.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const q=ue.folders||[];let ee={};if(q.length>0)try{ee=await Vi(this.apiClient,q.map(Je=>Je.uuid))}catch{}if(e!==this._loadId)return;const te=((x=re.files)==null?void 0:x.length)??0,N=te>=s.limit,se=((_=G==null?void 0:G.stats)==null?void 0:_.approx_files_count)??((w=G==null?void 0:G.info)==null?void 0:w.total_files_count)??((y=re.info)==null?void 0:y.total_files_count)??((k=(L=re.base)==null?void 0:L.count)==null?void 0:k.files_direct)??te;this.store.setState({assets:re.files||[],folders:q,folderPreviews:ee,totalCount:se,totalFolderCount:ue.total??q.length,offset:0,hasMore:N,isLoading:!1})}else if(Ze==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const oe=s.labels.find(Jt=>Jt.uuid===s.activeLabelUuid);if(!oe){this.store.setState({isLoading:!1});return}const Te=oe.sid.replace("#",""),ue=this._buildSearchNotation(),re=`labels:${Te}${ue?" "+ue:""}`,G=s.isAISearchActive&&!!s.searchQuery,q=ze(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:re,recursive:1,...G&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((S=s.config)==null?void 0:S.locale)??"en"}}),ee=Tt(this.apiClient,{folder:"/",q:re,search:s.searchQuery||void 0,recursive:1,...G&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((E=s.config)==null?void 0:E.locale)??"en"}}).catch(()=>null),[te,N]=await Promise.all([q,ee]);if(e!==this._loadId)return;const se=((A=te.files)==null?void 0:A.length)??0,Je=se>=s.limit,Zt=((ve=N==null?void 0:N.stats)==null?void 0:ve.approx_files_count)??((ae=N==null?void 0:N.info)==null?void 0:ae.total_files_count)??((P=te.info)==null?void 0:P.total_files_count)??((J=(Z=te.base)==null?void 0:Z.count)==null?void 0:J.files_recursive)??((De=(z=te.base)==null?void 0:z.count)==null?void 0:De.files_direct)??se;this.store.setState({assets:te.files||[],folders:[],totalCount:Zt,totalFolderCount:0,offset:0,hasMore:Je,isLoading:!1})}else if(Ze==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const oe=s.activeCollectionFolder;if(!(oe&&!((Ps=oe.children)!=null&&Ps.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ue=s.activeCollectionUuid,re=oe.filters||void 0,G=this._buildSearchNotation(),q=s.isAISearchActive&&!!s.searchQuery,ee=ze(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:G||void 0,recursive:1,collection_uuid:ue,f64:re,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Is=s.config)==null?void 0:Is.locale)??"en"}}),te=Tt(this.apiClient,{q:G||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:ue,f64:re,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ds=s.config)==null?void 0:Ds.locale)??"en"}}).catch(()=>null),[N,se]=await Promise.all([ee,te]);if(e!==this._loadId)return;const Je=((zs=N.files)==null?void 0:zs.length)??0,Zt=Je>=s.limit,Jt=((Rs=se==null?void 0:se.stats)==null?void 0:Rs.approx_files_count)??((js=se==null?void 0:se.info)==null?void 0:js.total_files_count)??((Ns=N.info)==null?void 0:Ns.total_files_count)??((Bs=(Us=N.base)==null?void 0:Us.count)==null?void 0:Bs.files_recursive)??((Vs=(qs=N.base)==null?void 0:qs.count)==null?void 0:Vs.files_direct)??Je;this.store.setState({assets:N.files||[],folders:[],totalCount:Jt,totalFolderCount:0,offset:0,hasMore:Zt,isLoading:!1})}}catch(Ze){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:Ze,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,o;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const w=e.labels.find(y=>y.uuid===e.activeLabelUuid);w&&(c=`labels:${w.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,g;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,g=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await ze(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...g&&{f64:g},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((o=e.config)==null?void 0:o.locale)??"en"}});if(s!==this._loadMoreId)return;const f=this.store.getState().assets,m=p.files||[],x=m.length>=e.limit,_=[...f,...m];this.store.setState({assets:_,offset:i,hasMore:x,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){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var o;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((o=this.config)==null?void 0:o.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&&eo(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:[]}),ei(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:[]}),ei(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&so(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,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;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&Ne(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,o;const i={assets:e};s!=null&&s.length&&(i.folders=s),(o=(a=this.config)==null?void 0:a.onSelect)==null||o.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var o;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(o=this.config)!=null&&o.rememberLastFolder&&ti(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 c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),g=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:g,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,o=s?i.breadcrumb.slice(0,a+1):[],n=o.length>0?o[o.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&ti(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:o,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await Ki(this.apiClient,s.uuid),a=ii(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),o=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,o.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:o,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Ja(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),o=[];let n=s.endsWith("/")?s:s+"/";for(const c of a)n+=c+"/",o.push({uuid:n,name:c,path:n});return o}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,o;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((o=this.config)==null?void 0:o.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var o,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((o=this.config)==null?void 0:o.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(Ne).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var o;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>ze(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(o=this.config)==null?void 0:o.maxSelections,g=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=g,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(g)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,o=this._transformFolders,n=a.length>1,c=bs(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var f,m;if(!Ne(h))return h;const u=(f=h.url)==null?void 0:f.cdn,g=(m=h.url)==null?void 0:m.permalink,p={cdn:u?we(u,c):""};return g&&(p.permalink_cdn=we(g,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,o.length?o:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}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",o=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){o&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const g=this._buildSearchNotation();let p=s.currentFolderPath||"/";const f=s.limit,m=s.assets,x=s.totalCount;let _=s.activeTab==="folders"?0:1,w=g||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const P=s.labels.find(Z=>Z.uuid===s.activeLabelUuid);P&&(w=`labels:${P.sid.replace("#","")}${g?" "+g:""}`),p="/",_=1}let y,L;s.activeTab==="collections"&&s.activeCollectionFolder&&(y=s.activeCollectionUuid||void 0,L=s.activeCollectionFolder.filters||void 0,p="",_=1);const k=[];for(let P=m.length;P<x;P+=f)k.push(P);const S=4,E=[];for(let P=0;P<k.length;P+=S){if(c!==this._selectAllId)return;const Z=k.slice(P,P+S),J=await Promise.all(Z.map(z=>{var De;return ze(this.apiClient,{...p?{folder:p}:{},offset:z,limit:f,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w,recursive:_,...y&&{collection_uuid:y},...L&&{f64:L},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((De=s.config)==null?void 0:De.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const z of J)z.files&&E.push(...z.files)}if(c!==this._selectAllId)return;const A=new Set(m.map(P=>P.uuid)),ve=E.filter(P=>A.has(P.uuid)?!1:(A.add(P.uuid),!0)),ae=[...m,...ve];this.store.setState({assets:ae,offset:Math.max(0,ae.length-f),hasMore:!1,isSelectingAll:!1}),o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(ae)}catch(g){if(c!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:g,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===b.DATE||e===b.LICENSE_EXPIRY||e===K.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=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(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:g}=i;c=!d&&!h&&!u&&!g}if(c){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===b.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 o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,o,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,o,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,f,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),o=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!o)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 x=a.renderRoot.querySelectorAll(".chip.pinned-empty"),_=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const w of x){const y=(m=(f=w.querySelector(".chip-label"))==null?void 0:f.textContent)==null?void 0:m.trim();if(i&&y===_){n=w;break}if(s&&y===(tt[s]||s)){n=w;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,g=h?c.bottom-h.top:void 0;i?o.openMetadataFieldPanel(i,!0,u,g):s&&o.openFilterPanel(s,!0,u,g)}_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},o={...a.applied};delete o[s],a.applied=o,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==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:o}=e.detail,c={...this.store.getState().filters},d={...c.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(g=>g!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:o},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const g=this.renderRoot.querySelector("ap-filters-bar");g&&(g.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),o.metadata=n,this.store.setState({filters:o})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata},n={...o.applied};delete n[s],o.applied=n,o.pinned.includes(s)||(o.visible=o.visible.filter(c=>c!==s)),a.metadata=o,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,o={...this.store.getState().filters};i?o.pinned.includes(s)||(o.pinned=[...o.pinned,s]):(o.pinned=o.pinned.filter(h=>h!==s),s in o.applied||(o.visible=o.visible.filter(h=>h!==s))),this.store.setState({filters:o});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;Wa(n,o.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,o={...this.store.getState().filters},n={...o.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))),o.metadata=n,this.store.setState({filters:o});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Xa(c,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(o=>o!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata};o.visible=o.visible.filter(n=>n!==s),a.metadata=o,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,o={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];o.applied=c;const d=Object.keys(s);if(o.visible=[...new Set([...o.pinned,...d])],i){const u={...o.metadata};u.applied=i.applied;const g=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...g])],o.metadata=u}this.store.setState({filters:o,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return po;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return ho;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return uo}return e.searchQuery?lo:e.activeTab==="folders"?co:ys}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return Pa(s,e.filters.metadata.applied).join(" ")}render(){var p,f,m,x,_,w,y,L,k,S,E,A,ve,ae,P,Z,J,z;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),o=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,c=r.html`
7298
+ `];Ei([l.property()],Zt.prototype,"text",2);Zt=Ei([l.customElement("ap-tooltip")],Zt);var vn=Object.defineProperty,mn=Object.getOwnPropertyDescriptor,Re=(t,e,s,i)=>{for(var a=i>1?void 0:i?mn(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&&vn(e,s,a),a};const bn=/[/\\\x00-\x1f]/;function _n(t){return bn.test(t)?`Folder name can't contain "/" or "\\".`:t==="."||t===".."?`Folder name can't be "." or "..".`:null}let _e=class extends o.LitElement{constructor(){super(...arguments),this.currentFolderPath="/",this.loading=!1,this.error=null,this._name="",this._localError=null,this._apiErrorDismissed=!1,this._handleDocKeyDown=t=>{t.key==="Escape"&&(t.preventDefault(),this._handleCancel())}}connectedCallback(){super.connectedCallback(),document.addEventListener("keydown",this._handleDocKeyDown),requestAnimationFrame(()=>{var t;return(t=this._input)==null?void 0:t.focus()})}disconnectedCallback(){document.removeEventListener("keydown",this._handleDocKeyDown),super.disconnectedCallback()}updated(t){t.has("error")&&this.error&&(this._apiErrorDismissed=!1)}_handleInput(t){this._name=t.target.value,this._localError&&(this._localError=null),this.error&&!this._apiErrorDismissed&&(this._apiErrorDismissed=!0)}_canSubmit(){return!this.loading&&this._name.trim().length>0}_handleConfirm(){if(!this._canSubmit())return;const t=this._name.trim(),e=_n(t);if(e){this._localError=e;return}this.dispatchEvent(new CustomEvent("create-folder-confirm",{detail:{name:t},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("create-folder-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleCancel()}_handleKeyDown(t){t.key==="Enter"&&(t.preventDefault(),this._handleConfirm())}render(){const t=this.currentFolderPath||"/",e=this._localError??(this._apiErrorDismissed?null:this.error);return o.html`
7299
+ <div class="backdrop" @click=${this._handleBackdropClick}>
7300
+ <div class="dialog" role="dialog" aria-modal="true" aria-labelledby="ap-cf-title">
7301
+ <div class="title" id="ap-cf-title">Create folder</div>
7302
+ <div class="description">In <code>${t}</code></div>
7303
+
7304
+ <input
7305
+ type="text"
7306
+ placeholder="Folder name"
7307
+ .value=${this._name}
7308
+ ?disabled=${this.loading}
7309
+ @input=${this._handleInput}
7310
+ @keydown=${this._handleKeyDown}
7311
+ aria-label="Folder name"
7312
+ aria-invalid=${e?"true":"false"}
7313
+ />
7314
+ ${e?o.html`<div class="error" role="alert">${e}</div>`:o.nothing}
7315
+
7316
+ <div class="actions">
7317
+ <button class="btn" @click=${this._handleCancel}>Cancel</button>
7318
+ <button class="btn btn-primary" @click=${this._handleConfirm} ?disabled=${!this._canSubmit()}>
7319
+ ${this.loading?o.html`<span class="loading-content"><ap-spinner .size=${14}></ap-spinner> Creating...</span>`:"Create"}
7320
+ </button>
7321
+ </div>
7322
+ </div>
7323
+ </div>
7324
+ `}};_e.styles=[H,o.css`
7325
+ :host {
7326
+ display: block;
7327
+ }
7328
+ .backdrop {
7329
+ position: fixed;
7330
+ inset: 0;
7331
+ z-index: 100;
7332
+ background: oklch(0 0 0 / 0.4);
7333
+ display: flex;
7334
+ align-items: center;
7335
+ justify-content: center;
7336
+ animation: ap-cf-backdrop-in 150ms ease-out;
7337
+ }
7338
+ .dialog {
7339
+ background: var(--ap-background, oklch(1 0 0));
7340
+ border-radius: var(--ap-radius-lg, 12px);
7341
+ padding: 24px 28px 20px;
7342
+ max-width: 440px;
7343
+ width: 90%;
7344
+ box-shadow: 0 16px 48px oklch(0 0 0 / 0.16);
7345
+ font-family: var(--ap-font-family, system-ui, sans-serif);
7346
+ animation: ap-cf-dialog-in 180ms ease-out;
7347
+ }
7348
+ @keyframes ap-cf-backdrop-in {
7349
+ from { opacity: 0; }
7350
+ to { opacity: 1; }
7351
+ }
7352
+ @keyframes ap-cf-dialog-in {
7353
+ from { opacity: 0; transform: scale(0.96); }
7354
+ to { opacity: 1; transform: scale(1); }
7355
+ }
7356
+ @media (prefers-reduced-motion: reduce) {
7357
+ .backdrop, .dialog { animation: none; }
7358
+ }
7359
+ .title {
7360
+ font-size: 1rem;
7361
+ font-weight: 600;
7362
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
7363
+ margin-bottom: 6px;
7364
+ }
7365
+ .description {
7366
+ font-size: var(--ap-font-size-sm, 0.875rem);
7367
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
7368
+ margin-bottom: 16px;
7369
+ line-height: 1.5;
7370
+ word-break: break-all;
7371
+ overflow-wrap: anywhere;
7372
+ }
7373
+ .description code {
7374
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
7375
+ font-size: 0.8125rem;
7376
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
7377
+ padding: 1px 6px;
7378
+ border-radius: 4px;
7379
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
7380
+ }
7381
+ input {
7382
+ width: 100%;
7383
+ box-sizing: border-box;
7384
+ height: 36px;
7385
+ padding: 0 12px;
7386
+ border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
7387
+ border-radius: var(--ap-radius-sm, 6px);
7388
+ font-size: var(--ap-font-size-sm, 0.875rem);
7389
+ font-family: var(--ap-font-family, system-ui, sans-serif);
7390
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
7391
+ background: var(--ap-background, oklch(1 0 0));
7392
+ outline: none;
7393
+ }
7394
+ input:hover {
7395
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
7396
+ }
7397
+ input:focus {
7398
+ border-color: var(--ap-ring, oklch(0.578 0.198 268.129 / 0.7));
7399
+ box-shadow: 0 0 0 2px var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
7400
+ }
7401
+ .error {
7402
+ font-size: 0.8125rem;
7403
+ color: var(--ap-destructive, oklch(0.577 0.245 27.325));
7404
+ margin: 6px 0 0;
7405
+ line-height: 1.25rem;
7406
+ }
7407
+ .actions {
7408
+ display: flex;
7409
+ justify-content: flex-end;
7410
+ gap: 12px;
7411
+ margin-top: 16px;
7412
+ }
7413
+ .btn {
7414
+ padding: 8px 20px;
7415
+ border-radius: var(--ap-radius-sm, 6px);
7416
+ font-size: var(--ap-font-size-sm, 0.875rem);
7417
+ font-weight: 500;
7418
+ cursor: pointer;
7419
+ transition: background 100ms;
7420
+ font-family: var(--ap-font-family, system-ui, sans-serif);
7421
+ border: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
7422
+ background: var(--ap-background, oklch(1 0 0));
7423
+ color: var(--ap-foreground, oklch(0.37 0.022 248.413));
7424
+ }
7425
+ .btn:not(.btn-primary):hover {
7426
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
7427
+ }
7428
+ .btn-primary {
7429
+ background: var(--ap-primary, oklch(0.578 0.198 268.129));
7430
+ color: var(--ap-primary-foreground, oklch(1 0 0));
7431
+ border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
7432
+ }
7433
+ .btn-primary:hover {
7434
+ opacity: 0.9;
7435
+ }
7436
+ .btn:disabled {
7437
+ opacity: 0.5;
7438
+ cursor: default;
7439
+ }
7440
+ .btn-primary .loading-content {
7441
+ display: flex;
7442
+ align-items: center;
7443
+ gap: 8px;
7444
+ }
7445
+ `];Re([l.property()],_e.prototype,"currentFolderPath",2);Re([l.property({type:Boolean})],_e.prototype,"loading",2);Re([l.property()],_e.prototype,"error",2);Re([l.state()],_e.prototype,"_name",2);Re([l.state()],_e.prototype,"_localError",2);Re([l.state()],_e.prototype,"_apiErrorDismissed",2);Re([l.query("input")],_e.prototype,"_input",2);_e=Re([l.customElement("ap-create-folder-dialog")],_e);var yn=Object.defineProperty,je=(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&&yn(e,s,a),a};const Us=class Us 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._transformOpen=!1,this._createFolderOpen=!1,this._isCreatingFolder=!1,this._createFolderError=null,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!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._cancelCreateFolderRequested=!1,this.store=zi(),this.storeCtrl=new Ri(this,this.store),this.selectionCtrl=new Ni(this,this.store),this.infiniteScrollCtrl=new Ui(this,()=>this._loadMore()),this.marqueeCtrl=new Bi(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=ws(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=ir(),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&&or(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new qi(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const{key:x,permissions:b}=await Zi(this.apiClient);this.apiClient.setSassKey(x),this.store.setState({sassKey:x,permissions:b})}const[r,n,c,d,h]=await Promise.allSettled([Da(this.apiClient),Qi(this.apiClient),Xi(this.apiClient),Pa(this.apiClient),Yi(this.apiClient)]),u={};if(r.status==="fulfilled"){const{fields:x,regionalVariantGroups:b,regionalFilters:w,brandColor:y}=r.value;u.metadataFields=x,u.regionalVariantGroups=b,u.regionalFilters=w,y&&(u.brandColor=y)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:f,pinnedMetadata:p}=er(e.auth.projectToken??null),g=this.store.getState().filters;u.filters={...g,pinned:f,visible:[...f],metadata:{...g.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const m=e.brandColor||u.brandColor||this.store.getState().brandColor;m&&(u.brandColor||this.store.setState({brandColor:m}),hr(this,m))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():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,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,closeOnComplete:s.closeOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay,lastUploadReview:s.lastUploadReview,showLocateButton:s.showLocateButton,showCopyCdnButton:s.showCopyCdnButton,getLocateUrl:s.getLocateUrl,minimizeOnUpload:s.minimizeOnUpload,metadataConfig:s.metadataConfig,tusConfig:s.tusConfig}}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,m,x;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=ws((h=this.config)==null?void 0:h.defaultFilters);for(const[b,w]of Object.entries(a))s.has(b)||(i[b]=w);const r=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(f=this.config)!=null&&f.rememberLastTab?lr(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c: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&&((m=this.config)!=null&&m.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),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((x=this.config)==null?void 0:x.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._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,c,d,h,u,f,p,g,m,x,b,w,y,L,k,S,E,A,me,ae,P,Z,J,z,Oe,gt,vt,mt,bt,_t,zt,Bs,qs,Vs,Hs,Gs;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const tt=s.activeTab;if(tt==="assets"){const re=this._buildSearchNotation(),Me=s.currentFolderPath||"/",ue=s.isAISearchActive&&!!s.searchQuery,oe=Ne(this.apiClient,{folder:Me,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:re||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),K=Rt(this.apiClient,{folder:Me,q:re||void 0,search:s.searchQuery||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[q,ee]=await Promise.all([oe,K]);if(e!==this._loadId)return;const te=((r=q.files)==null?void 0:r.length)??0,N=te>=s.limit,se=((n=ee==null?void 0:ee.stats)==null?void 0:n.approx_files_count)??((c=ee==null?void 0:ee.info)==null?void 0:c.total_files_count)??((d=q.info)==null?void 0:d.total_files_count)??((u=(h=q.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(f=q.base)==null?void 0:f.count)==null?void 0:p.files_direct)??te;this.store.setState({assets:q.files||[],folders:[],totalCount:se,totalFolderCount:0,offset:0,hasMore:N,isLoading:!1})}else if(tt==="folders"){const re=this._buildSearchNotation(),Me=s.currentFolderPath||"/",[ue,oe,K]=await Promise.all([Hi(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ne(this.apiClient,{folder:Me,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:re||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"}}),Rt(this.apiClient,{folder:Me,q:re||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((m=s.config)==null?void 0:m.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const q=ue.folders||[];let ee={};if(q.length>0)try{ee=await Gi(this.apiClient,q.map(st=>st.uuid))}catch{}if(e!==this._loadId)return;const te=((x=oe.files)==null?void 0:x.length)??0,N=te>=s.limit,se=((b=K==null?void 0:K.stats)==null?void 0:b.approx_files_count)??((w=K==null?void 0:K.info)==null?void 0:w.total_files_count)??((y=oe.info)==null?void 0:y.total_files_count)??((k=(L=oe.base)==null?void 0:L.count)==null?void 0:k.files_direct)??te;this.store.setState({assets:oe.files||[],folders:q,folderPreviews:ee,totalCount:se,totalFolderCount:ue.total??q.length,offset:0,hasMore:N,isLoading:!1})}else if(tt==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const re=s.labels.find(ns=>ns.uuid===s.activeLabelUuid);if(!re){this.store.setState({isLoading:!1});return}const Me=re.sid.replace("#",""),ue=this._buildSearchNotation(),oe=`labels:${Me}${ue?" "+ue:""}`,K=s.isAISearchActive&&!!s.searchQuery,q=Ne(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe,recursive:1,...K&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((S=s.config)==null?void 0:S.locale)??"en"}}),ee=Rt(this.apiClient,{folder:"/",q:oe,search:s.searchQuery||void 0,recursive:1,...K&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((E=s.config)==null?void 0:E.locale)??"en"}}).catch(()=>null),[te,N]=await Promise.all([q,ee]);if(e!==this._loadId)return;const se=((A=te.files)==null?void 0:A.length)??0,st=se>=s.limit,os=((me=N==null?void 0:N.stats)==null?void 0:me.approx_files_count)??((ae=N==null?void 0:N.info)==null?void 0:ae.total_files_count)??((P=te.info)==null?void 0:P.total_files_count)??((J=(Z=te.base)==null?void 0:Z.count)==null?void 0:J.files_recursive)??((Oe=(z=te.base)==null?void 0:z.count)==null?void 0:Oe.files_direct)??se;this.store.setState({assets:te.files||[],folders:[],totalCount:os,totalFolderCount:0,offset:0,hasMore:st,isLoading:!1})}else if(tt==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const re=s.activeCollectionFolder;if(!(re&&!((gt=re.children)!=null&&gt.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ue=s.activeCollectionUuid,oe=re.filters||void 0,K=this._buildSearchNotation(),q=s.isAISearchActive&&!!s.searchQuery,ee=Ne(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:K||void 0,recursive:1,collection_uuid:ue,f64:oe,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((vt=s.config)==null?void 0:vt.locale)??"en"}}),te=Rt(this.apiClient,{q:K||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:ue,f64:oe,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((mt=s.config)==null?void 0:mt.locale)??"en"}}).catch(()=>null),[N,se]=await Promise.all([ee,te]);if(e!==this._loadId)return;const st=((bt=N.files)==null?void 0:bt.length)??0,os=st>=s.limit,ns=((_t=se==null?void 0:se.stats)==null?void 0:_t.approx_files_count)??((zt=se==null?void 0:se.info)==null?void 0:zt.total_files_count)??((Bs=N.info)==null?void 0:Bs.total_files_count)??((Vs=(qs=N.base)==null?void 0:qs.count)==null?void 0:Vs.files_recursive)??((Gs=(Hs=N.base)==null?void 0:Hs.count)==null?void 0:Gs.files_direct)??st;this.store.setState({assets:N.files||[],folders:[],totalCount:ns,totalFolderCount:0,offset:0,hasMore:os,isLoading:!1})}}catch(tt){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:tt,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,r;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const w=e.labels.find(y=>y.uuid===e.activeLabelUuid);w&&(c=`labels:${w.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,f;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,f=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await Ne(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...f&&{f64:f},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((r=e.config)==null?void 0:r.locale)??"en"}});if(s!==this._loadMoreId)return;const g=this.store.getState().assets,m=p.files||[],x=m.length>=e.limit,b=[...g,...m];this.store.setState({assets:b,offset:i,hasMore:x,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){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),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&&rr(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:[]}),si(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:[]}),si(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&nr(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,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;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&qe(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,r;const i={assets:e};s!=null&&s.length&&(i.folders=s),(r=(a=this.config)==null?void 0:a.onSelect)==null||r.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,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&&ii(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 c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),f=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:f,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const 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:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&ii(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()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await Wi(this.apiClient,s.uuid),a=ri(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),r=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,r.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:r,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&ar(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 c of a)n+=c+"/",r.push({uuid:n,name:c,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;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((r=this.config)==null?void 0:r.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var r,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((r=this.config)==null?void 0:r.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(qe).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var r;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>Ne(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(r=this.config)==null?void 0:r.maxSelections,f=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=f,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(f)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,r=this._transformFolders,n=a.length>1,c=Cs(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var g,m;if(!qe(h))return h;const u=(g=h.url)==null?void 0:g.cdn,f=(m=h.url)==null?void 0:m.permalink,p={cdn:u?ke(u,c):""};return f&&(p.permalink_cdn=ke(f,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,r.length?r:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}_openCreateFolderDialog(){this._createFolderError=null,this._createFolderOpen=!0}_handleCreateFolderCancel(){this._isCreatingFolder&&(this._cancelCreateFolderRequested=!0),this._createFolderOpen=!1,this._createFolderError=null}async _handleCreateFolderConfirm(e){const s=e.detail.name;if(!s||this._isCreatingFolder||!this.apiClient)return;const i=this.store.getState().currentFolderPath||"/";this._isCreatingFolder=!0,this._cancelCreateFolderRequested=!1,this._createFolderError=null;try{await Ki(this.apiClient,s,i),this._cancelCreateFolderRequested||(this._createFolderOpen=!1),this._loadData()}catch(a){this._cancelCreateFolderRequested||(this._createFolderError=this._mapCreateFolderError(a))}finally{this._isCreatingFolder=!1,this._cancelCreateFolderRequested=!1}}_mapCreateFolderError(e){const s=(e==null?void 0:e.message)??"";if(/timed out/i.test(s))return"Request timed out. Please try again.";const i=s.match(/^API error: (\d+)/);if(i)switch(Number(i[1])){case 400:return"Invalid folder name.";case 401:return"Authentication failed. Please reload the page.";case 403:return"You do not have permission to create a folder here.";case 409:return"A folder with this name already exists.";default:return"Failed to create folder. Please try again."}return s||"Failed to create folder. Please try again."}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 c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const f=this._buildSearchNotation();let p=s.currentFolderPath||"/";const g=s.limit,m=s.assets,x=s.totalCount;let b=s.activeTab==="folders"?0:1,w=f||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const P=s.labels.find(Z=>Z.uuid===s.activeLabelUuid);P&&(w=`labels:${P.sid.replace("#","")}${f?" "+f:""}`),p="/",b=1}let y,L;s.activeTab==="collections"&&s.activeCollectionFolder&&(y=s.activeCollectionUuid||void 0,L=s.activeCollectionFolder.filters||void 0,p="",b=1);const k=[];for(let P=m.length;P<x;P+=g)k.push(P);const S=4,E=[];for(let P=0;P<k.length;P+=S){if(c!==this._selectAllId)return;const Z=k.slice(P,P+S),J=await Promise.all(Z.map(z=>{var Oe;return Ne(this.apiClient,{...p?{folder:p}:{},offset:z,limit:g,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w,recursive:b,...y&&{collection_uuid:y},...L&&{f64:L},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Oe=s.config)==null?void 0:Oe.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const z of J)z.files&&E.push(...z.files)}if(c!==this._selectAllId)return;const A=new Set(m.map(P=>P.uuid)),me=E.filter(P=>A.has(P.uuid)?!1:(A.add(P.uuid),!0)),ae=[...m,...me];this.store.setState({assets:ae,offset:Math.max(0,ae.length-g),hasMore:!1,isSelectingAll:!1}),r&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(ae)}catch(f){if(c!==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===_.DATE||e===_.LICENSE_EXPIRY||e===Q.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=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(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;c=!d&&!h&&!u&&!f}if(c){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===_.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 c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.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 c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.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 x=a.renderRoot.querySelectorAll(".chip.pinned-empty"),b=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const w of x){const y=(m=(g=w.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:m.trim();if(i&&y===b){n=w;break}if(s&&y===(at[s]||s)){n=w;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,f=h?c.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(c=>c!==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,c={...this.store.getState().filters},d={...c.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])),c.metadata=d,this.store.setState({filters:c,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(c=>c!==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(c=>c!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,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=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;tr(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 c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;sr(c,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)??{})),c={...s};for(const u of n)delete c[u];r.applied=c;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(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return gr;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return vr;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return mr}return e.searchQuery?ur:e.activeTab==="folders"?fr:Es}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return ja(s,e.filters.metadata.applied).join(" ")}render(){var b,w,y,L,k,S,E,A,me,ae,P,Z,J,z,Oe,gt,vt,mt,bt,_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=((b=this.config)==null?void 0:b.folderSelection)!==!1,c=o.html`
7269
7446
  <ap-header
7270
7447
  .activeTab=${e.activeTab}
7271
- .tabs=${((f=this.config)==null?void 0:f.tabs)??["assets","folders"]}
7448
+ .tabs=${((w=this.config)==null?void 0:w.tabs)??["assets","folders"]}
7272
7449
  .isInsideLabel=${e.activeTab==="labels"&&!!e.activeLabelUuid}
7273
7450
  .isInsideCollection=${e.activeTab==="collections"&&!!e.activeCollectionUuid}
7274
- .isInsideCollectionLeaf=${e.activeTab==="collections"&&!!e.activeCollectionFolder&&!((m=e.activeCollectionFolder.children)!=null&&m.length)}
7451
+ .isInsideCollectionLeaf=${e.activeTab==="collections"&&!!e.activeCollectionFolder&&!((y=e.activeCollectionFolder.children)!=null&&y.length)}
7275
7452
  .viewMode=${e.viewMode}
7276
7453
  .searchQuery=${e.searchQuery}
7277
- .enableAISearch=${!!((x=this.config)!=null&&x.enableAISearch)}
7454
+ .enableAISearch=${!!((L=this.config)!=null&&L.enableAISearch)}
7278
7455
  .isAISearchActive=${e.isAISearchActive}
7279
7456
  .regionalGroups=${e.regionalVariantGroups}
7280
7457
  .regionalFilters=${e.regionalFilters}
@@ -7286,30 +7463,31 @@
7286
7463
  @regional-change=${this._handleRegionalChange}
7287
7464
  @ap-close=${()=>this._handleCancel("close-button")}
7288
7465
  ></ap-header>
7289
- `,d=!!((_=this.config)!=null&&_.uploader),h=r.html`
7466
+ `,d=!!((k=this.config)!=null&&k.uploader),h=((S=this.config)==null?void 0:S.folderCreation)===!0,u=((E=this.config)==null?void 0:E.auth.mode)==="sassKey",f=e.activeTab==="folders",p=h&&f&&(u||Ji(e.permissions,ea.FOLDER_CREATE)),g=o.html`
7290
7467
  <div class="content-area"
7291
7468
  @dragenter=${this._onDragEnter}
7292
7469
  @dragover=${this._onDragOver}
7293
7470
  @dragleave=${this._onDragLeave}
7294
7471
  @drop=${this._onDrop}
7295
7472
  >
7296
- ${this._isDragOver?r.html`
7473
+ ${this._isDragOver?o.html`
7297
7474
  <div class="drop-zone-overlay">
7298
7475
  <div class="drop-zone-label">
7299
7476
  <ap-icon name="upload" .size=${32}></ap-icon>
7300
7477
  Drop files to upload
7301
7478
  </div>
7302
7479
  </div>
7303
- `:r.nothing}
7480
+ `:o.nothing}
7304
7481
  <div class="main-content">
7305
- <div class="toolbar-filters-wrapper${(w=this.config)!=null&&w.stickyFilters?" sticky":""}">
7482
+ <div class="toolbar-filters-wrapper${(A=this.config)!=null&&A.stickyFilters?" sticky":""}">
7306
7483
  <ap-content-toolbar
7307
7484
  .isLoading=${e.isLoading}
7308
7485
  .totalCount=${e.totalCount}
7309
7486
  .totalFolderCount=${e.totalFolderCount}
7310
7487
  .showUpload=${d}
7311
- .showFilters=${!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((y=e.activeCollectionFolder.children)!=null&&y.length)))}
7312
- .countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((L=e.activeCollectionFolder.children)!=null&&L.length))?`${this._getVisibleCollectionFolders().length} folder${this._getVisibleCollectionFolders().length!==1?"s":""}`:""}
7488
+ .showCreateFolder=${p}
7489
+ .showFilters=${!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((me=e.activeCollectionFolder.children)!=null&&me.length)))}
7490
+ .countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((ae=e.activeCollectionFolder.children)!=null&&ae.length))?`${this._getVisibleCollectionFolders().length} folder${this._getVisibleCollectionFolders().length!==1?"s":""}`:""}
7313
7491
  .sortBy=${e.sortBy}
7314
7492
  .sortDirection=${e.sortDirection}
7315
7493
  .sortOptions=${this._getSortOptions()}
@@ -7331,9 +7509,10 @@
7331
7509
  @filter-panel-change=${this._handleFilterPanelChange}
7332
7510
  @filter-pending=${this._handleFilterPending}
7333
7511
  @upload-click=${this._handleUploadClick}
7512
+ @create-folder-click=${this._openCreateFolderDialog}
7334
7513
  ></ap-content-toolbar>
7335
7514
 
7336
- ${e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((k=e.activeCollectionFolder.children)!=null&&k.length))?r.nothing:r.html`
7515
+ ${e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((P=e.activeCollectionFolder.children)!=null&&P.length))?o.nothing:o.html`
7337
7516
  <ap-filters-bar
7338
7517
  .appliedFilters=${e.filters.applied}
7339
7518
  .appliedMetadata=${e.filters.metadata.applied}
@@ -7342,7 +7521,7 @@
7342
7521
  .labels=${e.labels}
7343
7522
  .pinnedFilters=${e.filters.pinned}
7344
7523
  .pinnedMetadataFields=${e.filters.metadata.pinned}
7345
- .forcedFilters=${((S=this.config)==null?void 0:S.forcedFilters)??{}}
7524
+ .forcedFilters=${((Z=this.config)==null?void 0:Z.forcedFilters)??{}}
7346
7525
  @filter-remove=${this._handleFilterRemove}
7347
7526
  @filter-deactivate=${this._handleFilterDeactivate}
7348
7527
  @filter-open=${this._handleFilterOpen}
@@ -7355,25 +7534,25 @@
7355
7534
  ></ap-filters-bar>
7356
7535
  `}
7357
7536
 
7358
- ${e.breadcrumb.length>0?r.html`<ap-breadcrumb
7537
+ ${e.breadcrumb.length>0?o.html`<ap-breadcrumb
7359
7538
  .items=${e.breadcrumb}
7360
7539
  .rootLabel=${e.activeTab==="labels"?"Labels":e.activeTab==="collections"?"Collections":"Root"}
7361
7540
  @breadcrumb-navigate=${this._handleBreadcrumbNavigate}
7362
- ></ap-breadcrumb>`:r.nothing}
7541
+ ></ap-breadcrumb>`:o.nothing}
7363
7542
  </div>
7364
7543
 
7365
- ${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((E=e.activeCollectionFolder.children)!=null&&E.length)))?r.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((A=this.config)==null?void 0:A.gridSize)??"normal"} .multiSelect=${((ve=this.config)==null?void 0:ve.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
7544
+ ${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((J=e.activeCollectionFolder.children)!=null&&J.length)))?o.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((z=this.config)==null?void 0:z.gridSize)??"normal"} .multiSelect=${((Oe=this.config)==null?void 0:Oe.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
7366
7545
 
7367
7546
  <ap-marquee-overlay .active=${this.marqueeCtrl.isActive} .rect=${this.marqueeCtrl.rect}></ap-marquee-overlay>
7368
- ${this._folderResolveOpen?r.html`
7547
+ ${this._folderResolveOpen?o.html`
7369
7548
  <ap-folder-resolve-dialog
7370
- .folders=${o}
7549
+ .folders=${r}
7371
7550
  .loading=${e.isResolvingFolders}
7372
7551
  @folder-resolve-confirm=${this._handleFolderResolveConfirm}
7373
7552
  @folder-resolve-cancel=${this._handleFolderResolveCancel}
7374
7553
  ></ap-folder-resolve-dialog>
7375
- `:r.nothing}
7376
- ${this._transformOpen?r.html`
7554
+ `:o.nothing}
7555
+ ${this._transformOpen?o.html`
7377
7556
  <ap-transformation-dialog
7378
7557
  .assets=${this._transformAssets}
7379
7558
  .isMultiSelect=${this._transformAssets.length>1}
@@ -7381,79 +7560,88 @@
7381
7560
  @transform-skip=${this._handleTransformSkip}
7382
7561
  @transform-cancel=${this._handleTransformCancel}
7383
7562
  ></ap-transformation-dialog>
7384
- `:r.nothing}
7563
+ `:o.nothing}
7564
+ ${this._createFolderOpen?o.html`
7565
+ <ap-create-folder-dialog
7566
+ .currentFolderPath=${e.currentFolderPath}
7567
+ .loading=${this._isCreatingFolder}
7568
+ .error=${this._createFolderError}
7569
+ @create-folder-confirm=${this._handleCreateFolderConfirm}
7570
+ @create-folder-cancel=${this._handleCreateFolderCancel}
7571
+ ></ap-create-folder-dialog>
7572
+ `:o.nothing}
7385
7573
  </div>
7386
7574
 
7387
- ${e.isPreviewOpen&&e.previewAsset?r.html`<ap-preview-panel
7575
+ ${e.isPreviewOpen&&e.previewAsset?o.html`<ap-preview-panel
7388
7576
  .asset=${e.previewAsset}
7389
7577
  .assets=${e.assets}
7390
7578
  .selectedIds=${s}
7391
7579
  .containerToken=${e.projectToken}
7392
- .showMetadata=${((ae=this.config)==null?void 0:ae.showMetadata)!==!1}
7580
+ .showMetadata=${((gt=this.config)==null?void 0:gt.showMetadata)!==!1}
7393
7581
  .metadataFields=${e.metadataFields}
7394
7582
  .labels=${e.labels}
7395
7583
  .regionalFilters=${e.regionalFilters}
7396
- .multiSelect=${((P=this.config)==null?void 0:P.multiSelect)??!0}
7584
+ .multiSelect=${((vt=this.config)==null?void 0:vt.multiSelect)??!0}
7397
7585
  @preview-close=${this._handlePreviewClose}
7398
7586
  @preview-navigate=${this._handlePreviewNavigate}
7399
7587
  @asset-select=${this._handleAssetSelect}
7400
7588
  @asset-quick-select=${this._handleQuickSelect}
7401
7589
  @filter-update=${this._handleFilterUpdate}
7402
- ></ap-preview-panel>`:r.nothing}
7590
+ ></ap-preview-panel>`:o.nothing}
7403
7591
  </div>
7404
- `,u=r.html`
7592
+ `,m=o.html`
7405
7593
  <ap-selection-bar
7406
7594
  .selectedAssets=${a}
7407
- .selectedFolders=${o}
7595
+ .selectedFolders=${r}
7408
7596
  .totalCount=${e.totalCount}
7409
7597
  .totalFolderCount=${e.totalFolderCount}
7410
7598
  .isSelectingAll=${e.isSelectingAll}
7411
- .multiSelect=${((Z=this.config)==null?void 0:Z.multiSelect)??!0}
7412
- .maxSelections=${(J=this.config)==null?void 0:J.maxSelections}
7413
- .showTransform=${!!((z=this.config)!=null&&z.transformations)&&a.some(Ne)}
7599
+ .multiSelect=${((mt=this.config)==null?void 0:mt.multiSelect)??!0}
7600
+ .maxSelections=${(bt=this.config)==null?void 0:bt.maxSelections}
7601
+ .showTransform=${!!((_t=this.config)!=null&&_t.transformations)&&a.some(qe)}
7414
7602
  @selection-confirm=${this._handleSelectionConfirm}
7415
7603
  @selection-transform=${this._handleSelectionTransform}
7416
7604
  @selection-clear=${this._handleSelectionClear}
7417
7605
  @selection-deselect=${this._handleSelectionDeselect}
7418
7606
  @select-all=${this._handleSelectAll}
7419
7607
  ></ap-selection-bar>
7420
- `,g=this._isUploaderOpen?r.html`
7608
+ `,x=this._isUploaderOpen?o.html`
7421
7609
  <div class="uploader-overlay">
7422
7610
  <div class="uploader-body">${this._uploaderEl}</div>
7423
7611
  </div>
7424
- `:r.nothing;return this._isInline?e.isOpen?r.html`
7612
+ `:o.nothing;return this._isInline?e.isOpen?o.html`
7425
7613
  <div class="ap-inline">
7426
- ${this._isUploaderOpen?g:r.html`
7614
+ ${this._isUploaderOpen?x:o.html`
7427
7615
  <div class="inline-header">${c}</div>
7428
- <div class="inline-content">${h}</div>
7429
- <div class="inline-footer">${u}</div>
7616
+ <div class="inline-content">${g}</div>
7617
+ <div class="inline-footer">${m}</div>
7430
7618
  `}
7431
7619
  </div>
7432
- `:r.nothing:r.html`
7620
+ `:o.nothing:o.html`
7433
7621
  <ap-modal
7434
7622
  ?open=${e.isOpen}
7435
- @ap-cancel=${De=>this._handleCancel(De.detail.reason)}
7623
+ @ap-cancel=${zt=>this._handleCancel(zt.detail.reason)}
7436
7624
  >
7437
- ${this._isUploaderOpen?g:r.html`
7625
+ ${this._isUploaderOpen?x:o.html`
7438
7626
  <div slot="header">${c}</div>
7439
- ${h}
7440
- <div slot="footer">${u}</div>
7627
+ ${g}
7628
+ <div slot="footer">${m}</div>
7441
7629
  `}
7442
7630
  </ap-modal>
7443
- `}_renderContent(e,s,i=[],a=!1){var o,n,c,d,h,u,g,p,f,m,x,_,w;if(e.activeTab==="assets")return!e.isLoading&&e.assets.length===0?r.html`
7631
+ `}_renderContent(e,s,i=[],a=!1){var r,n,c,d,h,u,f,p,g,m,x,b,w;if(e.activeTab==="assets")return!e.isLoading&&e.assets.length===0?o.html`
7444
7632
  <div class="empty-state">
7445
7633
  <ap-icon name="search" .size=${48}></ap-icon>
7446
7634
  <div class="empty-title">No assets found</div>
7447
7635
  <div class="empty-desc">Try adjusting your search or filters</div>
7448
7636
  </div>
7449
- `:e.viewMode==="grid"?r.html`
7637
+ `:e.viewMode==="grid"?o.html`
7450
7638
  <ap-grid-view
7451
7639
  .assets=${e.assets}
7452
7640
  .folders=${[]}
7453
7641
  .selectedIds=${s}
7454
7642
  .selectedFolderIds=${i}
7455
7643
  .isLoading=${e.isLoading}
7456
- .multiSelect=${((o=this.config)==null?void 0:o.multiSelect)??!0}
7644
+ .multiSelect=${((r=this.config)==null?void 0:r.multiSelect)??!0}
7457
7645
  .folderSelectable=${a}
7458
7646
  .gridSize=${((n=this.config)==null?void 0:n.gridSize)??"normal"}
7459
7647
  @asset-select=${this._handleAssetSelect}
@@ -7462,7 +7650,7 @@
7462
7650
  @folder-select=${this._handleFolderSelect}
7463
7651
  ></ap-grid-view>
7464
7652
  <div id="sentinel"></div>
7465
- `:r.html`
7653
+ `:o.html`
7466
7654
  <ap-list-view
7467
7655
  .assets=${e.assets}
7468
7656
  .folders=${[]}
@@ -7481,13 +7669,13 @@
7481
7669
  @selection-clear=${this._handleSelectionClear}
7482
7670
  ></ap-list-view>
7483
7671
  <div id="sentinel"></div>
7484
- `;if(e.activeTab==="folders")return!e.isLoading&&e.folders.length===0&&e.assets.length===0?r.html`
7672
+ `;if(e.activeTab==="folders")return!e.isLoading&&e.folders.length===0&&e.assets.length===0?o.html`
7485
7673
  <div class="empty-state">
7486
7674
  <ap-icon name="folder" .size=${48}></ap-icon>
7487
7675
  <div class="empty-title">This folder is empty</div>
7488
7676
  <div class="empty-desc">No folders or files found here</div>
7489
7677
  </div>
7490
- `:e.viewMode==="grid"?r.html`
7678
+ `:e.viewMode==="grid"?o.html`
7491
7679
  <ap-grid-view
7492
7680
  .assets=${e.assets}
7493
7681
  .folders=${e.folders}
@@ -7505,7 +7693,7 @@
7505
7693
  @folder-select=${this._handleFolderSelect}
7506
7694
  ></ap-grid-view>
7507
7695
  <div id="sentinel"></div>
7508
- `:r.html`
7696
+ `:o.html`
7509
7697
  <ap-list-view
7510
7698
  .assets=${e.assets}
7511
7699
  .folders=${e.folders}
@@ -7526,38 +7714,38 @@
7526
7714
  @selection-clear=${this._handleSelectionClear}
7527
7715
  ></ap-list-view>
7528
7716
  <div id="sentinel"></div>
7529
- `;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let y=e.labels;if(e.searchQuery){const k=e.searchQuery.toLowerCase();y=e.labels.filter(S=>S.name.toLowerCase().includes(k))}const L=e.sortDirection==="asc"?1:-1;return y=[...y].sort((k,S)=>L*k.name.localeCompare(S.name)),y.length===0?r.html`
7717
+ `;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let y=e.labels;if(e.searchQuery){const k=e.searchQuery.toLowerCase();y=e.labels.filter(S=>S.name.toLowerCase().includes(k))}const L=e.sortDirection==="asc"?1:-1;return y=[...y].sort((k,S)=>L*k.name.localeCompare(S.name)),y.length===0?o.html`
7530
7718
  <div class="empty-state">
7531
7719
  <ap-icon name="tag" .size=${48}></ap-icon>
7532
7720
  <div class="empty-title">${e.searchQuery?"No labels match your search":"No labels found"}</div>
7533
7721
  <div class="empty-desc">${e.searchQuery?"Try a different search term":"Labels will appear here once created"}</div>
7534
7722
  </div>
7535
- `:e.viewMode==="grid"?r.html`
7723
+ `:e.viewMode==="grid"?o.html`
7536
7724
  <div class="labels-grid">
7537
- ${y.map((k,S)=>r.html`
7725
+ ${y.map((k,S)=>o.html`
7538
7726
  <ap-label-card .label=${k} .index=${S} @label-open=${this._handleLabelOpen}></ap-label-card>
7539
7727
  `)}
7540
7728
  </div>
7541
- `:r.html`
7729
+ `:o.html`
7542
7730
  <div class="labels-list">
7543
- ${y.map((k,S)=>r.html`
7731
+ ${y.map((k,S)=>o.html`
7544
7732
  <ap-label-row .label=${k} .index=${S} @label-open=${this._handleLabelOpen}></ap-label-row>
7545
7733
  `)}
7546
7734
  </div>
7547
- `}return!e.isLoading&&e.assets.length===0?r.html`
7735
+ `}return!e.isLoading&&e.assets.length===0?o.html`
7548
7736
  <div class="empty-state">
7549
7737
  <ap-icon name="tag" .size=${48}></ap-icon>
7550
7738
  <div class="empty-title">No assets in this label</div>
7551
7739
  <div class="empty-desc">Assets added to this label will appear here</div>
7552
7740
  </div>
7553
- `:e.viewMode==="grid"?r.html`
7741
+ `:e.viewMode==="grid"?o.html`
7554
7742
  <ap-grid-view
7555
7743
  .assets=${e.assets}
7556
7744
  .folders=${[]}
7557
7745
  .selectedIds=${s}
7558
7746
  .selectedFolderIds=${i}
7559
7747
  .isLoading=${e.isLoading}
7560
- .multiSelect=${((g=this.config)==null?void 0:g.multiSelect)??!0}
7748
+ .multiSelect=${((f=this.config)==null?void 0:f.multiSelect)??!0}
7561
7749
  .folderSelectable=${!1}
7562
7750
  .gridSize=${((p=this.config)==null?void 0:p.gridSize)??"normal"}
7563
7751
  @asset-select=${this._handleAssetSelect}
@@ -7565,14 +7753,14 @@
7565
7753
  @asset-quick-select=${this._handleQuickSelect}
7566
7754
  ></ap-grid-view>
7567
7755
  <div id="sentinel"></div>
7568
- `:r.html`
7756
+ `:o.html`
7569
7757
  <ap-list-view
7570
7758
  .assets=${e.assets}
7571
7759
  .folders=${[]}
7572
7760
  .selectedIds=${s}
7573
7761
  .selectedFolderIds=${i}
7574
7762
  .isLoading=${e.isLoading}
7575
- .multiSelect=${((f=this.config)==null?void 0:f.multiSelect)??!0}
7763
+ .multiSelect=${((g=this.config)==null?void 0:g.multiSelect)??!0}
7576
7764
  .folderSelectable=${!1}
7577
7765
  .totalCount=${e.totalCount}
7578
7766
  .isSelectingAll=${e.isSelectingAll}
@@ -7583,49 +7771,49 @@
7583
7771
  @selection-clear=${this._handleSelectionClear}
7584
7772
  ></ap-list-view>
7585
7773
  <div id="sentinel"></div>
7586
- `}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let k=e.collections;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=e.collections.filter(A=>A.title.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return e.sortBy==="created_at"?k=[...k].sort((E,A)=>S*(new Date(E.created_at).getTime()-new Date(A.created_at).getTime())):e.sortBy==="updated_at"?k=[...k].sort((E,A)=>S*(new Date(E.updated_at).getTime()-new Date(A.updated_at).getTime())):k=[...k].sort((E,A)=>S*E.title.localeCompare(A.title)),k.length===0?r.html`
7774
+ `}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let k=e.collections;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=e.collections.filter(A=>A.title.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return e.sortBy==="created_at"?k=[...k].sort((E,A)=>S*(new Date(E.created_at).getTime()-new Date(A.created_at).getTime())):e.sortBy==="updated_at"?k=[...k].sort((E,A)=>S*(new Date(E.updated_at).getTime()-new Date(A.updated_at).getTime())):k=[...k].sort((E,A)=>S*E.title.localeCompare(A.title)),k.length===0?o.html`
7587
7775
  <div class="empty-state">
7588
7776
  <ap-icon name="layout-grid" .size=${48}></ap-icon>
7589
7777
  <div class="empty-title">${e.searchQuery?"No collections match your search":"No collections found"}</div>
7590
7778
  <div class="empty-desc">${e.searchQuery?"Try a different search term":"Collections will appear here once created"}</div>
7591
7779
  </div>
7592
- `:e.viewMode==="grid"?r.html`
7780
+ `:e.viewMode==="grid"?o.html`
7593
7781
  <div class="collections-grid">
7594
- ${k.map((E,A)=>r.html`
7782
+ ${k.map((E,A)=>o.html`
7595
7783
  <ap-collection-card .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-card>
7596
7784
  `)}
7597
7785
  </div>
7598
- `:r.html`
7786
+ `:o.html`
7599
7787
  <div class="collections-list">
7600
- ${k.map((E,A)=>r.html`
7788
+ ${k.map((E,A)=>o.html`
7601
7789
  <ap-collection-row .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-row>
7602
7790
  `)}
7603
7791
  </div>
7604
- `}if(e.isLoadingCollectionFolders)return r.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const y=this._getVisibleCollectionFolders();if(!e.activeCollectionFolder||(((m=e.activeCollectionFolder.children)==null?void 0:m.length)??0)>0){let k=y;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=y.filter(A=>A.name.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return k=[...k].sort((E,A)=>S*E.name.localeCompare(A.name)),k.length===0?r.html`
7792
+ `}if(e.isLoadingCollectionFolders)return o.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const y=this._getVisibleCollectionFolders();if(!e.activeCollectionFolder||(((m=e.activeCollectionFolder.children)==null?void 0:m.length)??0)>0){let k=y;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=y.filter(A=>A.name.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return k=[...k].sort((E,A)=>S*E.name.localeCompare(A.name)),k.length===0?o.html`
7605
7793
  <div class="empty-state">
7606
7794
  <ap-icon name="folder" .size=${48}></ap-icon>
7607
7795
  <div class="empty-title">${e.searchQuery?"No folders match your search":"No folders in this collection"}</div>
7608
7796
  <div class="empty-desc">${e.searchQuery?"Try a different search term":"Collection folders will appear here"}</div>
7609
7797
  </div>
7610
- `:e.viewMode==="grid"?r.html`
7798
+ `:e.viewMode==="grid"?o.html`
7611
7799
  <div class="collection-folders-grid">
7612
- ${k.map((E,A)=>r.html`
7800
+ ${k.map((E,A)=>o.html`
7613
7801
  <ap-collection-folder-card .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-card>
7614
7802
  `)}
7615
7803
  </div>
7616
- `:r.html`
7804
+ `:o.html`
7617
7805
  <div class="collection-folders-list">
7618
- ${k.map((E,A)=>r.html`
7806
+ ${k.map((E,A)=>o.html`
7619
7807
  <ap-collection-folder-row .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-row>
7620
7808
  `)}
7621
7809
  </div>
7622
- `}return!e.isLoading&&e.assets.length===0?r.html`
7810
+ `}return!e.isLoading&&e.assets.length===0?o.html`
7623
7811
  <div class="empty-state">
7624
7812
  <ap-icon name="folder" .size=${48}></ap-icon>
7625
7813
  <div class="empty-title">No assets in this collection folder</div>
7626
7814
  <div class="empty-desc">Assets matching this collection's criteria will appear here</div>
7627
7815
  </div>
7628
- `:e.viewMode==="grid"?r.html`
7816
+ `:e.viewMode==="grid"?o.html`
7629
7817
  <ap-grid-view
7630
7818
  .assets=${e.assets}
7631
7819
  .folders=${[]}
@@ -7634,13 +7822,13 @@
7634
7822
  .isLoading=${e.isLoading}
7635
7823
  .multiSelect=${((x=this.config)==null?void 0:x.multiSelect)??!0}
7636
7824
  .folderSelectable=${!1}
7637
- .gridSize=${((_=this.config)==null?void 0:_.gridSize)??"normal"}
7825
+ .gridSize=${((b=this.config)==null?void 0:b.gridSize)??"normal"}
7638
7826
  @asset-select=${this._handleAssetSelect}
7639
7827
  @asset-preview=${this._handleAssetPreview}
7640
7828
  @asset-quick-select=${this._handleQuickSelect}
7641
7829
  ></ap-grid-view>
7642
7830
  <div id="sentinel"></div>
7643
- `:r.html`
7831
+ `:o.html`
7644
7832
  <ap-list-view
7645
7833
  .assets=${e.assets}
7646
7834
  .folders=${[]}
@@ -7658,7 +7846,7 @@
7658
7846
  @selection-clear=${this._handleSelectionClear}
7659
7847
  ></ap-list-view>
7660
7848
  <div id="sentinel"></div>
7661
- `}return r.nothing}};Ms.styles=[r.css`
7849
+ `}return o.nothing}};Us.styles=[o.css`
7662
7850
  :host {
7663
7851
  display: contents;
7664
7852
  font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
@@ -7832,4 +8020,4 @@
7832
8020
  width: 100%;
7833
8021
  height: 100%;
7834
8022
  }
7835
- `];let Pe=Ms;At([l.state()],Pe.prototype,"_isDragOver");At([l.state()],Pe.prototype,"_isUploaderOpen");At([l.state()],Pe.prototype,"_folderResolveOpen");At([l.state()],Pe.prototype,"_transformOpen");At([l.property({type:Object})],Pe.prototype,"config");exports.AssetPicker=Pe;exports.addCdnParams=we;exports.buildTransformCdnParams=bs;exports.buildTransformedUrl=ha;exports.getAltText=Zi;exports.getAssetDimensions=Ji;exports.getAssetHeight=zt;exports.getAssetWidth=Dt;exports.getBestVideoUrl=sa;exports.getCdnUrl=ai;exports.getTranscodedUrl=ta;exports.isAudio=Xi;exports.isImage=Ne;exports.isTranscoded=ea;exports.isVideo=Wi;
8023
+ `];let ve=Us;je([l.state()],ve.prototype,"_isDragOver");je([l.state()],ve.prototype,"_isUploaderOpen");je([l.state()],ve.prototype,"_folderResolveOpen");je([l.state()],ve.prototype,"_transformOpen");je([l.state()],ve.prototype,"_createFolderOpen");je([l.state()],ve.prototype,"_isCreatingFolder");je([l.state()],ve.prototype,"_createFolderError");je([l.property({type:Object})],ve.prototype,"config");exports.AssetPicker=ve;exports.addCdnParams=ke;exports.buildTransformCdnParams=Cs;exports.buildTransformedUrl=ma;exports.getAltText=ia;exports.getAssetDimensions=aa;exports.getAssetHeight=Ht;exports.getAssetWidth=Vt;exports.getBestVideoUrl=na;exports.getCdnUrl=oi;exports.getTranscodedUrl=oa;exports.isAudio=sa;exports.isImage=qe;exports.isTranscoded=ra;exports.isVideo=ta;