pocketbase/ui/dist/assets/autocomplete.worker-SdNqUZM...

5 lines
90 KiB
JavaScript
Raw Normal View History

2025-04-20 18:51:37 +08:00
(function(){"use strict";class Y extends Error{}class Yn extends Y{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}}class Jn extends Y{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}}class Bn extends Y{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}}class j extends Y{}class ft extends Y{constructor(e){super(`Invalid unit ${e}`)}}class x extends Y{}class U extends Y{constructor(){super("Zone is an abstract class")}}const c="numeric",W="short",I="long",Se={year:c,month:c,day:c},dt={year:c,month:W,day:c},Gn={year:c,month:W,day:c,weekday:W},ht={year:c,month:I,day:c},mt={year:c,month:I,day:c,weekday:I},yt={hour:c,minute:c},gt={hour:c,minute:c,second:c},pt={hour:c,minute:c,second:c,timeZoneName:W},wt={hour:c,minute:c,second:c,timeZoneName:I},St={hour:c,minute:c,hourCycle:"h23"},kt={hour:c,minute:c,second:c,hourCycle:"h23"},Tt={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:W},Ot={hour:c,minute:c,second:c,hourCycle:"h23",timeZoneName:I},Nt={year:c,month:c,day:c,hour:c,minute:c},Et={year:c,month:c,day:c,hour:c,minute:c,second:c},xt={year:c,month:W,day:c,hour:c,minute:c},bt={year:c,month:W,day:c,hour:c,minute:c,second:c},jn={year:c,month:W,day:c,weekday:W,hour:c,minute:c},vt={year:c,month:I,day:c,hour:c,minute:c,timeZoneName:W},It={year:c,month:I,day:c,hour:c,minute:c,second:c,timeZoneName:W},Mt={year:c,month:I,day:c,weekday:I,hour:c,minute:c,timeZoneName:I},Dt={year:c,month:I,day:c,weekday:I,hour:c,minute:c,second:c,timeZoneName:I};class ae{get type(){throw new U}get name(){throw new U}get ianaName(){return this.name}get isUniversal(){throw new U}offsetName(e,t){throw new U}formatOffset(e,t){throw new U}offset(e){throw new U}equals(e){throw new U}get isValid(){throw new U}}let We=null;class ke extends ae{static get instance(){return We===null&&(We=new ke),We}get type(){return"system"}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return nn(e,t,n)}formatOffset(e,t){return ce(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type==="system"}get isValid(){return!0}}const Ce=new Map;function Kn(r){let e=Ce.get(r);return e===void 0&&(e=new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:r,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",era:"short"}),Ce.set(r,e)),e}const Hn={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function Qn(r,e){const t=r.format(e).replace(/\u200E/g,""),n=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(t),[,s,i,a,o,u,l,f]=n;return[a,s,i,o,u,l,f]}function _n(r,e){const t=r.formatToParts(e),n=[];for(let s=0;s<t.length;s++){const{type:i,value:a}=t[s],o=Hn[i];i==="era"?n[o]=a:g(o)||(n[o]=parseInt(a,10))}return n}const Le=new Map;class $ extends ae{static create(e){let t=Le.get(e);return t===void 0&&Le.set(e,t=new $(e)),t}static resetCache(){Le.clear(),Ce.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat("en-US",{timeZone:e}).format(),!0}catch{return!1}}constructor(e){super(),this.zoneName=e,this.valid=$.isValidZone(e)}get type(){return"iana"}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return nn(e,t,n,this.name)}formatOffset(e,t){return ce(this.offset(e),t)}offset(e){if(!this.valid)return NaN;const t=new Date(e);if(isNaN(t))return NaN;const n=Kn(this.name);let[s,i,a,o,u,l,f]=n.formatToParts?_n(n,t):Qn(n,t);o==="BC"&&(s=-Math.abs(s)+1);const k=xe({year:s,month:i,day:a,hour:u===24?0:u,minute:l,second:f,millisecond:0});let m=+t;const N=m%1e3;return m-=N>=0?N:1e3+N,(k-m)/(60*1e3)}equals(e){return e.type==="iana"&&e.name===this.name}get isValid(){return this.valid}}let Ft={};function Xn(r,e={}){const t=JSON.stringify([r,e]);let n=Ft[t];return n||(n=new Intl.ListFormat(r,e),Ft[t]=n),n}const Re=new Map;function $e(r,e={}){const t=JSON.stringify([r,e]);let n=Re.get(t);return n===void 0&&(n=new Intl.DateTimeFormat(r,e),Re.set(t,n)),n}const Ue=new Map;function er(r,e={}){con
`),t+=n.map(s=>{let i="";return s.name.includes("(")||s.name.includes(" ")?i+=s.name:i+="`"+s.name+"`",s.collate&&(i+=" COLLATE "+s.collate),s.sort&&(i+=" "+s.sort.toUpperCase()),i}).join(`,
`),n.length>1&&(t+=`
`),t+=")",e.where&&(t+=` WHERE ${e.where}`),t}static replaceIndexTableName(e,t){const n=d.parseIndex(e);return n.tableName=t,d.buildIndex(n)}static replaceIndexColumn(e,t,n){if(t===n)return e;const s=d.parseIndex(e);let i=!1;for(let a of s.columns)a.name===t&&(a.name=n,i=!0);return i?d.buildIndex(s):e}static normalizeSearchFilter(e,t){if(e=(e||"").trim(),!e||!t.length)return e;const n=["=","!=","~","!~",">",">=","<","<="];for(const s of n)if(e.includes(s))return e;return e=isNaN(e)&&e!="true"&&e!="false"?`"${e.replace(/^[\"\'\`]|[\"\'\`]$/gm,"")}"`:e,t.map(s=>`${s}~${e}`).join("||")}static normalizeLogsFilter(e,t=[]){return d.normalizeSearchFilter(e,["level","message","data"].concat(t))}static initSchemaField(e){return Object.assign({id:"",name:"",type:"text",system:!1,hidden:!1,required:!1},e)}static triggerResize(){window.dispatchEvent(new Event("resize"))}static getHashQueryParams(){let e="";const t=window.location.hash.indexOf("?");return t>-1&&(e=window.location.hash.substring(t+1)),Object.fromEntries(new URLSearchParams(e))}static replaceHashQueryParams(e){e=e||{};let t="",n=window.location.hash;const s=n.indexOf("?");s>-1&&(t=n.substring(s+1),n=n.substring(0,s));const i=new URLSearchParams(t);for(let u in e){const l=e[u];l===null?i.delete(u):i.set(u,l)}t=i.toString(),t!=""&&(n+="?"+t);let a=window.location.href;const o=a.indexOf("#");o>-1&&(a=a.substring(0,o)),window.location.replace(a+n)}}const ut=11e3;onmessage=r=>{var t,n;if(!r.data.collections)return;const e={};e.baseKeys=d.getCollectionAutocompleteKeys(r.data.collections,(t=r.data.baseCollection)==null?void 0:t.name),e.baseKeys=ct(e.baseKeys.sort(lt),ut),r.data.disableRequestKeys||(e.requestKeys=d.getRequestAutocompleteKeys(r.data.collections,(n=r.data.baseCollection)==null?void 0:n.name),e.requestKeys=ct(e.requestKeys.sort(lt),ut)),r.data.disableCollectionJoinKeys||(e.collectionJoinKeys=d.getCollectionJoinAutocompleteKeys(r.data.collections),e.collectionJoinKeys=ct(e.collectionJoinKeys.sort(lt),ut)),postMessage(e)};function lt(r,e){return r.length-e.length}function ct(r,e){return r.length>e?r.slice(0,e):r}})();