PageSourceSearch

https://cha.fan/assets/DiffView.vue_vue_type_script_setup_true_lang-BfU3WaYz.js

js cha.fan collected 2026-09-25 21:50:13 UTC 8,045 bytes, 2 lines download raw bytes

1import{v as E,ae as K,w as V,H as S,c as j,M as ee}from"./index-DjJipepy.js";import{e as te}from"./SiteBtn.vue_vue_type_script_setup_true_lang-CXeFZt18.js";import{d as H,c as L,w as $,a as ne,q as se,z as oe,h as B,i as R,j as N,l as m,m as re,g as C,y as M,F as k,r as z,e as Z,t as W,f as ie}from"./vendor-CxandCH_.js";const Ce={async getPinnedQuestions(){return E.get("/discovery/pinned-questions/")},async getPendingQuestions(t){return E.get("/discovery/pending-questions/",V(t))},async getInterestingQuestions(t){return E.get("/discovery/interesting-questions/",V(t))},async getInterestingUsers(t){return E.get("/discovery/interesting-users/",V(t))},async getFeaturedAnswers(t,e,n){const o=new URLSearchParams;return o.append("skip",e.toString()),o.append("limit",n.toString()),E.get("/discovery/featured-answers/",K(t,o))}},ue=H({__name:"BaseCard",props:{flat:{type:Boolean,default:!1},divider:{type:Boolean,default:!1},noGutter:{type:Boolean,default:!1}},setup(t){const e=t,{theme:n}=S(),o=R(()=>({[n.value.baseCard.classKey]:!e.flat,"pa-2":!e.noGutter}));return(r,s)=>{const i=N("v-card"),u=N("v-divider"),a=N("v-sheet");return m(),L(a,null,{default:$(()=>[ne(i,se(r.$attrs,{class:o.value,flat:t.flat}),{default:$(()=>[oe(r.$slots,"default")]),_:3},16,["class","flat"]),t.divider?(m(),L(u,{key:0,class:"mt-3"})):B("",!0)]),_:3})}}}),ae={class:"text-body-1"},le={class:"mt-2"}
1,we=H({__name:"ExploreSitesGrid",setup(t){const e=j();function n(c,l){const p=new Set;return c.filter(h=>{const d=l(h);return p.has(d)?!1:p.add(d)})}const o=z([]),r=z(0),s=z([]),i=z(0),u=z(!0),a=R(()=>[o.value,s.value]);function f(c){const l=c.sub_site_maps?c.sub_site_maps.flatMap(p=>f(p)):[];return c.sites.concat(l)}return re(async()=>{await e.captureApiError(async()=>{const c=(await ee.getSiteMaps()).data;for(const l of c.site_maps)if(i.value>=r.value){const p=n(f(l),h=>h.uuid);o.value.push({topicName:l.topic.name,sites:p}),r.value+=p.length+5}else{const p=n(f(l),h=>h.uuid);s.value.push({topicName:l.topic.name,sites:p}),i.value+=p.length+5}i.value>=r.value?o.value.push({topicName:"未分类",sites:c.sites_without_topics}):s.value.push({topicName:"未分类",sites:c.sites_without_topics}),u.value=!1})}),(c,l)=>{const p=N("v-col"),h=N("v-row");return u.value?B("",!0):(m(),L(h,{key:0},{default:$(()=>[(m(!0),C(k,null,M(a.value,(d,y)=>(m(),L(p,{key:"col-"+y,class:"pb-2"},{default:$(()=>[(m(!0),C(k,null,M(d,_=>(m(),L(ue,{key:_.topicName,class:"px-2 py-4"},{default:$(()=>[Z("h3",ae,W(_.topicName),1),Z("div",le,[(m(!0),C(k,null,M(_.sites,g=>(m(),L(te,{key:g.uuid,showHotness:!0,site:g},null,8,["site"]))),128))])]),_:2},1024))),128))]),_:2},1024))),128))]),_:1}))}}});function w(){}w.prototype={diff:function(e,n){var o,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=r.callback;typeof r=="function"&&(s=r,r={}),this.options=r;var i=this;function u(v){return s?(setTimeout(function(){s(void 0,v)},0),!0):v}e=this.castInput(e),n=this.castInput(n),e=this.removeEmpty(this.tokenize(e)),n=this.removeEmpty(this.tokenize(n));var a=n.length,f=e.length,c=1,l=a+f;r.maxEditLength&&(l=Math.min(l,r.maxEditLength));var p=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+p,d=[{oldPos:-1,lastComponent:void 0}],y=this.extractCommon(d[0],n,e,0);if(d[0].oldPos+1>=f&&y+1>=a)return u([{value:this.join(n),count:n.length}]);var _=-1/0,g=1/0;function J(){for(var v=Math.max(_,-c);v<=Math.min(g,c);v+=2){var x=void 0,T=d[v-1],D=d[v+1];T&&(d[v-1]=void 0);var F=!1;if(D){var P=D.oldPos-v;F=D&&0<=P&&P<a}var U=T&&T.oldPos+1<f;if(!F&&!U){d[v]=void 0;continue}if(!U||F&&T.oldPos+1<D.oldPos?x=i.addToPath(D,!0,void 0,0):x=i.addToPath(T,void 0,!0,1),y=i.extractCommon(x,n,e,v),x.oldPos+1>=f&&y+1>=a)return u(ce(i,x.lastComponent,n,e,i.useLongestToken));d[v]=x,x.oldPos+1>=f&&(g=Math.min(g,v-1)),y+1>=a&&(_=Math.max(_,v+1))}c++}if(s)(function v(){setTimeout(function(){if(c>l||Date.now()>h)return s();J()||v()},0)})();else for(;c<=l&&Date.now()<=h;){var Q=J();if(Q)return Q}},addToPath:function(e,n,o,r){var s=e.lastComponent;return s&&s.added===n&&s.removed===o?{oldPos:e.oldPos+r,lastComponent:{count:s.count+1,added:n,removed:o,previousComponent:s.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:n,removed:o,previousComponent:s}}},extractCommon:function(e,n,o,r){for(var s=n.length,i=o.length,u=e.oldPos,a=u-r,f=0;a+1<s&&u+1<i&&this.equals(n[a+1],o[u+1]);)a++,u++,f++;return f&&(e.lastComponent={count:f,previousComponent:e.lastComponent}),e.oldPos=u,a},equals:function(e,n){return this.options.comparator?this.options.comparator(e,n):e===n||this.options.ignoreCase&&e.toLowerCase()===n.toLowerCase()},removeEmpty:function(e){for(var n=[],o=0;o<e.length;o++)e[o]&&n.push(e[o]);return n},castInput:function(e){return e},tokenize:function(e){return e.split("")},join:function(e){return e.join("")}};function ce(t,e,n,o,r){for(var s=[],i;e;)s.push(e),i=e.previousComponent,delete e.previousComponent,e=i;s.reverse();for(var u=0,a=s.length,f=0,c=0;u<a;u++){var l=s[u];if(l.removed){if(l.value=t.join(o.slice(c,c+l.count)),c+=l.count,u&&s[u-1].added){var h=s[u-1];s[u-1]=s[u],s[u]=h}}else{if(!l.added&&r){var p=n.slice(f,f+l.count);p=p.map(function(y,_){var g=o[c+_];return g.length>y.length?g:y}),l.value=t.join(p)}else l.value=t.join(n.slice(f,f+l.count));f+=l.count,l.added||(c+=l.count)}}var d=s[a-1];return a>1&&typeof d.value=="string"&&(d.added||d.removed)&&t.equals("",d.value)&&(s[a-2].value+=d.value,s.pop()),s}var X=/^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/,Y=/\S/,b=new w;b.equals=function(t,e){return this.options.ignoreCase&&(t=t.toLowerCase(),e=e.toLowerCase()),t===e||this.options.ignoreWhitespace&&!Y.test(t)&&!Y.test(e)};b.tokenize=function(t){for(var e=t.split(/([^\S\r\n]+|[()[\]{}'"\r\n]|\b)/),n=0;n<e.length-1;n++)!e[n+1]&&e[n+2]&&X.test(e[n])&&X.test(e[n+2])&&(e[n]+=e[n+2],e.splice(n+1,2),n--);return e};var G=new w;G.tokenize=function(t){this.options.stripTrailingCr&&(t=t.replace(/\r\n/g,`
2`));var e=[],n=t.split(/(\n|\r\n)/);n[n.length-1]||n.pop();for(var o=0;o<n.length;o++){var r=n[o];o%2&&!this.options.newlineIsToken?e[e.length-1]+=r:(this.options.ignoreWhitespace&&(r=r.trim()),e.push(r))}return e};function fe(t,e,n){return G.diff(t,e,n)}var pe=new w;pe.tokenize=function(t){return t.split(/(\S.+?[.!?])(?=\s+|$)/)};var de=new w;de.tokenize=function(t){return t.split(/([{}:;,]|\s+)/)};function I(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?I=function(e){return typeof e}:I=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(t)}var ve=Object.prototype.toString,q=new w;q.useLongestToken=!0;q.tokenize=G.tokenize;q.castInput=function(t){var e=this.options,n=e.undefinedReplacement,o=e.stringifyReplacer,r=o===void 0?function(s,i){return typeof i>"u"?n:i}:o;return typeof t=="string"?t:JSON.stringify(O(t,null,null,r),r,"  ")};q.equals=function(t,e){return w.prototype.equals.call(q,t.replace(/,([\r\n])/g,"$1"),e.replace(/,([\r\n])/g,"$1"))};function O(t,e,n,o,r){e=e||[],n=n||[],o&&(t=o(r,t));var s;for(s=0;s<e.length;s+=1)if(e[s]===t)return n[s];var i;if(ve.call(t)==="[object Array]"){for(e.push(t),i=new Array(t.length),n.push(i),s=0;s<t.length;s+=1)i[s]=O(t[s],e,n,o,r);return e.pop(),n.pop(),i}if(t&&t.toJSON&&(t=t.toJSON()),I(t)==="object"&&t!==null){e.push(t),i={},n.push(i);var u=[],a;for(a in t)t.hasOwnProperty(a)&&u.push(a);for(u.sort(),s=0;s<u.length;s+=1)a=u[s],i[a]=O(t[a],e,n,o,a);e.pop(),n.pop()}else i=t;return i}var A=new w;A.tokenize=function(t){return t.slice()};
2A.join=A.removeEmpty=function(t){return t};const me={key:0,class:"text-green"},he={key:1,class:"text-red"},xe=H({__name:"DiffView",props:{s1:{},s2:{}},setup(t){const e=t,n=R(()=>fe(e.s1,e.s2,{newlineIsToken:!0}));return(o,r)=>(m(),C("span",null,[(m(!0),C(k,null,M(n.value,(s,i)=>(m(),C("span",{key:i},[s.added?(m(),C("span",me,W(s.value),1)):B("",!0),s.removed?(m(),C("span",he,W(s.value),1)):B("",!0),r[0]||(r[0]=ie(" ... ",-1))]))),128))]))}});export{ue as _,Ce as a,we as b,xe as c};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.