PageSourceSearch

https://cdn.pacdora.com/_pacui/assets/useModels--g8QQh9ZUt.js

js pacdora.com collected 2026-10-03 22:13:35 UTC 9,762 bytes, 1 lines download raw bytes

1import{$t as e,At as t,Q as n,ct as r,ki as i,nt as a}from"./src-D9GYhO4rRw.js";import{$ as o,an as s,ft as c}from"./vue-DR-_0DQxXA.js";import{d as l,l as u,o as d}from"./pacdora-3d-wnulKoNRJ_.js";import{n as f,t as p,y as m}from"./boxMaterialSpherePresetApplier-DreQocAhqt.js";import{t as h}from"./AppEmitter-dnlzq1LHt6.js";import{C as g,S as _,h as v,v as y,w as b,x}from"./api-B8Y66gIssQ.js";import{r as S}from"./useLight-DlEsQrAoWs.js";import{t as C}from"./RegExpReplace-CucgiHptzd.js";function w(...e){return e.find(e=>e!=null&&e!==``)}function T(e){let t=Number(e);return Number.isFinite(t)&&t>0?t:0}function E(e){if(!e)return{};if(typeof e==`object`&&!Array.isArray(e))return e;if(typeof e!=`string`)return{};try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:{}}catch{return{}}}function D(e){let t=String(e||``);return t.startsWith(`cm_`)?t:void 0}var O=32,k=(e,n)=>{let r=document.createElement(`img`);return r.src=t(e,{width:O,height:O}),r.style.position=`fixed`,r.style.width=`${O}px`,r.style.height=`${O}px`,r.style.transform=`translate(-50%, -50%)`,r.style.left=`${n.clientX}px`,r.style.top=`${n.clientY}px`,r.style.zIndex=`10`,r.style.opacity=`0`,r.style.pointerEvents=`none`,r.style.borderRadius=`4px`,r},A=e=>{var t,n;let r=document.createElement(`div`),a=o(i,{borderSize:2.5,borderColor:`var(--loading-color)`});r.style.cssText=e.style.cssText,r.style.display=`flex`,r.style.flexDirection=`column`,r.style.justifyContent=`center`,r.style.alignItems=`center`,document.body.appendChild(r),a.mount(r);let s=document.createElement(`div`);return s.textContent=`Loading...`,s.style.color=`var(--reverse-color)`,s.style.fontSize=`14px`,s.style.lineHeight=`21px`,s.style.marginTop=`8px`,r.appendChild(s),(t=e.parentNode)==null||t.appendChild(r),(n=e.parentNode)==null||n.removeChild(e),r};async function j(e,t,r){try{var i;let o=await a(n),s=k(t,e);document.body.appendChild(s),(i=o.transformControls)==null||i.createAdsorptionMesh(),o.floor.initDragPlane({borderColor:`#73D1BE`,contentColor:`#51FEE3`,contentOpacity:.1}),document.onmousemove=e=>(o.control.controlsMouseDown=!0,s.style.opacity=`1`,s.style.left=`${e.clientX}px`,s.style.top=`${e.clientY}px`,o.targetElement.contains(e.target)&&o.floor.setDragPlane(e,!0),!1),document.onmouseup=async e=>{var t,n;if(document.onmousemove=null,document.onmouseup=null,o.floor.setDragPlane(e,!1),!((t=document.getElementById(`render-canavas`))!=null&&t.contains(e.target))){var i;return(i=s.parentNode)==null?void 0:i.removeChild(s)}let a=A(s);await r(),(n=a.parentNode)==null||n.removeChild(a),o.control.controlsMouseDown=!1}}catch(e){console.error(e)}finally{h.emit(`model-click-loading`,!1),h.emit(`change:recommendColor`,{})}}var M=async e=>await b({blankSettingId:e.blankSettingId,project_id:e.id,globalDesignList:e.globalDesignList,layer:e.layer,user_data:e.user_data}),N=s(),P=s(),F=s(new Map),I=c(()=>{var e;return((e=N.value)==null?void 0:e.cate)&&N.value.cate.complex_type===1}),L=c(()=>{var e,t,n;let r=String(((e=N.value)==null||(e=e.cate)==null?void 0:e.cate_no)??``),i=N.value;return!!(r===`custom-dieline`||i!=null&&i.isCustomModel||i!=null&&i.customModelId||(i==null||(t=i.user_data)==null?void 0:t.source)===`custom-model`||(i==null||(n=i.knife_data)==null?void 0:n.source)===`custom-model`)}),R=c(()=>{var e;return r((e=P.value)==null?void 0:e.modeCate)}),z=c(()=>{var e;return((e=P.value)==null||(e=e.modeCate)==null?void 0:e.code)===`SoftPacking`}),B=s(`library`),V=s(!1),H=s(!1);function U(e){return JSON.parse(JSON.stringify(e))}function W(e){var t;let n=e==null||(t=e.project)==null||(t=t.user_data)==null?void 0:t.materialSetting;return!!n&&typeof n==`object`&&Object.keys(n).length>0}function G(e){var t,n;return(e==null||(t=e.knife)==null||(t=t.modeCate)==null?void 0:t.code)===`SoftPacking`||(e==null||(n=e.project)==null||(n=n.cate)==null?void 0:n.code)===`SoftPacking`}function K(){let{addModel:t,replaceModel:r,getModelProjectData:i}=m(n),o=async e=>{if(Object.hasOwnProperty.call(e,`keyword`)&&e.keyword&&(e.keyword=C(e.keyword).trim(),!e.keyword))return Promise.resolve({data:[],total:0});let t=e.imageUrl?await _(e):await x(e);return{data:t.data.map(t=>{var n;let r=(n=t.modeSetting)==null?void 0:n.map(e=>({name:e.material,cover:e.image,id:e.id})).reduce((e,t)=>
1e.some(e=>e.name===t.name)?e:[...e,t],[]);return{id:t.id,url:t.image,modelSetting:r,activeModelSetting:r==null?void 0:r[0],mockupNameKey:t.mockupNameKey,dielineNameKey:t.nameKey,current:e.current,displaySetting:t.cate_info.displaySetting}}),total:t.total}},{logined:s}=e(),c=async e=>{if(!s.value)return{data:[],total:0};let t=await g(e);return{data:t.data.map(e=>{let t=E(e.user_data||e.userData),n=E(e.knife_data||e.knifeData),r=e.bridge||t.bridge||n.bridge||{},i=T(w(e.id,e.projectId,e.project_id,r.projectId)),a=Number(w(e.custom_model_id,t.customModelId,n.customModelId)),o=Number(e.cate_id??e.cateId)===0||a>0,s=w(e.mockupNameKey,e.virtualMockupNameKey,r.virtualMockupNameKey,n.virtualMockupNameKey,t.mockupNameKey,t.virtualMockupNameKey),c=w(e.nameKey,e.dielineNameKey,e.virtualNameKey,r.virtualNameKey,n.virtualNameKey,t.nameKey,t.virtualNameKey,s),l=w(D(e.customModelId),e.customModelPublicId,D(t.customModelId),t.customModelPublicId,n.customModelPublicId),u=w(e.editorUrl,e.url,t.editorUrl,t.customModelUseUrl),d=!!(e.isCustomModel||o||l||n.source===`custom-model`||t.source===`custom-model`||s!=null&&s.startsWith(`custom-mockup-`)),f={id:i,url:w(e.screenshot,e.cover,e.image)||``,mockupNameKey:s||``,dielineNameKey:c||``};return d&&(f.isCustomModel=!0),l&&(f.customModelId=l),u&&(f.editorUrl=u),f}),total:t.total}},h=async(e={pageSize:20,current:1,cateId:void 0})=>{let t=await y({...e,cateId:(e.cateId||-1)<0?void 0:e.cateId});return{data:t.data.map(e=>({id:e.id,url:e.cover,type:u.Decorator,cover:e.cover,cateId:e.cateId})),total:t.total}},b=async(e={pageSize:20,current:1})=>{let t=await v({...e,meshType:`base`});return{data:t.data.map(e=>({id:e.id,url:e.cover,type:u.Base,filePath:e.filePath,cover:e.cover,cateId:e.cateId})),total:t.total??t.data.length}},O=async e=>{let t=await a(n);t.model.group.children.length===1&&e&&t.focusObject3D(e,4.5,0,!1)},{applyLightInMaterialSetting:k,washRenderModelSettingSunLight:A}=S(),j=async(e,t)=>{let n=JSON.parse(JSON.stringify(t));if(e===u.Project&&n.modelSetting){var r;let e=await A((r=n.modelSetting)==null||(r=r.d3Params)==null?void 0:r.sunLight);n.modelSetting.d3Params.sunLight=e}return n},M=async(e,t)=>{if((await a(n)).model.group.children.length===0){let n=t.modelSetting;if(e===`add`&&n){let e=n.d3Params.envLight,t=n.d3Params.sunLight;await k({envLight:e,sunLight:t})}else if(e===`replace`){var r;let e=t;await k(e==null||(r=e.userData)==null?void 0:r.lightInMaterialSetting,e)}}},F=async(e,t)=>{var r,i;if(e!==u.Project)return;let o=t;o!=null&&o.project&&(G(o)||await p({D3:await a(n),projectData:o.project,knifeData:o.knife,material:{material:(r=o.modelSetting)==null?void 0:r.material,name:(i=o.modelSetting)==null?void 0:i.material}}))},I=(e,t)=>{var n,r;if(e!==u.Project)return t;let i=t;if(!(i!=null&&i.project)||G(i))return t;let a={material:(n=i.modelSetting)==null?void 0:n.material,name:(r=i.modelSetting)==null?void 0:r.material};return{...i,project:f({projectData:i.project,knifeData:i.knife,material:a,withMaterialSetting:!0})}},L=async(e,t,r)=>{var i,o,s,c;if(e!==u.Project)return!1;let l=t;if(!(l!=null&&l.project)||!G(l))return!1;let d=(i=l.project.user_data)==null?void 0:i.materialSetting;
1if(!d||!W(l))return!1;let f=await a(n),p=r??((o=f.model)==null||(s=o.getModel)==null?void 0:s.call(o,`${l.project.id}`)),m=U(d);if(p!=null&&p.setMaterialSetting)await p.setMaterialSetting(m,!1);else if(l.project.id){var h,g;await((h=f.material)==null||(g=h.setMaterialSetting)==null?void 0:g.call(h,`${l.project.id}`,m))}else return!1;return l.project.user_data={...l.project.user_data||{},materialSetting:U(m)},p!=null&&p.project&&(p.project.user_data={...p.project.user_data||{},materialSetting:U(m)}),((c=f.model)==null?void 0:c.selectedModel)===p&&await f.model.emitModelSelect(!0),f.needRenderOnce=!0,!0},R=async(e,r,i=!1,o=!0)=>{var s,c;let l=I(e,await j(e,r));await M(`add`,l);let u=await a(n),d=l;!(d==null||(s=d.project)==null||(s=s.cate)==null||(s=s.otherFaces)==null)&&s.length&&(d==null||(c=d.project)==null||(c=c.cate)==null||(c=c.otherFaces)==null?void 0:c.length)>0?u.showModelMainFaceInfoWithAi=!0:u.showModelMainFaceInfoWithAi=!1;let f=await t(e,l,i,o);return await F(e,l),await L(e,l,f),await O(f),f},z=async(e,t)=>{let r=I(e,await j(e,t)),i=await a(n);return i.model.group.children.length===1&&t.modelSetting&&await i.light.getEnvMap(t.modelSetting.d3Params.envLight.envUrl),[r,async e=>{await M(`replace`,e)}]},B=async(e,t)=>{var i,o;let[s,c]=await z(e,t),l=await a(n),u=s;!(u==null||(i=u.project)==null||(i=i.cate)==null)&&i.otherFaces&&(u==null||(o=u.project)==null||(o=o.cate)==null||(o=o.otherFaces)==null?void 0:o.length)>0?l.showModelMainFaceInfoWithAi=!0:l.showModelMainFaceInfoWithAi=!1;let d=await r(e,s,c);await F(e,s),await L(e,s,d),await O(d)},V=e=>e==null||Object.keys(e).length===0;return{getModels:o,getMyDesignModels:c,getModelProjectData:i,addModel:R,replaceModel:B,getDecorators:h,getBases:b,project:N,knife:P,hasDesign:async()=>(await a(n)).model.group.children.some(e=>{if((e instanceof l||e instanceof d)&&e.project){let r=e.project,i=Object.keys(r.layer);for(let e of i){var t,n;if(!(r==null||(t=r.layer[e].design_list)==null)&&t.filter(e=>!e._is_temporary_data).length||!(r==null||(n=r.layer[e].inside_design_list)==null)&&n.length||r!=null&&r.layer[e].background&&(r==null?void 0:r.layer[e].background)!==`#ffffff`||!V(r==null?void 0:r.layer[e].face_background))return!0}}return!1})}}export{L as a,B as c,K as d,I as i,F as l,j as n,R as o,H as r,z as s,V as t,M as u};

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.